CoderClark
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    2
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # A0001 好的應用,來自於好的底子 ## 程式問題很多的原因 為什麼會遇到程式問題很多呢?主因是**過度關注應用,導致忽略程式設計本身的學問**。 程式設計的目的終究是要提供應用,人們透過程式設計讓計算機幫忙完成特定任務,像是導航程式用於規劃路線、遊戲程式用於休閒娛樂、通訊程式用於遠距溝通…等等;反過來說,不能提供應用的程式,就不是一個有效的實作。然而,當程式設計人員過度在乎應用,忽略了程式設計本身,往往會產出 Bug 很多、效率很差的不堪用程式。舉例來說,一個導航程式如果規劃出很糟的路線、規劃路線要等很久、找不到目的地、導航中途閃退、語音不符導航內容…等等,使用者應該很難接受吧?這些問題,肯定不是在寫程式的時候,就想把問題呈現給使用者,讓使用者接觸這些不堪用的功能;真實情況應該是對程式設計本身的掌握度太低,難以做出功能精準、沒有問題的程式。要探討這個現象,可以從**當代程式設計過度依賴高階語言**與**教育與訓練不足**來討論。 ## 當代程式設計過度依賴高階語言 隨時時代的演進,程式語言的發展越來越高階,使得現任何想法的實現通常不需要寫太多的程式碼就能辦到;因此,同樣應用的實現,高階語言寫起來通常比低階語言來的簡潔,可以更專注於應用的開發。比方說字串的串接,高階語言通常只要將兩個字串加起來就可以了,但低階語言就需要在意字串串接後的記憶體空間夠不夠,需要先處理好記憶體,才能真的做串接。由於方便性,漸漸地**程式設計人員只關心把應用做出來,至於如何寫出好的程式碼就變得不是那麼重要了**。這樣的陳述,並不是要貶低高階語言,畢竟高階語言的出現,本來就是為了讓程式設計可以專注在功能的開發、應用的實現,而不用對枝微末節的項目費神。 要深究「為什麼方便性會讓人忽略寫好程式碼的重要性」,可以從程式的本質談起。所謂程式的本質,就是在處理邏輯。一個邏輯,就是根據一個條件去做某一件事情;然後將許許多多的邏輯堆疊起來,就是一個程式了。以這個定義來看,只要會下 if-else 條件式,應該沒有寫不出來的程式;加上高階語言通常又提供了很多方便的語法與套件,要具體做什麼或許都一兩行就能辦到,堆疊起來簡單方便。長期如此下來,自然自信心膨脹,認為什麼程式都能寫得出來。 但事實真的是如此嗎?人們對程式設計領域以寫文章、種田、蓋房子等方式來比喻[^1] 是很貼切的。試想一下,如果只會寫一個字、一個詞,有可能寫出好文章嗎?如果只會種一顆綠豆的人,有可能處理一畝地的農田嗎?如果只會疊一個磚頭的人,有可能蓋出大樓嗎?高階語言所提供,的方便性,或許可以幫忙做出一篇文章、耕耘一畝地、搭建大樓,但如果目標是一部曠世巨作系列小說、一鄉鎮的農地管理、一座世界最高樓呢?過度依賴高階語言的副作用,就是**讓人有任何程式都寫得出來的錯覺**,但實際上卻只會堆疊簡單邏輯罷了。 [^1]: Code Complete (2nd edition) 於第二章總結了常用的程式設計比喻,包括寫文章、種田、蓋房子,等等。 事實上,撰寫高階語言也應該關心**如何寫出好的程式碼**,只是大部分撰寫高階語言的訓練都太在意應用,才忽略了把程式碼寫好的這件事情。這是一個盲點,使得有些程式設計人員,自認為看透了程式設計,卻會寫出 Bug 百出、難以維護、沒有彈性、甚至不堪用的程式。 ## 教育與訓練不足 除了過度依賴高階語言的情形,即使是撰寫當代相對低階的 C 語言,許多的程式設計人員仍然有過度只關心應用、忽略寫好程式碼的現象。這現象從一般的大學資訊工程教育方式可以看出一二。 嚴格來說,真正涉及程式設計本身的課程,幾乎只限於大一的程式設計課,而部分規劃較完善的學校會加入物件導向(object-oriented)課。或許有人會疑問,難道就沒有其他課程了嗎?必修的資料結構(data structure)、演算法(algorithm)就不是嗎?又或是選修的競賽型程式設計、軟體工程、編譯器……等等,也不是嗎?這些課程當然也跟程式設計有關,但是課程規劃通常不涵蓋寫程式的層面,都以理論為主。具體而言,資料結構與演算法通常都在關心複雜度、解決問題的方法,卻沒有討論如何實作、實現。有多少人真的實作過樹(tree)或圖(graph)呢?這些概念不複雜的資料結構,其實是很好練習抽象化與封裝的題目,不但題目目標明確,實作出來後也很實用。倘若沒有在學習階段練習過,等真正寫應用的程式時,總會有需要更複雜的、需要客製化設計的資料結構,無異是跳過基礎練習而直接實作進階設計;要知道,並不是所有人都是天選之人,可以這樣跳躍式進步的。 從程式設計本身的課程之少,就可以了解應用的課程之多了。不意外的是,安排課程與授課的學者們,或許是因為自身很少實作、或者距離自己實作的年代已久,通常也都認為只要懂應用的觀念,程式沒有寫不出來的道理(這似乎又與前面提到的**任何程式都寫得出來的錯覺**連結在一起了)。殊不知,沒有足夠的程式設計教育與訓練,真的有不少應用是寫不出來的。 ## 好的應用,來自於好的底子 有一定經驗的程式設計人員,通常都會遇到怎樣也寫不好的情況;可能是目標功能無法實現、想實現一些方法卻無從下手、真的下手卻發現程式碼難以更動、更動了還有解不完的Bug等等的。這時候就應該問問自己,有沒有過度依賴高階語言、有沒有訓練不足、有沒有把程式碼寫好放在心上、有沒有打好底子?成天停留在「只要會下 if-else 條件式,就沒有寫不出來的程式」的想法,只會讓自己一直寫不好程式;一直寫不好,又何來好的應用呢?請理解,程式設計本身的學問,於重要性、深度、廣度,都至少與應用相當才是。**好的應用,來自於好的底子**,只有讓自己的程式設計底子更好了,才能寫出讓使用者與自己都滿意的應用!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully