My early days as Java Developer

2nd September 2018 5 By Alin Bistrian

On this blog, I will share with you everything I learned from my java developer career starting from day 1 to present and more.

I will not only share how I succeeded I will also share how I got confused, frustrated and overwhelmed by Java’s OOP (Object Oriented Programming) and by all the information available and how I overtook all of them one by one.

I must tell you that it did not happen overnight, it was a process and continues to be a process because I am still learning.

I want to share with you what worked, what did not work for me and why.

Before I start, I would like to recommend a short read which I wish I had read in day one of my careers, and also anytime you feel overwhelmed reread it, it helps. At least works for me:

The blog post from coding horror is a summary of one of the most fundamental principles called “Just In Time Learning” which I will expand and explain what this meant for me in feature posts from my experience using real examples. Also here are few other principals I will explore:

  • Master the simple and fundamental things; they alone will help you reach the top
  • Code Refactoring, redesign and Unit Testing are part of the daily activities
  • Leave the code a little bit cleaner then you found it
  • And in my opinion the big ones:  Separation of Concerns and Just In Time Learning

The first month of my Java Developer career

When I first started writing code in java, I thought that I know what is the OOP (Object Oriented Programming) all about, but after just a few days I was proven wrong by my code. I thought that a class holds one or more objects.

At this point the distance between me and confusion, frustration and code duplication was inexistent.

Project deliverables and code duplication

Because I was pushed by the project deliverables like most of us are, I did not have time to take a break and properly understand the Object-Oriented Designs and even when I had time I was like, OK where should I start? What book should I read, which tutorials should I follow, there is so much material online there are so many opinions, which one is right which one is wrong, what is the best for me?

And soon I realized that there is not a single book or a single tutorial to teach all you need/want to know and all the best practices.

I had no choice but to continue and deliver that way, and in many cases, I was aware that I am duplicating code and that is my code, and it all depends on me, and I could stop the duplication. You may ask then why did you continue why didn’t you end duplicating code, why didn’t you refactor?

Well, that is an excellent point. I had no idea how to do that where to start, but I wanted to find out how hence I start looking on the internet and very soon I got confused and overwhelmed by all that information.

I said to myself oh the Object Oriented Programming is the worst of them all and I should consider switching to a different programming language but I couldn’t because I did not have enough time or energy to do that and decided to continue with Java.

The code duplication and the bug fixing became more end more challenging and time-consuming and error-prone, and I had to do something to improve the code or at least to stop it from getting worse day by day which it has proven to be a challenging task.


How did I stop the code duplication? Well, I didn’t, at least not completely but I reduced it by starting to write pseudocode.

Even with pseudocode, it was tempting to copy and paste the code from one class into a new class and change a few lines, but I knew that I was already doing that and I had to stop doing it because it made the bug fixing very difficult.

So next time I was in the situation where I had to implement a new functionality instead of looking into my code to see if there is anything that I can reuse (misunderstood the reuse part) or to better say copy and paste, I started writing pseudocode and expand the details of the pseudocode as much as I could.

Here is an example where I had to update the user files with data entered on in the GUI:

public void updateUserFileFromGUI() {
//Read input from GUI
//Read existing user data from a file
//Update user data
//Write data into file

At this point I was very tempted to copy and paste 4 of my methods that were doing similar tasks and change only few things like the GUI’s Text Field from which I am reading the input from or copying the method that was dealing with user data and add new data to it, but I didn’t. What I have done is to take each line of pseudocode and write more details to it like this:

//Read input from GUI for a provided Text Area – this allowed me to use this method anytime I needed to read data from a given text area. Soon I realized that I could replace other methods with this one and reduce duplication.

//Read existing user data from a file and put the data into an array where each line is an array element – this way I was able to put a file content into an array and use that array to manipulate the data. And what do you think it happened, I realized that few other methods had incorporated into their code all the content of my new method and also few different methods that did the same thing.

This thing allowed me to replace the existing methods with this one and reduce duplication but also had another benefit; I was able to replace all the code from complex methods with just a call to the new method hence reducing the complexity which is always a good thing.

I also did the same for //Update user data and //Write data into a file


Although this was good, I still did not write my code into an Object Oriented design because I was writing my methods more like procedures that take parameters, but I was happy because my code base became a little bit smaller and the complexity got reduced.

Soon I observed that I spent significantly less time in bug fixing just because there was a lot less code to go through.

Coming up next

All the above was just a summary of my beginning as a java developer, and in the following posts, I will tell you how I have evolved these methods into objects and also the most important how all these experiences made me adopt the above mention fundamental principles and why I believe they are so important. Also, I will provide a more detailed and concrete code example to support my opinions.

Also, I forgot to mention that this is my first post ever and I am sure it is far from perfect, and that is why I would like to ask if you could leave your comments and let me know your thoughts. I will appreciate the critical comments as much as I will appreciate the positive ones.

I am also working on the Simplified Beginner Java Developer’s Guide in parallel with these posts.

I will add at least one post every week, and with your help, I will try to improve every week.

Thank you very much for reading this post, and I hope you enjoyed it and you will revisit my blog in the future.