|
|
|
||||||
|
Re: Why operations on classes?
Quote:
Quote:
If you decide to transfer classes by value, then operations give you a standard interface to such classes. For example, you could have a class "Address", with an operation "string format()", which returns the address in a format suitable for the client. How exactly format() is implemented depends on your client. You simply derive from Address, implement format() as you wish, and then install a factory for your derived class. If you do not like this approach, but rather prefer to have operations and data separate, you can still opt to not add operations to classes. As for non-local classes, they are in essence interfaces with data members added. Due to language constraints (like in Java), there must be a separate class type for such "interfaces with data members". Now, non-local classes with data members are for persistence: With Freeze, you can automatically make instances of such classes with data members persistent. Slice is not just an interface definition language, it is also a language to describe persistent state. (We decided to use one single language for both type descriptions and persistence, because this make writing Ice programs a lot simpler.) You might object to classes with operations in the non-local case, because the client will have knowledge about data members in the servers, which it doesn't really need to know about. For small projects and rapid prototyping, this is usual not a problem. However, if you consider this a problem for large-scale projects, then you can move the operations into an interface, keep the data members in the class, and have the class implement the interface. Your client will then only get the Slice code for the interface, while your server gets the class with data members implementing the interface. Quote:
Quote:
We are currently working together with another company on a very large-scale project that uses Ice (sorry, can't disclose yet who it is -- we're under NDA). This other project needs persistence everywhere. So far the class approach for persistence (as opposed to having a separate persistence language) worked out very well. It simplifies development dramatically. Take care, Marc |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Life cycle operations coment | xdm | Help Center | 1 | 05-13-2006 03:02 PM |
| Limitations of Overloading operations | Venkat Seeth | Help Center | 5 | 02-18-2005 10:19 AM |
| Performance in local operations | wolfram | Comments | 4 | 08-26-2004 06:47 PM |
| Operations in Class | yomi | Help Center | 2 | 04-10-2004 09:39 PM |
| class with operations, Initialization | StuartA | Help Center | 6 | 02-22-2004 06:58 PM |