Compare commits

...

56 Commits

Author SHA1 Message Date
Jay
ea3e782d28 fix spacing 2026-03-24 20:13:03 +00:00
Jay
e9cdb6e25f pull from main 2026-03-24 20:10:21 +00:00
Jay
0eb8915b21 Add dms lecture notes 2026-03-24 20:06:20 +00:00
Jay
ac5e4639d8 Add dms lecture notes 2026-03-24 20:05:33 +00:00
Jay
3b64218fe5 add workflow
All checks were successful
Build and Deploy MkDocs / deploy (push) Successful in 6s
2026-03-03 16:04:48 +00:00
Jay
2c56fad751 add workflow
Some checks failed
Build and Deploy MkDocs / deploy (push) Failing after 5s
2026-03-03 16:02:46 +00:00
Jay
914403247f add workflow
All checks were successful
Build and Deploy MkDocs / deploy (push) Successful in 5s
2026-03-03 15:59:10 +00:00
Jay
e9d34ec449 add workflow
Some checks failed
Build and Deploy MkDocs / deploy (push) Failing after 33s
2026-03-03 15:56:57 +00:00
Jay
0376e86fd0 add workflow
Some checks failed
Build and Deploy MkDocs / deploy (push) Failing after 9s
2026-03-03 15:55:16 +00:00
Jay
cb920fe70f add workflow
All checks were successful
Build and Deploy MkDocs / deploy (push) Successful in 25s
2026-03-03 14:59:32 +00:00
Jay
83e759895e add workflow
Some checks failed
Build and Push Static files / deploy (push) Failing after 32s
2026-03-03 14:57:22 +00:00
Jay
1209e30858 add workflow
Some checks failed
Build and Push Static files / deploy (push) Failing after 59s
2026-03-03 14:52:27 +00:00
Jay
4ba1f4be21 rename
Some checks failed
Build Notes Site / build (push) Failing after 21s
2026-03-03 11:19:06 +00:00
Jay
fbba5cb734 rename
Some checks failed
Build Notes Site / build (push) Failing after 15s
2026-03-03 11:16:05 +00:00
Jay
816bbe5be4 rename
Some checks failed
Build Notes Site / build (push) Failing after 16s
2026-03-03 11:13:47 +00:00
Jay
9b5cd7396e rename
Some checks failed
Build Notes Site / build (push) Failing after 2s
2026-03-03 11:12:29 +00:00
Jay
4a4c1419ec rename
All checks were successful
Build Notes Site / build (push) Successful in 12s
2026-03-03 11:06:11 +00:00
Jay
704a35548c rename
Some checks failed
Build Notes Site / build (push) Failing after 16s
2026-03-03 11:04:30 +00:00
Jay
5a4c6e2c88 rename
Some checks failed
Build Notes Site / build (push) Failing after 16s
2026-03-03 11:02:54 +00:00
Jay
0b6ac92f16 rename
Some checks failed
Build Notes Site / build (push) Failing after 7s
2026-03-03 11:01:55 +00:00
Jay
ca3f7cebca rename
Some checks failed
Build Notes Site / build (push) Failing after 10s
2026-03-03 11:00:51 +00:00
Jay
958b779983 rename 2026-03-03 11:00:00 +00:00
Jay
d673f9a6aa rename
Some checks failed
Build Notes Site / build (push) Failing after 9s
2026-03-03 10:54:22 +00:00
Jay
9d6417cda2 rename
Some checks failed
Build Notes Site / build (push) Failing after 9s
2026-03-03 10:53:16 +00:00
Jay
1e9247a843 rename
Some checks failed
Build Notes Site / build (push) Failing after 9s
2026-03-03 10:50:04 +00:00
Jay
6f7bc91166 Add docker file1
Some checks failed
Build Notes Site / build (push) Failing after 29s
2026-03-03 10:48:31 +00:00
Jay
af73b39fb0 Add docker file1 2026-03-03 10:48:05 +00:00
Jay
6866cba5d3 Add docker file 2026-03-03 10:47:04 +00:00
Jay
3c01d706d8 Add docker file
Some checks failed
Build Notes Site / build (push) Failing after 17s
2026-03-03 10:45:43 +00:00
Jay
4ceb357291 Add docker file
Some checks failed
Build Notes Site / build (push) Failing after 5s
2026-03-03 10:44:18 +00:00
Jay
6f37163a7b Add docker file
Some checks failed
Build Notes Site / build (push) Failing after 18s
2026-03-03 10:39:26 +00:00
Jay
4d56663b96 Add docker file
Some checks failed
Build Notes Site / build (push) Failing after 7s
2026-03-03 10:35:06 +00:00
Jay
206688ab77 remove workflow
Some checks failed
Build Notes Site / build (push) Failing after 6s
2026-03-03 02:02:54 +00:00
Jay
205eec7358 remove workflow
Some checks failed
Build Notes Site / build (push) Failing after 1s
2026-03-03 01:59:11 +00:00
Jay
9691ada4f1 remove workflow
Some checks failed
Build Notes Site / build (push) Failing after 2s
2026-03-03 01:56:54 +00:00
Jay
b211836136 remove workflow
Some checks failed
Build MkDocs / build (push) Failing after 8s
2026-03-03 01:53:56 +00:00
Jay
35ccefcd4d remove workflow 2026-03-03 01:42:24 +00:00
Jay
aed4fac3c3 remove workflow 2026-03-03 01:41:44 +00:00
Jay
69b8ac4591 remove workflow 2026-03-03 01:33:24 +00:00
Jay
0b44d28484 remove workflow 2026-03-03 01:30:52 +00:00
Jay
f049f3a277 update workflow
All checks were successful
Build and Deploy Notes / build (push) Successful in 24s
2026-03-02 18:24:28 +00:00
Jay
9b4115aafc update workflow
All checks were successful
Build and Deploy Notes / build (push) Successful in 17s
2026-03-02 18:21:18 +00:00
Jay
d4109f9d8d update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 20s
2026-03-02 18:18:50 +00:00
Jay
eaa9edf1b4 update workflow
All checks were successful
Build and Deploy Notes / build (push) Successful in 17s
2026-03-02 18:16:35 +00:00
Jay
e31dd7789c update workflow
All checks were successful
Build and Deploy Notes / build (push) Successful in 17s
2026-03-02 18:13:14 +00:00
Jay
cfe5fe6eca update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 17s
2026-03-02 18:12:29 +00:00
Jay
94403b660f update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 3s
2026-03-02 18:11:02 +00:00
Jay
0b7f66351f update workflow
All checks were successful
Build and Deploy Notes / build (push) Successful in 5s
2026-03-02 18:04:43 +00:00
Jay
2aa82a9317 update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 8s
2026-03-02 17:57:57 +00:00
Jay
adaf390009 update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 8s
2026-03-02 17:52:58 +00:00
Jay
ca5297b78f update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 9s
2026-03-02 17:48:58 +00:00
Jay
e9df4a3814 update workflow
Some checks failed
Build and Deploy Notes / build (push) Failing after 7s
2026-03-02 17:47:36 +00:00
Jay
e3711ae850 update workflow 2026-03-02 17:46:35 +00:00
Jay
e72f5c4231 Add readme1
Some checks failed
Build and Deploy Notes / build (push) Failing after 6s
2026-03-01 14:55:54 +00:00
Jay
be753dbb4c Add readme 2026-03-01 14:29:07 +00:00
Jay
40ca8eaf0a Add runner 2026-03-01 14:20:28 +00:00
8 changed files with 231 additions and 1 deletions

