/ Faster React Native development trick #2: use Prettier
In part 2, Tom explores how we can make the computer work for us to save development time and reduce app development costs.
Tue Feb 18 2020 - 3 min read
In part 1 one we learned that cutting corners does not work in software development. However, by using discipline, developers can leverage more advanced tools such as TypeScript to speed up app creation.
As more intelligent computer assistance comes into being, it will amplify human progress. — Paul Allen, Founder of Microsoft
Absolutely. Especially in code formatting.
I’m talking about adding spaces and syntax to make software look as beautiful on the inside as it is on the outside.
If you’re not sure why this is important, let me explain: changing code is like carrying out a surgical operation.
An operating theatre is organised and clean. The success of the operation depends on each piece of equipment and each member of the surgical staff being at the right place at the right time.
In the example above, the code on the right hand side is easy to read and understand, just like a modern hospital. This means we can quickly get our whereabouts, make amendments and hopefully avoid a tragedy at the operating table.
The code on the left is a real mess. Trying to make changes here could easily introduce bugs into our software.
If we do it manually… yes.
But if we do it with ‘computer assistance’ — definitely not!
The code above is formatted instantly using Prettier.
Prettier uses a set of rules to analyse code. It then automatically adds whitespace and line breaks to make it much… prettier.
At App Sapiens, we run it whenever we save a file. So it’s instant.
It all comes back to discipline. Prettier is a great tool, but requires professionalism on the part of the developer. Here’s why:
One sloppy developer ruins the experience for everyone and can cause regular conflicts in the code.
This happened to me at a job a couple of years ago. Half the team used Prettier, the other half couldn’t be bothered to set it up. As a result, every time a Prettier-enabled developer edited a file last changed by a lazy developer, it formatted the whole file. This made it impossible to track the actual change made.
At App Sapiens we use Prettier every day to speed up app development for our clients. If you would like to find out more about how to increase speed without cutting corners on your project, please reach out via our website.
Henleaze House, 13 Harbury Rd, Henleaze, Bristol BS9 4PN
+44 (0) 117 242 0671
Latest from the blog
How to Fail-Fast in app development in 2021
5 places you shouldn’t scrimp when it comes to app development
Weighing up Progressive Web Apps (PWAs) vs React Native? Here’s what you need to know
Why Flutter development is still in the slow lane