Re: Need .Net Design Help
From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 09/14/04
- Next message: Richard Blewett [DevelopMentor]: "Re: Configuration files for Services and Class Libraries"
- Previous message: Dennis Myrén: "Re: Response.Write for a XML string"
- In reply to: Jack Addington: "Re: Need .Net Design Help"
- Next in thread: Jack Addington: "Re: Need .Net Design Help"
- Reply: Jack Addington: "Re: Need .Net Design Help"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Sep 2004 10:51:24 -0400
Jack,
You shouldn't be worried about passing messages. You should basically
consider all of your operations as atomic transactions. In this sense, you
give it input, and it spits out output, doing work in between. The output
that it spits back would be whatever errors that occur. Once you make the
call, you should not wait for a message to come from somewhere indicating
whether or not it succeeded.
Now the kinds of errors that you report back are up to you, but IMO, I
think that business errors should always be in the form of return values.
You could have a collection of warnings/business logic errors that occur,
and then return those to the user, and then they decide what to do with
them.
Exceptions are different, these are not business logic errors, and
should be allowed to propogate up the call stack, IMO.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
"Jack Addington" <jaddington@shaw.ca> wrote in message
news:ux6YfEgmEHA.1652@TK2MSFTNGP09.phx.gbl...
>I wasn't under the impression that it would be as simple as changing a
>'skin' or something but for something as simple as an update that spawns a
>database error I would like a common plan to pass the information back to
>the presentation.
>
> Going back to my original question, more for the winforms since that has
> to work long before I tackle the webform, would you suggest a way to
> essentially push a message from a non-visual business layer to the
> presentation layer?
>
>
> "Bob Grommes" <bob@bobgrommes.com> wrote in message
> news:OqB72NemEHA.2140@TK2MSFTNGP11.phx.gbl...
>> Jack,
>>
>> An ASP.NET application is a very different beast. Things like
>> messageboxes
>> have to be raised by client-side JavaScript code. Also, that JavaScript
>> field validation has to replicate to a great extent the business logic
>> that
>> resides in your business objects and/or stored procedures -- at least, it
>> does if you want to provide the kind of feedback users expect from a rich
>> client.
>>
>> You can certainly swap in a different presentation layer but the code
>> reuse
>> between WinForms and ASP.NET presentation layers just inherently sucks.
>> If
>> you stick to Microsoft's postback-heavy model and try to keep as much
>> logic
>> on the server as possible, it gets somewhat better, but it'll never just
>> be
>> a matter of swapping a few things around no matter how hard you try.
>> Microsoft has actually backed off from a design goal like this for their
>> development frameworks. If they can't pull it off, you probably can't
>> either.
>>
>> --Bob
>>
>> "Jack Addington" <jaddington@shaw.ca> wrote in message
>> news:%23987oibmEHA.3464@tk2msftngp13.phx.gbl...
>>> I've got a fairly simple application implementation that over time is
>> going
>>> to get a lot bigger. I'm really trying to implement it in a way that
>>> will
>>> facilitate the growth. I am first writing a WinForms interface and then
>>> need to port that to a web app. I am kinda stuck on a design issue and
>> need
>>> some suggestions / direction.
>>>
>>> Basically I have a business layer that I want to use to process any
>>> dataentry logic (row focus changes, data validation etc). I'm hoping
>>> that
>> I
>>> can in time just substitute a web gui for the win gui and not have much
>> code
>>> re-write. Anyhow my problem is how to pass message to the user back to
>> the
>>> GUI layer from the logic layer.
>>>
>>> ex) GUI data object lets user change a number and it falls outside the
>>> range.
>>>
>>> I have subscribed to the data object's 'dataChanged' event from my logic
>>> layer and have determined that it falls outside the acceptable range. I
>>> basically want to display a popup message that tells the user so. Now
>>> it
>>> seems 'wrong' to me to have a reference to system.windows.forms so I can
>> do
>>> a MessageDlg.Show("Bad Value ...") as obviously that won't work with the
>> web
>>> frontend. I don't want to raise an exception because I don't have a
>>> 'try
>> '
>>> clause around some sort of 'start edit' on the GUI side.
>>>
>>> I've had thoughts that maybe I need a generic function on my frontend
>>> that
>>> handles messages from the logic side??? Is that where an interface
>>> would
>>> work? How do I go about making it generic so that I can re-use it for
>>> webforms etc.
>>>
>>> thanks so much
>>>
>>> jack
>>
>>
>
>
- Next message: Richard Blewett [DevelopMentor]: "Re: Configuration files for Services and Class Libraries"
- Previous message: Dennis Myrén: "Re: Response.Write for a XML string"
- In reply to: Jack Addington: "Re: Need .Net Design Help"
- Next in thread: Jack Addington: "Re: Need .Net Design Help"
- Reply: Jack Addington: "Re: Need .Net Design Help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|