More on questions.
Posted on 13.05.2013 11:27 am
Last time we discussed a bit what questions mean to a programmer, how important they are to that craft and how different they are. Here we will go a bit deeper into this idea, even with some fake (pseudo) code.
We saw last time that the question "if" is the biggest tool programmers use to ask questions. I can tell you also that the question "if" is the only question programmer can ask. And that there is another restriction on that as well.
Programmers can only ask an if question that has either true or false as an answer.
This might look wrong on the surface if you look at some programming languages but dive down and you'll find that this is the case.
Lets pose a problem. You need to check if the kettle is boiling. In our world, asking "Is the kettle boiling?" is enough. You would even get a Yes/No (true/false) answer from someone regarding that. So what's the problem? The kettle doesn't know what boiling is. It's a definition of water state based on how hot it is. Ok so does the kettle know how hot the water is? Lets say it does and it gives you a number back (in celsius).
So you ask "How hot is the water?" and you get back "102". Lets form this up a bit more strictly.
temperature = HowHotIsTheWater
What we are doing is storing the value of how hot the water is and calling that the temperature.
Now we need to form the logic for boiling water. We know that under normal circumstances the boiling point of water is 100°c. So anything higher than 99 degrees (if we only have whole numbers) is boiling.
if temperature > 99
{
// Boiling
}
So here is our question, if the temperature is higher than 99, then anything within the curly braces will happen. Otherwise whatever is within those curly braces will not happen.
Hopefully this wasn't to simple (or complex). Just something I had to get off my chest :)
0 2 Like it or hate it? - Comment (2)
The Important Question
Posted on 07.05.2013 11:42 pm
This little article is aimed at those who have either no or very little programming experience.
There are generally two types of questions you can ask. Questions that have a specific correct answer to, and questions that have an opinion based answer to.
For example you can ask "At what time Game of Thrones is on?". That question has 1 correct answer to it, though the wording is a bit vague. A bit more specific question would be "At what time does Channel 2 show Game of Thrones on Wednesday evening?". This one is a bit more specific and we could even go deeper.
Opinion based questions are simple to imagine, "What is your favorite type of pizza?" or "What is the best political party?". Here you can get answers but based on the person you will get different answers.
Asking questions is a big part of life, unless you are a gangster, because gangsters don't ask questions.
Questions are equally big in the programming world. Our entire world revolves around two things. Data (numbers, text, etc.) and the questions on what to do with these things. That's it. Everything else is aimed at making the question asking and data usage fast within that particular scenario.
The main tool we use is the question "if". We ask if something is true, then we proceed to do some work, otherwise we do something else or do nothing at all.
I'm not going to go into code, since that's not important at this stage. But what I want you to take away from this is that everything computer related you use or come in contact with is functional just because it's asking the right questions with the right data.
From your ability to enter a facebook status to the MRI machine displaying an image of your heart.
So a programmers skill lies partly in knowing the current environment he is working in well enough so he can with his best ability ask the right question.
0 3 Like it or hate it? - Comment (0)
Process time: 0.002224 seconds