If you know me, or if you have read some of my other blog posts you will already be aware that I am not the biggest fan of Python. But I do give credit when credit is deserved, and the first time I had to do some mocking with python I was baffled. While most of the process was very easy there are some more complicated things, but what really amazed me was how easy it is to mock system functions and most interesting is the dependency on files.
As mentioned in my previous blog post, I hope to examine a more interesting comparison for the different types of methods. Note that this comparison completely ignores the different use-cases for each type, it is therefor only relevant for ‘pure functions’, as in that case it doesn’t matter whether they belong to a class or whether they are static or not.
In comparison to Java, C++ does not force you to make all methods part of a class. Instead you can also have regular methods, which are often used for helper methods that only rely on their input parameters to generate an output. It is obvious that these methods don’t have to be part of a class as they do not require any state, they are what we call pure methods.
But you can also have regular methods and static methods outside of a class. Although this seems odd since isn’t static only saying that it does not require a class to be called, but since the method isn’t part of a class in the first place, what is the point of doing this?
In the previous blog post I wrote how you can have a simple ‘to string‘ method for a C++ object. My proposed solutions however, like in all languages, require you to have access to the code of that class and be able to alter it. There is however a way that allows you to ‘extend’ a class with some methods without needing actual access to the source code. In this blog post I will show you how you can implement output stream operator <<, and then discuss this approach more generally.
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.
It may not be a big secret to you that the popularity of python has been rising for many years now. It becomes hard to find a job vacancy where python is not listed. It also keeps going up on popularity lists such as TIOBE.
But what exactly makes this language so favored with many developers? In this blog post I will go into depth on the arguments python fans use to explain why they choose python over any other language.
Something that is almost impossible to look ignore now is the concept of an ‘app store’. Ever since the introduction of Windows 10, every big system now has this concept in place. But if you think about it, it’s not a very new concept and it has been around for years on Linux. In this post, I will discuss the benefits an downsides of having an app store as well as the different ways on how they are (or can be) used.