01 - Intro
Typical application architecture
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Distributed application architecture (N-Tier)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Clean architecture is a software design philosophy that separates the elements of a design into ring levels. An important goal of clean architecture is to provide developers with a way to organize code in such a way that it encapsulates the business logic but keeps it separate from the delivery mechanism.
Clean Architecture is a software architecture intended to keep the code under control without all tidiness that spooks anyone from touching a code after the release. The main concept of Clean Architecture is the application code/logic which is very unlikely to change, has to be written without any direct dependencies. So it means that if you change the database, or UI, the core of the system (Business Rules/ Domain) should not be changed. It means external dependencies are completely replaceable.
- Database changes, underlaying business rules change
- Data access is expensive
- Possibility to divide functionality between different platforms
- Future proof (versioning)
- Authentication and authorization
Today, the principal use of the World Wide Web is for interactive access to documents and applications. In almost all cases, such access is by human users, typically working through Web browsers, audio players, or other interactive front-end systems. The Web can grow significantly in power and scope if it is extended to support communication between applications, from one program to another.
-- Source: W3C XML Protocol Working Group Charter
Laiemas mõttes tähendab "veebiteenus" nö harilikku veebi, selle erinevusega, et urlide avamist ja vormide täitmist teeb programm, ning tulemusi loeb ja kasutab samuti programm, mitte inimene. Teisisõnu, "veebiteenus" tähendab programmide omavahelist suhtlemist ja andmevahetust üle hariliku veebi.
-- Tanel Tammet
HTTP - GET
HTTP is purely text-based protocol, basically you are just sending bunch of key-value pairs from browser to server
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
HTTP - POST
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7
- 1xx Informational response
- 100 continue
- 101 switching protocols
- 2xx Success
- 200 OK
- 201 Created
- 202 Accepted
- 204 No Content
- 3xx Redirection
- 300 Multiple choices
- 301 Moved Permanently
- 302 Found
- 303 See other
- 304 Not Modified
- 4xx Client errors
- 400 Bad Request
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 409 Conflict
- 5xx Server errors
- 500 Internal Server Error
- 501 Not implemented
- 503 Service Unavailable
REST - Representational State Transfer
It’s an architectural style that defines a set of recommendations for designing loosely coupled applications that use the HTTP protocol for data transmission. REST doesn’t prescribe how to implement the principles at a lower level. Instead, the REST guidelines allow developers to implement the details according to their own needs. Web services built following the REST architectural style are called RESTful web services.
Uniform interface Requests from different clients should look the same, for example, the same resource shouldn’t have more than one URI.
Client-server separation The client and the server should act independently. They should interact with each other only through requests and responses.
Statelessness There shouldn’t be any server-side sessions. Each request should contain all the information the server needs to know.
Cacheable resources Server responses should contain information about whether the data they send is cacheable or not. Cacheable resources should arrive with a version number so that the client can avoid requesting the same data more than once.
Layered system There might be several layers of servers between the client and the server that returns the response. This shouldn’t affect either the request or the response.
Code on demand [optional]
REST vs SOAP
- REST makes data available as resources (e.g. user)
- SOAP makes data available via services (e.g. getUser)
SOAP – Simple Object Access Protocol
SOAP can work with any application layer protocol, such as HTTP, SMTP, TCP, or UDP. It returns data to the receiver in XML format. Security, authorization, and error-handling are built into the protocol
Currently, SOAP will likely continue to be used for big enterprise-level web services that require high security and complex transactions. APIs for financial services, payment gateways, CRM software, identity management, and telecommunication services are commonly used examples of SOAP.
- One of the most well-known SOAP APIs is PayPal’s public API that allows you to accept PayPal and credit card payments, add a PayPal button to your website, let users log in with PayPal, and perform other PayPal-related actions.
- Estonian SOAP services: X-Tee, DigiDoc, EMTA
SOAP Example - EMTA VAT Registry WDSL - automatic description of accessible methods and data structures used.
Open-API example swagger
What will we do?
We will start with REST based services as more modern approach.
At the end of semester (if time permits), some SOAP and XML.
Good reading: How I Explained REST to My Wife
Tooling needed at first
- .NET 6 SDK and ASP.NET Core
- JetBrains Rider – Main IDE
- Postman – for REST testing
- Node and NPM – for frontend client development
- JS frontend framework (Aurelia, Angular, Ember, Polymer, ...) or not-so-full-framework (React, Vue, Svelte) or use barebones approach and write plain JS (and maybe some jQuery)
- TypeScript on top of JS is a must
One entity single list app