Every once in a while when something hits you, you really remember it; it stands out in your mind as an “Aha” moment. One of those moments for me was when I saw a particular “Model/View/Controller” (MVC) diagram, and the light bulb went on. This diagram made the MVC pattern very simple, and I’ve never forgotten it.
Table of Contents
- Backup your database
- Check my code out of Github, or create a module directory
- Create a project info YAML file
- Create the necessary subdirectories
- Write the code to display your block
- Clear the caches
- Enable the module
- Place the block module
- See the custom block on your website
- The biggest problem I encountered
- The source code
In this tutorial I’ll demonstrate how to write a simple Drupal 8 “block module.” By this I mean that I’ll show you how to write a simple Drupal 8 module that will display output in a block. When you’re done you will have created a new block that you can place in one or more theme regions.
This is a good post from 2014 titled, 44 engineering management lessons.
Tried to use someone’s software library.
Documentation was bad, couldn’t get it to work.
Used someone else’s.
“If testing costs more than not testing, don’t test.”
~ Kent Beck (via this twitter page)
In his book, The Universal Tone: Bringing My Story to Light, Carlos Santana writes about hearing other guitar players, and wondering with an intense curiosity how those other people got their guitars to make the sounds they made. As I thought about this I thought it was a good attitude to have in programming. For instance, if I look at an application where someone has done something really cool I try to understand, “How did they do that?”
“Perhaps the most important principle for the good algorithm designer is to refuse to be content.”
~ Alfred Aho
I was just reminded of Rubber Duck Debugging. From this Wikipedia link, “The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line-by-line, to the duck.” For me, my rubber duck is Albert Einstein.
“Besides a mathematical inclination, an exceptionally good mastery of one’s native tongue is the most vital asset of a competent programmer.”
~ Edsger Dijkstra
Dan Bricklin, inventor/creator of VisiCalc, the first spreadsheet program for personal computers, has created this page of historical notes and images about his work. His work came long before my interest in computers and programming, so I enjoy reading about it from a historical perspective. He shows a TI calculator and very large state diagram on this page. I remember seeing calculators like that in stores, and the work he put into the state diagram looks like a modern mind map.
If you’re into history, it’s all very cool.