810 likes | 1.05k Views
2010/10/20 修平技術學院 程式設計與認證平台實務研習會. Java@plweb 教材、練習平台與認證題庫. 認證平台應用實務. 計畫主持人:董少桓 教授 簡報製作:林彥宏 專案助理. 為什麼要學好程式設計?. 考試 ? 學分 ? 畢業 ? 工作 ? 當高手 ? 當好人 ? 當駭客 ? 成為世界首富 ??? Bill II ?. 程式設計師,你快樂嗎 ?. 你還記得 上一次快快樂樂寫程式 是什麼時候嗎?. 程式,為樂趣而寫. Just for fun. 快樂,單純的動機 動機,單純的力量.
E N D
2010/10/20 修平技術學院程式設計與認證平台實務研習會 Java@plweb 教材、練習平台與認證題庫 認證平台應用實務 計畫主持人:董少桓 教授 簡報製作:林彥宏 專案助理
為什麼要學好程式設計? • 考試? • 學分? • 畢業? • 工作? • 當高手? • 當好人? • 當駭客? • 成為世界首富??? Bill II ?
程式設計師,你快樂嗎? • 你還記得 • 上一次快快樂樂寫程式 • 是什麼時候嗎?
程式,為樂趣而寫 Just for fun. 快樂,單純的動機 動機,單純的力量
LinusTorvalds Linux 圖片來源:http://lwpca.net/
PCMan • PCMan系列 BBS 連線軟體,最早由陽明大學醫學系學生 洪任諭 製作在 2001 年作者高三畢業,升上大一的暑假,發行了陽春的第一版。原先只是單純想提供一個免費、輕巧、簡單的 BBS 連線軟體,但隨著使用者不斷增加,在眾多使用者建議下,不斷改良,增加了許多新功能陸續在每年又發行了許多新版本。 http://pcman.openfoundry.org/
Mark Zuckerberg Facebook 圖片來源:http://www.officesnapshots.com/2009/08/13/the-new-facebook-office/
計畫簡介 • 99年度中區技職校院區域教學資源中心計畫 • 「整合程式設計教學及實作能力認證之題庫與練習平台 • 計畫主持人董少桓教授 • 學歷: 美國印第安那大學電腦科學博士 • 專長: 程式語言 / 世界網資訊系統 / 工作流程 / 視覺語言 / 物件導向技術 • E-mail: tungsh@yuntech.edu.tw • 個人網站: http://www.mis.yuntech.edu.tw/~tungsh/tungsh.html
Welcome to Java world… 16 years old Fat, not fast Danger 資料來源:http://duke.kenai.com/
2009/04 Oracle buys Sun 2010/04 Gosling left Sun/Oracle 2010/09 SCJP OCP, Java The Big Issue 資料來源: http://duke.kenai.com/
More Duke… 資料來源: http://duke.kenai.com/ http://duke.kenai.com/
為何要學Java? 資料來源: http://www.tiobe.com/
為何要學Java? • 小程式到企業級的軟體開發 • 都有合適的解決方案 • Glassfish, JBoss, WebSphere, WebLogic, … • JavaFX, GWT, Struts, EJB, Spring Framework, ZK, … • JDBC, JPA, Hibernate, … • Eclipse, NetBeans, IntelliJ, … • Nutch, Lucene, Hadoop, …
1994 ~ 2010年 • James Gosling • 1994 – Java appeared • Bruce Tate say… • Better, Faster, Lighter Java (2004) • Beyond Java (2005) • 你正在參與的Java時代 • Java的未來?! 圖片來源:http://nighthacks.com/roller/jag/
Java的趨勢… 愈來愈簡單 • Scripting (JSR 223) • AWK, Clojure, Groovy, Jaskell(Haskell), JavaScript, JEP, JudoScript, Pnuts, Jython(Python), JRuby(Ruby), Quercus(PHP), SISC(Scheme), Sleep, Tcl • Annotation@WebService, @WebServlet, … 資料來源: https://scripting.dev.java.net/
Java的混搭風格… • Java + Scripting = Just Simple • 用 Groovy, Scala, Jython, JRuby 輕鬆撰寫簡潔的程式碼 • 高生產力 • 但…建立在強大穩固的Java基礎設施上
為何要學Java? 資料來源:http://www.indeed.com/
學習的重點是… • 很多很複雜的設定、語法、工具、框架… • 學會程式設計的觀念 • 學會解決實際的問題 • 學會簡單快速解決問題
Java不好教也不好學… public class HelloForLoop { public static main(String argv[]) { for (inti = 0; I < 10; i++) { System.out.println(“i = ” + i); } } }
Java不好教也不好學… • 只是要教個簡單的FOR迴圈 • 但學生必須先弄清楚… • 為什麼要有public、class、static… • 為何物件的類別定義有個main… • int與Integer的差別… • 什麼是System.out.printlnt… • 除此之外,為了學會寫Java程式,還要先學會用工具…
Teach less, learn more… • 老師 • 建立學習目標 • 引導 • 講解觀念 • 學生 • 聽講、閱讀教材 • 大量練習 • 瞭解、解決問題 • 找資料、互助、內化知識
RTFM google it • 搜尋 site:oracle.comjdkapisystem
Google程式碼搜尋 ^.*\.java$ wretch album
內容太OVER的教科書?! • New JDBC chapter introduces JDBC 4 and uses the MySQLand Java DBdatabases. • New JTablesorting and filtering capabilities. • New Java2D gradient capabilities. • Strong treatment of generics and generic collections. • New application using Google Maps web services. • Java Blueprints technology. • New StringBuilder class. • New Resource Centers for Eclipse, NetBeans, Java Studio Creator 2, JBuilderand other popular environments. • New coverage of annotations, and much more. • And all the key features from Java How to Program, 6/e, including • Carefully developed object-oriented programming presentation featuring an early classes and objects pedagogy. • Extensive object-oriented programming case studies. • Optional 10-section OOD/UML 2 Automated Teller Machine (ATM) case study, including complete code implementation. • Optional graphics and GUI case study track. • Multitier, database-driven web application development. • And much more. • Java How to Program, 7/e • This new edition includes all of the core pedagogic material from Java How to Program, 6/e updated to the forthcoming Java Standard Edition 6 (Java SE 6; code named "Mustang"). Check out the complete Table of Contents. Here's some of the book's key features: • Updated the entire book to the new Java Standard Edition 6 ("Mustang"). • Attention to key software engineering community concepts, such as Web 2.0, SOA, web services, open source software, design patterns, mashups, refactoring and many more. • Carefully coordinated with our new Java, Web 2.0, Ajax, and Programming Projects Resource Centers. • New Ajax-enabled, event-driven web applications development with JavaServer Faces • The servlets and JSP chapters have been dropped in favor of the new JavaServer Faces (JSF) treatment. • New tools-based approach for web applications development. • New web services chapter. • New SwingWorkerclass for multithreaded user interfaces. • New Java desktop integration (JDIC) features, such as splash screens and interactions with the system tray. • New GroupLayoutlayout manager.
希望藉由PLWeb… • 幫助學生 • 減少學習過程的挫折 • 順利畢業 • 奠定基礎能力 拿到學分更容易 • 增加實作能力 • 專題 • 計劃案 • 通過認證 • 累積寫程式經驗 • 找工作 成為程式設計師
PLWeb提供大量實作練習… • 李開復給資訊系學生的建議 • 多實戰。通過編程的實戰積累經驗、內化知識。建議大家爭取在大學四年中積累編寫十萬行代碼的經驗。 • 李開復曾任職微軟、Google副總裁,現為創新工場創辦人。 • PLWeb提供了超過200題的Java練習 • http://wiki.plweb.org/PLWeb-Java-Examples
希望藉由PLWeb… • 幫助老師 • 建立可以重複利用的線上教材 • 掌握教學重點及目標 • 清楚瞭解學生的進度及狀況 • Teach less, learn more…
PLWeb的架構 Browser-based 程式碼編輯器 網站 jEdit-based (Java Web Start)
執行PLWeb的環境 • Windows 2000 / XP / Vista / 7 • Java SDK 6 以上 • update 21 以上 (建議版本) • Modern browsers • Mozilla Firefox 3.6 以上 推推推 • Google Chrome 6.0 以上 跑很快,推 • Internet Explorer 8.0 以上 噓
Java@plweb教材、練習平台與認證題庫 • http://java.plweb.org/
PLWeb的TQC+ Java教材… • Java結構化程式設計 • 簡介 • Java 的變數、方法與型態:總覽 • 區域變數與基本資料型態 • 螢幕輸出及鍵盤輸入 • 算術運算式 • 類別變數與類別方法 • 運算式、句子與條件判斷句 • 迴圈與遞迴 • 陣列 教材網址: http://wiki.plweb.org/Java
PLWeb的TQC+ Java教材… • Java物件導向程式設計 • 實例、實例變數與實例方法 • 實例的產生與封裝 • 繼承、抽象類別 • 介面 • 泛型與 Collection • 例外狀態的處理 教材網址: http://wiki.plweb.org/Java
PLWeb的TQC+ Java題庫 • 銜接練習 • 教學用,是用於銜接教學與認證考試的練習。 • 不屬於認證題庫,所以認證考試不考。 • 學生做過銜接練習可確保讀完教材。 • TQC+ Java 6 認證題庫(17) • 幫助學生通過TQC+ Java認證。 • TQC+ Java 6 銜接練習與認證題庫(27) • TQC+ Java 6 認證題庫(17) + 銜接練習
PLWeb的題庫類型 • 是非選擇題 • 除錯題 • 程式碼填空題 • 預測答案題 • 程式撰寫題 • 綜合練習題組 http://wiki.plweb.org/PLWeb-Java-Examples
是非選擇題 1 class Market{ 2 static intsEgg = 5, sFruit = 20; 3 static intgetMoney(intnEgg, intnFruit) { 4 return sEgg * nEgg + sFruit * nFruit; 5 } 6 intgetMoney() { 7 return sEgg + sFruit; 8 } 9 } • 第 2 行的程式為何種的宣告方式: • 類別變數 • 實例變數 • 類別方法 • 實例方法 • 第 6 行的程式為何種的宣告方式: • 類別變數 • 實例變數 • 類別方法 • 實例方法
除錯題 public class Good { public static main (String args[]) { System.out.println(I love Java!); System.out.println("Java is so good!") } } 改正程式碼的語法錯誤 藉由編譯時的錯誤訊息,找出程式碼的BUG,培養除錯能力!
程式碼填空題 public class AndToIf { public static void main(String args[]) { System.out.println(andToIf(true, true)); System.out.println(andToIf(true, false)); System.out.println(andToIf(false, true)); System.out.println(andToIf(false, false)); } static booleanandToIf(boolean b1, boolean b2) { if (b1) ____________; else return _____; } } 請使用 if 撰寫一個類別方法,這個方法傳入兩個 boolean值:b1, b2,並回傳一個 boolean值,這個 boolean等於 (b1 && b2) 的值。
預測答案題 class GrandParent { String eyes() { return "blue"; } String test1() { return this.eyes(); } } class Parent extends GrandParent{ String eyes() { return "green"; } String test2() { return super.eyes(); } } public class Generation { public static void main(String args[]) { GrandParentgail = new GrandParent(); Parent sue = new Parent(); System.out.println(gail.eyes().equals("____")); System.out.println(gail.test1().equals("____")); System.out.println(sue.eyes().equals("____")); System.out.println(sue.test2().equals("____")); } }
程式撰寫題 • 請寫一個程式持續輸入一個數 n,使用遞迴計算 n 的階乘,直到輸入999為止。 import java.util.Scanner; public class Factorial { static Scanner keyboard = new Scanner(System.in); public static void main(String args[]) { int num1; System.out.print("Input n: "); num1 = keyboard.nextInt(); while (num1 != 999) { System.out.printf("%d 的階乘 = %d\n", num1, fac(num1)); System.out.print("Input n: "); num1 = keyboard.nextInt(); } } static intfac(int n) { if(n == 0) { return 1; } else { return (n * fac(n - 1)); } } }
綜合練習題組 請以避免在不同類別中重複寫相同的程式碼的方式,為某校資訊管理系(MIS)設計其學生成績資訊系統。 MIS 有 IT 與 IM 兩個學程。MIS 學生的共同必修課為 chi, eng。 IT 的選修課有:pl, db, ds;IM 的選修課有:econ, acct。 學生總平均成績的計算公式是: 必修課的平均成績 * 0.4 + 選修課的平均成績 * 0.6 請 new 兩位學生的資料並計算其「選修課的平均成績」及「總平均成績」。 該系決議另行增加一個ITM學程,ITM的學生除了要修IT的課之外,另外還需要修 acct 一門課。 ITM學生總平均成績的計算公式是: 必修課的平均成績 * 0.4 + IT 課程的平均成績 * 0.4 + acct * 0.2 ITM學生選修課平均成績的計算公式是: (IT 課程的平均成績 + acct) / 2 請 new 一位 ITM 的學生,並計算其「選修課平均成績」及「總平均成績」。 請以類別變數累計學生人數,並呼叫一個方法傳回該系的學生人數。 請使用 HashMap為該系設計一 MISClass類別。一個 MISClass的實例即代表一個班級,並且有 put, list 兩個方法: put 可以加入一名學生;list 可以印出該班所有學生的名字及平均成績。 請使用例外處理將該班學生平均成績大於 100 (資料錯誤)之學生的名字前增印兩個星號(**),並結束程式。 包含數個小題。 以逐步增加功能的方式,完成一個約 200 行程式碼的綜合應用。
PLWeb的測試機制 • 自動比對輸出結果 • 再由老師或助教批閱 正確 正確 1 + 1 = 2 2 * 2 = 4 1 + 1 = 2 2 * 2 = 5 ^