Object-Oriented PHP for Beginners

•05/27/2011 • Leave a Comment

For many PHP programmers, object-oriented programming is a frightening concept, full of complicated syntax and other roadblocks. As detailed in my book, Pro PHP and jQuery, you’ll learn the concepts behind object-oriented programming (OOP), a style of coding in which related actions are grouped into classes to aid in creating more-compact, effective code.


Understanding Object-Oriented Programming

Object-oriented programming is a style of coding that allows developers to group similar tasks into classes. This helps keep code following the tenet “don’t repeat yourself”

(DRY) and easy-to-maintain.

“Object-oriented programming is a style of coding that allows developers to group similar tasks into classes.”

One of the major benefits of DRY programming is that, if a piece of information changes in your program, usually only one change is required to update the code. One of the biggest nightmares for developers is maintaining code where data is declared over and over again, meaning any changes to the program become an infinitely more frustrating game of Where’s Waldo? as they hunt for duplicated data and functionality.

OOP is intimidating to a lot of developers because it introduces new syntax and, at a glance, appears to be far more complex than simple procedural, or inline, code. However, upon closer inspection, OOP is actually a very straightforward and ultimately simpler approach to programming.


Understanding Objects and Classes

Before you can get too deep into the finer points of OOP, a basic understanding of the differences between objects and classes is necessary. This section will go over the building blocks of classes, their different capabilities, and some of their uses.

Recognizing the Differences Between Objects and Classes

“Developers start talking about objects and classes, and they appear to be interchangeable terms. This is not the case, however.”

Right off the bat, there’s confusion in OOP: seasoned developers start talking about objects and classes, and they appear to be interchangeable terms. This is not the case, however, though the difference can be tough to wrap your head around at first.

A class, for example, is like a blueprint for a house. It defines the shape of the house on paper, with relationships between the different parts of the house clearly defined and planned out, even though the house doesn’t exist.

An object, then, is like the actual house built according to that blueprint. The data stored in the object is like the wood, wires, and concrete that compose the house: without being assembled according to the blueprint, it’s just a pile of stuff. However, when it all comes together, it becomes an organized, useful house.

Classes form the structure of data and actions and use that information to build objects. More than one object can be built from the same class at the same time, each one independent of the others. Continuing with our construction analogy, it’s similar to the way an entire subdivision can be built from the same blueprint: 150 different houses that all look the same but have different
families and decorations inside.

Structuring Classes

The syntax to create a class is pretty straightforward: declare a class using the class keyword, followed by the name of the class and a set of curly braces ({}):

  1. <?php
  2. class MyClass
  3. {
  4.     // Class properties and methods go here
  5. }
  6. ?>

After creating the class, a new class can be instantiated and stored in a variable using the new keyword:

  1. $obj = new MyClass;

To see the contents of the class, use var_dump():

Try out this process by putting all the preceding code in a new file called test.php in [your local] testing folder:

  1. <?php
  2. class MyClass
  3. {
  4.     // Class properties and methods go here
  5. }
  6. $obj = new MyClass;
  7. var_dump($obj);
  8. ?>

Load the page in your browser at http://localhost/test.php and the following should display:

  1. object(MyClass)#1 (0) { }

In its simplest form, you’ve just completed your first OOP script.


Defining Class Properties

To add data to a class, properties, or class-specific variables, are used. These work exactly like regular variables, except they’re bound to the object and therefore can only be accessed using the object.

To add a property to MyClass, add the following code to your script:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5. }
  6. $obj = new MyClass;
  7. var_dump($obj);
  8. ?>

The keyword public determines the visibility of the property, which you’ll learn about a little later in this chapter. Next, the property is named using standard variable syntax, and a value is assigned (though class properties do not need an initial value).

To read this property and output it to the browser, reference the object from which to read and the property to be read:

Because multiple instances of a class can exist, if the individual object is not referenced, the script would be unable to determine which object to read from. The use of the arrow (->) is an OOP construct that accesses the contained properties and methods of a given object.

Modify the script in test.php to read out the property rather than dumping the whole class by modifying the code as shown:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5. }
  6. $obj = new MyClass;
  7. echo $obj->prop1; // Output the property
  8. ?>

