The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
3answers
56 views

How to separate the logic of my application into a dependency when it is coupled to the structure of the data?

I am about to start prototyping a 'quiz'-like web application that tests test-scoring methodologies, and I have an interesting architectural question. Each quiz given to a user needs to use a set ...
1
vote
1answer
287 views

Pros and Cons of odd iframe 'architecture'

I'm in the process of experimenting with ways of breaking up a large (and growing project). Currently, we're working with a big Angular application with what will soon be a large number of components. ...
4
votes
1answer
122 views

Increase code duplication to simplify business rules in views

I am in the process of writing a Ruby on Rails web application for my university's department. For some of our resources in the web application, e.g. Project, are complex with their view layer logic: ...
2
votes
5answers
138 views

Database transaction and separation of concerns

Apllication structure: Business layer public interface IOrderDataService { void Save(Order order); } public interface IOrderLineDataService { void Save(OrderLine orderLine); } public ...
0
votes
4answers
84 views

Should database tables be separated by concern?

My question is related to when should a database table be broken into multiple tables with relations? However, I have a clearer one-to-one relationship than in that question. If I was designing the ...
0
votes
2answers
498 views

Single responsibility: how does this code cause problems?

Given the following interface interface Modem { public void Dial(string pno); public void Hangup(); public void Send(char c); public char Recv(); } Uncle Bob writes However, ...
1
vote
2answers
68 views

Separating save logic from WinForm to make it reusable

I have a Windows Form for creating configs. It has around 50 fields of data, which represent a group of entities, that I need to capture when the user presses the save button. Currently, on the press ...
0
votes
0answers
73 views

How to convince teammates to start separating database queries into one single layer

We are using ORM with bunch of database models and those ORM database queries (and models, of course) - are literally all over application from top to bottom. And when change in model structure ...
35
votes
5answers
7k views

Do stored procedures violate three-tier separation?

Some colleagues of mine have told me that having business logic in stored procedures in the database violates the three-tier separation architecture, since the database belongs to the data layer ...
1
vote
1answer
166 views

Should composition happen no matter what?

I feel like I should be able to register all my components into the application composition root container no matter what the current state of the environment is, even in the case environment lacks ...
3
votes
2answers
124 views

Proper design for models

I have a class called ReplaceRule this is used by 2 classes DocumentRuleViewModel and SectionRuleViewModel as a List<ReplaceRule> in both Question 1: In my database implementation I have 2 ...
1
vote
3answers
107 views

SOLID principles and generating many objects from a file

The "D" in SOLID stands for dependency inversion. If I have for example, a Blacksmith class that depends on Hammer, I should create my Hammer externally and pass it to Blacksmith, rather than having ...
0
votes
1answer
63 views

Should models be returning data directly to the client, or to the controller instead?

