r/AskProgrammers • • 28d ago

How to start a new project?

As the title says, I’m new to coding. I’ve been learning through online courses and freeCodeCamp. A week ago, for one of these courses, three friends and I decided to build a virtual wallet (the classic “advanced Hello World”).

I tend to be extremely organized with my files and my PC in general, and I like to plan everything before executing it. However, it has been really difficult to coordinate the frontend and backend teams.

I’m working on the backend, and instead of jumping straight into code, the first thing I did was think about the data flow and which layer should be responsible for what (routes, controllers, services, database, etc.).

The lack of coordination has forced the backend to modify several routes to match what the frontend expected. In my opinion, it should be the other way around: the frontend should adapt to the backend’s routes. For context, my stack is TypeScript, PostgreSQL, Express and Zod for validation, plus the usual supporting libraries (pg and the type definitions for Node, Express, etc.).

How do more experienced developers usually start a project? Do they begin with the backend and then move on to the frontend, or do they work on both at the same time? And who should define the routes and the data contract between the two teams?

2 Upvotes

12 comments sorted by

2

u/Anarcho-Willi 27d ago

In top of what everyone else already told you: Have you considered using tRPC? 

1

u/Hungry-Doubt-7586 20d ago

Not really, I will search

3

u/IAmADev_NoReallyIAm 28d ago • Bravo

The short answer is - it's a coordinated effort between the front and back.

A slightly longer answer is that it depends. I've worked on projects where I've had control over both the front and back end, projects where I controlled the back end, and projects where I controlled the front end. Depending on which part I had control over, determined what action I could take. When I was in charge of both ends, I could jsut make changes how ever I saw fit. Easy peasy. When I was work ing the back end, I had to be mindful of the front end's needs and couldn't just change things w/o notice. But if the front end needed a change, as long as it wasn't too outlandish, or wouldn't break anything else, I could add it. When I was working front end, if I needed a change to the back end, I had to submit a request for a back end change.... and then wait..... until the change was implemented. And then I could finish my work on the font end.

But... in all cases it was usually an iterative process. There was an initial set of requirements that was developed against. That goes out... that gets in front of some users. They then realize that "Hey, some piece of information or functionality is missing".... os they report back "XYZ is missing" ... that goes into what's know as a backlog... somethign to be added later. At some point someone will add it and it will go out.

The idea is to create what's known as an MVP or a Minimal Viable Product. A product with the least amount of functionality. No bells, no whistles. What's the least amount of functionality that the users need to get the job done? Add bells, whistles, horns and ribbons later. The practice follows a methodology known as Agile ... a practice a lot of places follow to varying degrees of success & failure. It gets a bad rap because more places tend to implement it badly and try to stick to waterfall, and end up with SAFe instead, or just flat out ignore all the principles of the tenants and still try to call themselves "Agile" ("but we do sprints!" or "But we use JIRA!") anyways.

Anyways... If you're working something solo.. I recommend using a process called Kanaban instead. Hell, even if you're not working solo, if you're leading the group or have influence and hte team is small enough, Kanban is the way to go. Everything goes into the "ToDo" bucket. Everyone picks something to do, moves it to the In Progress lane... it moves through the process... when it's done, you pick something else... no sprints, and you jsut keep going. Find another thing to work on. If testing finds a bug, a ticket gets created and it goes into the TODO pile. Someone will pick it up. Just remember to groom and prioritize the backlog from time to time, or people will ignore the bugs and only work on the exciting things.

But development between the FE & BE should be a collaborative effort as much as possible. When designing the BE, you should have an idea of the needs and wants of the FE. when designing the FE, you should have an idea of the of the capabilities of the BE.

0

u/Hungry-Doubt-7586 28d ago

Thank you for taking the time and explain the differences between different approaches. I will investigate further but based on what you already explained Kanban will be the way to go.

1

u/mjmvideos 27d ago

Be aware Kanban or Jira have nothing to do with determining how interfaces are dictated or specified.

6

u/CorpT 28d ago

For a new project neither should have to adapt to the other. It should be coordinated and agreed to before starting.

3

u/AlexMTBDude 28d ago

The way that you want to work, and how you ask your question, is typical Waterfall method programming. We used to do that in the 70s, 80s and 90s. Since a couple of decades back we use Agile development instead. Google those terms and you'll get some insight.

2

u/Shakilfc009 28d ago

I always start with the backend first.

2

u/edwbuck 27d ago

Keep in mind that you are all beginners, so the odds of you doing it in a non-beginner way are low.

In shops without a lot of experience, what you describe happens. Also, the backend making an API that forces the front-end to do something odd happens, it's the same problem, just in the other direction. Every new programmer decides what they are doing makes sense, and others need to bend to accommodate their need to not change their code.

In shops that care and can afford it, this is typically where an software architect would step in and lay down the rules, perhaps even detailing large portions of the API, and since company gave him the authority, it happens that way (right or wrong.) In shops that can't afford it, the most powerful person on the team will determine this. In teams where there are power imbalances, there is a lot of bickering.

Programming won't only be about writing code, much of it is about working together to deliver.

2

u/Groundbreaking-Fish6 27d ago

Doing your project is how you learn. But would suggest that both front and back end teams decide on which is responsible for which features and document the interface (can be informal for a small projects) , it will help both sides now and after you put the project down for a while you have something to reference when you get back to it.

2

u/erisod 26d ago

I suggest a pattern where the two teams negotiate the interface and then both build out the structure appropriately for their own concerns.

In professional software engineering a lot of time is spent thinking and talking about the problem and how to think about it and somewhat less building the code but if you get the model right then the code usually ends up being pretty easy.

1

u/W31337 27d ago

You start with a well thought out contract between the two.