110 likes | 255 Views
Unit 19 & Unit 41. Object Orientated Programming Programming in Java. S W Hoare. s.hoare@bcmuk.org.uk. Classroom Rules. Arrive Promptly Please (by 10am or 2pm) No Food & Drink in IT Lab Breaks are at the Tutor’s Discretion Mobile phones should NOT be seen or heard Do not mark the desks
E N D
Unit 19 & Unit 41 Object Orientated Programming Programming in Java
S W Hoare s.hoare@bcmuk.org.uk
Classroom Rules • Arrive Promptly Please (by 10am or 2pm) • No Food & Drink in IT Lab • Breaks are at the Tutor’s Discretion • Mobile phones should NOT be seen or heard • Do not mark the desks • Mains lead for Laptops must be checked by a member of staff to ensure they are not worn • Leave the room as you found it
Object Orientated Programming • One of a number of Programming Paradigms • Models the problem in terms of objects • The program then consists of the interactions between these objects. • The programmer writes the definition of the objects, not the objects themselves.
Java • Created by Sun • Owned by Oracle • Inherits C syntax • One of a number of Object Orientated Languages • Free to download • JRE – Java Runtime Environment • JDK – Java Development Kit
BlueJ • IDE – Integrated Development Environment • Written in Java • Designed for teaching Java • Free to download • Course based on Objects First with Java
What is an Object • Computer code representing a discrete item from the problem domain. • http://docs.oracle.com/javase/tutorial/java/concepts/object.html • All have State & Behaviour • An object’s state is kept in it’s fields • An object’s behaviour is defined by it’s methods
Bicycle • State • current gear • current pedal cadence • current speed • Behaviour • changing gear • changing pedal cadence • applying brakes
Class • Instead of creating each individual object We create a class • The difference between Class and object is the difference between Car and my car at home. • Two cars may be identical in all respects except for their VIN number and number plate. • Two objects of the same class may have exactly the same state, but will still be distinguishable.
Instance • An object may also be known as an instance of a class • Creating an object may be called instantiate