Skip to content

Instantly share code, notes, and snippets.

@humorless
Last active August 4, 2022 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save humorless/6d92ed4b2abaa7b6979b34f9c041fbe2 to your computer and use it in GitHub Desktop.
Save humorless/6d92ed4b2abaa7b6979b34f9c041fbe2 to your computer and use it in GitHub Desktop.
The web application challenges & solutions

The Heretic Web Application Technical Stack

應用軟體開發是很容易遇到坑而做不好、做不快,容易犯下所謂的應用軟體開發七宗罪

需要的 technologies

  1. Software Spec - Event modeling method
  2. Evaluation - The four key metrics
  3. Frontend - htmx
  4. Backend - Clojure
  5. Database - Postgres
  6. Deploy - PaaS

lesson 1: Challenges of the software spec

  1. time
  2. event
  3. the interaction with other parties
  4. use cases
  5. explain the problems first, then the solutions

lesson 2: Challenges of the UI

  1. Reduce the complexity
  2. Increase the responsiveness
  3. Maintain the Consistency & Style
  4. How to handle API Churn?
    • GraphQL
    • Separate two types of APIs: generic API & application API

lesson 3: Error Prevention - part 1

  1. Types
  2. Assert
  3. Schema Validation & Constraints
    • system input schema validation

lesson 4: Error Prevention - part 2

  1. unit test
  2. dependency injection
  3. integration tests
  4. Legacty code change algorithm
  5. Testing SQL

lesson 5: Log messages design

  1. log level
  2. context
  3. make the errors evident

lesson 6: How to debug

lesson 7: Functional Programming

  1. rules of abstraction
  2. map/filter/reduce
  3. immutable collection & PLOP
  4. combinator
  5. variant
  6. tree walk interpreter

lesson 8: Web basic

  1. Authentication & Authorization
    • ngrok or other third party services
    • web handler - sesssion & cookies
  2. Chrome debugger
  3. Web handler middleware
    • query string & cookie
    • formatting
    • status code

lesson 9: SQL

  1. psql basics: \dt, \dv, \dn, \du, \i, \?, \l, \c, \cd, \!
  2. copy to/from CSV
  3. 4 種 SQL 的基礎語法: select *, select columns, where, join
  4. group by, order by, aggregation functions
  5. 1Keydata SQL tutorial
  6. NULL, COALESCE, CASE
  7. created_time, updated_time & Trigger
  8. window function
  9. self-join

interlude

  • Where to put business domain logic?
    • Application Layer
    • DB layer
    • My answer: Split the domain logic into two part. Put fast changing part into application layer and slowly changing part into DB.

lesson 10: Performance issues

  1. Diagnosis Tools: top, SQL explain, logs
  2. IO problems
  3. threads vs event loop
  4. full page cache vs SQL index

lesson 11: OS & VM

  1. cronjob
  2. shell scripts
  3. byte code, JIT
  4. The utility of JVM
    • monitoring memory
    • specifiy arguments
    • leverage the graalvm

lesson 12: Deployment & 12 factor App

  1. Monolithic vs Microservices
  2. dependency declaration & separation
  3. stateless process
  4. single git repo for monolithic app
  5. separate git repo for library
  6. environment variables & configuration files

參考資料:

  1. 如何做技術決策
  2. 如何 debug
  3. 如何提高 developer productivity, 影片連結
  4. 關於學習軟體開發的迷思
  5. Clojure學習之路
  6. 解密函數式編程
  7. Elements of Clojure書摘
  8. 「敏捷軟體開發」並不敏捷
  9. 如何做好客製化軟體委外開發
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment