Re: Middle Tier (was Re: Table and Query Classes good or unnecessary?)
Nice writeup 🙂
On 17/3/18 8:24 am, Vik Shah wrote:
>>> 2. Remote tasks … cached data/objects…
> As Reg mentioned that having these data objects, lists, that are static or global in nature accessible via startup_task is the way to go. Just a note on this, use reference variables to pass things around, this will keep your omnis memory from blowing out.
This one I did want to add a few cents worth onto. I’m taking a
different route here myself really embracing the stateless nature of
http. This is where building for the web for me is structurally
different from building a client<->server application. While the front
end will keep data needed to keep an interface, my middle tier works on
single units of action.
So I will have a “get invoice” and a “set invoice” action in one shape
or form that work completely independent of each other. The get invoice
just gets an invoice, the middle tier then forgets about getting it. The
set invoice will validate the data its getting to make sure the user is
performing an allowed action, the invoice is still modifyable, the
invoice is properly structured, etc. At no time do I keep in memory the
invoice that the user retrieved. This also means that when the invoice
gets updated the middle tier checks the changes the user is trying to
make against the current state of the invoice, which could have been
It also means that in theory the set invoice command could be running on
a completely different server as load balancing redirects traffic to the
least busy server.
Now obviously, disclaimer here, where Omnis is concerned this for me is
theory, I’m mostly talking about past experience when I did 3-tier
development years ago. While I do have the “get invoice” and “set
invoice” approach implemented through stored functions on Postgres to
make the eventual move to 3-tier easier, we don’t have our middle tier
solution in development yet. Still I feel this is an important
structural difference in how you implement a 3-tier architecture
compared to implementing a client-server architecture and trying to keep
old habits alive will just cost you in the long run.