You are currently browsing the monthly archive for December 2007.
Author: Ashwinee Kumar Dash.
Name of the Book: Essential ActionScript 3.0 by Colin Moock
Disclaimer: Anything in quotation marks is a direct quotation from Essential
ActionScript 3.0. All other notes are my own summaries of the concepts
presented in the book.
These notes are for reference purpose only and not intended to replace the book .Therefore I would strongly advise you to read the original book as well as make your own notes wherever necessary.
Send your suggestions and feedbacks to aswhineedash[at]gmail[dot]com or aswhinee2004[at]gamil[dot]com.
- Data Type means a set of values.
- Null, void and object are three data types in AS.
- Null has null value
- Void has undefined as its value
- Object includes all the instances of all the classes in ActionScript.
- Each class creates a unique datatype. Its values are the instances of the class itself and its subclasses.
- Any given subtype is compatible with its supertype and likewise a supertype is incompatible with its subtype. That’s because an instance of subclass can be treated as an instance of its superclass.
- A type annotation or type declaration is a suffix that constrains the datatype of a variable parameter or function return value.
- Type declaration is preceded by colon “:”.
- In case of variable or function parameter the data type must be a class or interface.
- In case of return type the data type must be a class, interface or void.
- They can take * as data type which means untyped.
- 3 situations where data type mismatch error is ignored in strict mode until runtime (1) untyped expression assigned to typed variable or parameter or returned from a function with a declared return type (2) any expression assigned to a typed variable or parameter with Boolean datatype or returned from a function with a Boolean return type (3) any numeric type is used where a different numeric type is expected
- To detect reference errors compiler relies on type annotations.
- Compiler checks the method definition in the class or interface which is specified by variable’s type annotation.
- Compiler does not check the actual class of the value.
- To avoid such errors at the compile time cast operation is used.
- Cast operation tells the compiler to treat the expression as a specified type.
- Type (expression).
- At the runtime if the expression resolves to the specified object, it is returned.
- If it does not resolve to a specified object, either it is converted to a primitive datatype or an error is generated.
- Casting an object to its supertype is known as upcast
- Casting an object to its subtype is known as downcast.
- Upcast never generates an error
- Downcast has the potential to generate error
- To check the data type of an object, the ‘is’ operator is used like (expression is type) which returns a true or false value.
- A cast operation can be used to convert any value to a particular primitive type.
- When a variable is declared without a type annotation and without an initial value, its value is set to undefined.
- If a variable is not initialized, it takes the default value of its datatype.
- Both null and undefined means absence of data
- The null value represents the absence of data for variables, parameters and return values with any type annotations except Boolean, int, uint, and number
- Undefined represents absence of data for variables, parameters or return values without any specified type annotations
- Undefined also means complete absence of variable or method on an object whose class is defined as dynamic
After a 3 part video regarding Thermo appeared in youtube many developers got excited about the product and started blogging about it. So FlexNotes also watched the video and read the blog posts with eagerness and anticipation.The author even had an imaginary conversation with a developer (referred to as D) proficient in many technologies as well as managing large scale projects. He also runs his own company.
Disclaimer: The conversation between FL and D that you are going to read is a work of fiction. It does not bear any resembalance to anyone living or dead in real world.Please stop reading further from the point where it starts hurting your feelings, sentiments etc.
FL: Do you know when Thermo is coming?
D(Dev) :No, we don’t.
FL: Have you really tried it out ?
D: No, but I have seen a video on the YouTube.
FL: But you have posted in your blog divdavdev.com that Thermo will generate bad code. How do you know that ?
D: Any such thing that is designer friendly is bound to produce bad code. Just like any WYSIWYG editor.
FL: Do you intend to use it in your organisation for developing RIAs, along with Flex builder?
D: Look, its a designers’ only product that helps a novice to draw a very fanciful image of an application in Photoshop and then import it and convert it into a working Flex project, of course by adding interactivity to it. So its only good for designers who do not know MXML or AS 3.0.But we don’t need it as we are very efficient in writing code in Flex builder to generate what we want.Hence WE do not need it.
FL: May be your designers will need it.
D: We don’t have a full time designer. Whenever we have any design requirements we just ask any freelancer to do it. That’s all.
FL: What do you do when design related change requests come from clients ? Do you send it to the designers again for changes ?
D: We try to do it ourselves. Once the main design has been done, it is easy to make small changes in Photoshop. Then again we always ask the clients to consider bad effects of changing UI such as increase in loading time, decrease in performance which will lead to more development efforts etc.
FL: Do the clients always agree ?
D: Most of the time they do.
FL: What happens if the client does not agree ?
D: We make necessary changes ourselves. Chink our best java developer knows Photoshop a little.We ask to him to make the small changes. He likes it. You should see his some of his photo editing capabilities in flickr.
FL: But RIA without designers does not sound very promising?
D: Actually we are trying very hard find very best designers, but so far we have no luck?
FL: What are your requirements ?
D: Very few. He should know Flex 2 (both MXML and Actionscripting) very well and must have some knowledge in one Server side language and should know one database.While we would be certainly happy if he has some experience in Swing, Hibernate or JSF but that is not mandatory. But he must know about design patterns.
FL: You expect a designer to know all that?
D: We want someone to work in our team with team spirit and all our team members are conversant with that.
FL: Do you think Thermo will introduce new way of developing RIAs?
D: It is difficult to say anything about that right now .
FL: It is being speculated that once Thermo comes out designers would take care of all design, UI and Interactivity related tasks which will leave developers to concern about all logic and database related things. Do you think this is possible ?
D: It is a very difficult thing to achieve because for that Thermo has to produce readable and maintainable code just as we developers do.
FL: And who says if the code is up to the standard ?
FL: Are you afraid of the fact that once Thermo comes, some of the RIA market will go to designers or in some cases they will control a considerable portions of any applications to be developed using Flex ?
D: Let me make this very clear. We rule the enterprise application development world. Mere designers armed with Photoshop and Thermo can’t take it away from us. We won’t simply let them have any of it. They can keep learning and publishing nice tutorials in their pretty blogs but that’s it.