30
Alice 2.0 Alice 2.0 an introduction to computer an introduction to computer programming programming

Alice 2.0 an introduction to computer programming

Embed Size (px)

Citation preview

Page 1: Alice 2.0 an introduction to computer programming

Alice 2.0Alice 2.0

an introduction to computer programmingan introduction to computer programming

Page 2: Alice 2.0 an introduction to computer programming

Alice 2.0Alice 2.0

Part I: What is Alice?Part I: What is Alice?

Part II: Software DevelopmentPart II: Software Development

Part III: Elements of ProgrammingPart III: Elements of Programming

Part IV: Event-Driven ProgrammingPart IV: Event-Driven Programming

Page 3: Alice 2.0 an introduction to computer programming

Part I: What is Alice?Part I: What is Alice?

Page 4: Alice 2.0 an introduction to computer programming

What is Alice 2.0?What is Alice 2.0?

It is a computer application...

created by Carnegie Mellon University,

to “teach” computer programming.

Alice 2.0 is designed to create computer applications –

(i.e. build programs).

Page 5: Alice 2.0 an introduction to computer programming

Who should use Alice?Who should use Alice?

Anyone interested in learning the underlying skills required for programming in most languages.

And All of YOU lucky CS109 students in this class!

Page 6: Alice 2.0 an introduction to computer programming

Why use Alice?Why use Alice?Why not just jump into C++ or Java?Why not just jump into C++ or Java?

Alice makes learning programming easier…

removing the challenges of programming syntax,

and “debugging” is made easier with visual cues.

//c++ application

int main(0)

{

char display[20];

getline (display,20,\n);

cout>>display;

return;

}

Page 7: Alice 2.0 an introduction to computer programming

What type of programming does Alice What type of programming does Alice teach?teach?

Alice utilizes the concepts of OOP (Object Oriented Programming),

and Event Driven Programming (i.e. an “event trigger” causes a series of commands/instructions to be exectuted).

Page 8: Alice 2.0 an introduction to computer programming

Object BasicsObject Basics Objects have properties (description)

Page 9: Alice 2.0 an introduction to computer programming

Object BasicsObject Basics Objects have methods (behaviors)

Note: functions are a method that returns a value.

Method (code) to make beak open and close

Page 10: Alice 2.0 an introduction to computer programming

The Alice IDE The Alice IDE (integrated development environment)(integrated development environment)

ororsimply put – The Alice Interfacesimply put – The Alice Interface

This is the work area for programming with Alice…

Page 11: Alice 2.0 an introduction to computer programming

The IDEThe IDE

Object Tree

Page 12: Alice 2.0 an introduction to computer programming

Now you know what Alice is…Now you know what Alice is…the end (Part I)the end (Part I)

Page 13: Alice 2.0 an introduction to computer programming

Time to try out Alice…Time to try out Alice…

Page 14: Alice 2.0 an introduction to computer programming

Part II: Software DevelopmentPart II: Software Development

It’s not just Alice anymore.It’s not just Alice anymore.

Page 15: Alice 2.0 an introduction to computer programming

The Software Development CycleThe Software Development Cycle

1. Design Phase1. Design Phase

In the Design Phase, information is In the Design Phase, information is gathered to determine the gathered to determine the task/problem to be solved by the task/problem to be solved by the application.application.

The task/problem is broken into smaller The task/problem is broken into smaller tasks, called modules.tasks, called modules.

Then a “plan of attack” is created.Then a “plan of attack” is created.

Page 16: Alice 2.0 an introduction to computer programming

The Software Development CycleThe Software Development Cycle

2. Implementation Phase2. Implementation Phase

In the Implementation Phase, the In the Implementation Phase, the solution to the problem/task is coded solution to the problem/task is coded to build the application.to build the application.

Page 17: Alice 2.0 an introduction to computer programming

The Software Development CycleThe Software Development Cycle

3. Testing Phase3. Testing Phase

In the Testing Phase, the application is In the Testing Phase, the application is tested –tested –

Individual modulesIndividual modules

Combined modulesCombined modules

Entire applicationEntire application

Page 18: Alice 2.0 an introduction to computer programming

The Software Development CycleThe Software Development Cycle

4. Debugging Phase4. Debugging Phase

In the Debugging Phase,In the Debugging Phase,

The errors and side effects The errors and side effects (unwanted results)(unwanted results) are corrected.are corrected.

Page 19: Alice 2.0 an introduction to computer programming

The Software Development CycleThe Software Development Cycle

5. Documentation5. Documentation

Finally, once the application works as Finally, once the application works as required by the Design Phase – the required by the Design Phase – the application and its workings are application and its workings are documented –documented –

for users of the applicationfor users of the applicationfor future programmers to modify the for future programmers to modify the

applicationapplication

Page 20: Alice 2.0 an introduction to computer programming

Now you know the software Now you know the software development cycle…the end (Part II)development cycle…the end (Part II)

Page 21: Alice 2.0 an introduction to computer programming

Part III: Elements of ProgrammingPart III: Elements of Programming

Page 22: Alice 2.0 an introduction to computer programming

Programming Rule #1Programming Rule #1Algorithm: A step by step method for solving a problem

Programs are algorithms created to solve problems.

Thus, programs are linear –

They start at the top (beginning)

and

proceed to the bottom (end).

Page 23: Alice 2.0 an introduction to computer programming

Key Programming CommandsKey Programming Commands

Selection/Branching – if/else (decision point or multiple points)

Do you want

a glass of milk?

Make glass of

milk

milk

choc

straw

Make c

Make s

Make plain

Page 24: Alice 2.0 an introduction to computer programming

Key Programming CommandsKey Programming Commands

Repetition/Looping – loop & while (repeating a task)

Loops can be pre-test, or post-test

Page 25: Alice 2.0 an introduction to computer programming

Key Programming CommandsKey Programming CommandsAre you Boolean Logical?

Boolean values are easy, as there are only 2.

0 – off/false

1 – on/true

Logic Operators:

==, <,<=, >,>=, !=

Page 26: Alice 2.0 an introduction to computer programming

Now you know the key elements to Now you know the key elements to programming…the end (Part III)programming…the end (Part III)

Page 27: Alice 2.0 an introduction to computer programming

Part IV: Event-Driven ProgrammingPart IV: Event-Driven Programming

In order to cause an “event” to occur – the user must invoke the “event trigger”.

Page 28: Alice 2.0 an introduction to computer programming

Events & MethodsEvents & Methods

The event – chicken rolling and changing colors (as defined by the method “Silly Chicken”) “occurs” when the “event trigger” (mouse click on chicken) is detected by the “event listener”.

Note: The Silly Chicken method is known as the “event handler”.

Page 29: Alice 2.0 an introduction to computer programming

Adding a BillboardAdding a Billboard

Billboards are used in Alice to list Billboards are used in Alice to list keyboard controls (event triggers) keyboard controls (event triggers) available to the user.available to the user.

1.1. Create the control billboard using Paint Create the control billboard using Paint 2.2. Use a textbox in Paint to list the Use a textbox in Paint to list the

commands of your Alice Worldcommands of your Alice World3.3. Save the file as a .jpgSave the file as a .jpg4.4. Import and use the file as listed on pages Import and use the file as listed on pages

220 -223220 -223

Page 30: Alice 2.0 an introduction to computer programming

Time to try out Alice…Time to try out Alice…and explore the world of and explore the world of

programming!programming!