Posts in the “programming” category

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 expression-oriented programming (expressions as equations).

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

As a little update some time later, here are a few additional 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.

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.

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:

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 server-side 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.

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.

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]

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.

Background

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.