1 / 15

CSCI E-70

CSCI E-70. Graphical User Interface Programming in Java 29 January 2003. Instructor: Daniel Bromberg, Mitsubishi Electric Research Labs. Welcome to E-70!. Extend Java skills to advanced client-side libraries the java.awt and javax.swing package families Apply skills with generic libraries

lanai
Download Presentation

CSCI E-70

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI E-70 Graphical User Interface Programming in Java 29 January 2003 Instructor: Daniel Bromberg, Mitsubishi Electric Research Labs CSCI E-70 Lecture 1 / Bromberg

  2. Welcome to E-70! • Extend Java skills to advanced client-side libraries • the java.awt and javax.swing package families • Apply skills with generic libraries • java.util.Collection, java.net, java.lang, ... • Improve programming fluency • Apply data structures to solve cool problems • Learn more Object-oriented design, techniques • Perfect Java language knowledge: syntax, idioms, limitations • Learn the multi-threaded, event-driven, framework-based, visual modeling way of life • Make programs ordinary people can actually use • Think hard, code a lot, have fun CSCI E-70 Lecture 1 / Bromberg

  3. Course Layout • Lectures • Every Wednesday from Jan. 29 to May 14 excl. holidays • Maxwell Dworkin G135, 5:30-7:30 PM • 5 minute break at the hour • Primarily presentation and demonstrations by Instructor • Theory, example, motivate, guide to important study points • Present homeworks, projects, tests; outline requirements • Announce changes in policy, schedule • Questions and discussions as needed • Section • Tentative After lecture, 8-9 PM, Location TBA • Led by your Teaching Fellow • Driven almost entirely by student questions and needs CSCI E-70 Lecture 1 / Bromberg

  4. Additional Help • Web Site • http://www.fas.harvard.edu/~libe70/current • Check constantly for updates, hints, notes • Please read entire syllabus – many important details • Ultimate Bulletin Board • Group technical discussions • Moderated by staff – both TFs and I contribute • E-mail TFs with private questions, grading issues • Attend regular TF office hours • Possibly schedule additional if need more help • Contact instructor • course policy questions – general concerns & complaints • office hours by appointment • Come to us one way or another; don’t sink or disappear CSCI E-70 Lecture 1 / Bromberg

  5. Workload • 1st half: 5-6 problem sets: 40% • Exercises. short programs, practice “project” • Mid-game summary: Midterm Exam: 15% • Keep you on-target; gauge individual mastery • root out technical weaknesses before final project • SPRING BREAK! • 2nd half: The Final Project (approx. 5 weeks) 45% • 3 stages (progessive building blocks) • Proposal (2-3 pages) • Design charts & Class skeletons (5-8 pages) • Final package (code + documentation, 15-30 pages) CSCI E-70 Lecture 1 / Bromberg

  6. Books & References Required: Graphic Java 2, Volume 2: Swing (3rd Edition)by David M. Geary: Prentice Hall PTR; ISBN: 0130796670; 3rd edition (March 12, 1999) Java Event Handlingby Grant Palmer: Prentice Hall PTR; ISBN: 0130418021; Bk&Cd-Rom edition (August 8, 2001) Recommended: Java 2D API Graphicsby Vincent J. Hardy: Prentice Hall PTR; ISBN: 0130142662; 1st edition (November 3, 1999) (Especially if you think final project will involve drawing) Others:see “recommended reading” handout Topley: Advanced text & document formatting Zukowswi: Extra JBuilder practice Robinson et al.: Practical GUImiddleware Walrath et al.: Printed Sun tutorial Lewis et al.: Multithreaded applications CSCI E-70 Lecture 1 / Bromberg

  7. Prerequisites • Enjoy using a GUI; no GUI programming needed • Data Structures experience: beyond int x; float y;... • one-dimensional arrays and loops should be “old hat” • understand tables, trees, and graphs in order to apply them • Fine to use library classes: java.util.Collection et al. • Java/OO experience: beyond one big main()... • Declaring base classes, derived classes • Polymorphism (just another Big Word?) • Formal vs. actual data types are different but “compatible” • Reference semantics of objects • Passing an Object as a parameter sends a reference to receiver • Notion of “incomplete” classes • pure functional: interfaces • mixed implementation/functional: abstract classes • Don’t panic – we’re here to practice all of this! CSCI E-70 Lecture 1 / Bromberg

  8. Submitting Work • Use the ‘submit’ facility on Harvard Unix system • personal workstation, fas.harvard.edu, ice.harvard.edu • NO other method will be accepted! (no paper) • man submit(1): see examples; course is cscie70 • Late penalty of 5% per day including weekends • However: 8 free late days. Entirely self-budgeted. • Intended for occasional “soft” extension – water pipe burst – kid ate your homework – got sick – snow storm – disk crashed • It will happen • MAKE BACKUPS EVERY DAY PLEASE! • Therefore any other extension only for medical emergencies • Deadlines fall on Friday just before midnight • Gives you time to mull over Wednesday’s section CSCI E-70 Lecture 1 / Bromberg

  9. Getting Started with Development • By next class, be able to run Java 2 SDK 1.4 • Edit, compile, test Java/Swing programs • By 3rd class, need JBuilder environment • Will be installed in 53 Church St. • Personal Edition 8 is free download • Establish work environment now • at Harvard, work, home, laptop, or combination • See HASCS guide off of www.fas.harvard.edu • Will distribute CD next week • Online book, JDK 1.4 JavaDoc, JBuilder, readings, code Stop for Questions CSCI E-70 Lecture 1 / Bromberg

  10. Submission Standards • Clean code • Header comments: name, date, purpose, implementation notes • Thoughtfully chosen variable, constant, and class names • Consistent indentation and spacing style • Comments describing inputs, outputs, errors, and “side effects” of every major function • Evidence of testing • Show graceful error handling & non-trivial, valid inputs • Often means 2-3 well-chosen screendumps of a GUI in action • Accompanying documentation as requested • Projects: UML diagram, user manual, architectural overview... • Standards will become stricter as we provide feedback • Try your best for now; focus on clean code CSCI E-70 Lecture 1 / Bromberg

  11. Java: my take • Best widely available OO language I know of • Far from perfect • too “safe”? bounds checking slows performance • too compromised by C legacy? primitive vs. object dichotomy • Fought over by Micro$oft • Court ordered re-integration to Windows • But C# is an up-and-comer? Will .NET dominate? • Industry battles: I shrug it off • Java not independently standardized (like C) • May not last forever • As a developer, be flexible and switch when the time comes • Learn good Object Oriented programming • applicable from C through Python to Java and beyond! CSCI E-70 Lecture 1 / Bromberg

  12. Let’s Swing! • AWT/Swing libaries are a monstrous hairy beast • Fear not for ye shall wrestle them to the ground • Explain architecture on-demand for now • Get your feet wet • Tie code to visuals • Let’s put up a window • import: the GUI packages • JFrame et al.: “Heavyweight” components • contentPane: access to body area • BorderLayout: basic component layout manager • JButton: interactive control • ActionListener / ActionEvent: event handling CSCI E-70 Lecture 1 / Bromberg

  13. standard windows decoration & titlebar; inside controlled by pure Java renderers start Visual States pressed inside hilights released outside un-hilights • Note dotted outline; means • component has focus • can use space bar to fire • more on focus later resizable unless specified otherwise. centered component grows to fill bounds released inside text changes; msgs printed pressed inside hilights released outside un-hilights released inside un-hilights; msgs printed CSCI E-70 Lecture 1 / Bromberg

  14. State Machines a b • In essence • Stripped-down history of program’s execution • Only what you need to react correctly to future events • Theoretical basis of the “data models” I will be rambling about • Big Stuff • Underlies Computer Science and Computer Engineering at all levels • Practical and efficient once discipline learned • Ideally suited for processing unpredictable input over long periods • Forces understanding of the problem you’re solving CSCI E-70 Lecture 1 / Bromberg

  15. Follow-up Review and additional detail: http://java.sun.com/docs/books/tutorial/uiswing/start/index.html especially .../start/swingTour.html Problem Set 1: • Student Survey due at end of class • Programming due Friday Feb 7 11:59:59.999... • Install J2SE SDK v1.4 • Make program modifications • Turn in screen dump, code listing • Turn in modified state diagram • Answer questions to exercises • Submit package to cscie70 library account on FAS Unix system Stop for Questions CSCI E-70 Lecture 1 / Bromberg

More Related