Search Results

Search found 13727 results on 550 pages for 'oo design'.

Page 51/550 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • Useful design patterns when dealing with spring 3 controllers

    - by Mat Banik
    Recently I was overlooking my controllers and they are bit of mess. I'd like to organize they way I set returning views Do more elegant mesageSource massaging back to the users and account for i18n Security checking, what user can access an what they can't Consistent way of calling the service layer And somehow bring consistency to the debugging lines. Do better job with error handling and serving it to the user. I'm already on mission to do security logging with AOP :) I'm just looking for patterns I could implement to help me to do all of the above. Or just some general advice in case no patterns apply, or advice on something I didn't mention but is common practice.

    Read the article

  • MVC & Design patterns in C++

    - by theunanonim
    I have an assignment (university level) in C++ The application that was done so far: - MVC agenda - the views are command-line - Agenda contains a list of contacts - a contact may be a friend or an acquiantance - Agenda may contain also a Company that is a contact and may contain other contacts (sorry the code is already too big as I tried to keep the MVC aspect of the application, and I can't post it here or request your time to study it..) To do: - implement factory method pattern - implement observer pattern - implement strategy pattern - implement visitor pattern The evaluation will depend on the number of added patterns and places they have been added. Am I an idiot or this is the stupidies possible assignement ? If not, please help me with some basic tips.. which one where ? Best Regards. P.S. Sorry for my English

    Read the article

  • Database design: objects with different attributes

    - by Álvaro G. Vicario
    I'm designing a product database where products can have very different attributes depending on their type, but attributes are fixed for each type and types are not manageable at all. E.g.: magazine: title, issue_number, pages, copies, close_date, release_date web_site: name, bandwidth, hits, date_from, date_to I want to use InnoDB and enforce database integrity as much as the engine allows. What's the recommended way to handle this? I hate those designs where tables have 100 columns and most of the values are NULL so I thought about something like this: product_type ============ product_type_id INT product_type_name VARCHAR product ======= product_id INT product_name VARCHAR product_type_id INT -> Foreign key to product_type.product_type_id valid_since DATETIME valid_to DATETIME magazine ======== magazine_id INT title VARCHAR product_id INT -> Foreign key to product.product_id issue_number INT pages INT copies INT close_date DATETIME release_date DATETIME web_site ======== web_site_id INT name VARCHAR product_id INT -> Foreign key to product.product_id bandwidth INT hits INT date_from DATETIME date_to DATETIME This can handle cascaded product deletion but... Well, I'm not fully convinced...

    Read the article

  • SQL Server many-to-many design recommendation

    - by Jean-Philippe Brabant
    I have a SQL Server database with two table : Users and Achievements. My users can have multiple achievements so it a many-to-many relation. At school we learned to create an associative table for that sort of relation. That mean creating a table with a UserID and an AchivementID. But if I have 500 users and 50 achievements that could lead to 25 000 row. As an alternative, I could add a binary field to my Users table. For example, if that field contained 10010 that would mean that this user unlocked the first and the fourth achievements. Is their other way ? And which one should I use.

    Read the article

  • Design pattern: polymorphisim for list of objects

    - by ziang
    Suppose I have a class A, and A1, A2 inherits from A. There are 2 functions: List<A1> getListA1(){...} List<A2> getListA2(){...} Now I want to do something similar to both A1 and A2 in another function public void process(List<A>){...} If I want to pass the instance of either ListA1 or ListA2, of course the types doesn't match because the compiler doesn't allow the coercion from List< A1 to List< A. I can't do something like this: List<A1> listA1 = getListA1(); List<A> newList = (List<A>)listA1; //this is not allowed. So what is the best approach to the process()? Is there any way to do it in a universal way rather than write the similar code to both List and List?

    Read the article

  • Request for advice about class design, inheritance/aggregation

    - by Lasse V. Karlsen
    I have started writing my own WebDAV server class in .NET, and the first class I'm starting with is a WebDAVListener class, modelled after how the HttpListener class works. Since I don't want to reimplement the core http protocol handling, I will use HttpListener for all its worth, and thus I have a question. What would the suggested way be to handle this: Implement all the methods and properties found inside HttpListener, just changing the class types where it matters (ie. the GetContext + EndGetContext methods would return a different class for WebDAV contexts), and storing and using a HttpListener object internally Construct WebDAVListener by passing it a HttpListener class to use? Create a wrapper for HttpListener with an interface, and constrct WebDAVListener by passing it an object implementing this interface? If going the route of passing a HttpListener (disguised or otherwise) to the WebDAVListener, would you expose the underlying listener object through a property, or would you expect the program that used the class to keep a reference to the underlying HttpListener? Also, in this case, would you expose some of the methods of HttpListener through the WebDAVListener, like Start and Stop, or would you again expect the program that used it to keep the HttpListener reference around for all those things? My initial reaction tells me that I want a combination. For one thing, I would like my WebDAVListener class to look like a complete implementation, hiding the fact that there is a HttpListener object beneath it. On the other hand, I would like to build unit-tests without actually spinning up a networked server, so some kind of mocking ability would be nice to have as well, which suggests I would like the interface-wrapper way. One way I could solve this would be this: public WebDAVListener() : WebDAVListener(new HttpListenerWrapper()) { } public WebDAVListener(IHttpListenerWrapper listener) { } And then I would implement all the methods of HttpListener (at least all those that makes sense) in my own class, by mostly just chaining the call to the underlying HttpListener object. What do you think? Final question: If I go the way of the interface, assuming the interface maps 1-to-1 onto the HttpListener class, and written just to add support for mocking, is such an interface called a wrapper or an adapter?

    Read the article

  • Web Applications Development: Security practices for Application design

    - by Shyam
    Hi, As I am creating more web applications that are targeted for multiple users, I figured out that I have to start thinking about user management and security. At a glance and in my ideal world, all users belong to a group. Permissions and access is thus defined per group (and inherited by the users of that group). Logically, I have my group of administrators, which are identified with a level "7" (integer) clearance. A group of webusers have for example level "1". This in generally all works great for me, but I need some kind of list that I have to keep in mind how I secure my system, and some general practices. I am not looking for a specific environment; I want to learn the why's and how's. An example is privilege escalation. If someone would be able to "push" themselves inside a group with higher privileges, for example the Administration, how can I prevent this, or what measures should I take to have some sort of precaution? I don't like in that case to walk into a caveat. My question is basically: where can I find a good resource, list, policy, book that explains the security of web applications, the why's, the how's and readable if you don't have any experience in the realm of advanced security? I prefer a free resource, as I believe I couldn't be the first one who thought about this. Thank you for your answers, comments and feedback.

    Read the article

  • iPhone development - app design patterns

    - by occulus
    There are tons of resources concerning coding on the iPhone. Most of them concern "how do I do X", e.g. "setup a navigation controller", or "download text from a URL". All good and fine. What I'm more interested in now are the questions that follow the simpler stuff - how to best structure your complex UI, or your app, or the common problems that arise. To illustrate: a book like "Beginning iPhone 3 Development" tells you how to set up a multi viewcontroller app with an top 'switcher' viewcontroller that switches between views owned by other view controllers. Fine, but you're only told how to do that, and nothing about the problems that can follow: for example, if I use their paradigm to switch to a UINavigationViewController, the Navigation bar ends up too low on the screen, because UINavigationViewController expects to be the topmost UIViewController (apparently). Also, delegate methods (e.g. relating to orientation changes) go to the top switcher view controller, not the actual controller responsible for the current view. I have fixes for these things but they feel like hacks which makes me unhappy and makes me feel like I'm missing something. One productive thing might be to look at some open source iPhone projects (see this question). But aside from that?

    Read the article

  • What is this Design Pattern?

    - by Can't Tell
    I read the Wikipedia articles on FactoryMethod and AbstractFactory but the following code doesn't seem to fit anywhere. Can someone explain to me what the following pattern is or if it is an anti-pattern? interace PaymentGateway{ void makePayment(); } class PaypalPaymentGateway implements PaymentGateway { public void makePayment() { //some implementation } } class AuthorizeNetPaymentGateway implements PaymentGateway { public void makePayment() { //some implementation } } class PaymentGatewayFacotry{ PaymentGateway createPaymentGateway(int gatewayId) { if(gatewayId == 1) return PaypalPaymentGateway(); else if(gatewayId == 2) return AuthorizeNetPaymentGateway(); } } Let's say the user selects the payment method using a radio button on an html page and the gatewayId is derived from the radio button value. I have seen code like this and thought it was the AbstractFactory pattern but after reading the Wikipedia article, I'm having doubts.

    Read the article

  • web design PSD to html -> more direct ways?

    - by Assembler
    At work I see one colleague designing a site in Photoshop/Fireworks, I see another taking this data, slicing it up and using Dreamweaver to rebuild the same from scratch. It seems like too much mucking around! I know that Photoshop can output a tables based HTML, and Fireworks will create divs with absolute positioning; neither appear to be very helpful. Admittedly, I haven't tried much of (DW/FW) (CS4/CS3) since becoming a programmer, so I don't know if new versions are addressing this work flow issue, but are we still double handling things? Can we attach some sort of layout metadata (this is a rollover button, this will be a SWF, this will be text, this logo will hide "xyz" <h1> text etc) to slices to aid in layout generation? are there some secret tools which assist in this conversion process? Or are we still restricted to doing things by hand? The frustration continues when said hand built page needs to be reworked again to fit Smarty Templates/Wordpress/generic CMS. I acknowledge that designers need to be free of systems to be able to do whatever, but most conventional sites have: a header with navigation a sidebar with more links the main content part maybe another sidebar a footer Given the similarity of a lot of components, shouldn't there be a more systematic approach to going from sliced designs to functional HTML? Or am I over-simplifying things? -edit- Mmmmm.... I suppose I will accept an answer, but they weren't really what I was looking for. It just seems like designing the DOM is a bit of holy grail ("It's only a model!"), and maybe with all the "groovy" things you can do with HTML and Javascript, it would be mighty hard work, but with a set of constraints (that 960 stuff looks interesting), some well designed reset style sheets and a bit of... fairy dust? we should be able to improve the work flow. Photoshop's tables by themselves are pretty much useless, I agree, but surely we can take this data, and then select a group of cells and say "right, this is a text div, overflow:auto" or "these cells are an image block, style it with the same height/width as the selected area". Admittedly here at work there are other elephants in the room that need to make their formal introductions to management, but some parts of the designpage workflow seem... uneducated at best.

    Read the article

  • Table index design

    - by Swoosh
    I would like to add index(s) to my table. I am looking for general ideas how to add more indexes to a table. Other than the PK clustered. I would like to know what to look for when I am doing this. So, my example: This table (let's call it TASK table) is going to be the biggest table of the whole application. Expecting millions records. IMPORTANT: massive bulk-insert is adding data in this table table has 27 columns: (so far, and counting :D ) int x 9 columns = id-s varchar x 10 columns bit x 2 columns datetime x 5 columns INT COLUMNS all of these are INT ID-s but from tables that are usually smaller than Task table (10-50 records max), example: Status table (with values like "open", "closed") or Priority table (with values like "important", "not so important", "normal") there is also a column like "parent-ID" (self - ID) join: all the "small" tables have PK, the usual way ... clustered STRING COLUMNS there is a (Company) column (string!) that is something like "5 characters long all the time" and every user will be restricted using this one. If in Task there are 15 different "Companies" the logged in user would only see one. So there's always a filter on this one. Might be a good idea to add an index to this column? DATE COLUMNS I think they don't index these ... right? Or can / should be?

    Read the article

  • Help needed in database design for application of Timetable Generation

    - by Himadri
    I am planning for an application of time-table generation. I wanted the data such as standardname, teachername, standard wise subjects and also relate the corresponding teacher with the subject and standard. I had think like, StandardMaster(stdid,stdname) TeacherMaster(teacherid,teachername) SubjectMaster(subid,subname,stdid) What more I need? Any corrections needed in these three tables?

    Read the article

  • Design pattern to encapsulate common funtionality among UI controls

    - by Dan
    I'm brainstorming some ideas around a pattern to use for the following scenario. I have some 3rd party controls that I want to add common functionality to. Functionality is added by handling several of the the events and doing certain things when the events fire along with adding some private variables to hold some state info between events. I want to reuse the code and functionality so this is what I'd typically do. Create a class for this functionality and pass in the instance of the control that I want to add the functionality to in the constructor. Then I can add event handlers to the control in the instance of the class. Can anyone think of alternative patterns to use in order to create this kind of reusable functionality.

    Read the article

  • DB Design - Linking to a parent without circular reference issues

    - by zSysop
    Hi all, I'm having trouble coming up with a solution for the following issue. Lets say i have a db that looks something like the following: Issue Table Id | Details | CreateDate | ClosedDate Issue Notes Table Id | ObjectId | Notes | NoteDate Issue Assignment Table Id | ObjectId | AssignedToId| AssignedDate I'd like allow the linking of an issue to another issue. I thought about adding a column to the Issue table called ParentIssueId and that would allow me the ability to link issues, but i foresee circular references occurring within the issue table if i go through with this implementation. Is there a better way to go about doing this, and if so, how? Thanks

    Read the article

  • Database design for a Fantasy league

    - by Samidh T
    Here's the basic schema for my database Table user{ userid numeber primary key, count number } Table player{ pid number primary key, } Table user-player{ userid number primary key foreign key(user), pid number primary key foreign key(player) } Table temp{ pid number primary key, points number } Here's what I intend to do... After every match the temp table is updated which holds the id of players that played the last match and the points they earned. Next run a procedure that will match the pid from temp table with every uid of user-player table having the same pid. add the points from temp table to the count of user table for every matching uid. empty temp table. My questions is considering 200 players and 10000 users,Will this method be efficient? I am going to be using mysql for this.

    Read the article

  • Facebook style messaging system schema design

    - by Jamie
    Hi all, I'm looking to implement a facebook style messaging system (thread messages) into a site of mine. Do you think this schema markup looks okay? Doctrine schema.yml: UserMessage: tableName: user_message actAs: [Timestampable] columns: id: { type: integer(10), primary: true, autoincrement: true } sender_id : { type: integer(10), notnull: true } sender_read: { type: boolean, default: 1 } subject: { type: string(255), notnull: true } message: { type: string(1000), notnull: true } hash: { type: string(32), notnull: true } relations: UserMessageRecipient as Recipient: type: many local: id foreign: message_id UserMessageReply as Reply: type: many local: id foreign: message_id UserMessageReply: tableName: user_message_reply columns: id: { type: integer(10), primary: true, autoincrement: true } user_message_id as message_id: { type: integer(10), notnull: true } message: { type: string(1000), notnull: true } sender_id: { type: integer(10), notnull: true } relations: UserMessage as Message: local: message_id foreign: id type: one UserMessageRecipient: tableName: user_message_recipient actAs: [Timestampable] columns: id: { type: integer(10), primary: true, autoincrement: true } user_message_id as message_id: { type: integer(10), notnull: true } recipient_id: { type: integer(10), notnull: true } recipient_read: { type: boolean, default: 0 } When I a new reply is made,i'll make sure the boolean for "recipient_read" for each recipient is set to false and of course i'll make sure sender_read is set to false too. I'm using a hash for the URL: http://example.com/user/messages/aadeb18f8bdaea49882ec4d2a8a3c062 (As the id will be starting from 1, i don't wish to have http://example.com/user/messages/1. Yeah, I could start incrementing from a bigger number, but i'd prefer to start at 1.) Is this a good way to go about it? Your thoughts and suggestions would be hugely appreciated. Thanks guys!

    Read the article

  • Advice on Linq to SQL mapping object design

    - by fearofawhackplanet
    I hope the title and following text are clear, I'm not very familiar with the correct terms so please correct me if I get anything wrong. I'm using Linq ORM for the first time and am wondering how to address the following. Say I have two DB tables: User ---- Id Name Phone ----- Id UserId Model The Linq code generator produces a bunch of entity classes. I then write my own classes and interfaces which wrap these Linq classes: class DatabaseUser : IUser { public DatabaseUser(User user) { _user = user; } public Guid Id { get { return _user.Id; } } ... etc } so far so good. Now it's easy enough to find a users phones from Phones.Where(p => p.User = user) but surely comsumers of the API shouldn't need to be writing their own Linq queries to get at data, so I should wrap this query in a function or property somewhere. So the question is, in this example, would you add a Phones property to IUser or not? In other words, should my interface specifically be modelling my database objects (in which case Phones doesn't belong in IUser), or are they actually simply providing a set of functions and properties which are conceptually associated with a User (in which case it does)? There seems drawbacks to both views, but I'm wondering if there is a standard approach to the problem. Or just any general words of wisdom you could share. My first thought was to use extension methods but in fact that doesn't work in this case.

    Read the article

  • Design question - loading info from DB

    - by eriks
    I need to build a class that will represent a row in some table in DB (lets say the table is 'Subscriber' and so is the class). I can have the class Subscriber which constructor receives the Objectkey of subscriber, retrieves info from DB and initializes its members. I add another class - SubscriberLoader which have a static method 'LoadSubscriber'. This method will receive the subscriber objectkey, retrieve info from DB, crate a Subscriber object and initialize its members. Subscriber constructor will be private and SubscirberLoader will be friend class of Subscriber - this way, client could build a Subscriber only using the loader. which of the two in better? any other suggestions?

    Read the article

  • Grails design for domain class initialization from static data

    - by Allison Eer
    I have some data, stateNames, to instantiate an instance of the object Country. Right now, I will only have one Country but stateNames for each country should be different. What is the best way to instantiate the instance of Country with my data? I am new to grails and would appreciate any "best practices" or common designs. One solution I can think of is to use BootStrap to save the unitedStates instance of Country to the database. What are the cons of this approach? Another solution would be to save the data in a file (in xml?) under web-app folder. If I did this approach, should the unitedStates instance of Country be instantiated by a controller?

    Read the article

  • C++ design question, container of instances and pointers

    - by Tom
    Hi all, Im wondering something. I have class Polygon, which composes a vector of Line (another class here) class Polygon { std::vector<Line> lines; public: const_iterator begin() const; const_iterator end() const; } On the other hand, I have a function, that calculates a vector of pointers to lines, and based on those lines, should return a pointer to a Polygon. Polygon* foo(Polygon& p){ std::vector<Line> lines = bar (p.begin(),p.end()); return new Polygon(lines); } Here's the question: I can always add a Polygon (vector Is there a better way that dereferencing each element of the vector and assigning it to the existing vector container? //for line in vector<Line*> v //vcopy is an instance of vector<Line> vcopy.push_back(*(v.at(i)) I think not, but I dont really like that approach. Hopefully, I will be able to convince the author of the class to change it, but I cant base my coding right now to that fact (and i'm scared of a performance hit). Thanks in advance.

    Read the article

  • C++ design question, container of instances and pointers

    - by Tom
    Hi all, Im wondering something. I have class Polygon, which composes a vector of Line (another class here) class Polygon { std::vector<Line> lines; public: const_iterator begin() const; const_iterator end() const; } On the other hand, I have a function, that calculates a vector of pointers to lines, and based on those lines, should return a pointer to a Polygon. Polygon* foo(Polygon& p){ std::vector<Line> lines = bar (p.begin(),p.end()); return new Polygon(lines); } Here's the question: I can always add a Polygon (vector Is there a better way that dereferencing each element of the vector and assigning it to the existing vector container? //for line in vector<Line*> v //vcopy is an instance of vector<Line> vcopy.push_back(*(v.at(i)) I think not, but I dont really like that approach. Hopefully, I will be able to convince the author of the class to change it, but I cant base my coding right now to that fact (and i'm scared of a performance hit). Thanks in advance.

    Read the article

  • Beginner Design pattern question (Web Services involved)

    - by zombie
    Hi all ! I am a noob to web services world. I need to develop a login validator module and expose it as a service. I want it to be service independent, i.e I should have the option of exposing it as a SOAP service or REST service in the future. What pattern should I follow ? Sorry if I am unclear in my requirements, I can clarify as per need. Thanks !! Edit : I am using Eclipse as an IDE and Jersey libraries. I am not into any framework, simply using the MVC pattern. I find a lot of difference between SOAP ann REST methods, so I want my methods to be implementation independent - i.e I should be easily able to use my method through a SOAP or REST service call as per need. What should I do for maximum flexibility ?

    Read the article

  • C# Design Reduce a Long List of Methods

    - by guazz
    I have a simple application that loads data from an XML file to a database. public class EmployeeLoader() { public void LoadEmpoyees() {...} public void LoadSalaries() {...} public void LoadRegistrationData() {...} public void LoadTaxData() {...} } Is it a good idea to have multiple "Load" methods as this looks like a code smell as I have about tweney Load methods? If so, how do I make my code more readable? Each Load method loads data to the corresponding table in the database via a repository?

    Read the article

  • C++ design with static methods

    - by user231536
    I would like to define as class X with a static method: class X { static string get_type () {return "X";} //other virtual methods } I would like to force classes which inherit from X to redefine the get_type() method and return strings different from "X" (I am happy if they just redefine get_type for now). How do I do this? I know that I cannot have virtual static methods. Edit: The question is not about the type_id, but in general about a static method that should be overriden. For example class X { static int getid() {return 1;} }

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >