Back
Pieces User Stories: Auto-complete boilerplate code
Auto-complete is the ultimate workflow upgrade for Brandon, who doesn't have time to waste re-typing commonly used code snippets.
From developing APIs to streamlining internal ops to building micro-utilities, Full Stack Engineer Brandon’s work is different every day. The ways he uses Pieces are similarly varied.
One feature that he started using recently is auto-complete. “Auto-complete was pretty useful on some of the boilerplate code that I use in my C++ and CMake projects, where I copy certain things a lot and there's not really a good way to abstract it out. So, Pieces auto-completed it and nearly took care of everything for me.”
The snippet Brandon uses across all of his C++ projects to bring in Catch2, a popular open-source testing framework.
A lot of developers prefer writing code over the more “menial” chores like documenting their code and writing unit tests. Unit tests are extraordinarily powerful when combined with test automation + CI/CD systems, and go a long way to improve software stability. But the caveat is that you have to actually write your tests! “I save these two snippets in Pieces so I can use auto-complete to write tests faster and sleep better at night knowing I’ve tested the code I put into production.”
Then, onto the next task! “A typical challenge for budding JavaScript developers is how to perform seemingly simple tasks, like center a div. There are many different ways to do it, and I may not be quite sure which one will work out for the structure that I have, but I saved a few snippets from the web to my Pieces library, tried them out in my editor using auto-complete, and ended up finding something that worked. The solution wasn’t exactly from those snippets I saved, but Pieces made it easier to quickly try a bunch of approaches.”
Pieces is always there when he’s going into uncomfortable territory. “If I need to figure out how to do something in a language or framework that I don't know, I’ll find, like, three different solutions to do something, but I'm not quite sure which one will work, so I save them all to Pieces. I’ll come back later and try them out locally, but I can keep researching really efficiently and then trying things out really efficiently.”