Why JUnit 5 default access modifier changed to package-private

Why is the default access modifier in JUnit 5 package-private? It’s not the “default”. There technically is no default. Rather, in JUnit Jupiter you have a choice: public, protected or package-private. What is the benefit of changing it to package-private? The benefit is that you don’t have type public anymore. If your IDE automatically generates …

Read more

Should I use “public” attributes or “public” properties in Python?

Typically, Python code strives to adhere to the Uniform Access Principle. Specifically, the accepted approach is: Expose your instance variables directly, allowing, for instance, foo.x = 0, not foo.set_x(0) If you need to wrap the accesses inside methods, for whatever reason, use @property, which preserves the access semantics. That is, foo.x = 0 now invokes …

Read more

Effective C++ Item 23 Prefer non-member non-friend functions to member functions

Access to the book is by no mean necessary. The issues we are dealing here are Dependency and Reuse. In a well-designed software, you try to isolate items from one another so as to reduce Dependencies, because Dependencies are a hurdle to overcome when change is necessary. In a well-designed software, you apply the DRY …

Read more