Author: Lim Wei Liang
Semester Taken/Lecturer: AY20/21 Special Term 1 under Dr Boyd Anderson
Note: Content taught is equivalent to that of 2030S AY20/21 Semester 2
Main References:
CS2030 Programming Methodology II
The Java™ Tutorials
Units 00 - 03: Introduction
1. Why CS2030?
- Real-world code is complex, evolves continuously, and is the product of teamwork.
- Write 'better' code through programming paradigms, idioms, and language design. (e.g. Object-oriented Programming (OOP), and Functional Programming)
- more human-friendly
- easier to change and maintain
- fewer crashes
- Programming Paradigms
- imperative (how to deduce the solution, e.g. procedural, OOP)
- vs declarative (assertion of truth e.g. logic, functional programming)
- Not a module about:
- algorithms or efficiency, software engineering, Java language and libraries
2. Java Basics
- What is Java?
- a verbose, compiled, cross-platform language
- high-level (abstraction penalty?) and multi-threaded
- statically typed, object-oriented and class-based inheritance general purpose programming language
- Compiled vs Interpreted Languages - compiler is our friend
- Java Workflow: source code → compiler → compiled into java bytecode ahead of time→ just in time interpreted and run by the JVM
- helps us to catch errors early, but can only detect errors based on the static code, not from running it (runtime errors)
- prefer to catch errors in the compilation phase as compared to runtime phase
- to run code more interactively, we can use jshell, which is a REPL (Read-Evaluate-Print-Loop) interpreter, runs off .java files
- Java Memory Management
- Stack - for storing activation records of method calls, a method's local variables are stored here, is FILO
- Heap - for storing Java objects upon invoking new, garbage collection done here
3. Taming Complexity