Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming With Alice. Alice Free Java based, 3D programming tool Enables the manipulation and interaction of 3D objects Can also.

Similar presentations


Presentation on theme: "Programming With Alice. Alice Free Java based, 3D programming tool Enables the manipulation and interaction of 3D objects Can also."— Presentation transcript:

1 Programming With Alice

2 Alice Free Java based, 3D programming tool http://www.alice.org Enables the manipulation and interaction of 3D objects Can also react to user input Everything is drag and drop Designed to teach programming at a basic level

3 Programming Concepts - Objects Objects are entities in your program Objects can be related to a real world (concrete) concept or an abstract one In Alice: All objects are concrete, 3D objects Objects can be given attributes and behaviour

4 Object - Car Me2Kuul

5 Programming Concepts – Variables Variables are pieces of data that store information about an object or method Objects use variables to describe their current state Methods use variables for a variety of purposes – State, temporary storage, calculations

6 Object - Car GR8 LAY Speed Engine size Other objects: Tires Number of Girls

7 Programming Concepts - Methods We define the behaviour of an object using methods Methods are a list of instructions that an object is suppose to perform when that method is “called” The method list of an object tells us what that object is capable of. Parameters can be used to tell a method how to carry out a particular behaviour

8 Programming Concepts – Parameters When a method is called, parameters can be given to the method at the same time They tell the method how to execute a particular behaviour Allows methods to be more general/useful

9 Object - Car No1Stud Speed Engine size Other objects: Tires Method List: Drive(how fast) Stop() PickupGirls(how many) CruiseAbout() Number of Girls

10 Variable Types Primitive Data – Text, number or boolean value (true or false) Object data – variable stores an actual object List – A list of object data or primitive data

11 Comments Comments allow us to add notes in our code to help us (and others) understand it The computer ignores comments Proper use of comments becomes more important as your programs get larger In both Alice and Java, comments are preceded by “//” e.g. //This is a comment

12 Question We have objects, methods and variables, how do we use this to get work done?

13 Remember: A program is just a list of instructions for the computer to execute. Your average program will: Call methods React to user input Update variables with new data i.e. Execute code

14 Typical Program – PseudoCode Drive(50)//Drive at 50km/h PickUpGirls(3) Cruise() Stop()

15 Programming Concepts – Execution Control There are many execution control structures we can use to aid us in our programs if/else While for loop

16 If/else We have used “if” statements in Excel If(boolean) do “Something” //True else do “Something else”//False In Java and Alice, we replace the “Something” with code Used for making decisions

17 Typical Program – PseudoCode if(speed<50) Drive(50) else Stop()

18 loop The basic loop loop(number of times) do “Something” As you expect, loops a number of times and then stops

19 Typical Program – PseudoCode Drive(50)//Drive at 50km/h loop(3) pickupGirls(1) Cruise() Stop()

20 While While is a looping structure While(boolean) //if false, stop looping do “Something” //over and over Will continue to execute the same code until the test fails

21 Typical Program – PseudoCode Drive(50) while(girls<3) PickUpGirls(1) Cruise() Stop()

22 For For is also a looping structure for(list) //for each item in list do “Something” Allows you to take a list of data and perform some action on each item

23 Sequential or Parallel Do in order vs do together Do in order – Execute each command one after another, next command must wait until the previous has finished Do Together – Execute all commands at the same time

24 Demo


Download ppt "Programming With Alice. Alice Free Java based, 3D programming tool Enables the manipulation and interaction of 3D objects Can also."

Similar presentations


Ads by Google