Greg Pabian
May 6, 2024

--

Hello Brielle,

actually, I think I made that example with address too short to make my point. Another example, still not ideal, would be where we have a Vehicle, Engine (1:1 with Vehicle), Engine Certificate (1:1 with Engine). Each structure is independent, but we could reduce the indentation by specifying all of their properties on the same root level of the Vehicle.

I saw such nested structures go many levels deep, completely unneccesarily. Sometimes the model didn't even require it. Sometimes someone has a hunch that "these properties fit together" and no one protested. In general, when I see a structure, I want to know more or less what to expect.

You are absolutely right one should not change models to fit TypeScript; however, this goes beyond TS, I would apply it in most typed languages I worked.

--

--

Greg Pabian
Greg Pabian

Written by Greg Pabian

A Full-stack Software Engineer that loves building products. Disclaimer: https://gist.github.com/grzpab/3cf57878ffce7d5271298ccc473bcb98

Responses (1)