Differences between version 2 and previous revision of ObjectOrientation.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Wednesday, November 19, 2003 6:50:45 pm | by AristotlePagaltzis | Revert |
Older page: | version 1 | Last edited on Wednesday, November 19, 2003 6:06:04 pm | by AristotlePagaltzis | Revert |
@@ -12,8 +12,14 @@
!! Polymorphism
AddToMe
+
+----
+
+In [ProgrammingLanguage]s with StrongTypeChecking, objects are often instances of a class, an abstract DataType.
+
+----
!!! Some criticism and discussion
''needs cleanup and reflow. possibly its own page? --AristotlePagaltzis''
@@ -30,9 +36,9 @@
System.out.println("Hi, I am an animal.");
}
}
-What a boring [Class]
. Let us ''extend'' this class a little by ''inherit''ing from it.
+What a boring class
. Let us ''extend'' this class a little by ''inherit''ing from it.
public class Dog extends Animal {
public String getName() { return "Dog"; }
public void talk() {
@@ -75,19 +81,19 @@
Ok, sure, it is a contrived example. Which is actually a bit of a problem. You see, given a very good design, object oriented programming is, well, very good. Unfortunately, this design is very hard to come by. Some think it is impossible for many situations. So therein lies the real problem. It is easy to think up silly situations where object oriented programming works flawlessly. In practice, it can be very hard to apply. There are some good situations. Windowing systems come to mind: a well designed GUI can make excellent use of object oriented programming.
Technical difficulties also get in the way at times. C++ especially suffers here. All sorts of complexity has gone into allowing C++ to be useful as an object oriented language. The COM programming model by Microsoft is an example of an excellent attempt at making C++ useful as a component-based and object-oriented language.
-There is a lot of theory involved in ObjectOrientedProgramming
. A lot of processes have been invented in attempts to make designing systems easier: people who have studied it may remember CRC cards and class diagrams. Object oriented design purists will talk about class responsibilities and communications between classes and such.
+There is a lot of theory involved in ObjectOrientation
. A lot of processes have been invented in attempts to make designing systems easier: people who have studied it may remember CRC cards and class diagrams. Object oriented design purists will talk about class responsibilities and communications between classes and such.
Done well, object oriented programming is great. Given a good design, doing it well is not all that hard. Getting a good design is often near impossible.
----
-Now, you do not have to go all out when using ideas that form parts of ObjectOrientedProgramming
. PerryLorier pointed out after reading this article that ObjectOrientedProgramming
has bought some very useful ideas into programming languages that can be used for general purpose programming.
+Now, you do not have to go all out when using ideas that form parts of ObjectOrientation
. PerryLorier pointed out after reading this article that ObjectOrientation
has bought some very useful ideas into programming languages that can be used for general purpose programming.
Encapsulation - everything in a class is __encapsulated__ in that class. A class is its own [NameSpace]. This is an idea you often do not understand too well when you are new to programming but makes a lot of sense as you get a bit more experienced at writing somewhat larger applications. Now, the idea of full encapsulation of data and functions is quite a powerful one. It allows us to instantiate an object of some class and know it only works on its own data. It even easily allows us to instantiate more than on instance and know each will work separately. There is a little more to it than this, but that is the basic idea: functionality and data __encapsulated__.
Increased type checking is helpful in many cases, the use of some object oriented techniques can help find type errors in some languages earlier. Not all languages need stronger type checking, though, and not all programmers want this. In general it is fair to say it helps lower programmer errors, though, making it a useful feature of object oriented techniques.
-The last two points are just trying to get across the fact that some of the ideas of ObjectOrientedProgramming
can be used in general programming without "going the full hog" and using all the design patterns and implementing things in a purely object oriented way.
+The last two points are just trying to get across the fact that some of the ideas of ObjectOrientation
can be used in general programming without "going the full hog" and using all the design patterns and implementing things in a purely object oriented way.
(Feedback to SamJansen if you like)