Interface reference, collection reference and collection of

The use of specific JADE features and proposals for new feature suggestions
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Interface reference, collection reference and collection of

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:00 am

by florian >> Sun, 7 Dec 2008 12:37:22 GMT

Dear Jade programmer

Halloo
somebady can give explanation about this terms ?
1. Interface reference
2. Collection reference
3. Collection of interface

I am really appreciate,if you can give me more explanation with example case or better with code (schema)

Thanks
florian

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Interface reference, collection reference and collection of

Postby ConvertFromOldNGs » Fri Aug 07, 2009 11:00 am

by Tim M >> Tue, 9 Dec 2008 10:21:31 GMT

None of those terms are Jade specific so a search on google would probably be more effective at getting the answer. Anyway a reference means the address of as opposed to a copy of the whole data. In c language you can declare pointers to data that are usually 32bit or 64bit reference, in Jade it is simplified in that you either use an attribute for simple data like integers, characters, strings or you have a reference to an object.

Jade is very object orientated, in that everything is either an object or an attribute on a object. Interfaces and collections are kinds of objects (even classes are objects but that adds a bit of confusion unless you are doing metaprogramming) so that means that they are passed by reference and other objects can store a reference to them.

A Collection reference simply means a reference to a Collection (Any object that inherits from Collection). Use these to store multiple things in. An interface reference usually means a reference to an interface (JadeInterface) which I'll attempt to explain:

If you don't know interfaces are they are mainly used as a way of guaranteeing methods to be implemented in clases that derive from different super classes. For example you may have a class structure that goes somthing like this:

Animal
-Mamal
-Dog
-Lion
-Fish
-Goldfish

In the above example a Pet is a cross cutting concern that applies to both Dog and Goldfish but not Lion so the sollution is to define the Pet interface and make both the Dog and Goldfish implement it. You can then define a method that accepts a Pet as a paramater or an Object that references a Pet and that reference will never be of kind Lion.

When you define a new collection you choose what kind of collection like member key dictionary, array, etc... than subclass with you new one. Collection have a member type this allows you to create an array of dogs for example but when you define the membership interfaces are also an option aswell as classes. This makes it possible to create a collection of pets or whatever you interface is. Again this is just object orientated programming and not jade specific.


Return to “Feature Discussions”

Who is online

Users browsing this forum: No registered users and 11 guests