Тёмный

Object Oriented Programming With Smalltalk - Objects and Messages 

Code With Huw
Подписаться 11 тыс.
Просмотров 7 тыс.
50% 1

Do some hands-on coding with Squeak Smalltalk. This is the 6th lesson in a series about the principles of object orientation. These days most programmers are familiar with languages that implement some type of object orientation, whether it be Java, C#, C++, Ruby, Object Pascal or some other language. But not so many programmers are familiar with the language that really started the Object Oriented ball rolling - namely, Smalltalk.
If you really want to understand the big ideas of object orientation, it really is worth getting to know Smalltalk. In this series I explain the principles of object orientation in general as well as the practicalities of writing Smalltalk code using the modern, free, Squeak Smalltalk.
BOOKMARK THE SERIES PLAYLIST
To follow this series in order, bookmark the playlist. New episodes are added to the playlist whenever they are published.
• Object Oriented Progra...
DOWNLOAD SQUEAK
Squeak Smalltalk
squeak.org/
DOWNLOAD THE SMALLTALK/V TUTORIAL
I will using the excellent Smalltalk/V Tutorial as the “course text” for this series and I encourage you to download a PDF copy of that too:
stephane.ducasse.free.fr/FreeB...
or:
rmod-files.lille.inria.fr/?di...
SUBSCRIBE TO THE CODE WITH HUW CHANNEL
To be notified whenever I upload new lessons, be sure to subscribe.
ru-vid.com?s...
WHO IS HUW COLLINGBOURNE?
I’ve been programming since the early 1980s. I’ve written wrote programming columns on Java, C#, Delphi and other languages for “PC Plus Magazine”, “Computer Shopper” and numerous other UK magazines. I wrote the cult adventure game, The Golden Wombat Of Destiny, I have developed programming tools with SapphireSteel Software and I have written programming books published by Dark Neon and No Starch Press. These include books on programming C, C#, Java, Ruby, Delphi and Object Pascal, pointers, recursion and programming adventure games.
All my books can be found on Amazon.
Keep in Touch
==============================
Code With Huw on Facebook:
/ codewithhuw

Опубликовано:

 

