Você está na página 1de 4

Common Programming Questions

Why Should I Do It?


administrator Common Programming Questions

Programming is fun. It is a stimulating creative process by which your mind conceives of a goal (some result you wish to achieve) and you create it. What is it you want to achieve? Programming for some is a fun hobby, while others a necessary evil. If there is a specific program you want to create, and you arent really interested in learning program, you will first want to research and find out if the tool already exists. If something out there does what you want, dont push yourself.

If you want to learn how to program just to see how programming works, then you have come to the right place. This website will guide you as to a correct programming language and provide a tutorial on that language to demonstrate to you some of the inner workings of that language.

If you want to create games, be aware it is a long road. It is not impossible of course, and it is a very satisfying journey if you are truly interested in how games work and creating your own. This website has a page devoted entirely to game programming.

If you have a need for a certain utility or tool and/or think there might be one in the marketplace, we can guide you as to the best route for you to follow.

What exactly is programming?


administrator Common Programming Questions

Programming is the process of writing instructions that the programming language uses to tell the computer what to do. Of course the explanation can get much more detailed and complicated than that, but that is a good basic idea for the beginner. Programming can be done on any platform (platform generally refers to the combination of hardware and software you are using for example, AMD processor and Windows XP) you are likely to be using to read this page. We will assume that most beginners are likely to be using Windows, but you can write similar programs for other platforms such as those using Unix, Linux, or MAC operating systems.

Can I figure this programming stuff out?

administrator Common Programming Questions

Although much of the material you might pick up in a bookstore or see on the internet seems very dense and hard to understand, programming isnt all that difficult. Anyone who can follow a set of rules and use logic to solve a problem can program. Anyone functioning in society today is capable of that! Programming highly complex projects obviously gets more difficult, but lets not put the cart before the horse.

To program successfully, you need to be able to write instructions in a programming language (rules), and order those instructions to achieve the results you desire (logic). You do this every day: To cook food (even if you microwave), you take ingredients, follow some steps, and get the result of the fully prepared food. To get ready for bed at night, you do a few tasks a certain way brush your teeth, change clothes, get in bed, etc. and in a certain order to achieve the result of being ready to properly sleep.

If you can think these things through, you can program. The rest is just semantics. One overriding concept to keep in mind programs cannot read your mind. When programming, the computer will only do exactly what you tell it, no more, no less. If the program has a result that is not what you intended, you either forgot to tell it something it needed to know or do, and told it to do something incorrectly or in an unintended way. This may seem to be a simple concept, but it is very important to keep in mind when thinking through your program writing.

How does it work?


administrator Common Programming Questions

You dont need to know this stuff in order to start writing programs, but if you would like an idea what is going to go on behind the scenes, read on.

If you are going to write full fledged programs in a language like Visual Basic, C, C++ or Java, you are writing in what is called a high level language. This is language that is created to read in easily understandable usage and formatting, although you may not think so at first! When you compile the program, the compiler first checks to make sure you follow the structure and rules of the language. After that, the program you wrote is broken down into machine code that can be read by the computer. Essentially, machine code is what you may have seen referred to in the past as binary code numbers like 00101101. Everything you write is broken down to its base level - sets of zeros and ones that can be understood by the end machine.

If you are writing in a web formatting language like HTML or web scripting language like PHP, the process is a little different. Ultimately everything is still broken down into machine code so the processor can interpret it, but you are using a script rather than a full fledged compiled programming language. The script is run through the interpreter at the time the script is called, and translated into results on the browser screen. It is never compiled, rather it is a set of commands the browser is prepared to deal with when it is called. Stuff you dont really need to know at this point, but you might find interesting:

There are two main design processes languages use today : Functional/algorithm based and Object Oriented.

Functional program design was the standard for many years, and even today most things can be accomplished using a simple functional approach. The functional approach can be thought of this way: Ok, I have some data here. Do step one. Ok, do step two. Do I need to go to step three or four? Ok, go to step four. On and on until the program execution is completed. Sounds logical, eh? It is still the way I find easiest to understand programming for the beginner.

Objected oriented programming (OOP) is considered the new paradigm in program design. C++ and Java are both objected oriented languages, though you can still use them as functional languages. We dont think learning object oriented design should be a priority for the beginner this site is designed to get you where you want to go with minimal confusion, and trying to understand OOP is frankly quite confusing for the beginner. After the beginner understands functional programming and how it works, then perhaps trying to learn OOP and its benefits are justified. Frankly, most people never need to get that far to do what they want. If you have the intellectual curiosity, or the career need, you will continue on a course to OOP, otherwise it will just stall your progress in writing working programs that are useful to you. That being said, understand that OOP (when fully understood and used) allows what is considered a more elegant design and increased usefulness of your programs by advanced programmers (not beginners) and if you move on to writing more advanced programs you may likely work your way into OOP. Regardless of what some programmers might say, you can have a fully satisfying programming career without ever using OOP.

How do I program?
administrator Common Programming Questions

There are basically two steps to any program. Programming enthusiasts may disagree with me here, and as far as deep programming doctrine they would be correct. As far as the new user is concerned though, there are two steps you need to know right now. Write and compile.

Writing the program is the process of breaking out your instructions step by step and instructing the compiler to do those things in the proper programming language. Your first step is to figure out exactly what you want your program to do, step by step. It is helpful to write this out on paper (often called psuedocode). Once you gain more experience you will start to see the value in doing this, so dont worry too much about it right now. Keep in mind though when you write larger programs that have 10, 20, or even 100 or more steps and/or options available to the program or user, mapping everything out on paper first will be an invaluable tool. One you have your steps figured out, you will want to write your program in the language you have chosen. Whatever programming language you choose, it will have specific word and styles to do different things. Much like we use words and punctuation every day, so do programs. The good news is that it really doesnt take long to get familiar with a language and style. The bad news is most languages are quite different in the verbiage and punctuation! Dont worry about that for now though, your main goal is to become proficient in a language that is useful to you.

Compiling your program takes your written program in text form and translates it into an executable (usually) that can be run by the machine. For example, if you wrote a simple program to display a picture in a window, when you compile the program it takes the code you wrote and creates the executable command you click on in windows to run the program. When you run the program, the picture displays as you have commanded it to. After you write and compile, you will want to test your program to see if you are getting the desired results. If you arent getting the results you would like, you will then need to test your program you errors (commonly called debugging).

What do I need to know no matter what programming language I use?


administrator Common Programming Questions

There are some things you will need to use no matter what programming language you use. Listed below are some concepts that apply to most (if not all) languages. Read through them and you will start to get an idea what types of things you will need to learn to begin programming. If it seems like a lot right now, don't worry! The basic concepts you need to know you will learn one by one as you start programming. The concepts will build on each other until it all comes together and makes sense! Variables variables in programming are similar to variables you might remember from your algebra classes. Instead of just holding numbers, variables in programming can hold numbers or text (among other things). Commonly used variable types are: Integer a whole number (no decimal), Double or Float a number with a possible decimal, String a string of letters, words or numbers looked at as text, Boolean a variable that can be set to either TRUE or FALSE, useful in executing program controls once you get more involved in programming. Operators Operators are what you use in a program to work on a variable. Common operators are + (addition) , -(subtraction), /(division), *(multiplication), =(assignment of value, as in X=4), ++(increments an integer by 1), --(subtracts 1 from an integer). Braces {} - also called curly braces. These are used to control program flow. Everything in the braces is to be executed as a group. Functions Again similar to their usage in algebra, functions are used to do some work (often, but not necessarily, on a variable) to obtain a result. Include files Many languages use include files, and this is usually done at the top of the program code. Include files contain some information that the program needs to know in order to run the code contained in the program. Instead of copying all the code into the program (which can take up space and get complex), the compiler will look for the instructions on how to execute the item in the include files as well as the code you have written.

What standard programming languages are out there?


administrator Common Programming Questions

