3 ms·
I’ve taken 3 semesters of OOP and 1 semester of functional and still have no idea how I would build a program if someone told me to
by M5x7wI3CmbEem10 7y ago
I’ve taken 3 semesters of OOP and 1 semester of functional and still have no idea how I would build a program if someone told me to
- mntmoss 7y ago1. Write placeholder output, the equivalent of a Hello World for the task. 2. Start parameterizing parts of the program to generate the output, so that more and more of the output comes from a few source variables. 3. Eventually you want a user interface on this and have it load from disk instead of recompiling...and so you end up with a complete program. You generally don't get there just by concentrating really hard on the architecture. You architect a bit and then try things to get empiric feedback.
- viewer5 7y agoI'm writing a script right now. So far I've got a constructor written, and comments written for what the "main method" equivalent part of it will be doing. My next step is to implement the first comment: reading in my input file, at which point I'll add some temporary code to loop through and print out what got read in, so I know I did that right. Then I'll move on to implementing the next main-method comment, which'll loop through records from my input file, open files it says to, find certain lines, and edit the text of em. So basically using the loop I already wrote above, I'll add in code for it to find the line number I want, and print that out so I know that bit works. etc etc. It's all iterative. You start with bare bones, and add meat and tendons here and there, iteratively, throwing in test output as you go so you know the bit you just made works. edit: and you don't have to go in order, either. Writing comments like I did that lay out what my "main method" will be doing, lets me know "okay, i've got a file-reading bit, a file-seeking, -interpreting, and -writing bit, I'll need a bit that outputs results as CSV..." and I wrote above about implementing the first step and a little of the second, but the constructor I have written is for the last step, my results-as-CSV step, because that's a thing that was easy to think about while I pondered the tougher bits. I'll add more to that constructor, probably, as I realize "oh yeah I wanna know about X aspect of each operation result, too!" There'll be lots of TODO comments here and there as I bounce around, and it'll get built up in bits and pieces, like starting with a spooky skeleton and adding more and more meat to it til eventually you have the whole body