JaroslavTulach: /* Is Java an OOP system? */ - 2011-07-19 04:22:25

Is Java an OOP system?

←Older revision Revision as of 04:22, 19 July 2011
Line 40: Line 40:
But enough about [[Smalltalk]] and let's look at [[Java]]'s root class {{JDK|java/lang|Object}}. Can you guess what kind of ''oriented system'' [[Java]] is?
But enough about [[Smalltalk]] and let's look at [[Java]]'s root class {{JDK|java/lang|Object}}. Can you guess what kind of ''oriented system'' [[Java]] is?
 +
 +
I think the answer is clear. [[Java]] is a '''hash oriented language''' and also '''lock oriented language'''.
<comments/>
<comments/>

JaroslavTulach: /* Extending Root Hierarchy Class */ - 2011-07-15 14:57:58

Extending Root Hierarchy Class

←Older revision Revision as of 14:57, 15 July 2011
Line 33: Line 33:
</source>
</source>
-
As a result, if you want to understand a [[Smalltalk]] program/system, you should look at the added '''isSomething''' methods in the '''Object'''. Some might argue, that this is the way [[OOP]] should be done. On the other hand, such kind of programming creates not pure [[OOP|object oriented systems]], but different flavors (in the above case a ''person oriented system''), where capabilities of each object are driven by the variety '''isSomething''' methods on root class.
+
As a result, if you want to understand a [[Smalltalk]] program/system, you should look at the added '''isSomething''' methods in the '''Object'''. Some might argue, that this is the way [[OOP]] should be done. On the other hand, such kind of programming creates not pure [[OOP|object oriented systems]], but different flavors (in the above case a ''person oriented system''), where capabilities of each object are driven by the variety of '''isSomething''' methods on root class.
I don't like that each [[Smalltalk]] system ends up being completely unique. Merging two such systems together may create a lot of accidental conflicts preventing merge of systems developed independently, as far as I can tell.
I don't like that each [[Smalltalk]] system ends up being completely unique. Merging two such systems together may create a lot of accidental conflicts preventing merge of systems developed independently, as far as I can tell.

JaroslavTulach: /* Extending Root Hierarchy Class */ - 2011-07-15 14:55:28

Extending Root Hierarchy Class

←Older revision Revision as of 14:55, 15 July 2011
Line 3: Line 3:
== Extending Root Hierarchy Class ==
== Extending Root Hierarchy Class ==
-
[[Smalltalk]] systems (as far as I remember) come with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system is to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a [[distributed development]] process easily.
+
[[Smalltalk]] systems (as far as I remember) come with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system is to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a [[distributed development]] easily.
The classical [[Smalltalk]] style to implement '''instanceof''' (e.g. to find out if an object is instance of a certain type) is based on a bunch of '''isSomething''' methods:
The classical [[Smalltalk]] style to implement '''instanceof''' (e.g. to find out if an object is instance of a certain type) is based on a bunch of '''isSomething''' methods:

JaroslavTulach: /* Extending Root Hierarchy Class */ - 2011-07-15 14:55:10

Extending Root Hierarchy Class

←Older revision Revision as of 14:55, 15 July 2011
Line 3: Line 3:
== Extending Root Hierarchy Class ==
== Extending Root Hierarchy Class ==
-
[[Smalltalk]] systems (as far as I remember) come with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system is to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a [[distributed programming]] process easily.
+
[[Smalltalk]] systems (as far as I remember) come with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system is to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a [[distributed development]] process easily.
The classical [[Smalltalk]] style to implement '''instanceof''' (e.g. to find out if an object is instance of a certain type) is based on a bunch of '''isSomething''' methods:
The classical [[Smalltalk]] style to implement '''instanceof''' (e.g. to find out if an object is instance of a certain type) is based on a bunch of '''isSomething''' methods:

JaroslavTulach at 14:29, 15 July 2011 - 2011-07-15 14:29:16

←Older revision Revision as of 14:29, 15 July 2011
Line 3: Line 3:
== Extending Root Hierarchy Class ==
== Extending Root Hierarchy Class ==
-
The [[Smalltalk]] systems (as far as I remember) start with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system suggests to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a distributed programmning processes.
+
[[Smalltalk]] systems (as far as I remember) come with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system is to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a [[distributed programming]] process easily.
-
The classical [[Smalltalk]] style to find out what is a type of an object is based on a bunch of '''isSomething''' methods:
+
The classical [[Smalltalk]] style to implement '''instanceof''' (e.g. to find out if an object is instance of a certain type) is based on a bunch of '''isSomething''' methods:
<source lang="smalltalk">
<source lang="smalltalk">
Line 16: Line 16:
</source>
</source>
-
What people do when they define new types like '''Person'''? They what to have their own '''isPerson''' method. Thus they add this method to '''Object''' to return '''false''' and override it in '''Person''' class to return '''true''':
+
What can developers do when they define new types like '''Person''' and want to recognize their instances? They add '''isPerson''' method to '''Object''' to return '''false''' and override it in '''Person''' class to return '''true''':
<source lang="smalltalk">
<source lang="smalltalk">
Line 33: Line 33:
</source>
</source>
-
As a result, if you want to understand a [[Smalltalk]] program, you should look at the added '''isSomething''' methods in the '''Object'''. This kind of programming creates not [[OOP|object oriented systems]], but different flavors (in the above case a ''person oriented system''), where capabilities of each object are driven by the variety of subclasses.
+
As a result, if you want to understand a [[Smalltalk]] program/system, you should look at the added '''isSomething''' methods in the '''Object'''. Some might argue, that this is the way [[OOP]] should be done. On the other hand, such kind of programming creates not pure [[OOP|object oriented systems]], but different flavors (in the above case a ''person oriented system''), where capabilities of each object are driven by the variety '''isSomething''' methods on root class.
-
I don't like that each [[Smalltalk]] system ends up being completely unique. This is not how [[API]]s should be designed, as that prevents merge of systems developed independently, as far as I can tell.
+
I don't like that each [[Smalltalk]] system ends up being completely unique. Merging two such systems together may create a lot of accidental conflicts preventing merge of systems developed independently, as far as I can tell.
== Is [[Java]] an [[OOP]] system? ==
== Is [[Java]] an [[OOP]] system? ==
Line 42: Line 42:
<comments/>
<comments/>
-
 
-
[[TBD]]
 

JaroslavTulach at 00:06, 15 July 2011 - 2011-07-15 00:06:22

←Older revision Revision as of 00:06, 15 July 2011
Line 1: Line 1:
-
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]! [[Smalltalk]] is unique/strange, but I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
+
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create a better world inside a computer! Let's write in [[wikipedia::Smalltalk|Smalltalk]]! [[Smalltalk]] is unique/strange, but I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
== Extending Root Hierarchy Class ==
== Extending Root Hierarchy Class ==
-
The [[Smalltalk]] systems (as far as I remember) start with a bunch of predefined classes which everyone can modify. One can create new subclasses (OK, that is the same in [[Java]]), but one can also add new methods to existing classes.
+
The [[Smalltalk]] systems (as far as I remember) start with a bunch of predefined classes which everyone can use and modify. Of course, the nature of [[OOP]] system suggests to be extensible. Thus one can create new subclasses (OK, that is the same as in [[Java]]), but one can also add new methods to existing classes. Sure, lovers of meta-programming may be happy with that, but on and on, this is not a system that could work in a distributed programmning processes.
The classical [[Smalltalk]] style to find out what is a type of an object is based on a bunch of '''isSomething''' methods:
The classical [[Smalltalk]] style to find out what is a type of an object is based on a bunch of '''isSomething''' methods:

JaroslavTulach at 17:53, 12 July 2011 - 2011-07-12 17:53:10

←Older revision Revision as of 17:53, 12 July 2011
Line 1: Line 1:
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]! [[Smalltalk]] is unique/strange, but I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]! [[Smalltalk]] is unique/strange, but I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
-
== Extensibility ==
+
== Extending Root Hierarchy Class ==
The [[Smalltalk]] systems (as far as I remember) start with a bunch of predefined classes which everyone can modify. One can create new subclasses (OK, that is the same in [[Java]]), but one can also add new methods to existing classes.
The [[Smalltalk]] systems (as far as I remember) start with a bunch of predefined classes which everyone can modify. One can create new subclasses (OK, that is the same in [[Java]]), but one can also add new methods to existing classes.

JaroslavTulach at 17:51, 12 July 2011 - 2011-07-12 17:51:50

←Older revision Revision as of 17:51, 12 July 2011
Line 1: Line 1:
-
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]!
+
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]! [[Smalltalk]] is unique/strange, but I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
-
I don't like that each [[Smalltalk]] system ends up being completely unique, as it is common to add new and new methods to the base Object. Usually things like isInteger, isString, etc. This is not how [[API]]s should be designed, as that prevents merge of systems developed independently, imho.
+
== Extensibility ==
-
However I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
+
The [[Smalltalk]] systems (as far as I remember) start with a bunch of predefined classes which everyone can modify. One can create new subclasses (OK, that is the same in [[Java]]), but one can also add new methods to existing classes.
 +
 
 +
The classical [[Smalltalk]] style to find out what is a type of an object is based on a bunch of '''isSomething''' methods:
 +
 
 +
<source lang="smalltalk">
 +
> 1 isNumber
 +
true
 +
> 'text' isNumber
 +
false
 +
> 'text' isString
 +
true
 +
</source>
 +
 
 +
What people do when they define new types like '''Person'''? They what to have their own '''isPerson''' method. Thus they add this method to '''Object''' to return '''false''' and override it in '''Person''' class to return '''true''':
 +
 
 +
<source lang="smalltalk">
 +
> Object subclass: #Person
 +
> !Object methodsFor: 'Checking Person'! isPerson ^false !!
 +
> !Person methodsFor: 'Checking Person'! isPerson ^true !!
 +
</source>
 +
 
 +
One can then easily check on any object if it is a person or not:
 +
 
 +
<source lang="smalltalk">
 +
> 1 isPerson
 +
false
 +
> Person new isPerson
 +
true
 +
</source>
 +
 
 +
As a result, if you want to understand a [[Smalltalk]] program, you should look at the added '''isSomething''' methods in the '''Object'''. This kind of programming creates not [[OOP|object oriented systems]], but different flavors (in the above case a ''person oriented system''), where capabilities of each object are driven by the variety of subclasses.
 +
 
 +
I don't like that each [[Smalltalk]] system ends up being completely unique. This is not how [[API]]s should be designed, as that prevents merge of systems developed independently, as far as I can tell.
 +
 
 +
== Is [[Java]] an [[OOP]] system? ==
 +
 
 +
But enough about [[Smalltalk]] and let's look at [[Java]]'s root class {{JDK|java/lang|Object}}. Can you guess what kind of ''oriented system'' [[Java]] is?
 +
 
 +
<comments/>
 +
 
 +
[[TBD]]

JaroslavTulach at 21:29, 1 July 2011 - 2011-07-01 21:29:01

←Older revision Revision as of 21:29, 1 July 2011
Line 1: Line 1:
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]!
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]!
-
I don't like that each [[Smalltalk]] system ends up being completely unique, as it is common to add new and new methods to the base Object. Usually things like isInteger, isString, etc. This is not [[API]]s shall be designed, as that prevents merge of systems developed independently, imho.
+
I don't like that each [[Smalltalk]] system ends up being completely unique, as it is common to add new and new methods to the base Object. Usually things like isInteger, isString, etc. This is not how [[API]]s should be designed, as that prevents merge of systems developed independently, imho.
However I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].
However I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].

JaroslavTulach at 17:47, 21 December 2010 - 2010-12-21 17:47:53

←Older revision Revision as of 17:47, 21 December 2010
Line 1: Line 1:
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]!
Dissatisfied with relational or [[OOP]] mappings of the real world? Let's create our own world inside a computer. Let's write in [[wikipedia::Smalltalk|Smalltalk]]!
 +
 +
I don't like that each [[Smalltalk]] system ends up being completely unique, as it is common to add new and new methods to the base Object. Usually things like isInteger, isString, etc. This is not [[API]]s shall be designed, as that prevents merge of systems developed independently, imho.
 +
 +
However I like [[Smalltalk]]'s [[Hotswap]]. Long time ago [[Smalltalk]] could do things [[Java]] is still [[Hotswap|dreaming about]].