On Tuesday, 3 July 2018 at 03:27:06 UTC, Ali wrote:
Well, D is not exactly known for contract oriented programming
or DbC (Design by Contract)
we have to thank Bertrand Meyer and his language Eiffel, for
that
Thanks for pointing this out !
His book "Object-Oriented Software Construction" is an absolute
MUST-READ for any decent programmer.
Contracts, large-scale object-oriented architecture, how to
assign responsabilities to the right class, etc.
Even somthing seemingly insignificant as using uppercase
typenames is a complete life changer, as this way you can
immediately see the role of a single-word identifier just by its
case.
That's after reading his book almost three decades ago that I've
decided to use the following conventions for my personal code :
- PLAYER : type
- Player : member variable
- player : local variable
Still don't understand why people are still adding silly prefixes
or suffixes ("m_", "_", "this->", etc etc) to differentiate local
variables from member variables etc :
- Player : type
- player_, _player, m_player, this->player, etc : member variable
- player : local variable
While using the identifier case gets the job done in a simpler
and more readable way...
IMO reading this book should be mandatory for any second-year
student who is learning professional software development...