| Forget It! |
|
|
|
| Tuesday, 30 August 2011 14:30 |
|
I've been in this business for over 26 years now, so there is a lot of junk in that attic that I call "brain". Hopefully, there are some useful items, too, but every now and again I remember something that I did "way back when" and realize that I'll never do that again. No, I'm not talking about things I did in college (it's even more important that others forget about some of those things). I'm talking about little tips and tricks that I've learned along the way. Take date conversions. We have all had to deal with a date stored in a database as a numeric value. Sooner or later we need to convert it from one format to another. That's where that old trick of multiplying by a weird number and letting the system do truncation came into play. It was a cute (and very expensive) trick, always worked, but was oh, so esoteric. It's a good thing that I documented it in the code (at least once or twice). RPG-IV doesn't like that trick...without some extra effort. Using data structures or, better yet, date data types to do the conversion is pretty self-documenting. If you're using any of these types of tricks, you're pretty clever, but not necessarily smart. Sooner or later you will need to mainatin that code. Or, worse yet, someone else will. Will you remember what you did and why? Will anyone else understand it? Friends don't let friends (or themselves) code cleverly...code it smartly. And, about those tricks: Forget It! |




Comments
See below routine declarations:
fromXAdate(dec( 7,0)):date
toXAdate(date) :dec(7,0)
RSS feed for comments to this post