Aug 26
Object Oriented Concepts
Below is a short list of object oriented concepts.
Object:
An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. This lesson explains how state and behavior are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner.
Class:
A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behavior.
Inheritance:
Inheritance provides a powerful and natural mechanism for organizing and structuring your software. This section explains how classes inherit state and behavior from their superclasses, and explains how to derive one class from another using the simple syntax provided by the Java programming language.
Package:
A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage. This section explains why this is useful, and introduces you to the Application Programming Interface (API) provided by the Java platform.
Interface:
An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface. This section defines a simple interface and explains the necessary changes for any class that implements it.
Encapsulation:
Encapsulation is the ability to bundle the property and method of the object and also operate them. It is the mechanism of combining the information and providing the abstraction as well.
Inheritance:
Inheritance provide the facility to drive one class by another using simple syntax. You can say that it is a process of creating new class and use the behavior of the existing class by extending them for reuse the existing code and adding the additional features as you need. It also use to manage and make well structured software.
Composition - Association and Aggregation
Composition is a slightly different sort of relationship - this is where it could be said that a class was “composed” of other classes. For instance, a wall is “composed” of bricks and a molecule is “composed” of atoms. Neither of these examples could be described as inheritance - the statement, “a wall is a brick” simply isn’t true. Composition can be described as “has a” and “uses a” relationships; a wall “has a” brick or a wall “uses a” brick.
Polymorphism:
In simple terms, polymorphism lets you treat derived class members just like their parent class’ members.
Polymorphism is the process of using an operator or function in different ways for different set of inputs given.
More precisely, polymorphism (object-oriented programming theory) is the ability of objects belonging to different types to respond to method calls of the same name, each one according to an appropriate type-specific behavior. The programmer (and the program) does not have to know the exact type of the object in advance, so this behavior can be implemented at run time (this is called late binding or dynamic binding).
The different objects involved only need to present a compatible interface to the clients (the calling routines). That is, there must be public methods with the same name and the same parameter sets in all the objects. In principle, the object types may be unrelated, but since they share a common interface, they are often implemented as subclasses of the same parent class. Though it is not required, it is understood that the different methods will also produce similar results (for example, returning values of the same type).
In practical terms, polymorphism means that if class B inherits from class A, it doesn’t have to inherit everything about class A; it can do some of the things that class A does differently. This means that the same “verb” can result in different actions as appropriate for a specific class, so controlling code can issue the same command to a series of objects and get appropriately different results from each one.
Overriding and Overloading:
If a Dog is commanded to speak(), this may emit a Bark. However, if a Pig is commanded to speak(), this may emit an Oink. They both inherit speak() from Animal, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism.
Overloading Polymorphism is the use of one method signature, or one operator such as “+”, to perform several different functions depending on the implementation. The “+” operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses of Number, such as Integer and Double, are expected to add together properly in an OOP language. The language must therefore overload the concatenation operator, “+”, to work this way. This helps improve code readability.
Comments are off for this postAug 26
Web Development: How to get started
A friend asked me for some tips on getting started in the world of web development. Here is what I wrote:
Advice:
- You should try to get simple “Hello World” applications running in each. Then make the application more complicated.
- Also just learn Actionscript 3.0 . Dont waste time with 2.0
- Beyond actionscript you need: HTML, PHP, CSS, XML
- Don’t waste too much time on XML. If you get the concept your good.
- Make a program in php and actionscript that parses XML and traces to screen and your good.
To actually do work you will need to download,install, and master IDEs (Development Environments).
- for Actionscript 3.0 use flash and flex
- for HTML use dream weaver and eclipse (with an html plugin “HTML Tidy”)
- for PHP use eclipse with a php plugin
Make sure you download the 30 day trials of all of this stuff.
Tutorial links:
- http://www.virtualshowrooms.co.za/articlepage.php?cp=101
- http://imanit.com/blog/?p=60
- http://www.senocular.com/flash/tutorials/as3withflashcs3/
- http://www.w3.org/2002/03/tutorials
- http://www.php.net/tut.php
Once you mastered syntax, start mastering ood by joining a forum: http://oodforum.com/forums/
Most of all, enjoy!
Comments are off for this postAug 10
Tacori Male Microsite
here is a link to my latest work: http://gentlemensguide.tacori.com/
I did all the action scripting for this site. I used PureMVC, tweener, etc. I used Flex Builder (actionscript only project) and loaded asset swfs that where made in flash.
No commentsJun 20
My old school flash games
6 years ago I was a Java/ C++ programmer writing a socket server for a company that just received a contract with AOL to do 40 flash games. This company asked me if I could take a stab at writing actionscript. Thats when I fell in love with game writing and actionscript. In the next year I would write over 50 games for companies such as AOL, Dairy Queen and THQ. I was able to do this by creating my own physics engine and game framework. It was an exciting time for me because I was learning game making, flash, actionscript all at the same time and I was proud to have such a big client. While surfing, I recently found a bunch of these games I did for AOL. The best part was, they where all rated by user votes.
Links below:
http://kids.aol.com/KOL/2/Games/FlashHolder/KOL-Checkers (score: 78, votes:31,909)
http://kids.aol.com/KOL/2/Games/FlashHolder/KOL-9-Ball-Pool (score: 64, votes: 12,578)
http://kids.aol.com/KOL/2/Games/FlashHolder/KOL-Fun-Lanes (socre: 63, votes: 11,494)
http://kids.aol.com/KOL/2/Games/FlashHolder/KOL-Fun-Wordz (score: 56, votes: 6,517)
http://kids.aol.com/KOL/2/Games/FlashHolder/Table-Hockey-Extrem (score: 43, votes: 3,407)
http://kids.aol.com/KOL/2/Games/FlashHolder/Desert-Motocrosse (score: 42, votes: 11,419)
http://kids.aol.com/KOL/2/Games/FlashHolder/KOL-Mystery-Word (score: 37, votes: 6,259)
http://kids.aol.com/KOL/2/Games/FlashHolder/Darts-Fun (score: 28, votes: 6,996)
http://kids.aol.com/KOL/2/Games/FlashHolder/loaded-waterguns
http://kids.aol.com/KOL/2/Games/FlashHolder/Super-Slimy-Invaders (score: 28, votes: 1,169)
http://kids.aol.com/KOL/2/Games/FlashHolder/Puzzled-Circuits (score: 26, votes: 2,346)
http://kids.aol.com/KOL/2/Games/FlashHolder/KOL-Dodgeball (score: 25, votes: 7,305) http://kids.aol.com/KOL/2/Games/FlashHolder/Table-Tennis (score: 24, votes: 4,389)
http://kids.aol.com/KOL/2/Games/FlashHolder/Basketball-Madness (score: 22, votes: 11,535)
http://kids.aol.com/KOL/2/Games/FlashHolder/Mimic-the-Monkey (score 21, votes: 11,783)
May 11
fun youtube links
TED Statistics: http://www.youtube.com/watch?v=hVimVzgtD6w
bgt Micheal Jackson: http://www.youtube.com/watch?v=5U2A2IUzuso
Elmo and Adre Bocelli: http://www.youtube.com/watch?v=BgUnYzXU-Fo
May 4
Best of Blog
I have compiled a list of the 6 blog articles that appear to be the best of the collection (according to the stats). Please read these articles to get a feel for what this blog is all about. Please vote for your favorite by posting a comment.
Interactive 3D building: Discusses and shows videos of one of my favorite projects.
Command Strategy Queue: Discusses an implementation pattern for dealing with concurrency
Implementation Pattern for Complex Pre Loading
SCUGE Introduction: What is SCUGE and why use it.
How I use Enterprise Architect: Tips and tricks for using EA.
Keyboard Camera Controls PV3D example: Goes through a simple PV3D Sample. Includes code.
No commentsMay 4
Naked Forum: www.oodforum.com
Hello,
I just launched a new forum for Actionscript developers that want perfect their Object Oriented Design skills. I used VB 3.7 so its very social network-ish (instant messages, friends list).
Please sign up and start posting.
1 commentApr 30
Prana: What, Why and How.
Introduction
I have recently been playing around with Prana. This is a wonderful inversion of Control framework written by a very talented and supportive group (Christophe Herreman, Damir Murat, Erik Westra). Below are my learnings and observations.
What is Prana
Prana has a class called “XMLApplicationContext” that will create objects as defined by an XML file. The XML file actually specifies the class name and other necessary parameters required to create an object. Right off the bat I am sure you can think of projects where you have custom built a parser and a factory to do the same thing, but instead of linking the the class dynamically you used a case statement.
Why Use Prana
The driving forces behind Prana are much more than providing a reusable parsing and factory code. Actually Prana is a framework that implements to concept of IoC and Dependancy Injection. These are concepts most documented and implemented by the Java Based Spring Framework The general theory is that by inverting control logic from a centralized controller to external configuration files your application becomes flexible in the supporting and switching different types of control logic that might do the same thing, but do it in different ways (ie production environment might use data a server versus test environment that uses canned data). More specifically Prana allows you to use dependency injection in that we inject the implementation dependencies into build through the external configuration files instead of coding them into the application directly.
How to use Prana
Below are the simplest steps I found to actually seeing something working. The Prana team has a few great examples you should check out as well. 1) Check out Prana as a project into Flex Builder. New -> Project -> Checkout Projects from SVN -> Create a new repo location -> https://prana.svn.sourceforge.net/svnroot/prana -> click on “prana-main -> trunk -> src -> main” basically make it a project. 2) The project I made basically resuses a bunch of stuff that is in the prana-sample-movieApp project, so report step 1 for the movie project. New -> Project -> Checkout Projects from SVN -> Create a new repo location -> https://prana.svn.sourceforge.net/svnroot/prana -> click on “prana-sample-movieApp -> trunk -> src -> main” basically make it a project. 3) Now you have Prana, lets take it for a spin. Create a new Actionscript project, I called mine “iman_prana_simple_sample”. I set the Actionscript build Source path the following: a) Path to the “prana-main” we just checked out. make sure the path ends like this “\prana-main\src\main” b) Path to prana-sample-movieApp we just checked out. Make sure the path ends like this “\prana-sample-movieApp\trunk\src\main” c) Path to flex framework. Basically something like “C:\Programs\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\src” Here is the code I replaced the main AS3 class with. This is the class that you will “set as the default application” and run. I was able to compile this code and get the expected output. Its basically a bunch of stuff I stole from the movieApp example. I wanted to see the project work in an AS3 only environment. So here it is:
package {
import flash.display.Sprite;
import flash.events.Event;
import org.pranaframework.context.support.XMLApplicationContext;
import org.pranaframework.samples.movieapp.MovieLister;
import org.pranaframework.samples.movieapp.CSVMovieSource;
import org.pranaframework.samples.movieapp.StaticMovieSource;
public class iman_prana_simple_sample extends Sprite
{
private var _applicationContext:XMLApplicationContext;
private var _applicationContextComplete: Boolean= false;
private var _movieLister:MovieLister;
public function iman_prana_simple_sample()
{
// The next 2 lines gets the dynamic classes compiled.
CSVMovieSource
StaticMovieSource
logMessage(”creation complete; setting up object factory to load applicationContext”);
// an instance of XmlObjectFactory is able to load an XML
// file with object definitions and parse it
_applicationContext = new XMLApplicationContext(”applicationContext.xml”);
// listen for the object definitions loading to complete
// (loaded and parsed xml object definitions)
_applicationContext.addEventListener(Event.COMPLETE, onApplicationContextComplete);
// start the loading
_applicationContext.load();
logMessage(”started loading applicationContext”);
} // constructor
private function onApplicationContextComplete(event:Event):void {
logMessage(”finished loading applicationContext”);
logMessage(”trying to load ‘movieLister’ object from object factory”);
// we can get objects from the application context with
// the getObject() method. As an argument, we pass in the id of
// the object definition in the applicationcontext xml file
// here we request the ‘movieLister’ and put it in a var
// (note: container.getObject(”staticMovieSource”) would give
// us the StaticMovieSource object defined in the application-
// context
// programmatically we would do something like:
// var movieSource:IMovieSource = new StaticMovieSource();
// var movieLister:MovieLister = new MovieLister();
// movieLister.movieSource = movieSource;
// … but the container does that for us
_movieLister = _applicationContext.getObject(”movieLister”);
logMessage(”successfully loaded ‘movieLister’ “);
// mark the object factory complete flag as true
// this will enable the UI controls to search for movies
// because their ‘enabled’ property is bound to this var
_applicationContextComplete = true;
onGetMoviesButtonClick();
}//onApplicationContextComplete function
private function onGetMoviesButtonClick():void {
// search movies from the given director
// if the director’s name is left blank, then all movies will
// be returned
var director:String = “Quentin Tarantino”;
var movies:Array = (director == “”) ? _movieLister.getAll() : _movieLister.getMoviesDirectedBy(director);
logMessage(”‘” + movies.length + “‘ movie(s) found”);
// show all movie matches
for (var i:int = 0; i<movies.length; i++) {
logMessage(”movie #” + (i+1) + “: ” + movies[i]);
}
}
private function logMessage(message:String):void {
var time:Date = new Date();
trace(time.hours + “:” + time.minutes + “:” + time.seconds + ” - ” + message);
} // logMessage function
} // class
} // package
Apr 30
Flex Builder Build Path GUI bug and fix
I have seen this bug in Branded Flex builder and in Eclipse with the plugin where I right click on my project, go to properties, go to ActionScript Build Path and see a blank screen. Obviously this is disconcerting when you need to add to the build path. I finally found the work around. Just reduce the width of the panel with all of the different properties options. Once the panel that contains the Build Path GUI is big enough to display the whole thing it will become visible.
If you still don’t see the “add folder” button then try changing your resolution or using a different monitor.
No commentsApr 26
Suggest SCUGE for MAX
SCUGE is an open source game creating framework.
http://www.scuge.com/
If you want to learn more about SCUGE’s use , the principles used to derive SCUGE, or tools used to create SCUGE UML please suggest SCUGE for a MAX Session: https://adobemax.dabbledb.com/page/callforsessions/NLXYueHm
Session Title: “Using SCUGE” or “OOD case study: How SCUGE was derived”
Here are is an example Session Descriptions, please modify as you see fit:
“This course should answer questions like What is SCUGE? Why use it? How to use it? How was it constructed? What is the rational behind it? What is the next step? Examples should be used to illustrate the answers to these questions”
Speaker Name : Iman Khabazian
Speaker Email: iman@imanit.com
No comments