Skip to content

Conversation

poipiii
Copy link

@poipiii poipiii commented Aug 24, 2024

No description provided.

@xy-241
Copy link
Owner

xy-241 commented Aug 24, 2024

Thanks for the commit! Can I trouble you to git pull my branch first (I made a decent amount of updates to some of the notes recently), and just include the encapsulation and subtyping updates in the PR first? So it is easier for me to review. Thanks!

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a variety of content updates and new documents spanning object‐oriented design, cheat sheets for programming concepts, and detailed notes on computer organisation topics including MIPS instruction formats and number representations.

  • Added example blocks and clarifications in the Encapsulation document
  • Introduced new cheat sheets and recitations for OOP and computer organisation concepts
  • Expanded documentation for MIPS instruction types and related topics in computer architecture

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
content/OOP/Encapsulation.md Added examples and explanations for composition vs. inheritance; contains several typos and grammatical inconsistencies.
content/OOP/2030s PE1 cheatsheet.md New cheat sheet content illustrating Java examples and design patterns.
content/OOP/2030 sheat sheet.md New document with type hierarchies, method signatures, and type inference discussion (note the file name may need correction).
content/OOP/2030 recitation 28 aug.md Added recitation notes with examples, but several spelling and phrasing errors are present.
content/NUS/CS2030S Programming Methodology II.md Minor additions with week markers.
content/Discrete Math/cs1231s tutorial/tutorial 2.md New empty file started.
content/Computer Organisation/assembly/Assembly array operations.md Added brief explanations on array operations; the language could be clarified.
content/Computer Organisation/Processor/ALU.md Minor update to the ALU explanation with a confusing phrasing on subtraction.
content/Computer Organisation/Number System/... Multiple files updated with detailed explanations on number systems, integer/floating-point encoding, and bit-level calculations.
content/Computer Organisation/Instruction Set Architecture (ISA)/MIPS/... New and updated MIPS instruction format documentation including R-Type, I-Type, and J-Type instructions.
content/Computer Organisation/Combination Circuit/Multiplexer.md Added a detailed example of a 4-to-1 multiplexer with a table and explanation.
2024-09-06.md New sampling and data variables content with several typographical errors.

@@ -42,3 +44,15 @@ description:
> This allows for flexible designs as the `Engine` class can be **easily replaced** with another class that exhibits the same behaviour. It also promotes [[Encapsulation|encapsulation]] by **keeping related functionalities within the classes responsible for them**.
>
> "Has-a" Relationship is employed when **one class** needs to **utilise** the **functionality of another class** **without** [[Inheritance|inheriting]] from it, resulting in a more **modular** and **adaptable design**.

>[!example]
>if Class A receives instance of class b as a parameter to a method , class a is free to use the instance how ever they like as the instance acts as a interface/blueprint of what the object can and cant do
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There are several spelling and phrasing issues here (e.g., 'how ever' should be 'however', 'cant' should be "can't"). Consider rephrasing for clarity and correctness.

Suggested change
>if Class A receives instance of class b as a parameter to a method , class a is free to use the instance how ever they like as the instance acts as a interface/blueprint of what the object can and cant do
>If Class A receives an instance of Class B as a parameter to a method, Class A is free to use the instance however it likes, as the instance acts as an interface or blueprint of what the object can and can't do.

Copilot uses AI. Check for mistakes.

