Contents

Long Road of Learning Java

(Back to Blog)

by Rodion Gorkovenko - see profile at linkedin

INTRO

(imagine some beautiful advertising picture here)
Rodion Gorkovenko - author of the text

At the beginning I'd been using C. There were other languages, but most of the past years I was writting particularly in C. That is why my IT career started with this language. However it is used mostly in low-level programming - I had been writing firmware for microchips while working as electronics designer and later - software for POS-terminals.

When I asked myself "where to move further" - I have no clear answer. It was straightforward to deepen the knowledge of C++ but I have had an experience of work within the team of not very professional C++ developers and hence - slightly negative impression.

The alternative was Java (I have almost no idea of C# at that point). I knew almost nothing of it except for few attempts of writing for cell phones with JavaME out of curiosity - surely they did not give me deep idea of the language.

Well... During the year while I worked for company with POS-terminals I had a bit of time to spare at home, at mornings and evenings. Googling made me aware that I should download Java Development Kit (JDK) from the Sun's site (which since then turned to http://java.oracle.com) - and, well, I was ready to start!


Learning JavaSE

(first levels - easy monsters, like Hell Seargents and Imps)

I would say at once that programming experience is quite important (almost crucial!) for learning Java. To learn it as a first language - is not the best idea. From the very beginning Java will hurl a newcomer into the whirlpool of strange geeky words (packets, classes, methods, static, abstract, references, collections - who are all those people???) - and it is hard to find your way in this noisy crowd for one without knowledge of similar concepts from other languages.

So to very beginners I dare to recommend spending one or two months (or more) on Python for example. The simplest program in it will contain a single line instead of 5-10 for simplest Java code. At the same time you will have opportunity to learn all important things (including classes, methods etc.) mentioned above.

Well. Armed with some programming experience and JDK installed we are ready to sit down and give it a try. Yes, one may also want to download one of popular Integrated Development Environments (IDE) - like NetBeans, Eclipse or IntelliJ IDEA. However gurus do advice to write first programs "in the notepad" - i.e. with the help of simple built-in editor of Far Manager or Midnight Commander - or install Notepad++ or gedit - and then compile and run them from the command line interface (yes, this small funny black window - also called console or terminal). I dare to repeat this advice - it is great recommendation for those who really wants to reach tops of IT world rather than simply "to write and submit some stupid code to the stupid professor to get rid of him!"

Good IDE for beginner is something like a renewable diaper on steroids, with climate-control and embedded radio. It is too hard to learn using conventional bathroom after them - and I'm sorry to say, one should not expect being employed while wearing diapers...

What code should novice write? Hundreds of small and useless programs! Our goal during this period is to get used to syntax, to understand the idea of classes-methods-fields, to learn usage of collections, arrays, strings etc. Moreover we want to learn and understand them to such extent that part of such knowledge migrate from our head to our fingertips! This will free the head for new knowledge :)

