The Basics About Objects

     

In a non-object-oriented environment, there are two elements to deal with: data and code. These are two separate entities. Data is any stored content, and code is the procedural bits of programming that allow the data to get to its intended audience. But with Zope, you're dealing with objects and object orientation. As such, you have only one element, an object. The object comes to the table as a bundle of code and data, all nicely packaged together and ready for use.

The following object- related vocabulary will be helpful to you as you learn more about Zope; this is not intended to be a tutorial on object orientation.

  • Objects store data and code together, along with logic that makes them perform a task.

  • Classes contain the basic instructions for each type of object. For example, all folder objects come from the same class; their attributes make them different from one another. Objects created from a class are called instances of a class. For example, the fancy_folder object is an instance of the folder class, the graven_image object is an instance of the image class, and the secret_document object is an instance of the document class.

  • The data stored in an object is defined by its attributes (also known as properties ). For example, when you create a folder object, the folder has a name attribute and a description attribute. All of the attributes of an object, taken together, make up its state. When one or more of these attributes is changed, the state of the object is said to have changed.

  • The tasks performed by objects are called its methods . For example, if you want to print the name of a folder, you might use a method called getFolderName . If you want to change the state of a folder object by changing its name, you might use a method called setFolderName . Objects from the same class share the same set of methods.

  • Objects talk to one another using messages. Using the example of a folder object again, think of how you would display a list of folders in a directory tree. You might create an object called FolderList , whose only purpose is to communicate to all the disparate folder objects and ask their names ”for example, by calling the getFolderName method of each of these scattered folder objects.

  • Objects can inherit behavior from each other. They can also override defined methods of their parent class.

Clear as mud? Thousand-page books have been written solely on object-oriented programming, and whole-semester classes have been taught at universities on this topic. So these simple bullet points are enough to provide you with the basic terminology you need to survive and read more about the subject. Although a full understanding of objects and object-oriented programming is not required to successfully use Zope, it will open your eyes to the ease with which you can extend and scale your Zope application server.

Publishing and Managing Objects

If your web application consists of objects that coexist and talk to one another, it's the responsibility of Zope to publish these objects so that your users can access them. Through simplistic yet powerful design, the hierarchical nature of the Zope object structure provides a template of its own for producing URLs that it can then successfully interpret. A URL such as http://www.yourserver.com/myPlone/ members /jane/ is a request for the folder object called jane inside the folder object called members , inside the Plone instance known as myPlone .

In the world of static web servers, the mapping of elements from a URL also occurs, but only to files on a file system. For example, http://www.mycompany.com/index.html asks for the static file index.html . The URL http://www.yourserver.com/myPlone/members/jane/index.html might look and act the same way to the end user , but index.html on the Zope server is actually a document object called index.html , not a static file of the same name.

When working in your Plone site, each time you add a new image, document, file, or other content type to your member folder, you add an object into the mix. Outside of Plone, you can add and manage objects through the Zope Management Interface, a truly wonderful web-based tool. In the next section, you'll learn a great deal about the ZMI and how you can use it to completely manage your content outside of the framework of the Plone application.



Plone Content Management Essentials
Plone Content Management Essentials
ISBN: 0672326876
EAN: 2147483647
Year: 2003
Pages: 107
Authors: Julie Meloni

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net