Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to System Development with Java and OO Programming Illinois Institute of Technology School of Applied Technology ITM 311 Lecture 03 William.

Similar presentations


Presentation on theme: "Introduction to System Development with Java and OO Programming Illinois Institute of Technology School of Applied Technology ITM 311 Lecture 03 William."— Presentation transcript:

1 Introduction to System Development with Java and OO Programming Illinois Institute of Technology School of Applied Technology ITM 311 Lecture 03 William F. Slater, III, M.S., MBA, PMP, CDCP Spring Semester 2013 January 28, 20131IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

2 Presentation Location http://sdrv.ms/1123Cz6 January 28, 20132IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

3 Supplemental Materials Location http://sdrv.ms/LAXhFP January 28, 20133IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

4 Learning Objectives Learn more about Java and System Development Examples of Code and Resources UML Agile January 28, 20134IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

5 Assignments For Session 03 Review Syllabus Download Lecture Materials Do Exercise Chapter 3 January 28, 20135IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

6 Agenda Course Introduction & What to Expect An Introduction to your Instructor Intro to Programming Java and System Development Examples of Code and Resources UML Agile Conclusion January 28, 20136IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

7 COURSE INTRODUCTION & WHAT TO EXPECT January 28, 20137IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

8 Course Introduction This course introduces basic concepts of software development. Students learn the Java programming language and apply basic programming concepts toward solving problems using Java, create source files, understand how to the Java SDK, the JAVA API, and the acquire basic debugging skills. They will also understand, work with and effectively use basic data types, compile source code into class files, and understand the use of project management as it applies to software development. Course Dates: January 17 – May 2013 Locations: IIT Main Campus January 28, 20138IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

9 Course Introduction Lecture 01 – Introduction to Computers, Programs, and Java Lecture 02 – Elementary Programming Lecture 03 – Selections Lecture 04 – Loops Lecture 05 – Data Center Management Tools and Data Center Tools and Reporting Lecture 06 – Methods Lecture 07 – Arrays & Multidimensional Arrays Lecture 08 – Objects and Classes Lecture 09 – Strings Lecture 10 – Thinking in Objects Lecture 11 – Inheritance and Polymorphism Lecture 12 - GUI Basics & Graphics Lecture 13 – Exception Handling and Text IO Lecture 14 – Abstract Classes and Interfaces Lecture 15 – Event-Driven Programming January 28, 20139IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

10 Course Text Text Title: Introduction to Java Programming, Comprehensive Version, 8E Author: Y Daniel Liang Date:2010 Publisher:Wiley Publishing January 28, 201310IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

11 Supplemental Course Texts To Be Announced… January 28, 201311IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

12 Major Course Assignments AssignmentDescription 10 Exercises10 Exercises based on Programming and System Development Concepts 1 Project (Team or Solo)Modify an existing Project Propose your own I can provide choices 1 Mid TermMid Term Exam – Open Book, multiple choice, short answer, some coding segments 1 Final ExamFinal Exam – Open Book, multiple choice, short answer, some coding segments January 28, 201312IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

13 Most Important Concepts Coding is cool Coding requires concentration and patience Coding works better if you can learn the syntax, do pseudo code, flowcharts, and visualize what you are doing January 28, 201313IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

14 Extra Credit Certifications for Extra Credit: – FREE Certifications: – 15 Points each - Limit 2 – Other IT FREE certifications that you can obtain – 1) IPv6 Certification (FREE) – http://IPv6.he.net – 2) Telework Fundamentals for Managers - Training Completion Certificate (FREE) – http://www.telework.gov/tools_and_resources/training/managers/index.aspx – 3) Telework Fundamentals for Employees - Training Completion Certificate (FREE) – http://www.telework.gov/tools_and_resources/basics_employees/index.aspx Telework Fundamentals for Managers – Resources http://www.telework.gov/guidance_and_legislation/telework_guide/telework_guide.pdf http://sdrv.ms/xNldlU (get the 45 MB Word document for the slides from Telework Fundamentals for Managers and other information) January 28, 201314IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

15 Extra Credit January 28, 201315IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

16 AN INTRODUCTION TO YOUR INSTRUCTOR January 28, 201316IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

