哥寫的不是程式,是軟體從嵌入式系統看軟體工程全貌
Agenda❖ Embedded system v.s. Software engineering
➢ What is embedded system?➢ An overview of embedded system software architecture
❖ Getting start from modern application➢ Web based application➢ Talent tree for web developers
❖ Modern software development➢ NO programming? Not Only programming
➢ Agile development
➢ DevOps
❖ What is our future?2
Introduction to my self❖張惇育❖成功大學資訊工程博士❖經歷
➢ 宏普科技 ( 現為 樺漢集團樺賦科技 )
➢ 新漢股份有限公司❖專長
➢ 嵌入式系統開發➢ 分散式軟體架構設計
3
Outline❖Embedded system v.s. Software engineering
➢ What is embedded system?
➢ An overview of embedded system software architecture
❖Getting start from modern application
❖Modern software development
❖What is our future?
4
What is embedded system?❖完全嵌入受控器件內部,為特定應用而設計的專用計算機系統
➢ 被嵌入的系統通常是包含硬體和機械部件的完整裝置。➢ 其關鍵特性是專用於處理特定的任務
❖與個人電腦這樣的通用電腦系統不同,嵌入式系統通常執行的是帶有特定要求的預先定義的任務。
5
生活週邊的嵌入式設備
6
更多嵌入式設備
7
Embedded system software architecture
Bootloader
Linux kernel
Init ramdisk
RootFS
Application Application Application
Library Library
8
Bootloader 做什麼?❖bootstrapping / booting
➢ to pull oneself up by one’s bootstraps
9
Kernel❖monolithic kernel
➢ Linux
➢ Unix (MAC)
❖microkernel➢ Windows
❖driver➢ builtin
➢ module
10
11
Initrd & Rootfs❖Root file system
➢ OS 所需要的 file system
➢ C library, shell, etc.
❖系統 ready
❖等待使用者輸入
12
Application
13
Software engineering?❖嵌入式系統的架構,相當於整個軟體工業的微縮模型❖軟體開發包含:
➢ Application
➢ SDK & IDE
➢ Operate system
➢ Kernel & driver
➢ Bootloader
❖今天只談 Application 裡的 web based application
你平時寫的程式
都是軟體開發
14
Outline❖Embedded system v.s. Software engineering
❖Getting start from modern application➢ Web based application
➢ Talent tree for web developers
❖Modern software development
❖What is our future?
15
Web based application❖server-client architecture
❖跨平台❖標準化協定❖不用另外安裝程式❖適用於 cloud service
16
軟體開發實例
PythonJavascript
DjangoAngularJS
$resource ($http) Django REST framework
RESTful API (JSON)
HTML / CSS
DatabaseORM
Front-end Back-end
Language Framework Module / App17
Python
Life is short. You need Python.18
寫個 Web server 有多難?
19
Don’t repeat yourself ❖Web framework
➢ Django
➢ CherryPy
➢ Flask
➢ Tornado
➢ etc...
20
Django❖Model-Template-View, or MTV
❖Object-relational mapper, or ORM
❖Template engine
21
Python 高級特性知多少?❖ functional programming
➢ map()
➢ filter()
➢ reduce()
➢ list comprehensions 串列綜合運算❖ lambda functions
❖ Closures 閉包❖ Iterators 迭代器❖ generators 生成器
❖ Object Oriented Programming
❖ Abstract base classes 抽象物件➢ Inheritance
➢ super()
❖ Mixins/Multiple Inheritance
➢ Method Resolution Order, or MRO
❖ Decorator 裝飾器➢ @classmethod
➢ @staticmethod
➢ @property22
Python 進階議題❖ Global Interpreter Lock, or GIL
❖ C10K problem
➢ Multi-thread 多線程➢ Multi-process 多進程➢ Coroutine 協程➢ async-io 非同步 IO
❖ 快,還要更快➢ cython
➢ numba
➢ pypy
➢ numpy
➢ scipy
23
Database❖SQLite
➢ 常用於嵌入式系統❖MySQL
➢ 容易入門➢ 學習資源多
❖PostgreSQL, or Postgres➢ Object-oriented database
24
Javascript❖Web 技術的發展史
➢ 網頁互動效果➢ DOM(Document Object Model) API 操作➢ Ajax (Asynchronous JavaScript and XML) 的發明與普及➢ NodeJS 的出世 => npm 誕生
■ Javascript 進入套件管理的時代➢ 各種 framework 推陳出新
25
AngularJS❖關注點分離
➢ 控制器 (Controllers) 與 檢視 (Views) 之間切割的非常乾淨❖以習慣取代配置
➢ Directives
❖DOM Templates
❖Dependency injection 依賴注入❖Two-way data binding 雙向資料綁定
26
Model-View-Controller❖Model
➢ 管理 ( 商務 ) 邏輯、資料、 狀態❖View
➢ 視覺呈現➢ 只顯示資料,不處理資料
❖Controller➢ 介於 Model 和 View 之間的連結➢ Model 和 View 之間的所有溝通都要經過 Controller
27
Model-View-Controller❖Example
➢ iPhone SDK
➢ Android
➢ Qt
28
Web MVC❖Model 2
❖Example➢ Django
➢ Rails
➢ Yii
29
Model-View-Presenter❖Example
➢ Swing
➢ SWT
➢ JavaFX
30
Model-View-ViewModel❖AngularJS
31
MV-Whatever 大家族❖Model-View-Controller
❖Web MVC
❖Model-View-Presenter
❖Model-View-ViewModel
❖Model-View-Whatever
32
RESTful API - REST❖REST, Representational State Transfer ( 具象狀態傳輸 )
➢ Roy Thomas Fielding 博士於 2000 年在他的博士論文中提出來的一種軟體架構風格。➢ 應用程式的狀態跟功能拆成 resources
■ 每一個 resource 由一個 global identifier ( 即 URI) 所表示➢ 資源的表現形式則是 XML 或者 HTML ,取決於讀者是機器還是人,當然也可以是任何其他的格式。➢ 所有 resources 共用一致的介面轉換狀態
■ 一組有限的良好定義操作 well-defined operations
33
RESTful API - RESTful❖REST 的要求:
➢ 使用者端 /伺服器端 Client/Server
➢ 狀態無關 Stateless
➢可以快取 Cacheable
➢ 分層的 Layered
➢ 標準化的介面 Uniform interface
❖符合以上原則 (principles) 的系統稱做 RESTful 。
34
RESTful API - APIs ❖應用於 Web服務
➢符合 REST 設計風格的 Web API稱為 RESTful API
➢直觀簡短的資源地址: URI ,比如: http://example.com/resources/ 。➢ 傳輸的資源: Web服務接受與返回的網際網路媒體類型, JSON , XML , YAML 等。➢對資源的操作: Web服務在該資源上所支持的一系列請求方法。
資源 GET PUT POST DELETE
一組資源的 URI ,比如http://api.example.com/resources/
列出 URI ,以及該資源組中每個資源的詳細資訊。使用給定的一組資源替換當前整組資源。 創建 /追加一個新的資源。該操作往往返回新資源的 URL 。
刪除整組資源。
單個資源的 URI ,比如 http://api.example.com/resources/item17/
獲取指定資源的詳細資訊,格式可以是XML 、 JSON 等。
替換 /創建指定的資源。 在指定的資源下創建/追加一個新的元素。
刪除指定的元素。
35
RESTful API - 有什麼優點❖支援快取 caching 將改善反應時間跟 server 的負載能力。❖因為不必維持連結狀態,大大改善 server 的 scalability 能力。這表示不同 server可以處理同一串 requests 。❖一個瀏覽器就可以存取任一應用程式跟資源, client 端不需使用別的軟體。❖在 HTTP 之上不依存其他機制跟軟體。❖跟其他連結方式相比 (如 RPC) ,可以提供相等的功能。❖不需要其他的 discovery 機制,因為使用超連結了。
36
Talent tree for web developers
37
38
Outline❖Embedded system v.s. Software engineering
❖Getting start from modern application
❖Modern software development➢ NO programming? Not Only programming
➢ Agile development
➢ DevOps
❖What is our future?
39
Not Only programming❖你想象中的軟體開發是…
➢coding
➢compiling
➢debugging
➢building
❖那叫寫程式,那不是軟體工程,甚至不能稱為軟體產品。
40
軟體開發流程
41
Test-driven development❖Testing
➢ Unit testing
➢ Integration testing
❖Refactor 重構
❖TDD 是一種開發方法,不是測試➢將規格以可執行的「測試案例」來表達
42
Co-work❖Version control
❖Issue tracking
❖Documenting
❖Code review
43
Agile development
❖ Test-Driven Development 測試驅動開發❖ Continuous Integration 持續整合❖ Refactoring 重構❖ Stand up 站立會議❖ Frequent Releases 頻繁發佈❖ Minimal Documentation 測試即文件❖ Collaborative Focus 代碼共用❖ Customer Engagement 現場客戶❖ Automated Testing 自動化測試❖ Adaptive Planning 可調整計劃❖ Pair-Programming 結對編程
敏捷開發是一種以人為核心、迭代、循序漸進的開發方法。在敏捷開發中,軟體項目的構建被切分成多個子項目,各個子項目的成果都經過測試,具備集成和可運行的特性。 44
DevOps❖軟體工程劃分為兩個維度
➢ 一個是代表流程的 [ 開發 ] 、 [維運 ]
➢ 一個是代表資源的 [ 人力 ] 、 [ 設備 ]
❖開發就是研發設計與產出軟體程式的過程❖維運就是讓軟體真正成為產品所需的流程❖再加上 QA
45
為什麼會出現 DevOps ?
10+ Deploys per Day : Dev and Ops Cooperation at Flickr 46
DevOps 就是持續交付
47
Outline❖Embedded system v.s. Software engineering
❖Getting start from modern application
❖Modern software development
❖What is our future?
48
找到適合你的工作❖十萬青年十萬肝, GG輪班救台灣❖你想找怎麼樣的工作?以軟體產業來說
➢ IT
➢ FAE
➢ QA / QC (測試 )
➢ RD
49
我要學什麼語言?
50
開獎… ( 僅供參考 )
❖ 重點不是在於什麼語言、工具,而是你解決什麼問題51
如何學習新程式語言❖我只會寫 Java ,不會寫 C
❖正確的學習方式➢ Copy & Paste 臨摩➢ 看文件➢ 學習使用 library
❖不要鑽牛角尖,不要花時間在你”目前”看不懂的東西上
52
成為高手沒有捷徑❖Don’t repeat yourself.
➢ 學習使用框架、第三方套件➢ 理解原理與架構
❖看文件!看文件!看文件!很重要所以說三次。❖自我精進❖參與社群、 OpenSource
53
Questions?
54