Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
4.60/5 (3 votes)
See more:
Hello

i am beginner in programming and i need some help
i read in a website that i should separate coding from my interface form, and the best way for that using Interface

my question is that true, and if yes, can you help by some example ?

and thank you
Posted
Updated 2-Jun-13 3:43am
v2
Comments
Sergey Alexandrovich Kryukov 2-Jun-13 12:36pm    
This is a very reasonable question for a beginner, my 5.
—SA
Nepali Sagun 3-Jun-13 0:35am    
Try search on google about MVC

Separating? Good idea. Separation of the UI is more important than other parts of separation, in part due to social/market reasons: the are too many different UI systems and libraries, and they change faster then other parts of the software, as well as requirements, so you need to be able to quickly adopt them.

To start with, I suggest you learn and analyze applicability of the following architectural patterns (http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)[^]):

MVVM — Model View View Model,
http://en.wikipedia.org/wiki/Model_View_ViewModel[^],

MVC — Model-View-Controller,
http://en.wikipedia.org/wiki/Model-view-controller[^]),

MVA — Model-View-Adapter,
http://en.wikipedia.org/wiki/Model–view–adapter[^],

MVP — Model-View-Presenter,
http://en.wikipedia.org/wiki/Model-view-presenter[^].
Pay attention for the motivation of those architectures. If you understand it, you will be able to properly approach the design for a particular application.

—SA
 
Share this answer
 
Comments
Espen Harlinn 2-Jun-13 20:35pm    
Good background material :-D
Sergey Alexandrovich Kryukov 2-Jun-13 20:43pm    
Thank you, Espen.
—SA
Have a look at the asnwer I previously made here: decoupling user interface[^]

That, together with this article: A Detailed Data Binding Tutorial[^] - should help you get started.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 11-Jun-13 19:42pm    
Nice links, a 5.
—SA
Espen Harlinn 12-Jun-13 15:42pm    
Thank you, Sergey :-D
You should look for online articles for stuff like this. In general, your best bet is to buy a book and work through it, not try to follow random advice.

Your code should indeed be seperate from your interface if at all possible. The best way to do this, is to have a dll that contains the logic of your project, and have your user interface just handle events on controls and then pass values through to the dll. That way, if you ever want to change your interface, you just write a new interface that calls the same dll. However, if you're a beginner, you shouldn't be worried about such things. You shouldn't even worry about forms, although you can use forms to drive your code if you like, you should work on learning C# or VB.NET as a language, not worried about the niceties of design or the vagaries of UI development.
 
Share this answer
 
Comments
Ahmad Halabi 2-Jun-13 9:53am    
i am not worry about forms, but i want to build good application, and to do that i want to separate my code from interface,that simple
Christian Graus 2-Jun-13 9:56am    
I guess it depends on what you mean by 'beginner', but if you're new to C#, you can't write good applications yet. So, focus on learning the language, is my advice. It's good to know these things, but there's no need to learn everything at once, that's why people who do paid work as beginners, never become good programmers, they never have a chance to learn.
Ahmad Halabi 2-Jun-13 10:01am    
i am working programming,and i have many applications, i am not totally beginner.
but i want to go further,for that i ask my question
Christian Graus 2-Jun-13 10:23am    
OK. I didn't mean to be rude, when you say 'I am a beginner' you should not be surprised that people assume you're a beginner :-) Well, in that case, yes, put your business logic in a dll, and then try to only use the UI layer for UI code.
Ahmad Halabi 2-Jun-13 10:25am    
don't worry about that,this is my mistake.
Layered Application should be your term.

You can find on the MSDN this Guide "MS Application Architecture Guide 2nd Edition [^]"

It discuss the architecture & design principles and patterns of the .NET Framework also common Application Design.

Also you can download it as PDF.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900