Objektorientierung (CP): Unterschied zwischen den Versionen

Aus Philo Wiki
Wechseln zu:Navigation, Suche
K (add content)
(Überblick)
Zeile 8: Zeile 8:
 
[[Bild:se3.gif]]
 
[[Bild:se3.gif]]
 
</div>
 
</div>
 +
 +
Noch ein [http://www.nytimes.com/2010/04/27/world/27powerpoint.html?_r=1 bekanntes] Beispiel: "“When we understand that slide, we’ll have won the war,” General McChrystal dryly remarked, one of his advisers recalled, as the room erupted in laughter." --[[Benutzer:PW|PW]] 07:53, 10. Dez. 2010 (UTC)
 +
<div align="center">
 +
[[Bild:spaghetti_ppt.jpg|800px]]
 +
</div>
 +
  
  

Version vom 10. Dezember 2010, 09:53 Uhr

Vorgänger

Überblick

"Spaghetti Code"

Se3.gif

Noch ein bekanntes Beispiel: "“When we understand that slide, we’ll have won the war,” General McChrystal dryly remarked, one of his advisers recalled, as the room erupted in laughter." --PW 07:53, 10. Dez. 2010 (UTC)

Spaghetti ppt.jpg


4 Lines of Code

Se1.jpg Se2.jpg

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


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.