-
Notifications
You must be signed in to change notification settings - Fork 6
juncheng edits #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4
Are you sure you want to change the base?
juncheng edits #53
Conversation
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! |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
>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.
>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 |
There was a problem hiding this comment.
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).
>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) |
There was a problem hiding this comment.
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.
>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.
>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 |
There was a problem hiding this comment.
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.
>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 |
There was a problem hiding this comment.
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.
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$ |
There was a problem hiding this comment.
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.
- 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 |
There was a problem hiding this comment.
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.'
- 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 |
There was a problem hiding this comment.
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.
> 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 |
There was a problem hiding this comment.
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').
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 |
There was a problem hiding this comment.
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.
method overding | |
method overriding |
Copilot uses AI. Check for mistakes.
1d29362
to
6e6fed0
Compare
No description provided.