DEV Community

Discussion on: Beware of excess of "best practices"

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

While I understand the motivation of this article, I need to add a disclaimer:

Best practices have a context each.

By this means let's pick a piece of your example to see the reason behind "best practices":

You can spawn a cheap Linux VM and deploy your app by hand instead of spending hours setting up CI/CD for something you can do manually in 2 minutes.

✔️ Sure you can "spawn" a cheap Linux VM, there's nothing wrong with that nor there's a "best practice" that tells you otherwise. It's perfect for any starting project and many start ups go this path at the beginning. You can even start with a shared hosting and promote it to VM as soon as you need it -unless you need configs or tools not covered in shared hosting plans-.

But the second part... ❌

IRL you'll be wasting more than 2 minutes, because to set it up manually you'll probably need to -let's say- make a production build, pick any FTP tool, make the connection, then find the folder in both sides, push the build to your server, and finally test that it started correctly, let's say 5min at least (being quick).

Building a simple CI script will cost you like... 10 minutes? 15?
You'll amortize the time in just 3 deploys, at this point, from now on you'll be saving time.

The use-case for using CI Scripts instead manually updating your code as best practice not only covers this situation but also any step that you need to add in your pipeline.

Once it's written and tested, adding steps is just typing few characters in the CI script instead manually executing things in sequence.
Think on running some tests before the deploy;

If you do it manually, you'll probably be starring at your screen for some other minutes waiting for them to finish.
If you automate it instead, it's just a yarn test && or npm test && in the middle of your already existing CI script.

Just try to understand at least the basics about what CI and CD are and how they work and apply what you need after analysing your project stage.




TL;DR: Not knowing how to discern which best practices can be applied to your project or to simplify those best practices and apply them to your current use case is something negative for both you and your code and probably for your career as developer as well as it implies that you don't understand those best practices nor the reasons behind them.