Posts in the “programming” category

Steve Jobs on “A” players

“A small team of A+ players can run circles around a giant team of B and C players.” ~ Steve Jobs (image from this twitter page)

That’s true in software, and as I’ve found out recently, it’s true with doctors and other medical professionals.

Martin Fowler on lambdas, circa 2004

I ran across this historical tidbit from Martin Fowler a few days ago. It’s interesting to see that in 2004, lambdas weren’t too well known, and they’re associated here with dynamic languages. With a degree in aerospace engineering, I only knew of them from in interest in Lisp, and then Ruby around this time.

Could Functional Programming be called Algebraic Programming?

Lately as I’ve been writing and editing Functional Programming, Simplified: Updated for Scala 3, I’ve had the thought, could Functional Programming (FP) be called Algebraic Programming? That is, is “algebraic programming” a more accurate term for this style of programming?

The reason I say this is because, yes, FP is about pure functions, higher-order functions, functions as values, referential transparency, etc., but it’s also about domain modeling (ADTs), immutable variables (algebraic) and immutable data, errors as values, and EOP (expressions as equations).

Anyhoo, that’s just a random thought for the day.

Update: A few related notes:

  • Functional programmers also use the term “blueprint” a lot, so there might be another possible name in there (something like Blueprint Programming).
  • I’ve read that other people use the name mathematical functions when talking about what I call pure functions.
  • To be clear, I’m not calling for a name change or anything like that, just observing that Algebraic Programming may be a more accurate name.

How to use curl scripts to test RESTful web services (GET, POST, etc.)

Summary: This tutorial shows how to use Unix/Linux curl command to create shell scripts to test REST/RESTful web services.

Background: How to test REST services and microservices

There may be better ways to do this, but when I was writing a mobile app — with a JavaScript client written in Sencha Touch, and the server written with the Play Framework — I wrote some Unix curl scripts to simulate GET, POST, DELETE, and PUT request (method) calls to my Play Framework REST/RESTful web services.

You can also write REST clients with Scala, Java, and other languages, but for various reasons I wanted to test these web services with curl. As an added bonus, you can include scripts like this into your testing and integration process, if you like. You can also use the same approach with Nagios to make sure your service is still running.

A Markdown cheat sheet

This is a simple Markdown cheat sheet. I created it for my own needs, so I can find what I use and need quickly. If it’s a helpful resource for you too, cool.

[toc hidden:1]

How to call/test a web service from a browser

Web service testing FAQ: How can I test a web service from a browser?

There was a time in my life when all I did was write and test web services, and here are a few notes I learned about hitting one of my web services from a browser.

Looking at the WSDL for a web service from a browser

To view the WSDL document for a web service I created named UserService, I just went to the following URL in my browser:

Programmers, programming, and Zen

I started browsing through the book "The Cathedral & the Bazaar" again recently, and I was surprised to come across a quote where the author, Eric S. Raymond, refers to Zen. In the section on “How to become a hacker,” he writes that many hackers (where “hackers” refers to good programmers, and “crackers” is a derogatory term about people like to break into other people's accounts) like obvious things, like science fiction, music, and puns and wordplay.

Two great quotes on data, domain modeling, programming, and design

Here are two great quotes on programming, data modeling (domain modeling), algorithms, and design that I was just reminded of, thanks to this Twitter question:

Linus Torvalds: “Bad programmers worry about the code. Good programmers worry about data structures and their relationships.”

Fred Brooks: “Show me your flowchart and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowchart; it'll be obvious.”

The three principles of functional programming

Functional programming is interesting. On the one hand it’s very (extremely!) disciplined. But on the other hand, people can’t agree on certain definitions. As an example, here are the “three principles of functional programming,” from this tweet:

1. Orthogonal composability
2. Maximum polymorphism
3. Maximum deferment

Conversely, here are the “three pillars of functional programming,” from Functional and Reactive Domain Modeling:

1. Referential transparency
2. Substitution model
3. Equational reasoning

When I learned OOP I saw that it was based on several principles that everyone agrees upon. When I started learning FP (and later took two years to write Functional Programming, Simplified) I was surprised there wasn’t a single accepted definition of functional programming. I ran across the principles/pillars in the last two days and was reminded of that again.

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 functional programming (FP) I often see those words, so I thought I’d try to understand their meaning.


I ran into the word “reify” when I saw code like this:

trait Foo {

object Foo extends Foo

I’d see code like that then someone would describe that last line as a “reification” process.

What “reify” means

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

“Taking an abstract concept and making it concrete.”

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

Quotes from Clean Code

Back in 2013 I read the book Clean Code by Robert C. Martin, and in an effort to keep that book alive with me a little while longer, I decided to make my own “Cliffs Notes” version of the book on this page. One of my favorite notes from below is that a language named LOGO used the keyword to in the same way that Scala uses def, so a method named double would be defined as to double... instead of def double..., which seems like it would help developers name methods better.

LOGO used “TO” like Scala and Ruby use “def”

I ran across the following page in the book Clean Code, and it really caught my attention. In short, there is a programming language named LOGO that apparently used to keyword TO in the same way languages like Scala and Ruby use “def.” This is described near the bottom of the page in the following image, in the area I highlighted:

Clean Code - The TO keyword in the LOGO programming language

I’ve never used LOGO, but that sounds like a clever approach, and since I ran across this discussion, I have to say, it’s had an effect on my methods. Every time I type “def,” I think “TO,” and it makes me think a little bit more about how I want to write my method.

For more information on book, check out the Clean Code book.

How to use SQL SELECT, GROUP BY, ORDER BY, and COUNT (all in one)

It feels like my SQL skills are pretty average these days, but that’s only because I haven’t had to do anything hard in a while. But just now I was happy to write this little SQL SELECT query that does a GROUP BY, an ORDER BY, and a COUNT, yielding the results shown in the image:

select nid, count(nid) as count_nid from term_node
where tid in (3,1,11,10,9,8,7)
group by nid
order by count_nid DESC

I’m going to use this query — or one very similar to it — to get a list of nodes (nid) that have the most tag ids (tid) from the list of tid in the query. In theory, the nodes (blog posts) that have the most tags in common should be the most related to each other. So, in my Scrupal6 replacement for Drupal 6, this query is a way to get “related” content for a given blog post. (The tid list shown comes from node id 4, so I need to also exclude nid=4 from the results. I also need to add a limit clause to the query.)

If you ever need to do a group by, order by, and count in one SQL query, I hope this example is helpful.