Book

Framework-Based Programming: ASP.NET Core, Laravel and Spring Boot, from First Route to Deployed App

ASP.NET Core, Laravel and Spring Boot, from First Route to Deployed App — Every web application answers the same question thousands of times a day: a browser asks for an address, and the program must find the right piece of code, collect the right data, turn it into a page or an answer and send it back — correctly, safely, and quickly. You can write all of that yourself, and the first chapter of this book does, once, so that you see how much of it there is.

A416 ChaptersBI · ENC# · PHP · Java589 pages
Profitina Framework-Based Programming
Download Full Book (PDF) Download All Lectures (PDF) Download the Source Code (ZIP)

Overview

Chapters 1 to 3 build the ground: why frameworks exist, shown by writing the same small price list four times — without a framework in C#, PHP and Java, and then with ASP.NET Core — with a full set-up of VS Code, the .NET SDK, PHP and Composer, a JDK and Maven, and a database on Windows, macOS and Linux; the foundations shared by modern frameworks — MVC, routing, ORM, dependency injection and templates — built by hand in a tiny framework of our own, MiniFrame, and then found again in the three real ones; and a first real ASP.NET Core MVC application: the project, Program.cs with its services and its request pipeline, the model, controllers and routing, and Razor views. Chapters 5 to 7 give the application a memory and a second language: Entity Framework Core, LINQ, migrations and real CRUD for customers, orders, payments and the price list; validation, form classes, ASP.NET Core Identity for sign-in, and deployment from a laptop to a server; and the same shop in Laravel, with Artisan, migrations written in PHP, Eloquent models, routing, controllers and Blade templates. Chapters 9 to 11 take the application further and to a third framework: Laravel migrations in depth, factories and seeders, middleware and form requests; users and roles, sign-in, an API for programs with API resources, and testing; and Spring Boot, with Initializr, entities, Spring Data JPA repositories and REST controllers. Chapters 13 to 15 finish the work: a layered Spring Boot application with a service layer, validation, Thymeleaf pages and one place for errors; Spring Security with tokens for the API, REST API design, and automated tests on four levels; and a comparison of the three frameworks — performance, productivity, ecosystem and community, support calendars and security by default — ending in a way to choose among them.

Chapters 4, 8, 12 and 16 are Evaluation and Discussion chapters. Each closes one quarter of the book by solving complete problems in full — every problem restated, designed, programmed, tested, run where it could be run, and explained — with the tempting wrong solution shown and taken apart. They range from a showcase site with order tracking, a route table written by hand, a response-time header and a maintenance mode, through one price rule and one order workflow solved in both ASP.NET Core and Laravel, lists without the N+1 problem, a search that finds its customer and payments that cannot overpay, to one REST API contract — one way to write a time, one shape for every error, orders that move and close, a daily report — met by Laravel and Spring Boot alike, and finally the capstone: Profitina Laundry complete in all three frameworks, compared side by side, and a decision.

Throughout, one small business grows chapter by chapter: Profitina Laundry, a laundry that began with one washing machine, two dryers and a notebook, and that grows to three outlets across Surabaya. Its old website was twenty files that nobody dared to touch; its wish was modest — one change should be made in one place — and the book grants it one framework at a time: a public site with its services and a price quote, a counter application with a real database, staff who must sign in, an API for the drivers’ phone app, and at last the same shop in three frameworks, with the people who run it choosing between them. Each chapter also has a Using It for Real section that shows how the same ideas carry over to other small businesses and everyday problems, and several have a Profitina in Practice section that shows them at work in a real product.

Inside the Book

  1. From Web Programming to Frameworks
  2. Foundations Shared by Modern Frameworks: MVC, Routing, ORM, DI, Templates
  3. ASP.NET Core MVC I: Project, Pipeline, Routing, Controllers and Razor Views
  4. Evaluation and Discussion I: The Profitina Laundry Showcase Site, Solved in Full
  5. ASP.NET Core MVC II: Entity Framework Core and Real CRUD
  6. ASP.NET Core MVC III: Validation, Identity and Deployment
  7. Laravel I: Artisan, Routing, Blade and Eloquent
  8. Evaluation and Discussion II: The Same Feature Set in ASP.NET Core and Laravel
  9. Laravel II: Migrations, Seeders, Middleware and Form Requests
  10. Laravel III: Authentication, API Resources and Testing
  11. Spring Boot I: Initializr, REST Controllers and Spring Data JPA
  12. Evaluation and Discussion III: One REST API in Laravel and Spring Boot
  13. Spring Boot II: Layered Architecture, Validation and Full CRUD with Thymeleaf
  14. Spring Boot III: Spring Security, REST API Design and Automated Testing
  15. Comparing the Three Frameworks: Performance, Productivity, Ecosystem, Choosing
  16. Evaluation and Discussion IV
Who this book is for: You are assumed to know basic web programming: what HTML and a form are, what happens when a browser sends a request and a server answers it, and how to write a small program with variables, loops, functions and classes in at least one language. You are not assumed to know C#, PHP or Java, any framework, or how to set one up. Every term is introduced in plain words before it is used, every framework is installed step by step on Windows, macOS and Linux, and every idea is shown working before it is explained in general.

Profitina · profitina.com

💬 Community Discussion