Tag Archives: Coding

Coding Basics – Deceptively Simple Programming

In my last post on coding basics, I talked about turning an algorithm into code and used Euclid’s Algorithm as an example of programming a sequence of steps. There’s an even simpler type of algorithm that I want to look at this time. A formula, such as the one for converting Fahrenheit to Celsius, is also a series of steps that must be performed in order to achieve the needed result. These calculations can be represented within C# or other programming languages to include the formula as part of a larger program.

If you’re doing a one-time conversion from Fahrenheit to Celsius, you’re probably going to pull out your pocket calculator or find a good conversion website and enter the necessary numbers. You can do that because either of those resources has the necessary interface to get the necessary input from you. If you’re including this calculation in a program, you need to design your own interface, process that user input from it and return the result to the user in some way. In the case of the pocket calculator or website, other programmers pondered these issues at some point and now it’s your turn.

Continue reading

A Return to Programming

I’ve been working on a number of different projects lately, from I.T. networking to a book on MySQL, so I haven’t had as much reason to break out the programming tools as I used to. If not used regularly, programming skills can get a little rusty or even disappear like old friends from your college days that you lost contact with.

So, I’ve decided to delve back into the subject and update my status as a .NET programmer. The first step is a quick review of the C# language.  One resource that I can recommend for this is The C# Programming Yellow Book by Rob Miles. It’s just $0.99 for the Kindle version on Amazon.com and you can even get a free PDF version from the author’s website.

Continue reading

From Algorithm to Code

In previous articles, I’ve talked about the importance of finding the right algorithm, or series of steps to follow, when coding a solution. Efficiency in terms of the amount of memory used and the amount of time taken by the operation are key factors for the program. Sometimes an appropriate algorithm is already available and in wide use and it’s just up to the programmer to turn it into code. There’s always the option of running to StackOverflow and grabbing some code but that does nothing to further your talent.

Continue reading

What is Recursive Programming?

When writing programs, it’s often necessary to perform repeating operations on collections of items such as customer orders or invoices.  Often, you can just iterate through the collection or count the items to determine how many times to perform the operation.  When working with a hierarchy of items such as a directory structure where you have an unknown and varying number of levels under each branch, it’s a different story.  For this, the typical method is to use recursive programming, often just called recursion. This is a method in which one routine is designed to analyze the items on one level of the hierarchy, look for any sublevels and then call itself to analyze each sublevel.  Each time the routine calls itself, it creates another instance of itself that works independently until it’s finished and then returns to the instance that called it.

Continue reading