Class Notes Week 4
Acknowledgement of Traditional Owners
- QUT acknowledges the Turrbal and Yunggra as the first nation owners of the lands where QUT now stands.
- Respect is paid to their elders, laws, customs, and creation spirits.
- Recognition that these lands have always been places of teaching, research, and learning.
- QUT acknowledges the important role that Aboriginal and Torres Strait Islander people play within the QUT community.
Week Four Overview
- First week back from the cyclone.
- First assignment is officially due tonight, with a 48-hour grace period.
- Gradescope is separate from the QUT network, so only one date can be set.
- The date is set for tonight, but a 48-hour extension is provided by default.
Lecture Topics
- Briefly review Assignment One.
- Review Tutorial Four (Week Three).
- Guest speaker: Richard from the student support group (peer support).
- Brief review of the first four weeks.
- Tim covers what's to come in the next few weeks.
Assignment One
- Due since week one.
- Official due date is tonight.
- Gradescope was temporarily broken, but a workaround was provided.
- The issue has been officially fixed (as of overnight).
- A link to Gradescope status is provided to track predicted outages.
Gradescope Status Page
- Core functionality and auto grader status are available.
- Gradescope has different domains (e.g., .com, .ca).
- .ca is for Canada, while .com, .eu, and .au are for other users.
- Outages may not be fully disclosed, but some information is better than none.
Gradescope Issue Escalation
- The issue was escalated by instructors after it was not addressed on the weekend.
- Multiple units use Gradescope, primarily in computer science and engineering.
- The issue was escalated within QUT to those who signed the Gradescope license.
Resubmission and Code Quality
- If Gradescope issues persist, resubmit the code multiple times.
- Test locally to identify errors.
- While the code isn't executed during errors, it is copied.
Assignment Details
- Five questions: Chicken and eggs, counting largest number, warmer or colder, counting vowels and consonants, and the Manhattan block.
- Unlimited submissions are allowed.
- If encountering errors and stress, apply for an extension.
- QUT is aware of the issue, so extensions will be granted.
- Gradescope can only set one due date, but submissions will still be accepted after the due date with an extension.
- Questions one, two, and three could be answered after week two.
- Questions four and five can be answered after week three.
- Assignment submissions have been increasing significantly.
Gradescope Code Viewing
- Gradescope allows viewing of submitted code, even if it wasn't executed.
- This allows for code quality assessment in the second assignment.
Contact and Support
- Queries can be sent today, but weekend replies may be delayed.
Week Three Tutorial Review: Shopping List
- Skeleton code provided for input/output and string formats.
- Code begins and ends with equal signs to delineate the program.
- The program gets the number of items from the customer (
numItems). - If statement: if
numItemsis greater than zero, the program continues; otherwise, it doesn't proceed.
For Loop for Entering Items
- A for loop is used to enter items.
- Condition statement:
I < numItems(ensure it's not less than or equal to avoid out-of-bounds errors). - Initial value of the control variable is zero, and it's incremented each time.
- Items are added to the array using input from the
ReadLinestatement.
Array Details
- The array called
itemsis a string array. - Arrays in C# can only hold one type of data.
Debugging
- Debugging can be done using the debugger or simple console input/output.
- Example: bread is stored at index zero, milk at index one, etc.
- Arrays count from zero.
Sorting Array
- The
Array.Sortmethod is used to sort the array. - IDEs like Visual Studio can auto-complete the method.
- The program writes the sorted items to the screen using a specific format.
- The numbers zero and one in the format strings refer to what to print out.
- Strings are sorted alphabetically based on character values.
- Characters are stored as numbers, with 'a' having a higher numeric value than 'z'.
- Uppercase and lowercase letters have different numeric values.
- To sort differently, ensure all cases are the same.
Example of Sorting
- Tea, milk, and bread are entered, and the list is reordered alphabetically.
- Different cases affect the sorting order; uppercase letters come first.
Entering a List of Integers Separated by Commas
- Similar start and end to previous tasks.
- Use the
Splitstring method to split the input. - Delimiter is a comma.
- Create a new array called values.
- Convert each item to a new index in the
valuesarray. - Print things out to the console.
Redirection
- When you run it type in the execution, but the exe.
- That actually calls the DLL file.
Math Studio
- Pixelizing common mathematical operations.
- Compound arrays: arrays within arrays.
- Use a double for loop to print each index.
Alternative Implementation for Minus Symbol
- Create a new array with everything initially set to an empty space,
- Set a single row of the array, assigning the elements in that row specific characters.
- Use the
arraywith the new element values. - This is good for a 2D array when you want to change positions instead of creating a new array each time.
- Question five of your assignment.
Guest Speaker: Richard from Student Support
- Richard organizes peer support sessions.
- CAB201 students often seek support due to the subject's difficulty.
- Coding problems can arise from a single incorrect line.
Stimulate Program
- Dedicated support sessions are run to answer assignment questions.
- Help is often needed with assessments due to time constraints.
- The support is available throughout the semester, especially around assessments.
- Stimulate.qut.edu.au
STEM Support
- Support is available for any STEM question the university teaches.
- CAB201 has many peers available, but support is limited on Friday afternoons.
- Online support is available for those who can't make it to campus via the "Request PLF" button.
Opportunities and Motivation
- Students should explore career options and projects of interest.
- Motivation and determination are crucial as the course progresses.
- Consider the type of projects you want to work on and who you want to work with.
- Opportunities exist to do challenging projects and build a portfolio early.
Language Learning
- Practice and fatigue are essential for improving public speaking skills.
- Services like Speakeasy are available for free to improve public speaking.
Study Skills
- Help is available for study skills if things aren't sticking.
- Services can assist with study methods and time management.
- Empirically based methods for retention and content sticking are available.
- Student fees cover these services, so utilize them.
Review of Weeks One to Four
- The unit is split into three parts.
- The first part focuses on translating previous programming knowledge to C#.
- The second part covers object-oriented design and implementation.
- The final part reviews and reflects on previous work.
- The next four weeks will be a step up in learning.
Week One: Data and Types
- Different types: string, int, double, and float.
- Ways to format them on a string and looking at the different conversions for a string & vice versa.
Week Two: Selection and Iteration
- Selection: if, else, and switch statements.
- Iteration: while, do-while, and for loop.
Week Three: Arrays
- One-dimensional, parallel, and model dimension.
- Main array methods:
Sort,Reverse, andSearch. - Collections:
List(dynamic array) andDictionary(key-value pair).
Algorithms
- Sequential and segmented using loops and if statements.
Week Four: Command Line Arguments and Debugging
- Directories and files: reading and writing.
- Testing: valid, invalid, and boundary cases.
- Equals: testing values at the threshold.
- Absence testing: testing collections with no items.
Advice for the Next Eight Weeks
- New content builds upon previous content; knowledge from data types is crucial for collections and files.
- Previous knowledge is required to understand what's going on in the previous week because and this will get harder and harder as the semester goes on.
- Reach out for help from instructors, tutors, Simulate, and peers.
Object-Oriented Programming (OOP) Overview
- Classes and Objects
- Classes: Templates, blueprints, cookie cutters
- Objects: Cookies, widgets, things built from those templates/
Importance of Classes in Scaling Up Software Development
- Classes are self-contained packages of related data
Attributes of Classes:
- Methods
- Fields
- Properties
Example System Application: Employees
Each employee:
- Name
- Address
- Date of birth
Encapsulation of an Employee Class:
Bundles the information and can use the variables at the same time
Key Relationship to Object Oriented Design:
- How programs are buit differently
- Analyzing the system
- The new classes
Key Aspects: What do these classes need to know & What do these classes need to do?
So, for example:
An employee may need to do a "thing" and "name" that employee to be saved in a direct method.
Static Keyword for Methods:
A method that doesn't need a direct link to each employee
Static Keyword for Fields:
Each field is assigned to the employee class not on each individual employee
Public or Private variables
Global variable: (BAD!!! - if can be avoided, should be)
The Concept of Null and Nullability:
- What objects are missing vs what are active in your code.
- This section of the notes will show you how to fix the errors of nullability being an issue in your code, which can be solved in a few different manners
Proper written C# will need to fix these warnings!!!
Types you should be checking:
- Nullable String Type:
String?
- The Null coalescing operator - to use blank strings instead of Null values:
Console.ReadLine?? "\""
Make sure to check the null video when that goes up for those details
- From now on we need to fix the warnings