Reloading your browser now outputs the following:

  1. I’m a class property!

Defining Class Methods

Methods are class-specific functions. Individual actions that an object will be able to perform are defined within the class as methods.

For instance, to create methods that would set and get the value of the class property $prop1, add the following to your code:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function setProperty($newval)
  6.     {
  7.         $this->prop1 = $newval;
  8.     }
  9.     public function getProperty()
  10.     {
  11.         return $this->prop1 . “<br />”;
  12.     }
  13. }
  14. $obj = new MyClass;
  15. echo $obj->prop1;
  16. ?>

Note — OOP allows objects to reference themselves using $this. When working within a method, use $this in the same way you would use the object name outside the class.

To use these methods, call them just like regular functions, but first, reference the object they belong to. Read the property from MyClass, change its value, and read it out again by making the modifications below:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function setProperty($newval)
  6.     {
  7.         $this->prop1 = $newval;
  8.     }
  9.     public function getProperty()
  10.     {
  11.         return $this->prop1 . “<br />”;
  12.     }
  13. }
  14. $obj = new MyClass;
  15. echo $obj->getProperty(); // Get the property value
  16. $obj->setProperty(“I’m a new property value!”); // Set a new one
  17. echo $obj->getProperty(); // Read it out again to show the change
  18. ?>

Reload your browser, and you’ll see the following:

  1. I’m a class property!
  2. I’m a new property value!

“The power of OOP becomes apparent when using multiple instances of the
same class.”

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function setProperty($newval)
  6.     {
  7.         $this->prop1 = $newval;
  8.     }
  9.     public function getProperty()
  10.     {
  11.         return $this->prop1 . “<br />”;
  12.     }
  13. }
  14. // Create two objects
  15. $obj = new MyClass;
  16. $obj2 = new MyClass;
  17. // Get the value of $prop1 from both objects
  18. echo $obj->getProperty();
  19. echo $obj2->getProperty();
  20. // Set new values for both objects
  21. $obj->setProperty(“I’m a new property value!”);
  22. $obj2->setProperty(“I belong to the second instance!”);
  23. // Output both objects’ $prop1 value
  24. echo $obj->getProperty();
  25. echo $obj2->getProperty();
  26. ?>

When you load the results in your browser, they read as follows:

  1. I’m a class property!
  2. I’m a class property!
  3. I’m a new property value!
  4. I belong to the second instance!

As you can see, OOP keeps objects as separate entities, which makes for easy separation of different pieces of code into small, related bundles.


Magic Methods in OOP

To make the use of objects easier, PHP also provides a number of magic methods, or special methods that are called when certain common actions occur within objects. This allows developers to perform a number of useful tasks with relative ease.

Using Constructors and Destructors

When an object is instantiated, it’s often desirable to set a few things right off the bat. To handle this, PHP provides the magic method __construct(), which is called automatically whenever a new object is
created.

For the purpose of illustrating the concept of constructors, add a constructor to MyClass that will output a message whenever a new instance of the class is created:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function setProperty($newval)
  10.     {
  11.         $this->prop1 = $newval;
  12.     }
  13.     public function getProperty()
  14.     {
  15.         return $this->prop1 . “<br />”;
  16.     }
  17. }
  18. // Create a new object
  19. $obj = new MyClass;
  20. // Get the value of $prop1
  21. echo $obj->getProperty();
  22. // Output a message at the end of the file
  23. echo “End of file.<br />”;
  24. ?>

Note__CLASS__ returns the name of the class in which it is called; this is what is known as a magic constant. There are several available magic constants, which you can read more about in the PHP manual.

Reloading the file in your browser will produce the following result:

  1. The class “MyClass” was initiated!
  2. I’m a class property!
  3. End of file.

To call a function when the object is destroyed, the __destruct() magic method is available. This is useful for class cleanup (closing a database connection, for instance).

Output a message when the object is destroyed by defining the magic method
__destruct() in MyClass:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function setProperty($newval)
  14.     {
  15.         $this->prop1 = $newval;
  16.     }
  17.     public function getProperty()
  18.     {
  19.         return $this->prop1 . “<br />”;
  20.     }
  21. }
  22. // Create a new object
  23. $obj = new MyClass;
  24. // Get the value of $prop1
  25. echo $obj->getProperty();
  26. // Output a message at the end of the file
  27. echo “End of file.<br />”;
  28. ?>

With a destructor defined, reloading the test file results in the following output:

  1. The class “MyClass” was initiated!
  2. I’m a class property!
  3. End of file.
  4. The class “MyClass” was destroyed.

“When the end of a file is reached, PHP automatically releases all resources.”

To explicitly trigger the destructor, you can destroy the object using the
function unset():

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function setProperty($newval)
  14.     {
  15.         $this->prop1 = $newval;
  16.     }
  17.     public function getProperty()
  18.     {
  19.         return $this->prop1 . “<br />”;
  20.     }
  21. }
  22. // Create a new object
  23. $obj = new MyClass;
  24. // Get the value of $prop1
  25. echo $obj->getProperty();
  26. // Destroy the object
  27. unset($obj);
  28. // Output a message at the end of the file
  29. echo “End of file.<br />”;
  30. ?>

Now the result changes to the following when loaded in your browser:

  1. The class “MyClass” was initiated!
  2. I’m a class property!
  3. The class “MyClass” was destroyed.
  4. End of file.

Converting to a String

To avoid an error if a script attempts to output MyClass as a string, another magic method is used called __toString().

Without __toString(), attempting to output the object as a string results in a fatal error. Attempt to use echo to output the object without a magic method in place:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function setProperty($newval)
  14.     {
  15.         $this->prop1 = $newval;
  16.     }
  17.     public function getProperty()
  18.     {
  19.         return $this->prop1 . “<br />”;
  20.     }
  21. }
  22. // Create a new object
  23. $obj = new MyClass;
  24. // Output the object as a string
  25. echo $obj;
  26. // Destroy the object
  27. unset($obj);
  28. // Output a message at the end of the file
  29. echo “End of file.<br />”;
  30. ?>

This results in the following:

  1. The class “MyClass” was initiated!
  2. Catchable fatal error: Object of class MyClass could not be converted to string in /Applications/XAMPP/xamppfiles/htdocs/testing/test.php on line 40

To avoid this error, add a __toString() method:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function __toString()
  14.     {
  15.         echo “Using the toString method: “;
  16.         return $this->getProperty();
  17.     }
  18.     public function setProperty($newval)
  19.     {
  20.         $this->prop1 = $newval;
  21.     }
  22.     public function getProperty()
  23.     {
  24.         return $this->prop1 . “<br />”;
  25.     }
  26. }
  27. // Create a new object
  28. $obj = new MyClass;
  29. // Output the object as a string
  30. echo $obj;
  31. // Destroy the object
  32. unset($obj);
  33. // Output a message at the end of the file
  34. echo “End of file.<br />”;
  35. ?>

In this case, attempting to convert the object to a string results in a call to the getProperty() method. Load the test script in your browser to see the result:

  1. The class “MyClass” was initiated!
  2. Using the toString method: I’m a class property!
  3. The class “MyClass” was destroyed.
  4. End of file.

Tip — In addition to the magic methods discussed in this section, several others are available. For a complete list of magic methods, see the PHP manual page.


Using Class Inheritance

Classes can inherit the methods and properties of another class using the extends keyword. For instance, to create a second class that extends MyClass and adds a method, you would add the following to your test file:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function __toString()
  14.     {
  15.         echo “Using the toString method: “;
  16.         return $this->getProperty();
  17.     }
  18.     public function setProperty($newval)
  19.     {
  20.         $this->prop1 = $newval;
  21.     }
  22.     public function getProperty()
  23.     {
  24.         return $this->prop1 . “<br />”;
  25.     }
  26. }
  27. class MyOtherClass extends MyClass
  28. {
  29.     public function newMethod()
  30.     {
  31.         echo “From a new method in ” . __CLASS__ . “.<br />”;
  32.     }
  33. }
  34. // Create a new object
  35. $newobj = new MyOtherClass;
  36. // Output the object as a string
  37. echo $newobj->newMethod();
  38. // Use a method from the parent class
  39. echo $newobj->getProperty();
  40. ?>

