r/dailyprogrammer • u/Coder_d00d 1 3 • Jul 14 '14
[Weekly #2] Pre-coding Work
Weekly Topic #2:
What work do you do before coding your solution? What kind of planning or design work if any do you do? How do you do it? Paper and pencil? Draw a picture? Any online/web based tools?
Give some examples of your approach to handling the dailyprogrammer challenges and your process that occurs before you start coding.
Last week's Topic:
[Weekly Topic #1] (http://www.reddit.com/r/dailyprogrammer/comments/2a3pzl/weekly_1_handling_console_input/)
70
Upvotes
View all comments
Show parent comment
2
u/gfixler Jul 15 '14
I agree strongly with the data model approach. Every time I've finally understood how to structure the data, the code has all but entirely evaporated. I've had a pet project I've toyed at for most of a decade. I'd go months or a year without thinking about it, then remember it and think "I'm going to make that work tonight." Then I'd be up all night, failing to make it work yet again. It always seemed easy, but then it would get kind of meta and collapse in on itself, with too many ends I couldn't pull back together into a coherent whole. I tried again this past Christmas break, resuming where I'd left off the previous Christmas break (very discouraging), and sort of kind of got it hobbling along, but it wasn't the ideal I was seeking.
A few months ago it popped into my head again, and I thought "Wait, could all of this just be handled by a map?" I used TDD to make each feature work, and not only got the entire thing working in 2-3 days, and very cleanly, but quickly added in a bunch of features I either never thought of, or thought were going to be super hard problems to solve. None of them were. It just all needed to be a map the whole time.
That brings me to the second point. I've fallen out of love with OO. You mentioned classes. I'm by no means an expert in functional programming yet, but it's pulled me away from OO entirely now. I don't think I've made a class this year, and I'm starting to even have a negative reaction to seeing them in other people's code. They just never seem like they're helpful to me anymore. I had 11 classes fighting for supremacy in a data pipeline I made for work, and I was always hitting dead ends, unable to make it all come together as I wanted. This year I finally realized it just needed to be some simple maps, and some functions that act on those, and it removed all roadblocks, and opened up new powers that the old 'system' was never going to be able to do. It's been super fun and really liberating getting more and more into FP.
Have you experimented with that at all?