View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Hai Dang

HomePage:

http://www.angelfire.com/linux/dangthaihai/

http://360.yahoo.com/thaihaidang

Class-Based Inheritance (1 point)
What is a class? What is an instance? How do the two relate? In Smalltalk, what is the difference between class variables and instance variables? In Smalltalk, what is the difference between class and instance methods.

Class is the unit of definition of data and behavior for some kind-of-thing.
For example: A class of cars. Although cars may look different, they all have wheels, chairs, doors(data), and they are used to transport people(behavior).
An intstance is an object of a particular class.
For example: My Toyota Camry is an instance of class car.

Classes atc as factories. They produce new instances of themselves. They can reprogram instances already created. If the definition of a behavior(a method) is changed in the class, all instances will use new behavior.

Class variables are variables that are shared amongs objects in the same class. Instance variables are variables that binds to specific object.

For example: For a class of AirlineTicket, a class variable could be price(assume there is only one prize for the ticket), and number of tickets available. An instance variable could be ticketID or seatNumber, since each ticket has a unique ticket ID and a unique seat number.

Fibonacci implementation:
Add a method in Integer class

 fib
	(self < 0)
	     ifTrue: [^'Invalid value'.].
	((self = 0) | (self = 1)) 
             ifTrue: [^1.].
	 ^(((self - 1) fib) + ((self - 2) fib)).


Assignment 2:

Class-Based Inheritance (1 point)
What is a class? What is an instance? How do the two relate?

In Smalltalk, what is the difference between class variables

and instance variables? In Smalltalk, what is the difference

between class and instance methods.

Class is the unit of definition of data and behavior for some

kind-of-thing.
For example: A class of cars. Although cars may look

different, they all have wheels, chairs, doors(data), and they

are used to transport people(behavior).
An intstance is an object of a particular class.
For example: My Toyota Camry is an instance of class car.

Classes atc as factories. They produce new instances of

themselves. They can reprogram instances already created. If

the definition of a behavior(a method) is changed in the

class, all instances will use new behavior.

Class variables are variables that are shared amongs objects

in the same class. Instance variables are variables that binds

to specific object.

For example: For a class of AirlineTicket, a class variable

could be price(assume there is only one prize for the ticket),

and number of tickets available. An instance variable could be

ticketID or seatNumber, since each ticket has a unique ticket

ID and a unique seat number.

Fibonacci implementation:
Add a method in Integer class

 fib
	(self < 0)
	     ifTrue: [^'Invalid value'.].
	((self = 0) | (self = 1)) 
             ifTrue: [^1.].
	 ^(((self - 1) fib) + ((self - 2) fib)).




Assignment 2:
There are two ways to debug your program.
1) Use "Transcript show:" statement.
2) Use "self halt"

1)"Transcript show:" is a very useful way to debug the

program, especially logical errors. However, it maybe the pain

that you have to remove all those debug statements after

getting a particular bug out. One way to avoid doing this is

by adding a class method in the Transcript class call

onCondition: aValue show: aString
(aValue)
ifTrue: [Transcript show: aString.].

After you have this method, what you have to do is adding a

temporary variable | debug | to your method, when you want to

debug, just set 'debug := true'. And after you finish getting

that bug out, just set 'debug := false', and everything should

be fine.

Another tip for debuging is that trying to print out as much

as possible. Doing this way will help you to see what's going

on during the program flow.

2) "self halt" is another way to get the bug out of your

method. The "halt" message is understandable by an Object

object, thus every object will understand that message as

well(except that if your class inherits from some class that

is not a child class of Object(e.g ProtoObject)).

After you call "self halt", your program execution will be

paused and bring up a windows similar to this

External Image

You can see three button:

Proceed: Continue your program execution
Abandon: Stop your program execution
Debug: bring out the debug window

You can also click on any line that is below those button

which will also bring out a debug window. Don't click on the

line has method or class that you did not implement, since

those is implemented by squeak author, and you won't be able

to get anything out of it.

After you have the debug window, the line that you are at in

the program execution flow will be highlighted, and depending

on the value shown in the "Transcript", you can either proceed

or fix the bug.

External Image

You can also do something similar to the "Transcript

onCondition: show: " by adding a method to the Object class

that makes the execution stop when you have 'debug = true'.

Just a reminder, if someone says that Squeak is very reliable,

that's a lie
Squeak can crash for many reason. One of the common error you

may get when doing projects is:

When doing animation, usually you inherit your class from

ImageMorph class. If by anychance you forget to add
'super initialize.' to initialize method, Squeak will crash:D

External Image

And when it's late, it may take you hours to figure out where

the heck is your bugs

Hope this help you on your project...Happy debugging:D

Coweb Assignement 3
Usability (2 Points)

Cognitive walkthrough is a method for evaluating user interface by analyzing the mental processes required by users.

Heuristic Evaluation is a method for evaluating user interface by using specialists to determine the userbility based on their experience and standards.



Strength of Cognitive Walkthrough:




Strength of Heuristic Evaluation:





Weaknesses of Cognitive Walkthrough:




Weaknesses of Heuristic Evaluation:



We can do Heuristic Evaluation at any phase in the product develoment, but we should do Cognitive Walkthough at early phase of the development, since after

the product has been developed, the software become complicated to walkthrough.

We choose Heuristic Evaluation rather than Cognitive Walkthrough for this reason. Also, Heuristiv Evaluation is much faster to do and yield better results.


Object-Oriented Language Design (2 Points)

Since static typing finds errors at compile time, it increases reliability of the program. Static typing will result in executing code more quickly. When the

compiler knows the data type, it can produce the machine code that is optimized.

Dynamic typing allows debuggers greater functionality compare with static typing, thus make the edit-compile-test shorter. Dynamic typing makes programming

much more powerful, easier to use, and also more portable. Since the computer has to figure out the data type at run time, the code using dynamic typing

usually run slower than static typing.

Advantages and Disadvantages of Virtual Machine:

First, Virtual Machine provides portability for programs. We can write one program that run on both Windows and Linux, the different is the virtual machine

using to run our code. Also Virtual machine provides utilities for polymophism and dynamic binding, which is good for OOP. Since the code is run on virtual

machine, the program is much more secure. If it's crash, it wouldn't damage the computer.

The disadvantages of virtual machine is performance. Since when our code is running, it needs to be translate from virtual machine code(byte code in JVM) to

machine code(binary code). This extra layer will results executing programs slower.

Links to this Page