Basics of Programming

Posted by moodyharsh on 2016-06-06

Programming is an activity of designing Software Applications and Interactive Media.

A Software Application is a Control System with Digital Interfaces suited for the particular Domain.
Data, Components and Flows constitute the Constrol System of the Software .

Data

  • ER / Binary / XML / Object / EAV / File
  • Queries / Commands
  • Serialization
  • Storage and Caching
  • Indexing / Searching / Tagging / Learning
  • Compression
  • Ontology
  • Analytics
  • Events / Messages
  • Logs
  • ETL
  • Snapshot + Restore
  • State / Context / Session
  • Protocol / Format
  • Language + Parsing + Validation

Components

An Active Component has a

  1. A life cycle
  2. A way to get inputs and interrupts
  3. An execution body
  4. A way to delegate outputs
  5. A way to trigger events and alerts

Execution body is made of

  • System Calls and Instructions
  • Decisions and Loops
  • Arithmetic
  • Passive Components

A Passive Component is just made of execution body.

A set of Related Components is a Module.
Module manages dependencies and Component locations as well.

Active Components can be,
Reactive
Asynchronous
Synchronous
Controller
Proxy
Feedback
Feedforward
Scheduler
Router
Filters
Validators
Transformers
Authentication
Authorization
Source
Sink

User Interfaces

  • Forms / Widgets
  • Layouts
  • Scene
  • Graph

Flows

Flows are Data Driven on Demand Driven.
Flow occurs between component couplings.
Data flows across a coupling.

How to build components and flows ?

Function is a Passive Component.

Activte components can be built with the following,

  1. Recursion
  2. Mutual Recursion
  3. Co-Routines
  4. Automata
  5. Tables
  6. Threads / Processes / Active Objects
  7. Objects with a single public method

Passive Component Coupling

  • Function Calls
  • Function Pointers
  • Continuations
  • Promises
  • Closures

Active Component Coupling

  • Messaging
  • Memory
  • Wire
  • Interceptors / Delegates

User Interface Coupling

  • Observers

Remote

  • RPC
  • Half Objects
  • Request / Response

State

Never store state inside a Component. State should either be stored in Data or in transient Event objects.
Object Oriented Programming encourages storing State. DO NOT FOLLOW IT. Object Oriented Programming is an excellent choice for ADTs.

Programming

  1. Gather User Stories
  2. Map User Story to an Interface
  3. Design Data
  4. Couple User Interfaces to Observers and Observers to Components
  5. Couple Components
  6. Simulate / Demo
  7. Repeat

Characteristics of Software

  • Size
  • Speed
  • Bandwidth
  • Memory
  • Scale
  • Complexity
  • Leaks
  • Entropy
  • Cascades
  • Uptime
  • Cost
    Training

Deployment

  • Build
  • Version Control
  • Horizontal and Vertical Scaling
  • Upgrading

Testing Software

  • End User Simulation
  • Stress Testing
  • Edge Case Testing
  • Security Testing
  • Component Testing
  • Component Internals Testing
  • Tracing
  • Logging

Naming Conventions

Data / Events Should follow structural Naming Conventions.
Components are AdjectiveVerbs
Couplings are VerbNouns

Files should be organized by

  • Base
  • Data Models
  • Components
  • Passive Components
  • Main Component
  • User Interfaces
  • Simulations