assert
Brief
Brief
Brief
Don't leave commented out blocks in your code.
https://youtu.be/xu7q8dGvuwk?t=1198
Inheritance is often overused, even by experienced developers. A sound rule of software engineering is to minimize coupling: if a relationship can be expressed in more than one way, use the weakest relationship that's practical.
Brief
You can delete functions to prevent them from beeing used. This is mostly used to prevent a type from being copied ; for example std::sharedptr.
Brief
Keep it small
Brief
Because most applications don't really need performance, and correctness is their main concern. Often, the compute-heavy parts are handled by libraries and you don't need to worry about that. If the code that you write doesn't weigh much in the performance scale, don't waste time optimizing it, or worse, don't optimize it at the expense of readability / maintainability !
Brief
Brief
Exceptions
There are *very few* good reasons to use `friend`.
A monad is just a monoid in the category of endofunctors
Brief
There are only two hard problems in computer science: naming, cache invalidation, and off-by-1 errors.
Pointers can be null
Static Polymorphism
C.4: Make a function a member only if it needs direct access to the representation of a class.
Brief
Conference
The Single Source of Truth principle is very simple : only store an information once !
No naked new : this doesn't mean no dynamic allocations, it just means they should always be done through a smart pointer or a container.
Difference : State handles the changes itself, it is an implementation of a state machine. For Strategy, the decision of changing the strategy comes from the outside, it doesn't depend on what the current strategy is.
Brief
Brief
Brief
Brief
Here are some of the most important ones:
I.4: Make interfaces precisely and strongly typed.
https://youtu.be/ta3S8CRN2TM?t=1306
Brief
C.21: If you define or =delete any copy, move, or destructor function, define or =delete them all.
https://youtu.be/jKt6A3wnDyI
Brief
C.2: Use class if the class has an invariant; use struct if the data members can vary independently.
Even if it's only for your personal use, it will help you a lot with code reuse across projects and also inside one project. And also it will force you to make your code a little more generic, which most of the time will improve it at the same time. Moreover, it will make sure that the code is decoupled from the rest of your application.
Write the functions you wish to see in the world – Tony Van Eerd