Show HN your embarrassing (old) code
First I'll start off:
http://pastebin.com/ATdDUStd
That was from January 2008. I was young and stupid. I'm probably just as stupid now, but at least I can see now how stupid that was.
So let's open up the shame files, and show how far we've come by recognising how bad we used to be.
5 comments
[ 4.2 ms ] story [ 90.2 ms ] threadI love learning!
The system was your basic CRUD application that tracked who the food bank gave money/stamps/assistance too. It also allowed them to generate some fancy reporting.
The code was so. damn. bad. This was before I even knew what an MVC framework was. The "main" control panel page was a single, enormous PHP script that was switch-cased. There was zero data validation, zero security, zero maintainability. It was a nightmare in retrospect.
To be fair, I did it for free and the church loved it, so oh well :)
But as I went back to look at it, I found it wasn't unintelligible. It was just noobish. Lots of silly working around things that do not need to be worked around - that sort of thing. My models are mostly empty, if that tells you anything.
It's a testament to the Rails structure and convention that someone with no experience and a book can write something that not only works, but is reasonably readable despite being totally wrong.
As a side note, I made several thousand dollars off that app before shuttering it. Had it worked (the idea), I no doubt would have done some major rewriting. But it didn't so now I sit here looking at the fattest controllers known to man.