Jump to content

Advice on learning OOP (Object Orientated Programming)

loepa

i'm currently studying in computer science. Next semester I'm going to get OOP, can anyone give me advice so I can learn OOP the right way,or easily. forgot to say : I'm using C++

MB :MSI Z77a G45 | Proc: I5 3570K (Stock) | HSF : CM 212X turbo | RAM : Corsair Vengeance 8GB (2X4GB) | VGA : MSI GTX 660 Twin Frozr | PSU : Corsair GS600 | Case : CM Storm Enforcer | Storage :  OCZ Vector 128GB, WD Blue 500GB , Samsung 840 Evo 120GB, WD Blue 1TB

Link to comment
Share on other sites

Link to post
Share on other sites

All programing is arbitrary. Just keep how you pass data straight and u'll be OK! What language is it in ? C++ ? I got lucky and took it in Python first... which made it a lot easier as OOP is super easy in python as you don't have to iterate everything.

I have a 2019 macbook pro with 64gb of ram and my gaming pc has been in the closet since 2018

Link to comment
Share on other sites

Link to post
Share on other sites

c++ for me

MB :MSI Z77a G45 | Proc: I5 3570K (Stock) | HSF : CM 212X turbo | RAM : Corsair Vengeance 8GB (2X4GB) | VGA : MSI GTX 660 Twin Frozr | PSU : Corsair GS600 | Case : CM Storm Enforcer | Storage :  OCZ Vector 128GB, WD Blue 500GB , Samsung 840 Evo 120GB, WD Blue 1TB

Link to comment
Share on other sites

Link to post
Share on other sites

Learn about classes, access specifiers (public, protected, private), inheritance, polymorphism...

Link to comment
Share on other sites

Link to post
Share on other sites

The biggest thing about object oriented programming is learning how to reuse code. You want your function library to be able to be used for multiple applications within your program. I like to have a coupe different libraries that i end up reusing for multiple projects. The thing about creating libraries and then being able to create obejcts in your programming is that you can reuse your libraries on other projects if you write them open enough to be used that way.

One good thing to do is to get some libraries that are pretty common in use (you can even just go get something in PHP) and then walk through applying the library to a task. You will start to see just how easily applying a library can be and how much nicer it makes your programming life. Remember, the goal is to program less while doing more.

Top down programmers bug the crap out of me when you are trying to figure out how to troubleshoot something. I will often take a web app and just rewrite it because it actually costs less for me to redo it than to unscrew whatever someone else did because either a lack of documentation or a lack of sanity while they programmed it to begin with.

01110100 01101000 01100101 00100000 01110001 01110101 01101001 01100101 01110100 01100101 01110010 00100000 01111001 01101111 01110101 00100000 01100010 01100101 01100011 01101111 01101101 01100101 00101100 00100000 01110100 01101000 01100101 00100000 01101101 01101111 01110010 01100101 00100000 01111001 01101111 01110101 00100000 01100001 01110010 01100101 00100000 01100001 01100010 01101100 01100101 00100000 01110100 01101111 00100000 01101000 01100101 01100001 01110010

 

Link to comment
Share on other sites

Link to post
Share on other sites

My advice would be to start with a different language than C++. Java is very similar to C++ but it offers an easier learning experience in my opinion. Also, if you don't want to get caught up in the syntax and just learn OOB functionalities like polymorphism and other powerful concepts Python offers an easy experience.

EDIT:

I am currently learning C++ in my CS courses and in my opinion the functionalities that I am used to using very easily in JAVA and Python are more difficult to do in C++. It's up to you though I'm sure you can have success either way. I do agree C++ is a great language because it seems to be one of standard languages in business

CPU: Intel Core i5 2500K | Case: Bitfenix Prodigy | Motherboard: GA-H61N-USB3 | RAM: Corsair 8GB 1333 MHz Video CardEVGA GTX 660 Superclocked 2GB DDR5

