Developer Best Practices - The secret sauce for coding modern software
-
Upload
kosala-nuwan-perera -
Category
Software
-
view
567 -
download
0
Transcript of Developer Best Practices - The secret sauce for coding modern software
![Page 1: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/1.jpg)
Develop Best PracticesThe secret sauce for coding modern software
Kosala Nuwan Perera@kosalanuwan
![Page 2: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/2.jpg)
Peter Falk told to Paul Reiser…
get some paperput it in a typewritertype FADE IN ... and keep typing.
![Page 3: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/3.jpg)
Problem, solution, and solve…
Biggest mistake of all time is jump straight to “Solve”.
![Page 4: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/4.jpg)
People really don’t get this!
Every feature is a commitment, a financial debt, even if its not used.
![Page 5: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/5.jpg)
Did you know that you arewoefully stuck in the Appland?Well, now you know
![Page 6: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/6.jpg)
Things that teams literally struggle- More granular tracing and auditing- User telemetry- Support for flexible DevOps- Modularization- Hybrid could opportunities- End-to-end message security- Powerful API for Public and Private- Asynchronous UX- Support for Multiplicity of clients- More efficient background processing
![Page 7: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/7.jpg)
Things that teams literally struggle- More granular tracing and auditing- User telemetry- Support for flexible DevOps- Modularization- Hybrid could opportunities- End-to-end message security- Powerful API for Public and Private- Asynchronous UX- Support for Multiplicity of clients- More efficient background processing
![Page 8: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/8.jpg)
Things that teams literally struggle- More granular tracing and auditing- User telemetry- Support for flexible DevOps- Modularization- Hybrid could opportunities- End-to-end message security- Powerful API for Public and Private- Asynchronous UX- Support for Multiplicity of clients- More efficient background processing
![Page 9: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/9.jpg)
A computer program is the most complicated thing on
earth, second to a woman's brain. I just told this and she second it
![Page 10: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/10.jpg)
How do you make things so complicated? - Rigid Small change causing cascade changes.
- Fragile Breaks in many places due to a single change.
- Immobility Cannot reuse in other projects due to risks/high efforts.
- Design debt Technical debt by taking shortcuts?
- Environment debt Technical debt by not running build, test, and other tasks.
- Needless complexity- Needless repetition- Opacity Cannot/hard to understand. Requires reengineering.
![Page 11: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/11.jpg)
How do you make things so complicated? - Rigid Small change causing cascade changes.
- Fragile Breaks in many places due to a single change.
- Immobility Cannot reuse in other projects due to risks/high efforts.
- Design debt Technical debt by taking shortcuts?
- Environment debt Technical debt by not running build, test, and other tasks.
- Needless complexity- Needless repetition- Opacity Cannot/hard to understand. Requires reengineering.
![Page 12: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/12.jpg)
How do you make things so complicated? - Rigid Small change causing cascade changes.
- Fragile Breaks in many places due to a single change.
- Immobility Cannot reuse in other projects due to risks/high efforts.
- Design debt Technical debt by taking shortcuts?
- Environment debt Technical debt by not running build, test, and other tasks.
- Needless complexity- Needless repetition- Opacity Cannot/hard to understand. Requires reengineering.
![Page 13: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/13.jpg)
How do you make things so complicated? - Rigid Small change causing cascade changes.
- Fragile Breaks in many places due to a single change.
- Immobility Cannot reuse in other projects due to risks/high efforts.
- Design debt Technical debt by taking shortcuts?
- Environment debt Technical debt by not running build, test, and other tasks.
- Needless complexity- Needless repetition- Opacity Cannot/hard to understand. Requires reengineering.
![Page 14: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/14.jpg)
Why would you care? - Respond to change- Cost of change- Financial debt
![Page 15: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/15.jpg)
You have a limited number ofkeystrokes left in your hands before you “die”.
![Page 16: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/16.jpg)
What can you try Today? - Naming conventions- Methods- Design principles- Dependency injection- Encapsulate conditionals- Polymorphism to If/Else or
Switch/Case- Exception over return codes
![Page 17: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/17.jpg)
Read more at Crockford's guidelines for JavaScript and Google guidelines for JavaScript
Convention ExampleApp Root PascalCase ApprovelyFiles camelCased autoComplete.controller.j
sConstructors PascalCase WebRequestNamespaces camelCased but it’s unusual to
have two parts in one word though
Approvely.widgets
Functions camelCased toStringNon-constant variables including params
camelCased
Constants but ES5 has no constants
Capitalized or PascalCase CLICK_EVENT, Events.Click
Enums but ES5 has no enums
Capitalized or PascalCase. Singular for non-flags and plural for flags
HTTP_STATUS_CODE, HttpStatusCode, BindingFlags
![Page 18: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/18.jpg)
What can you try Today? - Naming conventions- Methods- Design principles- Dependency injection- Encapsulate conditionals- Polymorphism to If/Else or
Switch/Case- Exception over return codes
![Page 19: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/19.jpg)
What can you try Today? - Naming conventions- Methods- Design principles- Dependency injection- Encapsulate conditionals- Polymorphism to If/Else or
Switch/Case- Exception over return codes
![Page 20: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/20.jpg)
class Sword{ public void Hit(string target) { ... }}
class Samurai{ private Sword sword; public Samurai() { sword = new Sword(); } public void Attack(string target) { sword.Hit(target); }}
Usage:Samurai warrior = new Samurai();warrior.Attack("the evildoers");
![Page 21: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/21.jpg)
interface IWeapon{ void Hit(string target);}
class Sword : IWeapon{ public void Hit(string target) { ... }}
class Shuriken : IWeapon{ public void Hit(string target) { ... }}
class Samurai{ public Samurai(IWeapon w) { ... } public void Attack(string target) { ... }}
Usage:Shuriken weap1 = new Shuriken();Samurai warrior1 = new Samurai(weap1);warrior1.Attack("the evildoers");
Sword weap2 = new Sword();Samurai warrior2 = new Samurai(weap2);warrior2.Attack("the evildoers");
![Page 22: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/22.jpg)
What can you try Today? - Naming conventions- Methods- Design principles- Dependency injection- Encapsulate conditionals- Polymorphism to If/Else or
Switch/Case- Exception over return codes
![Page 23: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/23.jpg)
if (navigator.appName == "Microsoft Internet Explorer") { var flag = true; $(".js-right-arrow").click(function () { if (flag) { $(".js-slider-frame").animate({ left: "-130px" }, 1000); flag = false; } else { $(".js-slider-frame").animate({ left: "236px" }, 1000); flag = true; } return false; });} else { var flag = true; $(".js-right-arrow").click(function () { if (flag) { move(".js-slider-frame").set("left", -130).duration("1s").end(); flag = false; } else { move(".js-slider-frame").set("left", 236).duration("1s").end(); flag = true; } return false; });}
![Page 24: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/24.jpg)
if (navigator.appName == "Microsoft Internet Explorer") { var flag = true; $(".js-right-arrow").click(function () { if (flag) { $(".js-slider-frame").animate({ left: "-130px" }, 1000); flag = false; } else { $(".js-slider-frame").animate({ left: "236px" }, 1000); flag = true; } return false; });} else { var flag = true; $(".js-right-arrow").click(function () { if (flag) { move(".js-slider-frame").set("left", -130).duration("1s").end(); flag = false; } else { move(".js-slider-frame").set("left", 236).duration("1s").end(); flag = true; } return false; });}
![Page 25: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/25.jpg)
if (navigator.appName == "Microsoft Internet Explorer") { var flag = true; $(".js-right-arrow").click(function () { if (flag) { $(".js-slider-frame").animate({ left: "-130px" }, 1000); flag = false; } else { $(".js-slider-frame").animate({ left: "236px" }, 1000); flag = true; } return false; });} else { var flag = true; $(".js-right-arrow").click(function () { if (flag) { move(".js-slider-frame").set("left", -130).duration("1s").end(); flag = false; } else { move(".js-slider-frame").set("left", 236).duration("1s").end(); flag = true; } return false; });}
![Page 26: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/26.jpg)
var flag = true, isIE = navigator.appName == "Microsoft Internet Explorer";
$(".js-right-arrow").click(function () { if (isIE) { $(".js-slider-frame").animate({ left: flag ? "-130px" : "236px" }, 1000); } else { move(".js-slider-frame").set("left", flag ? -130 : 236).duration("1s"); } flag = !flag; return false;});
![Page 27: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/27.jpg)
What can you try Today? - Naming conventions- Methods- Design principles- Dependency injection- Encapsulate conditionals- Polymorphism to If/Else or
Switch/Case- Exception over return codes
![Page 28: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/28.jpg)
When you are matured with these
principles and patterns, it will become difficult for you to think without those.
![Page 29: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/29.jpg)
Where to begin?- Good Editor- Static analysis tools- Builds- Test automation tools- Source control- Continuous integration
![Page 30: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/30.jpg)
What other things that go with it? - Open source- Code kata- Pair programming- Design/Code reviews- Peer reviews
![Page 31: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/31.jpg)
![Page 32: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/32.jpg)
I swear to write software, more useful software and nothing but well-crafted
softwareso help me God!
- The Software Craftsmanship Oath
![Page 33: Developer Best Practices - The secret sauce for coding modern software](https://reader036.fdocuments.in/reader036/viewer/2022070523/58ecb0521a28ab1a418b4687/html5/thumbnails/33.jpg)
Happy Coding
Kosala Nuwan Perera@kosalanuwan