Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2007, 07:50 AM
Authorized User
 
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default UI Abstraction layer

Hello,

I am new into winforms and I write in c# now ( shifted from VB6 ). I am looking for inputs regarding, abstraction in UI ( forms ). I will try to quote an example.

Lets says I have a user entry form with few controls on it i.e.

1. Combo box - holds product names
2. Text box - holds price
3. Buttons - to Add , Modify , Save and Undo

Now for combo I need to call LoadProducts function so that I fill the combo. Text box with numeric inputs only ( validation ). Similiarly buttons with obvious functions.

I am not looking for code but how to abstract UI from Presentation layer / code. In future if I change this form with a web form I have to do minimal changes.

Any links to articles are also appreciated.

Thanks a ton.

+ Navdeep

 
Old July 19th, 2007, 02:41 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Imar has a series of articles on N-Layer design. The user interface part of it is ASP.NET, but simply by the nature of your question, the non-UI parts (business and data layer) should apply to your question. Just instead of a web application, you can create a win forms app.

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416

-Peter
 
Old July 19th, 2007, 08:37 PM
Authorized User
 
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 Imar has a series of articles on N-Layer design. The user interface part of it is ASP.NET, but simply by the nature of your question, the non-UI parts (business and data layer) should apply to your question. Just instead of a web application, you can create a win forms app.

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416

-Peter
Hi Peter,

I am aware of Imar's article. Its a well written article using dumb classes but it does not throw much light on UI abstraction or I am missing something.

Navdeep

 
Old July 20th, 2007, 08:00 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Layer abstraction (or more appropriately 'separation') is the whole point of the article. He creates a business object/class layer (BOL), data access layer (DAL), a business logic layer (BLL) and they the UI layer (the web app itself). He could take out the web UI and replace it with a winforms UI and not have to change any of the underlying layers.

Also, just a word of advice, unless you need to reference a specific part of a previous post, quoting entire posts just clutters up the thread.

-Peter
 
Old July 20th, 2007, 08:05 AM
Authorized User
 
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter,

I understand it won't affect other layers but I am interested in approach at UI layer. How can we abstract UI so that, for eg. code for buttons (like add, modify, delete), Loading data into combo boxes/list boxes/DataGrid views can easily handled if I change from webform to winform or vice versa.

Thanks,
Navdeep

 
Old July 20th, 2007, 08:27 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

you can only abstract so much. If you have a business layer method that gives you a list of X and you need to connect that list to a dropdownlist, the code for that in a web form is going to be different than it will for a win form because those controls are totally different animals.

You reach a point where you need to build glue code to stick together your process with the interface.

More importantly, there is a huge difference between building a statefull desktop application and a stateless web application so there will be lots of difference in the way you glue the UI to the business layer.

Perhaps something you could look into is the MVC architectural pattern. This is a pattern in which you could abstract the control of the application into a class. You wire the UI elements to the controller to "view" the business model and to give the controller actions/events to do business processes. Perhaps this will provide the level of abstraction you are looking for.

-Peter
 
Old July 20th, 2007, 09:15 AM
Authorized User
 
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter,

I agree with you that there is a limit to abstraction.
May be I should look deep into MVC. Any other reading you would like to suggest.
Actually all these question are source to clear my basics while designing.
We get lot of stuff on internet providing wider prospects but not smaller details

Navdeep


 
Old July 25th, 2007, 06:51 AM
Authorized User
 
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if anyone can throw some light on MVC pattern ( desktop ) or provide some good links.

Thanks.


 
Old July 25th, 2007, 08:08 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I provided a link 1 post back:

http://en.wikipedia.org/wiki/Model_view_controller

-Peter
 
Old July 25th, 2007, 08:40 AM
Authorized User
 
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes Peter, but I am looking something on the lines of Imar's article
( http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416 ). Somewhat elaborative.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Handle error from database layer to applican layer khatu_jec ASP.NET 2.0 Basics 1 November 9th, 2008 03:51 PM
Database abstraction layer - OOP style w. paginati raul.ionescu PHP Databases 4 May 26th, 2006 03:19 PM
Data Abstraction Layer kcraft Pro PHP 6 March 18th, 2006 04:29 PM
Database Abstraction Layer browngb BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 4 April 30th, 2005 03:34 PM
What is abstraction...? arshad mahmood C++ Programming 2 June 30th, 2004 01:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.