 |
| 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
|
|
|
|

July 19th, 2007, 07:50 AM
|
|
Authorized User
|
|
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 19th, 2007, 02:41 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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
|
|

July 19th, 2007, 08:37 PM
|
|
Authorized User
|
|
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 20th, 2007, 08:00 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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
|
|

July 20th, 2007, 08:05 AM
|
|
Authorized User
|
|
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 20th, 2007, 08:27 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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
|
|

July 20th, 2007, 09:15 AM
|
|
Authorized User
|
|
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

July 25th, 2007, 06:51 AM
|
|
Authorized User
|
|
Join Date: Apr 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
if anyone can throw some light on MVC pattern ( desktop ) or provide some good links.
Thanks.
|
|

July 25th, 2007, 08:08 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
|
|
 |