cisc 3120 c02: overview of software development and java · •check whether java and javac are...

40
CISC 3120 C02: Overview of Software Development and Java Hui Chen Department of Computer & Information Science CUNY Brooklyn College 1/31/2018 1 CUNY | Brooklyn College

Upload: others

Post on 20-May-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

CISC 3120

C02: Overview of Software Development and Java

Hui Chen

Department of Computer & Information Science

CUNY Brooklyn College

1/31/2018 1CUNY | Brooklyn College

Page 2: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Outline

• Recap and issues

• Some concepts in software development

• Brief introduction to history of Java

• First Java program (from command line)

• Text-based application user interface

• Command line arguments

• Review concepts of class and object

• Assignments

1/31/2018 CUNY | Brooklyn College 2

Page 3: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

How well am I doing?

• Check “My Grades” CUNY Blackboard

• Updated frequently

1/31/2018 CUNY | Brooklyn College 3

Page 4: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Attendance

• Y: you arrived on time and signed attendance sheet

• N: you missed the class

• L: you signed attendance sheet, but the instructor marked it as “late”

• X: you were excused with the support of legitimate documentation

1/31/2018 CUNY | Brooklyn College 4

Page 5: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Individual Assignment

• Practice W01-1_01-29

• Individual assignment

• A: Accepted

• U: Unaccepted, not submitted, or not submitted on time.

1/31/2018 CUNY | Brooklyn College 5

Page 6: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Practice W01-1_01-29

• What shows up in Github classroom?

• Feedback method

• Comments on commits

• Any problems?

• Issue type 1: Accepted assignment, but did nothing. I don’t even know who you are (unaccepted)

• Issue type 2: The content of your file is wrong (unaccepted)

• Issue type 3: You did not create the folder for the assignment (unaccepted)

• First assignment “give-away”: fix your problem by before the class on Monday (February 5)

1/31/2018 CUNY | Brooklyn College 6

Page 7: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Group Assignment

• Project 0

• Group assignment

• Letter grade

• A: perfect or imperfect, I am very happy with what you team did.

• B: at least three members completed the task.

• C: at least two members completed the task.

• D: at least one members completed the task.

• F: nothing is done.

• Letter grade to be posted after the class, and only issued to contributors

1/31/2018 CUNY | Brooklyn College 7

Page 8: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Project 0

• What shows up in Github classroom?

• Feedback method

• Comments on commits

• Any problems?

• Issue type 1: some members did not join the team in Github

• Issue type 2: some members joined, but did not make contribution

• Issue type 3: contribution is being made, but content of the file does not meet requirement

• First team assignment “give-away”: complete the task before the class on Monday, February 5.

1/31/2018 CUNY | Brooklyn College 8

Page 9: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Questions?

• Attendance

• Practice assignment

• Team Assignment

• Github issues

1/31/2018 CUNY | Brooklyn College 9

Page 10: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Suggestion

• Use Github Issue Tracking & Comments in your assignments

• Practice assignment: manage your own to-do, bugs, and other items

• Team project: manage to-do, bugs, other items; delegate tasks to members

• Communicate with the fellow team members and the instructor

1/31/2018 CUNY | Brooklyn College 10

Page 11: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Communicate Effectively

• Follow Stack Overflow,

• https://stackoverflow.com/help/how-to-ask

1/31/2018 CUNY | Brooklyn College 11

Page 12: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Questions?

• What are you suggestions and comments?

1/31/2018 CUNY | Brooklyn College 12

Page 13: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Develop Software Applications

• Apply engineering principles and scientific techniques to software development

• Software engineering

1/31/2018 CUNY | Brooklyn College 13

Page 14: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Main Parties in Software Development

• Two main parties: customers, designers

• Real word scenarios can be more complicated about who the customers and designers are

1/31/2018 CUNY | Brooklyn College 14

Page 15: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Software Development Activities

• Main activities

• Requirement analysis

• Architectural specification

• Detailed specification

• Implementation and unit testing

• Integration and testing

• Operation and maintenance

1/31/2018 CUNY | Brooklyn College 15

Page 16: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Waterfall Model

1/31/2018 CUNY | Brooklyn College 16

Requirements specification

Architectural design

Detailed design

Implementation & unit testing

Integration & testing

Operation & maintenance

Page 17: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Lots of Documentation

1/31/2018 CUNY | Brooklyn College 17

Page 18: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Software Development Process

• Waterfall vs. Spiral vs. Agile

1/31/2018 CUNY | Brooklyn College 18

Page 19: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Validation and Verification

• Validation

• Are we building the right product?

• Verification

• Are we building the product right?

• Testing

1/31/2018 CUNY | Brooklyn College 19

Page 20: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

In CISC 3120 …

• Projects

• The instructor is your customer

• You and your team members are the designers

• You deliver a verified product to the customer

• How does the software life cycle fit in?

• Learn to design and develop applications in Java

