Skip to content
Snippets Groups Projects
Commit 497d180b authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

edit: update slides for the lecture 11

parent 97be354e
No related branches found
No related tags found
No related merge requests found
Pipeline #291423 failed
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
include::{includedir}header.adoc[] include::{includedir}header.adoc[]
[.smaller-80][.center-paragraph] [.smaller-80][.center-paragraph]
IT1901 Fall 2022 - {LECTURE_NO} IT1901 Fall 2023 - {LECTURE_NO}
[.smaller-30] [.smaller-30]
...@@ -17,8 +16,11 @@ Partially based on slides from Torgeir Dingsøyr and Hallvard Trætteberg ...@@ -17,8 +16,11 @@ Partially based on slides from Torgeir Dingsøyr and Hallvard Trætteberg
== Overview == Overview
- OOD - SOLID, DRY - OOD - SOLID, DRY
- Some useful considerations
- UML Diagrams - UML Diagrams
- Summary
[background-color = "#124990"] [background-color = "#124990"]
[color = "#fff6d5"] [color = "#fff6d5"]
...@@ -37,12 +39,41 @@ designing object classes and the relationships between these classes.” ...@@ -37,12 +39,41 @@ designing object classes and the relationships between these classes.”
== Object Oriented Principles == Object Oriented Principles
- Encapsulation
- Abstraction - Abstraction
- Encapsulation
- Inheritance - Inheritance
- Polymorphism - Polymorphism
== Abstraction
- hiding the internal data and implementation from the external world
- hide complexity and show essential information
- could be classified further
** data abstraction
** process abstraction
- abstract classes and interfaces
== Encapsulation
- integrating fields (data) and methods (behaviors) into a single unit
- fields are hidden from other classes
- fields can only be accessed by the methods of the class in which they are found
== Inheritance
- mechanism that allows classes to acquire fields and behaviors from other class
- the properties of the "parent" class are inherited by the "child" class
== Polymorphism
- the ability to perform a single action in different ways
- differently stated - have one interface but have multiple implementations
** overriding
** overloading
== Common issues OOD == Common issues OOD
- External dependencies: - External dependencies:
...@@ -161,10 +192,56 @@ https://en.wikipedia.org/wiki/Don%27t_repeat_yourself ...@@ -161,10 +192,56 @@ https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
[background-color = "#124990"]
[color = "#fff6d5"]
== Some useful considerations
== Refactoring
- work on the code without adding functionality
- simplify and optimize
- make it more maintainable and reusable
== Refactoring (2)
- find problem areas and improve
** very long classes or methods
** long list of parameters
** confusing package structures
** ...
== Refactoring (3)
- aim for short methods with simple control flow
- avoid recursion (harder to understand the )
- limit loops
- limit variables to the smallest scope possible
== Nesting
- complex flow in methods is hard to understand
- if you are beyond 2-3 levels you need to consider refactoring
== Naming
- use suggestive names
- adhere to conventions
- do not abbreviate
- avoid single letter variables (y)
- do not include types in names (intCount, bResult)
== Naming (2)
- do include units where needed ( delayInSeconds )
- difficulty naming might indicate the need to rethink design
- avoid naming classes Abstract... or Base...
- avoid using an evergrowing "Utils" class
[background-color = "#124990"] [background-color = "#124990"]
[color = "#fff6d5"] [color = "#fff6d5"]
== UML == UML Diagrams
[.smaller-80] [.smaller-80]
== UML - Unified Modelling Language == UML - Unified Modelling Language
...@@ -281,6 +358,7 @@ TodoListListener -> TodoController: updateTodoListView ...@@ -281,6 +358,7 @@ TodoListListener -> TodoController: updateTodoListView
``` ```
[background-color = "#124990"] [background-color = "#124990"]
[color = "#fff6d5"] [color = "#fff6d5"]
== Summary == Summary
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment