Search Results

Search found 5636 results on 226 pages for 'facade pattern'.

Page 14/226 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Applying the Decorator Pattern to Forms

    - by devoured elysium
    I am trying to apply the Decorator Design Pattern to the following situation: I have 3 different kind of forms: Green, Yellow, Red. Now, each of those forms can have different set of attributes. They can have a minimize box disabled, a maximized box disabled and they can be always on top. I tried to model this the following way: Form <---------------------------------------FormDecorator /\ /\ |---------|-----------| |----------------------|-----------------| GreenForm YellowForm RedForm MinimizeButtonDisabled MaximizedButtonDisabled AlwaysOnTop Here is my GreenForm code: public class GreenForm : Form { public GreenForm() { this.BackColor = Color.GreenYellow; } public override sealed Color BackColor { get { return base.BackColor; } set { base.BackColor = value; } } } FormDecorator: public abstract class FormDecorator : Form { private Form _decoratorForm; protected FormDecorator(Form decoratorForm) { this._decoratorForm = decoratorForm; } } and finally NoMaximizeDecorator: public class NoMaximizeDecorator : FormDecorator { public NoMaximizeDecorator(Form decoratorForm) : base(decoratorForm) { this.MaximizeBox = false; } } So here is the running code: static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(CreateForm()); } static Form CreateForm() { Form form = new GreenForm(); form = new NoMaximizeDecorator(form); form = new NoMinimizeDecorator(form); return form; } The problem is that I get a form that isn't green and that still allows me to maximize it. It is only taking in consideration the NoMinimizeDecorator form. I do comprehend why this happens but I'm having trouble understanding how to make this work with this Pattern. I know probably there are better ways of achieving what I want. I made this example as an attempt to apply the Decorator Pattern to something. Maybe this wasn't the best pattern I could have used(if one, at all) to this kind of scenario. Is there any other pattern more suitable than the Decorator to accomplish this? Am I doing something wrong when trying to implement the Decorator Pattern? Thanks

    Read the article

  • Game mechanics patterns database?

    - by Klaim
    Do you know http://tvtropes.org ? It's a kind of wiki/database with scenaristic tropes, patterns that you can find in tones of stories, in tv shows, games, books, etc. Each trope/pattern have a (funny) name and there are references to where it appears, and the other way arround : each book/game/etc. have a list of tropes that it contains. I'm looking for an equivalent but for game mechanics patterns, something like "Death is definitive", "Perfect physical control (no inertia)", "Excell table gameplay", etc. I think it would be really useful. I can't find an equivalent for game mechanics (tvtrope is oriented to scenario, not game mechanics). Do you know any?

    Read the article

  • Top Fusion Apps User Experience Guidelines & Patterns That Every Apps Developer Should Know About

    - by ultan o'broin
    We've announced the availability of the Oracle Fusion Applications user experience design patterns. Developers can get going on these using the Design Filter Tool (or DeFT) to select the best pattern for their context of use. As you drill into the patterns you will discover more guidelines from the Applications User Experience team and some from the Rich Client User Interface team too that are also leveraged in Fusion Apps. All are based on the Oracle Application Development Framework components. To accelerate your Fusion apps development and tailoring, here's some inside insight into the really important patterns and guidelines that every apps developer needs to know about. They start at a broad Fusion Apps information architecture level and then become more granular at the page and task level. Information Architecture: These guidelines explain how the UI of an Oracle Fusion application is constructed. This enables you to understand where the changes that you want to make fit into the oveall application's information architecture. Begin with the UI Shell and Navigation guidelines, and then move onto page-level design using the Work Areas and Dashboards guidelines. UI Shell Guideline Navigation Guideline Introduction to Work Areas Guideline Dashboards Guideline Page Content: These patterns and guidelines cover the most common interactions used to complete tasks productively, beginning with the core interactions common across all pages, and then moving onto task-specific ones. Core Across All Pages Icons Guideline Page Actions Guideline Save Model Guideline Messages Pattern Set Embedded Help Pattern Set Task Dependent Add Existing Object Pattern Set Browse Pattern Set Create Pattern Set Detail on Demand Pattern Set Editing Objects Pattern Set Guided Processes Pattern Set Hierarchies Pattern Set Information Entry Forms Pattern Set Record Navigation Pattern Set Transactional Search and Results Pattern Group Now, armed with all this great insider information, get developing some great-looking, highly usable apps! Let me know in the comments how things go!

    Read the article

  • Set default reminder pattern to iCal Calendar/Group

    - by elhombre
    Hi all I have in iCal some Calendars/Groups named Birthday, Exams and Holidays. Now I am wondering if I can assign a default reminder pattern to all Exams events, for example: 2 Weeks before, 1 Week before, 2 Days before. The result should be that I don't have to specify each time the reminder pattern of an event in Exams when I create a New one. NOTE: If iCal can't do this, is it maybe possible do that through an automator action etc.?

    Read the article

  • Security Pattern to store SSH Keys

    - by Mehdi Sadeghi
    I am writing a simple flask application to submit scientific tasks to remote HPC resources. My application in background talks to remote machines via SSH (because it is widely available on various HPC resources). To be able to maintain this connection in background I need either to use the user's ssh keys on the running machine (when user's have passwordless ssh access to the remote machine) or I have to store user's credentials for the remote machines. I am not sure which path I have to take, should I store remote machine's username/password or should I store user's SSH key pair in database? I want to know what is the correct and safe way to connect to remote servers in background in context of a web application.

    Read the article

  • design pattern advice: graph -> computation

    - by csetzkorn
    I have a domain model, persisted in a database, which represents a graph. A graph consists of nodes (e.g. NodeTypeA, NodeTypeB) which are connected via branches. The two generic elements (nodes and branches will have properties). A graph will be sent to a computation engine. To perform computations the engine has to be initialised like so (simplified pseudo code): Engine Engine = new Engine() ; Object ID1 = Engine.AddNodeTypeA(TypeA.Property1, TypeA.Property2, …, TypeA.Propertyn); Object ID2 = Engine.AddNodeTypeB(TypeB.Property1, TypeB.Property2, …, TypeB.Propertyn); Engine.AddBranch(ID1,ID2); Finally the computation is performed like this: Engine.DoSomeComputation(); I am just wondering, if there are any relevant design patterns out there, which help to achieve the above using good design principles. I hope this makes sense. Any feedback would be very much appreciated.

    Read the article

  • A design pattern for data binding an object (with subclasses) to asp.net user control

    - by Rohith Nair
    I have an abstract class called Address and I am deriving three classes ; HomeAddress, Work Address, NextOfKin address. My idea is to bind this to a usercontrol and based on the type of Address it should bind properly to the ASP.NET user control. My idea is the user control doesn't know which address it is going to present and based on the type it will parse accordingly. How can I design such a setup, based on the fact that, the user control can take any type of address and bind accordingly. I know of one method like :- Declare class objects for all the three types (Home,Work,NextOfKin). Declare an enum to hold these types and based on the type of this enum passed to user control, instantiate the appropriate object based on setter injection. As a part of my generic design, I just created a class structure like this :- I know I am missing a lot of pieces in design. Can anybody give me an idea of how to approach this in proper way.

    Read the article

  • MVC Pattern, ViewModels, Location of conversion.

    - by Pino
    I've been working with ASP.Net MVC for around a year now and have created my applications in the following way. X.Web - MVC Application Contains Controller and Views X.Lib - Contains Data Access, Repositories and Services. This allows us to drop the .Lib into any application that requires it. At the moment we are using Entity Framework, the conversion from EntityO to a more specific model is done in the controller. This set-up means if a service method returns an EntityO and then the Controller will do a conversion before the data is passed to a view. I'm interested to know if I should move the conversion to the Service so that the app doesn't have Entity Objects being passed around.

    Read the article

  • Bayes Misclassification error and plot : pattern recognition [closed]

    - by user1214586
    Below is a Matlab code for Bayes classifier which classifies arbitrary numbers into their classes. training = [3;5;17;19;24;27;31;38;45;48;52;56;66;69;73;78;84;88]; target_class = [0;0;10;10;20;20;30;30;40;40;50;50;60;60;70;70;80;80]; test = [1:2:90]'; class = classify(test,training, target_class, 'diaglinear'); % Naive Bayes classifier [test class] If someone could provide code snippets for calculating the Bayes error for misclassification and accuracy.Also, is it possible to plot a scatter plot and histogram indicating the number of data points belonging to different classes? Thank you.

    Read the article

  • Implementing MVC pattern in SWT application

    - by Pradeep Simha
    I am developing an SWT application (it's basically an Eclipse plugin, so I need to use SWT). Currently my design is as follows: Model: In model, I have POJOs which represents the actual fields in views. View: It is a dumb layer, it contains just UI and contains no logic (not even event handlers) Controller: It acts as a mediator b/w those two layers. Also it is responsible for creating view layer, handling events etc. Basically I have created all of the controls in view as a static like this public static Button btnLogin and in controller I have a code like this: public void createLoginView(Composite comp) { LoginFormView.createView(comp); //This createView method is in view layer ie LoginFormView LoginFormView.btnLogin.addSelectionListener(new SelectionListener() { //Code goes here }); } Similalrly I have done for other views and controls. So that in main class and other classes I am calling just createLoginView of controller. I am doing similar thing for other views. So my question, is what I am doing is correct? Is this design good? Or I should have followed any other approach. Since I am new to SWT and Eclipse plugin development (basically I am Java EE developer having 4+ years of exp). Any tips/pointers would be appreciated.

    Read the article

  • Transient VO : Powerful J2EE Design Pattern

    - by Vijay Mohan
    We had a use-case wherein, the communication has to happen between regions residing under differenet taskfows. Essentially, they had a common set of parameters to be used. Initially, we resorted to the  use of pageFlowScope variables, but they are tightly coupled with the individual task flows. So, how the communication has to happen..?Some of the alternatives that we brainstormed into are - 1.usage of adf contextual event - This is a powerful feature indeed for such use-cases, but there is a considerable cost involved with it. So, before resorting to it, you have to make sure that you have good enough reason to use it.It actually does a server roundtrip and also the issue of an event and listening part to it is also something which requires your attention !!2.Use a transientVO with shared data control scope - with shared data control scope, the transient VO rows would be persistent across the task flows in your application. All you have to do is to create the attributes in the transientVO(prefereably with the same names - for the ease of conversion) and create some utility methods in VOImpl for creating row, updating row and deleting a row. You also have to make sure that the vo row is initialized per http request( this you can do in a bookmark method of your index.jspx - residing in adfc-config.xml), else the ui fields binded to the transient vo attributes won't render in UI.Hope, this helps and this should be a common use-case across apps.

    Read the article

  • Make a controller a superclass in MVC design pattern

    - by Nikola
    I am really confused how to handle this. I have: model.Outsider model.SubContractor (which extends Outsider) Basically, Outsider would mean Supplier, but SubContractor is not a Supplier itself so I had to divide it somehow. I used to have model.Outsider (super class of the two bellow) model.Supplier model.SubContractor But Supplier didn't have any unique fields so I have removed it (Was this correct?) So, continuing, I have db layer which has: db.DBOutsider db.DBSubContractor (which again extends the top one) And I have no place to put my Supplier methods. I can do that in DBOutsider, but then DBSubContractor (which extends DBOutsider) would get unnecessary methods. Do I create a DBSupplier even though there is no such class in the model layer? Then again, going to controller layer. It is the same situation as db layer. I have OutsiderController and SubContractorController (which extends the first one) (is this correct in first place? to have an extended controller?). But I have no place to put the methods which are concerned with Supplier and if I put them in the OutsiderController the SubContractorController would recieve unneccessary methods. At the moment I am going for the extra DBSupplier and SupplierController classes, but I have no idea if this is the correct way. Basically what perplexes me is the "empty" Supplier. Since it is supposed to be an Outsider but has no extra methods or fields, should there be an empty class?

    Read the article

  • Choice the project pattern, advice for this case

    - by Lucas Rodrigues Sena
    I have a project in MVC4 entity framework, and have to adapt it to possible updates on the dlls and system do not stop work. I'm using portable Areas, but have difficulty creating 5 modules and about 5 functionality for each modules with fully functioning independently as a dll and database. 1- Reflection DLLs, the system works "on the fly". (I cant do it on mvc4 at moment). 2- Portables Areas (I need to do one area for each modules*functionality 5*5 Areas). Confuse way and I'm afraid if this is ridiculous. 3- Implement WFC on MVC4, compatible? 4- Other better way?

    Read the article

  • Scala factory pattern returns unusable abstract type

    - by GGGforce
    Please let me know how to make the following bit of code work as intended. The problem is that the Scala compiler doesn't understand that my factory is returning a concrete class, so my object can't be used later. Can TypeTags or type parameters help? Or do I need to refactor the code some other way? I'm (obviously) new to Scala. trait Animal trait DomesticatedAnimal extends Animal trait Pet extends DomesticatedAnimal {var name: String = _} class Wolf extends Animal class Cow extends DomesticatedAnimal class Dog extends Pet object Animal { def apply(aType: String) = { aType match { case "wolf" => new Wolf case "cow" => new Cow case "dog" => new Dog } } } def name(a: Pet, name: String) { a.name = name println(a +"'s name is: " + a.name) } val d = Animal("dog") name(d, "fred") The last line of code fails because the compiler thinks d is an Animal, not a Dog.

    Read the article

  • Architecture/pattern resources for small applications and tools

    - by s73v3r
    I was wondering if anyone had any resources or advice related to using architecture patterns like MVVM/MVC/MVP/etc on small applications and tools, as opposed to large, enterprisy ones. EDIT: Most of the information I see on application architecture is directed at large, enterprise applications. I'm just writing small programs and tools. As far as using these architecture patterns, is it generally worthwhile to go through the overhead of using an MVC/MVVM framework? Or would I be better off keeping it simple?

    Read the article

  • Design pattern for an ASP.NET project using Entity Framework

    - by MPelletier
    I'm building a website in ASP.NET (Web Forms) on top of an engine with business rules (which basically resides in a separate DLL), connected to a database mapped with Entity Framework (in a 3rd, separate project). I designed the Engine first, which has an Entity Framework context, and then went on to work on the website, which presents various reports. I believe I made a terrible design mistake in that the website has its own context (which sounded normal at first). I present this mockup of the engine and a report page's code behind: Engine (in separate DLL): public Engine { DatabaseEntities _engineContext; public Engine() { // Connection string and procedure managed in DB layer _engineContext = DatabaseEntities.Connect(); } public ChangeSomeEntity(SomeEntity someEntity, int newValue) { //Suppose there's some validation too, non trivial stuff SomeEntity.Value = newValue; _engineContext.SaveChanges(); } } And report: public partial class MyReport : Page { Engine _engine; DatabaseEntities _webpageContext; public MyReport() { _engine = new Engine(); _databaseContext = DatabaseEntities.Connect(); } public void ChangeSomeEntityButton_Clicked(object sender, EventArgs e) { SomeEntity someEntity; //Wrong way: //Get the entity from the webpage context someEntity = _webpageContext.SomeEntities.Single(s => s.Id == SomeEntityId); //Send the entity from _webpageContext to the engine _engine.ChangeSomeEntity(someEntity, SomeEntityNewValue); // <- oops, conflict of context //Right(?) way: //Get the entity from the engine context someEntity = _engine.GetSomeEntity(SomeEntityId); //undefined above //Send the entity from the engine's context to the engine _engine.ChangeSomeEntity(someEntity, SomeEntityNewValue); // <- oops, conflict of context } } Because the webpage has its own context, giving the Engine an entity from a different context will cause an error. I happen to know not to do that, to only give the Engine entities from its own context. But this is a very error-prone design. I see the error of my ways now. I just don't know the right path. I'm considering: Creating the connection in the Engine and passing it off to the webpage. Always instantiate an Engine, make its context accessible from a property, sharing it. Possible problems: other conflicts? Slow? Concurrency issues if I want to expand to AJAX? Creating the connection from the webpage and passing it off to the Engine (I believe that's dependency injection?) Only talking through ID's. Creates redundancy, not always practical, sounds archaic. But at the same time, I already recuperate stuff from the page as ID's that I need to fetch anyways. What would be best compromise here for safety, ease-of-use and understanding, stability, and speed?

    Read the article

  • Design pattern for client/server sessions?

    - by nonot1
    Are there any common patterns or general guidance I can learn from for how to design a client/server system where the both the client and server must maintain some kind per-client session state? I've found any number of libraries that can help with some of the plumbing, but it's the overall design I'm wondering about. Open issues in my mind: How to structure the client/server communication so that bidirectional synchronous and asynchronous requests are possible? The server side needs to spawn a couple of per-connected-client session-long helper process. How to manage that? How to manage the mapping from a given client (and any of it's requests) to server state and helper process instances in the face of multiple clients and intermittent network connectivity. Most communication can be simple blocking request/reply, but some will be long running processing tasks that the client will want to keep tabs on. To the extent that it matters, the platform is Linux/C/C++. Not web based. Just an existing thick-client software app being modified to talk to backend servers for some tasks.

    Read the article

  • Liskov substitution and abstract classes / strategy pattern

    - by Kolyunya
    I'm trying to follow LSP in practical programming. And I wonder if different constructors of subclasses violate it. It would be great to hear an explanation instead of just yes/no. Thanks much! P.S. If the answer is no, how do I make different strategies with different input without violating LSP? class IStrategy { public: virtual void use() = 0; }; class FooStrategy : public IStrategy { public: FooStrategy(A a, B b) { c = /* some operations with a, b */ } virtual void use() { std::cout << c; } private: C c; }; class BarStrategy : public IStrategy { public: BarStrategy(D d, E e) { f = /* some operations with d, e */ } virtual void use() { std::cout << f; } private: F f; };

    Read the article

  • Help to understand the abstract factory pattern

    - by Chobeat
    I'm learning the 23 design patterns of the GoF. I think I've found a way to understand and simplify how the Abstract Factory works but I would like to know if this is a correct assumption or if I am wrong. What I want to know is if we can see the result of the Abstract Factory method as a matrix of possible products where there's a Product for every "Concrete Factory" x "AbstractProduct" where the Concrete Factory is a single implementation among the implementations of an AbstractFactory and an AbstractProduct is an interface among the interfaces to create Products. Is this correct or am I missing something?

    Read the article

  • The Singleton Pattern

    - by Darren Young
    Hi, I am a new programmer (4 months into my first job) and have recently taken an interest in design patterns. One that I have used recently is the Singleton. However, looking at some comments on this thread Overused or abused programming techniques .......it has some bad feedback. Come somebody explain why? I have found it useful in some places, however I could probably have achieved the same without it using a static class. Thanks.

    Read the article

  • Design pattern and best practices

    - by insane-36
    I am an iphone developer. I am quite confident on developing iphone application with some minimal feature. I would consider myself as a fair application developer but the code I write is not so much structured. I make vey little use of MVC because I dont seem to find places to impose MVC. Most of the time, I create application with viewcontrollers and very few models only. How could I improve the skill for making my code more reusable, standard, easy and maintainable. I have seen few books on design patterns and tried few chapters myself but I dont seem to skip my habit. I know few of them but I am not being able to apply those patterns into my app. What is the best way to learn the design patterns and coding habit. Any kind of suggestion is warmly welcomed.

    Read the article

  • State Design Pattern .NET Code Sample

    using System;using System.Collections.Generic;using System.Linq;using System.Text;class Program{ static void Main(string[] args) { Person p1 = new Person("P1"); Person p2 = new Person("P2"); p1.EatFood(); p2.EatFood(); p1.Vomit(); p2.Vomit(); }}interface StomachState{ void Eat(Person p); void Vomit(Person p);}class StomachFull : StomachState{ public void Eat(Person p) { Console.WriteLine("Can't eat more."); } public void Vomit(Person p) { Console.WriteLine("I've just Vomited."); p.StomachState = new StomachEmpty(); }}class StomachEmpty : StomachState{ public void Eat(Person p) { Console.WriteLine("I've just had food."); p.StomachState = new StomachFull(); } public void Vomit(Person p) { Console.WriteLine("Nothing to Vomit."); }}class Person{ private StomachState stomachState; private String personName; public Person(String personName) { this.personName = personName; StomachState = new StomachEmpty(); } public StomachState StomachState { get { return stomachState; } set { stomachState = value; Console.WriteLine(personName + " Stomach State Changed to " + StomachState.GetType().Name); Console.WriteLine("***********************************************\n"); } } public Person(StomachState StomachState) { this.StomachState = StomachState; } public void EatFood() { StomachState.Eat(this); } public void Vomit() { StomachState.Vomit(this); }} span.fullpost {display:none;}

    Read the article

  • Is ORM an Anti-Pattern?

    - by derphil
    I had a very stimulating and interessting discussion with a colleague about ORM and it's Pros and Cons. In my opinion, an ORM is useful only in the rarest cases. At least in my experience. But I don't want to list my own arguments at this time. So I ask you, what do you think about ORM? What are the Pros and the Cons? P.S. I've posted this "question" yesterday on Stackoverflow, but some of the user think, that this should better posted here.

    Read the article

  • Using a front controller design pattern doesn't allow images to be served

    - by MrMe TumbsUp
    I am currently using a front controller. All requests for my website go through it. I have a problem with image links like: <img src="img/image.jpg" /> Then my front controller will try to dispatch the request to: application/controller/ImgController.php. Then the image won't load. I think it has something to do with the .htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >