How to Build Logic for Programming

How to Build Logic for Programming thumbnail
Programming tells the computer how to process information and in what order.

Logic in computer programming gives specific instructions to the computer regarding what to do in different circumstances. As programs become more complex, so does the logic needed to keep the program up and running. Building your own personal logic helps to alter your brain so you can attack computer problems from the proper logical front.

Instructions

    • 1

      Learn the basics of the “C” programming language. This is the most diverse language to program with and tends to be the base for most of the logic programs. You can do this through self-study or a class.

    • 2

      Start writing simple programs. It sounds silly, but building your skills so you can clearly write an “if this, then that” program it will help you as you move further down the logic train.

    • 3

      Test any program you write for all parameters. Make sure you have built the logic correctly by giving the program all the potential options and making sure it still works. If there is a problem, go back and restructure your logic. For example, if an answer can be between one and 10, try giving the computer each individual number and making sure it works the “if this, then that” sentence correctly.

    • 4

      Study logic problems. Pick up a book at the local bookstore and test your mind with logic problems. This helps you put things in the correct order and gets you used to the format. Essentially, it gets you thinking like a computer, as you can only go off the information you have — just like the machine.

    • 5

      Try different methods of solving logic problems. Many people prefer the graph method, in which you cross reference all the items with one another and mark the graph with “+” and “-“ until you find the solution. The “-“ represents any answer it cannot be and the “+” is the correct answer. You can use this same type of graph to help you plan a program.

    • 6

      Write a logic program that tests logic. For example, plug in a series of questions to get to an answer like “20 questions”; this helps you think logically through the program, and is a game you can play afterward to test your logic.

    • 7

      Practice your programming skills every day. If you work with logic all the time, it will become second nature, but in the beginning this means practicing consistently. Even if you just do something small, do not let your programming sit idle, as you will likely forget.

    • 8

      Examine other programs and see if you can determine why the programmer wrote the code in that manner. At the same time, look for holes or ways you could make the program run faster. As code begins to run long, there are sometimes places where you could cut out steps or alter the steps to make it more streamlined.

Tips & Warnings

  • Stick with it. Logic is simple and complex all at once. There are many paths, so finding the right way is somewhat subjective.

  • Logic is not a “right” and “wrong” sort of subject, as arguments can be made for many different approaches. Keep your mind open to work with others whose logic might be different than your own.

Related Searches:

References

  • Photo Credit Comstock/Comstock/Getty Images

Comments

Related Ads

Featured