Upon reloading the test file in your browser, the following is output:

  1. The class “MyClass” was initiated!
  2. From a new method in MyOtherClass.
  3. I’m a class property!
  4. The class “MyClass” was destroyed.

Overwriting Inherited Properties and Methods

To change the behavior of an existing property or method in the new class, you can simply overwrite it by declaring it again in the new class:

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function __toString()
  14.     {
  15.         echo “Using the toString method: “;
  16.         return $this->getProperty();
  17.     }
  18.     public function setProperty($newval)
  19.     {
  20.         $this->prop1 = $newval;
  21.     }
  22.     public function getProperty()
  23.     {
  24.         return $this->prop1 . “<br />”;
  25.     }
  26. }
  27. class MyOtherClass extends MyClass
  28. {
  29.     public function __construct()
  30.     {
  31.         echo “A new constructor in ” . __CLASS__ . “.<br />”;
  32.     }
  33.     public function newMethod()
  34.     {
  35.         echo “From a new method in ” . __CLASS__ . “.<br />”;
  36.     }
  37. }
  38. // Create a new object
  39. $newobj = new MyOtherClass;
  40. // Output the object as a string
  41. echo $newobj->newMethod();
  42. // Use a method from the parent class
  43. echo $newobj->getProperty();
  44. ?>

This changes the output in the browser to:

  1. A new constructor in MyOtherClass.
  2. From a new method in MyOtherClass.
  3. I’m a class property!
  4. The class “MyClass” was destroyed.

Preserving Original Method Functionality While Overwriting Methods

To add new functionality to an inherited method while keeping the original method intact, use the parent keyword with the scope resolution operator (::):

  1. <?php
  2. class MyClass
  3. {
  4.     public $prop1 = “I’m a class property!”;
  5.     public function __construct()
  6.     {
  7.         echo ‘The class “‘, __CLASS__, ‘” was initiated!<br />’;
  8.     }
  9.     public function __destruct()
  10.     {
  11.         echo ‘The class “‘, __CLASS__, ‘” was destroyed.<br />’;
  12.     }
  13.     public function __toString()
  14.     {
  15.         echo “Using the toString method: “;
  16.         return $this->getProperty();
  17.     }
  18.     public function setProperty($newval)
  19.     {
  20.         $this->prop1 = $newval;
  21.     }
  22.     public function getProperty()
  23.     {
  24.         return $this->prop1 . “<br />”;
  25.     }
  26. }
  27. class MyOtherClass extends MyClass
  28. {
  29.     public function __construct()
  30.     {
  31.         parent::__construct(); // Call the parent class’s constructor
  32.         echo “A new constructor in ” . __CLASS__ . “.<br />”;
  33.     }
  34.     public function newMethod()
  35.     {
  36.         echo “From a new method in ” . __CLASS__ . “.<br />”;
  37.     }
  38. }
  39. // Create a new object
  40. $newobj = new MyOtherClass;
  41. // Output the object as a string
  42. echo $newobj->newMethod();
  43. // Use a method from the parent class
  44. echo $newobj->getProperty();
  45. ?>

This outputs the result of both the parent constructor and the new class’s constructor:

  1. The class “MyClass” was initiated!
  2. A new constructor in MyOtherClass.
  3. From a new method in MyOtherClass.
  4. I’m a class property!
  5. The class “MyClass” was destroyed.

Assigning the Visibility of Properties and Methods

For added control over objects, methods and properties are assigned visibility. This controls how and from where properties and methods can be accessed. There are three visibility keywords: public, protected, and private. In addition to its visibility, a method or property can be declared as static, which allows them to be accessed without an instantiation of the class.

Reference: http://net.tutsplus.com/tutorials/php/object-oriented-php-for-beginners/

Advertisements

HOW TO SHARE SUBREPORT DATA WITH THE MAIN REPORT.

•05/12/2011 • Leave a Comment

The information in the article refers to
Crystal Reports and BusinessObjects Reports
Applies to
Shared variables
Passing data between subreport and main report
Synopsis
A report contains a subreport. Data from the subreport is required for calculations in the main report.

How can you share subreport data with the main report in version 7 (or higher) of the Crystal Reports Designer?
Solution
Shared variables, make it easier to pass values from a subreport to the main report. Using shared variables requires two formulas: one to store the value in a shared variable, the other to retrieve the value from the shared variable.

