Drupal is very popular
Not only is Drupal a very popular framework - it is vastly superior to Wordpress. Sure, it took me a while to wrap my head around what's going on in Drupal, but once I did, I discoveted that it is actually a nice (if sometimes ugly) framework. In contrast, Wordpress is an obsolete monstrosity, probably CIA-owned, with poor culture (every plugin asks for money), horrible basic design (there is no single table defining categories?!) and an archaic contraption of an execution loop, instead of anything remotely resembling templates and layouts.
Comparing Drupal and Wordpress and listing the many ways Drupal is superior is a subject for a separate collection of articles. Those are being written at Wasya Co, slowly but surely. Here however, we will focus on one specific thing: demonstrating the structure of Drupal as seen through the prism of MVC, and giving practical examples of how to implement critical pieces of an MVC architecture in Drupal.
We will be looking at Drupal version 9.5, because that's the version I'm currently on. It should be very similar to versions 10 and 11. Unfortunately it is completely different from versions 7 and below, and different from version 8. I do not enjoy that if I search for an answer and see a solution, the solution may not be usable because its for, say, version 8. With that said, at least Drupal is a very old, very established framework that does not run the risk of disappearing over the next few years. So, although the awkwardness of legacy implementations comes at a cost, it also provides the benefit of stability, large support ecosystem, etc.
Symfony is actually already wired in
If you recall, Symfony is a very popular pure MVC framework for PHP. Drupal uses several symfony components. Nothing is preventing you from writing symfony code, inside Drupal, and making it all sort of work together. I have not looked too deeply into this aspect, but I believe it is valid. Earlier, my decision to do with Drupal was in part influenced by the fact that Symfony is wired in. I think of it as a good thing.
If I explore Symfony inside Drupal more, I'll add my insights to this collection of articles. But for now, let's focus on "pure" Drupal (such as the admin interface, creating blocks in the admin interface, etc). I intend to write little code (although definitely write code where reasonable), and leverage the interface and UI as much as reasonably possible.
We'll be copying from Ruby on Rails
I'm a fan of Ruby on Rails (RoR). I know it well, I think it's very elegant, and the architecture is very good. We will be using a lot of insight from the ror ecosystem.
When I was working heavily in the node ecosystem, I did very well by porting ror patterns there. The configuration pattern (environments) and the router pattern were very useful, I implement them in every node (or react) project. So, when looking at Drupal as an MVC, some implementations we'll do will be direct borrowings from the RoR ecosystem.
MVC is a (better?) structure than what Drupal uses
Drupal uses PAC - Presentation-abstraction-control (wiki) pattern, for its architecture. However, we will be looking at it through the eyes of a veteran user of MVC.
We will be showing (or re-implementing) common patterns, such as partials and scaffolding. In actuality, the overwhelming majority of elements have been already implemented. Often, we will use existing implementations and merely point out how the pieces fit together.
With that said, I have found it very frustrating that some patterns are obscure, and implementation are not available in Drupal. We will focus on those, provide implementations and examples of how to put the pieces together to get stuff done.
Testing, test-driven development, are a part of this book.
It appears that TDD is not very prevalent in Drupal development. There are some tests, but a lot of tutorials out there skip automatic testing entirely. We'll do our best to pay particular attention to testing and test-driven development. Overwhelmingly, simpletest (deprecated) and phpunit are already implemented in Drupal ecosystem.