Fallacy 1) bash scripts are used to start up programs, therefore it is useful for many things.
-- In reality Java is better at solving most business related problems / patterns.
Fallacy 2) logging is not very useful in Java
-- I agree it is abused, and it shouldn't be relied upon entirely. But for me logs help a lot, believe me, but to a non java-expert they may not help much).
Fallacy 3) XML hell: XML is bad, therefore java is bad.
-- Java developers often loathe XML too :-) XML is not Java in any case. XML does have its uses (representing hierarchical data). It is unwieldy to work with and expensive for resources. JSON is solving some problems here.
Fallacy 4) Stuff can be obfuscated, therefore things are only hard to maintain when somehow obfuscated.
-- In reality unofuscated stuff can be hard to maintain.
Fallacy 5) It takes hundreds of lines of text to say hello world in java
--
class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. } }Fallacy 6) splitting things into lots of parts is harder to maintain
-- The reverse is true, unless, of course, the developer has got the level of abstraction wrong (the "ravioli" anti-pattern that applies to any language).
Such misconceptions of enterprise coding that are fairly typical of the talented amateur developer. The biggest point to make, the biggest difference between amateurs and professionals, is in understanding "patterns", intuitively or formally. A sys admin will prefer Bash as he knows it well. Bash is good at solving certain patterns, an example you gave was start-up / cron-triggered automation scripts, which essentially solve some kind of "factory" / creational pattern. But even here it can get unweildy when there are significant rules. And when you need non-trivial integration with business-related systems, then shell scripts fail.
It's not only bash scripts, people have been trying to replace Java with all kinds of scripting languages (think dynamically typed languages) forever. (We will ignore C# here, which is Microsoft's IP-burdened clone of Java). People have tried to solve business / enterprise problems using languages like python and more recently with languages like Groovy that runs in the JVM. Such approaches have sometimes become popular in niche areas (Ruby on Rails, though that has lost popularity now - as such systems are not very maintainable). The only place scripting has really been successful is in web-based systems (PHP). But even PHP is evolving to become more like Java and less like PHP ;-)
Engineers stick to Java for several reasons
1) OO - helps with maintenance and patterns
2) Clean syntax, each line of code is unambiguous (unlike C++, C# etc)
3) Great IDE's and libraries and frameworks etc
4) Cross platform works well (as long as you don't do stupid things with paths and similar)
5) It's fast (except it needs a bit more memory and starting a VM can be slower)
6) Strongly typed. The older I get, the more I appreciate typing. It massively cuts down on bugs and makes maintenance much easier.
7) It's universal - great for interoperability.
8) It's the best language to solve enterprise business systems that are mission critical.
What Java is not the best language for: simple start up scripts. Writing other v. simple systems. Quick and dirty/prototyping (unless, perhaps, you're a Java expert ;-). Drivers. Writing system code such as operating systems and working directly with certain operating system resources that require access to (if non-wrapped to date) native API's. Java is not designed for problems where you need fine grained control over performance related to hardware resources. Arguably Java is not brilliant at web code / fat client code, but that's more of an issue with frameworks than Java itself. Also Java does not yet support closures - the reason is that closures would affect performance by way of how the VM processes byte code.
I once saw a quote that said that Java is popular because it helps businesses write spaghetti code in a maintainable way :) There is some truth in that. But (preferably spaghetti free) Java is the best language for solving business/enterprise systems code and cross platform programs.
And Java is now the main language on Android, another plus.
No comments:
Post a Comment