raymondworkshop / dev.programming

On how to design programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

programming

  • programmers combine primitive elements to form compound objects, they abstract compound objects to form higher-level building blocks, and they preserve modularity by adopting appropriate large-scale views of system structure.

    • primitives -> compound objects -> higher-level blocks -> module -> system
  • Metalinguistic abstraction — establishing new languages

    • Establishing new languages is a powerful strategy for controlling complexity in engineering design
    • enhance our ability to deal with a complex problem by adopting a new language that enables us to describe (and hence to think about) the problem in a different way, using primitives, means of combination, and means of abstraction that are particularly well suited to the problem at hand

Python

  • Python provides a kind of "domain language" for thinking about your problem

    • Python Data Model, and its API to make our own objects

      • The built-in operators and expressions are at the core of that language and everything else builds from it.

      • we leverage the Python Data Model to build new classes

        • implement special methods when we want out objects to support and interact with fundamental language constructs
        • the Python interpreter invokes special methods to perform basic object operations
    • one you build a kind of intuition around python's built-in objects and operations, you will find that your intuition applies everywhere

  • Object, and Protocols

    • everything in Python is first-class
    • All objects can be treated as data

tips

  • ipdb debugger

    import ipdb; ipdb.set_trace()

    python -m ipdb X.py

  • env

    python3 -m venv programenv
    source programenv/bin/activate
    deactivate

  • common commands on vim

    • :sp (:split) -> split vim the window horizontally
    • :vsp (:vsplit) -> split vim window vertically
    • Ctrl + wj -> move cursor to the window below (horizontal split)
    • Ctrl + wk -> move cursor to the window below (horizontal split)
    • Ctrl + wh -> move cursor to the left window (vertical split)
    • Ctrl + wl -> move cursor to the right window (vertical split)

reference

About

On how to design programs


Languages

Language:Python 66.5%Language:Racket 30.2%Language:JavaScript 3.1%Language:Scheme 0.2%