Modular Code with Examples in C#
"95% of the words [about software architecture] are spent extolling the benefits of 'modularity' and ... little, if anything, is said about how to achieve it." Glenford J. Myers (1978)
In 1978, Myers noted that while the benefits of modularity were widely agreed upon, there was little discussion about how to write modular code. Almost fifty years later, many engineers continue to struggle with using modules in their code. And yet the pressure to write modular code, to support augmented coding, InnerSource, and testing rises.
In this talk, we look at how to write modular code.
- We will start by defining modules. We will provide some examples in C# of modules (assemblies) and examine language features that control visibility.
- Next, we will look at how modules can help us in software development. We will discuss information hiding and examine coupling.
- Then we will look at how we slice our software estate into modules. We will discuss how David Parnas's observations can benefit us. We will provide some examples of how we slice up an estate.
- We will step into test-driven development, so we can understand the idea that the module boundary is where we should write our tests.
- Finally, we will look at how we use modules with some architectural styles: CQRS, ports & adapters, vertical slice architecture, and flow-based programming. Again, we will provide examples in C#
We will wrap up with an overview of how these ideas relate to modular architecture styles, such as modular monoliths and macroservices
About the speaker
Ian Cooper
Polyglot Coding Architect in London, founder of #ldnug, speaker, tabletop gamer, geek. Tattooed, pierced, and bearded. The 'guv' on @BrighterCommand
