PHP One — Volume 1
PHP Fundamentals
Java One
From the first println to a REST API in production
Java from zero to a complete REST API: Spring Boot, PostgreSQL, JPA, validation, JWT, tests and Docker. One project grows chapter by chapter — no disconnected examples and no theory before its time.
Atenção: o idioma desta edição é inglês.
English Edition
Menos teoria vazia.
Mais código que funciona.
Nada de exemplo solto com foo e bar.
Todo trecho pertence ao mesmo projeto, que cresce capítulo a capítulo —
e os erros aparecem como aparecem na sua tela, para serem lidos linha por linha.
public class App { public static void main(String[] args) { System.out.println("The first program"); }}
curl -s localhost:8080/products/7{"id":7,"name":"Mechanical keyboard","price":349.90}docker compose up -d✔ Container api started
Um sistema só, do primeiro arquivo ao deploy
README.md
At the end of the book, a program is running. It has no screen or button: it waits, and when someone asks the right question, it answers — a product API with a client, controller, service, repository and PostgreSQL.
From the first println to a REST API in production.
- One project, growing from chapter 1 to 42
- Each concept appears when the project needs it
- Real errors, read line by line
- An API with validation, security, tests and Docker
42 capítulos em 10 partes
Abra uma parte para ver os capítulos — e a frase que abre cada um.
parte 01 Starting from zeroYou write Java before you understand Java. The language comes in through practice: compile, fail, read the error, fix it. 6 cap.
-
01
What we are going to buildBefore the first line of code, the destination. Nobody learns a trip well without knowing where it ends.
-
02
First program in JavaTwo commands, one file and the most famous line in programming.
-
03
Variables and typesDeclaring a type is hiring a reviewer who works for free.
-
04
Operators and expressionsThe equals sign does not mean equal, and the double equals sign lies about text.
-
05
ConditionalsChoosing one path means taking responsibility for the other — even when it isn't written.
-
06
LoopsWriting the same line ten times is a design mistake, not a typo.
parte 02 The Java you actually needNot the whole language — the part of it that holds up an API. Methods, collections, objects, exceptions and streams, in the exact dose. 8 cap.
-
07
MethodsGiving a name to a piece of code is the cheapest form of documentation there is.
-
08
Arrays and collectionsAn array has a size. A list has a life. A map has a key. Choosing wrong is expensive.
-
09
Object orientationUntil now the code had loose verbs. Now it gets nouns.
-
10
EncapsulationHiding the attribute is not ceremony: it is what keeps the object from existing in an impossible state.
-
11
Inheritance and interfacesInheritance is a kinship you cannot undo. An interface is a contract you can sign with whoever you want.
-
12
Enums and recordsTwo features that delete code: one for the closed set, another for pure data.
-
13
ExceptionsA handled error is a requirement. A swallowed error is a debt with interest.
-
14
Lambdas and streamsThe loop says how to go through. The stream says what you want. The second sentence is shorter.
parte 03 Into Spring BootThe framework that writes the plumbing for you. And the price of it: understanding who is calling your code. 3 cap.
-
15
What Spring isYou stop creating objects with new. In exchange, someone creates them for you — and you need to understand who.
-
16
The first Spring Boot projectThree minutes between a form on the web and an application running on port 8080.
-
17
The first APIFour verbs, one path and a decision about what to return in each case.
parte 04 Building the CRUDThe backbone of the book. Entity, database, repository, service, controller and DTO — in that order, one layer at a time. 7 cap.
-
18
Modeling the applicationBefore choosing the technology, decide the nouns. A wrong model survives every refactoring.
-
19
DatabasesA place where data survives the machine being turned off — and a fifty-year-old language nobody has managed to replace.
-
20
Spring Data JPAA layer that translates objects into table rows. Powerful, convenient and full of traps this book is going to name.
-
21
RepositoryAn empty interface that gains twenty methods. It is worth understanding where they come from before trusting them.
-
22
ServiceThe layer where the rules live. If it is empty, the rules are scattered somewhere else — and you will find them the hard way.
-
23
ControllerThe thinnest layer of the system — and the only one the client sees.
-
24
DTOsThe client doesn't need to know how your table is designed. And you don't want it to depend on that.
parte 05 A real APIWhat separates a practice CRUD from an API someone else uses: validation, honest errors, pagination and search. 4 cap.
-
25
ValidationAll input is hostile until proven otherwise — and the proof is an annotation.
-
26
Error handlingThe error is part of the contract. An API that answers 500 to everything is an API that doesn't tell what happened.
-
27
Pagination and sorting`GET /products` with a million items is a denial-of-service attack you wrote yourself.
-
28
Filters and searchFiltering in the database is a query. Filtering in memory is bringing everything and throwing almost everything away.
parte 06 RelationshipsWhen tables know each other, JPA becomes powerful and dangerous in equal measure. Here is the map of the potholes. 2 cap.
-
29
JPA relationshipsTwo tables that know each other become two classes that point at each other — and that is where JPA becomes powerful and dangerous in equal measure.
-
30
Real JPA problemsThe ORM does exactly what you told it to. The problem is that you told it without knowing.
parte 07 SecurityAuthentication, authorization and a token that says who you are without the server having to remember. 3 cap.
-
31
Spring SecurityThe API has been live for three chapters and anyone with the URL can delete any product.
-
32
JWTA signed badge the server doesn't need to keep — and that it also can't cancel.
-
33
Users and permissionsKnowing who the person is is half the job. The other half is deciding what they can do.
parte 08 TestsThe safety net that lets you change code without fear. Unit, integration and a real database inside the test. 4 cap.
-
34
Testing JavaTesting isn't about proving it works. It's about being able to touch the code without fear on Friday.
-
35
Testing servicesTo test the rule, the database has to get out of the way — and someone has to pretend to be it.
-
36
Testing controllersThe HTTP contract is the only part of the system someone else depends on. It's the one that most deserves a test.
-
37
Testing the databaseTesting against a database other than production's is rehearsing the play in a different theater.
parte 09 Documentation and toolsAn API nobody knows how to use does not exist. And a project without history has no way back. 3 cap.
-
38
Swagger and OpenAPIAn API nobody knows how to use doesn't exist. And hand-written documentation goes stale in a week.
-
39
HTTP clientsThe tool matters less than the habit of keeping the request next to the code that serves it.
-
40
GitThe code says what the system does. The history says why — and it's the only part you can't rebuild.
parte 10 Final projectNo more spoon-feeding. You get the requirements and build the whole store — and then put it online. 2 cap.
-
41
Final projectNo more spoon-feeding. You get the requirements and build the whole store.
-
42
Docker and deployA program that only runs on your machine is a hobby. One that runs on any machine is a system.
Outros livros da série
PHP One — Volume 1
PHP Fundamentals
PHP One — Volume 2
Speeding Up with Laravel
O que leitores dizem sobre Java One
Carregando avaliações deste livro…
Ver todas as avaliações deste livro →Java One
From the first println to a REST API in production. O projeto começa a rodar no primeiro capítulo — e não para mais.
Atenção: o idioma desta edição é inglês.