17 Contact Info Classes will meet every Wenesday at 5:30 PM – 9:00 PM (Alternate) (Primary) wslater@iit.edu January 28, 201317IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

18 Your Instructor About me – IT professional since July 1977 – Currently a Senior IT Consultant and Adjunct Instructor – Veteran of several Data Center projects and efforts: 2008 – 2009 Data Center Build and Migration Effort for a Manufacturing Company 2008 – Manager of the Microsoft Chicago Data Center (one of the world’s largest at 120 MW, 705,000 sq. ft.) 2007 – 2008 – Managed a Data Center Migration for a Small Business 2007 – Technical Project Manage for a Data Center Migration effort at the Dept. of Veterans Affairs 2001 – 2006 Managed Data Centers at BP 2000 – 2001 – Managed a Data Center Migration for a Non-Profit Company 1995 – Worked in a Data Center at a local clothing manufacturer and helped deploy and document their first Enterprise LAN 1977 - 1980 – Worked at a WWMCCS Data Center at Strategic Air Command Headquarters, Offutt AFB, NE – 2005 – 2008 Part-time senior adjunct instructor with the Computer Systems Institute of Chicago – 2000 – 2002 Part-time adjunct instructor at IIT in Chicago and at the IIT Rice Campus in Wheaton, IL – Have achieved IT-related certifications, including PMP, CDCP, CISSP, SSCP, CISA, MCITP, MCSE 2003 Security & Messaging, MCSD, MCAD, MCDST, and MCT – Data Center Technology Program – Marist College & and the Institute of Data Center Professionals, February 2008 – Received the Certified Data Center Professional Certification – M.S. in Cybersecurity – Coming in March 2013! – MBA, University of Phoenix, 2010 – MS in Computer Information Systems, University of Phoenix, 2004 – BS in Engineering Technology with a major in Computer Systems Technology, Memphis State University, 1977 (now the University of Memphis) – Published author & editor: magazines, books, courseware – Happily married (since December 2000) to Joanna K. Roguska, who is a professional web developer at the Chicago Tribune – Resident of Chicago / Chicagoland area since 1986 (except for the period between May 1991 and December 1994) – Visit http://billslater.com/career for more informationhttp://billslater.com/career January 28, 201318IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

19 Teaching Philosophies and Goals I am here to lead, facilitate, inspire and teach - and I am not here to trick you. Learning should be fun and continuous. Passion and Enthusiasm are contagious. You cannot learn a topic or a skill from a single book or source. So please dig in and find multiple sources for Data Center Knowledge. I will provide a LOT of related sources and articles – you should read and study as much as possible to facilitate your knowledge, understanding and growth I am here to help mold you into a great Data Center Professional. If you work at it, get involved, read the materials think about it, and ask questions, you will learn a lot. January 28, 201319IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

20 Technical Job Skills Project Management Program Management Data Center Management Data Center Design and Development Mentoring Troubleshooting Problem Solving Information Security Systems Administration System Architecture and Design Database Design, Implementation, and Administration Network Design, Implementation and Administration Intranet Design and Implementation Infrastructure Design and Management Change Management Service Management Technology Assessment System Analysis & Design OO System Analysis & Design System Development using, VB.NET 2003, C#, Visual Basic 6, Java 2, and J2EE PERL and PYTHON Scripting Web Authoring/Web Publishing System Performance Tuning GUI Analysis, Design and Review Technical Writing, Documentation, and Editing Technical Training Safety Management January 28, 201320IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

21 1977 - First Job Out of College 2LT William F. Slater, III United States Air Force Computer Systems Staff Officer July 1977 Strategic Air Command Headquarters Offutt Air Force Base, NE Circa late 1970s – UNCLASSIFIED Configuration January 28, 201321IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

22 A Career in Information Technology If you are interested, visit these Links: http://billslater.com/career http://billslater.com/certifications http://billslater.com/interview http://billslater.com/writing January 15, 2013 http://billslater.com/datacentermanager http://billslater.com/iso27001 http://on.fb.me/fW3wH0 http://on.fb.me/vfGRVi http://billslater.com/ms_cybersecurity January 28, 201322IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

23 INTRO TO PROGRAMMING January 28, 201323IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