The most important thing to remember when using shared variables is that Crystal Reports must first evaluate the formula where the value is stored before evaluating the formula that retrieves the shared variable.

For example if you want to pass a grand total from the subreport to do a calculation in the main report, follow these steps:

1. In the subreport, create a formula similar to the one below:

//@SubFormula
//Stores the grand total of the
//{Orders.Order Amount} field
//in a currency variable called ‘myTotal’

WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({Orders.Order Amount})

2. Place this formula in your subreport.

3. In the main report, create a formula that declares the same variable name:

//@MainFormula
//Returns the value that was stored
//in the shared currency variable called
//myTotal in the subreport

WhilePrintingRecords;
Shared CurrencyVar myTotal;
myTotal

4. Place @MainFormula in a main report section that is beneath the section containing the subreport.

NOTE:
For the shared variable to return the correct value in the main report, you must place @MainFormula in a main report section that is beneath the section containing the subreport. This ensures Crystal Reports evaluates the @SubFormula before @MainFormula.

One way to do this is to insert a section below the section containing the subreport, and place @MainFormula in this new sub-section:

? On the ‘Format’ menu, click ‘Section’.

? On the ‘Sections’ list, click the section containing the subreport.

? Click ‘Insert’ (at top of dialog box). This inserts an additional subsection.

? Click ‘OK’ to return to the report, and insert @MainFormula into this new sub-section.

The next time you preview the report, @MainFormula displays the value from the subreport. In this particular example, that value was the grand total of the {Orders.Order Amount} field.

5. Once you have verified that @MainFormula is returning the correct value from the subreport, you can include this formula in other main report formulas, such as:

//@NewFormula
//includes data from subreport

{@MainFormula} + Sum ({Customer.Last Year’s Sales})

? Place this formula in the same section as @MainFormula, or in a section further down on the report.

You have now successfully shared data from a subreport with the main report.

NOTE:
This is not possible with On Demand Subreports in Crystal Reports since the report will not be processed until after clicking report.
http://www.datamanagementgroup.com/Resources/TrainersTalk/trainerstalk_howto_share_subreport_data_with_main_report.asp

Reva Aims to Alleviate ‘Range Anxiety’

•12/31/2010 • Leave a Comment

16_1753_20090910184812_REVA NXG

Apparently if you won’t go to electrics, electric car companies are taking pains to come to you.

First, we had Tesla’s vice president of business development, Diarmuid O’Connell, talking about “remote techs” servicing Tesla models in areas around the country without showrooms or repair stations. Now comes word that Indian electric car company Reva will be unveiling plans for emergency remote recharging at the Frankfurt Auto Show in six days’ time.

The two models featuring the REVive refueling option — which allows Reva drivers to call or text the company for an on-site recharge — are the 4-seat, family-oriented NXR hatchback and the sporty 2-seat NXG (pictured).

Both models aim to lure drivers with “range anxiety” (i.e. the fear of running out of charge midtrip) by assuring them that a charge is always available, though details of how, exactly, the company will deliver on that promise won’t be revealed until Sept. 16.

While Reva — a joint venture between Maini Group of India and AEV LLC of California — sells or test-markets cars in more than 24 countries and claims to have the largest fleet of EVs on the road with more than 3,000 vehicles deployed, there are no specific plans (that we’ve heard) to send the cars stateside. Given the backlash against EVs in general and small cars in particular that we’ve been reading recently in our own comments sections, that may be a smart choice.

Reference http://www.msn.com

Audi, Electric

•12/24/2010 • Leave a Comment

16_1753_20090914231042_Audi E-Tron

Don’t tell Audi of America President Johan de Nysschen, but someone at the company went and made an electric vehicle — and a pretty good-looking one, at that.

Of course, we kid, we kid; the man’s not fundamentally opposed to electrics — just certain aspects of the way the technology is being promoted. And, with the e-Tron’s R8-inspired design in Audi’s stable (proving true these rumors), he himself has plenty of reasons to make converts out of electric naysayers.

