"Maarten Wiltink" <maar...@kittensandcats.net> skrev i melding
news:a4o56n$dhn$1@news1.xs4all.nl...
Quote
> Bj?rge S?ther wrote in message
> <_hBa8.5539$HL2.119...@news2.ulv.nextra.no>...
> [...]
> >Yes, I agree, but I object this: the doubleclcicking of event handlers in
> >components is one of the basic concepts in "RAD Delphi". As a newbie you
> use
> >all the RAD features, and later you'll have to dicipline yourself into
> *not*
> >doing it ! The "RAD trap" !
> I'm afraid you're right. This is just one instance of a very
> common problem: that software should really adapt to the
> experience level of its user. It's a _very_ hard problem in
> general.
> In this case, I see the root cause as being that event handler
> methods should be named after something on a different level
> than the IDE has access to. The IDE knows about widgets and
> events, not about what you're trying to _do_.
> <three layers of events: UI -> application-logic -> UI>
> >This seems mature.
> Well, it took a few weeks before it had reached its final form
> and I understood what had happened. I like to think it deserves
> to be called mature.
Do you solve this by using object instances in parallell to e.g. form
objects in a 1 - to - 1 relationship, or what ?
Quote
> > ...restructure the whole application to be able
> >to serve both as a traditional Windows client *and* a web server app.
> I you hadn't said it so drily, I would not have believed it to
> be possible at all.
Well, it remains to see if it's a good solution. The application itself has
a quite simple GUI, with only 5 different screens. The complexity lies
within calculation of what to display in these forms for a certain
combination of selected parameters. The application needs to be split in two
also at a lower level, to allow for multiple sessions to share a common
system data structure. But again, this is a topic also for standard Windows
applications: How to split static systemdata from instance-specific data,
e.g. to allow for opening a second form showing something completely
different without having to duplicate more data than necessary. It is all
about where stateful data is located and where you put stateless data.
If the two "lower" layers, stateless systemdata and instance-specific,
stateful data is written without being GUI-specific, it should be fairly
easy to replace the Windows GUI with an HTTP-producer.
Quote
> > ...I have
> >planned for replacing all interaction controls <> underlying object with
a
> >few methods / properties. Exception is drawing in complex controls,
where
> >different descendants of a common base class either knows how to interact
> >with forms, or they provide HTML output. The necessary rebuild solves a
> lot
> >of other issues, as well; the ones you have solved through creating a
> >"logical layer" that maps interaction man <> code in a more model-true
> way.
> Thanks for the compliment. Is this the famous "peer recognition"?
Yes !
Quote
> I can _almost_ see how that solves the traditional impedance
> mismatch between the Windows GUI and the Web model. It's about
> channelling events back and forth, with state kept in the
> application where I still see everything that's in a browser
> as stateless HTML pages.
The main problem is, it seems, that if one does not utilize JavaScript or
Java/ActiveX, the flow of a Web application is very different from a Windows
client:
Typical Windows Client:
1) Open a form
2) Invoke Command through a control
3) Reflect changes by repainting some window(s)
Web app:
1) Return HTTP document (form) upon request
2) Invoke Command through a control
3) return to 1)
These two models need to be "mapped" to a common underlying structure. I
have thought that the common point will be a dispatching procedure,
providing command and parameters. There is also a difference in program
flow, in that a web request needs to return the resulting HTTP immediately,
whereas in Windows, you typically respond to messages.
Example (Web-app):
(sample url:
http://www.itte.no/bin/WebApp.exe?Session=23443321?Command=OpenDetail...
s=CustID:201122)
function Invoke(const Command: string; Params: string): string; // returns
HTTP
var
StateFulObj: THTTPStatefulObj;
begin
StateFulObj:=FindSessionInstance(Params); // extracts "SessionID" param
if Assigned(StateFulObj) then begin
StatefulObj.Invoke(Command, Params); // Extracts "Command" & "Params",
executes command
result:=StatefulObj.HTTP; // In win-app, the result is "returned"
through a call to the event handler
end
else
result:=InvalidSessionOutput(Command, Params);
end;
Example (Windows-app):
(sample: Invoke('OpenDetails', GetCustId);)
proceudre Invoke(Sender: TObject; const Command: string; Params: string);
var
StateFulObj: TWinStatefulObj;
begin
StateFulObj:=Sender as TWinStatefulObj;
if Assigned(StateFulObj) then
StatefulObj.Invoke(Command, Params) // Extracts "Command" & "Params",
executes command
else
raise Exception.Create('Invalid "Sender" parameter in function
Invoke;');
end;
...now, the latter doesn't really need to return anything, as messages will
be sent back to controls of the calling form.
Quote
> It's good to know I still have things to look forward to, new
> things to learn. What web server do you use? Is the application
> multi-user by design? How do you identify a session?
Well, the make of the Web-server doesn't matter that much, as long as you
don't use MS-specific techniques. I don't know, really, wherther I'll have
to use the ISAPI interface or whatever. If so, I understand that the .dll is
loaded / unloaded upon every call, so I need to make this one as small as
possible, dispatching calls to a steadily running server application. Maybe
a complete Web-Server application is the best ? Frankly, I have not been
doing this before...;-)
My application is multi-user by design, only that it needs a quite
complicated system database to work, and loading this one typically is a
quite expensive operation. I believe that a Server application should only
do this once, and let all sessions share the system data. It is a
"parameterized SQL-applications", where no fields are defined at designtime.
The main task of the client is to use system data for generating SQL calls
to pass to the server.
If you're interested, I'll send you a test URL the day something works ;-)
--
Bj?rge S?ther
bjorge@hahaha_itte.no