If you want to create programs that are executable on your computer, the languages below will apply.

As to what language to use, unfortunately the answer isnt usually clear cut. Its kind of like asking what you would like to major in in college. If you already know exactly what you want to do and why, you can work your way to an answer. If you dont know exactly what you want to do and why, there may be some experimenting involved.

Unless you have a specific need to use another language, I would recommend starting only with one of the below four languages: Visual Basic If dont mind limiting your applications to windows, and you want to create useful tools that will be relatively small scale, and you want something you can learn quickly and easily, Visual Basic is a great place to start. C If you are concerned about using your programs on operating systems other than windows, want a language that is very popular and well supported, and want to learn a more powerful programming language, C is a good place to start. C is a very powerful function based language that has been around for years. It is well supported, well documented and still in wide use today. C++ If you want to learn a very powerful and cross platform language that is the standard in large scale program creation today, C++ would be a good choice. C++ is an object oriented programming language, which is considered the new paradigm in languages (as opposed to a function based language like C). C++ can be used on a functional basis, and supports a lot of C code as well. Java If you want your programs to be internet based, or if you know you want your programs to run on multiple platforms, and/or you want to know what all the fuss is about, Java may be your best choice in language. Java may also be your best choice if you want to learn a more complex language and you will be the only one using your applications. We say that because in order to run your applications a user with need the java runtime software installed on their machine, and not all users will have it installed and/or know how to do so easily. There are pluses and minuses to starting here as a beginner. It isnt as easy to create visual based windows programs as other programming languages. It doesnt actually create executables, which is counter-intuitive for new programmer and most users. It does have its benefits though, as it is object oriented like C++ but it avoid some common traps that are likely to be difficult for beginners. Java is thought by some to be the wave of the future and is often taught by schools these days as the primary language of use, but VB, C and C++ are also widely used today.

Other languages you will hear mentioned often: COBOL COmmon Business Oriented Language is primarily used in big business applications that are data and text/number heavy. It is has been around for a long time and is still widely used, but short of wanting to learn it to get a specific job we dont recommend it for beginning programmers. C# - C Sharp is Mircosofts attempted answer to Java. It is relatively new, somewhat based on C/C++ and tries to incorporate some of the same internet functionality as Java without being cross-platform. We dont recommend this language for beginners, as it is not in widespread use at this point and is limited only to Microsoft operating systems. Pascal Pascal was designed as a language to teach good programming skills, as it requires a very disciplined approach when writing the code. Pascal is not considered as strong or powerful a language as C, C++ or Java. It is still in use today, but it not recommended for the pure beginner simply because the other languages mentioned are more supported and commonly used.

What languages do I want to use for Web programming? HTML HyperText Markup Language This is the standard language for web browsers to interpret information from the internet. All the formatting of text, pictures, colors, backgrounds, link creation, etc. is done in HTML. HTML is not very difficult to learn, and in fact there are many programs available that will do a lot of the coding behind the scenes for you. If you just want to create basic webpages, this is the route you will want to go. PHP PHP stands for PHP Hypertext Preprocessor notice the first P actually stands for PHP in the acronym, a little technique some creators like to use when naming their programs. PHP is a more advanced language for web display, and allows you to use variables as well as hide your code from the outside world. PHP also allows you to connect to databases in your webpages, allowing for more complex and interactive content than HTML. MySQL though not a web programming language, MySQL is a database programming language that is often used in conjunction with PHP to post web content. MySQL is a free for the personal user, and uses commands that actually seem logical when creating and accessing content. If you are going to create a webpage that needs a database for content (you may not know you need one, but depending on what you want to do you might), you are likely going to use MySQL on your webserver.

Glossary of common terms you will encounter as you learn programming:


administrator Common Programming Questions

Also see the "What do I need to know no matter what language I use?" section! Compiler A compiler is a program that reads the program you have written (the "code") and translates it according to the language specs into an executable program. Databse A database is a file that holds information in a structured way, in some respects similiar to a spreadsheet. They are often used in programming to store data and to retrieve that data back for use by the program. Algorithm An algorithm is a set of instructions or steps used to solve a problem. If someone asked you how to do something, and you told them to "do this, then this, then this, and if you see this do this" you have just given them an algorithm. Programs use algorithms to get results based on data.

