Hacker News new | past | comments | ask | show | jobs | submit | _qjt0's comments login

Author here.

> Fast forward almost a decade

If your system lasted a decade, that's a success, and any startup that just started would love to be in your shoes.

> management still doesn't understand the concept of "overwhelming technical debt".

That's a problem with your company, not with the suggestion in my post of adding in layers of abstraction when needed rather than ahead of time.


I'm not saying they weren't successful. As someone who tends to over-engineer things, I do admire their ability to get a product out quickly - I think for a startup that was probably the right decision!

But that's what I've been missing from your article - more on the distinction between the approaches, and the drawbacks of having a thin back-end layer as the product / company is growing. In the beginning I thought you were talking about how to make your startup more efficient and flexible - basically consciously building some technical debt, having weighed your options.

But if that's not the idea - personally I don't know how to scale with this approach, neither technologically nor in terms of team structure. The thin back end layer could work though if you have a lot of small products that are independent of each other - developed by small teams that can afford to act like early startups. Maybe that's what you meant, but I didn't really get that from the article.


I get that you've disagreed with almost every point telling you this is a bad idea, but I think the point is particularly pertinent.

They tried this system, and then realised they painted themselves into a corner. Businesses wants features they can sell to customers, and sometimes fixing technical debt is a luxury. Especially when technical debt hidden to customers.

Adding layers of abstraction when needed might sound like great advice to a startup that needs money ASAP. But down the line when requirements change, maybe those layers of abstraction cost too much time to implement, especially if you're firefighting a dozen other poor choices.


Author here.

> every change to your database will break your client unless they are updated simultaneously every time (impossible for mobile apps)

You can just put up a UI forcing the user to update. Which is perfectly fine since you won't be making backward-incompatible changes to your database every month. Adding a new column doesn't break existing clients.

> or your client is aware of every backend change (very complex)

You can just put in a build date in your frontend and compare it against the date a breaking change was made. If it's <, refresh.


> You can just put up a UI forcing the user to update

sounds very user-friendly


Author here.

The article says "build a backend API when it has something to do, not as a pass through to your database."


Author here.

It's good to see a considered response, rather than the typical knee-jerk reactions common on Internet forums including HN.


In this case, I wouldn't disagree with you if you were to do it on the backend.

The article says, "build a backend API when it has something to do, not as a pass through to your database."

It doesn't say "never write any backend code".


The article's subtitle literally says "The best backend is no backend at all". The article gives the impression you have no idea what a backend is supposed to do, except expose some data.


Author here.

> Your DB is likely to contain internal state that has no business being sent to the client.

Which is why not all tables need to be sent to the client. The post gives an example of exposing the friends table to the client but not others.

> If you do this, any business logic not captured in your backend has to be duplicated in each front end.

No, the post says to make your backend layer as thin AS POSSIBLE, not to not have a backend layer at all costs even if it means duplicating code.

> How do you make breaking DB changes if you take on this strategy of API design?

You change the frontend!

> This advice may be good for a proof of concept, a prototype, or an early version which stands a good chance of getting rewritten.

Which is why the blog post begins by saying, "Say you've started a startup today"

> I would not recommend it for anyone wishing to build a lasting architecture.

In a startup, I wouldn't recommend over-designing on day 1, because that's a good way of not delivering enough business value fast enough and so going bust.

> Take a look at your favorite famous internet company and look at their API and try to deduce if they follow this advice or not.

As the blog post says, you shouldn't cargo-cult Google or Amazon. You don't operate at their scale, you don't have as much traffic, you don't have as many teams, and so on. You should what makes sense for you given your company's maturity and where in the product lifecycle you are.


> Which is why not all tables need to be sent to the client. The post gives an example of exposing the friends table to the client but not others.

What if the "is_active" flag takes on more nuanced meaning over time, as you add "client_activation_status", and over time expand that meaning. All frontend clients of the API need to be aware of such low-level changes. An API acts as an insulation layer.

> No, the post says to make your backend layer as thin AS POSSIBLE, not to not have a backend layer at all costs even if it means duplicating code.

At one point the post says to get rid of it altogether and use SQL, making the architecture 2-layer. If you do have a backend layer, and it does have business logic, that business logic will stand between your DB and the client. This logic will vary in thickness, but in a mature application will be substantial.

> You change the frontend!

How do you force a synchronized iOS app update to all the people who have your app installed?

> Which is why the blog post begins by saying, "Say you've started a startup today"

Fair point. Still, it is not something I would do except in throwaway prototypes or proof-of-concepts.

> In a startup, I wouldn't recommend over-designing on day 1, because that's a good way of not delivering enough business value fast enough and so going bust.

Agreed on this advice. And you need to ask yourself how you will gradually adapt the software you've built so that it can change with the needs, risk profile of your clients, and growth of your company. An approach to API design you describe is fundamental, and it would be difficult to adapt it without scratching it altogether and starting afresh with v2.

