«« Next » « Previous
«« Next » « Previous

Link Details

Link 50153 thumbnail
User 111696 avatar

By bloid
via jeremyjarrell.com
Published: Oct 30 2007 / 03:43

Recently I came across some code in a framework that was performing different calculations on data as it was retrieved from data source. The framework had a set of derived columns, each of which represented a set of predefined calculations against the retrieved data. For example, we may have had a Sum column which was responsible for adding the values of two other columns together. We also may have had a Difference column which was responsible for subtracting the value of one column from another column. This is a pretty common, straight forward situation which I'm sure that nearly everyone has encountered at some point in their career.
  • 15
  • 3
  • 1284
  • 602

Comments

Add your comment
User 236137 avatar

dzonelurker replied ago:

0 votes Vote down Vote up Reply

Refactoring to the worse. Enums are easier to understand.

User 249616 avatar

robse replied ago:

0 votes Vote down Vote up Reply

Agreed. But it's the wrong use of enums anyway.
Refactoring a looooong switch-case away is always good.

User 164228 avatar

lipe775 replied ago:

0 votes Vote down Vote up Reply

That was some really bad use of enums.

User 254930 avatar

dzonereader replied ago:

0 votes Vote down Vote up Reply

Cool Idea, bad example.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.