Monday, February 29, 2016

What is programming?

My firsts contact with programming made me think of it as a very complex task: something for hackers, and black magicians. However, after getting my first programming homework at school, I had to learn the basics. Fortunately, programming is one of the top topics discussed in the web. So I could find out how to do that homework in a short time. Actually, one may find the answer to almost any question about programming by just asking it to Google. There are many good references and documentation about programming online (stackoverflow.com, codeacademy.com, cprogramming.com, w3schools.com, and etcetera).

The definition of "program" by WordReference.com is: "a sequence of instructions enabling a computer to perform a task; piece of software". However, it is not obvious for a human being that programs like Photoshop, Excel and our favorite video-game are all just a set of instructions. But, surprise: it is exactly what they are. Complex programs, such as the ones of everyday use in our computers, are composed by hundreds, thousands, or even millions of instructions. Even though there are people who spend a lot of time programming, most of these big programs are result of the effort of many people working together (and sometime code generators are involved, too).

"Sequence" is the other important word in the "program" definition. Following the same set of instructions in different order may lead to a very different result. For example, the mathematical operation " 5 + 4 * 3 " involves one sum and one multiplication. Doing one or the other first give different results: "(5 + 4) * 3 = 27" and "5 + (4 * 3) = 17". Similarly, if you are giving directions to a friend to go from his home to yours, only God knows where he could go if he followed your instructions in different order!



So programming is all about giving instructions to the computer. For doing that, we use a set of rules given by a programming language (such rules are also referred to as the language "syntax"). Most instructions are very simple, like: add two numbers, draw a point in the screen, or write a letter into a file. However, the way they are written depends on the programming language, for example: some languages require you end each statement with a semi-colon (;), while others just need a new line to write another instruction. Choosing a programming language is sometimes matter of personal preferences, but sometimes is determined by the goal to achieve: you may not use the same language for doing complex mathematical calculations (you could use Matlab, Octave, R, or even C) and designing an interactive webpage (javascript, php, ruby, among others).

So, at the end, the mindset for programming consists basically on: understanding the goal to achieve, break it apart in small and individual steps, and translating them to the programming language we pretend to use.

Source:
Video lesson: "What is programming" in "Foundations of Programming: Fundamentals", at Lynda.com.

Saturday, February 27, 2016

Electrical engineering and abstraction

Before starting, I would like to recommend a book I really like for studying electronics. This book is "Foundations of Analog and Digital Electronic Circuits" by the professor Anant Agarwal and Jeffrey H. Lang. The book makes difficult concepts simple and it is full of examples and exercises to practice what one has just learn. In the case the content is not clear, one can check out the online course "Circuits and Electronics" (part 1, 2, and 3) available in edx.org. Having said that, let's jump into matter.

While science is used for understanding natural phenomena, engineering is dedicated to use it in a purposeful manner. Through scientific studies, we can abstract experimental data through analysis and simplifications, resulting in mathematical models (equations). Later, engineers can use these models to achieve specific functionalities.

As these models are subject to simplification, they may not apply in all scenarios. For example, the famous "the force equals the mass times the acceleration" (F = ma) may not work for objects moving at speeds comparable to the speed of light. So it is important to question ourselves before using mathematical models to find out if they are applicable for our purpose.

Electrical engineering is the purposeful use of the abstractions made to electromagnetic phenomena. Science describes such phenomenons using Maxwell Equations. Since these models are still very complex for most electrical engineering applications, some extra abstractions are made over them to get simpler models that describe relationships between current and voltage. This allows electrical engineers to work with algebraic equations rather than partial differential equations (phew!).


Each circuit component has its own voltage-current equation to describe its behavior in a circuit. Then, as the circuit is composed by more and more elements, it's whole mathematical description becomes complex (again!). But abstraction comes to save the day: we can apply further simplifications to describe circuit blocks or even entire circuits.

There is no limit for applying abstractions. They can be used to build systems, computers for example, that seem to be very complex if they are described in terms of the natural phenomenons that make it work. However they can be described as simple as a processing unit executing a set of instructions. Just remember the restrictions used to made these simplifications as they may lead to limitations. For example: your computer may not have been designed to work at a temperature of 200 degrees celsius!


Friday, February 26, 2016

The purpose of Capacitive Load

"A short pencil is much better than a long memory". Well, what I am using to write is not precisely a pencil; but the purpose of this site is to capture the technical stuff I want to remember. Hopefully, this will not just help me but others too.

I chose "capacitive load" as the name of this "notebook" for two reasons: I tried to call it "My Technical Me" but the name was not available; and because it refers to the first energy storage element one meets when studying electrical engineering (which happens to by my profession), which is a metaphor of the knowledge storage I pretend to make here.

The content in this blog is not be homogeneous in terms of what topics it covers. However, they all are technical. Some topics one may find are: mathematics, physics, electric circuits, programming, and so on.

Most posts are based on my learning experience, more than in formal sources (although, sometimes I use them to recall where I got some information from).

Having said all this: Welcome to Capacitive Load!