• Mostly concern about design, specification, implementation, and testing

• Some object-oriented design and implementation

1/31/2018 CUNY | Brooklyn College 20

Page 21: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Java

• An Object-Oriented Programming language developed after C++

• Designed for devices, later for the Web

• “Write once, run anywhere”

• Java Virtual Machine (JVM)

1/31/2018 CUNY | Brooklyn College 21

Page 22: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Warm-up Group Discussion

• Read a Java program

• Answer the given questions, and during the process, think about the following,

• How much do you understand based on your knowledge and experience in C++?

• What looks familiar to you?

• What looks new to you?

1/31/2018 CUNY | Brooklyn College 22

Page 23: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Your First Java Program

• Set up environment

• Check whether java and javac are present and what versions they are

• Download and install JDK

• Create Java source code

• Use a text editor (e.g., notepad)

• Compile Java source code to generate Java byte code

• Use javac to compile the Java source code

• Run Java byte code in Java Virtual Machine

• Use java to run the Java byte code program

1/31/2018 CUNY | Brooklyn College 23

Page 24: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

The “Hello, World” Program

Create the HelloWorld.java file

public class HelloWorld {

public static void main(String[] args) {

System.out.println(“Hello, World”);

}

}

1/31/2018 CUNY | Brooklyn College 24

Page 25: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Compile and Run

• From the command line:

• Compile

javac HelloWorld.java

• Run

java HelloWorld

1/31/2018 CUNY | Brooklyn College 25

Page 26: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Questions?

• Create Java program from scratch

• Compile Java program

• Run Java program

1/31/2018 CUNY | Brooklyn College 26

Page 27: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Command Line Interface

• Also called text-based interface

• Method to interact with applications

• Interaction is from text-based terminal

• Text input only

• In Java, the interaction is done via the main method

• public static void main(String[] args)

• where “args” are the command line arguments

1/31/2018 CUNY | Brooklyn College 27

Page 28: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

The Beer Song

• A little big program that prints out the lyrics of the song “99 bottles of beer”.

1/31/2018 CUNY | Brooklyn College 28

Page 29: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Interfacing BeerSong with Command Line Arguments

• What if I want to start at 10 beers?

1/31/2018 CUNY | Brooklyn College 29

Page 30: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Questions

• Using command line arguments

• Writing applications with text-based interface

1/31/2018 CUNY | Brooklyn College 30

Page 31: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Real-world Objects

• Examples

• Chairs, desks …

• Student, instructor …

• State and behavior

1/31/2018 CUNY | Brooklyn College 31

Page 32: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Software Objects

• State

• States are stored in fields (member variables in C++, instance variables in Java, …)

• Behavior

• Methods (member function in C++, instance methods in Java, …)

• Methods operate on an object's internal state

• Methods serve as the primary mechanism for object-to-object communication.

1/31/2018 CUNY | Brooklyn College 32

Page 33: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Data Encapsulation

• Hide internal state

• Require interaction to be performed through an object's methods

1/31/2018 CUNY | Brooklyn College 33

Page 34: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Using Objects

• Modularity

• The source code for an object can be written and maintained independently.

• Information-hiding

• With data encapsulation, the details of its internal implementation remain hidden from the outside world.

• Code re-use

• Use objects written by you and other developers in many applications

• Allow specialists to implement/test/debug complex, task-specific objects

• Pluggability and debugging ease

• Can simply replace or diagnose problematic object

1/31/2018 CUNY | Brooklyn College 34

Page 35: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Real-world Classes

• Many individual objects are of the same kind

• Many classes you can take

• Many buses you can ride

• There are many students

• They are of the same “blueprint”

• A bus has different “color”, “capacity”, “route” …, i.e., has the same set of fields, but different values

1/31/2018 CUNY | Brooklyn College 35

Page 36: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Software Class

• A class is the blueprint from which individual objects are created

• Fields and methods

• A class can have many instances

1/31/2018 CUNY | Brooklyn College 36

Page 37: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Design Java Program

• Identify objects and classes

• Identify fields and methods

1/31/2018 CUNY | Brooklyn College 37

Page 38: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

The BeerSong Revisited

• More OOP way to write the BeerSongprogram

• Two objects

• A BeerSong object

• A BeerSongDriver object

• Object-to-object interaction

• The BeerSongDriver object calls the method of the BeerSong object

1/31/2018 CUNY | Brooklyn College 38

Page 39: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Questions

• Review a few concepts in Object-Oriented Programming

• Objects

• Classes

• Fields & Methods

• State and Behavior

1/31/2018 CUNY | Brooklyn College 39

Page 40: CISC 3120 C02: Overview of Software Development and Java · •Check whether java and javac are present and what versions they are •Download and install JDK •Create Java source

Assignments

• Assignment posted the Class Website and the Blackboard

• Practice assignment

• CodeLab assignment

1/31/2018 CUNY | Brooklyn College 40