Comment by crazygringo

Comment by crazygringo a day ago

21 replies

These are not decisions that should be taken solely by whoever is programming the backend.

They need to be surfaced to the product owner to decide. There may very well be reasons pieces of data should not be stored. And all of this adds complexity, more things to go wrong.

If the product owner wants to start tracking every change and by who, that can completely change your database requirements.

So have that conversation properly. Then decide it's either not worth it and don't add any of these "extra" fields you "might" need, or decide it is and fully spec it out and how much additional time and effort it will be to do it as a proper feature. But don't do it as some half-built just-in-case "favor" to a future programmer who may very well have to rip it out.

On a personal project, do whatever you want. But on something professional, this stuff needs to be specced out and accounted for. This isn't a programming decision, it's a product decision.

hamandcheese a day ago

Some things are trivial and nearly free - created_at, updated_at. I don't think engineers need to bring trivialities like this to a "product owner". Own your craft.

  • bayindirh 18 hours ago

    When the product you're developing is governed by regulations and standards you need to comply, owning your craft is doing things by the book, not adding fields on your own because it might be useful later.

    • dogleash 15 hours ago

      So what? I've worked places with lots of regulation. Part of every development job is learning the product domain. In that case devs become comfortable with reading standard/law/regulations and anticipating when software implementation might interact with the areas covered.

      Sure there were people who's job was to offload as much compliance work from everyone else; by turning it into internal requirements, participating in design discussion and specializing in ensuring compliance. But trying to isolate the development team from it is just asking for micromanagers.

      • bayindirh 14 hours ago

        > So what?

        Think before you act. The machine has no brain. Use yours.

        > Part of every development job is learning the product domain.

        Yes.

        > In that case devs become comfortable with reading standard/law/regulations and anticipating when software implementation might interact with the areas covered.

        This is what I'm saying, too. A developer needs to think whether what they are doing is OK by the regulation they're flying against. They need to ask for permissions by asking themselves "wait, is this OK by the regulation I'm trying to comply?".

        > But trying to isolate the development team from it is just asking for micromanagers.

        Nope, I'm all for taking initiatives, and against micromanagement. However, I'm also against "I need no permission because I'm doing something amazing" attitude. So own your craft, "code responsibly".

  • hombre_fatal 18 hours ago

    I never worked at a place with product owners, but their post made me appreciate my roles where I'm trusted to help design the product myself. Yeesh.

    Being unable to even call the shot of whether a database table should have an updated_at or soft-delete sounds like a Dilbertian hellscape to me.

  • IanCal 18 hours ago

    Although those can be more complicated, and it should be clear what they're for and why they exist. Will this result in an object having an updated_at timestamp elsewhere in a larger application? Is it clear which properties that refers to?

  • kace91 a day ago

    A soft delete might not be, for compliance reasons (GDPR and the like). Otherwise I agree.

  • danielPort9 18 hours ago

    I think the tricky part lies on knowing which things can be done without consulting any product owner. I agree that created_at and updated_at don’t cause any harm. deleted_at on the other hand cannot be decided by engineers only (mainly because of GDPR reasons: if something is expected to be totally deleted, then that must be it). As usual, these kind of things are obvious to engineers with years of experience , not so much to newcomers.

Extasia785 18 hours ago

This entirely depends on the company culture. I worked in teams where every small decision is in the hand of the PO and I've worked in teams where a software engineer is a respected professional enabled to make their own technical decisions. I found the second option to create higher quality software faster.

Also not sure what you mean by additional effort? Created_at, updated_at or soft-deletes are part of most proper frameworks. In Spring all you need is an annotation, I've been using those in major projects and implementation cost is around a few seconds with so far zero seconds of maintenance effort in years of development. At least those fields are solved problems.

  • crazygringo 12 hours ago

    But what if it's not a technical decision? What if there are legal implications around data retention that it's not your job to be aware of?

    I've been parts of teams where features had to be totally thrown out and rebuilt because developers made big assumptions that turned out to be wrong, because they didn't think it was worth it to check with the product owner. Because they assumed it was only a "technical decision", or they assumed they understood the customer needs despite never actually asking the customer.

    This doesn't mean checking with product around each line of your code, obviously. But deciding what information gets stored in the database, what level of event tracking you do, whether deletes are hard or soft -- these have massive product implications, and potentially legal ones.

    And it is additional effort. Now you have to write tests for all those things. Are the timestamps being stored correctly? Are the permission bits being stored correctly? Is "created_by" coming from the right user? Are we sure a malicious user can't spoof that? Do we care? Is "updated_at" actually being updated on every row change? But are we making sure "updated_at" is not getting changed when we import data from a separate table? How often do we remove soft-deleted data in order to comply with privacy policies and regulations, and with what cron job, and who maintains that? Where do alerts go if the cron job fails? What happens if that employee leaves? I could go on and on and on.

    So that's what I mean by additional effort. It's not "around a few seconds". Because it's not just a technical question, it's a product one. It's a proper feature that needs to be properly defined and properly scoped out and properly tested.

    • jeremyjh 7 hours ago

      No. Just no. Put created_at, updated_at on every table. You are really grasping to find a problem with it, because there isn't one, and its been helpful in literally every job I've had for the last 28 years. Product owners don't do application support.

  • exe34 17 hours ago

    even better, assume soft deletes and inform them this is how delete works - if there's a hard requirement for hard delete, they will tell you.

    the hypothetical future programmer is you in two weeks.

makeitdouble 12 hours ago

> And all of this adds complexity, more things to go wrong.

This argument is one of the reason why a backend engineer could just add the created_at and updated_at fields without asking a product owner.

It doesn't make much sense from the pure product perspective, so the standard answer will be "no, let's add them when we have a real case they're needed". The product I'm inheriting right now misses these fields on half of the tables. Except when you really want the data, it won't be there as you're not going back in time.

Trying to convince someone that it's worth it will also give the impression they're optional, when you already decided you need them. So at the end of the day, it's your responsibility as an engineer to do what's required, without punting it to non technical stakeholders to push your back.

I also wouldn't ask a product manager if they think table schema should be orthogonal.

Now keeping or not IPs or user IDs in a table is a whole different story and requires a lot more consulting, and not just with the PO.

chii a day ago

> don't do it as some half-built just-in-case "favor" to a future programmer who may very well have to rip it out.

in other words - YAGNI !

Cthulhu_ 19 hours ago

A product owner may (probably does not) have these things on their radar, it's up to a developer to inform them of industry best practices like these.

PaulHoule 15 hours ago

I've seen product owners who get blindsided every time by this sort of thing.

On the other hand, in some shops there is a dedicated DBA who is in charge of database schemas and possibly everything else. Before it became fashionable to create a "service layer" where people access the database (now database(s)) throw web endpoints, some organizations would put all the database access into a set of stored procedures managed by the DBA. Maybe that's extreme, but in the real world product owners come and go but the database is forever and deserves to have somebody speaking out for its interests.

escot 11 hours ago

In a good work environment you’ll have some telepathy with your product people and you wont have to communicate every minor change, which wastes time. Its similar to implementing a UI design — you and the designer will develop a relationship where you dont need to communicate every pixel, you fill in the blanks and show results, repeat.

damnitbuilds 20 hours ago

Yes. Adding fields to a DB is not a risk-free thing a programmer should just do.

Chris2048 a day ago

> And all of this adds complexity, more things to go wrong

That's a little vague given this specific example, which appears to be about maintaining some form of informative logging; though I don't think it necessarily needs to be in the form of an DB table.