Difference between revisions of "Computer Programming"
m (Correct link)
|Line 42:||Line 42:|
===Object Oriented Programming===
===Object Oriented Programming===
[[Object Oriented ]] is a methodology that uses the concept of classes to more easily modularize code. Most modern [[programming language]]s support Object Oriented Programming.
Latest revision as of 13:57, 12 December 2019
Computer programming is a subset of Computer Science and is related to Software Engineering. Computer programming is the act of creating computer programs to perform tasks ranging from simple calculations to complex games. .
Various studies have found that programmers with a comparable amount of experience may differ in skill levels by a factor of 10 or more.
A lot of free software (of varying quality) is available via the internet which allows one to experiment with many different programming languages.
Computer programming has great demand on the labor market, and is signed with the great differentiation in the salaries when comparing to other industries. 
- 1 Program Development Stages
- 2 Programming Approaches
- 3 Programming Tools
- 4 Prerequisites
- 5 Other development considerations
- 6 See also
Program Development Stages
Program development, no matter what size or target behavior, follows the same set of steps. In a small shop, a single programmer may be responsible for all stages. In a large company, one or more people (or separate groups) can be assigned to each stage.
This stage of programming is the planning stage. It can range from simple ideas to exhaustive specifications. Design includes both that of user interface and of program functionality. Poor design can result in programs that are ill-suited for the purpose for which they were written. It can also lead to programs that are difficult to debug or enhance.
This stage has to do with writing the source code necessary to implement the design. The end point of this stage is called "code complete".
Once code has been completed, it is necessary to verify that it works properly. If it doesn't operate according to the design, it must be corrected, which is the next step. Regression testing is a specific type of testing that is used to ensure that once working functionality has not been compromised by later changes. Regression tests are typically written once and then used to make sure the program has not regressed after debugging.
As flaws become apparent, either from the testing stage or as the program is used, the code must be corrected to eliminate those flaws (called "bugs"). Even with good design and good code, additional bugs can be created as old ones are fixed. Therefore, it is necessary to repeat the testing stage. In fact, the test/debug steps are usually repeated several times: first by the coder to ensure basic correctness, then by others (usually termed "alpha testing"), and sometimes by end users (called "beta testing").
End-user documentation may be written as part of the design, although it is typically written in conjunction with the above development steps, or sometimes afterwards.
At some point, the program is deemed sufficiently free of misbehavior and can be released to the target audience. The details of this process vary depending upon the program itself and the platform upon which it runs. For instance, release on Microsoft Windows may require creating an installation package.
Most useful programs will need enhancements over time to meet changing needs, hardware/software platforms, and competitive pressures. When this is needed, the above development steps are repeated, starting with the design of which enhancements to add or change. This ongoing cycle of development is called code maintenance.
While there are many guidelines, there are no rules which are guaranteed to produce a correct and usable program, so programming is very much an art or skill rather than a science. Furthermore, a programmer must pay meticulous attention to detail: a moderately large program of say 150,000 instructions must be completely free of punctuation errors, grammatical errors, and spelling mistakes, and must also be largely free of logical errors (as a size comparison, a 400-page paperback book contains about 16,000 lines - 1/10th the size). Despite handling all the details, a programmer must also keep an eye on the wider picture so that all parts of a program contribute effectively to the desired end result. Various programming approaches have been developed to reduce errors, development time, and maintenance costs. These can be used independently or in combination.
Modularization is the approach of breaking a program into several different parts ("modules"), each of which performs some specific part of the overall task. Modularization methods differ depending on the tools available, but in general the source for each module is in a different file. Modularization implies hiding the actual implementation of a task behind an interface that remains unchanged even as the underlying code changes.
This is a specific type of Modularization where a module (or a set of modules) takes care of one aspect of some processing (called a "layer") and passes it on to another layer. Typically the lowest layer directly interfaces with the hardware or software platform, while the highest layer interfaces with the program's user. These layers (sometimes collectively called a "stack", not to be confused with the data structure of the same name) are strictly designed so that a given layer only interfaces directly to the layer immediately above and the layer immediately below.
Object Oriented Programming
This approach involves writing the highest-level code first, assuming working functions to support it. Then the assumed code is written, again assuming even lower-level functions to support it. The process is repeated until the entire program is written.
This approach involves writing the lowest-level code first, then writing the code that makes use of it. This process is repeated until the uppermost levels of code are written.
Programming tools are programs that aid in the process of programming and the development stages described above.
An editor is used to create the source code statements. Some editors are context-sensitive for a given programming language which makes it easier for the programmer to catch mistakes early in the process.
Once source code is finished, another program is used to translate the human-friendly source code into something that the computer can execute, directly or indirectly. This program is called a Compiler or assembler. Each compiler is specific to a particular programming language and each assembler is specific to a particular CPU.
A linker is a program that combines several pieces of programs into a single executable file. Many compilers incorporate a linker so that this is less and less a separate tool.
The Integrated Development Environment is a program that combines all of the above tools to speed development.
Testing tools include source code that can be included in a program to help test for correctness (such a NUnit), or programs that can perform static analysis of source code to find problem areas (such as lint), or programs that can instrument a program to allow run-time analysis for either testing or performance analysis. Source code coverage analyzers can be used to verify that test suites exercise every line of source code. GUI testing programs can be used to simulate user operations on the interface including mouse moves, key presses, button clicks, etc. for the purposes of regression testing.
Version control programs are used to track how changes have occurred over time to source code. They can also be used to coordinate several programmers who are accessing the same set of source code to prevent them from overwriting the changes of other programmers who were modifying the same code at the same time.
Documentation tools can range from simple word processing programs to programs which extract information directly from source code to aid in documenting the program.
In order to write a program, the programmer needs a working knowledge of the following items.
The programmer must understand the problem to solve. For instance, some basic knowledge of physics would be required to write a physics simulation. Programmers must also understand the platform(s) under which the program is to operate, including the operating system, industry standards, and sometimes the hardware itself. Lastly, some graphics design knowledge may be required in order to create a "user-friendly" interface to the program.
Analysis and Design
Proper identification of what the program is intended to do and how to break down the task into smaller subtasks in order to accomplish this. This is independent of the programming language or other tools used to code.
Coding and Tools
The programmer must understand the Programming Language he is using (or the CPU architecture if programming in assembly), and how to use the compiler, assembler, IDE, and/or other tools necessary to build the executable file.
Other development considerations
Programming involves trade offs between performance, code maintainability, and footprint. It is rarely possible to achieve desired goals in all these areas. For instance, higher performance code may require more memory/disk resources (footprint), or more complicated code. More complicated code can be harder to maintain. An experienced programmer has learned how to juggle these requirements to create programs that are acceptable in all areas, even if not ideal.