According to the AutoWeek article, the company is behind electrics for various reasons — immediately available torque in a sports car such as this one, for one thing, as well as the same reducing-oil-dependency and cleaner-emissions arguments you hear ad nauseam — but is also upfront about the drawbacks of how electrics exist in their current iteration. The Catch-22 of EVs is that performance and range increase only with larger, heavier batteries, while the larger and heavier the batteries become, the less efficient (as in, less fun to drive, more power drained to move the vehicle) the cars become. But these are issues everyone is trying to tackle in the electric arena, and if we’re going to have to live with drawbacks, we’d rather they exist in a car that looks like the e-Tron.

Reference http://www.msn.com

Gilding the Lily: Another Supercar Reveal

•12/17/2010 • Leave a Comment

16_1753_20090911231806_lambo-reventon-front

First we heard the shouts about the McLaren MP4-12C, and the Mercedes SLS AMG made its own splash less than a day later. Apparently, Lamborghini has had enough of not being in the limelight. Ahead of its Frankfurt debut, the Italian supercar stalwart has revealed its own shots (or had them revealed despite their efforts — still unclear) of the new Reventon Roadster.

The scoop on the new drop-top (following the coupe’s debut two years after the 2007 Frankfurt show): Only 20 of the machines will be made next year, at a cost of $1.67 million each; that buys you, at the very least, the same massive 6.7-liter V12 engine found under the hood of the Murcielago.

Funny aside: About two years ago I got a desperate call from the Web editor of Popular Science; she said, essentially, that one of her car writers assigned to the Reventon press reveal had to duck out, and could she put me on a plane to Italy that afternoon in order to test-drive the new Lambo the next day? Sadly, I was on deadline for another project, and had to decline (despite every instinct telling me I should drop the conflicting assignment). I’ve regretted it ever since. The moral of the story is: Never say no to someone offering you a free trip to Italy to drive the newest supercar from Lamborghini.

Reference http://www.msn.com

The World’s Most Efficient Car?

•12/10/2010 • Leave a Comment

16_1753_20090915235848_VW L1

It’s funny hearing the boasts coming from the Frankfurt Motor Show. Whereas in years past the arms race seemed centered on speed and power — fastest time to 60 mph or most muscular top speed — carmakers (unsurprisingly) seem to be shouting from the hilltops about fuel efficiency and miles per gallon.

The latest town crier is VW, with its diesel-powered L1 concept hybrid, and it certainly has the efficiency paperwork: Total weight is kept to a staggeringly light 838 pounds thanks to lightweight components such as a carbon fiber-reinforced body, aluminum brakes and ceramic bearings. And the minuscule tank holds a mere 1.7 gallons of fuel — which, it should be mentioned, will get the car 306 miles farther down the road, according to some reports of its purported 180 mpg capability.

The tiny, aerodynamic L1 — which goes into limited production next year and will have a full run in 2013 — is the result of a Volkswagen research project that began way back in 1998. And, as anyone who’s read Exhaust Notes regularly could predict, we applaud its efforts toward real gains in fuel efficiency and clever engineering. We are, however, a little nostalgic for some old-school, gas-bill-be-damned, pin-you-to-your seat performance numbers.


Reference http://www.msn.com

The Prancing Horse Rides Away the Winner

•12/03/2010 • Leave a Comment

16_1753_20090916225059_Ferrari 458 Italia

Honestly, everyone should have seen this coming. Just look at it: This car was simply too stunning to be anything but the winner, and now AutoWeek, at least, has confirmed it by naming the Ferrari 458 Italia the Best in Show at Frankfurt. And while cream-of-the-crop contenders such as the Maserati GranCabrio, Mercedes-Benz SLS, Aston Martin Rapide, Bentley Mulsanne, Rolls-Royce Ghost, Lamborghini Reventon Roadster and Audi R8 Spider were all in the running, each, in the end, had to bow down to the swooping, sexy and somewhat menacing V8-powered monster with the 562 horses.

Other awards went to: The BMW Vision EfficientDynamics (Best Concept), the Porsche 911 Turbo (Most Fun, and again beating out Maserati’s GranCabrio … poor Maserati) and, for Most Significant, Renault’s entire four-model lineup of production electric vehicles.

Reference http://www.msn.com