ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
True, in the *basic* sense that is what it can mean when you are provided a library from an external source, but there's more to it than that. Using OOP, it's much simpler to model actual events, items, etc. within code, and in effect making something a lot simpler to implement.
It sounds like you're actually using it without knowing it if you are already linking against others' object files.
No I'm not, I just was explaining
In a nutshell, OOP allows you to create an instance of an object and to perform actions against it or use it to perform actions against other objects.
What exactly is an "object" and why is it called that? Don't the words "SOFTware" and "object" mean the opposite?
Software engineering is so much easier that way. If you're using classes, or objects in any way then you are using OOP to some extent without knowing it.
What exactly is an "object" and why is it called that? Don't the words "SOFTware" and "object" mean the opposite?
Within OOP code, an object is essentially an the replication of a thing in the "real" world. Each part of an item can be broken down into individual components to simplify the coding process and the combined into a larger item (class) that is a composite of the smaller ones.
i.e.: A car has an engine, a body, and wheels (keeping it simple). Each part would then be created as separate classes to depict the characteristics of each. Another item (vehicle) would then be created containing all the other three (engine, body, wheels) to create a car that can have a customized engine, body, or wheels simply by modifying the requested object. Does that help to clarify things a bit?
Quote:
Originally Posted by resetreset
?? why would i be using classes?
As I said earlier, it's just much easier maintenance-wise when using classes. Find the offending object and modify/correct it once (possibly) instead of multiple modifications/corrections within procedural code.
Also, as Nylex said, you don't have to use OOP to write in C++.
Surely you shouldn't just write an idea off because you don't understand it?
As has already been said OO programming is essentially a tool to add some structure to the design of a program. You don't need it, but it can help.
It also helps when the inevitable maintenance of a program comes along by providing structure to the code and protection against doing something inappropriate with the data.
Within OOP code, an object is essentially an the replication of a thing in the "real" world. Each part of an item can be broken down into individual components to simplify the coding process and the combined into a larger item (class) that is a composite of the smaller ones.
i.e.: A car has an engine, a body, and wheels (keeping it simple). Each part would then be created as separate classes to depict the characteristics of each. Another item (vehicle) would then be created containing all the other three (engine, body, wheels) to create a car that can have a customized engine, body, or wheels simply by modifying the requested object. Does that help to clarify things a bit?
I've heard things along these lines hundreds of times, no, I don't get it, like I said.
OOP isn't necessary to express an algorithm from what I can see, which is what a language is for.
As I said earlier, it's just much easier maintenance-wise when using classes. Find the offending object and modify/correct it once (possibly) instead of multiple modifications/corrections within procedural code.
Also, as Nylex said, you don't have to use OOP to write in C++.
Surely you shouldn't just write an idea off because you don't understand it?
I talked about Max..?
Yes, *I* should definitely write an idea off because I dont understand it, others are welcome to do as *they* please. But unfortunately this live-and-let-live policy isnt working when eg. to program in Flash when I just want to concentrate on making the page that I have an idea for, the *only* option is to use actionscript which has those bloody dots everywhere, then maybe I have to do something..?
As has already been said OO programming is essentially a tool to add some structure to the design of a program. You don't need it, but it can help.
In Java the line to PRINT a bloody string has dots in it, I think around 3 or 4 of them - can you please tell me what "structure" this is providing?
I greatly dislike structure. It's essential reason, the reason you're saying the things you are is because as I said, you can't get 10 people to work on the same program if one of them is a little "unstructured". I often wondered how these internet collaboration things like cvs etc. work - if you and programmer B halfway around the world both have the same variable, wht does it do? does it tell you? does it (my god!) CHANGE it to something not colliding?
And just out of curiosity, how much of the stuff on your nice install DVD is OOP?
It also helps when the inevitable maintenance of a program comes along by providing structure to the code and protection against doing something inappropriate with the data.
The best software in the world were the games of the 80s (you really *were* expecting a "IMHO" weren't you? ), like Pacman. All that going on on hardware that todays people can't even *imagine*, without OOP, without HLLs - just ASM. It was Structured enough to run, and that's all that I'll ever need.
resetreset, you dont like C, you dont like OOP, so what language do you use?
I mean, OOP is a novel concept if you have never done any real programming or only worked with Basic, but after you get the hang of it the whole concept makes a lot of sense, code is a lot easier to maintain, and a lot of the time easier to understand when you come back to it later.
The only OOP language I've used so far is Java, and IMO its a VERY easy language to learn. Maybe you could start there...
you're confusing syntax (dots) with a paradigm (OOP). Certainly it is true that applications don't have to be coded using OOP but for many programs and many programmers it certainly helps. Also it has received a lot of hype the trick is to find the right balance.
resetreset, you dont like C, you dont like OOP, so what language do you use?
I currently have ended up not programming because of this. I think I wouldn't mind C without pointers -I've looked into this: www.processing.org and I think that's what I'll haeve to end up using, it's somewhere in the middle but even IT has oop.
Last edited by resetreset; 07-21-2008 at 03:24 AM.
OOP is absolutely great, in its place. I have seen it abused to the point that the program was incomprehensible. I have also seen it employed correctly so that a large project was both comprehensible and maintainable.
Check if you can find any universities (or similar) sites where they have their course material freely available. There are some, and the material is usually pretty good; if you can find a site where there are small "tasks" you should do, instructions on how you should start solving them and then the ready source code for the final app (an example code, there's no need to do things exactly like it), you're good to go. I think programming is easiest/best learned by doing it, not just reading a book (I usually use books as a reference, not as the "main source" of knowledge) -- try, fail, retry, succeed and you'll learn a lot better than by just trying to memorize everything. Start with simple enough tasks, then add some personal curiosity into the programs and so on.
A course I attended last spring started off the classic hello world program using std::cout, and though the course wasn't very long, in the end I was able to create (as my last course exercise) a small IRC-resembling server-multiclient communication program (actually programs; server and client were two different things). The best thing was that it actually worked
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.