Problem/Solution/Representation

Standard

Programming is about representing in a computer a solution to a problem. Fred Brooks said in his The Mythical Man-Month that representation is the essence of programming, so maybe that shines a light on the whole issue.

Immediately, we can start asking questions from that.

What is representing a solution?

How do we solve the problem in the first place?

Is solving the problem part of programming?

What representational tools do our programming languages provide us with?

Are we making the best use of those tools or are we just trying to program in X using the Y language?

This is the kind of argument people make by saying “You’re just writing C in Python.” or “You’re just writing Java in PHP.”.

How is representing your solution in an OO fashion better for your particular goals?

If you’re not doing OO, think of the other paradigms you’re using.

In our programs source code, should we emphasize the problem, the solution or the representation?

Can we emphasize one without sacrificing the other 2?

How can raising the level of abstraction help us with better representing solutions?

Given a program, can we change how the solution is represented in such a way to get better results?

This is obviously true. We can very often change how we represent the solution to the problem in a way that leads to, for example, less memory usage at runtime. Another point of view here is refactoring, which can lead to programs that are easier to maintain.

Given you have to read some code, which of the three is the hardest to figure out?

Given you know the representation, can you “backtrack” the problem and the solution?

These last two are about code readability. When we program, we encode a solution into a representation. When we read a program, we do the reverse process: we decode the representation back into a solution.

The problem with “readability” is that it’s a terrible word. What we want is understandability, reasonability and related benefits. I believe the word “readability” causes issues for people and leads to significant misunderstanding. There is a lot of “code like english prose” out there that does more harm than good by hiding important aspects of the representation being used.

Answers…

No, I don’t really have the answers. But we can still think about the questions and come up with interesting and useful conclusions on how to become better programmers.

Stupidity?

Standard

I sometimes wish the smart exposed their thoughts and ideas more often, and that the dumb be quieter. What bothers me is that this sentence could easily mean that I’d like to see more people with whom I agree and less people with whom I disagree. If that is the case, I’m just being stupid.

Symmetry in “to be”

Standard

If someone tells you “You are yourself.”, could he/she had told you “Yourself is you.”? It’s true it’d be a weird way to say it, but it’d also be correct. There is a symmetric relation going on in there. While identifying the relation itself isn’t the point of this text, exploring that there is one is.

Another example of this is to say “I am the author of this post.”. I could have just as well said “The author of this post is me.” and it’d also be right. Can we always exchange A with B in a sentence A is B.”?

The answer is clearly no. For example, in “I am brazilian.” I cannot. It’d be an absurd to say that “Brazilian is me.” or anything of the kind. Another more screaming example is when to be is used to express that a subject is in a state, as in “I am writing.”.

From the mathematical perspective, a lot of the interesting research goes about studying if some relations are symmetric or not. For example, P is NP, but is NP P? Answering that question is left as an exercise to the reader.

I find this interesting because a lot of confusion I see in people’s discussions, including mine, have to do with misunderstanding the relation that exists (in the case there is an underlying relation) when the verb to be is applied. It’s not always obvious when someone is expressing an underlying symmetric relation or not.

For example, “Programming is math.”. Is there an underlying symmetric relation in there? A lot of people will jump to say that this is wrong because math isn’t programming, but if the underlying relation isn’t symmetric, that counter argument isn’t valid for discredit.

An interesting question for english day-to-day speaking is asking yourself if you’re assuming symmetry in the underlying relations people express in their conversations. Because there might not be one even when you’re sure there is. And be cautious because to be isn’t the only verb with this “misinterpretation feature”. =)

My New Blog

Standard

I’m working on a project to develop my own blog application to use it as my own blogging software for this blog specifically. It’s still under construction, but as soon as it gets done, I’ll post about it here.

The reason why I’m going forward with this is mostly so I have some real world project to practice web development using the Laravel framework. The blogging idea was my first in mind and I went with it. Now I already have many other ideas to follow on, but I’ll finish the blog.

This started Aug 19, 2014, and now, a week later, I already have read some stuff on Laravel, created users and post management features and have a layout going on. Things are going well, and I’m impressed how much a framework can help in productivity.

The project is open source and it’s already available on github. For now, you can visit the new blog, under construction, in here.

I intend to write tutorials on how one could clone that github project and use my own blogging software to support his/her own blog, but for now, I’m concerned with getting other features in place.

Paul Romero playing some HOMM songs on the piano

Standard

If you’ve ever played Heroes of Might and Magic, you know how wonderful the soundtracks are. I personally have played only HOMM3 and 6. They both do have amazing songs.

The people responsible for composing these [wonderful] songs seem to be Paul Romero and Rob King.

There is a Youtube video in which Paul Romero plays some of those songs on the piano. It’s amazing.

Some Thoughts on Meanings of Words

Standard

It happened several times to me (enough to catch my attention) that looking up the meaning of a word considerably helped me in understanding it. Not just in a dictionary however, but also in a thesaurus, encyclopedia or even in an etymology dictionary.

As a reader, I imagine you’d be surprised I’m saying such a thing. After all, isn’t it obvious? Dictionaries will tell you the meaning of words, so if you want to understand what a particular word means, look it up. And yes, it is, in that sense, obvious. However, there is another aspect to this issue.

Back when you learned procedural or object-oriented programming, did you look up in some programmer dictionary what “procedure” or “object” means? It’s very unlikely that you did. You probably just learned the concepts behind these topics by explanations in your textbook, but not precise definitions. It’s more than that though. What about the words I’m using in this text right now? How many of then have you actually looked up before?

The point I’m trying to make is that the way I generally learn meanings of words is through some other mechanism other than looking them up in some sort of reference material. And, as it seems to me, this is also true for most other people. In general, for learning meanings, we don’t look up in authoritative sources. We do something else, like learning from examples of use.

Just to be clear, there is nothing wrong with this “doing something else”. However, it leads to some issues. In scientific papers, books, other blog posts, speech and so forth, people use some words whose precise meaning aren’t that simple to be picked up informally.

Do you really know precisely what the following mean?

  • System
  • Model
  • Structure
  • Pattern
  • Object
  • Process
  • Procedure
  • Function
  • Number
  • Integer
  • Abstraction
  • Relationship
  • Predicate
  • Proposition
  • Set
  • Algorithm
  • Program
  • Schedule
  • Dynamic
  • Static

I could list a lot more, by the way.

These are all words I’ve seen enough people not quite getting them right. Some of these words, it was myself who didn’t get precisely right at first, and some up to today. The importance of these terms, for us software people, is that we seem to use them to describe what our software should do, how our algorithms work, how our software is designed, the requirements on our software, and so forth. And, as such, we should know extremely well what they mean.

Now you should get into the habit of looking things up (=D). Writing about them also helps. Making use of multiple sources is highly important too. The various dictionaries, thesaurus, encyclopedias and so forth out there help with this.