24 Programming 101 William F. Slater, III August 3, 2000 A Presentation for the Downtown Chicago IT Webmaster Program Illinois Institute of Technology January 28, 201324IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

25 Topics What is programming? Where did it start? Why program? What is an alogrithm? What is a Flow Chart? What is Pseudo Code? How do you develop a program? General Programming Tips Programming Concepts January 28, 201325IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

26 What Is Programming? Using a computer and software to automate a task and solve a problem, or create something January 28, 201326IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

27 Where Did It Start? Charles Babbage and his analytical engine computing machine Countess Ada Lovelace January 28, 201327IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

28 Why Program? It’s efficient It allows you the freedom to do other things if you simply your life by having computers do the work faster It’s fun It’s profitable If your competitors are doing programming to achieve greater efficiencies and you and your company are not – they will beat you and your company. January 28, 201328IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

29 What Is an Algorithm? A finite set of steps to follow to solve a problem. Many times algorithms are expressed in pseudo code, or even a mathematical expressions January 28, 201329IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

30 What Is a Flow Chart? A set of symbols and lines which explain the steps, to follow to accomplish some goal. Flow Charts are good for explaining “computer programming logic” Flow charts explain “procedural code” well. A procedure is an organized set of steps for accomplishing a task Procedural coding is an organized set of steps of accomplishing a task January 28, 201330IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

31 Flow Chart Symbols January 28, 201331IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

32 Flow Chart to Order Food January 28, 201332IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

33 What Is Pseudo Code? “False Code” that does not follow programming language syntax, but it does express in words, the steps required for a program to solve a problem. Example: Source: http://accurev.com/blog/wp-content/uploads/2007/05/kw_pseudo_code_example.jpghttp://accurev.com/blog/wp-content/uploads/2007/05/kw_pseudo_code_example.jpg January 28, 201333IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

34 What Is Pseudo Code? Source: http://accurev.com/blog/wp-content/uploads/2007/05/kw_pseudo_code_example.jpghttp://accurev.com/blog/wp-content/uploads/2007/05/kw_pseudo_code_example.jpg January 28, 201334IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

35 Coding Humor: What Is Sumo Code? January 28, 201335IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

36 How Do You Develop a Program? January 28, 201336IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

37 How Do You Develop a Program? Define the problem Write a spec (& write a user manual early) Design the program design your tests also Draw a flow chart Write Pseudo-code Get a syntax book handy and write the code Test the code, unit test and system test Make revisions (go back and test!) Document the program when you are finished Create the training docs. Train the user Have a Release party! January 28, 201337IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

38 General Programming Tips Study to understand HOW documented programs in books, etc. work Modify & run existing programs to increase your confidence with the technology Make changes carefully and incrementally – and always test after each change! Always think about what you are doing Learn to “read” code Keep your code simple and program for maintainability Remember that every line of code should contribute to the larger effort of solving a problem Strive for excellence and to be doing it smarter Always back up your work Always document your work January 28, 201338IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

39 Programming Concepts Data Expressing formulas as code Assignment Loops Tests Input Output Arrays January 28, 201339IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

40 Conclusion Programming is a great skill to develop Learning to think and express yourself logically is a great skill for learning to program An Algorithm is a finite set of steps required to accomplish a task or solve a problem A Flow Chart is a great way to express the steps a program is to perform Pseudo-Code is an English-like way of expressing the tasks that need to be accomplished in a program A program is best written from a flow chart and pseudo- code Programming is meticulous, thought-provoking work, and it pays well. January 28, 201340IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

41 Solving a Project Management Problem: How to Handle the Challenges of Accurate Time Tracking and Reporting When Handling Multiple High-Visibility, Complex Projects and Heavy Multi-tasking Every Day William F. Slater, III, PMP University of Phoenix February 2010 January 28, 201341IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

42 Working on Solving the Problem And belief overmasters doubt, and I know that I know, And my spirit is grown to a lordly great compass within, That the length and the breadth and the sweep of the marshes of Glynn… Sidney Lanier, “The Marshes of Glynn” I was on vacation when I decided to do the analysis, design, and implementation of this Time Tracker Application. This photo was taken in a hotel room in Lansing, MI as I was working on finishing this application. January 28, 201342IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

43 January 28, 201343IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

44 January 28, 201344IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

45 January 28, 201345IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

46 January 28, 201346IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

47 January 28, 201347IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

48 January 28, 201348IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

49 January 28, 201349IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

50 January 28, 201350IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

51 January 28, 201351IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

52 January 28, 201352IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

53 Time Tracker 2.0 User Interface January 28, 201353IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

54 January 28, 201354IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

55 Time Tracker 3.0 User Interface January 28, 201355IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

56 January 28, 201356IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

57 Time Tracker 4.0 User Interface January 28, 201357IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

58 January 28, 201358IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

59 Work Philosophy It’s not how hard you work… It’s how much you get done. January 28, 201359IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

60 Questions? January 28, 201360IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

61 JAVA AND SYSTEM DEVELOPMENT January 28, 201361IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

62 Java 2 and OO Programming William F. Slater, III Instructor Lesson 001 January 28, 201362IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

63 Agenda Introduction What is Java? Some Brief Java History Why Java? Tools Your first Java program Conclusion January 28, 201363IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

64 Introduction About the class – 10 weeks of fun and hard work About me About you January 28, 201364IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

65 What is Java? A high level, platform-independent, object- oriented computer programming language that is well-suited for application development in a distributed computing environment, especially the World Wide Web. Related to C and C++ January 28, 201365IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

66 Some Brief Java History Developed in 1991 by a team of programmers (called the Green Project) led by master computer scientist, James Gosling, at Sun Microsystems. They were attempting to develop programs for an automated appliance market and found C++ too unwieldy to work with Originally named “Oak” Fast becoming the world’s most popular development environment The official Java website is java.sun.com January 28, 201366IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

67 James A. Gosling Ace programmer at Sun Microsystems Led the development Team that created Java Generally regarded as the “Father of Java” Working on creating Real-time systems capability for Java http://java.sun.com/people/jag/ January 28, 2013IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

68 Why Java? The world needed: – An OO language, something better than C++ – An OO development environment that was platform independent – An OO language that was easy to use on the Internet and WWW January 28, 201368IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

69 How and Why is Java Platform Independent? Java Compiler Bytecode Java Virtual Machine Java Compiler Java BytecodeJava Code Sun Sparc PowerPC Intel (x86 or x64) Virtual Machines For each hardware platform The Java Compiler reads the source code (.java) and creates one or more.class files that be run by the Java Virtual Machine January 28, 201369IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

70 Tools JDK Or commercial Java Development Environments A computer GUI OS Text Editor Web browser Java Virtual Machine A design and algorithms Your brain January 28, 201370IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

71 Installation We will install the JDK 1.4 which is the Java Development Environment that IIT wants us to use Install the 36 MB file to c:\dev\Java2 January 28, 201371IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

72 Modify the Path Right click on my computer to get to the properties to modify the Path with this information at the end: ;c:\dev\Java2\bin This will permit you to easily compile and run your Java programs from the Command Prompt. January 28, 201372IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

73 Java Compiler Options Usage: javac where possible options include: -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info -O Optimize; may hinder debugging or enlarge class file -nowarn Generate no warnings -verbose Output messages about what the compiler is doing -deprecation Output source locations where deprecated APIs are used -classpath Specify where to find user class files -sourcepath Specify where to find input source files -bootclasspath Override location of bootstrap class files -extdirs Override location of installed extensions -d Specify where to place generated class files -encoding Specify character encoding used by source files -source Provide source compatibility with specified release -target Generate class files for specific VM version -help Print a synopsis of standard options January 28, 201373IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

74 Java Run Options Usage: java [-options] class [args...] (to execute a class) or java -jar [-options] jarfile [args...] (to execute a jar file) where options include: -client to select the "client" VM -server to select the "server" VM -hotspot is a synonym for the "client" VM [deprecated] The default VM is client. -cp -classpath set search path for application classes and resources -D = set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -showversion print product version and continue -? -help print this help message -X print help on non-standard options -ea[:...|: ] -enableassertions[:...|: ] enable assertions -da[:...|: ] -disableassertions[:...|: ] disable assertions -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions January 28, 201374IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

75 Your First Java Program Using Explorer, create a directory with the name of your last name Using Notepad, or another test editor, type in the the following program and save it in your new directory as “HelloDan.java” January 28, 201375IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

76 Your First Java Program The source code for “HelloDan.java” Class HelloDan { public static void main (String[] arguments) { System.out.println(“What’s the frequency, Kenneth?”); } January 28, 201376IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

77 Run Your First Java Program Start up a Command Prompt Session: For Windows 9x or ME: – Start | Run | command | OK For Windows NT or Windows 2000 – Start | Run | cmd | OK At the command prompt, type this shown below and press [Enter]: javac HelloDan.java January 28, 201377IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

78 Conclusion Java is the answer to the needs of many development needs Java is truly platform independent because it is compiled to bytecode which is interpreted by the Java Virtual Machines Java Virtual Machines have been created for most modern computing platforms, and they are not all created equal Java requires an orientation toward objects and good program design Java and OO are some of the hottest skills you can have January 28, 201378IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

79 Java 2 and OO Programming William F. Slater, III Instructor Lesson 002 January 28, 201379IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

80 Agenda Introduction Thinking in Objects Object Terminology Objects and Classes Attributes and Behavior Your First Java Class Organizing Classes and Class Behavior Java Terminology Review Conclusion January 28, 201380IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

81 Introduction Java is an OO language and was designed that way on purpose Objects are a powerful way to organize and describe the details of a business problem domain. A object-oriented approach to analysis, design, and coding results in the ability to organize and re-use code that procedural coding does not. Object-oriented thinking tends to place data and logic together, which is counter to procedural coding methods To gain an understanding of OO, you need to learn the jargon and the concepts. In the mid-1990s, OO evolved to the point where it gained its own descriptive language called the Unified Modeling Language, or UML. Object diagrams, analysis components, and design components are described in UML diagrams. Java can’t be fully appreciated without understanding OO January 28, 201381IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

82 Thinking in Objects Thinking in objects is different than writing procedural code You create or define objects that are “Participants” or “Actors” in the system you build It requires more work, but it is rewarding because: – You get a better system that more closely emulates the real world – It is better for code re-use and code maintenance Now we will cover Object Concepts in a presentation titled, “ A High-Speed Intro to Object-Oriented Technology” January 28, 201382IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

83 Object Terminology Objects Attributes Methods (Services) Messages Classes Encapsulation Inheritance Class diagrams Superclass Subclass Polymorphism Object Models OOA OOD OOP UML Name Attributes Services For simplicity and a standardized notation, you should represent an Object like this: January 28, 201383IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

84 Objects A self-contained element of a computer program that represents a group of features. Designed to accomplish a specific task Sometimes objects are called instances Sometimes the creation of an object is known as the act of instantiating it Name Attributes Services For simplicity and a standardized notation, you should represent an Object like this: Examples of Objects: This is sometimes called “Coad Notation” after Peter Coad. January 28, 201384IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

85 Classes A class is a template used to create multiple objects with similar features. A class embodies all the features of a particular set of objects A Class has a Name. When you write a program in an object- oriented language, you don’t define individual object, but rather, you define classes of objects. A group of classes organized together form a Class Library. A standard Java class library known as java.awt encompasses several UI objects and we will learn how to use this in a few weeks. Name Attributes Services January 28, 201385IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

86 Attributes Attributes describe an object Attributes differentiate one class from another Example Attributes: – Size – Dimensions – Gender – Appetite Name Attributes Services January 28, 201386IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

87 Attributes In Java, the instance variable is the mechanism for defining an attribute about a particular object Name Attributes Services January 28, 201387IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

88 Methods (Services) Describe the behaviors of an object. Name Attributes Services January 28, 201388IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

89 Messages Are how objects communicate with each other Name Attributes Services Name Attributes Services January 28, 201389IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

90 Encapsulation The ability to simplify the understanding of a component in a problem domain by defining it as an object and gathering its attributes and behaviors together After it is defined, an object encapsulates all the details of a component, and thereby hides the details, making it simpler and easier to understand. Name Attributes Services All details about Attributes and Methods Are Encapsulated in this Object January 28, 201390IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

91 Class Diagrams A diagram that describes the relationship between superclasses and subclasses. superclass subclasses January 28, 201391IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

92 Superclass A higher general class that has more specific subclasses superclass subclasses Monster FlyingWalkingSwimming January 28, 201392IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

93 Subclass A sub-category of a class that is able to inherit attributes and methods of a superclass superclass subclasses Monster FlyingWalkingSwimming January 28, 201393IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

94 Inheritance The ability for the attributes and methods of one class to be passed into and used by classes that are subordinate to it superclass subclasses Monster FlyingWalkingSwimming January 28, 201394IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

95 Polymorphism Taking many forms. Single interface, many implentations. Specifically, calling a virtual method for a variable whose precise type isn’t known at compile time. The behavior is established at run time via late binding. superclass subclasses Monster FlyingWalkingSwimming Eat() Example: Under the concept Of Polymorphism The subclasses of Flying and Walking Monsters have their own Eat() method. But the Smimming subclass inherits Its Eat() method from the Monster superclass. January 28, 201395IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

96 Object Models In order to create a quality object-oriented system, you need to create an object-oriented model. There are two types of models: OOA and OOD The more closely your model reflects the real world problem you are trying to simulate, the better your system will be. Object Models are normally described using UML (the Unified Modeling Language). January 28, 201396IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

97 OOA OOA = Object-Oriented Analysis The process of performing analysis that leads to the identification of objects in a problem domain, and carefully describes the names, attributes, and behaviors of these objects It also groups these objects into hierarchies of object classes, with superclasses and subclasses The output of an OOA effort is an OOA model. January 28, 201397IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

98 OOD OOD = Object-Oriented Design A method of taking the output of an OOA, which is an OOA Model and creating an OOD, which describes the OO System in such detail that it can be coded and implemented according to a project plan. The output of an OOD effort is an OOD Model, which is used as a roadmap to create an OO System January 28, 201398IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

99 OOP OOP = Object-oriented Programming It is a method of programming that employs the discipline of designing and creating objects first, then creating the code that describes the classes, attributes and methods (behaviors) that represent those objects. It employs encapsulation, inheritance, and polymorphism January 28, 201399IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

100 UML The Unified Modeling Language is a set of rules and syntax and diagrams used to design, describe, and build object models It is the culmination of a time span of about 20 years of OOA and OOD methodologies, and literally represents the merging of about five very good OOA / OOD methodologies. January 28, 2013100IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

101 Attributes and Behavior Attributes and behavior uniquely define an object Attributes describe things about the object Behaviors describe what the object does and how it interacts with other objects and with its environment January 28, 2013101IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

102 Interface A collection of methods that indicate that a class has some behavior in addition to what it inherits from its superclasses Interfaces will be explored later. January 28, 2013102IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

103 Your First Java Class We will type in the Jabberwock.java program using “Visual Notepad”. At the command prompt, we will compile this into a file named jabberwork.class: javac jabberwock.java We will then run this class file at the command prompt: java jabberwock.class January 28, 2013103IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

104 Classes and Packages You organize classes into class libraries Many class libraries already exist Packages are a way of grouping related classes and interfaces Class libraries are contained in a package called java In Java syntax, to refer to a class January 28, 2013104IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

105 Java Terminology Review Objects Attributes Behaviors Classes Class Libraries Packages January 28, 2013105IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

106 Running a Program from the Browser using the Java Virtual Machine (Java VM) We will now type in the palindrome.java At the command line: – Javac palindrome.java We will create a web page in HTML and run this together. January 28, 2013106IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

107 Running Program 3 From a Browser Use this HTML to run your palindrome Java program. Type in this HTML and save it as palindrome.html The Palindrome Program My First Web-based Java Program!! January 28, 2013107IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

108 Conclusion Java is based on object-oriented technologies To understand Java, you need to understand the terminology of the world of object- oriented technology OO is a different way of thinking than the world of straight procedural coding. January 28, 2013108IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

109 Java 2 and OO Programming William F. Slater, III Instructor Lesson 003 January 28, 2013109IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

110 Agenda Introduction Statements and Expressions Variables and Data Types Comments Literals Expressions and Operators String Arithmetic Example programs and discussion Summary Conclusion January 28, 2013110IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

111 Introduction Like any “language” the Java language has parts that you must understand in order to use it Mastering the proper use of the language is called mastering the syntax You may often need a reference manual Until you become experienced at the Java language, don’t be afraid to keep a syntax manual handy You need to understand Java commands in order to code programs from scratch and also to modify existing Java programs Unfortunately, having good syntax is no guarantee that your program logic or your system design is good January 28, 2013111IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

112 Statements and Expressions A statement is a simple command written in a programming language that causes something to happen. Examples: age = 30; player.score = 1257; An expression is a statement that results in a value being produced. The value can be stored for later use in the program, used immediately for another statement, or disregarded. The value produced by an expression is known as its return value. Examples will be given later… January 28, 2013112IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

113 Variables A variable is a place where information can be stored while a program is running. The value can be changed at any point in the program – hence the name. As a matter of necessity and good programming practice, ALL variables MUST be declared with the data type before they are used. January 28, 2013113IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

114 Types of Variables Instance – Used to define an object’s attributes Local – Used inside a method definition Class – Defined in the class itself and applies to the class and all of its instances January 28, 2013114IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

115 Variable Rules Must be declared before use Variable Names must start with a letter, underscore character (_), or a dollar sign ($). After the first legal character, variable names can be any combination of characters, except blanks. The variable is declared with its data type: Examples: – int age; – String StudentComment; – boolean class_state; January 28, 2013115IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

116 Variable Rules Naming guidelines: – The first letter of the variable name is lowercase – Each successive word in the variable name begins with a capital letter (for readability) – All other letters are lowercase The best variable names are descriptive and contribute to someone (including yourself) understanding what is going on in your program January 28, 2013116IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

117 Other Variable Considerations: Types In addition to having a name and data type, at declaration a variable can also have – the name of a class or interface – An array (we’ll discuss arrays later) January 28, 2013117IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

118 Data Types Java has several basic data types: These are called primitives – Integers byte – 8 bits – values from –128 to 127 short – 16 bits – values from –32,768 to 32,767 int – 32 bits – values from -2,147,483,648 to 2,147,483,647 Long – 64 bits – values from … (very big numbers) – float -- Floating point numbers – Double – very large floating point numbers – char -- character – string -- a “string” of characters – boolean -- boolean January 28, 2013118IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

119 Variable Initialization Variables may be initialized when they are declared: – Examples: int age = 30; string instructor = “Bill Slater”; Programmer Initialization always takes place with an equals sign (=) If you don’t set the initial value, Java provides these defaults: – Numeric variables 0 – Characters ‘\0’ – Booleans false – Objects null January 28, 2013119IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

120 Class Types In addition to the basic data types, variables can have a class as its type When a variable has a class as its type, the variable refers to an object of that class or one of its subclasses Examples: – Jabberwork firstMonster; – (where firstMonster refers to a Jabberwock object) January 28, 2013120IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

121 Comments Comments are addition information included as documentation in your program Comments are preceded by two // Multi-line comments are offset by /* at the start and */ at the end. Comments are extremely useful and are disregarded by the Java compiler Computer readable comments which will be added in your program as official documentation are offset by by /** at the start and */ at the end. When you use this form of comments, you can generate BEAUTIFUL web-based documentation using the Sunsoft javadoc program. Run this automated documenter program in the directory where your.java source files are, like this: javadoc *.java Comments assure that you or anyone else will have a chance to understand what you were doing at that point in your program The best programmers use comments January 28, 2013121IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

122 Literals Literals are characters placed between quotes – Example: string street_address = “1409 N. Ashland Ave.”; January 28, 2013122IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

123 Operators OperatorMeaning ( ) Brackets used to offset parts of expressions [ ] Parentheses used to offset parts of expressions. accesses methods and variables ++ Increment by 1 -- Decrement by 1 ! not ~ complement new Creates a new instance of a class January 28, 2013123IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

124 Operators OperatorMeaning * multiplication / division % modulus + addition - subtraction << Left shift >> Right shift < Less than January 28, 2013124IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

125 Operators OperatorMeaning > Greater than <= Less than or equal to >= Greater than or equal to = Equal to != Not equal to & Bitwise AND ^ Bitwise OR && Logical AND January 28, 2013125IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

126 Operators OperatorMeaning || Logical OR = Assigns expression on right to the variable on the right += Add expression on right to the variable on the left and store the result in the variable on the left -= Subtract expression on right from variable on left and store the result in the variable on the left /= Divide expression on right into the variable on left and store the result in the variable on the left *= Multiply expression on right with the variable on the left and store the result in the variable on the left %= Takes the expression on right with the variable on the left and store the result in the variable on the left January 28, 2013126IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

127 Expressions and Operators We will review these in class. January 28, 2013127IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

128 String Arithmetic We will review this later in class. January 28, 2013128IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

129 Example Programs Jabberwock.java Shape.java Let’s write a quick program in class January 28, 2013129IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

130 OO Technology Revisited: UML Class Diagram for Shape.java January 28, 2013130IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

131 Shape Rectangle -color : Color -origin : Point +area() : double +getColor() : Color +getOrigin() : Point +perimeter() : double +setColor( col : Color) : void +setOrigin( org : Point) : void #Shape( col : Color, org : Point) #Shape() #Shape( org : Point ) -height : double -width : double +area() : double +getH() : double +getW() : double +perimeter() : double #Rectangle( org : Point, h : double, w : double) #Rectangle() +setHW( h : double, w : double) : void Circle -radius : double +area() : double #Circle ( org : Point, rad : double ) #Circle() +getRadius() : double +perimeter() : double +setRadius( r : double ) : void From Bruce Wampler’s Book: The Essence of Object-Oriented Programming with Java and UML Copyright 2002, Published by Addison-Wesley January 28, 2013131IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

132 Questions What are the Attributes? What are the Methods? What are the Constructors? What gets Inherited? Where is the Polymorphism? Where is the Encapsulation? January 28, 2013132IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

133 Program Output Using System.out.println System is a standard Java class System has three fields can be used for input and output: – Out – the standard output stream – Err – the standard error stream – In – the standard input stream January 28, 2013133IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

134 Program Output Using System.out.println class Rodina_01 { public static void main(String args[]) { int population = 150000000; String age = "30?"; String language = "Russian"; String answer1 = "DA!"; String answer2 = "NYET!"; String goodbye = "Dasvedanya!"; System.out.println("The language of the Rodina is " + language); System.out.println(answer1); System.out.println("The population is " + population); System.out.println(answer1); System.out.println("The average age is " + age); System.out.println(answer2); System.out.println(goodbye); } January 28, 2013134IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

135 Summary Between variables, statements, expressions, data types and operators we have just seen some of the key building blocks of the Java language January 28, 2013135IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

136 Conclusion Like any other language or programming language, Java has basic parts that make up the language It is important to understand the basic parts so you can get the syntax correct when you build your Java Classes and programs. January 28, 2013136IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

137 EXAMPLES OF CODE AND RESOURCES January 28, 2013137IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

138 Examples of Code and Resources DoStocks.java – 1,080,000 records – Report in under 2 seconds on an i5 CPU January 28, 2013138IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

139 UML January 28, 2013139IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

140 UML Unified Modeling Language Open Standard www.uml.org 14 types of diagrams Current Version = 2.x Used by – Business Analysts – System Analysts – System Designers – Developers – Testers – QA – Project managers – Technical managers January 28, 2013140IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

141 AGILE January 28, 2013141IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

142 Agile Agile is the typical development methodology today – Iterative, short development cycles, 2 to 4 weeks – Heavily user focuses (user “stories”) – Very results focused Used with SCRUM (More about SCRUM Later) January 28, 2013142IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

143 Agile, Not Fragile Development January 28, 2013143IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

144 CONCLUSION January 28, 2013144IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

145 Conclusion We discussed the following: Intro to Programming and System Development Examples of Development January 28, 2013145IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

146 Questions? January 28, 2013146IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013

147 Assignments For Session 04 Chapter 4, Liang Exercise 1 January 28, 2013147IIT ITM 311 – Intro to System Development Using Java - Lecture 01 - Spring 2013


Download ppt "Introduction to System Development with Java and OO Programming Illinois Institute of Technology School of Applied Technology ITM 311 Lecture 03 William."

Similar presentations


Ads by Google