Page 3 of 3 FirstFirst 123
Results 51 to 71 of 71

Thread: OOP rant

  1. #51
    Sure, I've written OOP code in C, simply by using OOP notation style and malloc/free cycle. It's not a very efficient use of programmer and maintainer time, but you can do it. Some kids with no perspective were claiming that Java is noticeably slower than C, but that's an extremely naive POV.

    Of course you can create more efficient code in C than in Java, but generally you have a set amount of time to write your program, and with C, or PHP for that matter, you have to write an amazing amount of really basic code (think Collections in Java) yourself, and the results are often less than optimal because of the limited time available, and you have to debug all of that utility stuff yourself.

    When writing serious software with an adult software development team, the most efficient use of the team's time is achieved by using a system which provides a constant, common and complete conceptual framework, which has a reasonably efficient default implementation and which you can optimize within that framework where optimization is required.

    You'll understand when you grow up.

  2. #52

  3. #53
    Wow mikaelhg, you're just all sorts of wrong. Malloc/free cycle?? What does garbage collection have to do with OOP? And could you please explain to me what OOP notation is? Listen sweetheart, maybe some of the *kids* on this post are somewhat incorrect in their interpretation of what OOP actually is but you are just completely lost.

    I don't dislike Java by any means and I believe it has it's uses, but it is slow, like little yellow bus slow, and has little advantage over it's natively compiled couterparts, e.g. C++, aside from it's 'write-once run-anywhere' ability. In fact, developing can be more time consuming in Java when you factor in the effort spent continually optimizing code to improve it's inherently slow performance. True, C++ has no gc but with a good debugger and decent coding practices memory leaks can be virtually non-existent, and if discovered can be isolated and repaired relatively easily.

    BTW - I'm thinking 'collections in Java', and I guess I'm just not seeing it.

  4. #54
    Join Date
    Aug 2005
    Posts
    438
    I don't dislike Java by any means and I believe it has it's uses, but it is slow, like little yellow bus slow, and has little advantage over it's natively compiled couterparts, e.g. C++, aside from it's 'write-once run-anywhere' ability. In fact, developing can be more time consuming in Java when you factor in the effort spent continually optimizing code to improve it's inherently slow performance.

    This is just absolute rubbish. These are mere rumors about Java that were only partial true years ago and haven't been true for many years. Java is not much slower than C++, here I"ll say it again Java is not much slower than C++. Java even will out perform C++ in some things. Although a large project writen in Java is going to be slower, but not much slower (at most 10% or so). And ugh....development in Java takes much less time than development in C++. Furthermore when it comes time to do optimizations in your project the optimizations if anything are going to be faster to do in Java (and please note you'll need to optimize C++ just as much as you will Java code). But no doubt you have more control in C++ and this makes it more suitable for some tasks.

    Also your comments about memory leaks show you've never worked on a large project in C++ or C. Memory leaks are non-trivial to deal with, there are many examples of projects that have died due to memory leaks that could not be tracked down. Once the code base gets large memory leaks become extremely hard to track down.
    So when developing a project in C++/C you need to do unit tests on each piece of code so you can catch memory leaks locally when possibly, but this adds a lot of developoment time to your project. Furthermore it doesn't mean you aren't going to have memory leaks when everything is working together.

  5. #55
    This is just absolute rubbish. These are mere rumors about Java that were only partial true years ago and haven't been true for many years. Java is not much slower than C++, here I"ll say it again Java is not much slower than C++. Java even will out perform C++ in some things. Although a large project writen in Java is going to be slower, but not much slower (at most 10% or so). And ugh....development in Java takes much less time than development in C++. Furthermore when it comes time to do optimizations in your project the optimizations if anything are going to be faster to do in Java (and please note you'll need to optimize C++ just as much as you will Java code). But no doubt you have more control in C++ and this makes it more suitable for some tasks.
    Perhaps I should clarify, many low level non graphical calculations can be performed by java with little or no performance losses when compared to C++. When GUI's come into play, though, it is a different story, even with the advancements in the VM and computing technology in general. As far as development time, I think C++ and Java differ very little, but this is due largley in part to RAD environments. I could develop an app in Borland C++ Builder or VisC just as quickly as I could in J-Builder, and in a team environment this should be no different, as long as proper plans are laid and conventions are adhered to. Although I will admit that developing a *graphical* C++ app without an IDE is rediculous and it this case I would choose Java, but unless you're a masochist why would you ever be faced with this decision.

    As for memory leaks, C is more prone to them but Java is not immune either, and properly trained developers, coding standards, and testing/debugging practices can eliminate them in either language. I will say that you can get away with sloppier code in Java, thus making the planning phase less critical, but that is just stupid and shouldn't be acceptable in any language, and certainly not in a team.

  6. #56
    Join Date
    Aug 2005
    Posts
    438
    More myths.

    Java GUIs are not slow...Swing is not slow. GUIs in java are going to be a bit slower, but not much. And with GUIs it really doesn't matter, they are the sorts of things where speed is not the main issue.
    Its just as easy to make a slow crappy GUI in C++ as it is in Java, in fact GUIs are easier to make in Java. The only issue with Java apps is treading, you need to have a decent understanding of it to write non-trival java GUIs.

    Do you have a particular Java application in mind that is slow? Whenever I've seen a Java GUI app not respond fast it was a threading issue.

    Java also has all sorts of IDEs for it that speed up development, that are just as good as the ones for C++. Java remains faster to develop in because you do not need to deal with memory issues. These issues in themselves take up a lot of planning and testing time. Debugging is also harder in C++ than it is in Java.

  7. #57
    Join Date
    May 2004
    Location
    Singapore
    Posts
    263
    hmm... but the question here isnt Java vs C++...
    #include<cstdio>
    char*s="#include<cstdio>%cchar*s=%c%s%c;%cint main(){std::printf(s,10,34,s,34,10);}";
    int main(){std::printf(s,10,34,s,34,10);}

  8. #58
    Wow, you're one of the outnumbered here who actually read the topic..

  9. #59
    Join Date
    Aug 2005
    Posts
    438
    Wow, threads change topics.

  10. #60
    an interesting discussion of OO in the field of UNIX programming which seems closer to where the topic started (PHP).

    http://www.faqs.org/docs/artu/unix_and_oo.html

    "Since the mid-1980s most new language designs have included native support for object-oriented programming (OO). Recall that in object-oriented programming, the functions that act on a particular data structure are encapsulated with the data in an object that can be treated as a unit. By contrast, modules in non-OO languages make the association between data and the functions that act on it rather accidental, and modules frequently leak data or bits of their internals into each other.

    The OO design concept initially proved valuable in the design of graphics systems, graphical user interfaces, and certain kinds of simulation. To the surprise and gradual disillusionment of many, it has proven difficult to demonstrate significant benefits of OO outside those areas. It's worth trying to understand why............"

  11. #61
    Originally posted by Froggy
    Wow, threads change topics.
    Wow, I wonder why.

    I don't want to make this into total flame war so I'm stopping here. Please, try not to reply to this Froggy. Thanks.

    Back to the original topic - lots of people that actually took part on initial topic think that OO in php (version 4) is not just a lame feature but that it provides what it's meant to provide.
    This also confirms my thoughts that you don't need the biggest gun to fire a bullet, you can do it with any gun that provides basic means (bullet beeing OO, gun the language we use).
    Thanks to everyone who found the time to share the thoughts on the matter.
    Of course, there are people that rather disagree with my conviction, but that's the way it is.
    I'm just happy that I'm not alone in my thinking

  12. #62
    Join Date
    Aug 2005
    Posts
    438
    Yes you have a lot of people that don't understand OO or programming languages in general that are right with you in your thinking.

  13. #63
    Join Date
    Jan 2004
    Posts
    406
    Originally posted by Froggy
    I haven't looked into the history of OOP languages much but from what I know it was mainly created to deal with various issues in software development. That is OOP languages give you a better way of managing large projects.

    I generally use OOP for most of my projects both on the web and else where. In fact even when I use a language like C structure things a bit as if it was an OO language.
    Originally posted by Froggy
    But debating about whether you should use OO or procedural programming styles is pretty pointless, you should use whatever style you are most comfortable using.
    Amen!
    Affordable Business Web Site Hosting by Geo Redundant Hosting

  14. #64
    Originally posted by Froggy
    Yes you have a lot of people that don't understand OO or programming languages in general that are right with you in your thinking.
    Having read that from a guy who tried to compare Java and C++ in terms of performace really means nothing..also, you misunderstood what I wrote and it's either my bad english or something with your understanding of the same.
    But anyways, I have my oppinions and you have yours. The only difference is that I won't try to "convert" people to my way of thinking.
    I really dislike flaming, so I kindly ask you not to add oil to the fire anymore, if possible.

  15. #65
    Tommar: what I meant by managing the malloc/free cycle in an object oriented manner in C was that I define structs for my objects, include all resource allocation references (object graphs) inside these structs, and then create constructor and destructor methods which handle creating and releasing of all of the resources which are contained on that level of the object graph and one level down.

    That way, I can easily and separately test that each object can take care of allocating and releasing its resources, and be reasonably sure that those tests are valid on a systemwide level.

    Is this clear?

  16. #66
    Join Date
    Aug 2005
    Posts
    438
    Having read that from a guy who tried to compare Java and C++ in terms of performace really means nothing..
    And the myths live on....

    And the point of my comment is that: ALl the peole that say they do OO in PHP4 are people that don't have any idea what OO really is..they are thinking of object based programming. Whether someone uses object based programming or prodecural programming in PHP4 is a matter of personal preference. And this is what I said in the beginning I don't see how that equates with trying to "convert" people.

  17. #67
    We are talking about two total different aspects Froggy. I just deleted what I was writing the last 15 minutes since it would lead to even more argues.

    Just remember, OO IMO is a way of thinking first, and second - a language implementation. Even though PHP 4 lacks in implementation, I don't think that OO in PHP 4 should be ditched completely and that's what's it all about.

  18. #68
    http://c2.com/cgi/wiki?DefinitionsForOo

    There is no consensus on the definition of OO.

    However, PHP4's implementation of OO is of less value than the utter lack of OO implementation in C, which at least didn't come in the way of the developer, slow the system down, and provide developer and library confusion.

  19. #69

  20. #70
    Join Date
    Aug 2005
    Posts
    438
    However, PHP4's implementation of OO is of less value
    I don't believe the developers of PHP4 were trying to give an implementation of OO, they at least know what they did isn't anything close to OO.

  21. #71
    Join Date
    May 2004
    Location
    Singapore
    Posts
    263
    I don't believe the developers of PHP4 were trying to give an implementation of OO
    I could have sworn that I read an article last week (in an interview with one of the key players in PHP's development) that stated that PHP (which includes PHP5, and eventually PHP6, I suppose) would never really be designed with OOP in mind - unfortunately I cant find it.
    #include<cstdio>
    char*s="#include<cstdio>%cchar*s=%c%s%c;%cint main(){std::printf(s,10,34,s,34,10);}";
    int main(){std::printf(s,10,34,s,34,10);}

Page 3 of 3 FirstFirst 123

Posting Permissions

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