separation-of-concerns

How do I separate my entities from database model?

I need some help to organize my data model well. I am writing an app which will be a simple notebook. I use a three-tier architecture = business-logic, data-logic, database access. I`d like to use system of tags so it will be easier to search info in the app. Here are few questions - due to separation of concerns, classes of entities ...

ASP.NET MVC - Solution Layout Suggestions

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

[ASP.NET MVC] Who's responsibility is it to encode a string?

Hi, Who's responsibility is it to encode a string, the model or the view? I've a string from a database, it's come from the user - I want to keep as a much information as possible in the database, so I'm saving the input verbatim. When I come to display the string, should I be encoding it when I populate the view model, or should the ...

Separation of concerns versus performance?

I have an ASP.NET MVC site and I am trying to figure out separation of controller and model (repository) and HTML helper functionality. The goal is to query a database table of photo albums information and display it grouped by year. The steps are: Query database and return datatable of the database information. Convert Datatable to ...

What's the best way to separate concerns for this code?

In a previous question one of the comments from Dr. Herbie on the accepted answer was that my method was performing two responsibilities..that of changing data and saving data. What I'm trying to figure out is the best way to separate these concerns in my situation. Carrying on with my example of having a Policy object which is retriev...

Domain Driven Design Layout Question

Hi Im new to the DDD thing. I have a PROFILE class and a PROFILE REPOSITORY CLASS. The PROFILE class contains the following fields -> Id, Description, ImageFilePath So when I add a new Profile, I upload then image to the server and store the path to it in my db. When I delete the profile, the image should be removed from my file syste...

Where to put functions that help me execute controller tasks?

I'm currently working on an ASP.net MVC web site project. I've put all database related stuff in my model, such as queries and update/delete/save functions. I also created a couple of controllers that execute the logic. I added a Helpers namespace and inside that namespace there are a few classes that contain logic for pagination, inte...

Dynamic animations, Commands and separation of concerns

Scenario: I have a (numeric) textbox, a button, and a label. When the button is clicked I'd like the label to "animate" to the numeric value in the textbox (like a spinning dial) Given: a) that animations in storyboards cannot have databindings (because they are not FrameworkElements) b) the lack of triggers in Silverlight What is the...

Validation in the business logic - ASP.NET Web Forms

In reading up on ASP.NET MVC I came across some wonderful examples of validation where the business rules were associated with the model and the UI merely displayed the set of errors and flagged the form elements associated with invalid input. I think it makes fantastic sense to keep this logic in a single place rather than have every f...

MVC... how and why, and what other good options are there (PHP)?

All the examples I've seen of what and how MVC SHOULD be have used classes as the models, classes as the controller, and HTML templates as the view. And all of them consisted of one index.php script and different requests in the url to run the entire site. So they've all been something like... MODEL class User{ function getUser($u...

How have you combined the advantages of the direct View-to-Model approach and MVVM in your WPF projects?

In our application we have many Model objects that have hundreds of properties. For every property on the model: public string SubscriptionKind { get; set; } ...100x... we had to make an INotifyPropertyChanged-enabled property on the ViewModel: #region ViewModelProperty: SubscriptionKind private int _subscriptionKind; public int Sub...

Where should the viewModel be created?

Hi, I have seen a few examples where the viewModel (in Silverlight apps) is in the UserControl.Resources XAML section of a View. I read that for using Blend, this is a good place to have it (as it gives the ability to see sample data in Blend). However, is this the best place to have the viewModel? I read that the "view has to push s...

Architecture Concerns

My domain classes and persistance logic (Hibernate) are in one project called model. This jar is included within all of my apps. Packaged com.company.model & com.company.persistance Another Utils.jar - contains DateTime, String, Thread, etc general helper classes. This again is included within all of my apps. Packaged com.company.utils ...

Ruby on Rails with Repository Pattern?

After working with ASP.Net MVC, it has me thinking about Rails. I worked with Rails prior, but am a little rusty. ASP.Net MVC tutorials recomment hiding data layer implementation with the repository pattern. This allows easiesr Dependency Injection for Unit Testing, and nice decoupling of the controller from the model implementation. ...

Php: functional style, light-weight alternatives to the separation of concerns in OO MVC patterns?

The problem: I have a legacy php app that is coded in no particular style (some OO, function libraries, some templates, no templates), which I am slowly rewriting, cleaning up, and adding to. When I introduced templates to the system, it was immediately evident that that would really clean up and simplify the code a lot because of th...

Difference between Single Responsibility Principle and Separation of Concerns

What is the difference between Single Responsibility Principle and Separation of Concerns? ...

MVC - is it just a 3 tier model?

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

RSpec in Rails: How to skip a before_filter?

Hello everyone, I am trying to test my controller and maintain separation of concerns. The first concern is "Who is able to execute which action?" I am using authlogic for authentication and be9's acl9 for authorization. But this should not matter, all my authorization concerns are handled in a before_filter. I am testing such a befor...

Separation of Concerns the Repository Pattern & Entity Framework 3.5

Hi, I'm trying to be a better developer... What I'm working with: .Net MVC Framework 1.0 Entity Framework 3.5 I've been doing some reading and I think what i want to do is: Create a repository for each aggregate in the domain. An Order repository for example will manage an Order's OrderItems. Create a service layer to handle busi...

Refactoring a legacy WebForms app to better separation of concerns.

i.e. Is MVP still the next best choice when MVC is not an option? I thought I'd ask this here as I'm sure there are others like me who don't have the luxury of being on a green-field project and want to refactor a webforms UI to better separation of presentation from business objects... I'm working on a legacy application tasked with a...