
Imperfect 'best' Practices - shubhamjain
http://coffeecoder.net/blog/imperfect-best-practices/
======
pnt12
One 'best' practice that irks me: "Avoid static methods or attributes in
Java".

I find static final attributes to be quite good to avoid magic numbers or
strings. Static methods also seem better for functional, stateless methods.
Why instiate an object when you don't need it?

I assume most professionals know when or not to use static. However, most of
my university colleagues avoid it like the plague, because every professor
says "static is usually bad practice".

~~~
recursive
My favorite "best" practice to violate is "All fields must be private."

~~~
MichaelBurge
I can't remember the last time I've actually made a field private.

------
NumberSix
Dijkstra's "Go To statement considered harmful" article spawned a whole series
of "XXX considered harmful" papers by various computer science researchers in
the following years. This has even led to "Considered Harmful Considered
Harmful" counter posts to the practice:
[http://meyerweb.com/eric/comment/chech.html](http://meyerweb.com/eric/comment/chech.html)

One can argue that these "considered harmful" taboos were largely personal
opinions based on the, in retrospect, limited experience with early computers
and computer programming projects. Modern computers are over 1000 times faster
with 1000 times bigger memory and many other improvements. This, for example,
makes scripting languages much more practical than in the 1960's, specifically
making run-time type inference and similar implicit/weak typing methods
feasible for many programming projects. These typing methods clearly break
many of the rules established in the 1960's but empirically make software
development much faster in most cases. C++11 caved into fifty years of real-
world experience and added type inference with the auto keyword -- for
example.

