You are not a ‘real’ Java developer until…

You had to use JDK 1.3 on a real project. In 2006.

You had to use JDK 1.3 on a real project because you had to use some ancient version of WebSphere. In 2006. And you were already wondering who might ever want to use WebSphere back when JDK 1.3 was bleeding edge…

You wanted to kill Java because it makes you do Thread.currentThread().getContextClassLoader().
getResourceAsStream()
. And half of the time it doesn’t work.

Over time, you’ve used 15+ different ways to read-in a file from the context path. And most of the time you had to spend half a day to make it work.

You missed Generics with a passion after you had to work with a JDK < 1.5 for a while.

You have your own start up just because you want to use Ruby instead of Java.

You feel better for yourself when you hear that many people still use Struts.

You try not to think that every single other programming language around these days opens, reads, and closes a file handle in three lines of code.

You feel old when you consider that a native method that gets the free disk space on your hard drive has been requested eight years ago and it’s almost here now…

You have over-enginered Java code a dozen times to create functionality that resembles Ruby Code Blocks and Mix-ins.

You have to come up with an interesting use for Annotations, like it wasn’t bad enough already…

Feel free to add your own…

Digg some grumpy Java development

57 Responses to “You are not a ‘real’ Java developer until…”

  1. Jay Says:

    You have used jdb to find a bug.

  2. Kay Says:

    ..complained about it on your blog

  3. George Malamidis Says:

    Hehe… I wanted to mention that, but I was sure somebody would. Spot on, man.

  4. Jochen Says:

    You have a two-week-partying when you get to know that in 2007 you are allowed to use WebSphere 6 with JDK 1.4. (You know: the assert keyword and java.util.logging!) Man, what a delightful read.

  5. Jean-Michel Says:

    :D :D :D
    After 5 years of Java in Paris, London and Barcelona, I know exactly how you feel Georges! I am dreaming of working one day in a project with thoughtwork minded people … Europe is “years” behind regarding innovation and quality

    &gt; You have your own start up just because you want to use Ruby instead of Java.

    And I am about to start my own web 2.0 start up so I can feel the vibe!

    Le roi Java est mort, Vive le roi Ruby!

  6. CHris Munroe Says:

    Shut up you whiny little bitch

  7. Cristiano Mariano Says:

    I´m feeling just like that. The second one is the most real.

  8. Thomas Mueller Says:

    &gt; every single other programming language around these days opens, reads, and closes a file handle in three lines of code.

    RandomAccessFile f=new RandomAccessFile(”test.txt”, “r”);
    f.readFully(new byte[(int)f.length()]);
    f.close();

  9. Issie Says:

    LOL… I can’t wait to see the same thing written by the same author, but this time for Ruby (probably in a year or so)

  10. George Malamidis Says:

    Thomas,

    Thanks for the advice.

    What will happen, though, if you try this in a web app context, when the file is located in the container’s ‘webapps’ dir and you don’t want to use the absolute path?

    There is also FileReader, which essentially would do the same thing. Still doesn’t solve context issues, I think.

  11. George Malamidis Says:

    … also, f.readFully(new byte[(int)f.length()]) reads into a byte array. Not the most convenient thing in the world in my experience, when many times you just want to read the file contents into a String.

  12. harringf Says:

    until… you’ve said that java is not fast enought for the back-end, but it is the best tool for web using applets, then you realize that the applet download is too slow and the UI sucks, but just in time for J2EE to be out… then you say that it is the best tool for back-end app and web stuff, and then realize that to write a “hello world” you need 256 lines of code
    http://oodt.jpl.nasa.gov/better-web-app.mov

  13. Panos Konstantinidis Says:

    &gt; also, f.readFully(new byte[(int)f.length()])
    &gt;reads into a byte array.

    You might as well use the byte array to create the String.

  14. George Malamidis Says:

    Yes, my point exactly. How many lines of code are we left with now after creating a StringBuffer, iterating over the byte array, etc?..

  15. Foo Says:

    &gt;Yes, my point exactly. How many lines of code are we left with now after creating a StringBuffer, iterating over the byte array, etc?..

    You aren’t serious are you?

  16. George Malamidis Says:

    Ha!.. Yeah, I was, but I was thinking of something else… No excuses, I take it back…

  17. Nick Says:

    Wow… It’s like you work with me. We run all our stuff on 1.3 :(

  18. Can't get more real than that... Says:

    You mean you don’t use Struts? Wow! I *started* a Struts project in 2006, no kidding.

    But hey, we’re not laggards, we are doing unit tests! We are agile now!

  19. strayneuron Says:

    +1

  20. Joshua Volz Says:

    Don’t worry, most of these concerns are present in C# also. Particularly working with the older framework, and having to write lots of code to properly open, read and close a file. That’s actually been bothering me for some time….

  21. Andrey Fedorov Says:

    &gt; You try not to think that every single other
    &gt; programming language around these days
    &gt; opens, reads, and closes a file handle in
    &gt; three lines of code.

    Three lines? In python:

    data = file(’file.txt’, ‘r’).readLines()

    data is now an array of lines from file.txt

    Anything more complex is just unnecessary…

  22. You know... Says:

    If you want to open a file in Java in three lines, then write your own class to do it - and then use that.

    It’s giving you control… if you want to abstract it, feel free.

  23. Raghunandan Madanala Says:

    Thank god, I never used java… phew

  24. js Says:

    until you’ve had to explain at least 15 times in interviews that j2ee doesn’t mean just ejb.

  25. Colin Manning Says:

    You’ve had to program using JDK 1.1 AND try to get it to work consistently across Linux, Solaris, Windows AND Mac OS 9 (remember that!)

  26. David M. Gaskin Says:

    10 years ago I wrote a singleton class
    de.gaskin.io.Util for file I/O that provided:

    String fileAsString = Util.readIn(”filename”);
    byte[] fileAsArray = Util.readIntoArray(”filename”);
    etc. etc. etc.

    I therefore suggest that “You are not a ‘real’ Java developer IF YOU USE MORE THAN 1 LINE OF CODE TO OPEN, READIN AND CLOSE A FILE.

  27. Panos Konstantinidis Says:

    I love when people measure how good a programming language is by counting the LOCs of an application. By the way you can do file processing in Java in just one line:

    RandomAccessFile f=new RandomAccessFile(”test.txt”, “r”); byte [] b = new byte[(int)f.length()]; f.readFully(b); f.close(); String s = new String(b);
    ;-)

  28. Mark Smith Says:

    You’ve forgotten try…catch. That should be

    try{RandomAccessFile f=new RandomAccessFile(”test.txt”, “r”); byte [] b = new byte[(int)f.length()]; f.readFully(b); f.close(); String s = new String(b); }catch(IOException ioe){System.out.println(”Couldn’t read test.txt for some reason”);}

  29. Arash Rajaeeyan Says:

    you missed old days which you could see your friends each 6 month and ask them if they can code in this new programming language you have just learned this week!

  30. wolfy Says:

    There’s a basic principle that applies to all programming languages: DRY (don’t repeat yourself).
    So why anyone complains about LOC count and never actually thinks of encapsulating the units of work he needs repeatedly into a procedure/function/method/class (depending on your language of choice) is beyond me… David M. Gaskin gets it obviously, see above.
    And it is true that some (scripting?) languages make it easy to just open a file in one line - but in a server side application, separation of concerns is essential (parts of the app may reside in re-usable library-JARs etc), so something like getResourceAsStream() is in fact the only viable way to do things in J2EE, it’s not just “open a file with an absolute path in a filesystem”…

  31. Nutrun &#187; Blog Archive &#187; Three lines of code Says:

    [...] One of the most popular entries in the You are not a &lsquo;real&rsquo; Java developer until&#8230; post (that was mostly meant to be funny, by the way) was the one about the amount of lines of code required to read a file in Java. [...]

  32. Jed Wesley-Smith Says:

    you’re not a real java developer until you’ve had to find and fix memory, performance and character-set encoding (i18n) problems with pretty much all the file handling code examples above…

  33. rahul benegal Says:

    Once took me 20 minutes to find the class that allowed me to open a file in append mode. Years later a team member spent many hours trying to find how to append to a file, and came to me for help. Took me another half and hour to find the class.

    All programmers i have interviewd (several hundred) couldn’t convert a string to integer, or date. Used to parse the string using their own utility methods. Absolutely no one knew the class and methods to format a decimal. Again, they used to parse the String themselves. Sure it shows the quality of coders but such things should have been more apparent/accessible in Java?

  34. Karl Peterbauer Says:

    Oh Lord… Ever tried to implement a complex CORBA IDL in C++? Ever tried to get a Win32 service in C right (without crashing your development box twice an hour)? Ever tried to fetch some lousy registry entries with the Win32 API with a few lines of code? Ever tried to fix a shipload of PHP scripts without getting completely insane because you have no compiler as friend, or because functions which were available in PHP x.x vanished and then popped up again in later versions? Ever tried to fix some Perl scripts with dozns of absurdly unreadable regular expressions? Ever tried to hack a bunch of shell scripts to get a RAID driver installed on your Linux box which is unfortunately not Red Hat based?
    Try it, and then Java a second chance. You’ll enjoy your developer life again.

  35. anti-ruby Says:

    ruby sucks!

  36. Shane Says:

    … unitl you find out that the memory leak problem was because the keys that are only 10 characters long are holding on to a 1K char array

  37. Jon Seltzer Says:

    You’re not a java developer until you bitch and whine about a language you say you hate but are still using.

  38. herve Says:

    Two opposite things are written at the same time :
    * Java is not fast enough
    * Ruby rocks

    Ruby (or perl, or python, or PHP) is far slower than Java. The real question we have to ask is : what to we want ? It seems we don’t really know.

  39. Peter Becker Says:

    .. until you finally learn that any close() or similar statement belongs into the finally{} block (most tutorials on the net fail on that one as did a commenter above) and long for scope-based objects as in the good ole C++ days.

  40. Peterd Says:

    Surely a real Java developer would promote the use of decent tools, rather than bitch about being forced to use obsolete tools. Just quantify the risks…

    Yes, where I work Borland Enterprise Server 5 is the standard for production systems. Running Java 1.3…

    We have ground-breaking new production systems coming on stream - I’m testing them - that use (wait for it) Borland Enterprise Server 6.5

  41. Choon Whee Says:

    You are not a “real” Java Developer until…

    you wrote a blog post titled “You are not a ‘real’ Java Developer until …” only to find out lots of people don’t think you are not a real developer and upon realisation devote your life to becoming a “real” Java developer (or developer for any other language). Dying a terribly miserable death. Ending your life in a state of perpetual misery and damnation ….

  42. Choon Whee Says:

    continued …

    finally reaching nirvana upon your pitiful death, you start to realise there is no such thing as a fake developer (other than actors, conman and liars) … just lousy/clueless/average/good/better ones. You are now a “real” developer…but you spend the rest of eternity regreting that you should have became an accountant (subsitute account with any other job) instead.

  43. sm1_at_dev_java_net Says:

    You are not a “real” Java Developer until…

    you find out that after 10 years in production there are no JVMs that lets your desktop application optimize the heap space for the end user machine and that you have to write overly complex installation instructions to your ma-and-pa users for writing the valid -Xmx switch value for their own PC.

  44. Unicorn Says:

    Jajaja. That’s true!!! LOL

  45. Tim Schafer Says:

    @Andrey Fedorov

    &gt;data = file(’file.txt’, ‘r’).readLines()

    I don’t believe that will close the file.
    This has bitten me at least once.

  46. Santiago Says:

    Your arent a java developer until you have problem with charsets and coding in files.
    or until you have problems with dates….

  47. Neeraj Says:

    Until you love it.

  48. Clifton Santiago Says:

    until you make your own pathetic attempt to copy bileblog

  49. Taylor Gautier Says:

    you’re not a real programmer until you can write the code needed to read a url using java.net without looking it up

  50. Mark Bernard Says:

    You’re not a real Java programmer unless despite all the complaints you still love to program in Java because you know that you can throw something complex together 5-10x faster than most other languages, with all the necessary error checking.

  51. robc Says:

    …until you look out the window and see the sun rising and smell the fresh coffee, then realize you are still at the office.

  52. Andrew Bradbury Says:

    Hi Guys

    My company is looking for a Senior Java developer to work in a team of 11 in Oxfordshire. Contact details are on the website http://www.xit2.com.
    Anyone interested? Get in touch, email your CV to info@xit2.com. c35-40K what are you waiting for?! Andrew

  53. Jakub Hegenbart Says:

    &gt; Three lines? In python:

    &gt; data = file(’file.txt’, ‘r’).readLines()

    &gt; data is now an array of lines from file.txt

    &gt; Anything more complex is just unnecessary…

    Even worse, here’s Ruby: &gt;/]]]

    a = `cat file.txt`

    &gt; I don’t believe that will close the file.
    &gt; This has bitten me at least once.

    It will. Python uses refcounting and after the refcount drops to zero, the object will automatically close the file.

  54. Jakub Hegenbart Says:

    &gt; Ruby (or perl, or python, or PHP) is far slower than Java. The real question we have to ask is : what to we want ? It seems we don’t really know.

    There’s always Common Lisp at hand, you know… ;-) Not exactly clean (in some ways just like C++, by the same token), but stable, mature, standardized, often much faster and much more rich in features.

    (with-open-file (stream path)
    (let* ((len (file-length stream))
    (data (make-string len)))
    (read-sequence data stream)))

    This should be the fastest way ever. ;-) Of course, it’s a shame there isn’t a utility function yet. But then, C++ doesn’t exactly shine wr/t standard libraries, too.

  55. Jakub Hegenbart Says:

    Hmm, indentation gone wrong, I forgot that this thing in front of me uses HTML. ;)

  56. Tyrone Hed Says:

    You’re not a real Java developer until you experience the exquisite agony of going back to hand-coding JDBC calls after having used Hibernate.

    You’re not a real Java developer until you join a shop that–horrors–puts all their JDBC calls INSIDE THE JSP (and they don’t understand why that is an ABOMINATION).

  57. mnsharif Says:

    you are not a real java developer if you see this article and you leave the webpage before reading it in entirety with all 56 replies that follow ;)