CS 441 Programming Languages: Design and Implementation

Fall2003


Project #4 Group Members

 

Name

Personal Website

Email

Ahmad Ibrawish

http://a.students.umkc.edu/atic9f/ 

atic9f@umkc.edu 

Afrazuddin Mohammad

http://a.students.umkc.edu/azm150 

azm150@umkc.edu 

Neal Bellamy

http://n.students.umkc.edu/nlb477/index.html 

nlb477@umkc.edu

Nghi Phan

http://p.students.umkc.edu/phann/ 

phann@umkc.edu 

     

 

Object Oriented vs. Functional

 

I.                   History

Object-oriented languages were developed to model the problem domains closer than earlier imperative languages. They also provide more abstraction and information hiding.  Most of the languages are for general purpose programming where the solution is found by taking some input and providing some output through manipulation. The input is well defined and specific. 

Functional languages were started in the 1950’s to provide the computer with some ‘intelligence’. The programs were made to accept many different inputs and decide what to do with it. Most of these languages are based on recognizing one of several conditions and doing whatever is defined by the rule.

 

II.                Overview of Language (application areas, etc.)

Object-oriented languages usually have more applications and it is looked as being more robust.  The features of object-oriented language application have inheritance, abstract data types and dynamic bindings.  Object-oriented language applications are used in solving problems where it uses the objects and the processing of those objects to render and link between them, thus making object-oriented language application very effective.

Functional languages are primary used in Artificial Intelligence where its functional application is done with function argument statements.  Unlike object-oriented languages, functional languages depend heavily on recursion that can be unnecessary at times.  Also, functional languages do not have variables, assignment statements, and no iterative constructs.  The functional languages is based on the concept of mathematical functions

 

III.             Handling of data objects

            Object-oriented languages have many data objects, including built-in data objects like integers, characters etc. and user defined data objects. These objects can be passed from function to function and manipulated through the program.  Most Object-oriented languages have several scopes for their objects. For instance C++ has, Local, Global and Static scope, allowing different variables to be hidden from other functions and classes, have the value remembered between calls, of completely open to other functions a classes respectively.

            Functional languages however have few data objects.  Some languages like 5 however have few data objects.  Some languages like LISP only have 2 data types an Atom and a list comprised of atoms or other lists. Most Functional languages are not or loosely typed. In LISP an atom can contain one of several types of data. In general the data objects are in global or some other fixed scope.

  

IV.             Handling of sequence control

The handling of sequence control for object-oriented language is handled by the object itself where the data is stored inside the object.  The differences between object-oriented and functional languages are that object-oriented make changes and manipulations of data through the object instead of the program.

Functional language uses a simple sequence control structure that is implicit similar to that of LISP unlike object-oriented that uses Top-Down statement sequence.  Functional languages do not use variables, assignment statements, or iterative constructs (which is controlled by the variables) and functional languages handling of repetition is through the use of recursion.

 

V.                Handling of subprograms and storage management

Object-oriented languages use subroutines. Some of the languages of this family must have definitions for the subroutines others do not. In general the subroutines define an action to be taken out of the scope of the main program. These subroutines also allow parameter passing and a return value if needed.

Storage management is handled differently in each of these languages. Java, for instance, has it’s own garbage collection scheme that runs independently of the program. However C++ programs must call for garbage collection explicitly.

Functional languages use sub-routines as well. However they are used in a different manner.  Most of the function calls are used in recursion rather than all being called from one routine.

              Most functional languages include Garbage collection in the language. Allowing the programmers to worry about the problem domain and not memory allocation. Some functional languages like Scheme allow some control over the garbage collection process.

 

VI.             Handling of abstraction and encapsulation

Handling of abstraction and encapsulation for object-oriented language is done through the use of classes since classes can be defined as an abstraction for a collection of data and/or operations, which give object-oriented languages the ability to have high-level of abstraction and encapsulation.

In contrast to functional languages, it does not have classes therefore abstraction and encapsulation handling is not possible.  Because of this, the data structure is different than that of object-oriented.

 

 

 

Object Oriented vs. Logic

 

I.                   History

Object-oriented languages were developed to model the problem domains closer than earlier imperative languages. They also provide more abstraction and information hiding.  Most of the languages are for general purpose programming where the solution is found by taking some input and providing some output through manipulation. The input is well defined and specific.

Logic languages were designed to produce programs that solve problems given only the rules of the problem domain and the definition of a valid solution. While every problem could be represented this way, Logic based programs are very inefficient and use extensive processing power.  This limits the ability of Functional language to small programs.

 

II.                Overview of Language (application areas, etc.)

Object-oriented languages usually have more applications and it is looked as being more robust.  The features of object-oriented language application have inheritance, abstract data types and dynamic bindings.  Object-oriented language applications are used in solving problems where it uses the objects and the processing of those objects to render and link between them, thus making object-oriented language application very effective.

Logic language applications uses set of rules or goals which tells the system what is true and what is not true and what it need to do next from there rather than telling the system how to do it.  This type of language application is focused more on the problem solving side of things rather than on the specific of coding the program.

 

III.             Handling of data objects

             Object-oriented languages have many data objects, including built-in data objects like integers, characters etc. and user defined data objects. These objects can be passed from function to function and manipulated through the program.  Most Object-orinted languages have several scopes for their objects. For instance C++ has, Local, Global and Static scope, allowing different variables to be hidden from other functions and classes, have the value remembered between calls, of completely open to other functions a classes respectively.

             Logic language’s data objects are relatively small compared to Object-oriented data objects. For instance Prolog only has six different data objects with no possible extension. There is a global scope on Logic data objects.

 

IV.             Handling of sequence control

The handling of sequence control for object-oriented language is handled by the object itself where the data is stored inside the object.  The differences between object-oriented and logic languages are the control flow.  Since object-oriented is a procedural, it has a standard control flow of Top-Down while logic is non-procedural and lack the standard control.

With the logic language lacking the control flow, it also adds the inefficiency to the language.

 

V.                Handling of subprograms and storage management

Object-oriented languages use subroutines. Some of the languages of this family must have definitions for the subroutines others do not. In general the subroutines define an action to be taken out of the scope of the main program. These subroutines also allow parameter passing and a return value if needed.

Storage management is handled differently in each of these languages. Java, for instance, has it’s own garbage collection scheme that runs independently of the program. However C++ programs must call for garbage collection explicitly.

Most logic program use functions or Sub-routines. They are used to discover whether a scenario passes a particular rule, or if the answer given is a possible solution to the problem at hand.

Most Logic languages also include garbage collection. Since Logic programs are recursive by nature and have to store a backtracking information, Garbage collection is necessary. Usually garbage collection is performed in the background allowing the programmer to work on the problem domain.

 

VI.             Handling of abstraction and encapsulation

The handling of abstraction and encapsulation for object-oriented and logic languages are very similar in that they all uses modules to implement abstraction and encapsulation.  One noticeable difference between the two languages is that object-oriented language has a strongly typed language whereas logic is not as strict.  So, a type checking is required for object-oriented language because of the usage of a strong typed.

Object-oriented language encapsulation works by grouping the data and the operations together with classes and logic doesn’t encapsulate the same way.  For logic, the modules are used for grouping segments together and it has the ability to hide the details.

 

 

 

References

Functional Programming, ftp://ftp.aw.com/cseng/authors/finkel/apld/finkel04.pdf

http://www.fh-jena.de/~kleine/history/

http://www.cs.ucsd.edu/classes/fa02/cse150/lectures-pdf/lec7.pdf

http://www.cs.ucsd.edu/classes/fa02/cse150/lectures-pdf/lec7.pdf

http://math.uww.edu/

“Abstract Data Types”. Department of Information and Computer Sciences. University of Hawai at Manoa. n. d. 9 Nov 2003. http://lilt.ics.hawaii.edu/classes/ICS313/313-Ch-11.ppt

http://www.en2.wikipedia.org

http://www.threedee.com/jcm

Sebesta, Robert (2002). Concepts of Programming Languages. 5th Ed, Addison-. Wesley Publishing, CA.

Object-Oriented Software Engineering with Eiffel by Jean-Marc Jezequel, http://www.irisa.fr/pampa/EPEE/oosewe.pdf

http://www.docm.mmu.ac.uk/library/notes/ajt/chapter12.html

Concepts of Programming Languages, 6th Ed, Robert W. Sebesta

http://kti.ms.mff.cuni.cz/~bartak/prolog/learning.html

Bowers, Shawn, Ph.D University of Oregon, www.capital.ous.edu/~bowerss/cst426/lecture4-2up.pdf, 2003

Chang Y. and Cox P. “Storage management in a Prolog Compiler”. New York: ACM Press, 1986. http://80-delivery.acm.org.ezproxy.mnl.umkc.edu/10.1145/330000/322747/p43-chang.pdf?key1=322747&key2=6457148601&coll=ACM&dl=ACM&CFID=13797352&CFTOKEN=37926521

Clocksin, W.F. & C.S. Mellish “Programming in Prolog”, Springer, 1985

Diaz, Daniel.  “GNU PROLOG: A Native Prolog Compiler with Constraint Solving over

            Finite Domains.”  2002, Sept. 25.  Edition 1.7

            http://pauillac.inria.fr/~diaz/gnu-prolog/manual/index.html

            http://pauillac.inria.fr/~diaz/gnu-prolog/manual/manual022.html#toc41

Eadline, Douglas, “Making Prolog Parallel”, Paralogic, 1995

Hancox, Peter, Ph.D, University of Birmingham, www.cs.bham.ac.uk/~pjh/prolog_course/md1/md1_data_types.html, October 1998.

Huntbach Matthew. “Notes on Prolog”. Department of Computer Science. Queen Mary University. n. d. 6 Nov 2003. http://www.dcs.qmw.ac.uk/~mmh/AINotes/.

Luger, George. “Artificial Intelligence: Structures and Strategies for Complex Problem Solving.”. 4th ed. New York: Addson Wesley, 2002.

Massicotte, Pierre, Ph.D, Simon Fraser University, www.cs.sfu.ca/CC/SW/Prolog/Notes/syntax.html, 2003

 

Matuszek, David. “Programming Languages: The Beginning”. Department of Computing Sciences. Villanova University. n. d. 6 Nov 2003. http://www.csc.vill.edu/~dmatusze/resources/ general/beginning

Sebesta, Robert. “Concepts of Programming Languages”. 5th ed. New        York: Addison            Wesley, 2002

Wielemaker, Jan. “SWI-Prolog 5.2 Reference Manual”. Prolog. Oct 2003. 9 Nov 2003.

http://www.swi-prolog.org/

http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

http://www.cs.utexas.edu/users/lavender/courses/cs386/lectures/CS386L-Lecture-06.pdf

http://www.cs.sjsu.edu/~fecteau/cs140/SubroutinesI.html