Java Programming
Time: 0930 ~ 1230, Saturday and Sunday
Location: Room 108, 德田館
``Java is C++ without the guns, knives, and clubs.''
-- James Gosling, co-inventor of Java (1955-)
Course Description
To the students,
This course is designed for the students who want to learn Java programming without any experiences before. We will start with the very beginning of program design and the fundamental concepts of how the programs execute the instructions. You are expected to be capable to implement your idea with Java independently after 30 hours of lectures. Furthermore, I wish you could learn other programming languages without suffering from starting over.
Enjoy your coding time.
- Textbook
- References
- Java (basic level)
- Barron's AP Computer Science A, Roselyn Teukolsky M.S., 7/e, 2015
- Beginning Java 8 Fundamentals, Kishori Sharan, 2014
- Introduction to Java Programming: Comprehensive Version, Y. Daniel Liang, 10/e, 2014
- Fundamental Object Oriented Programming, Prof. HT Lin, Dept of Computer Science and Information Engineering, National Taiwan Univerisity, Taiwan, 2015fa
- Programming notes, Chua Hock Chuan, Nanyang Technological University, Singapore
- Java (advanced level)
- Java Platform, Standard Edition (Java SE) 8, Oracle
- Java in a Nutshell, Benjamin J Evans and David Flanagan, 6/e, 2014
- Java: The Complete Reference, Herbert Schild, 9/e, 2014
- Effective Java, Joshua Bloch, 2/e, 2008
- Java Performance: The Definitive Guide, Scott Oaks, 2014
- Introduction to Programming in Java, Robert Sedgewick and Kevin Wayne, Dept of Computer Science, Princeton University
- OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide: Exam 1Z0-809, Jeanne Boyarsky and Scott Selikoff, 2016
- Data structures and algorithms
- Data Structures and Algorithms in Java, Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser, 6/e, 2014
- Data Structures and Problem Solving Using Java, Mark Allen Weiss, 4/e, 2010
- Data Structures and Algorithm Analysis, Clifford A. Shaffer, 2013 (online resource)
- Data Structure Visualizations, David Galles, Dept. of Computer Science, University of San Francisco, 2011 (online resource)
- Data Structures for Interviews, Justin Zhao, 2014
- 2016 Introduction to Data Structure, Prof. Wing-Kai Hon, Department of Computer Science, National Tsing Hua University, 2016sp
- bigocheatsheet, Eric Rowell
- Object-oriented analysis and design (OOAD)
- Object-oriented Analysis and Design with Applications, Grady Booch, Robert A. Maksimchuk, Michael W. Engle, Bobbi J. Young, Jim Conallen, and Kelli A. Houston, 3/e, 2007
- Object-Oriented Analysis & Design, Prof. Kenneth M. Anderson, Department of Computer Science, University of Colorado, 2012fa
- Network programming
- Additional readings
- 為什麼要學各種程式語言, NiwaSho Lin, 2012.11.21
- 資深開發者給後輩的七個 Coding 學習心得, TechOrange, 2013.11.29
- 大企業都在用哪些程式語言?圖解程式語言編年史, T客邦, 2013.12.16
- 關於工程師 59 條搞笑但卻真實無比的語錄, INSIDE, 2013.12.20
- The reason everyone should learn to code, Mike Loukides, 2014.1.22
- 如何成為一個偉大的開發者?, TechOrange, 2014.6.20
- 沒神奇公式和捷徑,這11步驟就是成為頂尖Coder的必備條件, TechOrange, 2014.7.9
- 高生產力工程師的兩個特徵:聰明、懶惰, INSIDE, 2014.7.14
- 笑傲「演算法」江湖的獨孤九劍, INSIDE, 2014.8.14
- Google工程師親授:菜鳥開發者一定要投資的十大標的, TechOrange, 2014.9.17
- Re: [討論] 所以練acm都底有啥好處?, coquelicot, ptt, 2014.9.23
- 在美國,寫什麼程式收入最高?答案是:Java, T客邦, 2014.10.9
- 我們之前說錯了嗎?Coding 竟不是新世代必備能力, TechOrange, 2015.2.6
- 學 Coding 很簡單,但想要靠它吃飯你必須經過這4大階段, TechOrange, 2015.4.7
- The top ten technology skills at BAML, Barclays, Credit Suisse, Citi, Goldman Sachs, JPMorgan, Morgan Stanley and UBS, efinancialcareers, 2015.4 16
- 你自己選吧:當工程師不需數學好,但神級工程師的數學都很好, TechOrange, 2015.5.4
- code 海無涯,不想溺斃就快抓緊這 6 個緊急救生圈吧!, TechOrange, 2015.5.26
- 程式初學者的失落之鑰 - ``Computational Thinking'', 程式教育的唐吉訶德, 2015.6.2 (Original: Computational thinking and thinking about computing, Jeannette M Wing, 2008.10.28)
- 一個平庸工程師的自白, TechOrange, 2015.6.12
- 24 小時學會 Java 程式?想成為武林高手,還是先花 10 年磨一劍吧!, TechOrange, 2015.8.19
- 【洪士灝 v.s 蘇文鈺】真正的資訊教育不在學寫程式,關鍵在學用電腦解決問題, TechOrange, 2016.1.4
- AlphaGo: using machine learning to master the ancient game of Go, Google, 2016.1.27
- 人工智慧有多恐怖?聽聽「天才」Demis Hassabis 怎麼說!, INSIDE, 2016.2.21
- 葉丙成:學程式者,能成麒麟之才?, 翻轉教育, 2016.2.26
- 程式自學十年心得:想吃這行飯,學好演算法與資料結構才能讓你站穩腳步, TechOrange, 2016.4.13
- Misc
- 高中生程式解題系統 (An Online Judge System For Beginners)
- Organization of Programming Languages, Michael Hicks and Anwar Mamat, Dept. of Computer Science, University of Maryland, 2015sp
- Introduction to Artificial Intelligence -- Pacman Project, Dept. of Computer Science, UC Berkeley, 2014sp
- LeetCode Online Judge
- openjdk/8u40-b25, GrepCode
- 程式語言面試考題集錦, maoyang, 2016.2.21
- code.org
- CMU 15-112: Fundamentals of Programming and Computer Science, Computer Science Department, Carnegie Mellon University, 2016sp
- Understanding Just-In-Time Compilation and Optimization, Oracle
- Java Technology Tutorials, tutorialspoint.com
- w3schools.com
Overview
The major topics covered in the short course, time permitting, are listed below for your reference.
- Programming basics (procedural programming)
- Overview: preliminary knowledge of computer science, Eclipse
- Data types and declaration
- Operators
- Control structures: selections, iterations
- Analysis of algorithms (O-notation)
- Arrays
- Methods (functions) and recursion
- Object-oriented programming
- Objects and classes
- HAS-A relationship: association, aggregation, and composition
- IS-A relationship: inheritance and interfaces
- Polymorphism: upcasting and downcasting
- Exception handling
- Generics
I will give a simple tutorial for Object-Oriented Analysis and Design (OOAD), including some design patterns and diagrams used in Unified Modeling Language (UML 2.0).
- Applications
- String and regular expressions
- File input and output
- Multi-threaded programming
- GUI design using Swing
- Fundamentals of network programming
- Applets, servlets, and JSP
These topics will be covered if we does continuously run ahead of schedule. Historically, we did finish the lecture notes for multi-threaded programming.
- 2016.3.12 (2.5 hours)
- 2016.3.13, IntroToJavaVirtualMachine.pdf
- 2016.3.19 (3.5 hours)
- 2016.3.20
- Problem 1: Greatest common divisor. Let a > b be any two positive integers. Write a program which determines the greatest common divisor of a and b by using Euclidean Algorithm.
- Problem 2: π estimated by Monte Carlo. Let n be the number of simulation paths. The algorithm is as follows:
- Set n = 1e5.
- Declare m = 0 and i = 0.
- Use Math.random() to generate x and y.
- If x ^ 2 + y ^ 2 < 1, then m = m + 1.
- Set i = i + 1.
- Repeat (3) until i > n.
- Print 4 * m / n.
If you are not familiar with Monte Carlo simulation, you can refer to Calculating π using Monte Carlo Simulation.
- 2016.3.26: arrays
- 2016.3.27: methods, OOP part i
- Problem 3: Bisection method for root finding. Write a program which uses a bisection method to determine a root of the specific function within [a, b]. The input is as follows: f(x), a, b, eps. The output is the root. For example, consider f(x) = x ^ 3 - x - 2 with the initial search interval [0, 2] and eps = 1e-9. The root is about 1.5214.
- Problem 4: Power function. Write a program which calculates x ^ n where x is any real number and n is an integer. Let's call it power(x, n) which denotes x ^ n for simplicity. For example, power(2, 10) = 1024. If possible, implement a program whose runtime is at most O(log n). You may use recursion.
- Problem 5: Depth-first search. First download the maze game here. (You can unzip the jar file by using 7zip, WinRAR, and other unzip softwares.) Write a program which determines a path starting from the origin to the goal. All you need to do is to implement the agent method which uses DFS algorithm to explore the world. Watch the demo clip here.
- Problem 6: Observation. Write a program which simulates a real world you are concern of. This is an open question. No standard solution.
- 2016.4.2 no class (long weekend)
- 2016.4.3 no class (long weekend)
- 2016.4.9: OOP part ii
- 2016.4.10: OOP part iii
- (FYR) OOP: CH6.pdf, CH7.pdf (Thanks for Mr. Sung)
- Problem 7: Write a program which plays the nAnB game. First, the player enters 4 distinct digits as an input. For example, 1234 is ok but 1123 is not allowed. Second, the program evaluates the input and reports the status. For example, if the secret number is 5678 and the input is 1258, then the program outputs 1A1B. The program repeats itself until the player wins. More explicitly, the program outputs 4A0B. If the number of rounds exceeds 10, then the player loses and the program terminates.
- Problem 8: Rock-paper-scissors. Write a program which conducts a rock-paper-scissors game (RPS game, in short) with two computer players. The RPS game continues until one of computer players wins. If you can implement a two-player game, then you may try to implement a multi-player version of RPS game. You can find a demo clip here for the multi-player RPS game. Strongly recommend that you use OO design elements, say class, interfaces, enum types, and so on. (If you cannot watch mov files, please use the online convertor to convert mov files into the video types you can read on your machine. For example, link1.)
- 2016.4.16
- String and regular expressions: CH5.pdf (Thanks for Mr. Sung)
- Exceptions and file I/O: CH8.pdf (Thanks for Mr. Sung)
- 2016.4.17, feedback
Sample Codes
As a beginner, avoid copying. Please write the code on your own.
Grading Policy