![]() Inside you define its behaviour through functions (methods) that you can make public or private to keep the object as hidden and pure as possible. You want to have the data/variables and its behaviour closed in one single unit. The strengths of OOP are as follow Encapsulation methods: functions that define the behaviour of the object. ![]() attributes: parameters that define the state of the object.The class defines what you can do with the object and how other objects will be able to interact with said object once it's created.īoth the state and behaviour are modified through: The interactions are defined (just like instructions) inside the class through state and behaviour. So, to make things clearer, you have a design called class then you use that design to create a new object of that class with which you will be able to interact and use. NB: in languages like C++ you need to take care of the memory usage, however a lot of languages have garbage collection implemented nowadays so you don't have to worry about when your objects disappear from memory. behaviour (what can it do or what can it be done to it).You use that blueprint to create (or instantiate) the object that will run in memory. ![]() Objects are made through classes, what does this mean?Ĭlasses are blueprints for whatever you want to make. However with good practices and proper object modeling we can avoid having such a mess. It seems secure and it can be as complex as you wish, yet simple to understand. So you start looking at OOP and it makes a lot of sense! You have everything organized in objects that call other objects and are related to one another. So you ask the kind souls at StackOverflow, at which some reply and mention OOP before your thread gets deleted because code monkeys decide to fight over Objected Oriented Programming VS Functional Programming. You look outside and it's a beautiful day, you definitely can miss this weather so you decide to stay home and code.Īfter making a beautiful hello world program you feel good and empowered to try something more advanced, and you wonder, how should you organize or even where to start. However and as we all know there's never a clear answer when it comes to software engineering, it boils down to two magical words: " it depends".įeel free to correct me or provide feedback, you can find me on twitter OOP: what a beauty Most people already do all this without thinking, perhaps the post will just server to illustrate certain actions or thoughts. This post goes through basic concepts that every developer should know or at least be familiar with in some way or the other, it's an entry point to good practices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |