separation-of-concerns

When and how should I use enumeration classes rather than enums?

筅森魡賤 提交于 2021-02-18 05:22:30
问题 A developer at work recently started using a class pattern instead of enums in places where enums would usually fit. Instead, he uses something similar to that below: internal class Suit { public static readonly Suit Hearts = new Suit(); public static readonly Suit Diamonds = new Suit(); public static readonly Suit Spades = new Suit(); public static readonly Suit Clubs = new Suit(); public static readonly Suit Joker = new Suit(); private static Suit() { } public static bool IsMatch(Suit lhs,

When and how should I use enumeration classes rather than enums?

久未见 提交于 2021-02-18 05:22:22
问题 A developer at work recently started using a class pattern instead of enums in places where enums would usually fit. Instead, he uses something similar to that below: internal class Suit { public static readonly Suit Hearts = new Suit(); public static readonly Suit Diamonds = new Suit(); public static readonly Suit Spades = new Suit(); public static readonly Suit Clubs = new Suit(); public static readonly Suit Joker = new Suit(); private static Suit() { } public static bool IsMatch(Suit lhs,

redux-thunk and in app architecture - want to render only views in views and dispatch GET actions in separate component

纵然是瞬间 提交于 2020-07-09 12:48:12
问题 I am using react-redux and redux-thunk in my application and there are two things I am trying to do: I want to be able to share the results of a GET request in two components. I know you can do this by connecting the two components to the store, but I want to make it so if the user lands on X page, then Y page cannot make the same GET request again (these two components are Thumbnail and Carousel). In other words, the GET request should be made once (not 100% sure what best practice is here

MVC - is it just a 3 tier model?

不问归期 提交于 2020-02-23 13:10:41
问题 Just began researching mvc, and am not sure I grasp it yet. From what I gather it seems like an implementation of a 3 tier solution ie Model corresponds to DAL, Controller to business logic layer, and View as Presentation layer. Am I way off base here? 回答1: I caution against treating the Model as simply a data access layer. That's oversimplifying, and it results in you putting too much code into the Controller Layer. It's better if you put more of that code in the Model, and make database

MVC - is it just a 3 tier model?

陌路散爱 提交于 2020-02-23 13:06:47
问题 Just began researching mvc, and am not sure I grasp it yet. From what I gather it seems like an implementation of a 3 tier solution ie Model corresponds to DAL, Controller to business logic layer, and View as Presentation layer. Am I way off base here? 回答1: I caution against treating the Model as simply a data access layer. That's oversimplifying, and it results in you putting too much code into the Controller Layer. It's better if you put more of that code in the Model, and make database

MVC - is it just a 3 tier model?

白昼怎懂夜的黑 提交于 2020-02-23 13:06:23
问题 Just began researching mvc, and am not sure I grasp it yet. From what I gather it seems like an implementation of a 3 tier solution ie Model corresponds to DAL, Controller to business logic layer, and View as Presentation layer. Am I way off base here? 回答1: I caution against treating the Model as simply a data access layer. That's oversimplifying, and it results in you putting too much code into the Controller Layer. It's better if you put more of that code in the Model, and make database

ASP.NET: Code behind or no code behind?

六月ゝ 毕业季﹏ 提交于 2020-01-24 05:03:42
问题 Why would anyone want to not use a code behind file so that server sided code is separated from markup? Wasn't that supposed to be one of the advantages of .NET over classic ASP? Personally, I think mixing code with markup makes the code a lot harder to understand. I hate to see those darn <% %> (server sided blocks) inter-spliced in with markup, yuck. I would expect that this is in ASP.NET solely for backward compatibility with Classic ASP but I see examples from MS all the time that include

Generating Interfaces from entity framework database first auto-generated code

一曲冷凌霜 提交于 2020-01-20 04:35:05
问题 I am using MVC3, C# 4.0 and Entity Framework in Visual Studio 2010. I am generating my edmx and Designed.cs files from a database. I am then generating interfaces from the entities in the Designer.cs file as part of my nLayer structure. The original code is public partial class DataEntrySummary : EntityObject which then becomes public partial class DataEntrySummary : EntityObject, Mb.Interface.IDataEntrySummary My concern is that when the database changes (and it will) and I regenerate the

ASP.NET MVC - Solution Layout Suggestions

半腔热情 提交于 2020-01-12 05:37:07
问题 I have been working with ASP.NET MVC for a couple of months now and I'm still not happy with the layout of my project's solution. I am trying to construct a mid-sized website CMS that is as portable and reusable as possible and there are some obvious problems in the design of it. I am looking for some advice regarding how I should structure my solution in consideration of separation of concerns. I've found a similar question here, but it doesn't really target some of the issues I am facing.

EmberJS: Good separation of concerns for Models, Stores, Controllers, Views in a rather complex application?

余生颓废 提交于 2020-01-10 14:18:25
问题 I'm doing a fairly complex emberjs application, and tying it to a backend of APIs. The API calls are not usually tied to any particular model, but may return objects of various types in different sections of the response, e.g. a call to Events API would return events, but also return media assets and individuals involved in those events. I've just started with the project, and I'd like to get some expert guidance on how best to separate concerns to have a clean maintainable code base. The way