Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
121 lines (74 sloc) 5.7 KB

labels: Blog SoftwareDevelopment created: 2016-12-22T22:25 modified: 2017-09-14T10:12 place: Phuket, Thailand comments: true

Software development terms

[TOC]

See also Principles from software development and DynamoDB in examples, Example 1.5: Distributed system terms.

Accidental complexity

Complexity is accidental if it is not inherent in the problem that the software solves (as seen by the users) but arises only from the implementation.

"Out of the Tar Pit" by Ben Moseley and Peter Marks

Async frameworks

Async frameworks use a single thread as much as possible. Uses modern operation system's IO multiplexing functions: select(), poll() and epoll(). If we are single-threaded, we don't suffer the costs of context switches and save resources that extra thread requires.

The largest benefit of single thread is code simplicity, writing thread-safe code is more difficult.

Code smell

Code smell - a symptom of bad OO design. Smells are certain structures in the code that indicate violation of fundamental design principles and negatively impact design quality.

Complex universal vs simple specific

Vote for simple specific. KISS.

Composition vs inheritance

Favor object composition over class inheritance.

Design Patterns by Gamma et al.

Concurrency vs parallelism

Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once. Not the same, but related. One is about structure, one is about execution. Concurrency provides a way to structure a solution to solve a problem that may (but not necessary) be parallelizable.

Rob Pike, Co-inventor of the Go language

Deterministic

The same operation produces the same result.

Duck typing

When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.

James Whitcomb Riley

A form of polymorphism where functions operate on any object that implements the appropriate methods, regardless of their classes or explicit interface declarations.

Functional programming

It is a declarative programming paradigm, which means programming is done with expressions.

Hacker

A hacker - someone who strives to solve problems in elegant and ingenious ways.

Implementation vs interface

The design must be simple, both in implementation and interface. It is more important for the implementation to be simple than the interface. Simplicity is the most important consideration in a design.

Richard P. Gabriel, The rise of Worse is Better

Large and complex

There are two schools of thought about teaching computer science. We might caricature the two views this way:

  • The conservative view: Computer programs have become too large and complex to encompass in a human mind. Therefore, the job of computer science education is to teach people how to discipline their work in such a way that 500 mediocre programmers can join together and produce a program that correctly meets its specification.
  • The radical view: Computer programs have become too large and complex to encompass in a human mind. Therefore, the job of computer science education is to teach people how to expand their minds so that the programs can fit, by learning to think in a vocabulary of larger, more powerful, more flexible ideas than the obvious ones. Each unit of programming thought must have a big payoff in the capabilities of the program.

Brian Harvey and Matthew Wright, Preface by Simply Scheme

Lazy implementation

A lazy implementation postpones producing values to the last possible moment. This saves memory and may avoid useless processing as well.

Programming

Programming is science dressed up as art because most of us don't understand the physics of software and it's rarely, if ever, taught. ... This is the science of programming: make building blocks that people can understand and use easily, and people will work together to solve the very largest problems.

zguide

Thread safety

Thread-safe code is code that will work even if many threads are executing it simultaneously within the same process.

Thread safety is a computer programming concept applicable to multi-threaded code. Thread-safe code only manipulates shared data structures in a manner that guarantees safe execution by multiple threads.

Software libraries can provide certain thread-safety guarantees. For example, concurrent reads might be guaranteed to be thread-safe, but concurrent writes might not be:

  • Thread safe: Implementation is guaranteed to be free of race conditions when accessed by multiple threads simultaneously
  • Conditionally safe: Different threads can access different objects simultaneously, and access to shared data is protected from race conditions
  • Not thread safe: Code should not be accessed simultaneously by different threads

Ways to achieve thread safety:

  • avoid shared state (thread-local storage, immutable objects)
  • synchronization (ensure only one thread writes or reads the same data at any time, atomic)

See Thread Synchronization Mechanisms in Python.

Ugly code

Ugly code hides problems and makes it hard for others to help you. You might get used to meaningless variable names, but people reading your code won't. Use names that are real words, that say something other than "I'm too careless to tell you what this variable is really for". Use consistent indentation and clean layout. Write nice code and your world will be more comfortable.

zguide