Its sometimes a bit hard to describe what SOPE methods are, this page tries to give some idea on how things fit together ...
TODO: far from complete, just collecting ideas
Sometimes one walks over some typical WebObjects code which looks like this (actually this is in SkyP4FolderView ;-):
if ((page = [self pageWithName:@"SkyCompanyAccessEditor"])) { [page takeValue:gid forKey:@"globalID"]; [page takeValue:accessCheckFlags forKey:@"accessChecks"]; return page; } [self setErrorString:@"could not find access editor !"]; return nil;
Now this is a pretty good example why treating components as functions/methods makes sense. Because the above is semantically something like this:
[self showAccessEditorWithGlobalID:gid andAccessChecks:accessCheckFlags];
Actually it would not be hard to extend WO with a method like:
[self callPage:@"SkyCompanyAccessEditor", @"globalID", gid, @"accessChecks", accessCheckFlags, nil];
And indeed this is basically what SOPE allows you to do in a more formal way, more specifically the SoPageInvocation object.
In addition SOPE allows you to decouple the page from
the specific class name and bind it to a "method name".
For example you can call the "SkyCompanyAccessEditor"
as the "accessEditor" method on a SxPerson SoObject. Other
objects could map "accessEditor" to different accesss
editor page.
Maybe an example from a product.plist helps to understand:
SxDocument = { methods = { "view" = { protectedBy = "View"; pageName = "OGoDocumentView"; }; }; };
This says that when calling the SOPE "view" method on an SxDocument object will trigger the OGoDocumentView component (no parameters will be passed, though the component can retrieve eg form parameters using its own methods).
Q: Is it a function or a method?
A: Good one! ;-)
We would first need to define what a method is, I would
say its a function which operates in an object context
(self in Objective-C) and which is "usually"
polymorphically looked up (is that correct English?).
For SOPE methods the object context is the clientObject which is usually retrieved from the
associated context. In the case of components the client
object can also be retrieved using the -clientObject of
the component.
And the lookup of methods is attached to the SoClass as
described above (actually lookup is even more dynamic
because objects can override it and put acquisition into
the mix).