Comment on lines +52 to +54
>lets say you have a parent class called image , this class contians the data and methods to implement and manipulate a image
>if you have a abstract method that implements save and load method for diffrent image types(jpg.png,etc)
>if lets say the children class is draw on image , it doesnt make sense to implement a load or save image , instead we pass the class a instance of image
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Please correct typos (e.g., 'lets' → 'let's', 'contians' → 'contains', and consider capitalizing 'Image' when referring to a class).

Suggested change
>lets say you have a parent class called image , this class contians the data and methods to implement and manipulate a image
>if you have a abstract method that implements save and load method for diffrent image types(jpg.png,etc)
>if lets say the children class is draw on image , it doesnt make sense to implement a load or save image , instead we pass the class a instance of image
>Let's say you have a parent class called Image, this class contains the data and methods to implement and manipulate an Image.
>If you have an abstract method that implements save and load methods for different Image types (e.g., jpg, png, etc.),
>if, let's say, the child class is DrawOnImage, it doesn't make sense to implement a load or save Image. Instead, we pass the class an instance of Image.

Copilot uses AI. Check for mistakes.


>[!important] why use composition instead of inheritance
>lets say you have a parent class called image , this class contians the data and methods to implement and manipulate a image
>if you have a abstract method that implements save and load method for diffrent image types(jpg.png,etc)
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider correcting typos ('a abstract' → 'an abstract', 'diffrent' → 'different') and improve clarity in the description.

Suggested change
>if you have a abstract method that implements save and load method for diffrent image types(jpg.png,etc)
>if you have an abstract method that implements save and load methods for different image types (e.g., jpg, png, etc.)

Copilot uses AI. Check for mistakes.

Comment on lines +52 to +54
>lets say you have a parent class called image , this class contians the data and methods to implement and manipulate a image
>if you have a abstract method that implements save and load method for diffrent image types(jpg.png,etc)
>if lets say the children class is draw on image , it doesnt make sense to implement a load or save image , instead we pass the class a instance of image
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Please address spelling and grammar issues ('lets say' → 'let's say', 'draw on image' → possibly 'designed for drawing on an image', 'doesnt' → 'doesn't') to improve readability.

Suggested change
>lets say you have a parent class called image , this class contians the data and methods to implement and manipulate a image
>if you have a abstract method that implements save and load method for diffrent image types(jpg.png,etc)
>if lets say the children class is draw on image , it doesnt make sense to implement a load or save image , instead we pass the class a instance of image
>Let's say you have a parent class called `Image`. This class contains the data and methods to implement and manipulate an image.
>If you have an abstract method that implements save and load functionality for different image types (e.g., JPG, PNG, etc.),
>and let's say the child class is designed for drawing on an image, it doesn't make sense to implement a load or save method. Instead, we pass the class an instance of `Image`.

Copilot uses AI. Check for mistakes.


this points to the same object in the heap

if point doesn't override equal you use the objects ver of equal
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Correct the spelling errors ('ver' should be 'version') and clarify the phrasing regarding overriding the equals method.

Suggested change
if point doesn't override equal you use the objects ver of equal
If the `Point` class does not override the `equals` method, the default version of `equals` from the `Object` class is used.

Copilot uses AI. Check for mistakes.

## abstract
---
- array operations are done on words
- if our start address of our array is 0 , to append something to the array index 10 we need to move by 4 words or $4 * 10 bytes$
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider rephrasing to clarify the explanation; for instance, specify that the starting address is zero and explain the calculation more clearly.

Suggested change
- if our start address of our array is 0 , to append something to the array index 10 we need to move by 4 words or $4 * 10 bytes$
- If the starting address of our array is 0, the memory offset for appending an element at index 10 can be calculated as follows:
- Each word is 4 bytes.
- To reach index 10, we need to move by 10 words.
- Therefore, the offset is $4 \times 10 = 40$ bytes.

Copilot uses AI. Check for mistakes.

@@ -30,6 +30,7 @@ References:
![[mips_alu_branch.png|500]]

- `PCSrc` is `0` for **not taking** a branch and `1` for **taking** a branch. `isZero?` flag is also used to determine the value of `PCSrc`. `isZero?` is `1` when a branch should take place
- PCSrc value is computed using by doing a subtract operation on the s1 and s2 registers , if the result is 0 set PCSrc to 0 else 1
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The phrasing is awkward; consider rewording to 'PCSrc is computed by subtracting the values in the s1 and s2 registers: if the result is 0, set PCSrc to 0; otherwise, set it to 1.'

Suggested change
- PCSrc value is computed using by doing a subtract operation on the s1 and s2 registers , if the result is 0 set PCSrc to 0 else 1
- PCSrc is computed by subtracting the values in the s1 and s2 registers: if the result is 0, set PCSrc to 0; otherwise, set it to 1.

Copilot uses AI. Check for mistakes.

@@ -55,7 +56,7 @@ References:
> 2. Convert the binary form to [[#Normalised Number|normalised form]]
> 3. Calculate the Exponent Field by adding the bias $127$ to the exponent & convert the sum to binary (8 bits)
> 4. Determine the Sign Bit, $0$ for positive, $1$ for negative
> 5. Assemble the Float
> 5. Assemble the Float remember 1 bit for sign , 8 bit for exponent and 23 bits for mantisa
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Please correct 'mantisa' to 'mantissa' and consider adding punctuation for clarity.

Suggested change
> 5. Assemble the Float remember 1 bit for sign , 8 bit for exponent and 23 bits for mantisa
> 5. Assemble the Float: remember 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa.

Copilot uses AI. Check for mistakes.


## identify variables

variabkes used to indenity
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Please correct typos ('variabkes' → 'variables', 'indenity' → 'identify').

Suggested change
variabkes used to indenity
variables used to identify

Copilot uses AI. Check for mistakes.

method overloading
- Overloading is about changing the **order, number, or types of parameters**.
- works when multiple methods **in the same class or superclass that share the same name but have different [[Function#Function Signature|function signature]]. You create an overloaded method by changing the types, order, or number of parameters** the method takes, while **keeping the method name the same**
method overding
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Correct 'overding' to 'overriding' to ensure consistency with common terminology.

Suggested change
method overding
method overriding

Copilot uses AI. Check for mistakes.

@xy-241 xy-241 force-pushed the v4 branch 2 times, most recently from 1d29362 to 6e6fed0 Compare May 18, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants