Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Tuesday, August 25, 2009

Start Programming Quick and Dirty

Warning: This really is a quick and dirty start to computer programming, and if you know anything about software development, I'm sure you will find plenty of defects in my crude descriptions of computing. The point here is to communicate the basic understanding to begin learning without submarining a person's brain with useless detail. If a beginning programmer learns the quick and dirty way, then as their knowledge and interest grows, they can go back and fill in all the little details later. When you are writing computer code, or even just using a computer, it really helps if you keep in mind the three things that make up all computing devices.
  1. The processor.
  2. The memory.
  3. The storage.
These are the building blocks of every computer program and the only things we know for sure that all computing devices have in common. An iPhone, a laptop, or a server; Each of these computers has these three components in common. 1. Processor The processor is a collection of transistors that can do simple computing operations like evaluating if two bytes are equal, or adding two integers together, etc. A processor fetches values from memory, performs operations on them, and then puts them back into memory. 2. Memory System memory is a collection of computer chips that are able to store bits of information while the power is on. As soon as these memory chips lose power, the information is lost. Inside each memory chip there are 'rows' of data, and each 'row' is addressed with a special addressing number. The processor can remember where values are stored in memory using these addresses, but as soon as the power is shut off, it is all gone. 3. Storage The system storage can come in two forms. First is a set of spinning disks called a 'disk drive' and the second is a set of computer chips called 'solid state'. Most desktop and laptop computers have disk drives, while cell phones and memory sticks use solid state. Disk drives can be thought of like a record player, but imagine a record player that could play records and write them too. Solid state storage devices are banks of computer chips that do not lose the information stored in them when they lose power. So how does a programmer link these 3 fundamental computing functions together to make a computer program? We can demonstrate this process with a program called Python. Python is actually a computer programming language, which we will learn more about later. But for now, you should start the Python interpreter in your terminal by simply typing: python and hitting enter. (if you do not know what a 'terminal' is, please post a comment and I'll send you some more detailed instructions. If you type 'python' in you terminal and nothing happens, then you probably need to install it. Some good instructions can be found here: http://diveintopython.org/installing_python/index.html ) You should see something like this on your screen: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> The '>>>' is what we will call the Python prompt. Now enter in this program, hitting enter after you have typed in each line: >>> myvar = 1 >>> myOtherVar = 2 >>> mySum = myvar + myOtherVar >>> print myvar >>> print myOtherVar >>> print mySum See what has happened? First we stored a value, the integer 1, in the computer's memory. Remember that each value stored in memory has an address? Well that address would look something like 'f8a9b6' to the computer, which is really hard to remember for humans when we are trying to write a computer program. So, Python does us a favor and remembers that when we refer to 'myvar' we are really referring to the 1 we stored at address 'f8a9b6'. Second we stored another value, this time the integer '2' into memory. Now, if we were to keep adding values to memory without removing any of them we would eventually fill it up and cause our computer to crash. So, the Python interpreter also does something else really useful for us; It can tell when we are done with a value and it will remove unused values from memory so that we can go on with our program without having to remember to remove all our values when we're done with them. Third, we told Python to add the two values together. However, adding two values together is not much fun unless we store the result somewhere in memory so we can use it again. What actually happened here is that the Python interpreter remembered the address in memory pointed to by 'myvar' and 'myOtherVar', and then sent those addresses to the processor along with the instruction to add them together. A processor always does exactly as it is told, and so it fetched the values from their addresses in memory, added them together and put the result back into the memory location that Python pointed to with 'mySum'. Last, we used the 'print' statement of Python to retrieve each of our values from memory and print them out on the screen. Statements like 'print' are just shortcuts for longer instructions to the processor. So instead of saying: >>> send value from memory address at myVar to the graphics card to display We can just say: >>> print myVar or instead of saying: >>> take the value at myInteger and add 1 we can say >>> myInteger++ This is why computer programmers often refer to the terms 'writing code'. Because, all a programming language really is, is a set of statements or verbs that tell the computer to do something. So, instead of writing out long instructions in plain English, each programming language has a list of codes we can use to save time and space. So, that is only half of the story on a programming language. The other half is what is called the interpreter or compiler. We don't need to get into the specifics on each of these but what we do need to know is that the programming language we are writing must be translated out of the code, and into a language the computer can understand. Computers don't understand English, Latin, or even any programming languages for that matter. The only thing that the processor, memory, and storage understand is something called machine-code. Machine-code is written as a series of 1's and 0's like this: 100011 00011 01000 00000 00001 000100 While this is the only thing that a computer understands, it is very hard for humans to read and write, so in the early days of computing some smart folks came up with an answer. They would create an interpreter to translate machine-code into a programming language and vice verse. Today there are many different kinds of interpreters and compilers, one for each of the many different programming languages. Incidentally, an interpreter or compiler is a computer program written in machine code, but the nice thing about them is that once an interpreter or compiler program is completed by the smart people who write them, the rest of us can use it to write our programs in a language a little easier to understand. So, with a basic understanding of what is going on, and the right programming language interpreters in hand, we can tackle larger problems, like designing the interface to our program. There are many ways to do this, but one of the most popular, and the easiest to learn is XML and CSS. We'll move on to those later. At this point, I would encourage you to continue to learn a little more Python, and this is one of my favorite tutorials: Dive Into Python You can skip section 1, but you should thoroughly understand sections 2 and 3.

Tuesday, March 31, 2009

The Fear Factory

CBS sixty minutes really put me in a bad way sunday night. They ran a story on the "infected internet" that turned out to be a 15 minute commercial for anti virus software. The president of Symantec got most of the airtime. You can catch another blog post on it that pretty much sums up my feelings. Nowhere was it mentioned that the star of the show, the conficker virus, can only infect Windows computers. You can come up with any number of reasons why that might be, depending on how much you like a good conspiracy theory. What do we do? Laugh? Cry? I don't know, but I'm just mad. I'm mad that technogists are not responsible enough to tell the truth rather than base their products on lies. I'm mad Microsoft does not bother to re build their operating system to quelch most of the problems. And I'm especially mad that web users will just accept this fear mongering as truth. But really, what choice do they have? I'm not sure how to react to the growing fear factory motivated by greed, but for now we're going to continue to focus on a great user experience, and hope that doing good begets good.

Monday, March 30, 2009

Flying Cars

Why is it that we are so fixated on marginal improvements in our lives. I came across a story in the Register this past week that reminded me of the tunnel vision we often have of the future. The story is a tongue in cheek bit on a "real" flying car. It's comforting to know that there are other people who find the humor in this. A flying car is only a marginal improvement to the car, but is fundamentally the same solution to the transportation problem. One of my favorite quotes of all time is "If I had built what everyone wanted, I would have built a better horse." from Henry Ford. The truth is that we have the ability to think outside the margins as children, but sadly, it gets "educated" out of us, and we grow up to be reasonable adults. I wish everyone would be a little less reasonable. General Motors, Ford, and Chrysler are like a characters in a high school horror movie who step through a broken door. You know there's a guy in there with chainsaw, but no matter how much you scream at them to stop, they keep going. Not even a flying car is going to save them. Not even an electric car for that matter.

Sunday, March 1, 2009

Don't forget simplicity.

We hear it so often in the small business and entrepreneurial world, that it has started to lose value. Yes, small businesses and entrepreneurs have an advantage over larger competitors because of our ability to remain nimble and move quickly. Yes, we all hope to capitalize on that advantage. I just returned from a great gathering and open discussion on ideas and best practices in product management in Boston over the past weekend. I got the chance to hear stories and learn from the practices of product managers in large organizations, small organiziations, and start ups. In particular, I noticed the complexity of effectively managing a product from within a large organization. Now, I have never worked for a very large organization, but I can only assume a level of bureaucracy needed to manage a large number of people as being neccessary, like this example. Link Unfortunately, I also spoke with a lot of people working in small organizations or startups that had intoroduced some very complex methods of product management into their organizations. This is too bad, because by doing this we lose one of our strongest characteristics. While I never promote ignorance, a certain level of nievity can't hurt in a small organization either. While I'm interested in seeing how large production teams manage their products, I can't imagine implementing their methods or best practices into a startup. Nor can I understand how a person would want to introduce such complexity into a small organization abeit for their own job security. "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery In my view we can start a company that is so complex that it must be slow moving, or so simple that it is not possible to be slow. As we work on our organization (and it is always a work in progress), we need make the reduction of complexity our top priority for our business and for our customers.

Thursday, February 26, 2009

Abstract Thought is a Practiced Skill

While starting a new organization, there's a lot of abstract ideas that need to be discussed and agreed upon. In fact, where there is any concept that exists outside of our norms, there is very little tangible stuff to talk about. What were the discussions like during the framing of the United States Democracy? How did Henry Ford explain his assembly line to investors? Think about that. How would you explain an assembly line to somebody who had never seen or heard the idea before? I think most people dislike abstraction. The required skills to deal with intangible thought take time and effort to learn. For most people these days, I think the effort is really not worth it. That's a tragedy. But, how can we avoid talking about things that do not yet exist without talking about the intangible? In my experience over the last 6 weeks, it is not possible, or even desirable to do so. We must grapple with abstraction if we ever hope to innovate. That does not mean we need to be way out in orbit either. To make an idea into reality takes people. It takes people who understand the idea, and who believe in it enough to make it happen. An idea that is not effectively communicated, is a dead one. Don't give up hope yet. There are simple tools available to us that we have been using for thousands of years to pass important intangible information.
  • Stories.
  • Parables.
  • Scenarios.
Take the recent efforts of the new Obama administration during their first 30 days in office. Their initiatives are bold, they are well thought out, and yet they continue to elicit cries of protests from our citizens. "Where are the details?!", "It makes no common sense!", "Exactly how do you plan to do this?!", "It's never been done like that before!" The early initiatives of the new president are different, and need I say, innovative. Any long term failure they suffer will not come from the substance of theses initiatives, but from innefectively communicating complex and intangible ideas. It's too bad that the Obama administration failed to do this, but it is a tragedy that such a large percentage of Amercan people have not been exposed to abstract thought processes. So, get out there and grab a book, find articles, and most of all, learn to craft stories, parables, and scenarios to effectively communicate your ideas. Dealing with abstraction is a learned skill. It takes practice and patience to get good at it. But, stick with it, because there's a whole new world out there just waiting for us when we get it.