News for hackers. Stuff that matters.
Re:Refactor vs. Rewrite by jeffbee on Tuesday June 02, 2020 @08:53PM (#23398445)
I feel like you have denied the existence of people who are capable of writing down a good architecture on the first try, without all the grinding.
Re:Refactor vs. Rewrite by sdenton4 on Tuesday June 02, 2020 @08:57PM (#23398469)
No good plan survives first contact with the enemy...

Less pithily, the good architecture will almost certainly end up with arbitrary patches and madness after 2 years of active use, if anyone cares about it at all... And then somebody will join and say 'This is a mess, we should refactor and/or burn it to the ground.'

Re:Refactor vs. Rewrite by jeffbee on Tuesday June 02, 2020 @09:02PM (#23398510)
I don't doubt that this could accurately reflect your experience in the industry, but it is not a universal truth. I've worked on sustaining engineering of systems that were years old, the stewardship of which involved refactoring only, and which are still in production today. There are lots of systems that are more or less right in version 1.
Re:Refactor vs. Rewrite by MaulingMonkey on Tuesday June 02, 2020 @10:48PM (#23399144)
> There are lots of systems that are more or less right in version 1.

While true, in my experience this usually happened when at least one - if not all three - of these conditions were true:

1. The problem domain is relatively static, unmoving, and self contained

2. The systems in question is relatively small

3. The developers in question have written substantially similar systems before, or ground locally, or used version 0.x version numbers first (in any of these cases, is it really "version 1" per se?)

...game development is admittedly weak in all 3 categories, and high on time pressure. Oh sure, there's some solid code that will probably last decades in many codebases, but even the best programmers will occasionally make a system that - while good in isolation - needs reworking when combined with other systems - to say nothing of the content and rendering pipelines that vary wildly by decade.

Re:Refactor vs. Rewrite by jjeaff on Tuesday June 02, 2020 @11:53PM (#23399491)
4. A system that never needs to scale much beyond its original projected load.
Re:Refactor vs. Rewrite by recursive on Wednesday June 03, 2020 @01:22AM (#23400073)
First read as "original project lead", but I think that could apply too.
Re:Refactor vs. Rewrite by ratww on Wednesday June 03, 2020 @02:28AM (#23400517)
That's certainly true in my experience. I've seen some great, readable, codebases written by solo developers that had lots of previous experience writing code in larger teams.

Caveat: it's never something that's too large or complex, of course.

Re:Refactor vs. Rewrite by toast0 on Wednesday June 03, 2020 @02:59AM (#23400716)
0. The requirements were known in advance of starting the design.
Re:Refactor vs. Rewrite by WalterBright on Tuesday June 02, 2020 @11:04PM (#23399248)
> the stewardship of which involved refactoring only

I've known several such systems, and the reason they stuck with the original architecture is they wrote it in C, and it's very hard to iterate architecture in C programs. The programmers will just keep bashing the C code so it works well enough.

Yes, I know this is a provocative statement.

The reason behind it is that C's ability to encapsulate behavior is just not very good. Even simple things, like "is it an array or a linked list" leak out all over the place.

Even simpler, "is it a value or a reference type" means one has to swap "." and "->" everywhere. C++ half-fixed it by introducing reference types, D fixes it all the way by noting that "." can be unambiguously used for both operations.

Re:Refactor vs. Rewrite by Ididntdothis on Wednesday June 03, 2020 @12:24AM (#23399678)
To some degree that's matter of luck. Sometimes all your assumptions are correct from the start and the requirements don't change much. But often a lot of things change over time until the first architecture doesn't fit anymore. I would agree there are better and worse architects but luck definitely plays a role.
Re:Refactor vs. Rewrite by goto11 on Wednesday June 03, 2020 @03:44AM (#23400987)
Yeah it is always important in such discussions to remember how vastly different development can be. Developing embedded software for an appliance have vastly different constraints compared to a web app startup which pivot every three months.
Re:Refactor vs. Rewrite by constantine42 on Wednesday June 03, 2020 @02:14PM (#23406705)
It's funny to say, but I can't agree. I've designed and implemented many custom systems for which there was never a predecessor, and not only did it work splendidly at first release, but have been extended and enhanced many times over the years with no refactoring. Many of these systems have been extended enough to start taking over other systems that were never intended.

Design a system to be modular from the very beginning with only the most fundamental of API signatures and you win. Many of these signatures may even no-op for years, but because they're fundamental to the problem, you know there could be a case where they're needed.

I've never had a failed or late project and most of my projects are ones that were assigned to me because no other team would touch them due to all of the attention and required SLAs.

Re:Refactor vs. Rewrite by twhitmore on Thursday June 04, 2020 @07:02PM (#23423007)
Nonsense. Competent designers with 8 or 10 years experience should absolutely be capable of architecting a solid system that is cleanly extensible for forseeable business requirements.

Probably one huge confounding factor, however, is the continual drive by juniors (or supposed seniors who think like juniors) to use the latest & shiniest technologies. These of course these are unknown to the team, of questionable long-term suitability and introduced without knowledge of the "right" way to use them.

In the article the OP describes using Elixir without A) needing it or B) being able to handle its downsides. Plus many random versions of Angular and React. Plus the overheads of an excessive focus on SOA.

My emphasis in architecture is on using simple & strong tools, and delivering great architecture in the problem space. Configurability, extensibility and DSLs are my forte. I don't need a new language -- I know how to use the ones I've got.

Re:Refactor vs. Rewrite by WalterBright on Tuesday June 02, 2020 @10:57PM (#23399207)
I have yet to know any such people :-)
Re:Refactor vs. Rewrite by inopinatus on Tuesday June 02, 2020 @11:00PM (#23399228)
Agreed. Every new design is informed by past mistakes. Programming is not an a priori field.
Re:Refactor vs. Rewrite by Ididntdothis on Wednesday June 03, 2020 @12:25AM (#23399685)
Just avoid touching anything complex :-)
Re:Refactor vs. Rewrite by moksly on Wednesday June 03, 2020 @02:46AM (#23400634)
Or a deadline.
Re:Refactor vs. Rewrite by xwdv on Wednesday June 03, 2020 @12:11AM (#23399584)
Certainly possible to make a good one on the first try. A great one? Probably not, unless you are doing something absolutely trivial and done several times before, like a CRUD app.
Re:Refactor vs. Rewrite by Sammi on Wednesday June 03, 2020 @03:46AM (#23400995)
"Everyone has a plan, until they get hit" - Mike Tyson
Re:Refactor vs. Rewrite by BurningFrog on Wednesday June 03, 2020 @01:03AM (#23399938)
I'd suspect anyone who claims that is a bit full of himself. Maybe their work isn't so great to other people.

Or maybe it is. I won't rule it out.

But I also think that anyone who does this probably works too hard. It's so much easier to build things incrementally.

Re:Refactor vs. Rewrite by collyw on Wednesday June 03, 2020 @04:20AM (#23401195)
>It's so much easier to build things incrementally.

I would say its much easier if you know what you are building in advance. Building incrementally is usually more about exploring ambiguous ideas and not having a clear vision in my experience.

Re:Refactor vs. Rewrite by BurningFrog on Wednesday June 03, 2020 @11:39AM (#23404595)
I'm always building something I've never built before. And the requirements always change as you go.

So knowing what I'm building in advance never really happens.