C vrs OOP

This is a discussion on C vrs OOP within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Originally Posted by simpleid OOP isn't any different in concept based on your exposure to languages He didn't say it ...

  1. #31
    Disrupting the universe Mad_guy's Avatar
    Join Date
    Jun 2005
    Posts
    258
    Quote Originally Posted by simpleid View Post
    OOP isn't any different in concept based on your exposure to languages
    He didn't say it was 'different in concept,' he just said it's something nice if all you've had before is something like C or pascal.
    operating systems: mac os 10.6, debian 5.0, windows 7
    editor: back to emacs because it's more awesomer!!
    version control: git

    website: http://0xff.ath.cx/~as/

  2. #32
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by matsp View Post
    And of course other languages aren't? There is only one thing the processor(s) can execute: Machine code. Anything else has to be translated first. Whether you translate it DIRECTLY from assembler, macro assembler, C, Pascal, Fortran, Cobol, ADA or whatever is irrelevant - they are all "computer languages" - just more or less directly translated from what the programmer wrote to machine-code (and not ALWAYS obviously so, compilers sometimes produce not-so-obvious code).
    Programming language means features. Assembly doesn't have features - it does exactly what you tell it to do and nothing more nor less. You write one instruction - it is one machine code instruction after linking. Assembly is a human-readable form of machine code with no modifications (only storing used registers on the stack). It changes with the processors, it can't be developed as a language. Macros and other "features" sometimes used in Assembly code are totally assembler-specific stuff, not part of assembly.

    Assembly can't be compared as a language. It is not portable because it is basically machine code, which is different for most devices.
    Quote Originally Posted by Rashakil Fol
    Object oriented programming (don't know why people here are capitalizing it the way the Bible capitalizes The Lord) is wonderful if all you've been exposed to beforehand is C or Pascal.
    It's the same thing what we've done in C, just looks a little different.
    Quote Originally Posted by brewbuck
    Can BOTH be viewed as "object oriented." C++ just uses a different syntax which makes it more apparent that the object is the important concept. C focuses on the function, not the object.
    What you think is important IS important. People rely too much on the syntax.
    Quote Originally Posted by Mario. F
    It's not C over C++ now. I think it's OOP over non-OOP... but then and again I may be wrong. Maxorator entertains me so much I forget to listen.
    You got that right.

    I never wanted to say anything is better. My point is that OOP is not The God, it's just a form of syntax. If you like the syntax, go ahead, use it. But worshipping it is just silly. It is just another form of syntax like any other. The only thing that really matters is the programmer (of course I like to remind once in a while that performance of the program is important too), other things affect very slightly. Code is not better or worse depending on the language's syntax. Programmer is not better or worse depending on the syntax of the language (s)he uses mostly.

    Have fun.
    Last edited by maxorator; 08-20-2007 at 04:12 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #33
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    before you said so, no one was claiming it was "The God", no one important that is. Not even Bjarn Says so. Though he does find it an improvement on some of the antiquated constructs of C.

    Also getting upset because someone capitalizes it is ridiculous.

  4. #34
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I just noticed that the concept of OOP is frequently considered too important. It isn't. Programmers are important. The syntax doesn't really matter.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  5. #35
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,411
    OOP is not a syntax. It's a programming paradigm (http://en.wikipedia.org/wiki/Object-...ed_programming and http://en.wikipedia.org/wiki/Programming_paradigm)

    As a concept it is responsible for major changes in the industry and one of the key players of most of what you use today as far as software is concerned. The problem with OOP is that those you criticize are those who tend to bring religion into these things.

    The fact is that OOP doesn't need champions of the cause. It speaks for itself when used on those situations where it makes sense to use and it has nothing to say to its detractors either, because it doesn't pretend to be the solution to Life the Universe and Everything.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #36
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I always learned OOP as more than just syntax.

  7. #37
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Quote Originally Posted by maxorator View Post
    What you think is important IS important. People rely too much on the syntax.
    How can a person "rely on a syntax?"

  8. #38
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    lol, rely on syntax, that would be every programming language in existence... even assembly. technically, in the most fundamental meaning of the term, even machine language probably could be said to have syntax.

    http://en.wikipedia.org/wiki/Syntax

    we do rely on syntax, but saying we rely too much on the syntax is like saying, "you worry too much about grammar."
    yea well you sort of have to in -any- context to communicate anything in understandable terms.
    Last edited by simpleid; 08-21-2007 at 07:51 AM.

  9. #39
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Posts
    307
    OOP has many advantages over Procedural Programming.

    Some keys to OOP programming design:

    1) Encapsulation. (Private members)
    2) Inheritance. (Derived classes)
    3) Polymorphism. (Virtual functions)

    These 3 things allow programmers to write code that is easier to understand and maintain and also modify by adding new features on top of what already exists.

    Procedural programming has gone by the wayside these days, because it has been shown to lead to hard to understand, unmaintainable, and unmodifiable code.

    That's what they tell me, anyways.

    Specifically, C++ has a lot of great features such as the powerful STL and templates, while still allowing low level things like pointers and other things from C.

    Personally, I think C++ is the best OOP language because of these reasons. I did some Java, but I didn't care for the increased class overhead and the lack of pointers (I am too used to straight C/C++). The problem with Java is you HAVE to make a class for EVERYTHING. Annoying, IMO. OTOH, Java has a GREAT built-in GUI (swing/awt) and toolkits for just about anything you'd ever want to do.

    For testing algorithms and data structures, I like straight C w/o the class overhead. It's gonna be fast, simple, and reliable, w/o dealing with OOP syntax problems that will occur. Then, once my base code is tested, I can easily move that code directly into a class framework with some accessor functions and I gain the advantages of an OOP designed program.
    Last edited by MacNilly; 08-22-2007 at 04:56 PM.
    GCC on Fedora Core 10

  10. #40
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Posts
    307
    Quote Originally Posted by maxorator View Post
    I just wanted to say they're not so much different from the ordinary C-style and OOP should not be worshipped as it was something revolutional. It's just an alternative way with some extra features.
    Hmm, I'm going to have to strongly disagree with this.

    First, OOP and "C-Style" (Procedural programming) are quite different. While OOP should not be worshipped (nothing should be worshipped. imo), it definately WAS something revolutionary when it was introduced, because it solved MANY problems that programmers were facing with large code bases back in the day.

    It's just an alternative way with some extra features
    In a way, yes. We could also say the same about C to some assembler language. Can anyone say that C was not a revolutionary step from assembly?
    GCC on Fedora Core 10

  11. #41
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Posts
    307
    Quote Originally Posted by robwhit View Post
    The advantage of C compared to asm is portability. C++ compared to C doesn't have that advantage.
    No, there is more than one advantage here. Portability is not "THE" advantage. Some other advantages include: production time, maintainability, and maintenance costs. Also, C is only portable only if some C compiler has been written in assembly on the base architecture.
    GCC on Fedora Core 10

  12. #42
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Posts
    307
    Quote Originally Posted by maxorator View Post
    OOP doesn't make the developing much faster, it makes it look clearer. Big and complex systems have been programmed in C. All the ways of handling data like classes do were used long before classes were invented.

    Assembly isn't actually a programming language. It's human-readable machine code.
    Machine code is human readable. You just have to know HEX like the back of your hand and have a big reference manual next to you.

    Yes, assembly IS a programming language. It has it's own syntax wherein one symbol means one thing, and another symbol means another thing, ect.. How is that any different than any other programming language?
    GCC on Fedora Core 10

  13. #43
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Posts
    307
    Quote Originally Posted by brewbuck View Post
    Templates, inheritance, polymorphism, and exceptions work together to give you a language that simply WORKS DIFFERENTLY that C. It encourages a different way of thinking about the problems.
    I agree 100%. I posted some things above, but completely forgot about exceptions. Those and templates are awesome and powerful programming tools.
    GCC on Fedora Core 10

  14. #44
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by MacNilly View Post
    No, there is more than one advantage here. Portability is not "THE" advantage. Some other advantages include: production time, maintainability, and maintenance costs. Also, C is only portable only if some C compiler has been written in assembly on the base architecture.
    I agree with you on that.

  15. #45
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I disagree, but only with the last point. There is no need to write a C compiler in assembly for every architecture. Once you have a C compiler written in C for an architecture A and it runs there, you can write a code generator for another architecture B, still in C, and run it on architecture A to compile the compiler and code generator so that they run on architecture B. Voila, you have just used a cross-compiler to bootstrap the B architecture, without a bit of assembly.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Page 3 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP flu
    By Hussain Hani in forum General Discussions
    Replies: 15
    Last Post: 06-27-2009, 02:02 AM
  2. Should OOP be any new language priority??
    By Hussain Hani in forum General Discussions
    Replies: 80
    Last Post: 06-13-2009, 10:56 AM
  3. Data Mapping and Moving Relationships
    By Mario F. in forum Tech Board
    Replies: 7
    Last Post: 12-14-2006, 09:32 AM
  4. recommendation for a good OOP book
    By Mario F. in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2006, 04:28 PM
  5. OOP Theory Question
    By Zeusbwr in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2005, 07:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21