Objektorientierung (CP): Unterschied zwischen den Versionen

Aus Philo Wiki
Wechseln zu:Navigation, Suche
K (add content)
K (add content)
Zeile 1: Zeile 1:
 +
 +
== Vorgänger ==
 +
 +
=== Überblick ===
 +
 +
[http://4loc.wordpress.com/2008/12/09/20th-and-21st-century-software-engineering/ 4 Lines of Code]
 +
 +
 +
 +
=== Sequential Programming ===
 +
 +
 +
[http://www.transtutors.com/homework-help/C+Language/Control+Flow+Structures/sequential-programming.aspx Definition]:
 +
 +
Sequential programming can also be called linear programming. The sequential programs are non-modular in nature. That is, reusability of code is not possible. Thus, they are difficult to maintain and understand.
 +
 +
Consider an example of finding the circumference and area of a circle. The circumference of a circle is given by the formula 2*pi*r and the area of the circle is found out using the formula pi*r*r, where is the radius of the circle and pi is a constant. Thus, in this case,the objective is simple. That is, the tasks that are to be performed include
 +
 +
•    Getting the input from the use (radius, in this case).
 +
 +
•    Reading the value.
 +
 +
•    Manipulating the required result and
 +
 +
•    Printing the result.
 +
 +
•    Hence, one can understand that the objective is clear and therefore. The program will have statements that are placed sequentially and there is no decision involved in the process. Also, the program does not require a specific task to be repeated over and over again.
 +
 +
 +
=== Procedural programming ===
 +
 +
[http://www.wordiq.com/definition/Procedural_programming Definition]:
 +
 +
Procedural programming is a programming paradigm based upon the concept of the modularity and scope of program code (i.e., the data viewing range of an executable code statement). A main procedural program is composed of one or more modules (also called packages or units), either coded by the same programmer or pre-coded by someone else and provided in a code library.
 +
 +
Each module is composed of one or more subprograms (which may consist of procedures, functions, subroutines or methods, depending on programming language). It is possible for a procedural program to have multiple levels or scopes, with subprograms defined inside other subprograms. Each scope can contain names which cannot be seen in outer scopes.
 +
 +
Procedural programming offers many benefits over simple sequential programming since procedural code:
 +
 +
    * is easier to read and more maintainable
 +
    * is more flexible
 +
    * facilitates the practice of good program design
 +
 +
 +
=== Übergang zur Objektorientierung ===
 +
 +
[http://www.cpp-home.com/archives/206.htm C++ Tutorial]
 +
 +
 +
 
== [http://download.oracle.com/javase/tutorial/java/concepts/ The Java Tutorials] ==
 
== [http://download.oracle.com/javase/tutorial/java/concepts/ The Java Tutorials] ==
  

Version vom 10. Dezember 2010, 07:29 Uhr

Vorgänger

Überblick

4 Lines of Code


Sequential Programming

Definition:

Sequential programming can also be called linear programming. The sequential programs are non-modular in nature. That is, reusability of code is not possible. Thus, they are difficult to maintain and understand.

Consider an example of finding the circumference and area of a circle. The circumference of a circle is given by the formula 2*pi*r and the area of the circle is found out using the formula pi*r*r, where is the radius of the circle and pi is a constant. Thus, in this case,the objective is simple. That is, the tasks that are to be performed include

• Getting the input from the use (radius, in this case).

• Reading the value.

• Manipulating the required result and

• Printing the result.

• Hence, one can understand that the objective is clear and therefore. The program will have statements that are placed sequentially and there is no decision involved in the process. Also, the program does not require a specific task to be repeated over and over again.


Procedural programming

Definition:

Procedural programming is a programming paradigm based upon the concept of the modularity and scope of program code (i.e., the data viewing range of an executable code statement). A main procedural program is composed of one or more modules (also called packages or units), either coded by the same programmer or pre-coded by someone else and provided in a code library.

Each module is composed of one or more subprograms (which may consist of procedures, functions, subroutines or methods, depending on programming language). It is possible for a procedural program to have multiple levels or scopes, with subprograms defined inside other subprograms. Each scope can contain names which cannot be seen in outer scopes.

Procedural programming offers many benefits over simple sequential programming since procedural code:

   * is easier to read and more maintainable
   * is more flexible
   * facilitates the practice of good program design 


Übergang zur Objektorientierung

C++ Tutorial


The Java Tutorials

An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. This lesson explains how state and behavior are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner.

A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behavio

Inheritance provides a powerful and natural mechanism for organizing and structuring your software. This section explains how classes inherit state and behavior from their superclasses, and explains how to derive one class from another using the simple syntax provided by the Java programming language.