Welcome

Welcome to my blog.


I will be updating this blog with lecture notes and miscellaneous information for:

CSE 1030 : Winter Term
Prof. A. Eckford, Section-Z: MWF at 10:30 in R S137



Feel free to leave me a message or send me an e-mail at producap@yorku.ca.

Here is a link for MyMail, Hotmail, G-mail, and PRISM login.

On that note, you must have a PRISM account in order to write the lab tests.

If you have not created a PRISM account yet (e.g., if you received transfer credit for 1020), see the lab monitor in CSEB 1006 as soon as possible.

I will also leave the blog open to comments, etc. much like the CSE forums.

Thanks for visiting.

Phil.

Monday, March 10, 2008

CSE Lecture 25/ Feb/2008 (Alternative)


Please click on the desired image to view on a larger scale.

Sunday, March 9, 2008

CSE Lectures 22/Feb/2008 to 27/Feb/2008 Part 2




Please click on the desired image to view on a larger scale.

CSE Lectures 22/Feb/2008 to 27/Feb/2008 Part 1







Please click on the desired image to view on a larger scale.

CSE Lecture 8/Feb/2008





Please click on the desired image to view on a larger scale.

CSE Lecture 6/Feb/2008

Mutators and Accessors in Compositions

-avoid privacy leaks
-make defensive copies whenever mutable objects are passed into or out of the composition. No changes are needed for immutable objects.

Mutator
-create a copy of the external object and start that in our object's attribute.

Accessor
-create a copy of the objects attribute and return that copy.

Constructor
-just like the mutator.

Copy Constructors of Compositions and Aggregates
-"deep copy" --> respect the semantics of the internal objects.

-composition: copy constructor also creates new copies of all internal mutable objects.
-aggregate: only copy references, do not create new copies of internal objects.

Arrays

-Array is similar to ArrayList
- a list of objects stores by index
- all objects of the same type

Array Syntax (starting with primitives)
e.g. a list of 5 integers: int[] x = new int[5]; //creates an empty array of 5 integers.
x.length gives you the length of the array (5 in this case)

e.g. I want to store the int 1024 in the first element of the array.
x[0] = 1024; //note that array indices, like ArrayList, start at zero.

Say you want to get the third element in the array and store it in a separate int.
int y;
y = x[2];

Arrays can be initialized at declaration.
int[] x = {1024,345,-2,123,81};

Monday, February 4, 2008

CSE Lecture 4/FEB/08

Note: See the previous lectures notes for the majority of this lectures contents.

Defensive Copying and Privacy Leaks

Composition: external interference with the inner workings of the class are undersirable.

Aggregates: external changes are OK.

The method of Copy Constructors (previous lectures) is called defensive copying.

CSE Lecture 1/FEB/08

Collections

-A collection is an aggregate(or composition) in which more than one of each type is allowed.
-The number required is not known in advance.
e.g. Portfolio --> collection of Investments

-We have already seen HashMap from SingletonPerState

Collection Constructors

-Best way: create an empty collection object in the constructor.
-Also, provide a public add() method for loading objects into the collection. This method generally returns a boolean: false if it fails, true otherwise.

Collection Objects - 3 Types

Lists - objects in order, duplicates are OK
Sets - order does not matter, duplicates are not allowed.
Maps - objects are associated with keys.

See code for Portfolio

Iterators and Iterable

-Iterator and Iterable are interfaces.
-A class implementing an interface must implement all the methods specified in the interface exactly. This means the same return type, same name (case-sensitive), same number, order, and types of paramters.


--> MyClass implements MyInterface

public class MyClass implements MyInterface
{
.
.
.
}

The Iterator interface allows a method to take some action on each element in a collection. It contains a method that returns the collection's Iterator --> repackaging the collection for iterator operations.

See Rest of Portfolio code including getValue() method.