330 likes | 1.45k Views
Alice 2.0 an introduction to computer programming Alice 2.0 Part I: What is Alice? Part II: Software Development Part III: Elements of Programming Part IV: Event-Driven Programming Part I: What is Alice? What is Alice 2.0? It is a computer application...
E N D
Alice 2.0 an introduction to computer programming
Alice 2.0 • Part I: What is Alice? • Part II: Software Development • Part III: Elements of Programming • Part IV: Event-Driven Programming
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).
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!
Why use Alice? 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; }
What type of programming does Alice 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).
Object Basics Objects have properties (description)
Objects have methods (behaviors) Note: functions are a method that returns a value. Object Basics Method (code) to make beak open and close
The Alice IDE (integrated development environment)orsimply put – The Alice Interface This is the work area for programming with Alice…
The IDE Object Tree
Part II: Software Development It’s not just Alice anymore.
The Software Development Cycle 1. Design Phase In the Design Phase, information is gathered to determine the task/problem to be solved by the application. The task/problem is broken into smaller tasks, called modules. Then a “plan of attack” is created.
The Software Development Cycle 2. Implementation Phase In the Implementation Phase, the solution to the problem/task is coded to build the application.
The Software Development Cycle 3. Testing Phase In the Testing Phase, the application is tested – Individual modules Combined modules Entire application
The Software Development Cycle 4. Debugging Phase In the Debugging Phase, The errors and side effects (unwanted results) are corrected.
The Software Development Cycle 5. Documentation Finally, once the application works as required by the Design Phase – the application and its workings are documented – for users of the application for future programmers to modify the application
Now you know the software development cycle…the end (Part II)
Programming Rule #1 Algorithm: 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).
Key Programming Commands Selection/Branching – if/else (decision point or multiple points) milk Do you want a glass of milk? Make glass of milk choc Make c straw Make s Make plain
Key Programming Commands Repetition/Looping – loop & while (repeating a task) Loops can be pre-test, or post-test
Key Programming Commands Are you Boolean Logical? Boolean values are easy, as there are only 2. 0 – off/false 1 – on/true Logic Operators: ==, <,<=, >,>=, !=
Now you know the key elements to programming…the end (Part III)
Part IV: Event-Driven Programming In order to cause an “event” to occur – the user must invoke the “event trigger”.
Events & 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”.
Adding a Billboard • Billboards are used in Alice to list keyboard controls (event triggers) available to the user. • Create the control billboard using Paint • Use a textbox in Paint to list the commands of your Alice World • Save the file as a .jpg • Import and use the file as listed on pages 220 -223
Time to try out Alice…and explore the world of programming!