Power Supply: Corsair CX 430 | SSD: Samsung 840 120GB | HDD: 2X Seagate Barracuda 500GB 7200rpm | Monitor Asus PB238Q & Asus PB278Q

Mouse: Lenovo N50 | Keyboard: Apple Pro Keyboard | Operating Systems: Hackintosh OS X 10.8.5 & Windows 8.1

Link to comment
Share on other sites

Link to post
Share on other sites

If you can, learn OOP in a different language first. Since you are in C++, try looking at Java, since both languages are similar and Java pretty much forces you to use OOP to program.

As @Diventurer said, the major concepts to know are "...classes, access specifiers (public, protected, private), inheritance, polymorphism..."

For C++, just take note of the syntax used. If you have prior experience with C++, it should not be too difficult to learn OOP in C++. C++ has other concepts like pointers and memory allocation.

And remember, Google is your friend :D. There are a lot of resources on the web that you could look at to get a head start.

Link to comment
Share on other sites

Link to post
Share on other sites

In my class I am teaching C++, and I can't help but notice that the transition from simple programming to more complex programming, to objects to classes is much easier to understand than C++.

And Java is a terrible first language for anything, imo. You have to accept a hefty (more than C++) amount of code/boilerplate and ways of doing thing for reasons you can't understand, just to get started. And when it's all done, most Java students still have trouble with pointers. I've seen 2 students, one knowing C++, one knowing Java, for some reason get workloads assigned to them in the language the other knows, but they do not. By the end of the summer, the C++ student was cranking out Java code. and the other still did not have functional C++.

One of the most effective ways I have found to understand the core of what OOP is, is to take the things I learn in a static language like C++, and apply them in a dynamic language like Python. You stop and ask yourself why you are doing what you are doing, and what the additional effort is getting you. It also helps you discern quirks of the language/type system from what OOP really is.

Link to comment
Share on other sites

Link to post
Share on other sites

wow thanks for the reply.

Since I dont have enough time to learn java/python until my class start again,I guess I'll just learn OOP using c++ for now.

I'm wondering what Language I should learn next holiday? java or python or other language?

MB :MSI Z77a G45 | Proc: I5 3570K (Stock) | HSF : CM 212X turbo | RAM : Corsair Vengeance 8GB (2X4GB) | VGA : MSI GTX 660 Twin Frozr | PSU : Corsair GS600 | Case : CM Storm Enforcer | Storage :  OCZ Vector 128GB, WD Blue 500GB , Samsung 840 Evo 120GB, WD Blue 1TB

Link to comment
Share on other sites

Link to post
Share on other sites

Python is the language of science.

I have a 2019 macbook pro with 64gb of ram and my gaming pc has been in the closet since 2018

Link to comment
Share on other sites

Link to post
Share on other sites

wow thanks for the reply.

Since I dont have enough time to learn java/python until my class start again,I guess I'll just learn OOP using c++ for now.

I'm wondering what Language I should learn next holiday? java or python or other language?

If you have the time, I would recommend learning Python while you learn OOP with C++. It's amazingly simple. But if not, I still recommend it after.
Link to comment
Share on other sites

Link to post
Share on other sites

Especially if you are using Java, program to an interface, not an implementation. Make sure all code you write has a purpose, and that you test your code based on use cases. This will prevent your code base from "rotting" (not knowing the ins and outs of how everything works) and make software you write more flexible and reliable.

Your professors will stress points like those as you get into topics like software engineering, and OO analysis and design

I do not feel obliged to believe that the same God who has endowed us with sense, reason and intellect has intended us to forgo their use, and by some other means to give us knowledge which we can attain by them. - Galileo Galilei
Build Logs: Tophat (in progress), DNAF | Useful Links: How To: Choosing Your Storage Devices and Configuration, Case Study: RAID Tolerance to Failure, Reducing Single Points of Failure in Redundant Storage , Why Choose an SSD?, ZFS From A to Z (Eric1024), Advanced RAID: Survival Rates, Flashing LSI RAID Cards (alpenwasser), SAN and Storage Networking

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×