I apologize in advance if my question is vague and / or not constructed well. I am just getting started exploring ASP.NET Core MVC and Razor Pages (MVVM) and I am confused as to what is the difference between a model and a service. What questions should I ask myself before deciding if I need a new model or a new service. Any help would be greatly appreciated.
I am answering my own question because after posting this question I found a great explanation of what the differences are between a model and a service by reading the MVC Basics chapter in this great book - https://nbarbettini.gitbooks.io/little-asp-net-core-book/content/chapters/mvc-basics/
Related
Basically question is not about Codeigniter but about MVC architecture.
When I joined company my senior told me to use controller and views only its sufficient.Since I was new to Codeigniter, i did as he said.
Now i understand that company is small scale, it requires fast projects development.
But now he has gone, I want to learn MVC architecture, I have basic question whats the benefit of using MVC instead of using only view and controller.
FYI: My senior did know about MVC, but he just didn't pass on.
MVC is a great structure helping programmer to make large code without much messing up. It can be upgraded in the future by other programmers. It can be more secure as you don't use same code again and again by help of models.
When you learn MVC then you can learn faster how to use frameworks. Yeah controller view structure is a good point to start but you'll love mvc when you learn it and see it can help you a lot in speed.
I'm starting with web development and Spring MVC.
I currently have a good knowledge about create a simple CRUD.
But now, I need to do something more advanced.
I need to create a CRUD to an entity with details, like a Invoice with items/products.
What is the best way to manage this CRUD without persist the Invoice with no items?
How can I persist the entity only when the user ends to enter the fully data (invoice + items) ?
How will be the Controller to do this?
I already found this Explain this Spring MVC Controller behavior, but it doesn't clarify my questions.
Thanks!
Beto, have a look at the spring.io/guides page for clear examples of how to do this.
Especially review the 3 big tutorials at bottom of page (best one is http://spring.io/guides/tutorials/web/).
That will give you good answers and explanations behind them.
I have worked with MVC/MVC2 and built some web applications based on Nerddinner. Those applications only use webform and entity framework. I would like to start to use more Ajax and looked for some tutroials but they are a bit out of day. Does any one have found some recent practices/examples/tutorials/ of MVC3 with more integration of Ajax?
Thank you very much!
I recommend book 'Pro ASP.NET MVC Framework' by Steven Sanderson - it have examples of real applications and problems in development in begin, if you want - you can go in more detail chapters with description of all mechanisms, ajax and jquery basics included too. Book available for MVC2. To learn more about mvc 3 - read Scott Gu blog.
For ajax read JQuery tutorial:
Can anyone share links of production code to real-word ASP.NET MVC applications. It's interesting to see on production code and implementation staff!
Many thanks.
I found the best one for me its Kigg starter kit.
..And of course the almighty NerdDinner (which is not really real website, but rather an Implementation of the well known tutorial).
Umbarco CMS is an example of an open source ASP.NET MVC built CMS. While the Music Store is not a real world application it is close enough and a good from learning perspective.
What about http://www.stackoverflow.com? :)
This one: http://getrocketship.com/ It's a CMS service for small businesses.
And... http://www.lizzabethbrown.com/
I’m about to write quite a big web site that will basically be a forum, divided to (many) different subjects and allow users’ score.
I’ll be using MVC, so I (“naively”) asked this question about how to partition the Model portion of MVC, which is likely to be very large.
Two things I realized from the answers I got:
I really don’t know much about designing software.
There are many ways to implement MVC
So I have now two questions:
(That’s a bit theoretical-) Would
you say designing a software is
completely deterministic i.e.- For a
specific set of requirements there
is one best design? If not- why?
What are the common components
(necessary and optional) of MVC that
I should consider in writing my site
(resources for beginners would be
great)?
Although Java/JSP/Servlet targeted, you may get some useful insights out of this answer. It describes the common patterns to be used in MVC and the approach how to fit them all together. Here's a summary:
Front Controller pattern (Mediator pattern) - the controller
Strategy pattern - the business actions
Abstract factory pattern - to let controller obtain the desired business action.
Facade pattern - to abstract the raw HTTP details away.
State pattern - to introduce a lifecycle which abstracts gathering of request parameters, validation, conversion, updating model values, etc away.
Composite pattern - to create an advanced component tree for the view.
For ASP.Net MVC, a good entry level, free tutorial is the 'MVC 2 Music Store' by Jon Galloway. You can find it here. Note that the current version of ASP.Net MVC is MVC 2.
A more thorough tutorial is the Nerd Dinner tutorial. However the creators are still in the process of updating it to MVC 2. You can check for updates and downloads here.
I would recommend using resources for MVC 2 as there are some significant improvements over the first version. Also MVC 3 is on the horizon and you want to hit the ground running.
I would also recommend keeping an eye on MVC 3 improvements if you're serious about getting up to speed in this space. A good blog to subscribe to is Phil Haack's Haacked. Phil is the project manager for MVC at Microsoft.
In terms of textbooks, the gold standard is Steven Sanderson's 'Pro ASP.Net MVC 2 Framework'. The first review on Amazon is from Scott Guthrie, a Microsoft VP, who raves about the book. He also has a competing book of his own. You can get the ebook from Apress here. Do a google search for Apress promo codes and you may save a few dollars.
Good luck.
Software is definitely not deterministic. Theories in programming are constantly developing and improving, which is what makes the field such a fast-paced and exciting place to work. Also, what may seem like the best approach to a software problem right now could be obsolete in a matter of months by a newer, improved technology.