Webinar
Smarty

5 principles for creating stupidly brilliant JavaScript applications

The smarter an application is, the dumber its code should be. Make your code maintainable, extendable, and bug-resistant.
Andrew Townsend
Andrew Townsend
 • 
April 11, 2022
Tags

Have you ever tried to add a minor feature to your application only to discover that you’ll have to re-write large blocks of code first? Or maybe you’ve spent hours deciphering hundreds, or perhaps thousands, of lines of existing code just to find out a task only required two lines of additional code. If you’re like most developers, you’ve wasted countless, frustrating hours wading through immensely complicated code trying to force it to do things it wasn’t built for.

In his presentation, Mike Manwill, Frontend Team Lead here at Smarty, discussed 5 principles to help you create stupidly-simple applications that are maintainable, extendable, and bug-resistant. He calls it “writing stupid code”.

“If you can’t explain it simply, you don’t understand it well enough.” - Albert Einstein.

Mike explained that “smart” code is “dumb” for several reasons. It is difficult to read and understand, making it difficult to hand off to predecessors or other coders on the team. It is bug-prone, and debugging can be very very difficult. Extending it becomes time-consuming and difficult, especially if you’re not the one who authored it. Estimating work needed becomes virtually impossible if your code is too smart. And finally, it tends to have a short lifespan and needs to be overhauled frequently because it can be so frustrating to work with.

Smart code is dumb

Aside from spotting those challenges, there are five other symptoms of “smart code”.

  1. Your functions take lots of parameters
  2. There is a lot of conditional logic
  3. You need to explain your code via commented code
  4. Brittle code (it breaks every time you change it)
  5. The code is difficult to follow

So, we’ve identified the problem. You’re tired of being frustrated with this “smart code”. How can you make it better? For the main part of his presentation Mike went over the five principles you can follow to create brilliant “dumb code” that lasts.

  1. Take time to really understand the problem
  2. Decouple different ideas
  3. Pass the thing instead of the parts to build the thing
  4. Refactor (just because it’s working doesn’t mean you’re done)
  5. TDD (Red, Green, Refactor)

You can watch the video recording of his session (super short, only 28 minutes!) and see his examples and explanations first hand by clicking the button below.

Try our stupidly brilliant address validation and address autocomplete tools. You can sign up for a free account by clicking the link below.

Get Free Account

Subscribe to our blog!
Learn more about RSS feeds here.
rss feed icon
Subscribe Now
Read our recent posts
Computer Security Day
Arrow Icon
Here is a day to consider protecting sensitive data, whether it's names, addresses, social security numbers, telephone numbers, email addresses, driver's license numbers, passport numbers, financial data, or biometric records! Today's the day to double-check your systems and ensure accurate information management. It’s Computer Security Day, baby! 2-factor authentication? Check. Fingerprint and facial recognition? Check. Passwords over 15 characters long with alternating capital and lowercase letters, symbols, and numbers? Check!Your IT team is metaphorically making you double-pull on that yellow tab to ensure you’re strapped in securely.
Smarty® named among Utah's Top 2024 Workplaces
Arrow Icon
PROVO, Utah, April 10, 2024 – The Salt Lake Tribune recently announced that Smarty ranked 8th in the Small Business category for Utah’s Top 2024 Workplaces. We. Are. Pumped. Smarty is a great place to work, and we’re proud to say that the tradition of being publicly recognized as a top workplace is still going strong. If you’re unsure of what the Utah Top Workplaces Awards are or how they’re ranked, here’s the process in a nutshell. First, there’s no cost to participate. This award isn’t a pay-to-play award, and there’s no obligatory purchase of products or services.
Santa uses Smarty® 
Arrow Icon
HO HO HO! Merry Christmas, my dear friends,I’m taking a minute from my busy toy-making and list-checking (twice) schedule to write you a letter. I know, I know, usually, it’s you and your lovely children writing ME letters, but I’ve loved seeing your efforts to get on the nice list this year and want to give you a peek into how I make the magic happen. Because you made my heart feel warm even at the North Pole, I’m sharing the answer to my most asked question: "How do I deliver billions of gifts to people all over the world?” The magic behind my sleigh rides? Hint: it's not the reindeer… I use Smarty.