Drupal 8: How to write a simple custom “block module”

Table of Contents1 - Goals2 - Backup your database3 - Check my code out of Github, or create a module directory4 - Create a project info YAML file5 - Create the necessary subdirectories6 - Write the code to display your block7 - Clear the caches8 - Enable the module9 - Place the block module10 - See the custom block on your website11 - The biggest problem I encountered12 - The source code13 - Summary

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.

Functional programming leads to happiness alvin December 16, 2018 - 5:35pm

As I wrote in Functional Programming, Simplified, functional programming can lead to happiness (and sanity). The quotes in this slide from Rúnar Bjarnason’s FP talk expand on what I wrote in my book. They keys are that pure functions are very simple, and you don’t have to constantly worry about the mutable state in your application.

A nice story about Lisp has a nice story about Lisp titled, How Lisp became God’s own programming language. That page links to Paul Graham’s old Beating the averages post where he shares this Eric Raymond quote: “Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.”

The lack of type safety was difficult to scale ... alvin July 15, 2018 - 1:36pm

From this AirBnB article about using React Native: “JavaScript is an untyped language. The lack of type safety was both difficult to scale and became a point of contention for mobile engineers used to typed languages who may have otherwise been interested in learning React Native ... A side-effect of JavaScript being untyped is that refactoring was extremely difficult and error-prone.”

The 90/90 Rule of software development

The 90/90 Rule: “The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.”

~ Tom Cargill

If at first you don’t succeed ... alvin June 9, 2018 - 11:23am

I was reminded of this “If at first you don’t succeed, call it Version 1.0” saying this morning. You can find this t-shirt on Amazon if you’re interested.