|May the source be with you, but remember the KISS principle ;-)|
|Contents||Bulletin||Scripting in shell and Perl||Network troubleshooting||History||Humor|
Dr. Nikolai Bezroukov's Devil's
on "Thinking in Java" by Bruce Eckel.
Disclaimer: I would like to stress that the role of devil's advocate is to be critical. At the same time I believe than Java has a bright future and that TIJ can be listed among ten best books on Java. That's why I am writing this Commentary. This Commentary is a work in progress. Currently it is incomplete, buggy, and may contains bad links. All views expressed in the Commentary are my own.
The main problem with Chapter 1 is an uncritical acceptance of OOP by Bruce Eckel. Quite a better title would be "Introduction to Java". The chapter contains a lot of useful material, but IMHO it is somewhat more close to OOP evangelism, than I would prefer. OOP has been touted as the next great advance in software engineering. It promises to reduce development time, increase code reuse, etc. The question never asked by the author in this chapter is very simple: "Is this true ?". As this question was left out I will try to explore it below from the point of view of cynical, skeptical old programmer.
Java does have an important advantages and they are well described in the book. Among them:
But in order to understand the language fully one need to understand not only advantages, but disadvantages as well. I will try to summarize Java disadvantages below.
The first and probably key problem with Java is that it's too new and changes too fast. Each new version of JDK makes books and programs written in Java more or less obsolete. Generally a programming language need at least 10 years before is become stable enough to be used in large projects.
The second important problem with Java its complexity. More than 1000 pages for an introductory book is quite a lot. I doubt that Java can be mastered by a programmer without extensive background in C++ or Smalltalk in less than a year. Java is more complex language than PL/1 which at one point was considered a huge language and created KISS movement in programming languages represented by C and Pascal.
For example C -- a hybrid of PL/1 and BCPL is a programming language designed for writing Unix, and it has a minimalist set of constructs that permit both writing a decent compiler and OS. To keep language simple strings were made not first class data type. But simplicity is a very important advantage. Some people have called C a fancy assembly language and that's a very good point that can explain why C became popular and PL/1 obsolete although PL/1 in many respects was vastly superior to C (much better string handling, much better I/O, excellent exception handling, even rudimental multitasking, etc.).
C compilers were simple, were easy to port (can be ported by a single person), required few machine resources to run, and provided about 60% of what you want from a programming language. PL/1 compilers require a huge investment to write, were not easy to port and generated programs were less efficient than in C. Half of the computers that exist at any point are worse than average (smaller or slower). C works better on them. C philosophy means that implementation simplicity has the highest priority. Currently Java is big, complex and slow (probably factor 5-10 comparing to C, depending on the application ).
Java is the one of very few languages that supports multithreading ( Simula 67 - the grandmother of object-oriented programming, Algol68 and Modula support co-routines, PL/1 and Ada support multitasking) and has a usable (albeit pretty complex) exception handling mechanism. Exception handling and multithreading considerably add to the complexity of the language.
To master "Java for applications" one needs to know three major areas:
This scope is definitly beyond one single book. So one may need the following additional books:
Fortunately a lot of books in each area are now available. That's one of the most important advantages of studying a popular and fashionable language.
Java definitely can compete with VB and PowerBuilder as RAD language in commercial environment. It is a better language and in certain(but not all) aspect is a better implementation that VB.
Like VB it has a powerful marketing behind it so there are a lot of high quality commercial Java development environment and a lot of books are published on the subject. So in any case where now people use VB or PowerBuilder, they will probably be better using Java. Bruce Eckel is one of the first authors of books on Java who correctly stated that Java is more is a replacement of VB than for C++.
I am skeptical as for Java in system programming area, for example as a replacement for C/C++. IMHO that promise will never materialize. Ability to view an area of memory in a different ways is fundamental to system programming and here Java with its OOP bla-bla-bla definitly sucks. Speed is another problem. Currently Java is slow. Presence of garbage collection make debugging difficult and execution time non-deterministic. Moreover garbage collection is sometimes harmful in system programming when real-time performance is needed.
The OOP paradigm also is far from being useful for system programming. Those who do not believe are encouraged to try to rewrite the first volume of Donald Knuth "Art of computer programming" in Java. Not much fun :-(. In C++ if you do not want OOP you just don't use it, and when you don't need C++ you can use C. In Java ignoring OOP it more complex. Using C is possible only via native methods, so it's much more painful than in C++. Also important is the fact that C++ is much more mature language. Even in v.1.2 (that probably should be called version 3) Java still is pretty much in the state of flux.
You can notice that Java programs tend to be bigger (i.e. contain more lines of code) that programs in procedural languages like VB or Perl. For problems like compiler writing programs in Java also tend to be more obscure than programs in procedural languages like PL/1 or C.
Some words about debugging. Although Java (like Pascal in the past) sometimes is hyped as a Newspeak of computer languages -- the language in which it is impossible to have impure thoughts, reality is different. Generally I prefer the language that has the best debugger and best integration with the underling OS. For example C on Unix. Currently Java provide decent, but definitely not the best debugger for small and medium size projects and weak debugging support for complex projects. Heap allocation make debugging of complex system programs much more difficult (just compare complexity of Java memory allocation model with assembler or Fortran allocation model). I really do not envy the programmer facing the debugging of the program that run into JVM errors or some king of error on the border between the program code and JVM code.
There are already a couple of failures is using Java as a system programming language. Corel abandoned plans to rewrite its Perfect Suit of office applications, such as WordPerfect and Quattro Pro, in Java. Corel even ran TV commercials about it. Lotus got nowhere with its Cona suit of Java components. Oracle also quietly abandon its plans of "Java uber alles" and now use it mainly as more decent front-end to the Oracle databases that this horrible PL/SQL. Both Corel and Lotus experience shows that system programming projects in Java are currently a risky undertaking.
Is Java productivity promise real? The answer is: "under certain circumstances and to certain extent". With beans Java probably can be more productive than VB and Power Builder. Without beans gains in productivity are marginal -- it's just a better language although possibly some gain can be achieved due to a huge class libraries and a better integrated environment (for example Jbuilder 2.0 is very impressive).
Also gains in productivity are application area dependent. We probably can get better productivity in developing database-related and WEB-related applications -- where Java standard library provide rich set of primitives that can simplify the writing of the program. At the same time CGI programming and text processing are areas were Java sucks. I am skeptical of Java ability to compete with Perl in these two areas.
For me it is still unclear to what extent pain of learning Java can be translated into gain in productivity of writing complex applications. Other than beans, an important productivity gain can be achieved by using multithreading. But here we have too few programmers that are able to realize these gains.
I would like to stress that the most dramatic improvement in productivity and reuse in Java can come from beans. So beans are probably the most important feature of Java. With beans, Java became strong tool for integration of components, where we can use tested and proven components in our implementations.
Anyway, to be productive in writing commercial applications in Java one needs to know a large number of standard classes (class library). I would like to stress that this more complex task than leaning the language and it requires good guidance, documentation, search and indexing capabilities, tools that can hierarchically present all the reusable parts in a readable manner and a lot of time.
No language is perfect. But some people that I respect are very critical of Java.
Linux Torvalds (do not take his words for grated -- all he is doing all his life is just debugging Linux kernel ;-) in his interview to Inforword (see Linus Torvalds talks economics and operating systems) said:
InfoWorld: What do you make of Java?
Torvalds: I dislike the hype. I think it's way overhyped. I'd like it to have a more proven track record and I think the licensing restrictions are hurting it. I understand why Sun wanted to have them in place, but I also think that it means Java does not get as well maintained. Right now, if somebody notices a bug in Java, it's pretty hard to fix unless you're inside Sun. But the major issue is that it's a good idea whose time has come. It's an idea that's been done before, but you didn't have the same kind of hardware power you have today. Also you didn't have the same kind of software interfaces, so right now it is possible to make Java efficient? Potentially, it's a great technology, but it's unproven and there's been way too much hype.
The author of STL Alexander Stepanov in an interview for Edizioni Infomedia srl took an extremely critical view on Java. He said:
I spent several months programming in Java. Contrary to its authors prediction, it did not grow on me. I did not find any new insights -- for the first time in my life programming in a new language did not bring me new insights. It keeps all the stuff that I never use in C++ -- inheritance, virtual -- OOP gook -- and removes the stuff that I find useful. It might be successful -- after all, MS DOS was - and it might be a profitable thing for all your readers to learn Java, but it has no intellectual value whatsoever. Look at their implementation of hash tables. Look at the sorting routines that come with their "cool" sorting applet. Try to use AWT. The best way to judge a language is to look at the code written by its proponents...
Of course one can argue that Stepanov is interested in defending C++ as his STL library is now included in standard. Still IMHO there are several design flaws in Java, some of them probably serious. Among them:
There are also several implementation issues:
The acceptance of Java on Internet is exaggerated. According to WSJ Java used on less than 1% of all WEB pages with many sites abandoning the multimedia Java applets for simpler technologies such as animate GIFs.
One should understand that OOP is an old hat and several OOP-based languages are 10 or more years old and still fail to achieve wide acceptance and are limited to narrow niches. The classic example of such a language is Smalltalk -- paradoxically only financial institutions used it to a limited extend in real world projects. Success was mixed although Smalltalk programmers were very well paid ;-)
OOP attempts to decompose the world into objects and claims that everything is an object. But saying that everything is an object not always provide an useful insight into the problem. Just think of sorting. Will it help to sort the file efficiently if you thing that the records are objects. Most probably not.
OOP starts with classes. But the essence of programming are algorithms. Only when you understand them well, can you come up with optimal storage structures for solving the problem.
The words "religious" outline the last problem. Many people/authors now tend to look at programming styles and languages like religions. Object-oriented programming (OOP) is often treated like a new Christianity and religious zeal of converts is often border with stupidity. So it definitely attracts charlatans which propose magic cures like various object methodologies ;-).
IMHO OOP more looks more like a paradigm shift that a language breakthrough. Much like a religion OOP introduced entirely new and quite obscure terminology with the purpose of mystifying the real underling mechanisms. It has not added a single novel concept, but it emphasizes two old, and definitely useful, concepts:
Thus, whereas in reality in Java you activate a procedure by calling it, sometimes in Java books it is incorrectly called sending of a message to the method. A new structure is no longer built by extending an existing structure, but by defining a subclass which inherits its superclass. A positive site of all this OOP blah-blah-blah is that many people learned for the first time about the important notions of data type, encapsulation, and of information hiding. This alone would have made the leaning of Java worthwhile, even if one didn't actually make use of its later on.
From the point of view of teaching OOP should probably be treated as an important aspect of programming in the large more like a methodology that a basis for a universal language. IMHO it should logically follows programming in the small and requires sound knowledge of procedural programming. And it should be compared with alternative method of integrating components like traditional shells, REXX and Perl. In any case due to complexity Java is far from being the best first programming language. It's too far from the underling machine architecture of Pascal, C, Modula. Even Perl and REXX are somewhat better. They are much easier to understand than OOP approach and they are sufficient in most cases for writing small and medium size programs.
Perl is a interesting example from the pinot of view of viability of OOP as a universal
paradigm for programming in the large. Object-oriented features in Perl are somewhat
counter-intuitive to the Perl way of life. At its heart, Perl is a language for creating
scripts to handle routine text-processing tasks. Object-oriented design requires careful
planning and adds a additional layer of complexity to the software development process.
Why add this complexity to Perl? It's a very useful language even without this
OOP-orientation should not be a language issue. It is more a methodology, which, ideally, should be available in any language, but it is not suitable to any problem. Things that have state and change their state are natural candidates to be represented as objects. Here are some guidelines to help decide if an object-oriented approach is appropriate:
If the answer to any of the above questions is "Yes", then you might benefit from an object-oriented approach. Otherwise you will be in much better shape using regular procedure-oriented approach. I think that GUI-centered programs benefit from OOP approach most.
I would like to stress the importance multithreading in Java. As for paradigm shift,
Java can be compared to introduction of a local LAN instead of mainframe. That mean that
we now have a bunch of small, autonomous PCs each with own CPU, communicating with each
other via messages over the net. It takes some imagination to see a simple procedure call
as a real message passing mechanism -- only threads communicate through real
messages. So true object model is intristically connected with multithreading, yet this
connection is not understood well. True message mechanism presuppose that object
(autonomous PC with its own CPU) was active before receiving it and will be active
after processing it. To certain extent real OOP-style is a special case of
I would also like to see comparison of polymorphism, encapsulation, and inheritance with other approaches to programming in the large, for example with UNIX paradigm of shell programs that call small C-programs. For example as for encapsulation UNIX paradigm is as good as implemented in Java. All we have to worry about is what will be visible from the outside of UNIX utility are parameters one input and one output stream. Unix utilities are limited to one input and one output stream. But this is not critical limitation of the pipe model: for example VM/CMS pipes can have multiple input and output streams.
Polymorphism, means that object type can vary. Probably the easiest way to achieve polymorphism is to represent everything as a text string, Of course you need to pay for this. BTW polymorphism has nothing to do with inheritance or any other OOP mechanism. Moreover polymorphism and generic programming to certain extent contradict OOP idea of inheritance.
If one discard all this OOP-oriented blah-blah-blah, inheritance is just a useful mechanism of working with structures. It is simple, yet a very powerful mechanism to identify and extract repeated part of structures. Inheritance brings "classification" into focus. So programmers with a good classification skills will benefit from this approach most. Those that do not have these skills would most probably a pain a the neck for those poor folk that will mantage thier programs, if any.
I would like to stress it again that from the point of view of design the most
important part of Java is a built-in multithreading. Other than that Java is pretty much
"politically correct" C++. Threads are active objects, much like actors in actor
based languages. They do not need to receive a message to be in the "active"
state. They are independent and concurrent objects and really can communicate through
asynchronous messages. Name of the method became like a kind of unique mail
Java is not an open source product and I'm disturbed about handing over control to Sun, because of their track record. Sun's treatment of other server-making companies (Digital in particular) in the past can easily be likened to Microsoft's treatment of Internet content providers in regards to Netscape. This suggests that if Java takes over, Sun will become the next Microsoft. I don't like the fact that Sun - a company that has proven it is just as ruthless and bullying as Microsoft when having similar advantages - might control the important Internet standard. We screwed up by handing over control to Gates with Ms-Dos and Windows -- so what it the reason of handing control to McNealy with Java. For years, McNealy has talked the talk of open systems, taunting Microsoft, challenging it to put its Windows APIs into the public domain. It's time for McNealy to put up. Or shut up and let Java die.
Sun treatment of Java is very controversial. Sun can't/hasn't built a Java VM for Intel processors that is light and fast. Microsoft seems to know this stuff better. Sun is first and for most a developer for its own platforms. Also if Sun is going to charge royalties for every copy of the product other companies develop using Java companies will look at going back to C++ to avoid paying royalties for the use of a language and compiler.
Now about difficulty of having a single JVM. All the fuss between Sun and Microsoft was because MS wanted to do their own JVM and add stuff to it. Yet the main (and only?) advantage of Java is portability -- 'run anywhere'. Without open VM this will never materialize and now it is probably to late to save Java by opening VM. We're all back to square one except W Gates III has a very big grin on his face. In late 1998 Sun started realizing that Java will remain a very poor application platform compared to the Win32 API, but may be it's too late. As with most things made by man the genie of diversity cannot be kept in the bottle.
I think Java needs:
1.The Java API should reside with an open, neutral standards committee.
2.Better local applet caching and versioning.
3.Better authentication and verification.
4.An independent testing facility to verify that Java applets meet specifications.
I think there's no greater danger than letting one company control the language. IBM showed it with PL/1 all too well.
Java should be considered a competitor/replacement to VB and PowerBuilder, but to much less extent to C/C++. Beans are the most important productivity enhancement in Java and are especially important in a corporate environment. Despite its good qualities, Java appeared on the scene after its competitors were already established. Whether Java advantages are enough to persuade the hundreds of thousands of VB and Power Builder out there to switch remain to be seen.
Java (and OOP in general, irregarding the amount of books published or money OOP missionaries make ;-) need to stand the test of the time. Don't put all eggs into one basket. It's more wise to consider Java as yet another (although important) programming language. Java is more suitable to programming in large than low level programming. Knowledge of C/C++ is very important for a Java programmer -- in real projects part of the solution (probably up to 20%) are better written in C as native methods.
As of v.1.2 Java is still immature language and pace of change is too high for Java to be used for large scale projects. For pilot projects one needs the right people, a lot of training, and right tools. Java will never replace other languages. It will be just one more language suitable for particular areas. Currently the most promising areas for Java are:
Outside GUI-based application, servlets, database applications and a limited number of areas well served by OOP paradigm, Java it does not matter much and will not give a significant boost in a programmer productivity.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes. If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner.
ABUSE: IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days. Multiple types of probes increase this period.
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haterís Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least
Copyright © 1996-2016 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License.
Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info|
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: February 09, 2014