It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
This is more of a design question than a problem I'm trying to solve. I'm posting this here to get other people's opinion on the Design of the ASP.NET MVC framework.
To start with, I'll state the issues I have with the framework:
Html and code in views
Method names such as View() where one can't discern by looking at the name what it is doing and that it actually returns something
Too many overloaded methods that accept completely different parameters (like View())
Html Helpers - I don't believe Extension method were introduced for this use
ViewData
I'm not explaining in detail the issues I have have with the above in the hopes that there are others who see the problems I see. To be honest, I haven't anyone bring up these issues so I'm beginning to wonder if I'm alone :).
Someone somewhere must see/feel these issues when building large applications no?
Someone somewhere must see/feel these issues when building large applications no?
No, not really. At least - I don't call those as an issues.
Html and code in views
Simple if or foreach won't cut Your head off. Way much easier than this:
<asp:Repeater ID="uberRepeater" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate></ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
If You put there complex things, it's not fault of framework, it's fault of developer and his misunderstanding of mvc pattern.
Method names such as View() where one can't discern by looking at the name what it is doing and that it actually returns something
Makes perfect sense to me:
It might not, if developer is not familiar with mvc pattern and conventions asp.net mvc follows.
Too many overloaded methods that accept completely different parameters (like View())
It might seem like a problem. But with c# 4.0, if it bothers You, You can use named parameters to keep code readable.
Html Helpers - I don't believe Extension method were introduced for this use
Extension methods indeed weren't introduced for html helpers. They were introduced to hook additionally logic to existing classes. It was must have feature in order to implement LINQ successfully.
Can't see that as an issue though.
ViewData
Emmm.... huh?
But that does not mean issues don't exist. They do exist.
E.g. - huge part of Mvc V3 is about proper support for dependency injection.
ASP.NET MVC Framework is powerfull. You have a complete control of HTML/client scripting output.
If you use it the right way and with a good infrastructure like SharpArchitecture you can achieve way more in user experience compared to any other framework (except silverlight).
In my experience, with the framework 4, asp.net mvc, a nice ORM (like hibernate), a DDD architecture, good patterns and an IoC, you save 30% of your project time and spend it on user experience.
Side note : SharpArchitecture is great architecture example, in fact, it is perfectible, but even out of the box, it can handle any size of project. With my experience since MVC1, I just can't imagine any large project without ASP.NET MVC, and it is more and more powerfull as the community is so creative and skillfull.
By way of answering this, I'd direct you to a book that does quite a good job it: Professional ASP.NET Design Patterns by Scott Millett. The book takes the most popular patterns, including those documented by the "Gang of Four" and the enterprise patterns of Martin Fowler, and discusses them in terms of all ASP.NET app types, including MVC.
If he can't convince you that MVC offers advantages in partitioning user display, business logic, and data store, probably no one will
#Buggieboy, I'm not questioning the MVC design pattern or the virtues thereof. My question is really related to the implementation/design of the ASP.NET MVC framework.
I guess I'm not talking to an objective crowd. Or as jfar says, I'm probably alone.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
What are the limitations of using ApplicationBlocks (An Introduction and Overview of the Microsoft Application Blocks) for ASP.NET/VB.NET applications? I have found lots of websites that talk about the benefits e.g. divorcing the data tier from the web tier, but I cannot find a web page that discusses the limitations.
I don't think you can really get a plain list of disadvantages. Microsoft Enterprise Library is a good library, well documented, rich and with tons of features.
You should change your question to "When I do not need to use it?". Of course this question should be repeated for each block. I'll try to summarize a little bit.
For every block you should consider to do not use the library when you do not need its complexity. Features doesn't come without a cost and the most obvious one is complexity (first in deploying and configuration). If you have to document and your user have to change application's configuration you may need to provide some tool or a lot of documentation. Complexity can be hidden in code too, even if EL designers tried to make everything easy it can't be as easy as a raw solution.
Second important disadvantage is obviously the speed. Layers of abstraction can't be for free and you'll pay a speed cost for that. In some cases you may do not care (simple Logging, for example) but it may be a problem in other cases (so again the answer is "it depends"). Think, for example, to Unity Application Block: you'll get all the power of injection but you'll pay a great cost for this.
So when you should use it? In my opinion a big goal of this library is that you do not need to use it all together. You can pick blocks you need when you need them. It's very common, for example, to use Logging and Exception Handling but you may not need Unity in whole your life. The Data Access Application Block is a very thin layer above ADO, it simplifies many common tasks but you do not gain the level of abstraction you have, for example, with LINQ to SQL or Entities (hey, do not forget they have very different purposes) and you should consider to use it only if everything else can't suit what you need.
So, finally, in my opinion you should consider each block and use it only and only if you really need all the complexity that comes with an Enterprise level library. It's not designed for small single user applications (even if sometimes you may find that some Application Blocks may be great for a specific task). Its drawbacks aren't little: complexity and speed can't be ignored (both for short term solution and long term maintenance plans). Moreover if you really need all its power you'll find it's not as easy as a "ready-to-go" solution, to have the control you'll need to write more code.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am working on big application build using ASP.NET which was started 1.5 years back. The Site uses 3rd party telerik RadControls for UI. The problem with the website is it uses outdated stuffs like DataSets and all with no proper architecture. I have done some research and found some new technologies like ADO.NET Entity Framework out here. I want to know that is it worth investing to learn and migrate my site to ADO.NET Entity Framework at this stage.
Additionally are there any good technologies or tools (that can be used in ASP.NET) out there in the market which can be used to make the development life easier and be upto date with latest technologies.
ALL SUGGESTIONS WOULD BE REALLY PRECIOUS.
THANKS IN ADVANCE.
There is no real answer to this question.
Entity Framework is very useful. As is ASP.NET MVC. I guess it depends on what your metrics are to determine if it is worth it.
What are the goals for migration? Are you looking for a more testable website? Its unlikely to be worth migrating a large website just for the sake of it, so determining the measure of a successful migration may naturally lead you to a decision.
Its also worth noting that ASP.NET Web forms are still a viable option. If you want rapid development, which uses data grids and such like, then forms might be your best option. You could look to move to MVC, which will allow you to enforce a cleaner separation of concerns. Its horses for courses. A quick Google and you will find plenty of forms vs mvc pros and cons.
You could also consider a piece meal migration. For example, you could build and Entity Framework model of your database and start to use it one page at a time. Slowly removing ADO, but maintaining a working site. You can also use Forms, and MVC together in one site. So you don't have to do a complete migration in one go.
Food for thought, good luck.
The problem with questions like this is that the answer is always "it depends" however, having recently done some work with Entity Framework and MVC3 I will say that it is a very good platform to work with- MVC3 is logical and easy to work with and EF does a bunch of lifting for you.
Ultimately it depends how far along the project is and how much of it is complete in the way that it currently works. For example, if you have a decently designed database and a bunch of half finished pages then making the switch is probably not going to be a lot harder than finishing up with what you have, but don't underestimate the sheer scale of a rewrite when combined with the need to learn to use several new technologies even if the technologies themselves are fairly quick to learn. On any project of significant size you will run into quirks of the platform you are working with and find yourself completely stumped at least a few times.
On the other hand, the idea that something being outdated is a reason to replace working code is one that tends to result in expensive, embarassing project overruns. If it's most of the way finished and you are just lined up to do finishing touches then make the best of what you have and remember that Shipping Is A Feature. Similarly the size of the project and how business critical it is have a big impact. If this is a minor internal project maybe you have more room for a rewrite, if it is responsible for the company's revenue stream you need to get this version out fast and then think about refactoring later.
Either way, you need to talk this over with other stakeholders before throwing yourself into a potentially high-risk endeavour.
I have generally used Obout controls as a third party toolkit. I wish I could help more about switching to ADO.
Although, I don't suppose learning it would hurt, even if you don't end up using it for this particular project.
Good luck!
It all depends... Can you afford to migrate? Is your current framework not what you need it to be?
If you want to throw away 1.5 years of development just because something new has been released, maybe you should think twice. You surely know there's another version of .NET framework coming and who knows what will it bring? Does it mean that you will migrate again next year or so?
However, if you have designed your website the way it can be easily done, by all means, switch to new technologies and migrate how much you want and how you feel comfortable.
Whether or not it is worth converting your application to EF is a decision only you can make. You know the existing code base better than any of us. Evaluate how much code you would need to change, how much time you have, how much re-testing you would need to do, and so on. Depending on what you find, that will tell you whether you should upgrade or not.
I would love to upgrade every asp.net 2.0 app I find to MVC3 with EF, but usually time and resources only permit that we fix what is broken and move on the next project.
That said, EF is a wonderful advancement in data access. If it isn't worth doing on this project, it is definitely worth learning for the next one.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have a SQL Server Database. I would really like to quickly generate a middle-tier and a front-end from this database. I would prefer something that generates web forms if possible. I understand that no code-generator will be phenomenal. However, I just want something to get me up and running quickly that I can then customize as needed.
Can anybody recommend any code-generators?
Thank you!
There is ASP.NET Dynamic Data. If you can live with MVC, EF4 and MVC3 would be my choice above Dynamic Data.
I have a friend who is releasing a code generator very soon. You provide xslts based on the data model to create classes at any layer you want. Here is the site: Code Generator
Be sure to check out the sample project.
I have successfully used Code Smith (commercial product).
It is a popular templating engine and you will find many templates on the Internet for all kinds of architecture / data access frameworks.
I have also used plain T4 templates that you can use within Visual Studio without having to install anything (although I would recommend using something like Tangible T4 Editor to get color syntax).
If you have Visual Studio (2005 or greater) you might consider T4 templates. There's a good introductory video at DNRTV. T4 is a little known code generation facility that comes with all editions of Visual Studio (even Express I believe).
On some of my projects I have used MyGeneration, a free and open source code generator. This is also a good option.
You can use Entity Framework to generate objects from database schema, and then use the MVC Framework to generate stronly-typed views that use the said generated objects as models.
Here's a good post on that - http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx
I'd give SubSonic a try, especially the ActiveRecord version. It basically will generate an interface(with Linq) to an existing SQL Server database, For taking it to forms, I suspect you won't find a very good solution because there are so many implementation details that are commonly placed in webforms, such as XSS prevention, how things should look and behave, etc.
I suggest a tool that I have use for really rapid application development, is the asp.net maker. http://www.hkvstore.com/aspnetmaker/
I have used it for low budget projects, or where I need for a dirty quick solution, until the final gets ready. What I have did is that I create solution for the easy tables, and make code for the one that need too many thinks to be fix.
The pros is that have many future, its very easy and you do not need to know almost anything to make the interface, create from the database, all the environment that can edit it, have the opportunity to make a lot of adjustments, and what you get is a better page than the Scaffold can product.
The negative is that you stick with what this tool product, and you can not update the pages by your self to make some small changes, because is too complicates one, second if anything change, the pages changes, and even if you rename it and not overwrite it, it maybe not working.
You need to test it and see by your self.
Redbrook Technology has a great ASP.NET forms and code generator. It's also very cheap. Give it a try - ASP.NET Generator
The DevExpress XAF does much basis work for you, it creates a database based on your business objects, and dynamically generates a UI based on these, with basic functions like add, delete, sort etc. already present.
This leaves me wondering how to go about properly designing and modelling an application built on this framework. I could only model my business objects, or I could identify functions provided by the framework and include them in a details model down to sequence diagram level, but so much is being done by 'external' calls that I feel I would be wasting valuable time.
I am hoping someone with experience modelling application designs for this specific framework can give me some advice on what areas I should focus on.
As for DC, as Leon mentioned above, it has many benefits compared to the regular persistent classes. If all goes according to plan, we will release the Domain Components technology in the near future, and resolve all the remaining issues with it.
If you feel that it is hard to learn, please let us know the most difficult parts you experienced. We will be glad to review them and possibly make the things easier for you and other users.
P.S.
I apologize for the delay in responding; I was on sick leave. You will receive more timely responses if you post your questions in the DevExpress Support Center.
#ProfK:
Am I correct that you are looking for something like visual designer for your business models?
If so, then I am afraid that XPO (XAF) does not currently provide such a functionality. However, you can use free third-party tools for modeling, such as Liekhus ADO.NET Entity Data Model XAF Extensions
I hope you find this information helpful.
I'm using XAF for almost two years now and I'm very happy with it. Developing an app is very quick, nice architecture, both Win and Web the same time and great UI. As with all frameworks, it has a learning curve, but if your already familiar with DevExpress controls that it's not very hard.
As Dennis mentioned, most behaviour can be overriden or extended. Regarding your modelling question, if think an important choice you have to make is whether or not you will use their Domain Components technology. Basically they have 2 ways: the old fashion way by inheriting from the XAF or XPO base classes or by using DC. DC allows a clean separation in modules and allows multiple inheritance. They can do that by generating classes runtime, but it still has some issues.
And the framework comes with a Business Class Library, a set of common classes which may be useful.
When I get stuck or cannot find the answer myself, I always use their fantastic Support Center. Most issues I ran into were already asked and answer on that site.
Briefly, each XAF application consists of Modules. There can be standard (system) and extra (user-defined) modules. Each Module can contain business objects, so-called Application Model customizations, Editors, Controllers, and Actions to provide additional business logic, customize UI and provide interaction between framework parts. You can model and customize your application on each level listed above, including but not limited by the underlying framework's metadata and data store ones. You can find more information about the framework's architecture here:
http://documentation.devexpress.com/#Xaf/CustomDocument2559
I should emphasize that it is possible to override behavior of almost every part of the framework. For instance, create your own editors for detail and list forms, override certain standard controllers, etc.
If you experience any further difficulties with our framework, feel free to contact us through our Support Center. We will be always glad to not only answer you questions, but advice a certain technical or design solution, provide some example code, etc.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I saw AsP.NET Design Patterns Here
how can i understand which Design Pattern is Appropriate for our Projects?
most of our projects are Office Automation Projects.
I Had Never Used Any ASP.NET Design pattern In my projects.
just i used microsoft nettiers
Thanks.
I dont think any one can tell you which design pattern would be the best for your project. Because each design pattern solves some particular problem. And, you just have to choose a design pattern depending on the problem you want to solve in your project. You can also use combinations of design patterns to solve some particular problems.
Design patterns are efficient solutions for commonly faced problems and are generally used so that you dont reinvent the wheel. As you say you dont know much about design patterns I would suggest you to pick up some book to learn about design patterns. Head first design patterns was the first book I read about design patterns.You can start with that book. It will help you understand a number of commonly used design patterns and which pattern to use and when.
The design patterns to be found on your linked page (i.e. Factory pattern, Observer pattern, Decorator pattern, etc.) have a very general purpose and are helpful to design specific tasks in any kind of application framework and programming language. Usually a large application won't follow only one of them but will contain a mix of several of these pattern. They are not specific to ASP.NET.
Perhaps you are looking more for a design pattern which helps to create a clear and maintainable structure of an application as a whole. For ASP.NET Webforms a widely used application pattern is the Model-View-Presenter or MVP pattern which helps you to seperate concerns (for instance separate business logic from UI/code-behind logic) and improves automated testability for Webforms applications.
You can read more about the MVP pattern in relation to ASP.NET Webforms here (a brief introduction which also explains the various flavors of the pattern (like Passive View and Supervising Controller)) and more in detail here. (Last but not least combining the terms "ASP.NET", "Webforms", "MVP" or similar in your favourite search engine will reveal a lot more resources.)
Edit: Just to add one link more I just discovered: http://webformsmvp.com seems to be a website which focusses exclusively on the MVP pattern in ASP.NET Webforms.
Maybe check out this website to get an idea of the patterns available and when to use them:
http://www.dofactory.com/Patterns/Patterns.aspx
But again as #Pavanred says, it really depends what you want to use them for.