Fundamentals 8 min read

A Programming Language Is a System for Encoding, Naming, and Organizing Algorithms

The article explains that a programming language serves as a system to encode, name, and organize algorithms, discusses the misuse of the term “algorithm,” illustrates classic algorithms like Dijkstra’s and Euclid’s with code examples in Forth, PostScript, and Python, and emphasizes the DRY principle and efficiency concerns in software development.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
A Programming Language Is a System for Encoding, Naming, and Organizing Algorithms

A programming language is a system for encoding, naming, and organizing algorithms.

“Don’t repeat yourself” is a common mantra in the programming world.

People often use the word “algorithm” to sound knowledgeable about technology, but journalists who talk about “Facebook’s algorithm” or “Google’s algorithm” are usually referring to the software itself.

An algorithm does not have to run on a computer; it is a method for solving problems. Great algorithms have names, such as Dijkstra’s algorithm, which finds the shortest path in a graph (a network of nodes and edges, like a map of streets).

Graphs appear everywhere—in maps, water pipes, circuits, code compilation, social networks, and the Internet—so understanding them can be valuable.

Many algorithms have dedicated Wikipedia pages. For example, Euclid’s algorithm computes the greatest common divisor of two numbers (e.g., 16 and 12) by repeatedly applying division and remainder operations.

Rosetta Code is a website that demonstrates many algorithms in different programming languages. The Euclidean algorithm page contains a variety of examples, including a quirky Forth version:

: gcd ( a b -- n ) begin dup while tuck mod repeat drop ;

Forth is built on the concept of a stack, a special data structure that allows words (functions) to manipulate stack elements. PostScript, a language used by laser printers, is similar to Forth. An example in PostScript looks like this:

/gcd { { {0 gt} {dup rup mod} {pop exit} ifte } loop }.

The same algorithm in Python (taken from Rosetta Code) is:

def gcd(u, v): return gcd(v, u % v) if v else abs(u)

A programming language therefore provides a reusable collection of algorithms that can be called by software. Algorithms may serve image processing, data‑storage efficiency, fast list lookup, and many other purposes, and most of them are freely available as libraries on the Internet.

Computer scientists are not merely “math geniuses”; they need to understand algorithmic efficiency—how long an algorithm takes to run. Companies such as Google, Facebook, and Twitter rely heavily on efficient algorithms because they handle massive numbers of user actions.

When a program must perform billions of operations, even a nanosecond of latency adds up, making efficiency a critical cost factor.

Programming’s hardest challenge is handling tasks that cannot be directly computed, breaking them into small, feasible components, and giving the illusion that the computer is doing something it actually isn’t—this area is often called artificial intelligence or machine learning.

Thus a programming language has at least two fundamental responsibilities: to house a large collection of reusable algorithms, and to make it easy for programmers to add new algorithms and routines for future reuse. The “Don’t Repeat Yourself” (DRY) principle embodies this idea, encouraging single definitions for names and functions.

In short, a programming language’s core tasks are to collect reusable algorithms and to enable programmers to extend that collection efficiently.

Source: Business Weekly

software engineeringprogramming languagesAlgorithmscode examplesDRY principlealgorithm efficiency
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.