Friday, March 3, 2017

The code that does not have to be written

Do you know which code is best? It’s the one that does not have to be written at all!

As developers we often solve non-trivial problems. We have to analyze and understand each important aspect of a problem. Then we have to “convert” the result of such analysis into code. This code has to meet all the requirements. It has to be understandable. To achieve this, we talk about design and structure of the code and sometimes challenge it to make it better. And after a while we are there, with a clear picture in our heads. Now the funny part begins, now’s the time for coding!

Wednesday, February 1, 2017

KrkDataLink#1: The missing link between Functional Programming and Data Science

There's a new Meetup in the city of my ancestors!
If you are interested in Java and Data Science you just have to go to KrkDataLink (15th February, Kraków).

What is waiting for you?
  • Functional Programming in Java by Marcin Stępień
  • Using Scala for Big Data in e-commerce by Rafał Cycoń

Don't hesitate and just be there.


Monday, January 23, 2017

For the sake of laziness!

I like well written code. I like to reach out for perfection. I like to look for the most suitable design and solution. I’m doing it not because I treat software development as a kind of art and myself as an artist. I never looked at this in this way. I’m doing it, because I know it pays off. And one of my greatest motivators is my own laziness.

Tuesday, January 10, 2017

Lazy-loading is a Code Smell

Have you ever seen those huge objects with many attributes? These domain objects where we are using lazy-loading because we do not want to retrieve too much information from the database? I bet you’ve had this doubtful pleasure.

Today I want to share with you my impressions about them - using lazy-loading should be treated as a code smell!
Let me explain myself:
  • Lazy-loading means that sometimes you won’t need some attributes of an object. Those attributes will be necessary in a different context. Doesn’t it mean that you are building different objects depending on context?
  • The functionality that is using this object knows definitely too much. It knows the API of the object and this API contains also the methods that require attributes which were not loaded. Great, isn’t it?
  • You have to remember what is needed in each place and what is not needed …
  • … and, what is even worse, you have to remember what you may use and what methods are not supported in a particular place.

Tuesday, December 27, 2016

Happy New Year 2017!!!

class HappyNewYearWishes {
   private YearFactory yearFactory = new YearFactory();
   private BlogRepository blogRepository = new BlogRepository();
   private YearRepository yearRepository = new YearRepository();

   @Test
   public void youShouldMakeAllWishesComeTrue() {
      Year year2017 = yearFactory.aNewYear(2017);
      Person you = blogRepository.findAllReadersOf("Let's talk about Java").you();

      you.acceptChallengesOf(year2017);

      assertThat(you.allGoalsOf(year2017).achieved()).isTrue();
      assertThat(you.didLearnSomethingNewIn(year2017)).isTrue();
      assertThat(you.booksReadIn(year2017).count()).isGreaterThan(you.booksReadIn(aYear(2016)).count());
      assertThat(you.currentJob().isGreat()).isTrue();
      assertThat(you.currentSalary()).isGreaterThan(you.salaryIn(aYear(2016)));
      assertThat(you.wantMoreIn(aYear(2018))).isTrue();
   }

   private Year aYear(int year) {
      return yearRepository.find(year);
   }
}


Tuesday, October 25, 2016

Do you really need instanceof?

Using instanceof is a code smell. I think we may agree on that. Whenever I see a construction like that I’m sure that something went awry. Maybe someone just didn’t notice a problem when making a change? Maybe there was an idea, but it was so complex that it required so much effort or time that a developer made a decision not to do it? Maybe it was just laziness? Who knows. The fact remains that the code evolved into such state and we have to work with it.
Or maybe there is something that we can do about it? Something that will open our code for extensions?

Tuesday, October 11, 2016

Brace yourself for a new blog design

As you probably noticed I have slightly changed the design of my blog. I hope you like it and it’s more visually appealing than the previous one. I would be more than grateful for your comments regarding the change. Is it better? Worse? Or maybe something is missing?

I also added new subpages.
On the first one, you can find some information about me and contact details which may, some time, come in handy.
On the second one, there is a list of conferences and talks where I will have (or already had) pleasure to talk and share my ideas. You may find there also a links to slides and videos.

I hope that all changes are steps in the right direction.
I encourage you to write comments and share your ideas or suggestions. If there’s something that you would like to find here - simply leave a comment. It may help me refine the blog even more.
Don’t hesitate, write your opinion and help me improve.