Learn Object Oriented Programming - Your First Half Hour!
HTML-код
- Опубликовано: 23 ноя 2024
- This series is all about the BIG IDEAS of object orientation. If you are already familiar with an OOP language such as C#, Java, C++ or Ruby, I hope to give you an insight into the principles and practices of object oriented programming as they were originally conceived. Some of those ideas may be new to you. They may give you ideas about coding style that you can apply to whichever language you usually use.
It was the Smalltalk language that really set the standards for object orientation way back in the 1970s and early ‘80s. In this series I will be using Squeak, a free modern implementation of Smalltalk, to help you to get to grips with the core principles of object orientation. Squeak is a lot of fun to use so I encourage you to download a copy and follow along with me.
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.ducass...
or:
rmod-files.lil...
SUBSCRIBE TO THE CODE WITH HUW CHANNEL
To be notified whenever I upload new lessons, be sure to subscribe.
www.youtube.co...
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...
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
I used to program pascal in 80s. It’s an eye opener for me . Installed squeak 6.0 on my MBA. Great tutorial
We must have started around the same time, I guess. I did a lot of Turbo Pascal coding in the 80s.
Thanks for the comment!
I'm just trying out Squeak and this is a brilliant no nonsense start for me. There are very few intro's for interacting with the Squeak system, and this got me over the first hurdle.
Glad it helped. Squeak takes a bit of getting used to at first. You'll soon feel at home with it!
I understood everything! Really good tutorial! Hello from Ukraine! Actually watching this during blackout when everything is dark noir atmposphere which resembles with some magic!
I'm glad it helped. Even though you have to watch it in very difficult circumstances! Best wishes to you.
Thank you so much for sharing about the original OOP concepts, sir!
Thank you!
alright, that last video was a great intro to what you're going to be covering. subscribed.
Many thanks.
This is awesome Huw! It's not only a solid foundation in the original concepts of OOP, but also a historical lesson. I'm a fan of Pharo myself which is a fork of Squeak. As an aside, for those that may not know, there are actually two Squeaks - one was actually created to communicate with mice by Rob Pike in 1985. It eventually influenced the concurrency model that made its way into the Go language. The Squeak we're learning here, a SmallTalk derivative, was of course created by the venerable Alan Kay in 1996. 🐭🐭
Yes. Pharo is a great language and IDE too. I was also a big fan of Dolphin Smalltalk for Windows. This was a lovely commercial edition but the market wasn't sufficiently lively to keep it in business. Anyway, I hope the ideas from this series can be applied to Smalltalk dialects as well as other languages object oriented languages.
@@LearnWithHuw I've heard good things about Dolphin Smalltalk and it appears it has been open sourced with the latest stable version, 7.1.24, released July 2022 with a version 8 in beta.
Thanks Hew for bringing back Digitalk Smalltalk/V manual, it was my start long time ago. Have you covered (or plan to cover) what Digitalk released before the acquisition by ParcPlace, the PATRS Workbench for Smalltalk and PARTS Workbench for Java?
No. I haven't covered that. I don't recall the Smalltalk workbench. I do remember Actor, however (a curious mix of Smalltalk with a Pascal-like syntax) which may be worth taking another look at.
I'm curious, is there any relation between the actor model (as in the C++ Actor Framework) and message passing? It seems that the two concepts are somewhat related.
There is indeed a connection. This article explains more: library.fiveable.me/programming-languages-iii/unit-8/actor-model-message-passing/study-guide
Seeing the likes of this language and Haskell, C# seems so far behind! Immutable arrays weren't even a thing in C# until recently - they certainly weren't there prior to .NET Core; the closest thing was a ReadOnlyCollection which needed to take in the heavier and resizable List. 21:03 - Small Talk not only has them but they're also a native part of the language (no need to wrap a mutable array inside an immutable one)!
Loved this really cool!
Thanks. Lots more to come.
and what exactly is the difference between a public method and a message?
A message describes the request sent to an object. In languages such as Java and C#, a message is implemented as a method-call, based on C-like syntax of function-calls but with the function associated with an object instead of being "free standing" as in C. The method (like a C function but "built into" each object) handles that message.
@@LearnWithHuw so I understand correctly, that the messages can be defined as some process, which involves a sender calling a receiver giving him some typed information with a payload? as far as I know modeling and designing phase for any language uses the correct classical oop terminology, and defines messages, events, signals and this things are later translated into the target programming language, in case of message, as synchronous and asynronous public method calls, or function calls with receiver parameter, with receiver being an object, a component, a class, a struct, a handler. so any language, regardless of oop or not oop does implement messages (or even events or signals) differently, but it implements them correctly. then I do not understand the statement and the reason of it, about modern languages not implementing messages.
and imo main feature of oop is not messaging. and even not polymorphism. messges and polymorphism are possible without oop. main thing of oop is specific code structuring and easy info hiding or definition of public interface. later was possible in c/asm also, but one needed like 3 files to set this up. in (most) oop languages you can place all the info into one file.
Ok so what is the purpose of the messages and why are they different than calling a function. All I can see is that it's just a syntactic difference but it behaves exactly like a normal function or method
Edit: After seeing the conditional statements and loop it seems that you could also pass an arbitrary piece of code as an argument which is then going to be evaluated in the message body. Do I understand it correctly?
This should become clearer if you continue to watch the other videos in this series: ruclips.net/p/PLZHx5heVfgEvuveKG1T7BBSuDOTHl1eLl
Essentially, though, message-passing is a way of ensuring that the internal state of objects is kept private. This is explored more in my video on modularity: ruclips.net/video/MYDAAhB1QIo/видео.html
Best wishes
Huw
There isn't any advantage, it's slower and doesn't really do anything, which is why you don't have messages in modern OO.
@@LearnWithHuwInternal state of objects is kept private in many (most?) modern OOP languages, unless you expose members (declare them as public). So, what's the point? Where's the magic? You keep telling us that modern OOP is not real OOP because it doesn't use messages - but it uses method/function calls which are functionally equivalent to messages. Watching your videos is frustrating because in tens of minutes of your video content you lead us to believe that explanation is coming, but there is no explanation on a horizon. And when asked directly about it, you send us to a list of videos. I watched first 45 minutes of that list, and you don't explain the supposed benefits of messages, and what's the big deal. From what I understood from those 45 minutes, you feel that modern OOP languages are not "true OOP" because they allow us to do stuff that Smalltalk doesn't. Is that it? Those limitations can cause more issues than they solve. So it's great that basically nobody uses Smalltalk anymore. It seems there are plenty of reasons for that, starting with those limitations, and the silly thing with operators.
@@mbaksa I think you need to concentrate on the "OOP way of doing things" rather than trying to unpick the OOP features of specific languages. I advise everyone to do real, hands-on Smalltalk programming. That's by far the best way to understand the OOP way of thinking. I can try to explain it in the videos, but you really need to program Smalltalk to get a real feel for this.
@@davidlloyd1526apparently message passing has advantages with simplifying highly concurrent // parallel systems
6:29 paused to take a sneak peak at the syntax. Ohh. I like ifTrue. Indenting is so much better than curly braces, thumbs up there. Single quote for doc string / comment is a bit weird. But yeah, it's not ugly. Putting the internal classes on display is nice too, much less black box and you can ignore if you don't want to be bothered with it. Yeah, pretty good. Pythonesque frankly. Or I guess python is smalltalkese, this very much came first.
I wonder why it died so completely.
Yes, Smalltalk came on the scene a very long time before Python. As to why some languages succeed and others don't... partly that's due to the features of the language (Smalltalk was VERY hardware intensive at a time when many computers had only a few hundred K of memory and no graphics) and partly it's the luck of the draw. Why did C become all-dominant but Modula-2 faded away?
It’s because C style syntax is much more readable and compiles to faster machine code. C style syntax has even been improved in modern languages like Zig.
It’s always good to learn old languages if you want to improve modern languages, so that you can take the good ideas and avoid repeating past mistakes.
OOP was a huge mistake for most domains. It results in code that is less readable and maintainable, and also less performant than well written procedural/data oriented code.
@@NoX-512 Well you've got some very strong options. I code indented and curly brace languages and I'd go for the former every time in terms of readability.
And OOP was a huge mistake... Yeah, yeah, yeah Mr Edgy Opinion.
@@tophat593 You sound butthurt. Did I insult your religion?
interesting there was a programming language like this in the 80's. sadly im just finding this out now. i wonder if i could call this language up from a python program. it looks like it could do the machine learning math calculations faster than python.
I'm not sure how you'd integrate Smalltalk with Python. The two most actively developed modern Smalltalk implementations are Squeak and Pharo. This is something called PythonBridge that might help? objectprofile.github.io/PythonBridge/pages/pharo-installation
@@LearnWithHuw you can call any program with python.
I can now see why Smalltalk never actually took off as a language. It's horrible.
WHY IS THIS GUY USING SMALL TALK(OBSOLETE LANGUAGE) IN STEAD OF
C++, JAVA, C#, VBASIC, PYTHON, THEY ALL HAVE OOP INCLUDED FEATURES.
He explained why: Smalltalk approaches OO differently. Understanding that approach expands your toolbox, even if you never use Smalltalk in a real-world application.