Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,637 members, 7,958,933 topics. Date: Thursday, 26 September 2024 at 07:38 AM |
Nairaland Forum / Science/Technology / Programming / I Need Help In Object Oriented Programming (1892 Views)
Tutorial: Object Oriented Programming Paradigm For Beginners in Python / Object Oriented Programming (OOP) Tutorial / Object Oriented Programming (2) (3) (4)
I Need Help In Object Oriented Programming by Ajibade123(m): 3:12pm On Mar 21, 2020 |
I ain't a guru in programming. I started programming about a year ago as per computer science student. so far in school we have treated languages like Vb.net, and C but in each of these languages we didn't really go too deep. for the vb.net I think we stopped at conditional statements or so but for the C we did some basic aspect like functions, arrays and little of pointers, we briskly treated stack and heap but didn't go any further than just the explanation. Now this semester we are doing python which is an object oriented programming language and the whole concept of object, class, inheritance and polymorphism is really looking so strange and confusing.... please I really need any sort of help you can offer to me I really like programming but this is starting to confuse me...our programming classes right from year 1 is nothing to right home about we learn majority of if ourselves I tried reading through the recommended text but I still don't grab it 1 Like |
Re: I Need Help In Object Oriented Programming by Nearbyproperty(m): 3:30pm On Mar 21, 2020 |
Google,youtube,podcast should be your best friend as a programmer: for a better understanding of OOP in python: check out these source:https://www.programiz.com/python-programming/object-oriented-programming |
Re: I Need Help In Object Oriented Programming by MT: 10:00am On Mar 22, 2020 |
If you can answer this question. Why do we have object programming when we have function in procedural languages?. That will open a whole lot of windows to understanding the reason for object oriented programming. If you need more help, feel free to ask. |
Re: I Need Help In Object Oriented Programming by shegzhkn: 1:30pm On Mar 22, 2020 |
Ajibade123: you attend which school ?? |
Re: I Need Help In Object Oriented Programming by Nobody: 2:06pm On Mar 22, 2020 |
shegzhkn:Same question I was about to ask. Maybe a private school. OOP is easier than procedural methods. I was more confused than you when I started learning OOP but then I discovered it was the method of teaching that made it look complicated. The only way you can understand the topic is by working on a real life application. |
Re: I Need Help In Object Oriented Programming by shegzhkn: 2:20pm On Mar 22, 2020 |
Cakephp: You nailed it boss. |
Re: I Need Help In Object Oriented Programming by MT: 5:57pm On Mar 22, 2020 |
Let me give you a little scenario that might help you. Let us say in order to cook soup, you require 2 steps: First Step - You grind pepper using the blender. Second Step - You pour the pepper into the pot. In order to write this in code, you can either go procedural way or OOP way. For the procedural way, you can write TWO separate functions (let's call the function name - GrindPepper() ) to grind pepper and then write another function (let's call the function CookPepper() ) for cooking the pepper inside the pot. Yes the code will work as you planned. Another way is to see everything as an Object. You can treat the blender as an object and the Pot as an Object. How? you ask me. Well by developing code for the blender and the pot. See sample code like this: class Cooking { public void Blender(var Items) { //this code contains how u intend to blend } public void Pot(var Items) { //this code contains how to cook } } Now the thing is this code will achieve the same result as the code for the procedural BUT the difference is massive. For the procedural way, if you need to blend any other object, let us say okro, you will need a brand new code which you will have to rewrite to handle it. The same thing if you want to cook any other thing, let us say Rice. The code in the procedural function is tied to "grinding pepper" and "cooking pepper". With the OOP way, the blender can blend ANYTHING (just pass the object into the method) and the pot can cook anything (just pass the item you want to cook into the pot). So the OOP make the code to be REUSABLE and FLEXIBLE. In real life scenario, when you are confronted with a scenario, you need to know how to identify OBJECTS and how to identify METHODS and how OBJECT interracts with another OBJECT (Class Diagram). That is another scenario entirely. I hope this gives you the head up you require in your journey into programming. 6 Likes |
Re: I Need Help In Object Oriented Programming by Ajibade123(m): 6:52pm On Mar 22, 2020 |
shegzhkn:University of Lagos |
Re: I Need Help In Object Oriented Programming by Ajibade123(m): 6:52pm On Mar 22, 2020 |
Nearbyproperty:thanks a lot I will check it out |
Re: I Need Help In Object Oriented Programming by Ajibade123(m): 6:54pm On Mar 22, 2020 |
MT:I don't understand |
Re: I Need Help In Object Oriented Programming by Ajibade123(m): 6:56pm On Mar 22, 2020 |
Cakephp:how can I get to really like it bro... about the teaching method don't let us even go into that one |
Re: I Need Help In Object Oriented Programming by Ajibade123(m): 6:58pm On Mar 22, 2020 |
MT:wow you are a bomb |
Re: I Need Help In Object Oriented Programming by Anonime1105(m): 9:53am On Mar 23, 2020 |
MT: I believe this poster did justuce to the question, but could learn more from YouTube, w3schools.com etc You can as well follow this link https://beginnersbook.com/2018/03/python-tutorial-learn-programming/ for a detailed python oop tutorial |
Re: I Need Help In Object Oriented Programming by shegzhkn: 1:14pm On Mar 23, 2020 |
Ajibade123: CS major right ?? OOP is straight forward and can be fun, you just need the right approach ... OK |
Re: I Need Help In Object Oriented Programming by MT: 1:23pm On Mar 23, 2020 |
When it comes to programming, always get the understanding (the why) before the implementation (the how). Tutorial most times will expose you to the implementation and most times when you are confronted with a real life task, you won't be able to successfully apply the supposedly gained knowledge. It takes a bit of research to understand the whys of any technologies. ICT is deep and steep but doable. 1 Like |
Re: I Need Help In Object Oriented Programming by Deicide: 10:48pm On Mar 23, 2020 |
Lol OOP in python is shït if you wanna understand OOP try Java or Ada programming language, then you can come back to learning it in python which would still confuse you! Therefore my first statement up there. Good luck. 2 Likes |
Re: I Need Help In Object Oriented Programming by MT: 9:04am On Mar 24, 2020 |
Deicide: I think you are wrong. OOP is a practice and can be applied to any programming language. The implementation can be different in every programming language but the objective is still the same. What I have observed is many people focus on programming languages here. You shouldn't. When you understand WHY you are using certain architectural design, you can pick any programming language and work with it. A good programmer doesn't focus on type of programming language, they just understand the principle and any programming language will become easy to use. I laugh when I see people talking about java vs c# etc, it's unnecessary. Languages are just mere tools to implement the solution to the problems you are confronted with. Always have a simplistic view to solve problem, then you will realise programming is not as complex as you think. 1 Like |
Re: I Need Help In Object Oriented Programming by WebMind: 2:37pm On Mar 24, 2020 |
I like that MT's analogy of soup making algorithm in OOP and procedural approach. OOP is real-world centric. It breaks things down into how they are in real world and makes life better and simpler for programmers. If u create a blender object in OOP, u can then create a different blend() methods to handle different combination of ingredients or create on blend() methods parameters that can help differentiate how to handle different soup ingredients. if the is blend(Duration blendtime) function, you could call that method on pepper with a blendtime higher than that of okro because okro generally needs less time to blend. |
Re: I Need Help In Object Oriented Programming by MT: 3:31pm On Mar 24, 2020 |
WebMind: Nice if I was to implement that, I won't create different methods inside the class as the class will be unnecessarily bloated and still wont cover everything we need to blend inside the blend method. I will rather create an interface or abstract class and make the concrete class inherits it and overrides the blend method in the abstract class or implement the interface. This way your blend method can execute as you wish and you would have achieved "loose coupling" which is good for unit testing. Let's keep sharing idea. Smiles. |
Re: I Need Help In Object Oriented Programming by IMO01: 7:30pm On May 23, 2020 |
MT: Please how do one get d why help with example please? |
Re: I Need Help In Object Oriented Programming by Eyssant(m): 3:25am On May 29, 2020 |
You can take a beginner step by following basic lessons of OOPs. After that, you can take it forward and can get expertise in it. |
Re: I Need Help In Object Oriented Programming by avijeet26: 2:37pm On May 08, 2023 |
As with any other programming idea, the best thing to do after learning any syntax is to practise the concept exercises and enhance your skills. The same is true for Python's object-oriented programming. Here are some useful websites for learning OOPs ideas in Python with programmatic examples: 1.https://pynative.com/python-object-oriented-programming-oop-exercise/ 2. https://www.techgeekbuzz.com/blog/python-object-oriented-programming-exercise/ 3.https://gist.github.com/KirosG/f265f136bd97bd669632fa0f2f2721b4 I hope these materials will assist you in practising and comprehending the concept. |
(1) (Reply)
Javascript Problems / How To Shut Down Or Restart The Computer With A Batch File / Programmers In Da House Pls I Nid Ur Help
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 63 |