Ok, more religious oo talk, when I think of java I think of a call wrapper built on top of C++ and then interpreted.
No, I’m not in a religous battle. I’m just trying to be objective(haha pun intended). Seriously, the best thing in java is its natural straightforward OOP. If you use Java then you might as well
use all of the object oriented design, because otherwise I see no point in using Java at all.
As a language there are so many other ones with similiar syntax but after all not similiar OOP. Also GC helps a lot with OOP. Now, when using a language like Java, priorities should be(at least are for me):
1.) Clean, logical understandable code.
2.) Object oriented intependent classes.
3.) Reliable and error proof
Java = epitome of OOP.
C++ = dirty oop power house.
C = clean non-oop language.
However I can’t see why some people neglect the fact that Java is not capable of everything. Why? Because it is not meant to be. Singleton was adapted from C++, but are not the best way to do things in Java. You seem to clearly have your own view of what a singleton is and how it used, but I suggest you read Design Patterns by Gamma et al where the singleton patterns was introduced first academically.
[quote]Ok, more religious oo talk, when I think of java I think of a call wrapper built on top of C++ and then interpreted.
[/quote]
Hehe, then I can see why you have trouble with my views on Java and OO in general ;D
Here is probably where we differ the most - I can see many features in java that, for instance, make it a better imperitive (spelling?) language than even C (maybe not better than ada though)- great compiler checks, garbage collection and rather close to optimized C performance on most accounts (where all within 20-80% C speed is close enough - it usually is, i.e. only linear slower, sometimes even faster in a few cases where runtime information can increase speed even further than a static compiler can).
OO is just the big thing now - what will it be 5,10 or even 20 years? I’m sure OO will still be around, but I’m equally sure that there will be The Next Big Thing that will treat OO just as we OO programmers sometimes treat impertive and procedural programmers.
And becuase java the platform is just that, a platform, it will probably be around then too
Here I agree - just that I would add
2.1) If above doesn’t work good enough - don’t hang on to it like a religion
Well, java is not really object oriented (according to some definitions…) - say that it is in a smalltalk user group and you’ll see my point
Nah, Singletons have nothing to do with C++ they have (without any facts) probably been around a long time before C++ came around.
I’ve read that book (or atleast a couple of chapters of it, and others in the same category) and I can say to you that it’s not a bible, just a cook book of different recipies. As in, all recipies can differ from country (language…) to country while still being considered the same dish ;D
And YES, java is not good for everything and you can’t do everything in java - but that is another story.
[quote]1.) Clean, logical understandable code.
2.) Object oriented intependent classes.
3.) Reliable and error proof
[/quote]
You’ve got it almost backwards for me. Is not reliability no errors the most important thing for a program? The other aspects are only good for the programmer. Usually there are more users than programmers and it is the use of the program that is the whole point.
C is clean?? C is old and well understood… but clean isn’t the right word. C is just a small abstraction on top of an assembler.
Java is a general purpose language and as such is it is capable of almost everything. (I think it can do a perfectly acceptable singleton… at least for any definition of singleton that I would care to use.)
I like OOP, and use Java… but there are other reasons to use Java as well… the great tools and libraries being significant factors.
Yeah, and I once got badly bitten by the fact that instanceof operators then stop working!
Class.instanceOf() definitely stops working as expected (unless you know all about ClassLoader’s and the above-mentioned fact), but IIRC “instanceof” also stops working as expected (apologies if this is wrong, I’m going off the top of my head here.
Personally, I follow Bjarne Stroustrup (C++ inventor); an “Object Oriented Language” is one that “supports” the major features of OO in a way that makes them easy to use. You can do OO in assembly, and could hence argue that assembly is an OO language (in fact, it’s probably the most OO language because you have the most freedom to do any kind of OO however you want ;)).
C++, Java, Smalltalk, Modula-2 and others are all examples of different sets of OO features, supported in different ways. There’s no such thing (at the moment) as a “reference implementation” of the archetypal OO language.
Java’s two main differences over what has gone before are:
Lots of things that “seemed like a good idea at the time” (e.g. various aspects of C++) but turn out to be nightmarish in practice - on real projects - were cleaned up / excised (although many agree that initially this was taken too far…)
1.b. …and lots of things that other languages had discovered really were a good idea, but only a few languages were currently doing.
Standardisation of the libraries…and making sure the libraries encompassed all the major things they ought to (again, not achieved perfectly - e.g. regexps should have been in much earlier in an ideal world - but the intention was clear)
Your list makes sense to me, but I think you could have phrased it a little better. Number one priority should be phrased “ease of maintenance, including source upgrades/redevelopment” - since this is where the greatest unnecessary cost is in normal development.
I think your second ought to be phrased “loosely connected interface implementations (OO)” - i.e. the claim to fame of Object-Orientation (Objects use encapsulation etc to be highly modular, and robust to unexpected/unforseen changes in the design of the overall application…hence easy to replace, easy to change, easy to re-architect, easy to reason about/explain, etc)
…and I think you ought to include “standard libraries” in the top three too. If you were around in the bad old days of non-standardised C you may remember the pain of everyone re-inventing the wheel, with each library having it’s own unique unfixed bugs.