14 май 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 21   
@isr
@isr Год назад
How, please keep this series going, and delve even further into smalltalk.
@LearnWithHuw
@LearnWithHuw Год назад
I shall do. Be sure to follow the series using the playlist: ru-vid.com/group/PLZHx5heVfgEvuveKG1T7BBSuDOTHl1eLl
@davidbajger7982
@davidbajger7982 Год назад
I really like your series about OOP, this was clean and very good explanation of key principles. Thanks for doing that! Some notes taken on this video: For context to mention that everything is object in Smalltalk: - I would repeat here again, when dealing with numbers (I think you've said that in previous videos) and emphasize that there aren't any primitive types like ints or characters like in Java, even nil is an instance of UndefinedObject class. Key control structures are implemented using methods as well: - I would show the implementation of ifTrue: or ifFalse: methods on Boolean subclasses Finding implementor of #factorial - Mention there might be simple way, just right click on the selector and browse implementors (instead of finding a class in Browser) My thought on choosing Squeak implementation and reference tutorial (Smalltalk V): - Although I'm not challenging usefulness of it and you've shown many useful examples from book, Smalltalk V as reference material seems a bit archaic. Some younger users would say, "Nah, what I should look into something that is 40 years old". There are just some newer ways of learning Smalltalk (or Smalltalk like variant). I'm sure you are aware of these and I would say that way of learning is clean enough and compelling as with Smalltalk V tutorial: - I'm part of the Pharo community (fork of Squeak which isn't strictly ST80 compliant for good reasons), which has great books and massive online course (mooc.pharo.org). - GToolkit is another variant, it is approach of moldable, explorative development and modern IDE, where you can learn and write Smalltalk (non ST80 compliant) code
@LearnWithHuw
@LearnWithHuw Год назад
Thanks for the comments. More will be coming along in later videos. I'm trying to follow the Smalltalk/V tutorial very closely so that people can use that as the "course text" so the order of explanation is dictated by the order of the tutorial. It may be old but I still think it's a terrific tutorial. Very short, clear and methodical. I also like the fact that it lets me show how this old code can, with relatively few changes, be made to run in a modern Smalltalk. That said, my real focus is on trying to explain the core ideas of oop rather than just do another Smalltalk tutorial. Pharo and Squeak both have masses of tutorial material already. I'm hoping that my series might help people to bridge the gap between Smalltalk (which most viewers won't have used) and whichever modern oop language they are using. Best wishes Huw
@victorpinasarnault9135
@victorpinasarnault9135 8 месяцев назад
Didn't saw your video, but loved your channel. Thanks, liked and subscribed.
@LearnWithHuw
@LearnWithHuw 8 месяцев назад
Many thanks
@luisz0339
@luisz0339 Год назад
I was curious about smalltalk and the origin of oop (I wanted to understand it better by learning from its origin), your videos are of great help and you are great explaining things! Do you plan on continuing doing smalltalk videos? If so, do you plan on using Pharo or talking about it? Is the one I found when I look up for the best modern version of smalltalk. Thank you very much for tour videos!
@LearnWithHuw
@LearnWithHuw Год назад
Yes, there'll be more! I'm glad you find them of interest. Most of the code works equally well in Pharo though there will be a few differences re. graphics and Files. I may think of doing some Pharo lessons later on. I thought this series would be simpler to follow if I just used Squeak (and Smalltalk/V when I want to show a "historic" version). Bookmark the playlist if you'd like to follow the series in order. ru-vid.com/group/PLZHx5heVfgEvuveKG1T7BBSuDOTHl1eLl
@alkove
@alkove 9 месяцев назад
Message passing does not seems too dissimilar to method calls. Assuming I have a langage where numbers are objects (ruby, python or scala maybe), I coud have methods "factorial" and "between" implemented and thus have: 4.factorial().between(3+4, "hello".size()*7) equivalent of: 4 factorial between: 3 + 4 and: 'hello' size * 7
@haroldostenger5160
@haroldostenger5160 5 месяцев назад
in smalltalk in order to create a class or an object, you send a mesage, unlike these other languages.
@haroldostenger5160
@haroldostenger5160 5 месяцев назад
also, control flow structures in smalltalk follow the same pattern, unlike in these other languages.
@MarcosHernandez-ie4xd
@MarcosHernandez-ie4xd Месяц назад
Good video. Do you recommend the book "Discovering Smalltalk by Wilf LaLonde"?
@LearnWithHuw
@LearnWithHuw Месяц назад
To be honest, It's a long time since I've read a Smalltalk book. I'm sure I've read at least some of "Discovering Smalltalk" in the past but it's not fresh enough in my mind to comment on it. I think this is one of the titles freely available online so give it a try.
@MarcosHernandez-ie4xd
@MarcosHernandez-ie4xd Месяц назад
@@LearnWithHuw thanks!
@blackmirroxx
@blackmirroxx Год назад
True oop
@electrocatalyst
@electrocatalyst 9 месяцев назад
How is this "message sending to an object" different from the modern "calling a method on an object"?
@LearnWithHuw
@LearnWithHuw 9 месяцев назад
I talk quite a lot about that in several videos in this series. In short, the idea is that any object can receive any message but is up to the object to decide how (or if) to handle that message. You have to remember that when Smalltalk was released, most languages were *like C or Pascal) procedral with functions existing "free floating". One one function could have any given name. A function-call went straight to that function. OOP introduced "bound-in" methods where many objects could have functions with the same name. so messages were sent to objects. If anyone finds message-passing hard to understand, just think of methods as interfaces into objects.
@electrocatalyst
@electrocatalyst 9 месяцев назад
@@LearnWithHuw, I think I understand message-passing. I'm just trying to understand how it's different from today's method-calling.
@AnthonySouls
@AnthonySouls 9 месяцев назад
@@electrocatalyst I could be wrong, but after discussing it with chatGpt, lol, I came up with this response, which could be wrong: I think Smalltalk is a lot like Python. Thus, one difference is that messages are dynamic. They have late binding. When you send a message, the object searches for that method throughout its hierarchy until it finds it. It will check the method cache and method dictionary. If it doesn't find it, it responds with a message like "No such method". So, imagine Python. You take Python and create a method dictionary for all the methods in that class. You implement a message handler for the class that accepts messages, then map them to the dictionary. If it finds the method in the dictionary, it calls it with the implementation. Thus, instead of calling the method statically and passing the arguments, you go through this message handler to access the object and pass the messages. That's the difference as I know it. It's a more dynamic way. You could pass messages that can't be handled, and it will gracefully give you a "not found" message, like calling a method through a try block. It's like meta-class programming, if you ask me. Moreover, in Smalltalk, the documentation said that everything about an object is supposed to be protected, and the only way to interact with it is through these messages. So yeah, those are the differences as I understand them. I think there is a reason smalltalk failed, but Python is very successful. I think Python is basically a modern smalltalk equivalent with pragmatic approaches. Correct me if I am wrong, but there you go :) Additionally (just crossed my mind), it would be hard in C++ to do something like, send the object a message to do something dynamically, then have it respond if it has such a method. Statically, that would be problematic, since you have to dynamically do that. I'm sure you could implement such dynamic nature into your classes, but smalltalk seems to do it at a language level, which is pretty nice.
@SatumangoTheGreat
@SatumangoTheGreat 9 месяцев назад
​@@electrocatalystI guess the difference is that, with method calling, the compiler will determine what method to call and emits code that invokes that specific method (early binding, done at compile time). With message passing, the decision which method to call is made at runtime (late binding, done at runtime). This means that you could have objects that change method implementations in between method calls, which I believe Smalltalk can do. It also makes it possible to send a message to an object that does not have a method to handle it: in Smalltalk you can create a 'doesNotUnderstand' method that takes as parameter a datastructure containing the message sent to it. It can then examine the message and decide what to do with it (notify the caller that the message is not correct, sending the message to another object that can handle it, etc.). This can also be useful in implementing the proxy design pattern: the proxy's 'doesNotUnderstand' method simply forwards the message to the proxied object instead of having to reimplement every method, all of which would have to call the corresponding method on the proxied object. This is what Alan Kay meant when he said 'extreme late binding of all things'. Note that there is of course a runtime cost associated with this, but that some Smalltalk implementations can optimize away some of it. I don't know any details about this aspect of Smalltalk, so if you want to know more about it, you will have to Google it.
@NguyenTung-ss8cq
@NguyenTung-ss8cq 4 месяца назад
@electrocatalyst In my understanding, "message sending" is a fundamental idea and "calling a method on an object" is just a concrete expression of that idea in code. You can watch the previous video in this series to understand more about "message sending" ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-lmAarC0Zhq4.html
Далее
Нюша на премии МУЗ-ТВ 2024 #нюша
00:11
Object Oriented Programming vs Functional Programming
18:55
All Rust string types explained
22:13
Просмотров 148 тыс.
A Taste of Roc - Richard Feldman
1:13:20
Просмотров 47 тыс.
Нюша на премии МУЗ-ТВ 2024 #нюша
00:11