Week 10 Lab01
WEDNESDAY 4PM - 6PM
THURSDAY 4PM - 6PM
Slides by Alvin Cherk (z5311001)
Code smells are code and coding patterns that is considered bad style as a result of poor programming.
Design smells, on the other hand, tend to be more subtle. They usually affect maintainability and flexibility although symptoms of a poor design can also include unclear or misleading code.
Code smells negatively impact the maintenance of a program i.e. it decreases:
Why is writing good code important?
We write code for other people whether they are collaborators or clients therefore our code must be readable and maintainable by other people.
Unmaintainable code costs money, time, and effort to fix or add features to.
The process of restructuring software to make it easier to understand and cheaper to modify without changing its external, observable behaviour.
When should you refactor?
Coupling & Cohesion
Good software aims for building a system with loose coupling and high cohesion among its components so that software entities are:
A
depends on internal workings of another component B
and is affected by internal changes to component B
Aim for loosely coupled classes. It allows components to be used and modified independently of each other
The outside system (Server Layer, BookingSystemTest, CLI Wrapper) is lowly coupled with the overall Booking System.
Communication between the outside & internal system is just done via the BookingSystemController