Хелпикс

Главная

Контакты

Случайная статья





Object lesson



Another trend, which predates the web, but was greatly stimulated by it, is the shift to “object-oriented” programming. The objects in question tend to be convenient representations in computer code of counterparts in the real world. For example, a clickable button on a web page is an object. The programmer can change the object through a limited set of methods, which will be the same for all clickable buttons. This contrasts with so-called “procedural” languages such as Fortran and C, which focus on how to do things such as draw a button on the screen, and require the programmer to reinvent the button each time a fresh program is written. As the button example suggests, objects are particularly well-suited to “graphical user interfaces”—the friendly desktops that Windows and the World Wide Web present to users.

The price to pay for objects is that the language must come equipped with a large library of different classes of objects, making the language bulkier and more cumbersome to use. In some versions of the pioneering object-oriented language, Smalltalk, libraries can contain many thousands of object classes. Still, the consensus is that the benefits of having to store a library of objects far outweigh the costs—especially nowadays, with processing power and memory storage having become so abundant and cheap. In exceptional cases, where size is an issue, libraries can be pared to a minimum. Java, which is object-oriented, now comes in a pint-size version that fits on a “smart card”, a credit card with a chip embedded into it for encrypting data in mobile phones and other portable devices.

Another advantage of object-oriented programming is that groups of users (eg, retailers, estate agents, doctors) can create and share new classes of object. This makes object-oriented programming particularly suited to the group-based nature of the web.

It is no surprise that just about every programming language that was not object-oriented has now become so. Delphi is an object-oriented version of Pascal, once the favourite language for teaching computer science. An object-oriented extension to the no-frills Basic, the favourite language of amateur programmers, underlies Visual Basic—a favourite nowadays for developing simple graphical user interfaces in Windows. Visual Basic is reckoned to be used by 6m developers—twice as many as Java. Even the old-fashioned programming language for business, Cobol, has been revamped asOOCobol.

Meanwhile, the philosophy behind object-oriented programming is itself moving to higher levels of abstraction. A relatively new, and fashionable, extension of the concept is the so-called “software pattern”, which captures the essential structure of a successful solution to a recurring problem in software development. Patterns are to objects much as prefabs (factory-built houses) are to bricks and mortar.



  

© helpiks.su При использовании или копировании материалов прямая ссылка на сайт обязательна.