851
Developer's Corner / Re: Going Over Old Code...
« Last post by f0dder on November 22, 2012, 01:04 PM »Ho humm.
A lot of the things that makes code 'reusable' is just general good programming practice, IMHO. Single Responsibility, commenting, documentation, modularization. You should almost never skip those, even if you're just "doing a quick hackjob" - since we all know that things tend to evolve beyond that. My day time job is working on a fscking big CMS in a fscking big company dealing with fscking horrible code - because the "this isn't reusable code anyway" mentality means every single of the beforementioned principles have been violated. Large amounts of copypasta, almost no documentation, about the only comments written are mine (after doing lots of code spelunking), et cetera. Is howwible.
Going beyond those principles, it can be worthwhile to add a few more tricks from the reusable-code bag, even for stuff that isn't going to be used in other projects. Like, for C++ code, splitting out core logic in it's own library, making it both easier to test as well as drive from a command-line tool, factor into a Windows service, whatever. You might not think you're ever going to need it, but spending that small amount of time while setting up your project is sooooooo much easier than properizing things later on.
One of the reasons fSekrit development has been stagnant for so long is that it started as a cute little hackjob. Some of the features I need/want to add for the next version, and needs to be in place before opensourcing, is proper modularization and librarification. The source wasn't all that bad, but it's really boring and tedious work when you need to do it down the road - and with the dayjob and whatnot leaving me with pretty limited spare time and energy, it's hard mustering the morale to take on the reeeeeally boring refactorings necessary before interesting tasks can be resumed.
So, while you shouldn't delude yourself that stuff is going to be reusable, coding for "reusability" is going to make your life a lot easier in the long run. Of course it's a balance kinda thing, you don't want to gold-plate your 100-line AutoIt script that does whatever simple task - but anything that's going to have any kind of longevity? Ask yourself how pissed you're going to be at your former self sometime in the future.
A lot of the things that makes code 'reusable' is just general good programming practice, IMHO. Single Responsibility, commenting, documentation, modularization. You should almost never skip those, even if you're just "doing a quick hackjob" - since we all know that things tend to evolve beyond that. My day time job is working on a fscking big CMS in a fscking big company dealing with fscking horrible code - because the "this isn't reusable code anyway" mentality means every single of the beforementioned principles have been violated. Large amounts of copypasta, almost no documentation, about the only comments written are mine (after doing lots of code spelunking), et cetera. Is howwible.
Going beyond those principles, it can be worthwhile to add a few more tricks from the reusable-code bag, even for stuff that isn't going to be used in other projects. Like, for C++ code, splitting out core logic in it's own library, making it both easier to test as well as drive from a command-line tool, factor into a Windows service, whatever. You might not think you're ever going to need it, but spending that small amount of time while setting up your project is sooooooo much easier than properizing things later on.
One of the reasons fSekrit development has been stagnant for so long is that it started as a cute little hackjob. Some of the features I need/want to add for the next version, and needs to be in place before opensourcing, is proper modularization and librarification. The source wasn't all that bad, but it's really boring and tedious work when you need to do it down the road - and with the dayjob and whatnot leaving me with pretty limited spare time and energy, it's hard mustering the morale to take on the reeeeeally boring refactorings necessary before interesting tasks can be resumed.
So, while you shouldn't delude yourself that stuff is going to be reusable, coding for "reusability" is going to make your life a lot easier in the long run. Of course it's a balance kinda thing, you don't want to gold-plate your 100-line AutoIt script that does whatever simple task - but anything that's going to have any kind of longevity? Ask yourself how pissed you're going to be at your former self sometime in the future.

Recent Posts



- since there's the "let's run some tests" button, I think you're right, and in that case the steps should definitely be in a continuous list, like in your mockup.

.