View File

@@ -0,0 +1,135 @@
# Java Collections
Week 3 (Oct 5th)
**Part 1**
In java a *collection* is an object that represents a group of objects.
The collections API is a unified framework for representing and manipulating collections independently of their implementation.
An *API* (application programming interface) is an interface protocol between a client and a server, intended to simplify the client side software.
A *library* contains re-usable chunks of code.
**Java Collections framework**
- We have container objects that contain objects
- All containers are either "collections" or "maps"
- All containers provide a common set of method signatures, in addition of their unique set of method signatures
*Collection* - Something that holds a dynamic collection of objects
*Map* - Defines mapping between keys and objects (two collections)
*Iterable* - Collections are able to return an iterator objects that can scan over the contents of a collection one object at a time
NOTE: Vector is a legacy structure in Java replaced with *ArrayList*
Stack is now *ArrayDeque*
`LinkedList(Collection<? extends E> c)` - means some type that either is E or a subtype of E. The `?` is a wildcard.
```java
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.add("string");
String s = (String)list.getFirst();
System.out.println(s);
}
```
This is bad coding practice, the collection constructor are not able to specify the type of objects the collection is intended to contain. A `ClassCastException` will be thrown if we attempt to cast the wrong type.
```java
public static void main(String[] args) {
LinkedList<String> list = new LinkedList<>();
list.add("string");
String s = list.getFirst();
System.out.println(s);
}
```
This is a type safe collection using generics.
- Classes support generics by allowing a type variable to be included in their declaration.
- The `<>` show the same type as stated (in this case string)
- You cannot type a collection with a primitive data type eg int
**HashMap Class**
- A HashMap is a hash table based implementation of the map interface. This implementation provides all if the optional map operations, and permits null values and the null key.
```java
public static void main(String[] args) {
HashMap<String, Integer> userData = new HashMap<>();
userData.put("Emma", 30);
userData.put("John", null);
userData.put("Millie", 17);
Set<String> keys = userData.keySet();
for (String key:keys){
System.out.println(key + "=" userData.get(key));
}
}
```
```
Emma = 30
John = null
Millie = 17
```
**Part 2**
__Relationships between objects__
*Aggregation* - The object exists outside the other. It is created outside so it is passed as an argument.
An animal object *is part of* a compound object (semantically) but the animal object can be shared and if the compound object is deleted, the animal object isn't deleted.
```java
public class Compound {
private Animal dog;
public void setAnimal(Animal dog){
this.dog = dog;
}
}
```
![Image](assets/1.png)
*Composition* - The object only exists if the parent object exists, if the parent object is deleted then so is the child object.
The zoo object owns the compound object. If the zoo object is deleted then the compound object is also deleted.
```java
public class Zoo {
private Compound dogArea = new Compound();
}
```
![Image](assets/2.png)
**Inheritance**
A way of forming new classes based on existing classes. Has a "is-a" relationship.
*Polymorphism* - A concept in object oriented programming. Method overloading and method overriding are two types of polymorphism.
- *Method Overloading* - Methods with the same name co-exist in the same class but they must have different method signatures. Resolved during compile time (static binding).
- *Method Overriding* - Methods with the same name is declared in parent and child class. Resolved during runtime (dynamic binding).
```java
public class Child extends Parent {
public Child(String name){
super(name);
}
@Override
Public void eat() {
chew();
}
}
```
The super keyword called the parent class' constructor.
![Image](assets/3.png)
**What is the difference between an abstract class and an interface**
- Java abstract class can have instance methods that implement a default behaviour. May contain non-final variables.
- Java interfaces have methods that are implicitly abstract and cannot have implementations. Variables are declared final by default.
Interfaces are less restrictive when it comes to inheritance, interfaces can have many levels of inheritance where as a class can only have one level.

