OOP versus Imp

Tags

, , , , , , , , ,

This is another note for a friend: a followup to a discussion about how some programmers really hate Object-Oriented Programming (OOP) languages.

Most of those who hate OOP hold up Imperative Programming (IP) as the One True Way to write code. The key difference is the IP is function (or verb) oriented whereas OOP is object (or noun) oriented.

I’ve never really understood that active dislike. It’s just another way to organize the same code you’d write anyway.

Continue reading

The Eight Queens

Tags

,

There’s a fairly simple puzzle, called The Eight Queens, that I’ve long favored as a project for first semester CS students. The problem is simple enough for a beginner to tackle, yet also interesting enough to be engaging. (And just tricky enough to be a nice beginner challenge.)

Due to a discussion on my other blog, I dug out an old Python implementation I had, and, after looking at it, I thought it might be worth writing a post about. If nothing else, as I said, the problem is interesting enough to be engaging.

Continue reading

Adventures in Address Vector Space

Tags

, ,

Lately I’ve been exploring the idea of a vector space with a large number of dimensions (but few degrees of freedom). A model was presented with five degrees of freedom in 500 dimensions (neurons, as it happens).

The question is, given the axes are bit-level, does normal vector manipulation semantics make sense. My contention is it has severe problems.

Continue reading

Full Adder Sim V2.0

Tags

, , , , , ,

This is the third post in the Full Adder series. The first post explored ways to code the abstract model of a full-adder. The second post explored one way to code a simulation of a physical system (where the models are of the components of the system).

This post explores another gate-based model, but one with only one type of gate. This simulation is close to being transistor-level.

Continue reading

Full Adder Simulation

Tags

, , , , ,

In the last post, I explored different ways to model the logic of a full-adder. In this post I’ll explore a model of a physical instance of a full-adder — a model that simulates physical reality.

Because a full-adder is, at root, a mathematical expression, various software models can accomplish the same results. Models are abstractions, so the only thing a model can simulate perfectly is another model.

Continue reading

Full Adder Code

Tags

, , , , , , , ,

I was involved in a debate recently about whether a full adder logic circuit is a computer. The computer science answer is: “No, not as we define a computer.”

I plan to address that answer in detail on my main blog. Here I wanted to show some of the different ways a full adder can be modeled and implemented.

Continue reading

So Random!

Tags

, ,

To ring in the new year I thought I’d play around with an old friend from my earliest programming days, a random text generator. Back then (over 30 years ago), but a little bit always, a good way to practice programming is by working on small, relatively easy, but still fun, programs.

Simple games are common choice, but not the only one. (I’ve probably written a version of Mastermind in every programming language I know.) Another fun choice is various image or text generators (or processors). Random text generators, in particular, offer a range of complexity depending on your taste and time.

Continue reading

Anyone Can Code?

Tags

, , , , , ,

There’s a general ethic these days — that anyone can code — and like a lot of things, there’s some truth to it, but also some silliness. As usual, it really depends on what we mean by “anyone can code.”

If we mean it in the same way we might say, “anyone can drive,” I think it’s silly. But if we mean in the same way we might say, “anyone can doctor (or lawyer),” well, then I still think it’s silly.

Continue reading