Knowledgebase

Language Features: Everything That Matters, Briefly Print

  • programminglanguages, programming, performance, guide, howto, solution, zillionkinghost, hosting
  • 0

The summary.

CHOOSE DATA STRUCTURES BY THE OPERATIONS YOU PERFORM MOST

Looking up by key in a sequence examines every item; in a mapping it does not. The wrong structure turns fast code slow at scale.

Never use floating point for money, in any language.

UNDERSTAND WHAT YOUR LANGUAGE ACTUALLY PASSES

Most pass references by value: reassigning the parameter does not affect the caller, but modifying what it points to does.

PREFER COMPOSITION OVER INHERITANCE, AND EXPOSE BEHAVIOUR RATHER THAN DATA

Deep hierarchies become rigid, and exposed internal state defeats the ability to change anything.

ADOPT THE FUNCTIONAL IDEAS REGARDLESS OF LANGUAGE

Minimise changing shared state, prefer pure functions, and use map, filter and reduce — they state intent rather than mechanics and eliminate index errors.

USE EARLY RETURNS INSTEAD OF DEEP NESTING

It puts the main path at one level of indentation.

STREAM LARGE DATA RATHER THAN LOADING IT

The failure from loading entirely appears only with real data, in production.

ONE CHARACTER IS NOT ONE BYTE

Truncating by byte count can split a character, and case conversion and sorting are locale-dependent. Always specify the encoding when reading and writing.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot