Saturday, January 16, 2010
Situation where to use abstract class?.
In an object-oriented drawing application, you can draw circles, rectangles, lines, Bezier curves, and many other graphic objects. These objects all have certain states (for example: position, orientation, line color, fill color) and behaviors (for example: moveTo, rotate, resize, draw) in common. Some of these states and behaviors are the same for all graphic objects—for example: position, fill color, and moveTo. Others require different implementations—for example, resize or draw. All GraphicObjects must know how to draw or resize themselves; they just differ in how they do it. This is a perfect situation for an abstract superclass. You can take advantage of the similarities and declare all the graphic objects to inherit from the same abstract parent object—for example, GraphicObject, as shown in the following figure.
Classes Rectangle, Line, Bezier, and Circle inherit from GraphicObject
First, you declare an abstract class, GraphicObject, to provide member variables and methods that are wholly shared by all subclasses, such as the current position and the moveTo method. GraphicObject also declares abstract methods for methods, such as draw or resize, that need to be implemented by all subclasses but must be implemented in different ways. The GraphicObject class can look something like this:
abstract class GraphicObject {
int x, y;
...
void moveTo(int newX, int newY) {
...
}
abstract void draw();
abstract void resize();
}
Each non-abstract subclass of GraphicObject, such as Circle and Rectangle, must provide implementations for the draw and resize methods:
class Circle extends GraphicObject {
void draw() {
...
}
void resize() {
...
}
}
class Rectangle extends GraphicObject {
void draw() {
...
}
void resize() {
...
}
}
Wednesday, January 13, 2010
difference between asynchronous and synchronous request
Take uploading a file. To do this, you have to:
1. Select the files you want to upload
2. Click the upload button
3. Wait for the files to be uploaded
4. Work with them
You cannot chose to upload another set of files while the first ones are being uploaded, nor can you start to work with them (like adding tags) before the upload process has completed. The interaction is synchronous.
With asynchronous interaction you can do other things while the system uploads the file.
Or take a kitchen, which is asynchronous by design. While you are e.g. baking bread, cooking spaghetti and frying some meat - you are also making the salad. The result of this multitasking behavior is that you can prepare a nice dinner in about 30 minutes. If you had to do the same in a synchronous fashion it would take hours, and most of the food would have gotten cold before everything was finished.
The Future of CakePHP
Now that the major PHP frameworks have reached sustained maturity, where do we go from here? With the long-awaited release of PHP 5.3, many are gearing up to take advantage of the available features with new major versions, which will change the way we create web applications. We'll take a sneak peak at the next major version of CakePHP to see what this evolution might look like, and how you can apply new techniques in your own projects.
Nate Abele is the lead developer of the CakePHP framework, an internationally ignored author and speaker, and has come to be known as the Johnny Cash of the PHP community. Having lived in the midwestern US and both coasts, Nate has currently taken up residence in the most desolate place on the planet: New Jersey. When not code-monkey'ing or yelling at people for "doin' it rong", Nate enjoys snowboarding, playing guitar, being a beach bum, and writing about himself in the third person.
Thank you to IBM for providing a great presentation space in Midtown Manhattan. As a service to our community, New York PHP Community meetings are always free and open to the public.
Monday, January 11, 2010
jQuery feature
- Ajax
jQuery is one of the ajax framework that used mostly by many web master. - Shortcut access to DOM
instead of using bulk of code in accessing DOM, jQuery have the shortcut. - Manipulating the element content
With jQuery, we can freely insert, update and delete every HTML element. - Easy event handling
Event handling is no fear again in web pages, jQuery make the process simple. - Animation
by default, jQuery already have ability to perform general animation on the pages. - Action Chaining
Instead of using many temporary variable and repetition lines, we can easily unite several lines of code that have same characteristic to a line code with chaining. - CSS Compliance
The jQuery selector is CSS Compliance, that make any designer that already have knowledge about CSS is able to learn jQuery easily. - Cross browser
using jQuery, no more hack for IE… the framework has done it automatically.
Small Businesses Benefit from Drupal
Small businesses today are quickly recognizing the power of content management systems and website platforms that allow you to interact with your customers. The days of an old static website that simply lists your phone number are long gone. Today, your website visitors demand that you engage them in dialogue, provide resources at their fingertips, and give them an easy way of understanding what you do and how to buy it from you.
This might seem difficult or expensive, but it doesn't have to be. Orchestra provides Drupal, a leading open source Content Management System, to our clients for a price and timeline built for small business. Drupal is free and open source, so we're able to offer an enterprise level website solution for a very affordable price.
As you'll see below, Orchestra has crafted a solution for small and midsize companies to take advantage of web 2.0 and the growth in internet marketing. And it's not just B2C that benefits, one of the fastest growing sectors of the web is B2B. For small businesses in the B2B space, having an engaging website that positions your company as a market leader and thought driver is imperative.
So, lets get right into the "meat and potatoes" as they say:
Big Features for Small Networks
The increasing importance of computers in even very small businesses is exposing the weaknesses of these simple networks: They offer little security, no data backups, no easy way to share an Internet connection, and they become difficult to manage if they grow beyond a handful of computers. Help is on the way. A new breed of server can deliver big office features at low cost and require little technical skill. Eventually, they may even find their way into your home.