

Ask HN: How do I avoid the Second System Effect? - clistctrl

I've been a developer for 4 years, I've personally seen myself suffer form the second system effect at least twice. (2 different systems) I'm on a project now, doing a specific large task... for my second time.  I have several ideas on how to avoid the mistakes of my first try, but i'm worried its too much.  Any tips on how I can avoid going overboard, but still avoid the mistakes from my first attempt?
======
danudey
The method I use is to look at the old functionality, figure out the
structure, and rebuild it. Don't build a second system, build the first system
better.

In my scripts and projects, I generally start out with a simple, procedural
batch of code, hacking on bits as I go. Eventually, I get to the point where
code flow is nearly impossible to understand - too convoluted, too many global
variables, function calls nested too deep, etc.

Once I'm at that point, I usually know what the program is going to do and how
it should do it, so I rewrite it in a more object-oriented manner. I don't add
functionality, I just move it around to make more sense. I implement only the
features that were in the code already, usually using as much of the old code
as I can, but restructuring it in a way that makes more logical sense. When
possible, I take out code I wasn't using.

After that, I can build on the code further, extending it as needs warrant,
until the code flow gets more complicated. Then I go back and refactor again.

I find that if done properly, each iteration happens sooner (it's easier for
larger and more complicated code bases to become inscrutable), but that each
refactor becomes simpler (as you work towards an optimized design).

------
run4yourlives
The best way to avoid the second system effect is not to build the second
system.

Stupidly obtuse, but nevertheless a simple truth.

<http://www.joelonsoftware.com/articles/fog0000000069.html>

------
logicalmind
One way is to adopt iterative development practices that focus on customers
actual needs and not just desires. The first system should evolve to meet any
unmet needs of the customer. Rather than trying to build a bigger and better
second system.

In summary: small, iterative releases with direct customer feedback on needs.

------
pmiller2
Build a third system. UNIX is the result of the "third system effect."

