Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18
Dolda, Well, I guess you really don't like OOP. Did you have a bad professor or something when taking an OOP class(jk)? Inheritance is a way of reusing code in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    OOP


    Dolda,

    Well, I guess you really don't like OOP. Did you have a bad professor or something when taking an OOP class(jk)?
    Inheritance is a way of reusing code in OOP. You don't have that in C. You can reuse C code but if you wanted to improve it, inheritance provides a simple way of doing it. Without OOP, you need to do a lot of parameter passing. You stated that its just useless wrapper code. Well, it's wrapper code but it's certainly not useless. It is useful otherwise Java wouldn't have been born. By the way you are judging OOP, I suppose you aren't a big fan of Java either.
    All I can say is that there are different circumstances for different approaches. If I'm writing code in the procedural or modular approach, I'll use C. This is to say that not one language is better than the other. However, some language maybe better suited for a certain task.
    Don't be afraid to yell at me from time to time. Everyone yells at me. =)
    The best things in life are free.

  2. #12
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I've never liked OOP, even though I haven't had a single teacher that has been able to teach me anything about programming. I've just never seen any real use for it. Please note that most of my comments about OOP applies to normal programming, ie. compiling to machine code and running it directly on the processor, etc.
    While I did find inheritance interesting when I first learned about it, and though that "this should be very useful", it has turned out to be different. Not a single time when I've been programming in C have I ever thought that "Oh, how much easier this would have been with OOP and inheritance". With problems related to code reuse and modularity, I have experienced very few problems at all when programming, and not a single one where OOP would have made it easier. Could you please tell me a real world example of how inheritance solves something that would have been even a little hard to do otherwise? I'd honestly be very interested to hear about it. Like I said, I find C++ utterly useless, and that is simply because this far I haven't found a use for it.
    However, I'm not as much against Java. Since you've left the point on running on the processor behind you, it doesn't really matter anymore. Any language should be made to best fit the machine that's interpreting it, and while C is very appropriate for normal hardware processors, I guess that Java is the best language for the Java VM. Not that I use Java, though, but I don't have anything against its OOPishness. I would prefer a non-OOP language for it though, but I guess that just wouldn't be as good.

  3. #13
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    real world exp

    Hmm,

    Real world experience... the best example that I can use is the Java classes themselves. Every Java class extends from class Object and most of them also inherit(technically not really inheriting since Java only provides one source of inheritance) from other classes via implementing. If that's not enough to satisfy your thirst, then I've nothing more to give.
    The best things in life are free.

  4. #14
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Well, Java doesn't really apply since the virtual machine on which it runs is so object oriented. It simply wouldn't be possible to do it any other way in Java, since there is no alternative.
    What I was really looking for was some C++ example where inheritance actually proves it more useful than C or solves a problem.

  5. #15
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    you got me there

    Dolda,

    You got me there. There is nothing that you can't do in C that you can in C++ besides classes and related materials. Classes are really just a more fancy way of doing things by making them easier to use. The one thing that I do adore about C++ is operator overloading. Of course you need classes in order for this to work.
    The best things in life are free.

  6. #16
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I kind of agree, operator overloading could be welcome in C, but it's not really that great. After all, how hard is it to write add(var1, var2) instead of var1 + var2?

  7. #17
    Linux Engineer
    Join Date
    Nov 2002
    Location
    Queens, NY
    Posts
    1,319

    again, point taken

    Dolda,

    Yes, operator overloading is really for ease of code readability and nothing more. As far as I'm concerned, most people don't use it often because they don't have the proper training in using them. Overall, I think it's a pretty cool feature. Another feature that I really like are templates in C++. Of course the STL is one of the biggest contribution in C++ and many people use those classes.
    The best things in life are free.

  8. #18
    Just Joined!
    Join Date
    Mar 2005
    Posts
    1
    Does this Dolda guy still object to OOP? lol

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •