Title | : | 5 Tips For Object-Oriented Programming Done Well - In Python |
Lasting | : | 16.08 |
Date of publication | : | |
Views | : | 154 rb |
|
Few people can write good software, even fewer object oriented software, and virtually zero can write good object oriented software Comment from : Roger Isaksson |
|
What I tend to do is when functional programming makes more sense I put all the functions into a class that kindof describes what the group of functions does and make them all static methods or class methods Comment from : Ricardo Suarez del Valle |
|
Thank you for making this video Great advice Comment from : Chris M |
|
An hour video on proper compositional hierarchy programming for GUIs using Qt would be awesome Great vids Comment from : Three Legged Pig Studios |
|
all the fancy stuff is for the masturbators - guys who will 'learn' new fancy stuff or programming language every 6 months, insist on using it for EVERYTHING and abandon it 12 months later 'because new shiny thing' and leave their code for other people to maintain Comment from : YT feels like North Korea |
|
Are you 46yo? Comment from : Italo Buitron |
|
Step 1: Dont use Python Comment from : Hannes Baum |
|
Arjan I know why you like to talk about payment: You are dutch! :D Comment from : Labret |
|
quality content Comment from : Damian Games |
|
Tip #2 is one of the most helpful pieces of advice i've come across Applying that thinking to my classes has made my projects way more organized Comment from : Sam Leheny |
|
The dependency injection topic was something new to me, so thank you! Comment from : Bulelani Botman |
|
The only one of these tips that irked me was the separation of "behaviour classes" and "data classes" This irked me because that is a very close to C-style way of thinking, that is: procedural programming Right now, I'm forced to use Java, and I see this style in the code that my predecessors wrote It is hell to maintain as they had a "dto" obsession Every time I see a "data class" that isn't there to act as a projection of your business models or as a helper class because your function needs to return a value comprised of heterogeneous items, I cringe and start to worry about the maintainability of the code Yes, OOP isn't perfect, and Java is probably the worst way to implement OOP (*cough*C++*cough*), it feels like you're fighting an uphill battle when you go against these OOP principles Sure, it's "easy" and gets you some quick velocity, but the technical debt you accrue is so damn high It's insane Comment from : MarleyDX |
|
Awesome tutorial Comment from : Sherif Ahmed |
|
ive been using classmethods as a way to lock down interfaces, rather than using config filesbrbrespecially when it comes to pipelines good idea or bad? how would one use class methods? are they a replacement for a singleton? Comment from : Raven Echo |
|
Mid level engineer here Binge watching your videos like its netflix Hands down some of the best programming content on youtube Thank you! Comment from : Mista T |
|
wow I loved every bit of this videofrom the introduction to the end, as a self taught software developer in the making vidoes like this helps a lot, I did not only like but i subscibedThank you Comment from : Oluwabukola Owoeye |
|
You either want to do something well OR you do it in python Comment from : TsiGahn |
|
Great video! Comment from : Magnus Anand |
|
This is a really good video Only thing I'd say I disagreed with is separating classes by data vs behavior In theory this sounds nice, but when I get into a larger project I almost always need some of my data focused classes to be able to do some various behaviors I think separating those out too much from each other could pose other problems All about balance though Comment from : Jordan Mungo |
|
code MUST be readable by humans first, has been my motto for years And what you're saying is along those lines The more I watch of your videos ,the more I like I'm trying to "bing" watch your videos but my head feels like it may explode 🙂 Keep up the good work Comment from : Barry Kruyssen |
|
Isn't the Point of Objekt oriented programming to combine Data and methods? So that the class can stay consistent for the Data? Comment from : Kathi |
|
algo boost comment thanks for all your help! Comment from : Bikes |
|
tip 2 doesn't make any sense in terms of OOP By definition an object has state and behaviour So when the author is suggesting to keep the two separate, he is just better organising procedural/functional style code and it does not apply for OOP Comment from : balbir chahal |
|
I have a question about tip 2 If its not recommended to combine data and behavior classes, wouldnt we be against whath POO proposes about attributes and methods? Comment from : Miguel Vásquez |
|
Modula-2!!! Kudos from a Pascal lover! Comment from : edgeeffect |
|
Thank you! Comment from : D S |
|
I can't believe your channel hit 100K+ subs I have learned a lot from you Arjan, thanks for all the quality videos (and free knowledge) You deserve more Comment from : Neema Tsering |
|
Can you do a vid on import handling? Comment from : Noah Jones |
|
Excellent video about how to make the code cleaner and neat Thanks a lot! Comment from : Embru |
|
Great video! Comment from : DdOS |
|
"Object oriented programming is stupid" You should've stopped the video there 😂 Comment from : Daniel |
|
nice background Comment from : Олег Чередниченко |
|
Good stuff Separating data and behavior concerns is forward thinking Not being worried about strictly adhering to a design paradigm is so refreshing to hear; let's be practical! This is your best video, yet! Comment from : Slacquer |
|
I can see how Java gets a lot of heat for how things are done When I started studying computer science in 1999, no surprise, Java was all the rage Fortunately I had worked with Delphi before (a natural step up from my Turbo Pascal days in DOS), so I was able to tell apart what disadvantages are specific to Java and what to OOP in generalbrI have moved away to mostly working in C nowadays since I work as an embedded developer (never done C++), but I use Python for tools that make my life easier That's why I watch your videos When appropriate, I sometimes follow a semi-OOP approach in C, where I define a struct holding all data of that "object" and pass this (well, a pointer to it) to various functions that work on this data, much like the self parameter in an object's method in Python I even call the parameter "self" most of the time 😅 Comment from : Colaholiker |
|
Wow 🤩 luckily I landed on this channel and loving it Gonna go through each of the videos , amazing way of teaching Comment from : tir0__ |
|
I'm glad I found this channel Comment from : Justice Selasi Yevoo |
|
I'm making my way to senior and I would dare say you helped me a lot with getting to a whole different level of app design Thanks Comment from : No Stromo |
|
I enjoyed your video In your tip #2, it would be useful to add an explicit "Why you create separate data and behaviour classes" It sounds like you are transitioning to FP when you say that often the behaviour classes could be replaced by a module of functions Are you trying out any pure -FP languages? Comment from : Carl Hunter-Roach |
|
great tips Arjans Comment from : Iraj |
|
Its like arguing a hammer is always better than a screwdriver Comment from : digiryde |
|
O dear Comment from : Programming with John |
|
Thanks for sharing! What is the sound/track name at the end of the video ? Comment from : ££l337 |
|
Thank You,brbrFrom the Functools to DataClassess and now blending (F and OOP)brbrI feel this could have been your 7 steps pdf for download, lolbrbrI had a question about assigning a index in lieu of self generated indexingbrbrThere are (Cluster, Multilevel, Sparse, Hash etc)brbrI have a establisd mathematical function I would like to use to assign a index to the database instead of building out table relationships brbrI believe your depth of understanding of how to remain scalable and dynamic in your approach to coding gives me a bit of confidence that I can do something along these lines brbrThank you for your valued insight in this field brbrMy question is how can we have a discussion ?brbrMy bread just came out of the toaster, and butter must be applied for the best Bread in the WORLD, lolbrbrPS also my thumbs are cramping from this texting I need to use VOIP more often Comment from : Davis Rogers |
|
About inheritance: One more usage of it is for making C/C++ classes integrate better in a Python program Depending on how the C/C++ side is implemented, inheriting from these, or creating a class to wrap around them, might actually benefit the simplicity and readability of your code Comment from : Cheeba Digga |
|
I like your explanations Comment from : The TopShottah |
|
as someone who uses python for over 2 years now This is a huge added value for a 16 mins video Comment from : Adnane EL KASMI |
|
I've worked in crazy spaghetti codebases, and architecture astronaut code mazes After those experiences, I love this practical, real-world advice Thank you Comment from : Nitin Punjabi |
|
I don't think functional alone is conductive to clean code How do you group functions? How do you initialize data in a group of functions that share some state or configs? How do you decouple the functions' contract from its implementation, etc Comment from : Tea Bunz |
|
This video has a lot of boilerplate footage Comment from : Good luck America |
|
Thanks, I used the dictionary as a collection of functions/objects a lot but until this video, I did not realize that enums as keys can work really nice Comment from : oglop |
|
Superb tips Comment from : TechieGuy |
|
Writing object oriented code well is basically a process of mostly avoiding object oriented programming Comment from : Dino Dini |
|
For dataclasses, why don't we just use dictionaries? Comment from : Noël D |
|
#1 - Don't use OOP and prosper Comment from : Simon |
|
This kind of insight is quite rare for a you tube video Really well delivered on a topic that should be discussed more! brbrKey takeaway is mostly that your chosen method of programming doesn’t have to be right or wrong Is it useful? Is it readable to others in the team? brbrGreat work! Comment from : Ted Lerios |
|
Arjan, I love all your videos You are a great teacher I know it's not the focus of your video, but can you tell us how you have your line numbering setup in VSCode? Comment from : Jeffrey Ralston |
|
Data classes have brought way more OOP to my code A series of transformations on an object with predefined values is way easier to track compared to a dictionary Comment from : grant williams |
|
Thank you! 🙏🏻 Comment from : Dawid Dahl |
|
I really hate python Comment from : nathan ruben |
|
I did all your tips in my last refactoring and it's working wonders 😂 A sane combination of functional and oop is actually great for writing well-structured code without crazy side-effects! 😄brbrOne thing about turning behavior-oriented classes into raw functions: If you wanna do dependency injection and duck typing via protocols, it's really essential to represent your set of functions as a class because it's way more cohesive than passing each function separately (really helps readabity) And moreover something like attributes is necessary to store the handle to each dependency instance But for the rest of the video, I totally agree 😁 Comment from : Marco Tröster |
|
tip numebr one: don’t do it brtip numebr two: there is none Comment from : Rez |
|
Basically all big and popular Python libs are written in a OO manner OO and "Pythonic" is not contradictory IMHO, who believes that simply is a programming novice and has never worked on any bigger project in RL And sure: you CAN go even further and do everything using functional programming But than again: in RL good luck finding enough staff familiar with that to the required degree OO is here to stay for many more years to come because it maps relations in a manner how we associate things in our brains Easy to learn, hard to master Comment from : O |
|
So you just use it how Rust is? Rust uses Structs for data and "Traits" for behavior Rust has no classes I do like to keep data and functionality separated in any kind of programming language Sometimes the data can have some kind of "interface" on top of it for lightweight functionality But even that interface or lightweight functions are mostly separated haha Comment from : Aerism |
|
this is quality content for senior devs; you're talking about abstract topics that matters on the big picture/decision making of big projects; I loved it, subscribed! Comment from : Alberto Harres |
|
I am confused what is the meaning of @dataclass and @property?? Comment from : zeki |
|
Those look a lot more like procedures than functions to me Comment from : Niall Tracey |
|
Hey ArjanbrMaybe you'll consider making a tutorial about creating python packages with setuptools etc? :) Comment from : D P |
|
I noticed you sometimes use the UML class diagrams to explain some OOP patterns (eg adapter pattern) brI would love, if you would explain how to read those diagrams on some examples I can't follow them in other videos Comment from : Lud Orb |
|
Great topic indeed and looking forward for many such Comment from : Swadhikar C |
|
what is the -> operator? Comment from : Will D |
|
The point of classes is to group up related behavior and data together If you create a class just to store data, there are dictionaries for that If you want to group up functions, that's why we have imports and functions in single files Comment from : Jorge Escobar |
|
Classes to me are too repetitive and seems to nested, if that makes sense It’s on thing learning about students, and nr and subjects that fit into a class, and quite another to link duplicity name types with ’s Comment from : Jacques Gerber |
|
1 Tip For Object-Oriented Programming Done Well - don't do it in python ;) Comment from : Ivaylo Bonev |
|
Its not functional, its procedural Comment from : Demid Druganov |
|
Now this crack, is just unreal! Thanks for that ;) Comment from : c greek |
|
100 working THXs Comment from : #FREEZILLA |
|
OOP sucks balls Comment from : Handsome_Hero |
|
Amazing video Sir! Thank you very much for sharing your expertise with us! I always learn a lot from you! Comment from : Paulo Henrique |
|
Step one, forget about inheritance Comment from : Marcus Rehn |
|
You've failed at "object-oriented", there's no good way to run with a fridge strapped to your back xD Comment from : Vincent Rodriguez |
|
What the OP calls "functional" programming is actually procedural programming Writing stand alone functions does not mean you are using FP Full-blown FP is what languages like Haskell and F# do Python has limited FP capabilities Comment from : nccamsc |
|
you can use ide to navigate embedded classes, interfaces or abstract classes Comment from : sick000fight |
|
Rocking that shirt! And as always concise and wonderful video Comment from : Abhishek Srivastava |
|
Simply don’t do it python wasn’t made for it and it’s only there because it didn’t have structures Comment from : Platin 21 |
|
Here is your first tip abandon Python and use a real object oriented language Be definition, having to pass a reference to the class to each member of the class IS NOT object oriented It is just dependency injection There is no multiple inheritance (or inheritance at all to be honest), againdependency injection Python does not support actual polymorphism, at best it supports a weak version of overloading, but that really isn't the same thing Comment from : Andrew Erwin |
|
One thing I don't understand is why you see so rarely these tips applied, even in the python standard libary One recent exemple is the pathlib library It does everything you advise against like multiple inherentences and even the use of the fency i_new_/i to create an os dependant path instance So is it worth using this style of coding when not many people seem to use it ? Comment from : firefouuu |
|
This guy does create a lot of object oriented code, sometimes importing a couple of functions in a python script is all you need Comment from : DistortedV12 |
|
brother thanks for share this best Crack Comment from : ananda putra doneva |
|
OOP can be done well? what? WHAT? I've always thinked that the right way to do OOP is ditch it and use Procedural Comment from : Prag & Senss diary |
|
Best channel of advanced python OOP thanks! Comment from : RiptorForever |
|
With all due respect, the first example is not a combination of FP and OOP Here's an exemplification: "2" is an object in Python, and print() is a function But when we write "print(2 + 2)" we don't "combine FP and OOP" It is just old good imperative codebrbrWhen we put imperative code into a function, we don't do "functional programming" just because of that Functional programming is a quite special thing: it's a programming via function composition Likewise, when we put our code into a method, this doesn't make our code object-oriented OOP assumes certain specific principles (encapsulation, inheritance, polymorphism), without them it's all just using classes as C-like data structures Comment from : Виталий Сергеев |
|
thanks for the tips Comment from : hg |
|
you're using a wrong definition of functional programming It has nothing to do with using objects or not What you mean are stand-alone functions Comment from : Alex D |
Fundamental Concepts of Object Oriented Programming РѕС‚ : Computer Science Download Full Episodes | The Most Watched videos of all time |
Object-oriented Programming in 7 minutes | Mosh РѕС‚ : Programming with Mosh Download Full Episodes | The Most Watched videos of all time |
Object-oriented Programming Visually Explained for Data scientists РѕС‚ : Thu Vu data analytics Download Full Episodes | The Most Watched videos of all time |
Modular Object-Oriented Dynamic Learning Environment РѕС‚ : The Education Channel Download Full Episodes | The Most Watched videos of all time |
#TIK #13 Modular Object Oriented Dynamic Learning Environment РѕС‚ : Akademisi Muda Download Full Episodes | The Most Watched videos of all time |
Modular object-oriented dynamic learning environment LMS in Hindi Urdu LECTURE 19 РѕС‚ : Virtual Comsats Download Full Episodes | The Most Watched videos of all time |
Moodle|Modular object-oriented dynamic learning environment Lms in Hindi Urdu LECTURE 22 РѕС‚ : Virtual Comsats Download Full Episodes | The Most Watched videos of all time |
Moodle มาจากคำว่า Modular Object-Oriented Dynamic Learning Environment РѕС‚ : Ajan Pannavich Chanel (ช่องอาจารย์ปัณณวิชญ์) Download Full Episodes | The Most Watched videos of all time |
Moodle|Modular object-oriented dynamic learning environment in Hindi Urdu LMS in Hindi Urdu РѕС‚ : Virtual Comsats Download Full Episodes | The Most Watched videos of all time |
Moodle|Modular object-oriented dynamic learning environment in Hindi Urdu LECTURE 23 РѕС‚ : Virtual Comsats Download Full Episodes | The Most Watched videos of all time |