Relying on the database to validate your data

Posted on by Matthias Noback

One of my pet peeves is using the database schema to validate data.

Several ways in which this normally happens:

  • Specifying a column as "required", e.g. email VARCHAR(255) NOT NULL
  • Adding an index to force column values to be unique (e.g. CREATE UNIQUE INDEX email_idx ON users(email))
  • Adding an index for foreign key integrity, including cascading deletes, etc.

Yes, I want data integrity too. No, I don't want to rely on the database for that.

Free book chapter: Key design patterns

Posted on by Matthias Noback

I wanted to share with you a free chapter from my latest book, "Advanced Web Application Architecture". I've picked Chapter 11, which gives a compact overview of all the design patterns that are useful for structuring your web application in a way that will (almost) automatically make it independent of surrounding infrastructure, including the web framework you use.

Chapter 11 is the first chapter of Part II of the book. In Part I we've been discovering these design patterns by refactoring different areas of a simple web application. Part II provides some higher-level concepts that can help you structure your application. Besides design patterns, it covers architectural layering, and hexagonal architecture (ports & adapters). It also includes a chapter on testing decoupled applications.

If you're interested in this kind of topic, make sure to get a discounted copy using this link: https://leanpub.com/web-application-architecture/c/RELEASE_DAY.

Chapter 11: Key design patterns

This chapter covers:

  • A catalog of design patterns
  • Implementation suggestions
  • A high-level design process based on these design patterns

Release of the Advanced Web Application Architecture book

Posted on by Matthias Noback

Book cover

100% done

I'm happy to announce that my latest book "Advanced Web Application Architecture" is now complete. With ~390 pages it has become a well-rounded book full of useful design patterns and architectural principles built around the notion of object-pure code, that will help you create decoupled applications that are testable by definition, and support a domain-first approach to software development.

Use this link to get 10% off the price: https://leanpub.com/web-application-architecture/c/RELEASE_DAY

"This book helped me to improve myself and I recommend it to any developer who wants to learn how to solve problems in a better way." -- Iosif Chiriluta

"Matthias has a knack for distilling decades of experience into simplified rules of thumb. Explained with practical examples, the rules in this book are accessible to developers of any level of experience. I expect to recommend this book for many years to come." -- Ramon de la Fuente