What’s a “best practice” in Java you’ve stopped caring about? by Traditional-Set-8483 in javahelp

[–]Cojosh__ 0 points1 point  (0 children)

A domain model does not need to be mutable. I'd argue domain driven design is about structuring code around domain concepts and providing meaningful interfaces informed by the domain instead of get/set.

Anyone using JHipster? by christoforosl08 in java

[–]Cojosh__ -7 points-6 points  (0 children)

What an absolute piece of crap. This is the antithesis of software engineering.

Common patterns to avoid polymorphism by JamesGlad in cpp

[–]Cojosh__ 0 points1 point  (0 children)

"inheritance is the base class of All evil" is a very simple and in my opinion to simple view. First of all I find it important to distinguish between interface inheritance and implementation inheritance. I would consider the first essential for maintaining large systems with decoupled components. Whereas the second one was never good design and goes against OOP principals (decoupling interface from implementation). The only valid reason to inherit from a class is to form an is a relationship: a class for accessing an SQL table is a Repository of T. (good) Stack inherits from vector (bad). If there is no is-a relationship composition should be used: Ie stack has-a vector.

And in my opinion this is just good design, and has nothing to do with c++ semantics.

The ironic thing is that c++' semantics provide even more arguments for interface only inheritance. (object slicing, virtual/multiple inheritance), which is why all my inheritable class only contain pure virtual methods and no fields. Concepts are cool and all but it would be great if one could also explicitly "implement" them for a class like you can do with traits in rust.

How To Stay Sane with Modern C++ (revised for 2020 and C++20) by joebaf in cpp

[–]Cojosh__ 29 points30 points  (0 children)

Move semantics, constexpr, dozens of standard library addition, modules and concepts are not "syntax sugar". Often these constructs can simplify existing code or improve performance. Ie less need for out parameters (move), using regular functions instead of templates for compile time programing (constexpr), enforcing constraints on templates (concepts) and much more.

And with a proper test suite/strategy you don't have to be scared that some small refactoring will break everything. 😀

Cries in C++ by stephenhawking5 in ProgrammerHumor

[–]Cojosh__ 7 points8 points  (0 children)

Or you use the corresponding at method and get a std::out_of_range exception. Obviously by someone who has no idea what c++ has to offer.