Optionals To Avoid Null

With the introduction of Optionals, people thought they could get rid of nullpointer exceptions, simply use optionals everywhere where there will be no more null. We know that this is of course not true, since an optional can be null itself and it can be empty which could lead to a NPE itself when used incorrectly. But Optionals due help in communicating a message and help to avoid certain errors. In this blog post I will first give my opinion of the cases where optionals are good to be used followed by some scenario’s where I have used optionals to avoid null.

Continue reading

Domain Primitives

As mentioned in my previous blog post, the idea of domain primitives seems interesting. Since the focus was more on validation I did not go into much detail. In this blog post, I will be discussing Domain Primitives in much more detail, their advantages and disadvantages, and even their potential future evolutions.

Continue reading

Setting Up Code Guidelines

In the previous blog post, I dicusssed the tradeoff when setting up coding style. There is however much more to be agreed upon than simple formatting rules. The guidelines go much further and are more difficult to enforce, nevertheless they are important to make sure everyone is comfortable working on the same code.

Continue reading

React Data Communication Problems

Since I started to use ReactJs, I have learned a lot and I got used to the principles of composition, functional components and the use of callbacks. But there are still a couple of weird quarks that I feel make code uglier than it should be. I will not discuss the actual patterns for data communication since there are enough blog posts that already do so, I will share a link to one of those. I do intend to share my opinion and problems I have dealing with data communication

Continue reading

Jackson Lowercase Key Mapping

Recenlty I had to write a service that calls another service and passes on the result to the caller. Easy enough, with the only caveat that the json response I got from the service uses camel case and the caller wants it in all lowercase. I never though I would need to do something like this, but there is a first time for everything. There are a couple of ways to do this, and I will discuss the ones that came into my mind when I had to do this.

Continue reading

Testing Time

In the past I have not been in touch with time that much, but I do know that time is one of the trickier things to test (except in Python maybe). Since I am now working more with webservices, I do get more in touch with time related concepts. Just something as simple as storing when a change happened, when a record was created, etc. All of this is information you want to keep (and in my case even show to the user). This however means that I now too am faced with testing code that relies on time.

Continue reading

Java Multiple Interface Extension

Java does not support multiple inheritance, at least not for classes. It does allow implementing multiple interfaces. This made me wonder how it would deal with methods that collide with eachother. What probably made it even more tricky is the fact that interfaces can now have default implementations. What if two interfaces define the same method, but with a different default implementation? Let’s find out in this blog post.

Continue reading

Java Method Overloading

Method overloading is a very common practice in Java, and I assume in many other programming languages too. The idea is that you have multiple methods with the same name, but takes different parameters. There are a couple of limitations to this such that the compiler can distinguish between the different methods, it needs to know which one to call after all. It are these caveats that intrigued me to write this blog post.

Continue reading

First Experience: Kotlin

As I decided to start creating a mobile app, I chose to use Kotlin as the language to write it in, mostly because Kotlin is not the preferred language of Android. Another reason was that I heard a lot of Kotlin, and I have seen it a couple of time in job descriptions. So I was of course curious to try it out, especially since it is also a JVM language and it is said to be an improved version of Java. This also means that my initial though was that it would be very easy to use it, as it would just be Java with some syntax altered, but that turned out a bit different.

Continue reading

Framework Generators

Something I have been noticing when trying out a couple of new frameworks and technologies is that everything seems to be having generators or initializers to get you going. One generator is not the same as another, and this is something I want to discuss with you. Like always I am curious to find out what you think about this evolution, so leave a comment.

Continue reading

C++ Evaluation

When looking for a new job about 1.5 years ago, I was eager to start working with C++ again. Now after I have freshened up my knowledge and gained some new experience, it is time to evaluate the situation. I will try to make an objective assessment and clearly specify why I feel certain things. Some may be caused by the situation of way of working, where others are caused bye the language itself.

Continue reading

C++ Smart Pointer Arguments

In my previous blog post, I did an experiment to see how the different ways of passing an argument hold up against each other. And it was clear that for larger objects a reference or raw pointers was the fastest way to pass an argument. But since raw pointers should not be used in new modern C++ code anymore, I did a similar experiment with the smart pointers. The results of this experiment can be found in this blog post.

Continue reading

C++ Passing Arguments

C++ allows us to pass arguments in many different ways, and although most of them will allow you to do the same thing, there are subtle difference in what is actually done behind the scenes and how strict it is about the things you can do with the argument. Another important aspect is whether or not changes made to the argument are reflected to the original value as well.

This blog post will mostly focus on the performance of the different ways of passing the arguments, but it is important to first discuss exactly what each approach allows you to do, since this will determine whether or not you can pass the argument in such a way in the first place.

Continue reading

Python Mocking

Python offers many features with its mocking framework, the most interesting and fascinating ones are of course those that are related to mocking. It isn’t hard to simply check whether a certain return value matches what is expected. Mocking however is very much tied with the language the the design as it requires you to cut the connections and replace it. I will look into these fascinating features and how to use them.

Continue reading

C++ Static Variables

The concept of a static variable exists in every language, and it is a feature that enables multiple objects to share a common variable. It enables communication between these multiple objects and can be used to avoid creating copies of certain data if this data is constant. There is however a big difference between Java and C++, whereas in Java you can only have static members, in C++ you can have static on all levels going from global variables all the way down to (function) local ones.

In this blog post I will briefly discuss the sense and nonsense of static variables and how they perform. Based on that I will give my opinion of when and how they should be used.

Continue reading

Switching From Java To C++

I started off my professional career programming in Java, which wasn’t my preferred language, but as there is a lot more demand for it there are more jobs available and thus it made sense I ended up programming in it. Nevertheless I have always felt the urge to program using C++ some more, and in my latest job switch I did make the switch from Java to C++, but not all was rainbows and sunshine. It seems that my idea of what C++ was has been distorted over the years and Java has grown on me a lot more then I was aware of.

Continue reading