A Big Ball of Mud
All code starts off with the best feasible design. Without patterns, devolution is inevitable.
An AHA! moment with software design patterns
For 30 years now I have derived a great deal of satisfaction teaching new and new-ish software developers our trade. There's just something about seeing the AHA! moment when suddenly a tough or opaque concept clicks in my colleague's mind. The world for them has opened to new possibilities, even if they are small. When Packt Publishing approached me about a book on design patterns, I jumped at the chance.
Software development as a profession has been around for over 50 years now. As an industry, we’re pretty good at teaching new languages, and basic theory like algorithms, data structures, Big O notation and the like. But there is a difference between software development and software engineering. Engineers need to be able to think about more than just syntax and clever uses of linked lists. They also need to learn programming paradigms and how to use software design patterns as both a communications tool and as an advantage when designing well written, easily maintainable code.
Developers working with C# will be able to put their knowledge to work with this practical guide to design patterns. The book provides a hands-on approach to implementation and associated methodologies that will have you up-and-running, and productive in no time.
Complete with step-by-step explanations of essential concepts, practical examples, and self-assessment questions, you will begin by exploring what patterns are. Throughout the book, you'll learn how to leverage them in your daily work, and even how to recognize and correct for anti-patterns that invariably worm their way into your projects.
You’ll learn to recognize solutions to common problems in software design with C# that come up time and again regardless of where you work or what industry you serve. Rather than an academic treatment that you’ll find in “classic” books on this topic, we’ll be exploring real-world applications of design patterns that you can use in your everyday work.
By the end of this book, you’ll be able to recognize situations where you are tempted to reinvent the wheel, and quickly avoid the time and cost associated with solving problems that are common, well understood, with battle tested, and proven design patterns.
You'll wield patterns with confidence, and you do it with CLASS! And sometimes interfaces.
Why should you use this book to learn or teach software design patterns in C#?
Most books on patterns have one or more problems:
Learn to defeat antipatterns and dark forces that plague 99% our projects!
(Most software developers don't do this!)
This book focuses entirely on reality, warts and all. It presents the story of two sisters, Kitty and Phoebe, who create a tech startup aimed at building the finest bicycles the world has ever seen. The girls are not professional software developers, so they have to learn as they go. They have business objectives and very real competitive pressures just like you do. Left to their own devices, their code will turn into a big ball of mud on a plate of spaghetti.
We start off with some anti-patterns: those practices everybody does because either they're lazy, or they cut corners because they're under extreme pressure to ship before the code is ready. These conditions can be corrected with regular refactoring and code reviews, but they usually aren't. The anti-patterns we cover include:
Prepare yourself to transform the way you write code.
Good code never happens by accident. Learning patterns without learning the best design practices will not yield good results. After we cover antipatterns, we talk about SOLID. SOLID represents a set of design techniques that help you create flexible object class structures.
Single Responsibility Principle
Open-Closed
Principle
Liskov
Substitution
Interface Segregation Principle
Dependency Inversion Principle
Not sure what these are? Read Chapter 2! Each principle is explained in detail. Examples are included that show you how to break the rules, and later, how to use them. After that, SOLID is used to make every example including a full project in Chapter 7.
Any resemblance to actual persons, alive or dead, is a mere coincidence (and a real shame!).
Meet Kitty and Phoebe – Texas-born sisters who share a love for riding bicycles. Phoebe is studying engineering at Southern Methodist University, a private university in the sisters’ hometown of Dallas, Texas. Kitty is studying industrial design at Sul Ross University in the town of Alpine located in west Texas. Purely through kismet, they both won a summer internship at MegaBikeCorp, a large multi-national bicycle manufacturing company.
After three months of soul crushging big-company bureaucracy, the girls decided they could do better. Kitty designs a new line of incredibly innovative bicycles. Her sister has the idea to create an automated robotic assembly line. The sisters find two abandoned warehouses: one in Dallas, the other in the city of Alpine. The two set up shop with the help of their father's credit card. (Don't worry, they pay him back!)
Throughout the story, the sisters are working on building the software systems that will control their robotic manufacturing facilities. You'll be working alongside them, learning as they do, and occasionally making mistakes, and then correcting them.
This is the most fun you'll have reading a technical book.
Master the most important patterns you'll use every day.
Chapter 3 through 6 describe what I believe are the most useful patterns for every day, real-world projects in C#.
Chapters 7 & 8: PLOT TWIST!
The plot of our story takes a dire turn and the heroic sisters must find a way to adapt so they can save their family and their business.
In the real world, your business needs to be able to pivot on a dime to capture new markets and new opportunities. If your software architecture isn't resilient and flexible, you could miss out. The only way to have a flexible architecture is to follow SOLID principles and utilize patterns. Stretched thin by their current business committements, the girls have to recruit some help from a skilled developer most companies probably wouldn't hire. Will this unlikely hero save they day using the patterns learned in the earlier chapters?
That's all we're going to say! No spoilers! I'm not even going to tell you what that red thing is. It looks like a tank, but it isn't. That's all you're getting! Now go buy the book!