design-patterns

Design Pattern for Undo Engine

 ̄綄美尐妖づ 提交于 2020-01-17 08:29:14
问题 I'm writing a structural modeling tool for a civil enginering application. I have one huge model class representing the entire building, which include collections of nodes, line elements, loads, etc. which are also custom classes. I have already coded an undo engine which saves a deep-copy after each modification to the model. Now I started thinking if I could have coded differently. Instead of saving the deep-copies, I could perhaps save a list of each modifier action with a corresponding

Proxy Design Pattern : Disadvantages

左心房为你撑大大i 提交于 2020-01-17 04:35:09
问题 I was going through one of the Articles on Proxy pattern. Read the Comments After the Explanation In this article there are few downsides mentioned for Proxy Patterns, but I am not able to understand: 1) The downside here is 'magic' could be happening that an extender is unaware of (a 'black-box' problem). Please explain the magic . 2) A proxy can mask the life-cycle and state of a volatile resource from its client. A client may call the proxy not realizing that the resource is currently

Inheritance - variable initialisation in subclass

柔情痞子 提交于 2020-01-17 02:36:13
问题 I tend to favour composition over inheritance where possible based on what I learnt at university on "best practices" type course. I am looking at some code in an application, which looks like this: Public Class A Protected _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value As String) _Name = value End Set End Property End Class Public Class B Inherits A End Class Public Class C Inherits B End Class Public Class D Inherits C Public Sub SomeMethod() 'This

SOA/WCF dissecting the system & service boundaries

让人想犯罪 __ 提交于 2020-01-16 21:40:32
问题 I'm building a system which will have a few channels feeding different clients (MonoDroid, MonoTouch, Asp.Net Mvc, REST API) I'm trying to adopt an SOA archetecture and also trying to adopt the persistence by reachability pattern (http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/) My question relates to the design of the archetecture. How best to split the system into discreet chunks to benefit from SOA. In my model have a SystemImplementation which represents the an

SOA/WCF dissecting the system & service boundaries

拟墨画扇 提交于 2020-01-16 21:37:13
问题 I'm building a system which will have a few channels feeding different clients (MonoDroid, MonoTouch, Asp.Net Mvc, REST API) I'm trying to adopt an SOA archetecture and also trying to adopt the persistence by reachability pattern (http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/) My question relates to the design of the archetecture. How best to split the system into discreet chunks to benefit from SOA. In my model have a SystemImplementation which represents the an

SOA/WCF dissecting the system & service boundaries

拟墨画扇 提交于 2020-01-16 21:35:07
问题 I'm building a system which will have a few channels feeding different clients (MonoDroid, MonoTouch, Asp.Net Mvc, REST API) I'm trying to adopt an SOA archetecture and also trying to adopt the persistence by reachability pattern (http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/) My question relates to the design of the archetecture. How best to split the system into discreet chunks to benefit from SOA. In my model have a SystemImplementation which represents the an

PCRE: pattern for unicode characters (hex code)

烂漫一生 提交于 2020-01-16 19:39:09
问题 What is the PCRE pattern, in PHP, for characters with hex code from \x00 to \xFF ? 回答1: To match a specific Unicode code point, use \uFFFF where FFFF is the hexadecimal number of the code point you want to match. You must always specify 4 hexadecimal digits . E.g. \u00E0 matches "à", but only when encoded as a single code point U+00E0. Source: Regex Tutorial 来源: https://stackoverflow.com/questions/17507850/pcre-pattern-for-unicode-characters-hex-code

Caching Data on a Heavy Load Web Server

徘徊边缘 提交于 2020-01-16 19:03:46
问题 I currently have a web application which on each page request gets user data out of a database, for the currently logged in user. This web application could have approximately 30 thousands concurrent users. My question is would it be best to cache this. For example in C# using System.Web.HttpRuntime.Cache.Add or would this cripple the servers memory storing up to 30 thousand user objects in the memory? Would it be better to not cache and just get the required data from the database on each

Caching Data on a Heavy Load Web Server

核能气质少年 提交于 2020-01-16 19:03:06
问题 I currently have a web application which on each page request gets user data out of a database, for the currently logged in user. This web application could have approximately 30 thousands concurrent users. My question is would it be best to cache this. For example in C# using System.Web.HttpRuntime.Cache.Add or would this cripple the servers memory storing up to 30 thousand user objects in the memory? Would it be better to not cache and just get the required data from the database on each

Can’t understand controller part of MVC

心不动则不痛 提交于 2020-01-16 18:11:38
问题 What exactly are those controllers? We were asked to build an ATM in Java for school project, and part of our design is: We have accounts that stores most of informations We have users that can make operations for their own accounts and stores some minor informations. (Also we have atm class to store users and make some toplevel changes) We have userInterface to catch inputs and use controllers. Am I right that our accounts are models, interfaces are views and users are controllers? Thanks a