DOC PREVIEW
TRINITY CSCI 1311 - Methods
Pages 12

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Methods1/23/20082Opening Discussion■Let's look at some answers to the interclass problem.■Quotes from book:“Great things can be reduced to small things, and small things can be reduced to nothing.” - Chinese Proverb“Weeks of programming can save you hours of planning.” - Anonymous3Minute Essay Answers■Can you insert music/audio into Alice? Yes, but it won't play on the lab computers.■Problems with moveToward. I typically use turnToFace and move.■Comparing Alice and GameMaker. I've never used GameMaker. There are conditional events you can add in Alice that could be made to check for things like collisions.■Someone wanted to make “graphs for sports”. I'm not certain what that meant, but I can tell you that it will be possible in Java.■Making objects interact without looking akward.4Do Together■So far we have had all of our statements in Alice happen sequentially. This is the normal mode of working in programs. We used the doInOrder to make a block of things that happen sequentially.■Alice provides a simple way to make things happen at the same time. The doTogether block lets you specify a bunch of commands that should all happen at the same time.■Let's make use of this and see what happens.5Quad View■When you are working on the project you will probably be picky about exactly how different figures are set up.■The quad view gives you a lot more information about the relative position of objects in your scene.6Problem Decomposition■One of the most basic skills you should learn in this class is that of problem decomposition. This is perhaps the most fundamental skill in CS and a great benefit to all facets of life.■The idea is simple. Solving big problems is hard, but solving little problems is easy. So you break big problems into little ones and solve them independently.■The book uses term “divide and conquer”. I'm not big on this because it has a specific meaning to computer scientists that is beyond the scope of this course.7Role of Methods■The way you decompose problems in Alice is by creating new methods.■Methods are basically collections of statements that you can call.■You have been calling methods already so that is nothing new.■The new aspect of this is that you can make methods where you can put collections of statements that you will be calling frequently, or just to break the problem into more manageable pieces.8World Methods■Top level decomposition should likely be done with world methods. Basically, any method that is going to alter the state of multiple objects should probably go into the world.■Your book is really big on the analogy of making a film and talks about methods named by scenes or shots. I'm not a fan of this. I like method names that carry more information. That also makes them more general.■Rule of Thumb: methods should not be longer than what you can see on the screen. This really helps to reduce errors.9Never Do Anything Complex■My own rule of thumb in CS is that if you are doing things properly, you never do anything complex.■More to the point, if you have something that is complex, always try to break it into pieces that are simple. It is much harder to mess up things that are simple.10Comments■Another block type that you can add to Alice is a comment block.■Comments don't do anything, they simply allow you to type in a description of what is happening.■You should also put comments in your programs that say you are the author.11Playing Around■Let's do something in Alice where we can make use of methods.12Minute Essay■The rule of thumb for keeping methods short is actually based on real research and is generally valid for all programming languages. Why do you think this matters?■Interclass Problem – Do either problem 1.6, 1.7, or 1.8 from the text. Try to use several methods when you do


View Full Document

TRINITY CSCI 1311 - Methods

Course: Csci 1311-
Pages: 12
Documents in this Course
Arrays

Arrays

12 pages

Arrays

Arrays

10 pages

Applets

Applets

5 pages

Arrays

Arrays

8 pages

Drawing

Drawing

8 pages

Load more
Download Methods
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Methods and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Methods 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?