Slide 1

Slide 1 text

RainerHahnekamp Evolving Architecture Ng-Asia Rainer Hahnekamp 10. January 2025

Slide 2

Slide 2 text

About Me... https://www.youtube.com/ @RainerHahnekamp https://www.ng-news.com https://github.com/softarc-consulting/sheriff ● Rainer Hahnekamp ANGULARarchitects.io NgRx Team (Trusted Collaborator) ● Developer / Trainer / Speaker @RainerHahnekamp Workshops NgRx • Testing • Spring • Quality

Slide 3

Slide 3 text

RainerHahnekamp Evolving Architecture Prepared for Next Steps Adopt to changing Requirements Fits the Size

Slide 4

Slide 4 text

RainerHahnekamp Stages 1. Anarchy 2. The Split a. Container & Presentational b. Component & Services c. Container & Service & Presentational (Sheriff) 3. Independent Features a. Shared b. APIs 4. Grouped Features aka. Domain/Scope a. Feature or Domain State 5. Going Beyond a. Hexagonal b. Micro Frontends Fine-Grained Coarse-Grained

Slide 5

Slide 5 text

RainerHahnekamp Stage 1: Anarchy ● Implement a minimal Prototype ○ "Having a foundation" ● Handful of elements ● Basic Bootstrapping ● No Routes

Slide 6

Slide 6 text

RainerHahnekamp Overengineering vs. No Plan ● Uncertainties ○ Developers ■ Don't know how to implement ○ End Users ■ Don't know what they want ● Certainties ○ Authentication ○ UI Library ○ Backend ● Dogmatics vs. Standardization ● Specify First

Slide 7

Slide 7 text

RainerHahnekamp Stage 2: The Split Anarchy Container Component Presentational Component Presentational Component Anarchy Component Service

Slide 8

Slide 8 text

RainerHahnekamp Stage 2: The Split Anarchy Container Presentational Presentational Service

Slide 9

Slide 9 text

RainerHahnekamp Stage 2: The Split - The Need for Rules Feature Component UI Component Component Data Service Model Sheriff

Slide 10

Slide 10 text

RainerHahnekamp Container & Presentational Components ● Also known as ○ Smart & Dumb Components ○ Feature & UI Components ● Quick Win for Separation ● Dogmatic Overuse ○ Container Component First ○ Presentational Component as Extraction

Slide 11

Slide 11 text

RainerHahnekamp Different Types of Presentational Components ● Feature-specific ○ Used to a single container component ○ Specific Use-Case ○ Part of a feature group ● Shared ○ Reusable ○ No feature-specific types ○ Generic

Slide 12

Slide 12 text

RainerHahnekamp State Management: Yes or No? ● Local & Global State Management ● Modern Tools aren't boilerplate ○ NgRx Global & SignalStore ○ Angular (TanStack) Query ○ RxAngular State ○ StateAdapt, MiniRxStore, XState, Redux for Angular ● My approach ○ Logic in Component ○ Extract Logic to Service ○ Switch to NgRx SignalStore

Slide 13

Slide 13 text

RainerHahnekamp Stage 3: Independent Features Feature Data UI Model Quiz Feature Data UI Model Booking Shared

Slide 14

Slide 14 text

RainerHahnekamp Stage 3: Independent Features ● Features as additional layer ● Need to be independent ● Shared Elements ● API Type for Inter-feature Dependencies ○ 100% Independence almost impossible

Slide 15

Slide 15 text

RainerHahnekamp Stage 4: Feature Groups Brochure Data UI Model Shop Holidays Feature Data UI Model Booking Quiz

Slide 16

Slide 16 text

RainerHahnekamp Stage 4: Feature Groups (Independent Subfeatures) Quiz Data UI Model Brochure Data UI Model Shop Data UI Model Holidays Feature Data UI Model Booking

Slide 17

Slide 17 text

RainerHahnekamp Stage 4: Feature Groups (with Feature Core) Quiz Data UI Model Shop Data UI Model Holidays Core Data UI Model

Slide 18

Slide 18 text

RainerHahnekamp Stage 5: No Limits ● Scaling up: Hexagonal Architecture ○ Addresses Complexity ○ Borrows Concepts from Hexagonal Architecture ○ Brings Overhead ○ Clean Code vs Cognitive Load ● Scaling out: Micro Frontends ○ Addresses Team Coordination ○ No Sharing ○ Technically Challenging

Slide 19

Slide 19 text

RainerHahnekamp Concepts from Hexagonal Architecture The Problem Dependency Domain

Slide 20

Slide 20 text

RainerHahnekamp Concepts from Hexagonal Architecture The Solution Dependency Domain Adapter

Slide 21

Slide 21 text

RainerHahnekamp Thanks