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().. And half of the time it doesn’t work.
getResourceAsStream()
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

June 12th, 2006 at 8:18 pm
You have used jdb to find a bug.
June 12th, 2006 at 9:07 pm
..complained about it on your blog
June 12th, 2006 at 9:09 pm
Hehe… I wanted to mention that, but I was sure somebody would. Spot on, man.
June 13th, 2006 at 8:47 am
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.
June 13th, 2006 at 9:19 am
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
> 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!
June 13th, 2006 at 11:58 am
Shut up you whiny little bitch
June 13th, 2006 at 12:25 pm
I´m feeling just like that. The second one is the most real.
June 13th, 2006 at 1:57 pm
> 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();
June 13th, 2006 at 3:52 pm
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)
June 13th, 2006 at 5:04 pm
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.
June 13th, 2006 at 5:17 pm
… 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.
June 14th, 2006 at 3:37 am
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
June 14th, 2006 at 8:19 am
> also, f.readFully(new byte[(int)f.length()])
>reads into a byte array.
You might as well use the byte array to create the String.
June 14th, 2006 at 9:16 am
Yes, my point exactly. How many lines of code are we left with now after creating a StringBuffer, iterating over the byte array, etc?..June 14th, 2006 at 12:32 pm
>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?
June 14th, 2006 at 12:48 pm
Ha!.. Yeah, I was, but I was thinking of something else… No excuses, I take it back…
June 14th, 2006 at 1:07 pm
Wow… It’s like you work with me. We run all our stuff on 1.3
June 14th, 2006 at 1:09 pm
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!
June 14th, 2006 at 2:15 pm
+1
June 14th, 2006 at 4:47 pm
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….
June 14th, 2006 at 6:06 pm
> 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.
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…
June 15th, 2006 at 1:21 am
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.
June 15th, 2006 at 4:51 am
Thank god, I never used java… phew
June 15th, 2006 at 4:52 am
until you’ve had to explain at least 15 times in interviews that j2ee doesn’t mean just ejb.
June 15th, 2006 at 9:17 am
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!)
June 15th, 2006 at 9:17 am
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.
June 15th, 2006 at 9:56 am
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);

June 15th, 2006 at 1:36 pm
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”);}
June 15th, 2006 at 3:31 pm
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!
June 15th, 2006 at 10:15 pm
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”…
June 16th, 2006 at 12:27 am
[…] One of the most popular entries in the You are not a ‘real’ Java developer until… 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. […]
June 16th, 2006 at 2:09 am
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…
June 16th, 2006 at 4:53 am
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?
June 16th, 2006 at 3:39 pm
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.
June 16th, 2006 at 6:08 pm
ruby sucks!
June 16th, 2006 at 7:33 pm
… 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
June 17th, 2006 at 5:12 am
You’re not a java developer until you bitch and whine about a language you say you hate but are still using.
June 17th, 2006 at 9:38 am
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.
June 18th, 2006 at 7:43 am
.. 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.
June 18th, 2006 at 10:12 am
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
June 19th, 2006 at 3:32 am
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 ….
June 19th, 2006 at 3:39 am
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.
June 19th, 2006 at 1:28 pm
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.
June 19th, 2006 at 2:42 pm
Jajaja. That’s true!!! LOL
June 19th, 2006 at 6:49 pm
@Andrey Fedorov
>data = file(’file.txt’, ‘r’).readLines()
I don’t believe that will close the file.
This has bitten me at least once.
July 27th, 2006 at 2:41 pm
Your arent a java developer until you have problem with charsets and coding in files.
or until you have problems with dates….
August 4th, 2006 at 10:14 am
Until you love it.
August 31st, 2006 at 8:50 pm
until you make your own pathetic attempt to copy bileblog
October 4th, 2006 at 6:21 am
you’re not a real programmer until you can write the code needed to read a url using java.net without looking it up
December 11th, 2006 at 4:39 pm
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.
December 20th, 2006 at 10:16 pm
…until you look out the window and see the sun rising and smell the fresh coffee, then realize you are still at the office.
January 10th, 2007 at 12:12 pm
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
January 17th, 2007 at 10:39 am
> 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…
Even worse, here’s Ruby: >/]]]
a = `cat file.txt`
> I don’t believe that will close the file.
> 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.
January 17th, 2007 at 11:04 am
> 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.
January 17th, 2007 at 11:05 am
Hmm, indentation gone wrong, I forgot that this thing in front of me uses HTML.
February 28th, 2007 at 1:40 pm
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).
March 8th, 2007 at 9:52 pm
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