1/15/2020

Difference between struct and class in C++

Introduction
A really popular question of the C++ interview is about the difference between struct and class. It seems to be an easy question, but there are multiple views to be considered.

Historical background

Let’s start with the historical view. C++ is based on the programming language C, which is not supporting the object oriented programming paradigm. So that there were no classes in C, only structs. And struct was nothing else than a data structure to be used to store variables of different types together.
Later on with C++ together with the object oriented programming support the keyword class has been introduced to represent the typical object oriented classes.
In C++ Struct has also been extended with time, so it is also possible to inherit structs from each other, change the visibility of the attributes and to add constructors, destructors and member functions.

Technical difference

What is then the exact difference?
Technically there’s only one difference between structs and classes: in a struct the default visibility is public, since in a class the default visibility is private.
There’s technically no other difference in C++.

Practical difference

The difference is more philosophical.
As I already mentioned struct is a collection, a record of data, which belongs somehow together. And nothing more.
Since class is a bit more, class represents something, which has an interface, a state and a behavior. The state is usually internal, not visible from outside, that’s why the default visibility is private. The state can be changed through the predefined interfaces, which are the public methods of the class. Furthermore the usually the class has an invariant which is a restriction on its possible states. In case of a class you have methods which are handling the attributes of the class together.

So my suggestion is: use struct if you need a simple data container of data which belongs together and use class for everything what is more complex, what involves more abstraction.

1/02/2020

You salary is less than it could be! - How to negotiate your salary at an interview?

Introduction
Most of the companies handle the salaries as a secret and it has a cause. I am pretty sure that you have colleagues whose knowledge, experience and performance is worse than yours and they earn more and you. And there are of course colleagues who are better, but earning less. How to be part of the first group and earning more than the others?
Of course this question has a lot of factors. You can ask your boss for a raise. It is also important to change the companies at the right time. But where you can win the most is the negotiation during the interview process. To expertise your skills in this activity first you have to understand the view of the other participants.

The view of the company

If a company is hiring for a new position that means they have some work to be done, so they are looking for someone, who has the right skills to overtake the position with a possible short ramp-up time. Usually they have a clear view which skills are required to overtake the position. It is also important for them who is supporting them on long term, since a new change has a lot of extra cost and effort. And of course they are looking for the cheapest well-working solution. They are either hiring someone who is owning all the skills or someone who is lacking some of the necessary skills, but can be trained fast. Of course the one having all the right skills can achieve the highest salary, since there are no extra costs for trainings.
On the other hand, the company can only see from your skills what you are showing through the interview process. To be honest here you can present yourself a bit better as you are by concentrating on the skills which are really required for the position.
But in the end, the company has always a planned salary for the position, but usually it if defined in a range. If you have all the needed skills you can reach the maximum of this range. But unfortunately most of the cases this range is not public.

The view of the recruiter

Really often you have are first negotiating your salary with an external recruiter. The only goal for this recruiter to let you join the new company, since they are paid after the successfully hired candidates. So the recruiter can go to the company with some prepaid facts: there’s this guy, with these skills, expecting such amount of salary. As lower is the salary expectation, higher is the chance that the company applies you and the recruiter gets the success-bonus. That’s why the recruiters try to ensure you that your expectations are too high. They are often using phrases like “this is the realistic salary” etc. Don’t believe them. You have other ways to figure out what is your realistic salary.

Your realistic salary

It is very important for you to figure out what is your realistic salary. It is up to the company, up to the position, up to the city and up to your skills, that’s why it is not easy to find the right range. It makes it more difficult that in most countries salary is handled as a sensible information. People don’t like to talk about that.
Don’t use your current salary as a reference, it can be that you are really underpaid, but it is also possible that you are changing to a place where your responsibility is less, so that your current salary is not a realistic target. If you are changing the city that can make a really big difference on the realistic salary.
The first source you can use is the internet. There are websites, like glassdoor which can give you a good base, based on the inputs of the others. But in several cases it has simply not enough, or only obsolete inputs, so that it is not telling you a realistic value, especially if you are checking a smaller company or a smaller city.
It also worth to read to feedback about the company on different pages, like google maps, etc. Just google the name of the company and the city. You can find there often information which is comparing the salaries to other companies.
The most efficient way is to ask others who changed their jobs recently. Don’t ask them about their new salary, but ask them about what they think, what would be a realistic salary for you. It can also give you some guess.
Before you start to negotiate your salary, you should have a range in your mind about your realistic salary and don’t accept anything that is below this range.

How to negotiate your salary?

First of all you should show your best side during the recruitment process. Send a well-prepared CV with do your best on the interviews.
You will be might asked for your current salary. Just answer that it’s a personal info. Do not share it. Then you will be asked for expected salary. At this point you have to tell the higher limit of the range what you just determined, maybe a bit more. Most likely they will try to offer a bit less. If that amount is still in the determined range and it is not much less than the amount you told you can expect it. If it is much less or it is out of the range just tell, that sorry it is too less, then you rather search for something else. You may be asked for what is the lowest salary you would accept. Here you should tell a number which is just a bit below the first amount you asked.
During this whole process be patient, friendly but self-confident and very determined. You should show yourself strong and professional. Avoid answers like “let me think about this offer”. That would show weak and unconfident.
The most important point: if the company can’t give you an offer which is fulfilling your expectations, just keep on searching. That’s why it is good if you are not in a hurry at job searching. That makes you more confident.
It is always good to do 2-3 interview processes parallel, so that you can choose the best offer in the end.

Summary


To negotiate the highest-possible salary is not easy at all and the worst part is that you can never be sure that you reached the possible maximum. But it makes sense to take some time to negotiate. Because a higher starter salary makes an effect on your whole career at that company.

How I prepared my first online course

Since long I didn't publish anything here. It's because I was busy with some other topics, but now it's time to share the result...