Title: Starting Software Development
1Starting Software Development
2- You Learn
- Software Development By Doing
- Software development
3Starting Software Development
- How to develop simple Object Oriented programs.
- How to create Objects to perform simple tasks.
- How to compile and run programs that use Objects.
- A simple understanding of the Java programming
language. - How to read a class diagram.
- A basic vocabulary of Software Development
4- Software Development
- Is
- Building Models
5- A Model is not
- The real thing
6An object has state and behaviour
State
Behaviour
Load Depart Unload Load fuel Is In Transit Is
Heading For ...
Registration Make Axle Weight Driver Destination
7Software Models the Real world
Lorry Registration F423 675 Make
Ford Axle Weight 25 tonnes Driver
Fred Status LOADING Destination
BIRMINHAM DEPOT Left at 8.35 Due at
11.50
8Suit Face Value
9behaviour
Draw Turn Stack
SuitIs ColourIs IsPictureCard
10(No Transcript)
11An object is an instance of a class that has
state and behaviour
12(No Transcript)
13public class SimpleCounter extends Object
private int count // End class simplecounter
count 5
count
count count 2
5
6
8
14public class SimpleCounter extends Object
private int count // the constructor public
SimpleCounter (int startValue) count
startValue // End SimpleCounter()
// a simple action public void click ()
count // End click() // a
'getter' public int getValue() return
count // End getValue() // End class
simplecounter
15(No Transcript)
16(No Transcript)
17Modifying a class Adding a new method
18public class SimpleCounter extends Object
private int count // the constructor public
SimpleCounter (int startValue) count
startValue // End SimpleCounter()
// a simple action public void click ()
count // End click() // a
'getter' public int getValue() return
count // End getValue() // End class
simplecounter
// a new action public void add2()
count count // End click()
19SimpleCounter myCount new SimpleCounter(21)
myCount
count
21
20 public class SimpleCounterDemonstration extends
Object public static void main (String
args) SimpleCounter myCount new
SimpleCounter(21) System.out.print(
"First value ") System.out.println(
myCount.getValue()) myCount.click()
System.out.print( "Second value ")
System.out.println( myCount.getValue())
myCount.click() myCount.click()
System.out.print( "Third value ")
System.out.println( myCount.getValue())
// End of main // end of class
SimpleCounterDemonstration
public void click() count
public int getValue() return count
First Value
21
Second Value
22
Third Value
24
22
23
24
myCount
21 public class SimpleCounterDemonstration extends
Object public static void main (String
args) SimpleCounter myCount new
SimpleCounter(21) SimpleCounter count2
new SimpleCounter(5) System.out.println(
"First value " myCount.getValue())
System.out.println( "Second value "
count2.getValue()) myCount.click()
count2.click() System.out.println( "Third
value " myCount.getValue())
System.out.println( "Fourth value "
count2.getValue()) myCount.click()
myCount.click() System.out.println( "Fifth
value " myCount.getValue())
System.out.println( "Sixth value "
count2.getValue()) // End of main //
end of class SimpleCounterDemonstration
First value
21
Second value
5
Third value
22
Fourth value
6
6
22
23
24
Fifth value
24
Sixth value
6
myCount
count2
22An object is an instance of a class that has
state and behaviour
23A Reminder
public class SimpleCounter extends Object
private int count // the constructor public
SimpleCounter (int startValue) count
startValue // End SimpleCounter()
// a simple action public void click ()
count // End click() // a
'getter' public int getValue() return
count // End getValue() // End class
simplecounter
24Modifying a class Extending
public class SillyCounter extends
SimpleCounter public SillyCounter (int
theCount) super(theCount) public
void click3() super.click()
super.click() super.click() // End
click3() // End SillyCounter
silly.click() ? myCount.click()
? silly.click3() ? myCount.click3() ?
SillyCounter silly new SillyCounter(3) SimpleCo
unter myCount new SimpleCounter(4)