View File

@@ -0,0 +1,92 @@
# Unified Modelling Language
12/10/20
**UML**: A specification defining a graphical language for visualising, specifying, constructing and documenting the artefacts of distributed object systems.
Latest version: **2.6**
**Benefits of UML**
- Enhances communication and ensures the right communication
- Captures the logical software architecture independent of the implementation language.
- Helps to manage the complexity
- Enables reuse of design
<img src="assets/4.png" alt="img" style="zoom:80%;" />
## Object Orientated Analysis
**Use case diagrams**
- Describe a set of actions that some system should or can perform in collaboration with one or more external users of the system.
- No attempt to represent an order or a number of executions.
**Use case diagram components**
`Actors` - Entities that interface with the system. Can be people or other systems.
`Use case` - Based on user stories and represent what the actor wants your system to do for them. In the use case diagram only the use case name is represented.
`Subject` - Classifier representing a business, software system, physical system or device under analysis design, or consideration.
`Relationships`
> Relationships between use case and actor
>
> 1. Association indicates which actor indicates which use case
>
> Relationship between two use cases
>
> 1. Specifying common functionality and simplifying use case flows
> 2. Using <<include>> or <<extend>>
**`<<include>>`**- multiple use cases share a piece of same functionality which is placed in a separate use case.
**`<<extend>>`** - Used when activities might be performed as part of another activity but are not mandatory for a use case to run successfully.
**Use case diagram of a fleet logistics management company**
![image](assets/5.png)
**Base Path** - The optimistic path (best case scenario)
**Alternative Path** - Every other possible way the system can be used/abused. Includes perfectly normal alternate use, but also errors and failures.
Use Case: `Borrow copy of book`
> **Purpose**: The book borrower (BB) borrows a book from the library using the Library Booking System (LBS)
>
> **Pre-conditions**:
>
> 1. The book must exist
> 2. The book must be available
>
> **Base Path**:
>
> 1. LBS requests membership card
> 2. BB provides membership card
> 3. BB is logged in by LBS
> 4. LBS checks permissions / debts
> 5. LBS asks for presenting a book
> 6. BB presents a book
> 7. LBS scans RFID tag inside book
> 8. LBS updates records accordingly
> 9. LBS disables anti-theft device
> 10. BB is logged out by LBS
> 11. LBS confirms that process has been completed successfully
>
> **Alternative Path**
>
> 1. BB's card has expired: Step 3a: LBS must provide a message that card has expired; LBS must exit the use case
>
> **Post conditions for base path**
>
> **Base path** - BB has successfully borrowed the book & system is up to date.
>
> **Alternate Path 1** - BB was NOT able to borrow the book & system is up to date.

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

View File

@@ -73,4 +73,7 @@ nav:
- Part 2. Design Principles:
- Chapter 3. Naming: books/api_design_patterns/part2/chapter3.md
- Chapter 4. Resource Scope and Hierarchy: books/api_design_patterns/part2/chapter4.md
- Lecture Notes:
- Developing Maintainable Software:
- Java Collections: lectures/dms/01_java_collections.md
- UML Diagrams: lectures/dms/02_uml.md