But where to get these ideas of "small and useless" programs? I tried two ways:

  1. I registered at local java forum (for English-speaking people I dare to recommend Java Programming Forum and Reddit - LearnProgramming. I thought I will ask questions there - but instead I spent most time trying to answer the questions of other beginners. I found this greatly helps in boosting my skills - and also allows to be in touch with important events of the Java-world.
  2. I started participating in short contests at TopCoder and later CodeForces - problems of 2-3 lower levels here are not too hard for "ordinary" programmers who do not care about competitive programming but just is searching for more practice. There is some "danger" since such contests mostly learn you to write "fast and dirty" - but nevertheless they force you learning about collections, arrays, type casts and hundreds of small tips and tricks!
  3. At last but not least - you can try exercises at CodeAbbey where you can browse other users' solutions later to learn better practices from fellow coders.

As about additional sources - I only used the JavaDocs on standard library API (which are also accessible directly from google by queries like "Java SomeClassName" like "Java HashMap"), and also Java Language Specification - I read it even while travelling to work via subway - of course one needs some patience, but it is worthwhile. Surely soul-saving examples which could be googled out from the internet are of great use also. The only important thing to note for those who (like me) do not call English the "native language" - try to improve your English and read documentation, books and examples in it. Information in native languages is significantly more scarce and often obsolete.

Besides this one also can read books if one wants. There are several widely recognized authors like Horstmann (good for ones having some programming experience in other languages) or Eckel (quite a deep dive for advanced users) or Sedgewick (learn java by learning algorithms!) etc.

However there are few books which are really must-have for beginners - I dare to name two:

So far so good. About 6-9 months later I had significant knowledge migrated from head to fingertips and had written a lot of useless tools, primitive games and exercises which are usually of any interest only for their author. If asked "Do you know JavaSE" I can confidently answer fairly well - perhaps with except of concurrency.
What now? Are these knowledge enough to get employed as a Java-developer?


Java SE and EE comparison

Learning JavaEE / Web

(advanced level, CacoDemons, Hell Barons, CyberDemons)

No. Usually just JavaSE skills are not enough to get employed.

Most of industrial Java-projects are web-based - either enterprise web-apps or web-resources directly for internet. There are dozens of technologies, libraries and frameworks helping in creating such applications - for producing web-pages, building web-services, interacting with databases etc. As a volume of knowledge they are at least ten times greater than all we have learned in JavaSE.

Since 90% of such applications use web-interface it becomes crucial to get the idea of web-related things, such as HTML, HTTP, CSS (and perhaps JS) - moreover it is important to get some practice with them. That is not hard and, luckily, there are many tutorials and examples. So just spend some time to get clear enough understanding of this matter.

Java is used in web-apps for producing new HTML-pages on-the-fly, as a result of processing incoming HTTP-requests. For beginner this cuisine may look difficult to understand... at least it was difficult to me. I was fortunate that just few months before that I was required to learn basics of PHP - this helped very much. Really it was even convenient: I spent about two weeks on writing few dozens of scripts (though somewhat messy, PHP resembled C significantly) - and get far more knowledge of the internals of the web than during several preceeding years!
To make practicing with PHP easier I recommend to install handy "all-in-one" server like XAMPP - it includes both Apache httpd web-server, PHP interpreter and MySQL database (and something more). Then get any suitable tutorial on PHP - and you will be happy, I promise!

After this, switching back to Java I found it quite easier to understand: here is Tomcat, it is a java web-server which receives requests and produces web-pages in responce. Here are JSP-pages well resembling PHP at first. They are accompanied by Servlets helping to process different types of requests and produce data for pages. Java database connectivity or JDBC - far easier to understand after playing with databases from PHP - the same queries, tables, data extraction. And internet is boiling with examples - cool!
Though instead of MySQL popular for PHP I do recommend to use embeddable java database like H2.

I do not say I become guru of Java EE at this level. Nothing of the kind! It requires significant labor - moreover that even small projects consist of many whimsically interwoven files. However, I get some understanding in a month or two and started to search for new job. I applied my CV to all positions where Junior or Middle developer was required (since there are not so many junior's positions) honestly explaining that I have no official experience.

Of course many companies did not answer to me and just several invited to interview. At this step it is important just to avoid falling into despair.

Few important hints on list of skills in your CV here:

So I was sending my CV and sometimes was invited for interviews. Two companies offered me to try their exercise projects.

Exercise project, or test-project as we sometimes call it - it is a luck and great chance: it allows you to learn some technologies and problems used and solved at the given company - and at the same time to boast how nicely you can write the code, how smart you can think etc. It is a sorrow that they are somewhat rare. During about 5 last years I've visited about 30 interviews and got only about 5 test projects.

For those who are unlucky - I provide an example of such project at the end of the article.

First project I was offered required to write a small web-app with several pages listing the data from the database. It has inscription "Please use JSF and Hibernate". I was scared at first - I only heard of such things and surely have no ideas of them. Interviewer told that the project should be written in about five days working lasily - however I was allowed to spent two weeks on it due to lack of experience with necessary technologies (now I can write such project in about 3-5 hours, I think). The second project I got from another company was asking to make some utility working with JavaMail.

I succeeded with both projects and was invited in both places. Suddenly :)

Another lucky thing was that just a month or so ago I read Java Code Conventions and get used to write the code in the same style as used almost everywhere, so interviewers were not much horrified reading my sources.

Well. As I said, I was invited to my first Java position. It was in 2011. Now at 2014 I am working as senior or lead developer at international company which provides software mainly for US and UK businesses. My salary have grown about 5 times compared to which I received as junior electronics developer in 2008. This is not quite fast growth, but I love programming and I'm glad I can do what I love to do - and get well paid for it.

Here we can finish. :) If you are curious - at the first company I worked for, I wrote my first industrial project using JSF and Hibernate (surprising?) - and meanwhile I get acquainted with Spring and some other important things.

I should say that it is quite important to continue learning even when you already got the job you wanted - since Java has tons of strange, unheard-of, funny and special technologies. The more you know - the faster you move. And besides Java here are another languages, architectural concepts, scientific-related programming fields etc... The whole world is out there - for you! :)


Appendix

(level editor, ha-ha)

As I told I'm going to present something like "typical" exercise project for potential employee. Here it goes. As most of such projects it is about writing small web-application. Be ready that it may take days or even few weeks if you are not acquainted with some technologies.

I'm not going to give some of the projects I was offered myself. Instead I invent just another one, similar.

Write web-application representing a Bank. Let it be The Central Bank of NonameTown with population of 53 citizen and still growing! :)

You should store data about:

Minimum functionality should include the following pages:

Additional pages:

Quite often the problem description will have a list of suggested technologies. They may be for example:

Database could be MySQL or Postgres - though I recommend to make application able to switch between two - external database and embedded one (like H2) for easy testing and demonstration.

You may also find examples of test projects from google and forums. Do not avoid using Maven and its plugins like maven-jetty-plugin for easy deployment during demonstration! Do not forget to add some short text document explaining what you have written, how to start and use it.

Here at my github are few projects similar in functionality - just here is a shop instead of bank - they were written by me based on some old exercise project in order to test several technologies and libraries.

So Farewell - and Good Luck!