25T2 Week 10
Friday 9AM - 12PM (F09A)
Slides by Christian Tolentino (z5420628)
Congrats on also making it to the end of the term!
Definition: Allows developers to build and run applications without managing infrastructure
Explain how serverless functions could be used in an IoT health monitoring system.
IoT devices i.e. smart watches can send users' health data to the cloud periodically (e.g. this is why it takes a while to sync your fitness data between devices).
Each incoming data packet can trigger a serverless function that checks the data for anomalies such as a dangerously high heart rate and sends a push notification to the user.
1. What is the primary benefit of serverless computing for developers?
2. In a serverless system, when does a function typically execute
3. Which of the following is NOT a serverless platform?
4. What best describes the cost model of serverless computing?
6. Which of the following best describes the correct order of operations in a typical serverless function workflow?
7. What is a major drawback of serverless architecture?
8. Which of the following principles is LEAST aligned with serverless design?
9. What is a mitigation strategy for cold start issues?
10. When comparing the serverless and microservice architecture, which is TRUE about serverless?
11. What is a key design principle that makes serverless architecture suitable for modern applications?
12. Why can observability be a challenge in serverless systems?
13. Which scenario is best suited for a serverless architecture?
14. What role does an event play in a serverless system?
15. What is a common drawback of relying too heavily on a single cloud provider particularly in serverless architecture?
You’re building a simple online ordering system for a small cafe because they would like an electronic way of managing their orders. There are only a handful of features (creating an order, marking an order as complete and deleting an order) as the owner would like to test the system out before committing to it. What architecture is most suitable?
a) Microservices
b) Event driven
c) Layered Architecture
d) Modular Monolith
Your organisation wants to scale user management, billing, and content recommendation independently for a streaming platform like Netflix. What architecture is most suitable?
a) Microservices
b) Event driven
c) Layered Architecture
d) Modular Monolith
A government tax agency needs high control over deployments and compliance enforcement. Which architecture provides easier centralised governance?
a) Microservices
b) Modular Monolith
c) Monolithic
d) Event Driven
An education platform needs clear boundaries between features like course content, assessment, and user management. Teams are aligned to business domains. What is the best fit?
a) Modular Monolith
b) Serverless
c) Layered Architecture
d) Microservices
An IoT device continuously sends JSON health data to the cloud. The system must process this data and generate alerts immediately. What is the most efficient choice?
a) Microservices
b) Event Driven
c) Layered
d) Monolithic
An image processing pipeline needs to resize photos as soon as they're uploaded to a cloud bucket. Cost is a major concern. What architecture should you use?
a) Microservices
b) Serverless
c) Modular Monolith
d) Event driven
Finding Patterns
A code smell is a surface indication that usually corresponds to a deeper problem in the system.
An good list of most code smells are in Refactoring Guru. You will be tested on identifying different code smells in the assignment and final exam!
In groups, let's discuss the following examples. Identify the code smells and any underlying design problems associated with them.
Mark, Bill and Jeff are working on a PetShop application. The PetShop has functionality to feed, clean and exercise different types of animals. Mark notices that each time he adds a new species of animal to his system, he also has to rewrite all the methods in the PetShop so it can take care of the new animal.
public class Person {
private String firstName;
private String lastName;
private int age;
private int birthDay;
private int birthMonth;
private int birthYear;
private String streetAddress;
private String suburb;
private String city;
private String country;
private int postcode;
public Person(String firstName, String lastName, int age,
int birthDay, int birthMonth, int birthYear,
String streetAddress, String suburb, String city,
String country, int postcode) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.birthDay = birthDay;
this.birthMonth = birthMonth;
this.birthYear = birthYear;
this.streetAddress = streetAddress;
this.suburb = suburb;
this.city = city;
this.country = country;
this.postcode = postcode;
}
// Some various methods below
// ....
}
public class MathLibrary {
List<Book> books;
int sumTitles {
int total = 0
for (Book b : books) {
total += b.title.titleLength;
}
return total;
}
}
public class Book {
// Our system just models books as titles
// (content doesn't matter)
Title title;
}
public class Title {
int titleLength;
int getTitleLength() {
return titleLength;
}
void setTitleLength(int tL) {
titleLength = tL;
}
}
Book and Title can be one classHow do these code smells cause problems when developing code?
Affects the reusability, maintainability and extensibility. How fast does it take for a new developer to understand what is happening?
Is a code smell always emblematic of a design problem?
No - e.g "switch statements" and "comments" are often listed as code smells but are not always actually smells