Most active commenters

    ←back to thread

    873 points belter | 11 comments | | HN request time: 0.952s | source | bottom
    Show context
    ZaoLahma ◴[] No.42947654[source]
    > Most programming should be done long before a single line of code is written

    Nah.

    I (16+ years developer) prefer to iteratively go between coding and designing. It happens way too often that when you're coding, you stumble across something that makes you go "oh f me, that would NEVER work", which forces you to approach a problem entirely differently.

    Quite often you also have eureka moments with better solutions that just would not have happened unless you had code in front of you, which again makes you approach the problem entirely differently.

    replies(16): >>42947849 #>>42948402 #>>42948536 #>>42948683 #>>42948786 #>>42949252 #>>42949429 #>>42949588 #>>42950167 #>>42950238 #>>42950409 #>>42953785 #>>42955243 #>>42956358 #>>42957524 #>>42964457 #
    1. VyseofArcadia ◴[] No.42948536[source]
    Iterative work is THE way to work in large legacy codebases. The minute you wade into the code, all of your planning is moot. You don't know what's lurking below the surface. No one knows what's lurking under the surface. Except maybe Dave, because he vaguely remembers about 15 years back talking to some guy who wrote some code 30 years back about it.

    Greenfield, absolutely design up front you lucky devils, but iterative is the way otherwise.

    replies(6): >>42948610 #>>42949170 #>>42949340 #>>42951151 #>>42956824 #>>42962429 #
    2. renewedrebecca ◴[] No.42948610[source]
    Every development shop has a Dave.
    3. bluGill ◴[] No.42949170[source]
    Greenfield lasts only for at best 2 years or the first public release. After that it is legacy.

    I'm am the "Dave" on my current code since I was one of the first engineers on the project and the others before me have long moved to management. There is a lot I don't know about how the code works. There are dark corners we just lifted completely from an earlier project where the guy who wrote it 30 years back is retired. This is normal.

    I'm fighting desperately to keep this code in shape as I don't want to go to management to ask for $$$ (billions) to rewrite it. I regret many choices. I'm making other choices in response that I fear someone will regret in 15 more years. I'm hoping to retire before then - better talk to me now because soon the people who have talked to the person who wrote the code 30 years ago will also be a memory. (the guy who write the code 30 years ago is still alive and someone has his phone number - they talk once a year about something weird to see if why is remembered)

    replies(1): >>42961838 #
    4. braggerxyz ◴[] No.42949340[source]
    Today's greenfield is tomorrow's legacy. So this statement still holds true ;)
    5. devmor ◴[] No.42951151[source]
    As someone who's spent 12 years working on legacy codebases, I strongly disagree with this.

    Iterative work in a large legacy codebase is how you end up making your large legacy codebase larger and even less understood.

    Your planning should "wade into the code" from the start. I have always gotten better results by charting out flow diagrams and whiteboarding process changes than just "diving in and changing stuff".

    Frankly, I'd say it's the opposite for greenfield development. Doing iterative work to build out a new product and make changes as you discover needs you didn't account for makes a lot more sense that flailing around making holes in something you don't fully understand that is tied to active business needs.

    replies(1): >>42951819 #
    6. 9rx ◴[] No.42951819[source]
    > I have always gotten better results by charting out flow diagrams and whiteboarding process changes than just "diving in and changing stuff".

    In terms of a broad population, I am not sure there is a meaningful difference, though. You can iterate on your ideas on the whiteboard or you can iterate on your ideas in code, but the intent is the same. Either way you are going to throw it all away once you have settled on what should be the final iteration anyhow.

    It just comes down to where you are most comfortable expressing your ideas. Some like the visuals of a diagram, others are more comfortable thinking in code, some prefer to write it out in plain English, and I'm sure others carry out the process in other ways. But at the end of the day it is all the same.

    replies(2): >>42952443 #>>42952932 #
    7. mjlawson ◴[] No.42952443{3}[source]
    > Either way you are going to throw it all away once you have settled on what should be the final iteration anyhow.

    I think this needs to be highlighted, because while I completely agree, I think it's often implicit, taken for granted, and neglected. Far, far too often I've seen code bases bloat because this never takes place. The sentiment at a lot of places seems to be, if the tests pass, ship it. Arguably, it may even be the right decision.

    8. devmor ◴[] No.42952932{3}[source]
    I have never really thought about it that way, but you're right.

    Ultimately what matters is the final changeset. How you get there doesn't really matter.

    9. johnnyanmac ◴[] No.42956824[source]
    >Everyone has a plan until they get punched in their face (by landmines in legacy code)

    unless you have the old maintainer on call (I rarely did due to them leaving the company years ago) you definitely need to move slowly. rely on test suites if you are blessed with them. Submit small changes that pass tests.

    BTW, nice and timely username.

    10. arkh ◴[] No.42961838[source]
    > I'm making other choices in response that I fear someone will regret in 15 more years.

    Junior dev made to maintain some code base: "wtf, all this old code suck. People were really bad at their job".

    Same dev 5 years later: "wellll, this looks bad but there must be a reason.". Usually the reason is someone sold a new feature without asking the implementers or even checking what the impacts could be. So it has to be ready yesterday and you'll never get approval to refactor or clean-up anything, until it breaks.

    11. scotty79 ◴[] No.42962429[source]
    > Greenfield, absolutely design up front you lucky devils, but iterative is the way otherwise.

    That only works for greenfield projects where you have extensive experience with everything that is going to be used on that project. For all others you still learn as you go and all plans and designs need to be revalidated and updated multiple times.