Saturday, December 22, 2012

What Programming Style(s) Do You Use?

So, what programming style(s) do you use?
A programming style (aka, paradigm) can be considered the approach (i.e. the techniques and styles) used to write a program. Its key characteristics include the concepts and abstractions used to represent the basic elements of a program (such as its variables, methods, objects, etc.), and the steps that make up a computation (assignment, evaluation, continuations, data flows, etc.).  Several common programming paradigms are:
  • Declarative programming focuses on describing what something is by identifying its attributes and characteristics, defining its mathematical relations, specifying its rules, etc. A programming expression written with a declarative programming language is referentially transparent; this means that it always produces the same result for a given set of inputs and doesn’t modify the state of another part of the program.
  • Functional programming is a type of declarative programming that emphasizes the creation of computer programs as referentially transparent mathematical functions.
  • Imperative programming defines solutions through sequences of commands for a computer to perform.  In contrast to functional programming, imperative programming defines a program in terms of its state (i.e. memory). In addition, unlike declarative programming it can modify state.
  • Structured programming aims to improve the clarity, quality, and development time of a program by making extensive use of program flow structures. OOP is a style of structured programming that combines data with the operations you can perform on that data.
Once you know the type of program you want to develop, then you can more readily determine the programming paradigm(s) for the program and then use a programming language that supports that paradigm.

For example, what type of language would be a good choice for creating an electronic library card catalog? Since a card catalog provides information on a book such as its name, description, location in the library, etc. (in other words descriptive information), then a language that supports declarative programming would be a good choice. If you need to create a program that solves a given set of linear equations for a set of inputs (i.e., mathematical functions), then a language that supports functional programming would be appropriate. On the other hand, if you need to create a program that will be used to perform inventory management for a library (place orders, support different types of inventory items [e.g. books, electronic media], track shipping, etc.) then an OOP language might be appropriate.

In summary, consider choosing your programming language based on the programming paradigm(s) it supports.

Programming for Everyone is designed to give the reader an introduction to computer programming. The book is written for a very general audience and focuses on providing you with a detailed understanding of the basic concepts.  It's also great for programmers who want to learn about other programming areas (e.g. logic programming, computer graphics, games, etc.) they may not have experience in.  Whatever your age or background, Programming for Everyone will help you to understand computer programming!


No comments:

Post a Comment