separation-of-concerns

Creating Views in PHP - Best Practice [closed]

爷,独闯天下 提交于 2019-12-10 02:58:31
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . I am working on a website with 2 other developers. I am only responsible to creating the views. The data is available in an object, and I have getters to read the data then create XHTML pages. What is the best practice to do this, without using any template engine? Thanks a lot

What does N-tier Architecture mean nowadays?

谁都会走 提交于 2019-12-09 11:54:32
问题 In a traditional sense, N-tier means separating the application into "tiers" and putting each "tier" on different servers. This was done for at least 3 reasons: Maintenance: a) Code Maintenance: Easier to do bug fixes and feature additions. b) Hardware Maintenance: Taking one server down does not disrupt service from other tier. Performance: One server was often not fast enough to handle web requests, business logic computations, and database/file access at the same time. Scalability:

MVVM + Implementation of View specific functionalities called by the ViewModel

点点圈 提交于 2019-12-07 18:32:40
问题 here is my "problem" I want to resolve: I have got many "View only" specific functionalities for example: Change the ResourcesDictionary of a View at runtime (for changing skins from black to blue or whatever) Save and restore View specific settings like the view size, or grid properties set by a user ... All those functionalities have nothing to do with the ViewModel, since they are really view specific and might only fit to one client (View) of a ViewModel (in the case a ViewModel has got

Unit testing functions with side effects?

旧城冷巷雨未停 提交于 2019-12-07 03:32:18
问题 Let's say you're writing a function to check if a page was reached by the appropriate URL. The page has a "canonical" stub - for example, while a page could be reached at stackoverflow.com/questions/123, we would prefer (for SEO reasons) to redirect it to stackoverflow.com/questions/123/how-do-i-move-the-turtle-in-logo - and the actual redirect is safely contained in its own method (eg. redirectPage($url)), but how do you properly test the function which calls it? For example, take the

Persistence encapsulated via the domain, or persistence via the Repository?

房东的猫 提交于 2019-12-06 14:40:49
问题 If my Domain Model is not supposed to know/care about the Repository, then how does some behaviour like .UpdateOrder(...) , that encapsulates a CRUD-Update, interface with the Repository? Through a Domain Service? Ok, then my Repository has an effective CRUD-Update that's used in conjunction with my .UpdateOrder(...) . That's fine. But i don't want someone to use the Update method on the Repository, i want them to go through the behaviour on the Entity (use UpdateOrder() instead). I'd prefer

How to separate web components to individual files and load them?

流过昼夜 提交于 2019-12-06 08:59:49
问题 I have a web component x-counter , which is in a single file. const template = document.createElement('template'); template.innerHTML = ` <style> button, p { display: inline-block; } </style> <button aria-label="decrement">-</button> <p>0</p> <button aria-label="increment">+</button> `; class XCounter extends HTMLElement { set value(value) { this._value = value; this.valueElement.innerText = this._value; } get value() { return this._value; } constructor() { super(); this._value = 0; this.root

Separating Tkinter UI concerns from Logic in Python app

末鹿安然 提交于 2019-12-05 19:20:13
This is my first app ever. It is working well but I would like to separate the UI concerns like getting input and creating labels, from the translation logic. I would then like to remove the output from the previous translation, i.e., only showing one translation on the screen at a time. How can I separate the translation logic from my Tkinter GUI? from Tkinter import * import tkMessageBox def start(): inputg = input.get() if len(inputg) >= 2 and inputg.isalpha(): new_word_out = Label(text=(inputg[1:] + (inputg[0] + "ay")).lower().title()).pack() out_message = Label(text="Cool! Try another!")

Are WPF related properties inside a ViewModel a violation of MVVM best practices?

偶尔善良 提交于 2019-12-05 18:26:28
问题 Here is an example case to elaborate: I am dynamically creating a simple Bar Graph using an ItemsControl in my View and binding the items to a collection of BarViewModels (each containing percentage a value) in my BarGraphViewModel. Each bar should have a different color. The colors should be chosen from a collection e.g. {Color1, Color2, ..} The collection itself is constant but the number of bars will depend on the circumstances. A simple solution would be to create a simple BarViewModel

Dependency Injection - Does it violate Separation of Concerns?

我的梦境 提交于 2019-12-05 18:00:52
Does Dependency Injection violate the Separation of Concerns as it pertains to an n-tier architecture? Suppose you have the following projects: MyApp.Data MyApp.Business MyApp.Web If I were to use DI to tell the Business Layer which Data Context to use, wouldn't this violate SoC? This would mean the UI (MyApp.Web) would have to have knowledge of the Data Access Layer (MyApp.Data) to tell the Business Layer (MyApp.Business) which context to use, right? public class WebForm { public void Save(Object dto) { BusinessObject bo = new BusinessObject(Data.MyDataContext); bo.ValidateAndSave(dto); } } I

Place client-side JavaScript templates in HTML or JavaScript?

你。 提交于 2019-12-05 07:55:11
Should client-side templates like the following (using underscore's templating engine): <p class="foo"><%= bar %></p> be placed in an separate HTML file, or a separate JavaScript file? I know it could work both ways. For example, a JavaScript file could just contain a list of string variables like so: var cute = '<p class="the"><%= unicorn %></p>'; var fb = '<p class="new-design"><%= sucks %></p>'; But I have also seen the following: <script type="text/template" id="omg-template"> <span id="swag-name"><%= name %></span> </script> Just from a Separation of Concerns standpoint, where does the