Level 41

Old Level 06

Published in the Java Developer group

Roadmap of a Java Developer

A friend of mine was wondering why developers are always so happy. The answer she came with was simple and surprising: they do what they like and earn big money. Welcome to the world of software developers. Old Level 06 - 1

Software developer’s salary

I would like to tell you about developers’ salaries. How the land lies with salaries, where you should go work, and where you shouldn’t. If you are not a developer and try to puzzle it out on your own, you may get a rather controversial data. The main point is that major factor influencing a developer’s salary is not qualification, but the place of employment. Sometimes, given equal qualification level, the difference between good and bad place of employment can be 2 to 10 times(!) Each given moment of time your qualification is constant. You can’t become twice as qualified in a month and get paid twice as much. But you can change a place of work in a month and get twice bigger salary. Once in the flow of two month my salary multiplied by three (!) – Unforgettable experience. So, let’s find out, which place is best. Here are the three factors majorly influencing salary levels in companies:
  1. Whether main business of a company is software development
  2. Whether company is oriented on global or local market
  3. Where is the main office located: developed country or developing country
Note that city you work in is irrelevant. Meaning, if you earn five times less in Barcelona that your friend in New-York, the factors I’ve mentioned had probably influenced. 

Specific numbers

Since salaries are different in different parts of world, I propose to take the salary of Senior Java Developer with 5 years of experience as a starting point and call it “5 year maximum”. All figures below will be given as a percentage of this amount. Here are some examples of “5 year maximum” salaries in different cities of the world: Old Level 06 - 2Below it is shown how much a Java Senior Developer with 5 year experience may earn depending on the company he works for: Old Level 06 - 3Old Level 06 - 4What’s the strangest thing about current situation? Half of all programmers work in 1 and 2 level companies. D’you wanna know, what’s the catch? There are hundreds of opened vacancies in 3 and 4 level companies. These companies are willing to offer you higher salaries and, usually, better working conditions. I know two Java Junior's, one of them got a job paying about 3% of “5 year maximum” (level 1 company), and another got a job with 30% of “5 year maximum” salary (level 4). So why get less? The demand for programmers exceeds the offer – don’t go working where you are paid less! Conclusion 1: Average salary for Java developers (with any experience) is 40%-50% of “5 year maximum” salary. Conclusion 2: Your average salary in 5 years will be about 90%-110% of “5 year maximum” salary, if you not work for 1 and 2 level companies, and work for companies level 3 and 4.

What you can achieve unless you do stupid things

If you start working on your self-education in programming right now, your salary can look like this: Old Level 06 - 5


0-3 month (Student)

You know very little about programming. You may have studied it at school or in a college on basic level. What you need to do is learn how to program and learn Java. Your goal is getting a job as Java Junior Developer in a level 3 or up company. For the first three month of the plan you’ll get nothing, because you are just learning how to program. But the earlier you start the better. The best time is NOW. In the future, when you have a family and loads of loans, it’s going to be much harder to requalify. In order to correct your mistake you’ll have to lay aside money to pay for at least for a year of normal life. Don’t make silly mistakes.

3-15 month (Java Junior Developer)

You work as a software developer already and your experience grows daily. Do not relax. You have a lot to do before resting on oars. What you need to do is – study technologies you’ll need as a Middle Developer. What are these? The world is constantly changing. I’ll load you with advices and life will change it all. Find a few vacancies on the web and see what you need to apply. Be sure to read a book by Bruce Eckel “Thinking in Java”. Your goal in the first year of working as Java Junior Developer is to reach the level of Java Middle Developer. No one says that would be easy, but that’s possible for a goal-oriented person. It will increase your salary in an instant up to 40% of “5 year maximum” ($50K for SF and London, $6K for Bangalore).

2-d year programming (Java Middle Developer, level 1)

