SlideShare a Scribd company logo
1 of 27
Basic Software
Engineering
Principles
(Session 2)
By Lahiru Wijewardana
What is Software Engineering?
How Engineer solves a problem
● Understand the requirement
● Plan a solution
● Carry out that plan
● Examine your results for accuracy
Solve problems fully BEFORE diving into the
implementation of your solution
Thinking About the Process
1. Have a clear vision for the project
2. Have a rigorous process
3. Develop applications rapidly
4. Make it WORK first, then work RIGHT, THEN look
pretty
Thinking About (Coding) the Solution
1. YAGNI (You Ain't Gonna Need It!)
2. DRY (Don't Repeat Yourself)
3. Embrace abstraction
4. DRITW (Don't Reinvent The Wheel)
5. Write code that does one thing well
6. Debugging is harder than writing code
7. Kaizen (leave it better than when you found it)
S.O.L.I.D Principles
What is S.O.L.I.D?
● [S]ingle Responsibility Principle
● [O]pen/Closed Principle
● [L]iskov Substitution Principle
● [I]nterface Segregation Principle
● [D]ependency Inversion Principle
Single Responsibility Principle
“A class should have one, and only one, reason to change”
Open/Closed Principle
“You should be able to extend a classes behavior, without
modifying it”
In other words: Software entities (classes, modules,
functions, etc.) must be opened for an extension, but
closed for modification
Liskov Substitution Principle
“Derived classes must be substitutable for their base
classes”
Interface Segregation Principle
“Make fine grained interfaces that are client specific”
In other words: Many specific interfaces are better
than a general interface
Dependency Inversion Principle
“Depend on abstractions, not on concretions”
Definition of this principle into two sub-items:
● High-level modules should not depend on low-
level modules. Both should depend on
abstractions.
● Abstractions should not depend on details. Details
should depend on abstractions.
Code Duplications
Basic Types of Duplications
1. Data
2. Type
3. Algorithm
These duplications happen unintentionally or because
we don’t know how to prevent or get rid of it.
We can prevent unintentional duplications by simply
rechecking what we did.
Data Duplication
Most basic and common type of duplication. Easily
recognizable.
Type Duplication
In many cases where the difference between two
methods is only the type in which they operate on.
Algorithm Duplication
Most difficult one and can not easily done without an
understanding of the program.
Steps to Eliminate Duplicates
Nothing new …. all these steps can be found in earlier points.
1. Single responsibility principle (First principle in SOLID)
2. DRY (Don’t Repeat yourself)
3. DRITW (Don’t Reinvent The Wheel)
4. Make it WORK first, then work RIGHT, THEN look pretty
Naming Conventions
Why Naming Conventions?
To maintain,
● Readability
● Understandability
● Maintainability
Each organization has its own syntax specific standards
Mobisec Best Practices
● Variable naming
● Function Naming
● Programming Standards
Variable naming
● Variable names should be meaningful and pronounceable.
For example appcnt Vs appCounter.
● Specific words should not be used like equals, compare, data.
● Don't use same variable for different purposes in a method.
● Don't use _ to declare a variable name, Use camel casing. For
example, employeeName is better than employee_name
Function naming
● Function names should be meaningful and pronounceable.
● Avoid pointless function names. For example myFunc(),
procedure().
● Don’t say one thing and do another.
● Function names should have a verb.
Programming Standards
● Use Camel Case (aka Upper Camel Case) for classes:
VelocityResponseWriter
● Use Lower Case for packages: com.company.project.ui
● Use Mixed Case (aka Lower Camel Case) for variables:
studentName
● Use Upper Case for constants : MAX_PARAMETER_COUNT = 100
● Use Camel Case for enum class names and Upper Case for enum
values.
● Don't use '_' anywhere except constants and enum values (which are
constants).
Questions….?
Reference
● https://www.vikingcodeschool.com/software-engineering-basics/basic-
principles-of-software-engineering
● https://mari-azevedo.medium.com/s-o-l-i-d-principles-what-are-they-and-
why-projects-should-use-them-50b85e4aa8b6
● https://itnext.io/solid-principles-explanation-and-examples-715b975dcad4
● https://dev.to/danialmalik/a-beginner-s-guide-to-clean-code-part1-naming-
conventions-139l
● https://medium.com/swlh/javascript-best-practices-variable-naming-
conventions-ea121ca389c5
● https://medium.com/wix-engineering/naming-convention-8-basic-rules-for-
any-piece-of-code-c4c5f65b0c09
● https://dzone.com/articles/best-practices-variable-and
● https://simpleprogrammer.com/types-of-duplication-in-code/
Thank You…..

More Related Content

What's hot

Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Hernan Wilkinson
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentJosh Candish
 
Basics of writing clean code
Basics of writing clean codeBasics of writing clean code
Basics of writing clean codeKnoldus Inc.
 
Lập trình hướng kiểm thử - Test Driven development
Lập trình hướng kiểm thử - Test Driven developmentLập trình hướng kiểm thử - Test Driven development
Lập trình hướng kiểm thử - Test Driven developmentAnh Lê
 
Lessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialLessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialAlan Richardson
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit TestingEyal Kenig
 
The Agile Tester’s Mindset
The Agile Tester’s MindsetThe Agile Tester’s Mindset
The Agile Tester’s MindsetTechWell
 
recapitulando: de métodos ágeis até lean startup
recapitulando: de métodos ágeis até lean startuprecapitulando: de métodos ágeis até lean startup
recapitulando: de métodos ágeis até lean startupPedro Axelrud
 
Lecture 7 program development issues (supplementary)
Lecture 7  program development issues (supplementary)Lecture 7  program development issues (supplementary)
Lecture 7 program development issues (supplementary)alvin567
 
Test Aided Development - A gateway drug to TDD
Test Aided Development - A gateway drug to TDDTest Aided Development - A gateway drug to TDD
Test Aided Development - A gateway drug to TDDÁdám Turcsán
 

What's hot (15)

TDD & Refactoring
TDD & RefactoringTDD & Refactoring
TDD & Refactoring
 
Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Basics of writing clean code
Basics of writing clean codeBasics of writing clean code
Basics of writing clean code
 
Lập trình hướng kiểm thử - Test Driven development
Lập trình hướng kiểm thử - Test Driven developmentLập trình hướng kiểm thử - Test Driven development
Lập trình hướng kiểm thử - Test Driven development
 
Lessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialLessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorial
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 
The Agile Tester’s Mindset
The Agile Tester’s MindsetThe Agile Tester’s Mindset
The Agile Tester’s Mindset
 
recapitulando: de métodos ágeis até lean startup
recapitulando: de métodos ágeis até lean startuprecapitulando: de métodos ágeis até lean startup
recapitulando: de métodos ágeis até lean startup
 
Clean code
Clean codeClean code
Clean code
 
Lecture 7 program development issues (supplementary)
Lecture 7  program development issues (supplementary)Lecture 7  program development issues (supplementary)
Lecture 7 program development issues (supplementary)
 
Make a better with clean code
Make a better with clean codeMake a better with clean code
Make a better with clean code
 
Test Aided Development - A gateway drug to TDD
Test Aided Development - A gateway drug to TDDTest Aided Development - A gateway drug to TDD
Test Aided Development - A gateway drug to TDD
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 

Similar to Basic software engineering principles with code examples - Session 2

Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patternsPrabhakar Sharma
 
Ood and solid principles
Ood and solid principlesOod and solid principles
Ood and solid principlesAvinash Kadam
 
There Is No Easy Button
There Is No Easy ButtonThere Is No Easy Button
There Is No Easy ButtonChad Udell
 
The OO Design Principles
The OO Design PrinciplesThe OO Design Principles
The OO Design PrinciplesSteve Zhang
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD introVitaliy Kulikov
 
1. oop with c++ get 410 day 1
1. oop with c++ get 410   day 11. oop with c++ get 410   day 1
1. oop with c++ get 410 day 1Mukul kumar Neal
 
Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better SoftwareHean Hong Leong
 
Clean Code - Part 2
Clean Code - Part 2Clean Code - Part 2
Clean Code - Part 2Knoldus Inc.
 
Software Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit DeySoftware Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit DeyCefalo
 
How to get your app or site built
How to get your app or site builtHow to get your app or site built
How to get your app or site builtJoe Chin
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019Paulo Clavijo
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software DesignGiorgio Zoppi
 
Software Engineering Primer
Software Engineering PrimerSoftware Engineering Primer
Software Engineering PrimerGeorg Buske
 
Working effectively with legacy codes
Working effectively with legacy codesWorking effectively with legacy codes
Working effectively with legacy codesAli Shariat
 

Similar to Basic software engineering principles with code examples - Session 2 (20)

Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
 
Ood and solid principles
Ood and solid principlesOod and solid principles
Ood and solid principles
 
There Is No Easy Button
There Is No Easy ButtonThere Is No Easy Button
There Is No Easy Button
 
The OO Design Principles
The OO Design PrinciplesThe OO Design Principles
The OO Design Principles
 
Best pratice
Best praticeBest pratice
Best pratice
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD intro
 
1. oop with c++ get 410 day 1
1. oop with c++ get 410   day 11. oop with c++ get 410   day 1
1. oop with c++ get 410 day 1
 
Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better Software
 
Clean Code - Part 2
Clean Code - Part 2Clean Code - Part 2
Clean Code - Part 2
 
Pragmatic programmer 2
Pragmatic programmer 2Pragmatic programmer 2
Pragmatic programmer 2
 
CLEAN CODE
CLEAN CODECLEAN CODE
CLEAN CODE
 
Software Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit DeySoftware Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit Dey
 
While You Are Coding
While You Are CodingWhile You Are Coding
While You Are Coding
 
How to get your app or site built
How to get your app or site builtHow to get your app or site built
How to get your app or site built
 
Agile Practices
Agile PracticesAgile Practices
Agile Practices
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software Design
 
Software Engineering Primer
Software Engineering PrimerSoftware Engineering Primer
Software Engineering Primer
 
Working effectively with legacy codes
Working effectively with legacy codesWorking effectively with legacy codes
Working effectively with legacy codes
 
Software development fundamentals
Software development fundamentalsSoftware development fundamentals
Software development fundamentals
 

Recently uploaded

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 

Recently uploaded (20)

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 

Basic software engineering principles with code examples - Session 2

  • 2. What is Software Engineering?
  • 3. How Engineer solves a problem ● Understand the requirement ● Plan a solution ● Carry out that plan ● Examine your results for accuracy Solve problems fully BEFORE diving into the implementation of your solution
  • 4. Thinking About the Process 1. Have a clear vision for the project 2. Have a rigorous process 3. Develop applications rapidly 4. Make it WORK first, then work RIGHT, THEN look pretty
  • 5. Thinking About (Coding) the Solution 1. YAGNI (You Ain't Gonna Need It!) 2. DRY (Don't Repeat Yourself) 3. Embrace abstraction 4. DRITW (Don't Reinvent The Wheel) 5. Write code that does one thing well 6. Debugging is harder than writing code 7. Kaizen (leave it better than when you found it)
  • 7. What is S.O.L.I.D? ● [S]ingle Responsibility Principle ● [O]pen/Closed Principle ● [L]iskov Substitution Principle ● [I]nterface Segregation Principle ● [D]ependency Inversion Principle
  • 8. Single Responsibility Principle “A class should have one, and only one, reason to change”
  • 9. Open/Closed Principle “You should be able to extend a classes behavior, without modifying it” In other words: Software entities (classes, modules, functions, etc.) must be opened for an extension, but closed for modification
  • 10. Liskov Substitution Principle “Derived classes must be substitutable for their base classes”
  • 11. Interface Segregation Principle “Make fine grained interfaces that are client specific” In other words: Many specific interfaces are better than a general interface
  • 12. Dependency Inversion Principle “Depend on abstractions, not on concretions” Definition of this principle into two sub-items: ● High-level modules should not depend on low- level modules. Both should depend on abstractions. ● Abstractions should not depend on details. Details should depend on abstractions.
  • 14. Basic Types of Duplications 1. Data 2. Type 3. Algorithm These duplications happen unintentionally or because we don’t know how to prevent or get rid of it. We can prevent unintentional duplications by simply rechecking what we did.
  • 15. Data Duplication Most basic and common type of duplication. Easily recognizable.
  • 16. Type Duplication In many cases where the difference between two methods is only the type in which they operate on.
  • 17. Algorithm Duplication Most difficult one and can not easily done without an understanding of the program.
  • 18. Steps to Eliminate Duplicates Nothing new …. all these steps can be found in earlier points. 1. Single responsibility principle (First principle in SOLID) 2. DRY (Don’t Repeat yourself) 3. DRITW (Don’t Reinvent The Wheel) 4. Make it WORK first, then work RIGHT, THEN look pretty
  • 20. Why Naming Conventions? To maintain, ● Readability ● Understandability ● Maintainability Each organization has its own syntax specific standards
  • 21. Mobisec Best Practices ● Variable naming ● Function Naming ● Programming Standards
  • 22. Variable naming ● Variable names should be meaningful and pronounceable. For example appcnt Vs appCounter. ● Specific words should not be used like equals, compare, data. ● Don't use same variable for different purposes in a method. ● Don't use _ to declare a variable name, Use camel casing. For example, employeeName is better than employee_name
  • 23. Function naming ● Function names should be meaningful and pronounceable. ● Avoid pointless function names. For example myFunc(), procedure(). ● Don’t say one thing and do another. ● Function names should have a verb.
  • 24. Programming Standards ● Use Camel Case (aka Upper Camel Case) for classes: VelocityResponseWriter ● Use Lower Case for packages: com.company.project.ui ● Use Mixed Case (aka Lower Camel Case) for variables: studentName ● Use Upper Case for constants : MAX_PARAMETER_COUNT = 100 ● Use Camel Case for enum class names and Upper Case for enum values. ● Don't use '_' anywhere except constants and enum values (which are constants).
  • 26. Reference ● https://www.vikingcodeschool.com/software-engineering-basics/basic- principles-of-software-engineering ● https://mari-azevedo.medium.com/s-o-l-i-d-principles-what-are-they-and- why-projects-should-use-them-50b85e4aa8b6 ● https://itnext.io/solid-principles-explanation-and-examples-715b975dcad4 ● https://dev.to/danialmalik/a-beginner-s-guide-to-clean-code-part1-naming- conventions-139l ● https://medium.com/swlh/javascript-best-practices-variable-naming- conventions-ea121ca389c5 ● https://medium.com/wix-engineering/naming-convention-8-basic-rules-for- any-piece-of-code-c4c5f65b0c09 ● https://dzone.com/articles/best-practices-variable-and ● https://simpleprogrammer.com/types-of-duplication-in-code/