Search Results

Search found 14326 results on 574 pages for 'design by contract'.

Page 17/574 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Interfaces, Adapters, exposing business objects via WCF design

    - by Onam
    I know there have been countless discussions about this but I think this question is slightly different and may perhaps prompt a heated discussion (lets keep it friendly). The scene: I am developing a system as a means for me to learn various concepts and I came across a predicament which my brain is conflicting with. That is whether to keep my interfaces in a separate class library or should they live side by side my business objects. I want to expose certain objects via WCF, however refuse to expose them in its entirety. I am sure most will agree exposing properties such as IDs and other properties is not good practice but also I don't want to have my business objects decorated with attributes. The question: Essentially, I'll be having a separate interface for each of my objects that will essentially be exposed to the outside world (could end up being quite a few) so does it make sense to create a separate class library for interfaces? This also brings up the question of whether adapters should live in a separate class library too as ideally I want a mechanism from transferring from one object to the other and vice versa?

    Read the article

  • The Template Method Design Pattern using C# .Net

    - by nijhawan.saurabh
    First of all I'll just put this pattern in context and describe its intent as in the GOF book:   Template Method: Define the skeleton of an algorithm in an operation, deferring some steps to Subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the Algorithm's Structure.    Usage: When you are certain about the High Level steps involved in an Algorithm/Work flow you can use the Template Pattern which allows the Base Class to define the Sequence of the Steps but permits the Sub classes to alter the implementation of any/all steps.   Example in the .Net framework: The most common example is the Asp.Net Page Life Cycle. The Page Life Cycle has a few methods which are called in a sequence but we have the liberty to modify the functionality of any of the methods by overriding them.   Sample implementation of Template Method Pattern:   Let's see the class diagram first:            Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt; mso-ligatures:standard;}   And here goes the code:EmailBase.cs     1 using System;     2 using System.Collections.Generic;     3 using System.Linq;     4 using System.Text;     5 using System.Threading.Tasks;     6      7 namespace TemplateMethod     8 {     9     public abstract class EmailBase    10     {    11     12         public bool SendEmail()    13         {    14             if (CheckEmailAddress() == true) // Method1 in the sequence    15             {    16                 if (ValidateMessage() == true) // Method2 in the sequence    17                 {    18                     if (SendMail() == true) // Method3 in the sequence    19                     {    20                         return true;    21                     }    22                     else    23                     {    24                         return false;    25                     }    26     27                 }    28                 else    29                 {    30                     return false;    31                 }    32     33             }    34             else    35             {    36                 return false;    37     38             }    39     40     41         }    42     43         protected abstract bool CheckEmailAddress();    44         protected abstract bool ValidateMessage();    45         protected abstract bool SendMail();    46     47     48     }    49 }    50    EmailYahoo.cs      1 using System;     2 using System.Collections.Generic;     3 using System.Linq;     4 using System.Text;     5 using System.Threading.Tasks;     6      7 namespace TemplateMethod     8 {     9     public class EmailYahoo:EmailBase    10     {    11     12         protected override bool CheckEmailAddress()    13         {    14             Console.WriteLine("Checking Email Address : YahooEmail");    15             return true;    16         }    17         protected override bool ValidateMessage()    18         {    19             Console.WriteLine("Validating Email Message : YahooEmail");    20             return true;    21         }    22     23     24         protected override bool SendMail()    25         {    26             Console.WriteLine("Semding Email : YahooEmail");    27             return true;    28         }    29     30     31     }    32 }    33   EmailGoogle.cs      1 using System;     2 using System.Collections.Generic;     3 using System.Linq;     4 using System.Text;     5 using System.Threading.Tasks;     6      7 namespace TemplateMethod     8 {     9     public class EmailGoogle:EmailBase    10     {    11     12         protected override bool CheckEmailAddress()    13         {    14             Console.WriteLine("Checking Email Address : GoogleEmail");    15             return true;    16         }    17         protected override bool ValidateMessage()    18         {    19             Console.WriteLine("Validating Email Message : GoogleEmail");    20             return true;    21         }    22     23     24         protected override bool SendMail()    25         {    26             Console.WriteLine("Semding Email : GoogleEmail");    27             return true;    28         }    29     30     31     }    32 }    33   Program.cs      1 using System;     2 using System.Collections.Generic;     3 using System.Linq;     4 using System.Text;     5 using System.Threading.Tasks;     6      7 namespace TemplateMethod     8 {     9     class Program    10     {    11         static void Main(string[] args)    12         {    13             Console.WriteLine("Please choose an Email Account to send an Email:");    14             Console.WriteLine("Choose 1 for Google");    15             Console.WriteLine("Choose 2 for Yahoo");    16             string choice = Console.ReadLine();    17     18             if (choice == "1")    19             {    20                 EmailBase email = new EmailGoogle(); // Rather than newing it up here, you may use a factory to do so.    21                 email.SendEmail();    22     23             }    24             if (choice == "2")    25             {    26                 EmailBase email = new EmailYahoo(); // Rather than newing it up here, you may use a factory to do so.    27                 email.SendEmail();    28             }    29         }    30     }    31 }    32    Final Words: It's very obvious that why the Template Method Pattern is a popular pattern, everything at last revolves around Algorithms and if you are clear with the steps involved it makes real sense to delegate the duty of implementing the step's functionality to the sub classes. Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt; mso-ligatures:standard;}

    Read the article

  • The best tile based level design [on hold]

    - by ReallyGoodPie
    My current method for tile based levels is to put everything in an array like the following: grass = g sky = s house = h ... """ ["SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"], ["SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"], ["HHHHHHHHHHHHHHSSSSSSSSSSSSSSSS"], ["GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"], """ I would then run a for loop to pass these on to a sprite class, bliting the images to the screen. This is what I'd generally do in pygame when I am creating levels for a tile based RPG's. However, as I've gone on, I have added allot more sprites and image and it is seriously becoming more and more confusing to work with this and allot of mistakes are being made. What is the best alternative or other methods for doing this?

    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

  • Website design reviews and advice [closed]

    - by dotman14
    I have developed a website for a non-profit organisation, and after a while I constantly get bad reviews on how my CSS is. Most of them don't really say what the problem is or how I can manage to redo or make amends to it. Please what do you advice that I do in this case to make it look better. Please feel free to migrate the question to the appropriate SO site, if this question does not belong here. Thank you.

    Read the article

  • Is there a design pattern for chained observers?

    - by sharakan
    Several times, I've found myself in a situation where I want to add functionality to an existing Observer-Observable relationship. For example, let's say I have an Observable class called PriceFeed, instances of which are created by a variety of PriceSources. Observers on this are notified whenever the underlying PriceSource updates the PriceFeed with a new price. Now I want to add a feature that allows a (temporary) override to be set on the PriceFeed. The PriceSource should still update prices on the PriceFeed, but for as long as the override is set, whenever a consumer asks PriceFeed for it's current value, it should get the override. The way I did this was to introduce a new OverrideablePriceFeed that is itself both an Observer and an Observable, and that decorates the actual PriceFeed. It's implementation of .getPrice() is straight from Chain of Responsibility, but how about the handling of Observable events? When an override is set or cleared, it should issue it's own event to Observers, as well as forwarding events from the underlying PriceFeed. I think of this as some kind of a chained observer, and was curious if there's a more definitive description of a similar pattern.

    Read the article

  • Game World Design [on hold]

    - by GameDev
    I have one doubt about world game developing. I want to do a kind of platform game mixed with RPG (Side Scroll). What's the best to draw the world, - Draw everything than use the camera to move around the world - Draw just what you see as the player moves draw the new stuff. I'm new at this and didn't had any course for it. So if anyone can help me thanks :) PS: Any recommendation to learning game concept, like drawing world theory, play etc.. (not code and i want to 2D and i only see books for 3D stuff)

    Read the article

  • Class design, One class in two sources

    - by Pavla
    Is it possible define methods from the same class in different "CPP" files? I have header file "myClass.h" with: class myClass { public: // methods for counting ... // methods for other ... }; I would like to define "methods for counting" in one CPP and "methods for other" in other CPP. For clarity. Both groups of methods sometime use the same attributes. Is it possible? Thanks :).

    Read the article

  • Design of input files reading when it comes to defaults/transformations

    - by Stefano Borini
    Suppose you have an application that reads an input file, on a language that does not support the concept of None. The input is read, parsed, and the contents are stored on a structure for later use. Now, in general you want to keep into account transformation of the data from the input, such as adding default values when not specified, or adding full path information to relative path specified in the input. There are two different strategies to achieve this. The first strategy is to perform these transformations at input file reading time. In practice, you put all the intelligence into the input parser, and your application has no logic to deal with unexpected circumstances, such as an unspecified value. You lose the information of what was specified and what wasn't, but you gain in black-boxing the details. Your "running code" needs that information in any case and in a proper form, and is not concerned if it's the default or a user-specified information. The second strategy is to have the file reader a real one-to-one mapper from the file to a memory-stored object, with no intelligent behavior. unspecified values are not filled (which may however be a problem in languages not supporting None) and data is stored verbatim from the file. The intelligence for recovery must now go into the "running code", which must check what was specified in the file, eventually fall back to a default, or modify the input properly before using it. I would like to know your opinion on these two approaches, and in particular which one you found the most frequently implemented.

    Read the article

  • Difference between Factory Method and Abstract Factory design patterns using C#.Net

    - by nijhawan.saurabh
    First of all I'll just put both these patterns in context and describe their intent as in the GOF book: Factory Method: Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.   Abstract Factory: Provide an interface for creating families of related or dependent objects without specifying their concrete classes.   Points to note:   Abstract factory pattern adds a layer of abstraction to the factory method pattern. The type of factory is not known to the client at compile time, this information is passed to the client at runtime (How it is passed is again dependent on the system, you may store this information in configuration files and the client can read it on execution). While implementing Abstract factory pattern, the factory classes can have multiple factory methods. In Abstract factory, a factory is capable of creating more than one type of product (Simpilar products are grouped together in a factory)   Sample implementation of factory method pattern   Let's see the class diagram first:                   ProductFactory.cs // ----------------------------------------------------------------------- // <copyright file="ProductFactory.cs" company=""> // TODO: Update copyright text. // </copyright> // -----------------------------------------------------------------------   namespace FactoryMethod {     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;       /// <summary>     /// TODO: Update summary.     /// </summary>     public abstract class ProductFactory     {         /// <summary>         /// </summary>         /// <returns>         /// </returns>         public abstract Product CreateProductInstance();     } }     ProductAFactory.cs // ----------------------------------------------------------------------- // <copyright file="ProductAFactory.cs" company=""> // TODO: Update copyright text. // </copyright> // -----------------------------------------------------------------------   namespace FactoryMethod {     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;       /// <summary>     /// TODO: Update summary.     /// </summary>     public class ProductAFactory:ProductFactory     {         public override Product CreateProductInstance()         {             return new ProductA();         }     } }         // ----------------------------------------------------------------------- // <copyright file="ProductBFactory.cs" company=""> // TODO: Update copyright text. // </copyright> // -----------------------------------------------------------------------   namespace FactoryMethod {     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;       /// <summary>     /// TODO: Update summary.     /// </summary>     public class ProductBFactory:ProductFactory     {         public override Product CreateProductInstance()         {             return new ProductB();           }     } }     // ----------------------------------------------------------------------- // <copyright file="Product.cs" company=""> // TODO: Update copyright text. // </copyright> // -----------------------------------------------------------------------   namespace FactoryMethod {     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;       /// <summary>     /// TODO: Update summary.     /// </summary>     public abstract class Product     {         public abstract string Name { get; set; }     } }     // ----------------------------------------------------------------------- // <copyright file="ProductA.cs" company=""> // TODO: Update copyright text. // </copyright> // -----------------------------------------------------------------------   namespace FactoryMethod {     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;       /// <summary>     /// TODO: Update summary.     /// </summary>     public class ProductA:Product     {         public ProductA()         {               Name = "ProductA";         }           public override string Name { get; set; }     } }       // ----------------------------------------------------------------------- // <copyright file="ProductB.cs" company=""> // TODO: Update copyright text. // </copyright> // -----------------------------------------------------------------------   namespace FactoryMethod {     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;       /// <summary>     /// TODO: Update summary.     /// </summary>     public class ProductB:Product     {          public ProductB()         {               Name = "ProductA";         }         public override string Name { get; set; }     } }     Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text;   namespace FactoryMethod {     class Program     {         static void Main(string[] args)         {             ProductFactory pf = new ProductAFactory();               Product product = pf.CreateProductInstance();             Console.WriteLine(product.Name);         }     } }       Normal 0 false false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

    Read the article

  • API Design Techniques

    - by Dehumanizer
    Is it right or more beautiful to name the functions with an prefix, like in Qt? Or using "many" namespaces, but 'normal' names for functions? For example, slOpenFile(); //"sl" means "some lib" vs some_lib::file_functions::openFile(); UPD: I've read somewhere that the first variant(using some prefix) is better, because the API users can perform 'fast' search among the documentation and in the Internet. E.g. by typing the magic prefix search engine starts to advice the exact functions. Is it enough to use the first variant?

    Read the article

  • Software design for non object oriented paradigm

    - by Dean
    I'm currently working on a project where I'm writing the firmware for an electronic system in C, and have been asked to produce documentation on the development/evolution of the software for the embedded devices. Having developed software in the object oriented paradigm I know to use UML to document the software such as class diagrams with objects, however this does not work for documenting the development of my embedded system. So what should I produce to document the development of my firmware?

    Read the article

  • Asynchronous update design/interaction patterns

    - by Andy Waite
    These days many apps support asynchronous updates. For example, if you're looking at a list of widgets and you delete one of them then rather than wait for the roundtrip to the server, the app can hide the one you deleted, giving immediate feedback. The actual deletion on the server will happen in the background. This can be seen in web apps, desktop apps, iOS apps, etc. But what about when the background operation fails. How should you feed back to the user? Should you restore the UI to the pre-deletion state? What about when multiple background operations fail together? Does this behaviour/pattern have a name? Perhaps something based on the Command pattern?

    Read the article

  • Design: classes with same implementation but different method names

    - by Dror Helper
    I have multiple classes that have similar implementation for different named methods: class MyClassX { public int MyClassXIntMethod(){} public string MyClassXStringMethod(){} } class MyClassY { public int MyClassYIntMethod(){} public string MyClassYStringMethod(){} } the methods inside the classes have similar implementation but because the method's names are different (due to 3rd party constraints) i cannot use inheritance. I'm looking for an elegant solution that would be better than implementing the same functionality over and over again.

    Read the article

  • Where to put business logic in MVC design?

    - by BriskLabs Pakistan
    I have created a simple MVC java application that adds records through data forms to a database. my app collects data, it also validates it and stores it. This is because the data is being sourced online from different users. the data is mostly numeric in nature. now on the numeric data being stored into database (SQL server) , i wish that my app should be able to perform computations... and display it. the user is not interested in how computations are done so they must be encapsulated. the user must only be able to view the simple computed data which for example A column data - B Column data / C column data etc... and just display it to the user... i know how to write stored procedures for same but i want a 3 tier app I want the data, that I put into the database as a record, worked upon by performing calculations on it. However, the original data should remain unaffected, while the new data, post-calculations, must be stored as a new entity record into the database. Where should I write the code for this background calculation? As it is the rules and business logic... in a new java beans files ?

    Read the article

  • MMORPG design for time-limited players

    - by Philipp
    I believe that there is a significant market of players who would enjoy the exploration and interaction aspects of MMORPGs, but simply don't have the time for the endless grinding marathons which are part of the average MMORPG. MMORPGs are all about interaction between players. But when different players have different amounts of time to invest into a game, those with less time to spend will soon lack behind their power-leveling friends and won't be able to interact with them anymore. One way to solve this would be to limit the progress a player can achieve per day, so that it simply doesn't make sense to play more than one or two hours a day. But even the busiest casual players sometimes like to spend a whole sunday afternoon playing a video game. Just stopping them after two hours would be really frustrating. It also creates a pressure to use the daily progress limit every day, because otherwise the player would feel like wasting something. This pressure would be detrimental for casual gamers. What else could be done to level the playing field between those players who play 40+ hours a week and those who can't play more than 10?

    Read the article

  • Facebook Game database design

    - by facebook-100000781341887
    Hi, I'm currently develop a facebook mafia like PHP game(of course, a light weight version), here is a simplify database(MySQL) of the game id-a <int3> <for index> uid <chr15> <facebook uid> HP <int3> <health point> exp <int3> <experience> money <int3> <money> list_inventory <chr5> <the inventory user hold...some special here, talk next> ... and 20 other fields just like reputation, num of combat... *the number next to the type is the size(byte) of the type For the list_inventory, there have 40 inventorys in my game, (actually, I have 5 these kind of list in my database), and each user can only contain 1 qty of each inventory, therefore, I assign 5 char for this field and each bit of char as 1 item(5 char * 8 bit = 40 slot), and I will do some manipulation by PHP to extract the data from this 5 byte. OK, I was thinking on this, if this game contains 100,000 user, and only 10% are active, therefore, if use my method, for the space use, 5 byte * 100,000 = 500 KB if I use another method, create a table user_hold_inventory, if the user have the inventory, then insert a record into this table, so, for 10,000 active user, I assume they got all item, but for other, I assume they got no item, here is the fields of the new table id-b <int3> <for index> id-a <int3> <id of the user table> inv_no <int1> <inventory that user hold> for the space use, ([id] (3+3) byte + [inv_no] 1 byte ) * [active user] 10,000 * [all inventory] * 40 = 2.8 MB seems method 2 have use more space, but it consume less CPU power. Please comment these 2 method or please correct me if there have another better method rather than what I think. Another question is, my database contain 26 fields, but I counted 5 of them are not change frquently, should I need to separate it on the other table or not? So many words, thanks for reading :)

    Read the article

  • How to deal with Character body parts from Design to Cocos2d

    - by Edwin Soho
    I'm trying to figure out the pattern the game developers use together with game designers: See the picture below with the independent parts: Questions: 1) Should I create different image parts from different body parts or keep frame by frame animaton? (I know both can be used, but I'm trying to figure what is commonly used in the industry) 2) If I'm going to generate different image parts from different body parts (which is I thing is more logical) how would I export that to Cocos2d (Vector or Bitmap)?

    Read the article

  • Design patterns for effects between actors and technology

    - by changelog
    I'm working on my first game, and taking the opportunity to brush up my C++ (I want to make as much of it as portable as I can.) Whilst working on the technology tree and how it affects actors (spaceships, planets, crew, buildings, etc) I can't find a pattern that decouples these entities enough to feel like a clean approach. Just as an idea, here's the type of effects these actors can have on one another (and techs too) An engineer inside a spaceship boosts its shield A hero in a spaceship in a fleet increases morale A technology improves spaceships' travel distance A building in a planet improves its production The best I can come up with is the Observer pattern, and basically manage it more or less manually (when a crew member enters a spaceship, fire the event; when a new building is built in a planet, fire the event, etc etc.) but it seems to be too tightly coupled to me. I would love to get some ideas about how to approach this better.

    Read the article

  • Should we consider code language upon design?

    - by Codex73
    Summary This question aims to conclude if an applications usage will be a consideration when deciding upon development language. What factors if any could be considered upon language writing could be taken into context. Application Type: Web Question Of the following popular languages, when should we use one or the other? What factors if any could be considered upon language writing could be taken into context. Languages PHP Ruby Python My initial thought is that language shouldn't be considered as much as framework. Things to consider on framework are scalability, usage, load, portability, modularity and many more. Things to consider on Code Writing maybe cost, framework stability, community, etc.

    Read the article

  • Optimal Database design regarding functionality of letting user share posts by other users

    - by codecool
    I want to implement functionality which let user share posts by other users similar to what Facebook and Google+ share button and twitter retweet. There are 2 choices: 1) I create duplicate copy of the post and have a column which keeps track of the original post id and makes clear this is a shared post. 2) I have a separate table shared post where I save the post id which is a foreign key to post id in post table. Talking in terms of programming basically I keep pointer to the original post in a separate table and when need to get post posted by user and also shared ones I do a left join on post and shared post table Post(post_id(PK), post_content, posted_by) SharedPost(post_id(FK to Post.post_id), sharing_user, sharedfrom(in case someone shares from non owners profile)) I am in favour of second choice but wanted to know the advice of experts out there? One thing more posts on my webapp will be more on the lines of facebook size not tweet size.

    Read the article

  • Need advice on framework design: how to make extending easy

    - by beginner_
    I'm creating a framework/library for a rather specific use-case (data type). It uses diverse spring components, including spring-data. The library has a set of entity classes properly set up and according service and dao layers. The main work or main benefit of the framework lies in the dao and service layer. Developers using the framework should be able to extend my entity classes to add additional fields they require. Therefore I made dao and service layer generic so it can be used by such extended entity classes. I now face an issue in the IO part of the framework. It must be able to import the according "special data type" into the database. In this part I need to create a new entity instance and hence need the actual class used. My current solution is to configure in spring a bean of the actual class used. The problem with this is that an application using the framework could only use 1 implementation of the entity (the original one from me or exactly 1 subclass but not 2 different classes of the same hierarchy. I'm looking for suggestions / desgins for solving this issue. Any ideas?

    Read the article

  • Android From Local DB (DAO) to Server sync (JSON) - Design issue

    - by Taiko
    I sync data between my local DB and a Server. I'm looking for the cleanest way to modelise all of this. I have a com.something.db package That contains a Data Helper and couple of DAO classes that represents objects stored in the db (I didn't write that part) com.something.db --public DataHelper --public Employee @DatabaseField e.g. "name" will be an actual column name in the DB -name @DatabaseField -salary etc... (all in all 50 fields) I have a com.something.sync package That contains all the implementation detail on how to send data to the server. It boils down to a ConnectionManager that is fed by different classes that implements a 'Request' interface com.something.sync --public interface ConnectionManager --package ConnectionManagerImpl --public interface Request --package LoginRequest --package GetEmployeesRequest My issue is, at some point in the sync process, I have to JSONise and de-JSONise my data (E.g. the Employee class). But I really don't feel like having the same Employee class be responsible for both his JSONisation and his actual representation inside the local database. It really doesn't feel right, because I carefully decoupled the rest, I am only stuck on this JSON thing. What should I do ? Should I write 3 Employee classes ? EmployeeDB @DatabaseField e.g. "name" will be an actual column name in the DB -name @DatabaseField -salary -etc... 50 fields EmployeeInterface -getName -getSalary -etc... 50 fields EmployeeJSON -JSON_KEY_NAME = "name" The JSON key happens to be the same as the table name, but it isn't requirement -name -JSON_KEY_SALARY = "salary" -salary -etc... 50 fields It feels like a lot of duplicates. Is there a common pattern I can use there ?

    Read the article

  • ASP.NET design not SOLID

    - by w0051977
    SOLID principles are described here: http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29 I am developing a large ASP.NET app. The previous developer created a few very large classes each with lots of different purposes. It is very difficult to maintain and extend. The classes are deployed to the web server along with the code behind files etc. I want to share a small amount of the app with another application. I am considering moving all of the classes of the ASP.NET web app to a DLL, so the small subset of functionality can be shared. I realise it would be better to only share the classes which contain code to be shared but because of the dependencies this is proving to be very difficult e.g. class A contains code that should be shared, however class A contains references to classes B, C, D, E, F, G etc, so class A cannot be shared on its own. I am planning to refactor the code in the future. As a temporary solution I am planning to convert all the classes into a single class library. Is this a bad idea and if so, is there an alternative? as I don't have time to refactor at the moment.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >