/ 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 Morrow, 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 Morrow 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.
Henleaze House, 13 Harbury Rd, Henleaze, Bristol BS9 4PN
+44 (0) 117 456 6433
Latest from the blog
Apple’s App Tracking Transparency - what it means for your business
How to keep your investors happy - Q&A with angel investor Ash Phillips
E-commerce recurring revenue — here’s why apps rake in more than websites
Meet Alex - our new project manager