###### tags: `WebHack#34` # When learning a new programming language Speaker: __Greg Weng__ Slides: https://tinyurl.com/y7ebvyu2 ## Talk ### I love programming languges - I've learnt Java, ruby, python, Elm, Go, Haskell ### Show the diagram from a simple statement - My **mind map** whien learning a new programming language ![](https://i.imgur.com/ToLLwS5.jpg) - If language doesn't have `Maybe` or `Optional` feature you'll get `NullPpoin` feature ### Program = symbls = macro (LISP one) - |Looks like | Symbols | |f x = x + y | [=,[f,[x]],[+,[x,y]] | - Every thing you write and read is from symbols ### Walls in any language without LISP macro 1. No way to easily and freely implement AOP, decorator, runtime analytic tools, and etc 2. Need language natively support them 3. Another way to workaround this issue is binary hack 4. Language...... ### Program = symbols run on a logic machine - | Looks like | The machine does | |-------------|-----------------------------| | f x = x + y | 1. Find `+` in symbol table | | | 2. Find & get value of `x` | | | 3....and etc. | ### Implicit type info = how it can be used > what it is 1. Dynamatically typed language 2. Statically typed language ### No strong type inference = explicit - | Need to tell | Means | |----------------|-----------------| | x is addable | 1. Even types are so trival you still need to write everything done | y is addable | 2....and etc | f() is addable | | f x = x + y | - Dynamically typed language, Statically typed language, Dumb typed language ### Generic, or duplicated code + casting - Don't repeat yourself and don't do the machine's jobs ### State management - Program = symbol + type + value - Value is the state of a program - Immutable = Channing input/output Mutable = Changing black box ![](https://i.imgur.com/WM32eI3.png) ### Effect management = why <something> can be here - | One simple thing | Become multiple purpose | |------------------|--------------------------| | request.send() | perf.start("send request") | request.await() | ........and etc - Become multiple purpose with reasons + language support at type level - ![](https://i.imgur.com/gu5OBWw.png) ### Parallel or Async or Concurrent computing - | Serial | Parallel | Async | Concurrent | |--------|----------|-------|---------------| | | | | | ### Recall of the knowledge of learning a new language ![](https://i.imgur.com/xb2XSq7.jpg) ### By writing a toy program.... 1. You pratice both high-level and low-level features of the language 2. You don't need to dive into some super complicated or difficult program 3. You usually avoid any topic with heavy infra dependency (e.g. write a distributed database) 4. You figure out how to create API, read/write from the network, filesystem, and database 5. You learn how to split fuctions into files, modules, and how to pack them as a installable package 6. You re/organize your program by functions, state keepers, shared or specialized units 7. You try several popular solutions by the language's community 8. Don't need to ask whether it is meaningful to create and extends the program! ### I choose ChaCha20 for practising new any language - Start from MVC ChaCha20, then... - ChaCha20 --> Modularized --> Parallel/async --> IO, network --> Streaming, as API, Database --> Packing ## Q & A - Q: How to choose a language to learn? A: For you compancy, You could choose the language with the support from a big company or good community. | - Q: When you run into a problem you cannot solve, how do you get around the block? A: Choose another implementation or negotiate the requirements according to benefit and cost. - Q: Which is your favorite language? A: - Q: What's your motivation of learning a new language? A: I love to realize the design of a language