I started off programming with no formal education in it all. I suspect this was (and still is) pretty normal, especially with the culture around programming. However, this inevitably means that you're missing a lot of useful knowledge that you end up picking up the "hard way" ... by making mistakes and slogging through it. So, what mistakes did you make early on that you think might be useful to people starting out now?
For me it was: Do not store money in floating point variables
One of my first applications was an office management suite that had to deal with money. I had never heard of fixed point numbers, I didn't know anything about internal representation yet. And I paid for it with weeks of tracking down missing pennies from round-off errors. The lesson was to never, ever use floating point numbers for something that has to have an exact decimal representation. This seems obvious now, but a decade ago it really wasn't.
Work arounds:
- Fixed point numbers. Databases have them. Most frameworks have them now. Use them.
- Failing that, store / do math on everything as in integer, scaled to store correct precision. (ie, multiply everything by 100 if you care about 2 decimal places), divide by the scaling factor for display, but do all math on the int.