Par positonu Nereti, pie mums ienākot, cilvēki vaicā – kāpēc pie sienas karājas Positons, Konditons, Configyre un Descriptitons?
Laiku pa laikam saskaroties ar The Daily WTF cienīgiem brīnumiem kodā, un nevēloties šīs kultūras vērtības laist vējā, mēs darba iekšējajā informācijas sistēmā ierīkojām žurnālu “Good code”. Šeit arī atrodamas pirmās ziņas par Positona izcelsmi – 2005. gada 3. jūnijs:
Variable names – It’s all about positon.
Programming stupid bank systems all day long, every year to come can get rather boring. However, there are many little things you can do to make the day more colorful and enjoyable for you and your colleagues. One such thing is – variable names.
Usually, you’ll see variables named like index
, i
, tran_id
, client
, client_position
and so on. Authors of these variables have all been wrong. Where’s the creativity, where’s imagination? Let’s take, for example, the variable client_position
. Why don’t we rename it to client_
positon
? Many happy hours of wondering and bugfixing are guarranteed.
Here are some ideas to use when naming your variables:
- If the variable name loosely resembles you something, change it so that the association is clear. For example,
resident
becomes president
- We all love the names of fictional characters, animals, birds and trees. Examples –
orihime, baboon, rooster, bush
and alike.
- Make a good use of your existing associations –
engine.start(), gearbox.erect()
etc.
Now, let the fun start! Go and fix your code!