Showing posts with label interface. Show all posts
Showing posts with label interface. Show all posts

Wednesday, October 7, 2015

OOP: How to do it right. What the method is?

Some time ago I wrote about objects' attributes. Parts that identify them. However, the objects are exactly like us - it’s our behavior that determines who we are, makes us who we are. This behavior and reactions are the things that really interest others. Would Sebastian be the same annoying person if his name were different? Assuming there's no magical power in our names he probably would.

Don't get me wrong, I don't want to minimise the importance of object's attributes. The behavior of the object often depends on them, e.g. if the age is one of person’s attributes, it's clear that it determines many activities that the person can or cannot do.

Tuesday, March 17, 2015

Differences between abstract class and interface

it is obvious, right?

No, it’s not. I have conducted a lot of interviews and very often one of the first questions I used to ask was the one about the differences between interface and abstract class. And still I met a lot of programmers who couldn’t give me the right answer.
In my opinion even a junior programmer should know them, maybe not necessarily with understanding what reasons lie behind, but still ­­­­­- structural differences, specific for particular language (and the same for almost all OOP languages) should be more than known.

What do I find instead? Candidates who were applying for other positions (sometimes even senior ones) who didn’t knew the differences or knew only a few or one.
I know that only the things that we know very well are easy, but those are OO basics and we have to know them to write well-designed code.

Tuesday, December 30, 2014

OOP - how to do it right? - part 1

When I started my journey with Object Oriented Programming I quickly found out many tutorials and trainings, which showed how to use OOP structures in code. Unfortunately, most of them demonstrate only how to write your first own class, interface. How to create an object. All of this was about language “grammar”, about key words, the way how to create structures used in OOP, etc. Yet, somewhere authors lost the most important information to share - why we decide to do this instead of looking for other solutions? Why an interface contains nothing more than abstract methods? Why all of those are public? What for are those visibilities? And so on...