SlideShare une entreprise Scribd logo
1  sur  20
What is High-Quality
                      Programming Code?
         Code Correctness, Readability, Maintainability


Svetlin Nakov
Manager Technical Training
http://www.nakov.com
Telerik Software Academy
academy.telerik.com
What is High-Quality
Programming Code?
Why Quality Is Important?
static void Main()
{
  int value=010, i=5, w;
  switch(value){case
10:w=5;Console.WriteLine(w);break;case 9:i=0;break;
          case 8:Console.WriteLine("8 ");break;
     default:Console.WriteLine("def ");{
              Console.WriteLine("hoho "); }
     for (int k = 0; k < i; k++,
Console.WriteLine(k - 'f'));break;} {
Console.WriteLine("loop!"); }
}


What does this code do? Is it correct?
                                                      3
Why Quality Is Important? (2)
 static void Main()
 {
   int value = 010, i = 5, w;
   switch (value)
   {
     case 10: w = 5; Console.WriteLine(w); break;
     case 9: i = 0; break;
     case 8: Console.WriteLine("8 "); break;
     default:
       Console.WriteLine("def ");
       Console.WriteLine("hoho ");
       for (int k = 0; k < i; k++,
        Console.WriteLine(k - 'f')) ;
       break;
     }
     Console.WriteLine("loop!");
 }

Now the code is formatted, but is still unclear.    4
Software Quality
 External quality

   Does the software behave correctly?
   Are the produced results correct?
   Does the software run fast?
   Is the software UI easy-to-use?
 Internal quality

   Is the code easy to read and understand?
   Is the code well structured?
   Is the code easy to modify?
                                                5
What is High-Quality
                        Programming Code?
 High-quality   programming code:
   Easy to read and understand
    Easy to modify and maintain
   Correct behavior in all cases
    Well tested
   Well architectured and designed
   Well documented
    Self-documenting code
   Well formatted
                                               6
What is High-Quality
                       Programming Code? (2)
 High-quality   programming code:
   Strong cohesion at all levels: modules, classes,
    methods, etc.
    Single unit is responsible for single task
   Loose coupling between modules, classes,
    methods, etc.
    Units are independent one of another
   Good formatting
   Good names for classes, methods, variables, etc.
   Self-documenting code style
                                                       7
Code Conventions
   Code conventions are formal guidelines about the
    style of the source code:
     Code formatting conventions
       Indentation, whitespace, etc.
     Naming conventions
       PascalCase or camelCase, prefixes, suffixes, etc.
     Best practices
       Classes, interfaces, enumerations, structures,
        inheritance, exceptions, properties, events,
        constructors, fields, operators, etc.
                                                            8
Code Conventions (2)
   Microsoft has official code conventions called
     Design Guidelines for Developing Class Libraries:
      http://msdn.microsoft.com/en-us/library/ms229042.aspx
 Sun also    have official code conventions called
     Code Conventions for the Java Programming
      Language: http://java.sun.com/docs/codeconv/
 Large organization follow strict       conventions
     Code conventions can vary in different teams
   High-quality code goes beyond code conventions
     Software quality is a way of thinking!
                                                              9
Managing Complexity
   Managing complexity has central role in software
    construction
     Minimize the amount of complexity that anyone’s
      brain has to deal with at certain time
   Architecture and design challenges
     Design modules and classes to reduce complexity
   Code construction challenges
     Apply good software construction practices:
      classes, methods, variables, naming, statements,
      error handling, formatting, comments, etc.
                                                         10
Managing Complexity (2)
 Key to being an effective programmer:

  Maximizing the portion of a program that you
   can safely ignore while working on any one
   section of code
  Most practices discussed later propose ways to
   achieve this important goal




                                                    11
Key Characteristics of
                         High-Quality Code
 Correct behavior

   Conforming to the requirements
   Stable, no hangs, no crashes
   Bug free
   Correct response to incorrect usage
 Easy to read

 Easy to understand

 Maintainable   – easy to modify when required
                                                  12
Key Characteristics of
                       High-Quality Code (2)
 Good identifiers   names
   Good names for variables, constants, methods,
    parameters, classes, structures, fields,
    properties, interfaces, structures,
    enumerations, namespaces,
 High-quality classes, interfaces and class
 hierarchies
   Good abstraction and encapsulation
   Simplicity, reusability, minimal complexity
   Strong cohesion, loose coupling
                                                    13
