Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 19th, 2007, 07:50 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old July 19th, 2007, 02:41 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #3 (permalink)  
Old July 19th, 2007, 08:37 PM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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

Reply With Quote
  #4 (permalink)  
Old July 20th, 2007, 08:00 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #5 (permalink)  
Old July 20th, 2007, 08:05 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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

Reply With Quote
  #6 (permalink)  
Old July 20th, 2007, 08:27 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #7 (permalink)  
Old July 20th, 2007, 09:15 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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


Reply With Quote
  #8 (permalink)  
Old July 25th, 2007, 06:51 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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.


Reply With Quote
  #9 (permalink)  
Old July 25th, 2007, 08:08 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #10 (permalink)  
Old July 25th, 2007, 08:40 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:27 AM.


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