Learn Programming Language from Diving into Source Code

1 Master Core Functions

If you're a beginner on learning Programming Language, mastering some core and frequently used functions is really helpful. This can let you write better code.

This thought is comes from book <Clojure Standard Library: An annotated reference>. I get a free chance to choose an ebook after filled a form from Manning Publications. (I choose this book because I'm learning Clojure, need to master basic of Clojure as a beginner.)

2 Dive into Language Source Code

Programming Language usually has a mechanism to check out source code. For example, Emacs Lisp, it can use M-. to jump to function definition. Clojure is same. About other languages like Python, Ruby etc. In Emacs also can use M-. or Emacs extensions to support this.

3 Search code examples on public source code hosting websites

Learning with examples is helpful for beginner, you can search code on public source code hosting websites. Here is my collected list:

Rosetta Code
Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 874 tasks, 223 draft tasks, and is aware of 687 languages, though we do not (and cannot) have solutions to every task in every language.
search for open source code by functionality.
search for code, docs, and usage examples.
(no term)
(no term)
(no term)
(no term)
(no term)
(no term)
The Complete Open-Source Software Platform. Create, collaborate & distribute to over 33 million users worldwide.
(no term)
(no term)
(no term)
(no term)
(no term)

3.1 Emacs package engine-mode

Emacs has a package called "engine-mode" which can define search engine based on URL by replacing query keyword with "%s". It is quite quick to use it to open a search query in web browser. Even can use thing-at-point to get word or symbol at point to avoid manually input.

3.1.1 how to define engine

  1. simple
    (defengine github
  2. specify key
    (defengine duckduckgo
      :keybinding "d")
  3. specify browser function
    (defengine github
      :browser 'eww-browse-url)
  4. specify docstring
    (defengine ctan
      :docstring "Search the Comprehensive TeX Archive Network (ctan.org)")

3.1.2 my config part

;; general search engines
(defengine google
  ;; "http://www.google.com/search?q=%s"
  :docstring "Google"
  :keybinding "g")
(defengine duckduckgo
  :docstring "DuckDuckGo"
  :keybinding "d")
(defengine blekko
  :docstring "Blekko"
  ;; :keybinding "B"
(defengine bing
  :docstring "Bing")
(defengine baidu
  :docstring "Baidu"
  :keybinding "b")

;; Wikipedia
(defengine wikipedia
  :docstring "Wikipedia"
  :keybinding "w")
(defengine baidu_baike
  :docstring "Baidu Baike"
  :keybinding "W")
(defengine wolfram-alpha
  :docstring "Wolfram Alpha"
  :keybinding "A")

;; programming

;; Docs: API
(defengine APIs
  :docstring "APIs"
  :keybinding "a")
(defengine mozilla-developer
  :docstring "Mozilla Developer"
  :keybinding "m")
(defengine rfcs
  ;; "https://www.rfc-editor.org/search/rfc_search_detail.php?rfc=%s"
  :docstring "RFC"
  :keybinding "R")
(defengine emacswiki
  :docstring "Emacs Wiki"
  :keybinding "e")

4 More tips will updated on this post

If anyone suggest more skill tips about learning from diving into source code. I will add them at this post.