JaroslavTulach at 05:56, 10 September 2025 - 2025-09-10 05:56:40

←Older revision Revision as of 05:56, 10 September 2025
Line 31: Line 31:
</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 of '''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 its [[RootClass]].
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 at 05:55, 10 September 2025 - 2025-09-10 05:55:02

←Older revision Revision as of 05:55, 10 September 2025
Line 1: Line 1:
[[OOP]] languages tend to have a [[RootClass]] - a super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
[[OOP]] languages tend to have a [[RootClass]] - a super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
-
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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. Lovers of meta-programming may be excited by that, but on and on, this is not a system that could work in a [[distributed development]] easily. Listen:
+
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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. Lovers of meta-programming may be excited by that, but on and on, this is not a system that could work in a [[distributed development]] environment easily. Imagine:
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 05:54, 10 September 2025 - 2025-09-10 05:54:32

←Older revision Revision as of 05:54, 10 September 2025
Line 1: Line 1:
[[OOP]] languages tend to have a [[RootClass]] - a super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
[[OOP]] languages tend to have a [[RootClass]] - a super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
-
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.
+
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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. Lovers of meta-programming may be excited by that, but on and on, this is not a system that could work in a [[distributed development]] easily. Listen:
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 05:30, 10 September 2025 - 2025-09-10 05:30:05

←Older revision Revision as of 05:30, 10 September 2025
Line 1: Line 1:
-
[[OOP]] languages tend to have a [[RootClass]] - an super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
+
[[OOP]] languages tend to have a [[RootClass]] - a super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.

JaroslavTulach at 05:29, 10 September 2025 - 2025-09-10 05:29:48

←Older revision Revision as of 05:29, 10 September 2025
Line 39: Line 39:
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'''.
+
[[Image:JavaLangObject.png]]
 +
 
 +
I think the answer is clear. [[Java]] is a '''hash oriented language''' and also '''lock oriented language'''!

JaroslavTulach at 04:59, 10 September 2025 - 2025-09-10 04:59:10

←Older revision Revision as of 04:59, 10 September 2025
Line 1: Line 1:
 +
[[OOP]] languages tend to have a [[RootClass]] - an super type of every object in the system. [[Java]] has {{JDK|java/lang|Object}}. [[Scala]] has '''Any'''. Etc.
 +
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.

JaroslavTulach at 04:56, 10 September 2025 - 2025-09-10 04:56:46

←Older revision Revision as of 04:56, 10 September 2025
Line 1: Line 1:
-
== Extending [[RootClass|Root Hierarchy Class]] ==
 
-
 
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.
[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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.

JaroslavTulach: New page: == Extending Root Hierarchy Class == Smalltalk systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). ... - 2025-09-10 04:56:20

New page: == Extending Root Hierarchy Class == Smalltalk systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). ...

New page

== Extending [[RootClass|Root Hierarchy Class]] ==

[[Smalltalk]] systems come with a bunch of predefined classes which everyone can use and modify (in the form of serialized heap, btw.). 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:

<source lang="smalltalk">
> 1 isNumber
true
> 'text' isNumber
false
> 'text' isString
true
</source>

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">
> 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/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.

== 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?

I think the answer is clear. [[Java]] is a '''hash oriented language''' and also '''lock oriented language'''.