programming

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.

How I make very early software cost estimates (Part 1)

Summary: I use Function Point Analysis (FPA) and Yesterday’s Weather to make “back of the envelope” software cost estimates when discussing potential new software projects with decision makers.

The problem

Many times when a software project is in its earlier stages (the conceptualization phase), the people that control the money at an organization (the CEO, CFO, CIO, etc.) want the best estimate they can get regarding the time and cost of a software development project. This is often very early in the project lifecycle, typically shortly after someone said, “Hmm, that sounds like a very interesting idea” and well before the first check is cut. In short, they want the best back of the envelope, ballpark cost estimate you can give them.

The solution

I used to dread these discussions, because I hated estimating the time and cost of software projects. I wasn’t any good at it, and the developers I worked with weren’t any good at it either. But once I learned two things:

The meaning of the word “reify” in programming

I don’t recall hearing of the words “reify” or “reification” in my OOP years, but that may be because I studied aerospace engineering in college, not computer science. Since learning FP I often see those words, so I thought I’d try to understand their meaning.

The short answer is that the main definition seems to be:

“Taking an abstract concept and making it concrete.”

For the longer answer, I found the following definitions and examples of reification.

A terrific Model View Controller (MVC) diagram

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.

Notes from “Thinking Functionally with Haskell”

I’m always curious about how people think, and these days I’m most interested in how functional programmers think about programming problems. Along those lines I found a good blog post (tutorial) titled, “Thinking Functionally with Haskell”, and these are my notes from that post:

The Scala spectrum: OOP to Pure FP

Scala is a great language in many ways. One great feature is that you can use it as a “Better Java” (i.e., as an OOP language), and you can also use it as a pure FP language. While some people prefer one extreme or the other (not unlike extremist Republicans and Democrats in the U.S.), I appreciate that this lets you find a “Middle Way” of using the best features of both approaches.