> As the blog post says, you shouldn't cargo-cult Google or Amazon. You don't operate at their scale, you don't have as much traffic, you don't have as many teams, and so on. You should what makes sense for you given your company's maturity and where in the product lifecycle you are.

Agree about not cargo-culting. Agree about adjusting approach to company maturity. My experience has showed me that the approach you suggest has too many disadvantages for building any production software.

I wish you best of luck and hope that at the very least I and others on this thread were able to offer another perspective.


Author here.

> This article doesn't use the word "permission" or "validation"

The article talks about it multiple times: using a database user account with limited privledges, exposing some tables but not others, exposing read but not write access, giving users access only to data they own.

> it's nearly impossible to parse and check an arbitrary SQL query for malicious intent

Which is why the article doesn't propose trying to parse and check queries for malicious intent.

> it now passes the responsibility of query performance to the FE engineer. Are appropriate indexes in place? Does the query make inappropriate JOINs?

No, in the proposal, we have backend engineer(s) to advise and assist frontend engineers. Having appropriate indices and JOINs doesn't mean you have a layer that doesn't add business value. And when it does add value, write it!

> schema changes now mean that you need to update your front end code. This means guaranteed hard downtime, because you can't control what JS folks are running in the browser.

I don't know if I understood you, but you can just force a refresh in the browser.

> you also need to make sure that queries aren't designed to intentionally DoS your DB.

That's a valid point I didn't think of.

> There's a lot wrong with the ideas presented here.

It's hard to take your criticism seriously when many of your reactions are a result of your own misunderstanding of the proposal.


Author here:

> 1. You can't trust the front end. Backends must be written assuming that every call from the front end is malicious.

This is already taken care of in the proposal, by permitting clients to access only data they own.

> 2. There will be multiple front ends. If all your business logic is in the front end, you'll have to duplicate it into all of them. Where it will rapidly get out of synch and you'll have different behaviours on different clients.

No, because a) not every startup starts on multiple platforms b) you can always put common behavior into a piece that's reused. This can be a library linked in to multiple frontends, or a backend API. The post says your backend should be as thin AS POSSIBLE. It doesn't say you shouldn't have a backend at all costs, even if that means duplicating code.

> Forcing your UI to use the same entities as your database.

Nothing prevents you from mapping the entities to different ones for your frontend, in cases where you need that.

> The advice in the article strikes me as dangerously sensible-sounding while being mostly wrong.

I don't think you even understood the advice in the first place, as I can see from your misconceptions above.


> This is already taken care of in the proposal, by permitting clients to access only data they own.

But you don't propose any method for that apart from hand-waving about "database user accounts with read access", which is largely irrelevant unless you're proposing to give every one of your customers a database account and do row-level database security.

Let's talk about a concrete example: A call arrives at the back end to change the user's name to "dickwad".

In a conventional backend, you'd check the session, work out which user that session was logged in as, check that it's the same account as the name that's going to change, and maybe then run a profanity filter, or not.

How would you build your minimal backend to do that? Remember, you don't actually know that this call has come from the front end, it could be sent from curl.

> Nothing prevents you from mapping the entities to different ones for your frontend, in cases where you need that.

True, but that's not mentioned at all in your article, and defeats half the point of it - the front end engineer still has to worry about what the database needs and how to do that mapping when it changes.

> I don't think you even understood the advice in the first place, as I can see from your misconceptions above.

What misconceptions? I understood you (almost) perfectly. It's a well-written article. Still wrong, though.


> This is already taken care of in the proposal, by permitting clients to access only data they own.

I'm curious how this works. In a database that stores something like an address, how do you prevent someone from slightly changing the query to give them someone else's address stored in the same table. I've heard of giving per-table access, but never per-row.


alter table addresses enable row level security;

However this article is insane because of the security nightmare of trusting all incoming queries


Not the parent, but I read the book, and the principles have become so common nowadays that I never really had a wow moment. It was more like "Yeah, this guy is telling me things I already know." It is nice to see the common knowledge built up from scratch, rather than just automatically accepted the way it is, but I wouldn't consider the value you get from the book worth the time, today.


I agree that you get most of it by reading HN for a few years. However, it is a small old book so not that much of an investment.

It did have a few ideas which were new to me and it presents a holistic consistent management philosophy which you don't get from reading a hodge-podge of blog posts.

Two (for me) new ideas: Matrix organisation is inevitable for large companies in search of the sweet spot between agility and efficiency. Knowledge workers are middle managers.

Overall: Good book but not "you have to read it" level.


8 vs 11 is too small a sample size to say either way. It may very well be that a couple of these startups succeeded due to their business model / luck / sector / whatever which wouldn't apply to the next startup.

If it were 0 vs 11, that would mean something, but 8 vs 11 is too close.

Instead of counting unicorns, we should count the number of successful exits, such as acquisitions. Or, second best, the number of companies that reached (say) series C funding.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: