Computer Programming

From Computing Concepts
Jump to: navigation, search

Chapter Overview

Programs are developed and used in a variety of ways by a wide range of people depending on the goals of the programmer. Programs developed for creative expression, such as animating a story you wrote, or to satisfy personal curiosity, such as a program you write to process data to make a fantasy sports league pick, may have visual, audible, or tactile inputs and outputs. Programs developed for creative expression or to satisfy personal curiosity may be developed with different standards or methods than programs developed for widespread distribution, such as an app game that you intend to sell online.

Programming allows you to realize additional desired outcomes independently of the original purpose of the program. For instance, using Macro programming you can have Excel produce computations that are unique to your use of the spreadsheet.

A computer program or the results of running a program may be rapidly shared with a large number of users and can have widespread impact on individuals, organizations, and society. For instance, you can publish the results of running game development software (the game software) on the Internet and have your game immediately available to the world.

Advances in computing have generated and increased creativity in other fields. For instance, animation has spurred creative leaps in the movie industry, and video has motivated creative approaches to teaching including flipped classrooms.

An iterative process of program development helps in developing a correct program to solve problems. Developing correct program components and then combining them helps in creating correct programs. Incrementally adding tested program segments to correct; working programs helps create large correct programs.

Program documentation helps programmers develop and maintain correct programs to efficiently solve problems. Documentation about program components (such as blocks of code and functions) help in developing and maintaining programs. Documentation helps in developing and maintaining programs when working individually or in collaborative programming environments. Below is a picture of comments that describes each line of code.

Comments.png

Program development includes identifying programmer and user concerns that affect the solution to problems. Consultation and communication with program users to gather their requirements and preferences is an important aspect of program development to solve problems.

A programmer’s knowledge and skill affects how a program is developed and how it is used to solve a problem. For instance, if the programmer is skilled in the SQL database access language, she might be better to solve data analysis problems that a programmer who is not. A programmer designs, implements, tests, debugs, and maintains programs when solving problems.

Collaboration in the iterative development of a program requires different skills than developing a program alone. Collaboration among several programmers can decrease the size and complexity of tasks required of individual programmers. Collaboration facilitates multiple perspectives in developing ideas for solving problems by programming. Collaboration can make it easier to find and correct errors when developing programs - one programmer may see errors that another doesn't. Collaboration facilitates developing program components independently - that is a team can split development so that smaller groups each develop their own components of a larger program and then integrate their components to achieve the final program. Effective communication between participants is required for successful collaboration when developing programs.

Algorithms

People write programs to execute algorithms, as described in the Algorithms section of this book. Algorithms are implemented using program instructions that are processed during program execution. Program instructions are executed sequentially. Program instructions may involve variables that are initialized and updated, read and written.

An understanding of instruction processing and program execution is useful for programming. Program execution automates processes. Processes use memory, a central processing unit (CPU), and input and output. A process may execute by itself or with other processes. A process may execute on one or several CPUs.

Executable programs increase the scale of problems that can be addressed. Simple algorithms can solve a large set of problems when automated. Improvements in algorithms, hardware, and software increase the kinds of problems and the size of problems solvable by programming.

Abstraction

Programming is facilitated by appropriate abstractions. The process of developing an abstraction involves removing detail and generalizing functionality. An abstraction extracts common features from specific examples in order to generalize concepts. An abstraction generalizes functionality with input parameters that allow software reuse.

Software is developed using multiple levels of abstractions such as constants, expressions, statements, functions/procedures, and libraries. Functions and procedures reduce the complexity of writing and maintaining programs. Functions and procedures have names and may have parameters and return values. Being aware of and using multiple levels of abstraction in developing programs helps to more effectively apply available resources and tools to solve problems.

Different programming languages offer different levels of abstraction. High-level programming languages, like Java and JavaScript, provide more abstractions for the programmer and are easier for humans to read and write a program. Code in a programming language is often translated into code in another lower level language to be executed on a computer. In an abstraction hierarchy, higher levels of abstraction (the most general concepts) would be placed toward the top and the lower level abstractions (the more specific concepts) toward the bottom.

Parameterization (e.g. the parameters that are passed to a function) can generalize a specific solution. Parameters generalize a solution by allowing a function to be used instead of duplicated code. Parameters provide different values as input to procedures when they are called.

Data abstraction provides a means of separating behavior from implementation. For instance, most programming language provides arrays or list data structures. The programmer can use these structured data types to manage multiple data values without knowing how the computing devices actually stories the data.

Application program interfaces (APIs) and libraries simplify complex programming tasks. Documentation for an API/library is an important aspect of programming. APIs connect software components, allowing them to communicate.

Data Types

Strings and string operations, including concatenation and some form of substring, are common in many programs. Integers and floating-point numbers are used in programs without requiring understanding of how they are implemented. Lists and list operations such as add, remove, and search are common in many programs. Using lists and procedures as abstractions in programming can result in programs that are easier to develop and maintain.

Programming uses mathematical and logical concepts. Numbers and numerical concepts are fundamental to programming. Integers may be constrained in the maximum and minimum values that can be represented in a program because of storage limitations. Real numbers are approximated by floating-point representations that do not necessarily have infinite precision. Mathematical expressions using arithmetic operators are part of most programming languages.

Logical concepts and Boolean algebra are fundamental to programming. Compound expressions using AND, OR, and NOT are part of most programming languages. Intuitive and formal reasoning about program components using Boolean concepts helps in developing correct programs.

Computational methods may use lists and collections to solve problems. Lists and other collections can be treated as abstract data types (ADTs) in developing programs. Basic operations on collections include adding elements, removing elements, iterating over all elements, and determining whether an element is in a collection.

Best Practices and Debugging

Programs are developed, maintained, and used by people for different purposes so programs have to be written well. Program style can affect the determination of program correctness. Duplicated code can make it harder to reason about a program. Duplicated code should be abstracted and implemented as a function or procedure. Meaningful names for variables and functions/procedures help people better understand programs. Longer code blocks are harder to reason about than shorter code blocks in a program.

Locating and correcting errors in a program is called debugging the program. Knowledge of what a program is supposed to do is required in order to find most program errors. Examples of intended behavior on specific inputs help people understand what a program is supposed to do. Visual displays (or different modalities) of program state can help in finding errors.

As part of the programming process, programmers justify and explain a program’s correctness. Justification can include a written explanation about how a program meets its specifications. Correctness of a program depends on correctness of program components, including code blocks and procedures. An explanation of a program helps people understand the functionality and purpose of a program. The functionality of a program is often described by how a user interacts with the program. The functionality of a program is best described at a high level by what the program does, not at a lower level of how the program statements work to accomplish this.

References

Parts of this page are based on information from: Wikipedia: The Free Encyclopedia