domk
Joined 13 years ago
Joined 13 years ago
It helps directly by making it much easier to know what type or shape everything is. Without types, all you have are variable names and tracing the code back up the stack yourself. Sometimes good naming conventions are enough. More often than not, a variable called `product` can be one of 3 different types and you have no idea why unless you go up the call stack to figure it out.
I find it also helps indirectly by making clever code harder to write. The dynamic nature of JavaScript encourages a degree of cleverness and meta-programming that makes things harder to understand. While you can do the same in TypeScript, making the complier happy makes it much harder to do so, which encourages more straightforward code.
Of course, you can write clever type definitions that are impossible to follow. Sometimes you do want to do some meta-programming without fighting the compiler. But in my experience, the path of least resistance when writing TypeScript is fairly straightforward OOP that tends to lead to clearer code.
customer.is_entitled_to("feature")
to abstract the logic away to the same effect.For example, we have deliberately stuck with a single Node.js/Next app in a single repo using Postgres running on Heroku. We are 5 engineers now and plan to keep it that way for the foreseeable future, even as the team grows.
There is some complexity we probably don't need – the JavaScript ecosystem is notorious for this – but what we use is all reasonably boring tech at this point, and it allows us to stay productive as a team, focusing on delivering value instead of just maintaining things or chasing trends.
Then I joined one and had an eye opening experience - it's not true at all. They might have better tooling (although that's not even always the case), and they might have better established ways to do things, but the engineers aren't any better than at a startup and they deal with the same problems as you.
A lot of work at large corps is "patchworking", and a lot of code is pretty awful and won't teach you "the right way" to do anything. Like anywhere else, there's a lot of v1 code that doesn't get substantially improved after it's shipped because the team has moved on to something else. There can be a lot of churn where code gets moved between teams, rewritten and discarded as priorities change and people come and go. Only a minority of core systems get the benefit of being iterated on and evolved over a long period of time.
I believe that the best way to learn how to do things right is to make mistakes yourself and learn from them. Work on a single project long enough so that you don't just write the v1, but also the v2 and v3 and v4 that make you see the mistakes you previously made and let you figure out how to fix them.
Startups can be a good place to do that, because unlike in a bigger place, you might actually be given the scope and responsibility to do that even as a junior engineer.
You are right that maintaining things is a good way to learn, but you could equally spend 3 years moving on from one new micro service to another as the roadmap priorities change every 6 months, with very little opportunity to spend some time with your own code and learn from it.
If you've worked at 3 different places in 3 years, you might not have seen the benefits yet, but if you try to stay and work on something for long enough, you'll learn a ton.
Use a PaaS like Heroku, hook it up to your GitHub and a CI platform. Get your database hosted on Heroku or somewhere similar - plenty exists for anything you might need (Postgres, MySQL, Redis, Mongo...).
Don't do things that increase your operational overhead like using microservices or running unusual databases for which a good hosted solution doesn't exist. Stay away from anything k8s.
It will be a bit more expensive but well worth the extra money, compared to the time you'd spend on operations.