SlideShare a Scribd company logo
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

PPTX
Basic software engineering principles - Session 1
PPT
The ten commandments of TDD
PPTX
Exceptions: Why, When, How and Where!
PDF
Agile Network India | Challenges in executing Agile Projects to deliver value...
PDF
Design talk
PDF
Evolutionary Design - Refactoring Heuristics
PPTX
Intro to Unit Testing with test Driven Development
Basic software engineering principles - Session 1
The ten commandments of TDD
Exceptions: Why, When, How and Where!
Agile Network India | Challenges in executing Agile Projects to deliver value...
Design talk
Evolutionary Design - Refactoring Heuristics
Intro to Unit Testing with test Driven Development

What's hot (15)

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

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

PPTX
Design principle vs design patterns
PPT
Ood and solid principles
PPT
There Is No Easy Button
PPT
The OO Design Principles
PPTX
Best pratice
PDF
Agile Programming Systems # TDD intro
PPT
1. oop with c++ get 410 day 1
PPTX
Developing Better Software
ODP
Clean Code - Part 2
PPT
Pragmatic programmer 2
ODP
CLEAN CODE
PPTX
Software Design Principles and Best Practices - Satyajit Dey
PPTX
While You Are Coding
PDF
How to get your app or site built
PPTX
Agile Practices
PDF
TDD and Simple Design Workshop - Session 1 - March 2019
PDF
Structured Software Design
PPTX
Software Engineering Primer
PPTX
Working effectively with legacy codes
PPTX
Software development fundamentals
Design principle vs design patterns
Ood and solid principles
There Is No Easy Button
The OO Design Principles
Best pratice
Agile Programming Systems # TDD intro
1. oop with c++ get 410 day 1
Developing Better Software
Clean Code - Part 2
Pragmatic programmer 2
CLEAN CODE
Software Design Principles and Best Practices - Satyajit Dey
While You Are Coding
How to get your app or site built
Agile Practices
TDD and Simple Design Workshop - Session 1 - March 2019
Structured Software Design
Software Engineering Primer
Working effectively with legacy codes
Software development fundamentals
Ad

Recently uploaded (20)

PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Construction Project Organization Group 2.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
PPT on Performance Review to get promotions
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Geodesy 1.pptx...............................................
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Construction Project Organization Group 2.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
bas. eng. economics group 4 presentation 1.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
R24 SURVEYING LAB MANUAL for civil enggi
PPT on Performance Review to get promotions
OOP with Java - Java Introduction (Basics)
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Geodesy 1.pptx...............................................
CH1 Production IntroductoryConcepts.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Internet of Things (IOT) - A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd

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/