Key Characteristics of
                         High-Quality Code (3)
 High-quality   methods
   Reduced complexity, improved readability
   Good method names and parameter names
   Strong cohesion, loose coupling
 Variables, data, expressions   and constants
   Minimal variable scope, span, live time
   Simple expressions
   Correctly used constants
   Correctly organized data
                                                  14
Key Characteristics of
                        High-Quality Code (4)
 Correctly used control structures

   Simple statements
   Simple conditional statements and simple
    conditions
   Well organized loops without deep nesting
 Good code formatting

   Reflecting the logical structure of the program
   Good formatting of classes, methods, blocks,
    whitespace, long lines, alignment, etc.
                                                      15
Key Characteristics of
                      High-Quality Code (5)
 High-quality   documentation and comments
   Effective comments
   Self-documenting code
 Defensive programming and exceptions

   Ubiquitous use of defensive programming
   Well organized exception handling
 Code tuning and optimization

   Quality code instead of good performance
   Code performance when required             16
Key Characteristics of
                      High-Quality Code (6)
 Following the corporate code conventions

  Formatting and style, naming, etc.
  Domain-specific best practices
 Well tested and reviewed

  Well designed unit tests
    High code coverage
  High coverage with automated tests
  Passed code reviews and inspections
                                               17
What Is High-Quality
                                                                                                                                 Programming Code?




    курсове и уроци по програмиране, уеб дизайн – безплатно     BG Coder - онлайн състезателна система - online judge
          курсове и уроци по програмиране – Телерик академия    форум програмиране, форум уеб дизайн
               уроци по програмиране и уеб дизайн за ученици    ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET




                                                                                                                                         http://academy.telerik.com
           програмиране за деца – безплатни курсове и уроци     ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC
                безплатен SEO курс - оптимизация за търсачки     алго академия – състезателно програмиране, състезания
курсове и уроци по програмиране, книги – безплатно от Наков     курс мобилни приложения с iPhone, Android, WP7, PhoneGap
       уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop    Дончо Минков - сайт за програмиране
       free C# book, безплатна книга C#, книга Java, книга C#   Николай Костов - блог за програмиране
                    безплатен курс "Качествен програмен код"
       безплатен курс "Разработка на софтуер в cloud среда"     C# курс, програмиране, безплатно
Homework
 Write a short essay(1-2 pages) on the topic:
 "What is a high-quality programming code?"
 Send us a Word file in ".doc" or ".docx" format




                                                   19
Free Trainings @ Telerik Academy
 “High-Quality   Programming Code"
    course @ Telerik Academy
       codecourse.telerik.com
   Telerik Software Academy
       academy.telerik.com
   Telerik Academy @ Facebook
       facebook.com/TelerikAcademy
   Telerik Software Academy Forums
       forums.academy.telerik.com

Contenu connexe

Dernier

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

En vedette

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

En vedette (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

2. what is high quality programming code

  • 1. What is High-Quality Programming Code? Code Correctness, Readability, Maintainability Svetlin Nakov Manager Technical Training http://www.nakov.com Telerik Software Academy academy.telerik.com
  • 3. Why Quality Is Important? static void Main() { int value=010, i=5, w; switch(value){case 10:w=5;Console.WriteLine(w);break;case 9:i=0;break; case 8:Console.WriteLine("8 ");break; default:Console.WriteLine("def ");{ Console.WriteLine("hoho "); } for (int k = 0; k < i; k++, Console.WriteLine(k - 'f'));break;} { Console.WriteLine("loop!"); } } What does this code do? Is it correct? 3
  • 4. Why Quality Is Important? (2) static void Main() { int value = 010, i = 5, w; switch (value) { case 10: w = 5; Console.WriteLine(w); break; case 9: i = 0; break; case 8: Console.WriteLine("8 "); break; default: Console.WriteLine("def "); Console.WriteLine("hoho "); for (int k = 0; k < i; k++, Console.WriteLine(k - 'f')) ; break; } Console.WriteLine("loop!"); } Now the code is formatted, but is still unclear. 4
  • 5. Software Quality  External quality  Does the software behave correctly?  Are the produced results correct?  Does the software run fast?  Is the software UI easy-to-use?  Internal quality  Is the code easy to read and understand?  Is the code well structured?  Is the code easy to modify? 5
  • 6. What is High-Quality Programming Code?  High-quality programming code:  Easy to read and understand  Easy to modify and maintain  Correct behavior in all cases  Well tested  Well architectured and designed  Well documented  Self-documenting code  Well formatted 6
  • 7. What is High-Quality Programming Code? (2)  High-quality programming code:  Strong cohesion at all levels: modules, classes, methods, etc.  Single unit is responsible for single task  Loose coupling between modules, classes, methods, etc.  Units are independent one of another  Good formatting  Good names for classes, methods, variables, etc.  Self-documenting code style 7
  • 8. Code Conventions  Code conventions are formal guidelines about the style of the source code:  Code formatting conventions  Indentation, whitespace, etc.  Naming conventions  PascalCase or camelCase, prefixes, suffixes, etc.  Best practices  Classes, interfaces, enumerations, structures, inheritance, exceptions, properties, events, constructors, fields, operators, etc. 8
  • 9. Code Conventions (2)  Microsoft has official code conventions called  Design Guidelines for Developing Class Libraries: http://msdn.microsoft.com/en-us/library/ms229042.aspx  Sun also have official code conventions called  Code Conventions for the Java Programming Language: http://java.sun.com/docs/codeconv/  Large organization follow strict conventions  Code conventions can vary in different teams  High-quality code goes beyond code conventions  Software quality is a way of thinking! 9
  • 10. Managing Complexity  Managing complexity has central role in software construction  Minimize the amount of complexity that anyone’s brain has to deal with at certain time  Architecture and design challenges  Design modules and classes to reduce complexity  Code construction challenges  Apply good software construction practices: classes, methods, variables, naming, statements, error handling, formatting, comments, etc. 10
  • 11. Managing Complexity (2)  Key to being an effective programmer:  Maximizing the portion of a program that you can safely ignore while working on any one section of code  Most practices discussed later propose ways to achieve this important goal 11
  • 12. Key Characteristics of High-Quality Code  Correct behavior  Conforming to the requirements  Stable, no hangs, no crashes  Bug free  Correct response to incorrect usage  Easy to read  Easy to understand  Maintainable – easy to modify when required 12
  • 13. Key Characteristics of High-Quality Code (2)  Good identifiers names  Good names for variables, constants, methods, parameters, classes, structures, fields, properties, interfaces, structures, enumerations, namespaces,  High-quality classes, interfaces and class hierarchies  Good abstraction and encapsulation  Simplicity, reusability, minimal complexity  Strong cohesion, loose coupling 13
  • 14. Key Characteristics of High-Quality Code (3)  High-quality methods  Reduced complexity, improved readability  Good method names and parameter names  Strong cohesion, loose coupling  Variables, data, expressions and constants  Minimal variable scope, span, live time  Simple expressions  Correctly used constants  Correctly organized data 14
  • 15. Key Characteristics of High-Quality Code (4)  Correctly used control structures  Simple statements  Simple conditional statements and simple conditions  Well organized loops without deep nesting  Good code formatting  Reflecting the logical structure of the program  Good formatting of classes, methods, blocks, whitespace, long lines, alignment, etc. 15
  • 16. Key Characteristics of High-Quality Code (5)  High-quality documentation and comments  Effective comments  Self-documenting code  Defensive programming and exceptions  Ubiquitous use of defensive programming  Well organized exception handling  Code tuning and optimization  Quality code instead of good performance  Code performance when required 16
  • 17. Key Characteristics of High-Quality Code (6)  Following the corporate code conventions  Formatting and style, naming, etc.  Domain-specific best practices  Well tested and reviewed  Well designed unit tests  High code coverage  High coverage with automated tests  Passed code reviews and inspections 17
  • 18. What Is High-Quality Programming Code? курсове и уроци по програмиране, уеб дизайн – безплатно BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране – Телерик академия форум програмиране, форум уеб дизайн уроци по програмиране и уеб дизайн за ученици ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NET http://academy.telerik.com програмиране за деца – безплатни курсове и уроци ASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC безплатен SEO курс - оптимизация за търсачки алго академия – състезателно програмиране, състезания курсове и уроци по програмиране, книги – безплатно от Наков курс мобилни приложения с iPhone, Android, WP7, PhoneGap уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop Дончо Минков - сайт за програмиране free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране безплатен курс "Качествен програмен код" безплатен курс "Разработка на софтуер в cloud среда" C# курс, програмиране, безплатно
  • 19. Homework  Write a short essay(1-2 pages) on the topic: "What is a high-quality programming code?" Send us a Word file in ".doc" or ".docx" format 19
  • 20. Free Trainings @ Telerik Academy  “High-Quality Programming Code" course @ Telerik Academy  codecourse.telerik.com  Telerik Software Academy  academy.telerik.com  Telerik Academy @ Facebook  facebook.com/TelerikAcademy  Telerik Software Academy Forums  forums.academy.telerik.com