SlideShare una empresa de Scribd logo
1 de 39
The Taming of the Code Alan Stevens A tale of the first principles of software development presented in three acts
Who is Alan Stevens? Microsoft Most Valuable Professional ASP Insider Occasional Blogger http://netcave.org Senior Software Developer 	Interactive Intelligence Incorporated An Enthusiast NOT an expert!
PLAYBILL Act I: The Goal Act II: The Guidelines Act III: The Practice
Let’s Talk About Code
Act I: The Goal
The rest of a developer's career is spent pursuing better and better answers to the question "where should this code go?" Jeremy Miller “On Writing Maintainable Code” http://codebetter.com/blogs/jeremy.miller/archive/2006/12/06/On-Writing-Maintainable-Code.aspx
Once you get your systems to work, you still have to go back and clean up the wreckage left behind by the victorious battle. You are not done until the victorious code has been cleaned, polished, and oiled. “Uncle” Bob Martin “The Rush” http://blog.objectmentor.com/articles/2009/06/26/the-rush
How do we balance building the right thingwith building it well?
Building the right thing is always a higher priority!
I'm never in favor of writing code poorly, but I am in favor of writing code to reflect your current understanding of a problem even if that understanding is partial. Ward Cunningham “Ward Explains Debt Metaphor” http://c2.com/cgi/wiki?WardExplainsDebtMetaphor
Building it right has a minimum acceptable thresholdwhich must be met
Do the simplest thing that could possibly work
Enable Change
Build Architectural Seams
At least build fault lines
Manage Debt
Manage Technical Debt
I thought that rushing software out the door to get some experience with it was a good idea, but that of course, you would eventually go back and as you learned things about that software you would repay that loan by refactoring the program to reflect your experience as you acquired it. Ward Cunningham “Ward Explains Debt Metaphor” http://c2.com/cgi/wiki?WardExplainsDebtMetaphor
By the same token, if you develop a program for a long period of time by only adding features and never reorganizing it to reflect your understanding of those features, then eventually that program simply does not contain any understanding and all efforts to work on it take longer and longer. In other words, the interest is total -- you'll make zero progress.
You know, if you want to be able to go into debt that way by developing software that you don't completely understand, you are wise to make that software reflect your understanding as best as you can, so that when it does come time to refactor, it's clear what you were thinking when you wrote it, making it easier to refactor it into what your current thinking is now.
Enable The *ILITIES Coined by KevlinHenney Agility Testability Readability Reversibility Changeability Flexibility Maintainability
Act II: The Guidelines
Don’t Repeat Yourself&Separation of Concerns
DRY Don’t Repeat Yourself
The Rule of Three See it once: do it See it twice: notice it See it a third time: abstract it!
Separation of Concerns
Separation Of Concerns Break the system into distinct, cohesive modules that don’t overlap in responsibilities Examples: MVC, MVP, MVVM etc. UI, Service, DAL HTML, CSS, JavaScript
Cohesion The degree to which the responsibilities within a given class are strongly related Highly cohesive code is: More readable and easier to understand Easier to manage, maintain, and test More likely to be reused Less complex
protected void btnSubmit_click(object sender, EventArgs e) {     if ( this.IsValid(this.txtUserName.Text, this.txtPassword.Text) )      { // do stuff here } } private boolIsValid(string userName, string password) { boolisValid = false;     using ( SqlConnectionconn = new SqlConnection(_connString) )     {         using ( SqlCommandcmd = conn.CreateCommand() )         {             // query on User Name and Password isValid = cmd.ExecuteScalar();         }    }    return isValid; }
SOLID Principles Single Responsibility Principle Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle
The Single Responsibility Principle  A class should have one, and only one, reason to change. Granularity Have many small classes that are easy to understand
The Open Closed Principle You should be able to extend a classes behavior, without modifying it. Sealed classes are evil! Make classes virtual by default.
The Liskov Substitution Principle  Derived classes must be substitutable for their base classes. Preserve polymorphism.
The Interface Segregation Principle  Clients should not be forced to depend on interfaces that they do not use. No God objects!
The Dependency Inversion Principle  Depend on abstractions, not on concretions. User interfaces and/or abstract base classes
Act III: The Practice
How do we guarantee baseline design without impeding productivity?

Más contenido relacionado

Similar a The Taming Of The Code

2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and WebMarco Parenzan
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortalscgack
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernizationdevObjective
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the informationToushik Paul
 
WordCamp Nashville: Clean Code for WordPress
WordCamp Nashville: Clean Code for WordPressWordCamp Nashville: Clean Code for WordPress
WordCamp Nashville: Clean Code for WordPressmtoppa
 
Top 5 performance problems in .net applications application performance mon...
Top 5 performance problems in .net applications   application performance mon...Top 5 performance problems in .net applications   application performance mon...
Top 5 performance problems in .net applications application performance mon...KennaaTol
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellPVS-Studio
 
The Rest of the Best
The Rest of the BestThe Rest of the Best
The Rest of the BestKevlin Henney
 
5a329780735625624 ch10
5a329780735625624 ch105a329780735625624 ch10
5a329780735625624 ch10harkesh singh
 
Lublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design PatternsLublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design PatternsKarol Szmaj
 
Lessons Learned in a Continuously Developing Service-Oriented Architecture
Lessons Learned in a Continuously Developing Service-Oriented ArchitectureLessons Learned in a Continuously Developing Service-Oriented Architecture
Lessons Learned in a Continuously Developing Service-Oriented Architecturemdwheele
 
learn mvc project in 7 day
learn mvc project in 7 daylearn mvc project in 7 day
learn mvc project in 7 dayQuach Long
 
A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRBình Trọng Án
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsSteven Smith
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonifiedChristian Heilmann
 
The Testing Planet Issue 2
The Testing Planet Issue 2The Testing Planet Issue 2
The Testing Planet Issue 2Rosie Sherry
 

Similar a The Taming Of The Code (20)

2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the information
 
WordCamp Nashville: Clean Code for WordPress
WordCamp Nashville: Clean Code for WordPressWordCamp Nashville: Clean Code for WordPress
WordCamp Nashville: Clean Code for WordPress
 
Top 5 performance problems in .net applications application performance mon...
Top 5 performance problems in .net applications   application performance mon...Top 5 performance problems in .net applications   application performance mon...
Top 5 performance problems in .net applications application performance mon...
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShell
 
The Rest of the Best
The Rest of the BestThe Rest of the Best
The Rest of the Best
 
5a329780735625624 ch10
5a329780735625624 ch105a329780735625624 ch10
5a329780735625624 ch10
 
Lublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design PatternsLublin Startup Festival - Mobile Architecture Design Patterns
Lublin Startup Festival - Mobile Architecture Design Patterns
 
Lessons Learned in a Continuously Developing Service-Oriented Architecture
Lessons Learned in a Continuously Developing Service-Oriented ArchitectureLessons Learned in a Continuously Developing Service-Oriented Architecture
Lessons Learned in a Continuously Developing Service-Oriented Architecture
 
learn mvc project in 7 day
learn mvc project in 7 daylearn mvc project in 7 day
learn mvc project in 7 day
 
A Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatRA Developer's Guide to CQRS Using .NET Core and MediatR
A Developer's Guide to CQRS Using .NET Core and MediatR
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonified
 
The Testing Planet Issue 2
The Testing Planet Issue 2The Testing Planet Issue 2
The Testing Planet Issue 2
 

Más de Alan Stevens

My Prayer As I Leave You
My Prayer As I Leave YouMy Prayer As I Leave You
My Prayer As I Leave YouAlan Stevens
 
Making a Difference
Making a DifferenceMaking a Difference
Making a DifferenceAlan Stevens
 
Beyond Fast Good and Cheap
Beyond Fast Good and CheapBeyond Fast Good and Cheap
Beyond Fast Good and CheapAlan Stevens
 
You Are Not a Craftsman
You Are Not a CraftsmanYou Are Not a Craftsman
You Are Not a CraftsmanAlan Stevens
 
Better Is the Only Way Forward
Better Is the Only Way ForwardBetter Is the Only Way Forward
Better Is the Only Way ForwardAlan Stevens
 
Distributed Version Control Systems: A Guide For The Perplexed
Distributed Version Control Systems: A Guide For The PerplexedDistributed Version Control Systems: A Guide For The Perplexed
Distributed Version Control Systems: A Guide For The PerplexedAlan Stevens
 
Seven Lessons in Personal Marketing I Learned From Pickup Artists
Seven Lessons in Personal Marketing I Learned From Pickup ArtistsSeven Lessons in Personal Marketing I Learned From Pickup Artists
Seven Lessons in Personal Marketing I Learned From Pickup ArtistsAlan Stevens
 
Does Your Code Tell A Story
Does  Your  Code  Tell  A  StoryDoes  Your  Code  Tell  A  Story
Does Your Code Tell A StoryAlan Stevens
 

Más de Alan Stevens (11)

My Prayer As I Leave You
My Prayer As I Leave YouMy Prayer As I Leave You
My Prayer As I Leave You
 
My Creed
My CreedMy Creed
My Creed
 
Leveling Up
Leveling UpLeveling Up
Leveling Up
 
Making a Difference
Making a DifferenceMaking a Difference
Making a Difference
 
Beyond Fast Good and Cheap
Beyond Fast Good and CheapBeyond Fast Good and Cheap
Beyond Fast Good and Cheap
 
You Are Not a Craftsman
You Are Not a CraftsmanYou Are Not a Craftsman
You Are Not a Craftsman
 
Better Is the Only Way Forward
Better Is the Only Way ForwardBetter Is the Only Way Forward
Better Is the Only Way Forward
 
Distributed Version Control Systems: A Guide For The Perplexed
Distributed Version Control Systems: A Guide For The PerplexedDistributed Version Control Systems: A Guide For The Perplexed
Distributed Version Control Systems: A Guide For The Perplexed
 
Seven Lessons in Personal Marketing I Learned From Pickup Artists
Seven Lessons in Personal Marketing I Learned From Pickup ArtistsSeven Lessons in Personal Marketing I Learned From Pickup Artists
Seven Lessons in Personal Marketing I Learned From Pickup Artists
 
Does Your Code Tell A Story
Does  Your  Code  Tell  A  StoryDoes  Your  Code  Tell  A  Story
Does Your Code Tell A Story
 
Coding In Public
Coding In PublicCoding In Public
Coding In Public
 

Último

[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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 

Último (20)

[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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
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...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 

The Taming Of The Code

  • 1. The Taming of the Code Alan Stevens A tale of the first principles of software development presented in three acts
  • 2. Who is Alan Stevens? Microsoft Most Valuable Professional ASP Insider Occasional Blogger http://netcave.org Senior Software Developer Interactive Intelligence Incorporated An Enthusiast NOT an expert!
  • 3. PLAYBILL Act I: The Goal Act II: The Guidelines Act III: The Practice
  • 5. Act I: The Goal
  • 6. The rest of a developer's career is spent pursuing better and better answers to the question "where should this code go?" Jeremy Miller “On Writing Maintainable Code” http://codebetter.com/blogs/jeremy.miller/archive/2006/12/06/On-Writing-Maintainable-Code.aspx
  • 7. Once you get your systems to work, you still have to go back and clean up the wreckage left behind by the victorious battle. You are not done until the victorious code has been cleaned, polished, and oiled. “Uncle” Bob Martin “The Rush” http://blog.objectmentor.com/articles/2009/06/26/the-rush
  • 8. How do we balance building the right thingwith building it well?
  • 9. Building the right thing is always a higher priority!
  • 10. I'm never in favor of writing code poorly, but I am in favor of writing code to reflect your current understanding of a problem even if that understanding is partial. Ward Cunningham “Ward Explains Debt Metaphor” http://c2.com/cgi/wiki?WardExplainsDebtMetaphor
  • 11. Building it right has a minimum acceptable thresholdwhich must be met
  • 12. Do the simplest thing that could possibly work
  • 15. At least build fault lines
  • 18. I thought that rushing software out the door to get some experience with it was a good idea, but that of course, you would eventually go back and as you learned things about that software you would repay that loan by refactoring the program to reflect your experience as you acquired it. Ward Cunningham “Ward Explains Debt Metaphor” http://c2.com/cgi/wiki?WardExplainsDebtMetaphor
  • 19. By the same token, if you develop a program for a long period of time by only adding features and never reorganizing it to reflect your understanding of those features, then eventually that program simply does not contain any understanding and all efforts to work on it take longer and longer. In other words, the interest is total -- you'll make zero progress.
  • 20. You know, if you want to be able to go into debt that way by developing software that you don't completely understand, you are wise to make that software reflect your understanding as best as you can, so that when it does come time to refactor, it's clear what you were thinking when you wrote it, making it easier to refactor it into what your current thinking is now.
  • 21. Enable The *ILITIES Coined by KevlinHenney Agility Testability Readability Reversibility Changeability Flexibility Maintainability
  • 22. Act II: The Guidelines
  • 24. DRY Don’t Repeat Yourself
  • 25. The Rule of Three See it once: do it See it twice: notice it See it a third time: abstract it!
  • 27.
  • 28.
  • 29. Separation Of Concerns Break the system into distinct, cohesive modules that don’t overlap in responsibilities Examples: MVC, MVP, MVVM etc. UI, Service, DAL HTML, CSS, JavaScript
  • 30. Cohesion The degree to which the responsibilities within a given class are strongly related Highly cohesive code is: More readable and easier to understand Easier to manage, maintain, and test More likely to be reused Less complex
  • 31. protected void btnSubmit_click(object sender, EventArgs e) { if ( this.IsValid(this.txtUserName.Text, this.txtPassword.Text) ) { // do stuff here } } private boolIsValid(string userName, string password) { boolisValid = false; using ( SqlConnectionconn = new SqlConnection(_connString) ) { using ( SqlCommandcmd = conn.CreateCommand() ) { // query on User Name and Password isValid = cmd.ExecuteScalar(); } } return isValid; }
  • 32. SOLID Principles Single Responsibility Principle Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle
  • 33. The Single Responsibility Principle A class should have one, and only one, reason to change. Granularity Have many small classes that are easy to understand
  • 34. The Open Closed Principle You should be able to extend a classes behavior, without modifying it. Sealed classes are evil! Make classes virtual by default.
  • 35. The Liskov Substitution Principle Derived classes must be substitutable for their base classes. Preserve polymorphism.
  • 36. The Interface Segregation Principle Clients should not be forced to depend on interfaces that they do not use. No God objects!
  • 37. The Dependency Inversion Principle Depend on abstractions, not on concretions. User interfaces and/or abstract base classes
  • 38. Act III: The Practice
  • 39. How do we guarantee baseline design without impeding productivity?
  • 40. Can we verify that we are building the right thing?
  • 41. The tests specify requirements in a way that does not require human interpretation to indicate success or failure. Jim Newkirk Test Driven Development in Microsoft .NET
  • 44. When you finally realize what your program is doing, you have to go back and make it look like you knew that all along. Make it look like it was easy to write this program, even if it wasn’t. Ward Cunningham “Mastering the Craft of Programming” http://railslab.newrelic.com/2009/09/15/ward-cunningham-aboutus-org
  • 45. Prevention is the best cure
  • 47. As applications mature, they should become more maintainable, not less.
  • 48. “With every mistake, I must surely be learning” George Harrison
  • 50. Thanks For Listening! Email/IM: alanstevens@gmail.com Blog: http://netcave.org Twitter: @alanstevens

Notas del editor

  1. The Taming of the Code:A tale of the first principles of software development presented in three actsHow do we balance building the right thingwith building it well? In this presentation we will examine this question at three levels of focus looking at I The Goal, II The Guidlines and III The Practice. This will be an interactive discussion of the values, compromises and practices of successful software development.
  2. Drafts when writing
  3. Enable isolationFault lines
  4. SRP The Single Responsibility Principle A class should have one, and only one, reason to change.OCP The Open Closed Principle You should be able to extend a classes behavior, without modifying it.LSP The Liskov Substitution Principle Derived classes must be substitutable for their base classes.ISP The Interface Segregation Principle Clients should not be forced to depend on interfaces that they do not use.DIP The Dependency Inversion Principle Depend on abstractions, not on concretions.