Slido

A story of using architectural patterns in open source application
for templating prints

But Why?

What then?

Whoami?

  • 🤵 Now Architect at Kinguin
  • 🤝 Leading DDD-GDA Meetup
  • 📖 Love books
  • 🤢 Several years in debt driven development
  • 💕 starting new projects
  • 💕 collaborating on projects
  • 💔 cognitive load
  • 💔 reinventing the wheel

The Stack

  • 🌩Event Storming - to quickly design the application
  • 😹Kotlin - to minimize the boilerplate and better DX
  • ♨Spring Boot - to not invent the wheel again
  • 😴Spring Data Rest - to expose endpoints to frontend ASAP
  • 🐋Docker - to allow frontend dev to easily test with backend
  • 🧼Clean Architecture - to minimize cognitive load and allow for small contributions
  • 🐝Hexagonal Architecture - to introduce structure and convention (subjective choice)
  • NOTICE: all those were made to address some issues!

Don't use things you don't need!!!

The Juice AKA
WTF are those practices

Clean Architecture?

Let's Be Tactical:
Clean Architecture = SOLID, Interfaces, Factories


    @Bean
    fun previewingService(
        templatingService: TemplatingService,
        svgSizeExtractor: SvgSizeExtractor,
        multipleSVGRendererService: MultipleSVGRenderingService,
        labelRescaler: LabelRescaler,
        templateRepository: SpringTemplateRepository
    ): PreviewingService =
        CachedPreviewingService(
            LanguagePreviewingService(
                templatingService,
                svgSizeExtractor,
                multipleSVGRendererService,
                labelRescaler
            )
        )


    @Bean
    fun multipleSVGRendererService(): MultipleSVGRenderingService {
        return MultipleSVGRenderingServiceImpl(
            FlavorAwareRenderingService(
                InkscapeRendererService(), 
                    listOf(
                        QRCodeFlavor()
                    )
            )
        )
    }
                    
  • 🗣 Clean Architecture helps with code reusability
  • 🤷 Maybe
  • 🗣 SOLID helps with code reusability
  • 👨‍🔧 SOLID helps with code flexibility/recyclability
  • 📖 Creating flexible design and locking as late as possible
  • 🧓 "It (Your Software) works because getting something to work—once—just isn’t that hard"

Hexagonal Architecture
or Ports & Adapters

  • 🥯 How to Bake Hex
  • 🥞 Three Layers:
    1. 🌐 Domain: Business Rules
    2. 🤵 Application: Use Cases
    3. 🔌 Peripherals: Outside World Connectors
  • ⬇ Layer knows only about layer below
  • 🐽 Layer below exposes interfaces (ports)
  • 🤘 Layer above implements those interfaces (adapters)

To the Code!

The Domain

And the other layers?

Vertical Slice

Testing?

Selective Mockability

  • 🗣 Hexagonal allows you to change databases/libraries/frameworks during development
  • 🐂 Who changes databases or frameworks?
  • 🧪 Great testability and speed of iteration
  • 👨‍🔧 great approach to reusability
    • 🌐 domain = components and paths of interaction
    • 🤵 application services = reusable use cases
    • 🔌 peripherals = implementation details
  • 🧠 separation of concerns = less cognitive load
  • 🟣 Hex is implementation of Clean Architecture

Summary

  • 🧼 Clean Architecture = flexible and recyclable code
  • 🐝 Hex Architecture = reusable and ordered code
  • 🧠 They both reduce your cognitive load
  • ❗ USE ONLY IF NEEDED
  • 👹 BONUS: You can write encapsulated shit code

Q&A + Rating

Thank you!


You will find here the presentation, code repository and contact to me.