You’ve done a good job last year and now you are a Java Middle Developer. You can live pretty well earning 50% of Senior Java Developer’s salary. You are being given some serious tasks at work and your experience grows significantly. You’ll reach the level of Java Senior Developer in two or three years. No need to hurry. You won’t get big uppers in salary anyway. What you need to do is learn design patterns, read – McConnell’s Code Complete. Perfect the quality of your code and team skills. Create a rule of reading 1 book on computer programming each month. Then, in 4 years you’ll be 50 books smarter than all the rest. Do not postpone it: you won’t get any larger amount of spare time, besides, most likely you’ll start a family, or if you have one, it’ll become bigger. Your goal is to choose a few technologies to specialize in as a Senior Java Developer. You can’t learn them all, you know. And it’s always a good decision becoming guru in a single specialization. Old Level 06 - 6

3-d year programming (Java Middle Developer, level 2)

You are now an experienced Middle Developer and you’re thinking on becoming a Senior Developer. It’s pleasant as well as prestigious. You salary exceeds 60% of “5 year maximum” ($10K in Bangalore, $25K in Kiev, $40K in Berlin, $80K in New York). From this moment on demand for professionals like you rises the offer. You’ll always be able to find a job in a couple of days and you’ll hardly ever earn less than you do now. That, of course, if you don’t do anything stupid. What you need to do is keep studying the technologies you chose. Work better. Not for your employer’s sake, for your own. Apply to participate in projects involving promising technologies (like BigData, at the moment this article is being written). You’ll be spending 8 hours a day in the office anyway, so why not get a little more money for it, and, what’s far more important, most valuable experience you’re gonna need in the future. Your goal is to find a new job. A good team is always to be found. You’ll face with new projects and technologies. You don’t need to root to your chair. If you’re still working in a third level company, think on employing into a fourth level one.

