Skip to content

Instantly share code, notes, and snippets.

@wallymathieu
Created February 27, 2016 22:19
Show Gist options
  • Select an option

  • Save wallymathieu/278aabb4b4828b86712d to your computer and use it in GitHub Desktop.

Select an option

Save wallymathieu/278aabb4b4828b86712d to your computer and use it in GitHub Desktop.
Analysis of source code

Global Structure

Location of code

  • Is the code located such that reading at one location is sufficient to understand it? Or is it located in many locations?
  • Is there any external documentation (wiki, onenote or word files)?
  • Use of libraries with intuitive API

How do you start reading the code?

  • wiki
  • readme
  • tests or example code

How does the authors make use of files and folders to structure the program or library?

  • Namespaces and folders
  • Classes and files

How does the authors make use of libraries and modules?

Local Structure

Abstract versus concrete code

Use of constructs common to a specific language

  • Class && Method
  • Functions
  • Lambda
  • Generators
  • for
  • while
  • switch
  • Pattern matching
  • Destructuring
  • DSL embedded in the language (xml - vb.net, html - react jsx and sql like syntax in c#)

Also you see a lot of patterns that are in the base libraries, thus get repeated in user code.

What kind of words are used to describe patterns in the language and in the code? For instance:

  • property
  • attribute
  • member variable
  • field

What kind of algorithms are used in the code? Are they recognized or named such that people can find a description?

Context of execution

  • Installation
  • Execution (how it interacts with users)
  • Network (what kind of services, web sites et.c. not local to the machine are assumed to exists)
  • Organization (what roles and people are required in order for the use of the software to make sense)

Domain, algorithm or technical solution (intent of program or library)

  • How clearly is it expressed?
  • What kind of things are muddled or removed from a domain
  • Can we see the intent of the programmer? Does the intent and the execution coincide? Is it OK due to local confusion unintentionally causing the right behaviour in certain cases?
  • How clearly can we see the relation between observed behaviour and written behaviour?
  • Is the type system used in order to aid semantics?

Correctness of the program

  • Is the type system used in order to avoid bugs
  • Static code analysis
  • Manual verification (documents describing the expected behavior that you can manually execute)
  • Unit, integration testing et.c. How are these things used?

Historical perspective

  • Who wrote it? Is it a javascript library written by java programmers, thus influenced by the style and patterns common to that language?
  • Does the code align with patterns, structure et.c. that where prevalent during a time and in a community? For instance in litterature is it a well written limerick?
  • In what context was the work written? For instance, what kind of restrictions influenced how it was written?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment