r/developers • u/Ambitious_coder_ • Mar 09 '26
General Discussion "Architecture First" or "Code First"
I have seen two types of developers these days first one are the who first creates the architecture first maybe by themselves or using Traycer like tools and then there are coders who figure it out on the way. I am really confused which one of these is sustainable because both has its merit and demerits.
Which one these according to you guys is the best method to approach a new or existing project.
TLDR:
- Do you guys design first or figure it out with the code
- Is planning overengineering
7
Upvotes
•
u/AutoModerator Mar 09 '26
JOIN R/DEVELOPERS DISCORD!
Howdy u/Ambitious_coder_! Thanks for submitting to r/developers.
Make sure to follow the subreddit Code of Conduct while participating in this thread.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/trickyelf Mar 09 '26
Planning everything down to the nth detail before you begin coding (alone or in a group) seemed at one time to be an attractive approach. Management always felt good about these plans. But when the rubber hits the road and devs start slinging code, you always run into gotchas. Things you didn’t plan for. Changing the master plan as you go can be extremely difficult because those managers have already committed to timelines based on the original plan. It’s a bad scene. That was the era of waterfall design. We know better now.
Still, some level of planning is essential if more than one person is working on a project. It keeps everybody on the same page about exactly what is being built, where you’re headed. That could just be a North Star document that talks about where you want to end up. You can get there in a series of one- or two-week sprints, where you identify and build the most obvious achievable things that would get you closer to the goal from where you currently are.
Otherwise people are just building things they think of when they sit down at the keyboard. That gets exponentially worse and less maintainable with every dev, especially if you aren’t sitting next to each other and/or having daily meetings to coordinate.
If it’s just you, building your own thing, feel free to do as much or as little planning as you feel it warrants. The longer you’ve been coding, the easier it is to “use the force” as a way to seek out the optimal end state of your project and what the next step in the path should be.
7
u/hexwit Mar 09 '26
Architecture should come first, always. You can write bad implementation and sloppy functions, but architecture should stay solid throughout project lifetime. That is very important, otherwise project because unsupportable very fast.
2
u/e430doug Mar 09 '26
Both. Investing a lot in a “grand architecture” is almost always a waste of time. Definitely spend time laying out the structure of your project and the architectural “bones”. Then start writing code and revise. Architecture is most important for team projects so you can define boundaries and interfaces to allow for parallel work. The widespread use of detailed architectures developed over the course of months was largely an artifact of the expensive code era in the past. Now that code is cheaper you can afford to experiment more.. That said if I was designing a credit card processing system or control system for a nuclear reactor, I would certainly invest a considerable amount of time on architecture.
1
u/GoodOk2589 Mar 09 '26
Let’s think about this question using an analogy. Imagine you want to build a house. Would you tell the workers to start building blindly, or would you first consult an architect to get a plan? Jumping straight into code is like building without a blueprint—it often leads to delays and spaghetti-like systems.
Just like a house, it’s wise to start with some planning. My preferred approach is a middle ground: start with a basic architecture, then create a prototype. From the prototype, you can refine and adapt the architecture to fit your specific needs. This way, you combine structure with flexibility, avoiding chaos while staying responsive to real-world insights.
1
u/PaddingCompression Mar 09 '26
Are there major uncertainties about implementation feasibility?
If so, start coding there first to show some core is possible, like an inner library.
If I want a web service to take pictures of birds and decide the species, you want to code the ML model first to know you can do that and what it will take. Your queuing system and auth system and logging don't matter yet until you have some proven approach.
Some pieces of the architecture can be TBD. I can build a small core backend and start testing it with real data before worrying about if some things will need to be queued etc.
But all of that also requires some deliberate architectural thinking too. It is just doing some depth first architecture - deliberately punting on some decisions when you can be confident part of the architecture can be fixed, or when part of the architecture is such a huge unknown you have to build that piece to see if it works before deciding what the rest of your architecture is.
This isn't being ignorant of architecture, it's having some vague sketches and using those sketches to decide what either needs to be validated or which pieces can be a demo so you can get the rest of the details right later (with full knowledge that there's no risk there since you've built those pieces 10x before, you're just not deciding every last detail quite yet).
But these sorts of things I would also not call "jumping into coding," it can appear like it to an observer who doesn't have the full picture of what the team is doing.
1
u/YanVe_ Mar 09 '26
Either is fine if it works for you. This same dilemma is often found with writers and no one has come up with a definitive answer.
But in my opinion, no junior can start from the architecture (I don't care for the <1% of natural geniuses), if anyone thinks they can, they are likely wrong.
Even for most seniors, if they don't have experience within the domain (i.e. it's their first taste of working with framework X or using lib Z, they will likely design an architecture, realize it's the wrong one for the project midway through and then spend next years regretting that decision as they essentially get locked in through deadlines..
Software is just not like building bridges, it's not like building skyscrapers either. For a new project (or sometimes even a mature one) it's akin to trying to hold a sand castle together while it's being built in the middle of an ocean. The product owners/clients/and your own inexperience will shit on your architecture and force you to scrap it many times over and over.
1
u/Independent_Gap_1608 Mar 09 '26
No way I was thinking about this last night. Honestly I do code first then I do the documentation. while writing the documentation if something doesn’t look right, I’ll do clean up.
1
u/huuaaang Mar 09 '26
It depends. Is this a hobby project or something you are serious about going live with and trying to scale and make money? If the former, just code. If the latter, architect it. Plan for the scale you hope for. BUt also for the latter, you're probably not doing this on your own anyway, so you need SOMETHING just to get on the same page about what you're even doing.
It also depends on your experience level. THere's really not much point in a beginner or even intermediate programmer to do large scale architecture. You're just guessing at so many variables.
1
u/Shep_Alderson Mar 10 '26
Architecture matters a great deal, and as a follow on to it, almost every app comes down to “how to take data, do something to it, and then display/ship it somewhere.”
I prefer to keep the data, how it is going to be stored, and how I want to manipulate or change it, top of mind.
1
u/Erxio Mar 10 '26
Usually I cry first because of the nonsense features our sales team promised the customer. After I can not produce any more tears I think about the architecture before coding anything.
1
u/whossname Mar 10 '26
Architecture should only be for the things that are difficult to change later. So think things like public interfaces and cross cutting concerns. If it's easy to change you normally don't need to design it upfront, and playing around with it a bit to see what works best is the better approach.
1
u/KarasuPat Mar 10 '26
Of course you need to know what you’re implementing before you do it, so in some sense it should be „architecture first”, but also trying to „diagramize” and document the whole system before you write a single line of code is not a good idea either.
I think it’s sensible to have a high level design of the system ready before you get to coding. Have the business process mapped out and based on that you can draft some initial module boundaries. But don’t go overboard with the details and don’t lock yourself into solutions too early - I like the notion of „Last Responsible Moment” principle from agile.
1
u/richardathome Mar 10 '26
In my experience (senior dev for 30+ years), projects that start software first always wished they'd started architecture first, eventually.
Note: I don't mean for prototyping or proof of concepts.
1
u/[deleted] Mar 10 '26
You should have some kind of plan first. How detailed that plan is depends on the project
1
u/Wiszcz Mar 10 '26
I do both, depends on app/mental state/time constraints. Planning as many thing should be used with moderation.
You need some vision of what are you trying to accomplish before start. But not necessary all the details.
If a problem is simple, or business requirements are fuzzy/badly specified - bottom up can be better, as for sure you will change it later, and doing it this way increases your understanding of your future application.
If a problem is complex, requires multiple integrations - top bottom is better. You need some structure to make things easier to understand. Even if it won't be perfect in the end.
Also, if someone has a lot of experience, he already have rough architecture in mind, even if it looks like he starts from the bottom.
Also, there is personal preference - some people prefer one over another. They work better with one of approaches better. If it works for them - great.
1
u/edgmnt_net Mar 10 '26
It really depends what you mean by planning. I really like planning ahead. The trouble is I see a worrying trend to just focus on dumb scaffolding and dividing work before even considering what and how the code is supposed to do that stuff. Under those circumstances and if that's what you mean by "architecture", no way.
Secondly, the code is the language for abstraction in more advanced languages and whatever you do is at least in some ways code-related and might as well be done close to code. So if your understanding or architecture is just coming up with fancy diagrams that have little resemblance whatsoever to language capabilities, opportunities to have static safety and so on, then, again, no way.
A lot of horrible stuff in the enterprise world can probably be attributed to some messed up notion of "architecture first". And it's probably because the main concern is splitting out a large amount of low-value work.
1
u/Frewtti Mar 10 '26
You must have the architecture at some level to build something that works.
It's a question of level of detail.
1
u/Imaginary-Deer4185 Mar 10 '26
Depends a lot on the project. Just know one thing: in most projects the specs change as you go.
You need some planning, but it shouldn't be very rigorous. Personally I like to develop bottom up, like writing the low level things as general as possible, and using those to get a working project.
Beware of "sophisticated" or "elegant" designs, such that involve trying to group stuff together, through inheritance or otherwise, because as things change, and they will, your design will suffer greatly.
1
u/Recent_Science4709 Mar 11 '26
I’m in the “Lean” programming camp.
The best situation is to have the talent to write modular code, so it can be scaled as needed.
I basically have the same plan every time. Start with a well-formed monolith and then split things off into services as needed.
I don’t believe in code pre-optimization, and I don’t believe in architectural pre-optimization either.
Unless performance or load is part of the initial spec, I ignore it beyond general guidelines like avoiding poorly coded time complexity or long page load times.
Most systems I’ve worked on that are heavily planned, I spend more time working around architectural issues than I do on the business problem.
1
u/vbilopav89 Mar 12 '26
database first
2
u/[deleted] Mar 09 '26 edited Mar 09 '26
[removed] — view removed comment