Python OOP Tutorial: Unlock 7 essential secrets for mastering object-oriented programming in Python. #Python #OOP #Programming #Tutorial #CodeNewbie

Python OOP Tutorial: Unlock 7 essential secrets for mastering object-oriented programming in Python. #Python #OOP #Programming #Tutorial #CodeNewbie
one aspect on the complexity of software projects is a complex graph of dependencies (I'm not thinking only to other packages, but class/module dependencies inside a single package/library).
Functional programming encourages to use really tiny and precise dependencies (i.e. functions) instead of collections of them (e.g. classes).
This makes the dependency graph more complex. Hence managing and organizing the dependency graph becomes harder.
Could this be a reason why in functional programming projects I tend to see less code organization than in OOP ones?
Programmers must avoid leaving false clues that obscure the meaning of code.
— Robert C. Martin
@serge Is Scratch not essentially based on #Smalltalk? Not knocking it, Smalltalk is also an excellent language, but #FunctionalProgramming is a different, and in my opinion more fundamental, paradigm than #OOP, and one which I believe it benefits children to be introduced to first.
Objects are abstractions of processing. Threads are abstractions of schedule.
— James O. Coplien
#Claude4 Sonnet and I have successfully built our Sunya bootstrap compiler using #Fortran and #Assembly. So, from now on Sunya can compile itself and starts growing into the real core Sunya programming language. If we succeed, Sunya will be the first AI Human fully #modularized #OOP #programming language that does not use pointer but has array and matrix as its primitive datatype. I will call it Organic #Object Programming. No more #C, #Python, #Rust, F#, C#,...
What is #OOP? The current Object Oriented #Programming has been distracted by #classes, #interfaces, #override, .. and is ignoring its crucial component, namely #object. Claude4 Sonnet and I are developing this new language called Sunya to get rid of all the nuisance and focus on objects. An object is a standalone entity that has attributes and functionalities and that can "emulate" other objects directly. As object is a set of functions with a persistent state. A module is a complex object.
I also got experience with the following (5 = a lot, 1 = a little) :
#machinelearning #ml (3) (I have implemented some ML models myself in the past, for learning purposes.)
#guix (3) (Using it for reproducible setups of projects.)
#functionalprogramming #fp (5) (Doing it in my own projects.)
#objectorientedprogramming #oop (4) (last job and past xp in my own projects.)
#CI / #CD (3) (Last job)
#make (4) (using it for my own project setups and convenience)
#testing (4) (last job, own projects)
Don't mind me, I'm just poking around this newfangled OOP thing with LOOPS on Medley Interlisp. LOOPS (Lisp Object-Oriented Programming System) is the object extension of Interlisp.
The LOOPS primer, published in 1987, captured well the essence of exploratory programming in Lisp:
The LOOPS interface provides both a programming tool and a thinking tool. As you develop a new system, each preliminary version provides an object for thought and discussion. The preliminary versions are a crucial part of the design process.
LOOPS (Lisp Object-Oriented Programming System) is the OOP extension of Interlisp.
#commonLisp #programming #amop #mop #metaobjectProtocol #exercise #closette #learnToCode (my own experience) #oop
https://screwlisp.small-web.org/amop/eg1/
Today I simply share and solve (hopefully!) The Art of the Metaobject Protocol exercise 1.1
(the softball generic classes #memoization exercise from chapter 1)
I just added a lexical closure of hash tables.
@simoninireland wrote about the art of the metaobject protocol in his #lisp bibliography a year ago. https://simondobson.org/2024/07/23/the-art-of-the-metaobject-protocol/
A string "this is an object" is a "literal" in #Csharp. In #computer science, a literal is a fixed VALUE. In c#, "this is an object" is not a simple value, but an object. c# is designed base on OOP. The word literal was used well before #OOP was even a concept. Should a simple string "this is an object" be called a literal? Say I have a class SillyAnimal with only a string literal string sillyanimal = "I am a silly animal". I instantiate SillyDog as a SillyAnimal. Is Sillydog a literal? #logic
#programming #oop #commonLisp #GUI #app #McCLIM #gamedev #devlog https://screwlisp.small-web.org/lispgames/hurkling-onwards/ #hurkle
Well, it's pretty graphical now. Yes, table columns goofily resize and the history of button presses appear in the interactor shell: Really I just wanted to show you those features working.
Next article, I'll add two more asks and "launch" the game on itch.io.
Anyone else have a McCLIM show-and-tell?
One pro I have noticed regarding object oriented programming in a large corporate environment: it soft-encourages a team to document their conceptual nouns.
You can certainly do this in functional programming too, but in general I find that when people do their language equivalent of alias SkagWuzzit map<int,map<int,list<map<str,str>>>
, they often completely forget to ever get around to defining what a SkagWuzzit actually is. This is something you can handle with programming discipline (i.e. peer review and make people provide definitions for these types and what they conceptually mean, document the module in which the type is defined, etc.), but a class
definition with no docs looks naked in a way that a single type def on a line by itself doesn't.
New Kitten Release
(Run `kitten update` to update your dev machines. Production machines will automatically update in a couple of hours.)
• You can now add a generic script block to your markdown pages (see https://mastodon.ar.al/@aral/114432417394114105)
• Markdown pages can now be `KittenPage` instances and attach `KittenComponent` instances (so you get a full server-side component hierarchy with an event-based workflow; ideal for authenticated pages where you can be use only the author of the page will be accessing them and thus the additional memory and processing overhead are not issues. Isn’t the Small Web great? Only having instances of one makes it possible to optimise so many things for the human experience instead of vertical scale of the data farming machine.)
• Two new examples showcase the new features: https://codeberg.org/kitten/app/src/branch/main/examples/streaming-html/markdown-script-simple-components and https://codeberg.org/kitten/app/src/branch/main/examples/streaming-html/markdown-kitten-components
• Attributes with object values are no longer serialised into the DOM (but your components’ render functions will continue to receive them, of course.) This is because only string values make sense for attributes in the context of the HTML DOM. (You can still, of course, have stringified representations of objects in attributes, as used by the `data` attribute to pass data from nodes to event handers on the server.)
Gemini 2.0 is very smart, though not as smart as 2.5 pro. The problem is not 2.0 herself, but the fact that she has to handle a huge amount of queries. She will not spend too much resources on a particular user. You have to push her to her limit to get the "correct" response.
Whatever you can achieve with "#Interface", you can do it with OOP. if you have a perfect understand of #OOP, there is really no need for interface. In any case, here are 2 examples of using "this" in both cases. #C#
I have this whole object-model in my head which is basically a compromise between class-based #oop, and prototyped with differential inheritance.
You would just need to differentiate between an objects namespace and its layout, decoupling state and strutucture. 'Layout' only being created when the object is used as a prototype, and the resolution chain would go local ns->local layout if any->proto layout. Changes to the layout would have to be done explicitly to get propagated down.
Drei Tage OOP gehen dem Ende zu. Anstrengend war's, aber gut. Danke @gazebo_c, das war sehr interessant und wird hoffentlich sehr hilfreich sein!
in case you prefer #functionalprogramming over #oop your primary motivation is /was