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.
So, why is OOP pushed so hard?? hard enough to make me question my own interest in learning programming basics from C?
Well, some people have a bug up ...
There are fanatics of any programming language or even programming concept. At one time Pascal was the king of languages and all other computer languages will be forgotten in only a few years. Yeah - and where's Pascal now?
Then there's OOP - but don't confuse OOP and C++ - read about 'smalltalk' if you want some clue about the OOP inventor's ideas. So there are OOP fanatics tied to one language or another (and they are possibly more hostile to the other language than to a language which doesn't claim to be OO). OOP is the best thing on the planet and all other programming languages will die in just a few years.
You will also see fanatics of other concepts such as strict type-checking, magic garbage collection, and so on. The trick is to know what you're doing and what you're trying to achieve - and if you're really good you'll learn to ask the fanatics all sorts of simple but fundamental questions which they will not be able to answer...
LOL, yeah, that could explain why some people think the LHC is going to end in apocalypse. Nearly all of it is programmed in java. So far for anyone pretending that java is slow and unreliable. Or they may be right - oh no, here comes the black hole!
LOL, yeah, that could explain why some people think the HCL is going to end in apocalypse. Nearly all of it is programmed in java. So far for anyone pretending that java is slow and unreliable. Or they may be right - oh no, here comes the black hole!
Programmed in Java? OH! *That* must be the 'beast' referred to in the Book of Revelations! We *are* doomed! For people who remember ancient comedies from the UK, imagine John Laurie staring into the distance and muttering "doomed ... doomed ..."
LOL, yeah, that could explain why some people think the LHC is going to end in apocalypse. Nearly all of it is programmed in java. So far for anyone pretending that java is slow and unreliable. Or they may be right - oh no, here comes the black hole!
I have a very hard time believing this.
I would quickly believe that the component that is intended to use otherwise unused CPU cycles in machines around the world would be in Java, but that certainly isn't "nearly all" of that system, and I seriously doubt that the major components of the system - the components that control and monitor the LHC itself and collect the data - have any Java in them.
Yeah, there's no accounting for taste in programming language, eh? Now - is it compiled Java or pseudo-code? Put it on Winduhs and you have an excuse to buy a few thousand more cores for that supercomputer.
LOL, yeah, that could explain why some people think the LHC is going to end in apocalypse. Nearly all of it is programmed in java. So far for anyone pretending that java is slow and unreliable. Or they may be right - oh no, here comes the black hole!
I know, mostly I thought it was nonsense until I heard they used java ... prepare for the end
At least, the end should be slow - due to Java performance issues .
Nice to know that we are gonna have a slow and painful death
Well, besides jokes from those of use who dislike Java and sometimes are a little more biased that I would like to be, this demonstrates that ultimately is the skill of the programmer which counts.
However, not all language are good for everything, and Java is not an exception.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Don't expect that a slow death. Quoting the CERN guy:
Quote:
In the past, Java had a reputation for being slow compared with traditional languages, such as C++ and Fortran. Today, however, with advances in compiler technology, it equals and sometimes outperforms C++ in many benchmarks.
I definitely agree with that statement.
Java has superseded C, C++, Fortran, Cobol and the likes in many areas. C is slowly becoming a niche programming language while Java is now amongst the general purpose ones.
Unlike the java bashers I read in that thread, I feel very comfortable with Java. I used to program in C twenty years ago and I love this language. I occasionnaly still write code in C and have fun doing it.
However, I slowly switched to Java in the late nineties. At that time, Java was indeed a poor performer but its other qualities were already worthing the move. I'm always disappointed to see people having such a negative and misinformed opinion about Java.
Don't expect that a slow death. Quoting the CERN guy:
I definitely agree with that statement.
Java has superseded C, C++, Fortran, Cobol and the likes in many areas. C is slowly becoming a niche programming language while Java is now amongst the general purpose ones.
Unlike the java bashers I read in that thread, I feel very comfortable with Java. I used to program in C twenty years ago and I love this language. I occasionnaly still write code in C and have fun doing it.
However, I slowly switched to Java in the late nineties. At that time, Java was indeed a poor performer but its other qualities were already worthing the move. I'm always disappointed to see people having such a negative and misinformed opinion about Java.
AFAIK, Java runtime is implemented in "C", not even in C++.
And from programmer's point of view, just have a look at, say, the right column (compared to the left) here:
http://www.ultimatepp.org/www$uppweb$vsswing$en-us.html .
Admittedly, part of the overhead is not Java itself, but the strange desire to first declare private variables and then to declare public methods to set/get them, but prevalent fashions tell a lot about the ecosystem ...
Interestingly enough, C# has default setters/getters which can be later overridden, so, at least, no private members <-> public methods default craze.
Admittedly, part of the overhead is not Java itself, but the strange desire to first declare private variables and then to declare public methods to set/get them, but prevalent fashions tell a lot about the ecosystem ...
So what happens if you write a library and you provide direct access to all your variables? If you see a reason to refactor - and it happens more often than you think - you are bound to the current interface because client developers have come to depend on it. Change the interface and you cause massive code breakage and treat yourself to a stream of angry mails. In other words, you have tied yourself by the hands and the feet. On the other hand, if you use setters and getters, you can strip out/ reimplement nearly anything and you have greatly reduced the risk of incompatibilities
Quote:
Interestingly enough, C# has default setters/getters which can be later overridden, so, at least, no private members <-> public methods default craze.
What is the point of using default setters and getters if your members aren't private in the first place?
So what happens if you write a library and you provide direct access to all your variables? If you see a reason to refactor - and it happens more often than you think - you are bound to the current interface because client developers have come to depend on it. Change the interface and you cause massive code breakage and treat yourself to a stream of angry mails. In other words, you have tied yourself by the hands and the feet. On the other hand, if you use setters and getters, you can strip out/ reimplement nearly anything and you have greatly reduced the risk of incompatibilities
What is the point of using default setters and getters if your members aren't private in the first place?
"Refactoring" is my favorite word among OOP proponents - it means:
we first do, then think;
when we realize we've screwed up; we rewrite the code;
we use the "refactoring" euphemism to cover our screwup.
Regarding
Quote:
what happens if you write a library and you provide direct access to all your variables
I did _not_ write this.
In fact, I'm very much _for_ encapsulation.
Logically first to encapsulate a variable by making it private and then to allow access to it using public methods is, at least, funny.
Again, the difference between
Code:
instance.a = foo;
and
Code:
instance.set_a(foo);
is purely syntactic.
And the point of default setters/getters is that if instead
Code:
instance.a = foo;
behavior you suddenly want
Code:
instance.a = 2 * foo;
one you add an explicit setter for 'a' in the class description, i.e. the compiler will use overloaded '=' for the 'a' data member.
I think it's a good idea - because writing all those 'set' and 'get' methods the way it is done in Java is simply brain dead.
In the past, Java had a reputation for being slow compared with traditional languages, such as C++ and Fortran. Today, however, with advances in compiler technology, it equals and sometimes outperforms C++ in many benchmarks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.