Pēteris Caune, jaunumi (cu) rakstīja, @ 2006-09-12 19:32:00 |
|
|||
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:
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:
resident
becomes president
orihime, baboon, rooster, bush
and alike.engine.start(), gearbox.erect()
etc.Now, let the fun start! Go and fix your code!