Architecture and Program Principles
APP (Architecture and Program Principles)
Recommended Books:
- Clean Code
- The Pragmatic Programmer
Architecture Section Preview
Loosely-Coupled System(SOA)
Challenges: how to define the Services and their interaction
Non-functional Requirements
Remote Interface (RESTful APIs)
Asynchronous Systems
Challenges:
- need rethinking with an event-driven approach
- cannot rely on remote services even more than before
- Testing complicated
Reactive Concept
Stateless Decision Systems
Approach:
- how to build decision system that can read to a dynamic state of the world
- how to coordinate a collection of systems
Modern Architecture Concepts
Approach:
- How to make the right tech and arch decisions for a given problems
Data Pipelines
Approach:
- How to develop data-driven use cases
Coding Section Preview
Managing Technical Debt
Handling Logic Failures
Log , but how to prevent too much
Instrumenting for Verification
Approach: how to verify non-functional requirements
Unit and Regression Testing (Continuous ?)
Testing Asynchronous Code
Medical Device Marketplace
multi suppliers multi groups (with different hospitals ) negotiate online
Players:
- hospitals
- suppliers
- manufactures
- groups
Concept:
- Contract (group, suppliers, negotiation)
- Price Lists
- Orders
- Negotiation
- Commitment
- Historic Date (Read, Update, Delete )
- Returns
- Payment Terms
Action: CRUD
Behavior: Hospital <> Group
- Negotiate Group, Suppliers, Items, Historic Date (optional, maybe first time)
- Commitment Volumes, historical volumes
- Volume, items, price when signing contract
- volume, items, price when paying
Week 4
4. Error Handling, REST
- bad request (get)
- depending failure ()
- internal error (login)
- Bad code (global)
http status code
- 2xx
- 200
- 201
- 4xx (Client Side)
- 400
- 401
- 403
- 404
- 405
- 5xx (Error)
- 500
- 501
GET http://server/car/298
Response:
{
statusCode: 404,
errorCode: 1132, // (reserved not valid)
errorMsg: 'Car is not a valid resource'
}
Table of error code & message:
Code | Message | Properties |
---|---|---|
1132 | {} is not a resource |
POST /user
Possible error:
1. Invalid resource (url not exist)
2. Empty Body
3. Invalid Format (XML, JSON)
4. Invaild Attribute
5. Missing Required Attribute
6. Id should not be provided
7. Duplication Attribute
8. Attribute not unique (email address, etc.)
9. Invaild Attribute value (type error)
Instrumentaion
- Rate limites (day, hour, month)
- log: count API calls by user/api key.
- check against quota/limit
- Measure Performance (Response, load)
- timestamp
- throttling
- check for total api call count
- Usage Patterns
- logging
- Logging -> Error
- Documentation Errors