The Daily WTF
It’s important to be prepared- but not too prepared. A common trap developers fall into is “premature abstraction”- trying to solve the general case of a problem when you only need to solve a very specific case.
Frequent contributor Argle sends us some very old BASIC code. The task was to convert this ancient language into C#.
Someone decided that, instead of waiting to learn specifically what variables they’d eventually need, they’d just declare all the variables they could ever want right at the top.
Which gives us this block, included in its entirety.
COMMON PRICE1, PIECE1, PRICE2, PIECE2, PRICE3, PIECE3, PRICE4, PIECE4 COMMON PRICE5, PIECE5, PRICE6, PIECE6, PRICE7, PIECE7, PRICE8, PIECE8 COMMON PRICE9, PIECE9, PRICE10, PRICE11, PIECE11, PRICE12, PIECE12 COMMON PRICE13, PIECE13, PRICE14, PIECE14, PRICE15, PIECE15, PRICE16, PIECE16 COMMON PRICE17, PIECE17, PRICE18, PIECE18, PRICE19, PIECE19, PRICE20 COMMON PRICE21, PIECE21, PRICE22, PIECE22, PRICE23, PIECE23, PRICE24, PIECE24 COMMON PRICE25, PIECE25, PRICE26,
To read the full article click on the 'post' link at the top.