Blog post

What Mr. Miyagi can teach you about writing Clean Code

Liz Ryan photo

Liz Ryan

Product Marketing Manager

Date

  • Clean Code
  • Learn as You Code
  • Code Quality
Daniel-San balances a laptop in one hand while performing his patented crane kick. Mr. Miyagi is proud.

Since its release in 1984, The Karate Kid has become a classic and beloved piece of cinematic history and pop culture. Its underdog theme and inspirational moments resonate with audiences, even after nearly 40 years. But what makes it distinctly memorable is the constant opposition between the two karate teachers, Mr. Miyagi and John Kreese. 


With two distinct and contrasting teaching styles, Mr. Miyagi is rooted in balance, discipline, and personal growth through education. At the same time, John Kreese focuses on a ruthless and combative mindset, often resorting to intimidation, fear, and harsh discipline. Both teachers are successful in their own right and have devoted students, but in the end (spoiler alert!), Mr. Miyagi's attentive and balanced approach ultimately wins. 


Mr. Miyagi's teaching style drives success because it goes beyond simple execution, instead focusing on practical application, personalized education, and straightforward delivery. He equips students with excellent karate skills plus the values and qualities necessary for continued growth.

But why does Mr. Miyagi matter to Clean Code? 

When your goal is to be an expert at your craft - in this case, software development - it's essential to consider who you look to for guidance. Do you prefer to learn with advice that helps refine and deepen your coding skills, or do you choose intimidation and force? If you could find and fix issues while also learning along the way to achieve increased coding precision and excellence, wouldn't you want to try it? 


Mr. Miyagi stands for helping his students internalize his lessons to become better. The same can be said for your approach to writing Clean Code. So how can we apply Mr. Miyagi's genius to Clean Code to help developers succeed? It's all about how we embed and deliver education in the development process. Let's first consider Mr. Miyagi's key principles: 


  • Character Development: Mr. Miyagi goes beyond teaching karate moves to explain "the why" behind karate so that his students apply their skills responsibly and ethically.
  • Individualized Instruction: Mr. Miyagi tailors his approach to give students the attention and guidance they need to reach their full potential.
  • Practical Application: Mr. Miyagi emphasizes techniques that are efficient, effective, and rooted in real-world scenarios so students develop skills that can be applied in practical situations, promoting self-confidence.
  • Nurturing and Supportive Environment: Mr. Miyagi fosters positive relationships built on trust and motivation.
  • Long-Term Focus: Mr. Miyagi strives for a deeper understanding and appreciation of karate as a means of personal growth rather than a mere tool for victory.


Ultimately, Mr. Miyagi equips students with the skills to defend themselves and the values and qualities necessary for success in life. We can apply these same principles to education in the development cycle.


Wax on, wax off with education from Sonar

Just like it's not enough to practice karate for Mr. Miyagi's teaching style, it's not enough for Sonar to find and fix issues when guiding developers to practice Clean Code. Developers should be able to find, choose to understand, and fix issues to write Clean Code optimally. 


Developers want to grow and build their skills so that they can take on bigger and bigger challenges. However, the realities of security issues, bugs, and deadlines are all competing for that valuable personal growth time. Like Mr. Miyagi, we want to help you tackle your challenges while allowing you to embrace education. We apply Mr. Miyagi's principles to the way that we deliver education in SonarQube Server, SonarQube Cloud, and SonarQube for IDE:


  • Character Development: When an issue occurs, developers can use our "Why is this an issue?" functionality to understand what caused the issue and internalize the guidance quickly.
  • Individualized Instruction: Sonar's education is specific and contextualized based on the issue to help developers reach their full potential.
  • Practical Application: Sonar's education appears when an issue is flagged, and our "How to fix it" functionality provides code samples that suit your coding framework for real-world scenarios.
  • Nurturing and Supportive Environment: Sonar integrates into your workflow and provides the information you need at the right place and time with well-structured rule descriptions.
  • Long-Term Focus: Sonar shows valuable information related to the current issue in a rule's 'More info' section. It's easy to access without getting in the way of fixing the issue quickly.


At Sonar, our goal is to be your Clean Code mentor. We aim to be friendly yet straightforward and trustworthy when helping you understand why your issues occur. We want to help you learn and grow while writing high-quality code.


We're taking a note from Mr. Miyagi's playbook when we say writing Clean Code means more than just brute force and execution. Clean Code is achieved through the skills and strength of the developers writing it. When you can confidently understand issues as you fix them, you grow as an individual contributor and a team member and, as a result, increase your delivery. As delivery improves, your software becomes more valuable. Sonar can help you on your path to becoming a better developer, starting today, while you achieve the best results possible in the process.


Related Blog Posts


Get new blogs delivered directly to your inbox!

Stay up-to-date with the latest Sonar content. Subscribe now to receive the latest blog articles. 

By submitting this form, you agree to the storing and processing of your personal data as described in the Privacy Policy and Cookie Policy. You can withdraw your consent by unsubscribing at any time.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

  • Legal documentation
  • Trust center
  • Follow SonarSource on Twitter
  • Follow SonarSource on Linkedin

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.