Disclaimer: This is my first time: using node, creating a REST API, and trying out MVC server side. (so, just statistically speaking, I'm probably doing something wrong ¯\_(ツ)_/¯) I'm working on ...
3
votes
3answers
96 views

Why do we separate Data Retrieval from View?

I am seeking a good argument for: Why is it NOT a good idea to embed data retrieval code in my view? Example <tr> <td>Product</td> <td><select name="product"> ...
0
votes
0answers
76 views

What benefits does React bring over Partial Views

Beside the performance optimizations that React brings to the table with the Virtual DOM : conceptually, in terms of end-software design, what does React brings to the table that partial views did not ...
0
votes
1answer
25 views

How to store the current version of an instance? Store reference to specific instance?

I'm working on a project with has different checklists (questions and answers) associated with an entity (Protocol). There is a business requirement to have these questions be altered in the future ...
3
votes
2answers
3k views

Domain Services vs. Factories vs. Aggregate Roots

After dealing with DDD for months now, I'm still confused about the general purposes of domain services, factories and aggregate roots in relation to each other, e.g. where they overlap in their ...
38
votes
12answers
3k views

Is there ever a reason to do all an object's work in a constructor?

Let me preface this by saying this is not my code nor my coworkers' code. Years ago when our company was smaller, we had some projects we needed done that we did not have the capacity for, so they ...
6
votes
4answers
340 views

Class design dilemma: Encapsulation vs Single Responsibility/Separation of Concerns

I'm working on a class that represents an object with multiple representations - one is an XML type representation used by an automatic ordering system, the other is a POJO-based representation used ...
0
votes
1answer
115 views

Should I hold an Id and the Item [duplicate]

Let's say I have a Customer which contains an Address class like: public class Customer { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; ...
3
votes
1answer
150 views

Could a view call a function of the model directly?

this is a fundamental question about MVC (in particular using AngularJS) and I've found similar questions here, but not the exact same problem: Could the view call a function of the model, or should ...
2
votes
0answers
50 views

Where to output from large CLI app [closed]

I've built a reasonably sized CLI app with everything split across different classes and namespaces in a logical way. However many components need to render output from within themselves. Which seems ...
1
vote
2answers
175 views

How can I create a model to efficiently answer the question of - where to place my db-interaction code I am about to write?

I am seeking the right model for storing and retrieving data, when working with any specific class, while keeping in mind the bigger picture. Details: I have some SQL code in (one) of my classes and ...
13
votes
8answers
2k views

When does one hard-code actual data values into the code as opposed to using a DB?

A long-standing question for me has been: when do I store data (actual values) in a database table, and when do I store them right in the code? The untold consensus has typically been as such(*): If ...
3
votes
1answer
65 views

Can I resolve an issue with SRP, SOC that prevents object initialization via constructor?

In OOP, I can populate (initialize) an object using constructor injection at object creation time, or setter injection, after creation time. I like the idea of populating object at creation time via ...
2
votes
1answer
78 views

Why is SRP using the class construct to contain a responsibility opposed to using any other OOP entity?

SRP states ... There should never be more than one reason for a class to change. But why a class? Why not use granularity of a function/method? What instead of separating my functionality into ...
2
votes
2answers
207 views

Does it break SRP to have concerns of data handling and object mapping inside a single class, as part of the DataMapper pattern?

Summary I want to look into separating the concern of "creating a populated object from database", to use inside my application. DataMapper pattern seems to be doing just that for me. DataMapper ...
2
votes
2answers
606 views

Refactoring long methods with a lot of cyclomatic complexity

I'm attempting to refactor what is becoming a very large method -- currently 350 or so lines -- that contains a high degree of cyclomatic complexity. I understand and ascribe to the theories that ...
0
votes
1answer
79 views

Sense user-agent to determine HTML - Keep HTML and Logic separate?

I am of-the-understanding that you should try to keep HTML out of your logic, and keep logic out of your HTML. E.G.: You don't write HTML in (C# strings or Javascript Services) and pass them into the ...
0
votes
1answer
53 views

SOC and self-initializing configuration

Disclaimer: I'm using C# for code examples. But I guess they should be readable/understandable for everyone. If they are not: please leave a comment. Okay I have a Client-Server application. The ...
0
votes
2answers
120 views

Distinguishing Classes: How to catch system behavior in classes (Library System Case)

Suppose a Library System. if I think about Data, I can just distinguish Book, Member classes or at most Author or Publisher... (Are they only classes?), but I have some use cases, scenarios (Borrow, ...
1
vote
1answer
208 views

Does Separation of Concerns applies to GUI components?

In an application I developed with C#, I use a webbrowser control, it should navigate to some websites, then I would like to extract some contents from the webpages. I do it by manipulation of DOM and ...
2
votes
3answers
331 views

API - How to handle scope based functionality?

TLDR; Where and possibly how should I implement scope based logic in the example code? I have got a ASP.NET Web Api. The Api uses OData (on top off REST) for data endpoints and OAuth 2.0 ...
1
vote
2answers
72 views

What layer generates commands for dependent services?

Our business works with truck drivers making pickups/deliveries of containers. The location of containers needs to be tracked. The drivers use mobile devices to generate a "DriverReport" (a log of ...
3
votes
2answers
152 views

Separation of logic from presentation results in repetition of code

Here's what I've been thinking. Say you're making a multiplayer game. A good way to structure it is to have all your game logic on the server and have the clients only be responsible for transmitting ...
3
votes
2answers
217 views

Separation of concerns between objects

I have two objects which work together to provide interaction with HIDs on a machine. One object is responsible for the communication (read/write) to the HID and the other object is responsible for ...
3
votes
0answers
281 views

Decoupling of Model and API (in an .net WEB API Project)

I currently have one separate project for my models, and one separate project for a API application that consumes this model. The intention of the separation is to avoid any outgoing dependencies from ...
20
votes
4answers
8k views

If MVC is “Separation of Concerns” then why was Razor Syntax introduced?

My question is related to MVC design pattern and Razor Syntax introduced by Microsoft. While learning MVC design pattern I was told that the idea is based upon a principle known as Separation of ...
2
votes
0answers
245 views

Entity Framework and separating DAL from domain entities

If I have a normalized db, it's unlikely to map 1 to 1 with my domain entities. So I customize my EF entities to fit the domain. But now my EF entities are essentially my domain entities and my DAL is ...
2
votes
1answer
246 views

Third Party web controls and tight coupling

Disclaimer: I am not against third-party controls because I believe it's for productivity I have used Telerik asp.net controls, especially the RadGrid because it makes it easier to do CRUD. They ...
1
vote
2answers
339 views

Email service or simply abstract email out and call from?

Got a fairly large web application in asp.net using C#. Also have a mobile setup using a common api that we wrote to basically share data across both of our apps using web methods and common classes. ...
0
votes
2answers
385 views

Separating roles authorization and database

Something really bothers me about the way authorization tends to be done with roles in ASP.NET MVC. The way it is normally done is that you have a Users table and a Roles table. A User can have many ...
4
votes
4answers
662 views

How to write JavaScript while keeping HTML/CSS out of it

What is / are some recommended ways to write JavaScript as to control behavior of showing HTML on screen, while keeping well-maintainable code? Basically, I started to look for ways to keep HTML/CSS ...
2
votes
1answer
81 views

Queue of jobs in a different states and with different services around

I need to design a 'queue' of jobs (in a a very much UI oriented application) that can be run by a user and I need some other thoughts to pick optimal approach from ground up. My jobs can be in a ...
4
votes
5answers
2k views

Is this a good practice or not?

I have a colleague who has come up with a way of 'genericizing' information from a database so that all his web application's drop-down lists can share the same object in his MVC.NET C# code and Views,...
1
vote
3answers
1k views

What are the steps to grouping related classes into packages

What are the steps needed to be taken to group related classes into packages in Java? In my case, I have about a number of .java files that I'd like to group into 3 packages according to the MVC ...
1
vote
2answers
273 views

How to refactor code that has 2 concerns

Say I have this code: if ($this->ship == "e") { $this->price->addLine($this->price->base * $this->price->e, 0, "Export"); $this->price->...
1
vote
0answers
113 views

How to use data shaped by the UI from the ViewModel while keeping concerns separated?

I'm coming from a winforms background and trying to get ahold of MVVM and XAML. Right now I'm wondering how I can take advantage from a data-shaping control (either native or provided by a third party)...
2
votes
2answers
147 views

Segregating interfaces/concerns to a tree

When working with a single object there are a number of ways to segregate interfaces to it. Breaking it into smaller components that can be treated independently. Breaking it into simpler interfaces....
0
votes
1answer
194 views

Design MVC site such that UI developer can work without access to data tier? [closed]

I'm working on an ASP.NET MVC site (using Team Foundation Service for source control) that I've divided into a few separate projects under one solution: Project.WebAPI (Main entrypoint, contains "...