Showing posts with label programming languages. Show all posts
Showing posts with label programming languages. Show all posts

Friday, January 22, 2016

No Instant Experts

What do playing the guitar and skiing have in common? Both require many hours of practice to become proficient. This is something I didn't understand growing up. Fortunately being a beginner skier can still be a lot of fun. When I would take guitar lessons as a child or teenager, I would practice for about a month or two and then get frustrated that I didn't know very much. This time I am making the process of learning the guitar a lot of fun and I look forward to practice every day.

So what does any of that have to do with computers and technology? The same rule of practice applies. If you want to get good, then you need to spend some time with the technology. The trick is how to make it fun. Each of us is different and so one solution might not work for everyone.

I once read about someone that wanted to learn how to program computers with a new language. He loaded his computer into his camper and headed into the woods for a week. He then spent one uninterrupted week of running through Donald Knuth's Fundamental Algorithms and turning out computer programs. My wife would never let me get away with that but I always thought that would be the perfect way to learn a new programming language.

I find that the right motivation helps people learn new things as well. I often try to marry learning tasks with something something I really want to do. Back in 2004 I had wanted to learn more about the PostgreSQL database system. I was also part owner in a restaurant and heard a great presentation about customer loyalty systems. I thought it would be fun to use PostgreSQL to help me write a web-based customer loyalty program. So I sat down and designed a system to keep track of customers and reward them with points every time they made a purchase. My program never got used but I did learn a lot about PostgreSQL and made a career of it for quite a while.

If you find yourself frustrated with your computer, just remember that there are no instant experts. It takes time to learn a lot of this stuff. Search engines are your friend and there may be someone who has already solved the problem you are having. If that doesn't work, post your question on a forum and a number of experts may be able to help you out. Who knows. One of them may have learned how to solve your problem by spending a week camping in the woods.

Monday, December 28, 2015

Technology Debt

This morning I was up skiing at Snowbird and it was rather cold. I had a friend coming up to meet me and so I stopped in one of the lodges to warm up and wait a bit. There was someone working on her laptop computer and it looked like she was writing code. I can't be sure that is what she was really doing as I try not to be one of those nosy people that reads other people's computer screens. However it got me excited to do some coding of my own.

One of the things that is fought in a high-tech job is that of technical debt. Sometimes we spend so much of our career specializing in one technology or another and ignore new ones coming out. If we do it too long then our own skills become irrelevant. That is why it is good to periodically look at one's technical skills to see if they should be enhanced.

I used to have a developer on my team that would never create a second version of any software he wrote with the same technology. Instead he would look at other computer languages and see if it could be done faster with fewer lines of code or in a more efficient manner. That can be a bit drastic, but constantly looking for better ways to do things is something we should all strive towards.

Seeing someone coding at the ski resort got me excited about the coming year and the new projects I will be working on for my job as well as my personal edification. It also has me focused on my own technical debt and what I can do to move forward with the industry so I don't get left behind. Nobody likes being left behind, especially me.

Wednesday, October 22, 2014

Programming Languages

My oldest son is back in college and currently working on a really long programming assignment. The course requires him to use the Java programming language and he is not very happy about it. At the beginning of the project, he was told by the teaching assistants that his code would approach 5,000 lines of code and take 3 weeks to write. Part of the reason for the class is to show the flexibility of Java. My son doesn't see it that way. His preference would have been to use Erlang. He could do everything the 5,000-line Java program does with 25 to 30 lines in Erlang.

This brings up the topic of programming languages. Not all of them are created equal. If you want to write something that runs very fast and only needs to run on one platform, do it in Assembly. If you need something to run as fast as possible but it may run on a number of different operating system (i.e. Linux, Windows, or Mac), then use C. If you are working with statistics then R is your best choice. A good software developer will know the benefits of a number of different languages and apply the best one for the problem at hand.

Does that mean that every software developer should know every language out there? No, but he or she should be familiar with a number of different languages along with the strengths and weaknesses of each. Software developers should also be experimenting with new languages when time permits and not rely on one language to do everything. After all, 30 lines in one language is a whole lot less work than 5,000 even if you have to learn a new language. The 30 lines of code is also a lot easier to maintain.

Wednesday, January 22, 2014

A Little Coding

It has been a while since I have done any real computer programming. Sure I work on a computer all day and spend a lot of time writing SQL statements but I don't really count SQL as a programming language. I figure I have been getting a little rusty and so I have taken it upon myself to do a little coding every evening when I get back to the boat. When I am at home in Utah, there is too much to do each evening. When I am on the boat in California, there is nothing to do but watch television. I figure it is a good time to refresh my programming skills.

It is best to start with what I already know and so I have a simple example C program that converts IP addresses into integers. An IP address is simply 4 numbers separated by a dot. My IP address is something like "101.102.103.104". This can be converted into an integer simply by breaking the numbers up and thinking of them in binary format (that will be in 1's and 0's). If you take 101 as a decimal number and shift it to the left by 24 bits, add it to 102 shifted to the left by 16 bits, add it to 103 shifted to the left by 8 bits, and add it to 104, you are left with an unsigned 32-bit integer that is the equivalent of your IP address. This is a number between 0 and 4,294,967,295.

Now the question you need to ask is why? Isn't it easier to remember 101.102.103.104 than some seemingly random integer? Yes, but it also takes more space. The IP address requires up to 16 bytes when left as a string. The unsigned integer only requires 4 bytes.  With computers that have gigabytes of memory, does 12 bytes really matter? Yes, when you are trying to remember 90 million IP addresses. 4 times 90 million is only 360 megabytes of memory where 16 times 90 million is well over a gigabyte.

My little program is working in the C programming language because that is what I am most familiar with. Now my goal is to rewrite it in a number of other languages so I can become familiar with them. When I am finished, I want to compare execution times and see which is fastest. I also want to see which one is easiest to understand, easiest to code, and fewest number of lines. It may sound like a boring exercise but my hope is that it will help improve my coding skills at the same time I learn about a number of new languages. It also has a practical application to a problem I am trying to solve at work and so that makes it significantly more interesting.

Monday, June 27, 2011

Relearning C

The first computer language I learned was BASIC and I was in the 8th grade. It was fun to get the computer to do various things but I really enjoyed my next class which taught me Pascal. When I got to college, I learned a few more computer programing languages including C. I would have to say that C remains as my favorite language for a number of reasons.

Recently I started a new personal project and have chosen to do it in C. I thought about using something a little more modern like Python or Perl but need something that compiles to an incredibly fast program. The tradeoff is that I will have to spend more time writing code. It also means I will have to relearn many of the things I have forgotten about C.

C is one of those languages that has a lot of flexibility but also has a lot of pitfalls. Today I was working with pointers and made a minor mistake on the syntax. Because pointers are so flexible, the syntax was correct, I just wasn't getting the results I was expecting. I used an Internet search engine to look up various examples with no success. It turns out, I needed to include some parenthesis around one small section of code. I came up with the solution after thinking about the results I was getting for a while. Then things started working correctly.

Some might be discouraged by such an experience, but not me. I just realized that I need to do some relearning and that is one of the reasons I started this project. It is my understanding that colleges and universities have moved towards teaching Java instead of C and I think that is a mistake. If it was up to me, everyone would learn C as their first computer programming language. There is something about having to work hard to get your program running. It has a bit of a learning curve, but allows you to write complex programs that run really fast.