Objektorientierung (CP)

Aus Philo Wiki
Wechseln zu:Navigation, Suche



"Spaghetti Code"


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


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


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.


Ikea stuhl.jpg

Was ist ein Sessel?
Wie sieht der Sessel aus?
Sind das etwa voneinander unabhängige Fragen?
Die einzige Funktion des Satzes scheint es, auf dem Gedankenklavier zu spielen; die Musik die er darauf hervorbringt, — das Gedankengebilde, — das ist der Gegenstand unsrer Untersuchung. (Wittgenstein TS 213, 265)

Wenn ich sage "dort steht ein Sessel", so hat dieser Satz Bezug auf eine Reihe von Erwartungen. Ich glaube ich werde dorthin gehen können, den Sessel befühlen und mich auf ihn setzen können, ich glaube er ist aus Holz und ich erwarte von ihm eine gewisse Härte, Brennbarkeit etc. etc.. (Wittgenstein MS 107, 284)


Ontologie und das semantische Web

Rdf-example.jpg Rdf-example-complex.jpg

Typically, a data set contains knowledge about a particular domain, like books, music, encyclopedic data, companies, you name it. If these data sets were interconnected (i.e. link to each other like websites), a machine could traverse this independent web of noiseless, structured information to gather semantic knowledge of arbitrary entities and domains. The result would be a massive, freely accessible knowledge base forming the foundation of a new generation of applications and services. (Alexander Korth: The Web of Data: Creating Machine-Accessible Information)


Chair-surreal4.jpg Chair-surreal8-small.jpeg Chair-surreal2.jpg Chair-surreal7.jpg

Der Sessel spricht zu sich selber: ... Wo spricht er es? In einem seiner Teile? Oder außerhalb seines Körpers in der Luft um ihn? Oder gar nicht irgendwo? Aber was ist dann der Unterschied zwischen dem Sprechen dieses Sessels und dem eines andern Dings das neben ihm steht? —- Aber wie ist es dann mit dem Menschen: wo spricht er zu sich selbst? (Wittgenstein MS165, S. 205)