Object Oriented Object Oriented Programming (OOP) is a recent trend in programming languages. OOP is a redesign of how programmers think about solving problems instead of using a function and algortihm approach, you think of the "objects" in the program and what they need to do. Don't worry too much about OOP concepts as a beginner. When it is time for you to learn them it will be obvious, and in some cases you may never have to. Platform Platform refers to the type of hardware and Opeating System you are creating software for. For example, Intel and Windows, or Mac and Mac OS.

What do I need to know to create useful programs?


administrator Common Programming Questions

First you need to know whether you want to create programs that run on your (or some other) computer, or if you want to write web pages that either just display information or have some functionality involved. If you dont really know yet, do not worry! The information on this site will give you a good background to figure out where you want to go.

You will find that most books and websites you encounter on programming generally show you text programs. This style of programming goes back to the days of prompt-based computing. Some of you may remember using DOS or perhaps a VAX system in school, where you had to enter commands on a command line (c:\>) to get things done. Since most programming languages were written when command line interface was the primary interface, many of the instructional manuals you will find use this method of teaching. You are probably much more interested in creating windows based programs, those that run in an open window in your current operating system. The windows and tools commonly used in the windows (menus, help files, open and save files, etc) are found in what is called an Integrated Development Environment (IDE). These environments provide the tools you can drag and drop into your programs so you dont have to write these types of tool from scratch - a very useful innovation. Given that most teaching texts stress the command line interface, this can be confusing for the person who is trying to learn and understand programming. You probably arent interested in writing command line interface programs, yet that is most of what is being taught. Rest assured, there are ways to easily write windows applications. Visual Basic is built to write Windows applications specifically. Languages like C and C++ werent designed for Windows specifically, but using IDE tools like Microsoft Visual C++ and Borland C++ Builder you can adapt your knowledge to Windows based programs.

If you wish to create webpages or programs that function on the web, you have a few roads you can choose. If you would just like to create webpages with text and graphical content, HTML is probably the best choice for you. If you want to create more interactive pages or pages with more advanced content, learning PHP and MySQL may be appropriate depending on what exactly it is you want to do. If you want to create rather advanced programs that use the internet to function, the more complex uses of Java may be what you are looking for.

How do I create a webpage and put it on the internet?


administrator Common Programming Questions

Your first step will be to design the content you want text, graphics, number of pages, etc. Once you do so, you can use an HTML editor (or a text editor for PHP/MySQL, etc.) to format the content the way you would like. Easy enough, right?

Your next step will be to figure out how you want the page hosted. If you have an aol account, they provide free webspace under an address like members.aol.com\yourscreenname\ and you can post your pages there. If you dont have aol, other hosts like geocities or tripod might offer free webspace, but understand that they will probably put advertising and/or popups on your site. When you get a free web host, you really get what you pay for. You can register your own domain name (like www.mywebspace.com) for about $15 per year and set up hosting for that domain with a web host using packages that start at about $5 per month. Be aware that the process varies per web host, so read their instructions carefully. Keep in mind that all hosts will support HTML, but if you want to use PHP or MySQL you will want to make sure the package you are buying supports what you want to use. This will usually be clearly listed in the package specs, and usually you will have to get the second package up (as opposed to the cheapest package) to get MySQL support.

Once you have purchased your package, your web host will give instructions on how to upload a page. If you purchased web hosting you will want to find a free FTP program to use to easily transfer files, Core FTP is one freeware/shareware program that is easy to configure and use, but there are many others. The web host will give guidance on how to configure the FTP client and send the pages to their server to be seen by the world. Database creation if you are going to be using MySQL for database access, you will need to create and set up the database for use. Your web host will provide instructions on how to create the database on their server, and you can connect to the database and create tables on it using PHP scripts.