5-th year programming (Java Senior Developer, level 1

You are now a Senior Developer. Maybe, you did not deserve it, and you feel it. Still, my congratulations. It does not matter whether you are worthy of your position now, all it matters that you become worthy of it in the future. I think you’ll agree it’s better to get a good job and after grow to the level required then vice versa. I hope you haven’t forgotten my advice to read one book a month? Any student will envy your knowledge and skills now. To be more specific, he’ll be praying on them. Just think of it: you’ve got serious earnings, close to 90% of “5 year maximum” salary. You’re probably still young. The world is at your feet. What you need to do is to re-evaluate technologies you’ve chosen. Perhaps, you need to change specialization. The world has changed, technologies changed, and you’ve gained quite some knowledge in past two years. What you choose now will become the headline for a few next years for you. It’s time to choose your favorite technologies. Your goal is to choose your growth direction. They are numerous, no one can name them all, but your choice has to be done right now. If you make a little change today, you’ll get a big one in the future.

6-th year programming (Java Senior Developer, level2)

You’ve decided on your future and you’re working on your dream to come true. A direction chosen correctly along with desire to move forward – and result won’t be long. Congratulations. I am happy to see there is one more person landed his dream. There is one profound truth. People often overestimate what they can achieve in a year and underestimate what they can do in five. Look five years back. It is so. What you need to do is to avoid unwise decisions and not be lazy. Your goal is to choose direction and move forward. Or did you think it ends here? Remember your graduation. It’s not the end, it’s just the beginning.

You future specialization

Old Level 06 - 7You can grow as technical specialist (upper branch), as management (lower branch) or as hired professional/independent consultant (medium branch). It all depends on what you prefer.

Java Developer’s career

Developer’s career is different from any other. You don’t need to become a manager to earn good money. It often happens that a Senior Developer earns more that his manager-boss. The more experience you get the stronger your working relationships with your boss change from “boss-subordinate” to “star and the manager”. Spoiled knowing their worth developers pick projects and vacancies. Let’s be happy for those of our own. So what do you need to become such a highly-valued and world-scale popular developer? You must have huge experience in most demanded and new technologies. How to achieve this? See below. Old Level 06 - 8As soon as you get a job as a developer, two thing start happening to you; still, they are not always visible. 1. You gain experience in real projects and grow fast. One year on this job gives you more experience than 5 years in college. Experience is such an important issue that they write “Java developer with 3 year experience required” in the vacancies posted. 2. You study new technologies 8 hours a day and get well paid for it. You really can’t overestimate this fact. In some cases skills you get are so valuable that you could have worked for free to get them or even pay up. If you choose projects you work on wisely, you are about to have a head-spinning software developer career. So… what to choose? It often happens that you don’t know which technology will be useful, so you start choosing on “like and don’t like” and “fashion trends”. You may get lucky or you may not. So you’d better know your destination beforehand. There are tons of ways to evolve for programmers, so, to make it simple, I’ll choose a few of them and write my vision of situation ahead. Do not think this pattern to be a hard line; it’s rather a simplified view of things presented to make it clear.

Two-hundred-year-old developer

If you enjoy programming most of all, then this is your way: Senior Developer, then Tech Lead Developer and an architect. This way you can work as a developer for 50 years and more. In most cases salaries of Senior Developers and Tech Lead Developers exceed those of their managers. So get your money’s worth.

Manager. You’re lucky you’re not like the others

You went over to the enemy. Just kidding. If you discover great organization skills, then your ways is: Team Lead, and then Project Manager. It’ll give you a chance to become head of department and open your own business. That’s what you want, isn’t it?

Home is where the heart is

Old Level 06 - 9If you have already started a family, then, perhaps, you wish to have a nice and quiet life in a country with strong economics. Perhaps you consider moving to Canada, USA, Switzerland or even Australia. You have excellent skills and a profession in demand. You won’t have to start from washing dishes. You’ll start as a Java Senior Developer. Probably, earning a lot. Not bad, ha?

See Naples and not die.

You don’t have a family yet and you love travelling. oDesk is your all. Find a client, agree to a rate of $20-$50 per hour, take a laptop with you and go! Your salary will suffice to live anywhere in the world. Why not start making your dreams come true right away?

I don’t wanna program, I’m a girl..

If you’re a girl, you may need to take a maternity leave. It sounds like a sexist joke, which it is. Still, there’s a lot of common sense in it. Most likely, taking a maternity leave you’ll be able to get a lot of maternity leave money (in countries with high social protection). There are companies that pay nothing, and there are those, that pay well. One of my students got one third of yearly salary going on a maternity leave. And this happened in spring 2009, during employment layoffs. And in a year and a half you may come back, being at least Middle Developer.

Lebvel 6

Old Level 06 - 10

1 Elly. Object visibility. null

- Hey, Amigo! - Hi, Elly! Will you tell me something interesting today? - Today I’ll tell you about the lifetime of an object. After an object is created, it exists (lives) until at least one variable stores its address (there’s at least one object reference). If there are no references anymore, then the object dies. Examples: Old Level 06 - 11- The object «cat Tommy» exists in the only one line since the moment it’s been created. In the next line, that only variable storing its reference is set to null and the Java virtual machine destroys the object. - The object «cat Sammy» after its creation is stored in variable cat1. Or, rather, cat1 stores a reference to the object. Then a couple of lines below this reference is copied to the variable cat2. After that a reference to another object is stored in cat1, and the reference to «cat Sammy» remains only in cat2. Finally, in the last line of the method main, the last reference to the object is set to null. - The object «cat Maisy» exists in the only one line since the moment it’s been created. In the next line the variable cat2 is assigned another value and the reference to «cat Maisy» is lost. The object becomes unreachable and is considered garbage (dead). - The object «cat Ginger» exists since the moment it’s been created to the end of the method. At runtime when the method exits, the variable cat1 will be destroyed, and after the object «cat Ginger» will be destroyed as well. - It’s clear. - However, if you create the object Cat in some method and store its reference in a class variable, then Cat will exist as long as there’s a reference to it from another existing object. - Usually, an object isn’t destroyed immediately. Java virtual machine occasionally activates the garbage collection to remove unused objects. I’ll tell you about that later. - If you want some variable to stop storing an object reference, you can assign it null value or a reference to another object.

2 Professor, Garbage collection

Old Level 06 - 12- Hey, Amigo! Here’s a useful link about the garbage collection in Java. That’s certainly not my excellent lectures, but that’s good enough: Java Garbage Collection Basics

3 Elly, finalize

- Hello again! Now I’ll give you a brief introduction to the method finalize(). This method is called by Java virtual machine on the object before the object is destroyed. In fact, this method is opposite to the constructor. In this method it’s possible to release the resources used by an object. - The class Object has this method, therefore, every class has it (all classes in Java is considered to be inherited from the class Object and contain a copy of its methods). If you write in your class the finalize() method and it will be called before objects of this class are destroyed. Example: Old Level 06 - 13- Got it. - But there’s one thing. Java virtual machine decides for itself whether to call this method or not. Most often, objects created in the method and declared as garbage after its exit, are destroyed immediately and without any calls of finalize() method. This method is a one more instrument of control over external (out of JVM) resource allocation. You’d better release all used external resources and reset stored references when you want the object to be destroyed. I’ll tell you about the advantages of this method and the details of its work in 10 or 20 levels. Meantime, you should know two things: such method exists, and (surprise!) it’s not always called.

4 Elly, Object lifetime

- I also want to tell you a couple of interesting things about the object lifetime. In Java, it’s very difficult to lose the object by accident; if you have an object reference, it means that the object is surely alive. - Inside an object reference stores a number – address of this object in memory. You cannot change that number, increase or decrease it. You cannot create a reference when you just have address in memory. You can only create a new object and assign its reference to a variable. This is the only way to get a new reference. - I see. That is, if I set to null (erase) all the object references, I’ll never get the object reference and access it? - Yep. But often the opposite is true – there are too many live objects unused. Most programs create dozens of objects and store them in different lists at runtime, but never clean those lists. - Mostly, programmers label unwanted objects as “deleted”, that’s all. Nobody cares for their removal from the lists. So large Java programs tend to bloat - more and more unused objects remain alive in the memory. - That’s all. In the future I’ll always draw your attention to unused objects and their proper disposal. - ОK, thanks. You’ve cleared up a couple of things about the references.

5 Diego, Object lifetime tasks

- Hey, Amigo! Here’s a couple of tasks for you:
1 1. finalize() method of Cat class
Write a method protected void finalize() throws Throwable in the class Cat
3 2. Classes Cat and Dog and finalize() method for each class
In each Cat and Dog class write a finalize() method, which displays to the screen a message that the object is destroyed.
3 3. 50,000 objects of Cat class and 50,000 objects of Dog class
Create in a loop 50,000 objects of Cat class and 50,000 objects of Dog class. (Java virtual machine will destroy unused objects, so the method finalize() will be called at least once).
4 4. Cat counter
In Cat class constructor [public Cat()], increase the cat counter (static variable catCount of the same class) by 1. In the method finalize() decrease by 1.

6 Elly, Static classes and methods

- Here is a new interesting topic. I want to tell you about the static variables and methods. - Oh, I already heard about static variables. About static methods, too, I guess. But I’d like to have more details. - When declaring variables in a class, we specify whether these variables are created in a single shared instance, or whether it’s necessary to create their copies for each object. By default, a new copy of class variable is created for each object of this class. Here’s what it looks like: Old Level 06 - 14- Though variables and are declared in the same class - Cat, they store different values, because they’re bound to different objects. - It’s clear. - A static variable exists in a single instance; you need to access it by using a class name: Old Level 06 - 15- It’s clear, too. - The class methods are also divided into two categories. Ordinary methods are called on the object and have access to the data of this object. Static methods don’t have such access, because they just don’t have an object reference. Static methods are able to access either static variable of this class or other static methods. - Static methods can’t access non-static methods or non-static variables! - Why so? - Every ordinary class variable is placed inside an object. Any method can access such variable only when it has a reference to that object. Such reference isn’t passed to static method. - What about ordinary methods? - To ordinary method is passed hidden reference to the object this method is called on. The variable that stores this reference is called this. Thus, the method can always get data of its own object or call another non-static method of the same object. - A null is passed to a static method instead of an object reference. Therefore, a static method can’t access non-static variables and methods - it just has no reference to the object they’re bound to. - I see. - That’s the way ordinary non-static methods work: Old Level 06 - 16- And that’s how static methods work: Old Level 06 - 17- A variable or a method is static if they’re declared with the keyword static. - And what is the good of such methods, if they’re so limited? - This approach also has its advantages. - First, you don’t need to pass any object reference to access static methods and variables. - Second, sometimes it’s necessary that the variable is one-of-a-kind. Like, for example, the variable System.out (static variable out of the class System). - And third, sometimes it’s necessary to call a method before you’ll be able to create any objects. - On what occasion? - Why do you think the method main is declared static? To call it immediately after the class is loaded into memory before it’s possible to create any objects.

7 Risha, Static classes and methods

- In addition to static methods there are also static classes. We’ll consider this case later, I’m just going to show you an example of it: Old Level 06 - 18- You can create as many objects of the class Cat as you wish. Unlike a static variable, which exists in a single instance. - The main purpose of the modifier static before a class declaration is to maintain a relation between the class Cat and the class StaticClassExample. Generally speaking, class Cat isn’t bound (doesn’t have hidden reference) to StaticClassExample object and cannot access to ordinary (non-static) StaticClassExample variables. - So I can create classes inside other classes? - Yep. Java makes this possible. Now, don’t think about it too much. Later I’ll explain some other things, and everything will become a little bit easier. - I hope so.

8 Diego, Tasks on static method

- Hey, Amigo! Here are some interesting tasks on static methods:
1 1. Class Cat and static variable catCount
Write a static variable int catCount in the class Cat. Create a constructor [public Cat()], in which the given variable should be increased by 1.
2 2. Static methods: int getCatCount() and setCatCount(int)
Add two static methods to the class Cat: int getCatCount() and setCatCount(int) using which you can get / change the number of cats (the variable catCount)
3 3. Class Util
Implement a static method double getDistance(x1, y1, x2, y2). It should calculate the distance between points. Use the method double Math.sqrt(double a) to calculate the square root of the parameter passed
4 4. Class ConsoleReader
Write a class ConsoleReader, which will have 4 static methods:
- String readString() to read strings from keyboard
- int readInt() to read numbers from keyboard
- double readDouble() to read fractional numbers from keyboard
- void readLn() to wait for pressing enter [use readString()]
5 5. Class StringHelper
Write a class StringHelper, which will have 2 static methods:
- String multiply(String s, int count) should return the string s repeated count times.
- String multiply(String s) should return the string s repeated 5 times.

Amigo → AmigoAmigoAmigoAmigoAmigo

9 Professor, object static scope and lifetime

Old Level 06 - 19- It’s me again. Unfortunately, I can’t give you any links today. Those great lectures are lost somewhere. I am afraid today you have to do on your own. But you better listen more to Elly and Risha, they can always teach you something. Yet try this one: Object Lifecycle

10 Julio

- Hey, Amigo! You did a great work today. That’s why I just cannot give you more. Come on, sit down, the show begins:

11 Captain Squirrels

- Hello, soldier! - Good morning, sir! - I have some awesome news for you. Here’s a quick check to reinforce your skills. Do it every day, and you’ll enhance your skills quick. Tasks are specially designed to do in Intellij IDEA.
Additional tasks to do in Intellij Idea
1 Class Cat and static variable catCount
Write a static variable public int catCount in the class Cat. Create a constructor [public Cat()]. Let the static variable catCount increase by 1 every time you create a cat (a new object Cat). Create 10 objects Cat and display the value of the variable catCount.
2 2. Static cats
  1. Add a public static variable cats (ArrayList<Cat>) in the class Cat.
  2. Every time you create a cat (a new object Cat), let this new cat be added to the variable cats. Create 10 objects Cat.
  3. The method printCats() should display all the cats. You need to use the variable cats in the method.
To create cats variable use code line:
public static ArrayList<Cat> cats = new ArrayList<Cat>();
3 3. Move one static modifier
Move one static modifier so the code compiles.
4 4. Minimum number of static keywords
Add the minimum number of static keywords to make the code compile and the program to successfully complete.
5 5. Any new ideas? Let’s think...
  1. Write a public static class Idea in the class Solution
  2. Write a method public String getDescription() in the class Idea to return any non-empty message
  3. In the class Solution create a static method public void printIdea(Idea idea) to display a description of the idea - that’s what the method getDescription() returns
6 6. KissMyShinyMetalAss
Write a class named KissMyShinyMetalAss. Create an object of this class, then display it to the screen.
7 7. Three static variables name
Write 3 public static variables: String, String, String