Search Results

Search found 17940 results on 718 pages for 'algorithm design'.

Page 19/718 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • User account design and security...

    - by espinet
    Before I begin, I am using Ruby on Rails and the Devise gem for user authentication. Hi, I was doing some research about account security and I found a blog post about the topic awhile ago but I can no longer find it again. I read something about when making a login system you should have 1 model for User, this contains a user's username, encrypted password, and email. You should also have a model for a user's Account. This contains everything else. A User has an Account. I don't know if I'm explaining this correctly since I haven't seen the blog post for several months and I lost my bookmark. Could someone explain how and why I should or shouldn't do this. My application deals with money so I need to cover my bases with security. Thanks.

    Read the article

  • Schema design: many to many plus additional one to many

    - by chrisj
    Hi, I have this scenario and I'm not sure exactly how it should be modeled in the database. The objects I'm trying to model are: teams, players, the team-player membership, and a list of fees due for each player on a given team. So, the fees depend on both the team and the player. So, my current approach is the following: **teams** id name **players** id name **team_players** id player_id team_id **team_player_fees** id team_players_id amount send_reminder_on Schema layout ERD In this schema, team_players is the junction table for teams and players. And the table team_player_fees has records that belong to records to the junction table. For example, playerA is on teamA and has the fees of $10 and $20 due in Aug and Feb. PlayerA is also on teamB and has the fees of $25 and $25 due in May and June. Each player/team combination can have a different set of fees. Questions: Are there better ways to handle such a scenario? Is there a term for this type of relationship? (so I can google it) Or know of any references with similar structures?

    Read the article

  • General ORM design question

    - by Calvin
    Suppose you have 2 classes, Person and Rabbit. A person can do a number of things to a rabbit, s/he can either feed it, buy it and become its owner, or give it away. A rabbit can have none or at most 1 owner at a time. And if it is not fed for a while, it may die. Class Person { Void Feed(Rabbit r); Void Buy(Rabbit r); Void Giveaway(Person p, Rabbit r); Rabbit[] rabbits; } Class Rabbit { Bool IsAlive(); Person pwner; } There are a couple of observations from the domain model: Person and Rabbit can have references to each other Any actions on 1 object can also change the state of the other object Even if no explicit actions are invoked, there can still be a change of state in the objects (e.g. Rabbit can be starved to death, and that causes it to be removed from the Person.rabbits array) As DDD is concerned, I think the correct approach is to synchronize all calls that may change the states in the domain model. For instance, if a Person buys a Rabbit, s/he would need to acquire a lock in Person to make a change to the rabbits array AND also another lock in Rabbit to change its owner before releasing the first one. This would prevent a race condition where 2 Persons claim to be the owner of the little Rabbit. The other approach is to let the database to handle all these synchronizations. Who makes the first call wins, but then the DB needs to have some kind of business logics to figure out if it is a valid transaction (e.g. if a Rabbit already has an owner, it cannot change its owner unless the Person gives it away). There are both pros/cons in either approach, and I’d expect the “best” solution would be somewhere in-between. How would you do it in real life? What’s your take and experience? Also, is it a valid concern that there can be another race condition the domain model has committed its change but before it is fully committed in the database? And for the 3rd observation (i.e. state change due to time factor). How will you do it?

    Read the article

  • How to better design it ???

    - by Deepak
    public interface IBasePresenter { } public interface IJobViewPresenter : IBasePresenter { } public interface IActivityViewPresenter : IBasePresenter { } public class BaseView { public IBasePresenter Presenter { get; set; } } public class JobView : BaseView { public IJobViewPresenter JobViewPresenter { get { this.Presenter as IJobViewPresenter;} } } public class ActivityView : BaseView { public IActivityViewPresenter ActivityViewPresenter { get { this.Presenter as IActivityViewPresenter;} } } Lets assume that I need a IBasePresenter property on BaseView. Now this property is inherited by JobView and ActivityView but if I need reference to IJobViewPresenter object in these derived classes then I need to type cast IBasePresenter property to IJobViewPresenter or IActivityPresenter (which I want to avoid) or create JobViewPresenter and ActivityViewPresenter on derived classes (as shown above). I want to avoid type casting in derived classes and still have reference to IJobViewPresenter or IActivityViewPresenter and still have IBasePresenter in BaseView. Is there a way I can achieve it ?

    Read the article

  • Project design / FS layout for large django projects

    - by rcreswick
    What is the best way to layout a large django project? The tutuorials provide simple instructions for setting up apps, models, and views, but there is less information about how apps and projects should be broken down, how much sharing is allowable/necessary between apps in a typical project (obviously that is largely dependent on the project) and how/where general templates should be kept. Does anyone have examples, suggestions, and explanations as to why a certain project layout is better than another? I am particularly interested in the incorporation of large numbers of unit tests (2-5x the size of the actual code base) and string externalization / templates.

    Read the article

  • Exploring the Factory Design Pattern

    - by asksuperuser
    There was an article here: http://msdn.microsoft.com/en-us/library/Ee817667%28pandp.10%29.aspx The first part of tut implemented this pattern with abstract classes. The second part shows an example with Interface class. But nothing in this article discusses why this pattern would rather use abstract or interface. So what explanation (advantages of one over the other) would you give ? Not in general but for this precise pattern.

    Read the article

  • Design issue with ATG CommercePipelineManager

    - by user1339772
    The definition of runProcess() method in PipelineManager is public PipelineResult runProcess(String pChainId, Object pParam) throws RunProcessException This gives me an impression that ANY object can be passed as the second param. However, ATG OOTB has PipelineManager component referring to CommercePipelineManager class which overrides the runProcess() method and downcast pParam to map and adds siteId to it. Basically, this enforces the client code to send only Map. Thus, if one needs to create a new pipeline chain, has to use map as data structure to pass on the data. Offcourse, one can always get around this by creating a new PipelineManager component, but I was just wondering the thought behind explicitly using map in CommercePipelineManager

    Read the article

  • Repository Design Pattern Guidance

    - by thefactor
    Let's say you have an MVVM CRM application. You have a number of customer objects in memory, through a repository. What would be the appropriate place to handle tasks that aren't associated with traditional MVVM tasks from a GUI? For example, let's say every few minutes you want to check to see if their address is valid and pop up a notification if it is not. Or you want to send out an hourly e-mail update. Or you want a window to pop up to remind you to call a customer at a specific time. Where does this logic go? It's not GUI/action-oriented, and it's not logic that would be appropriate for a repository, I think.

    Read the article

  • Domain-Driven-Design question

    - by Michael
    Hello everyone, I have a question about DDD. I'm building a application to learn DDD and I have a question about layering. I have an application that works like this: UI layer calls = Application Layer - Domain Layer - Database Here is a small example of how the code looks: //****************UI LAYER************************ //Uses Ioc to get the service from the factory. //This factory would be in the MyApp.Infrastructure.dll IImplementationFactory factory = new ImplementationFactory(); //Interface and implementation for Shopping Cart service would be in MyApp.ApplicationLayer.dll IShoppingCartService service = factory.GetImplementationFactory<IShoppingCartService>(); //This is the UI layer, //Calling into Application Layer //to get the shopping cart for a user. //Interface for IShoppingCart would be in MyApp.ApplicationLayer.dll //and implementation for IShoppingCart would be in MyApp.Model. IShoppingCart shoppingCart = service.GetShoppingCartByUserName(userName); //Show shopping cart information. //For example, items bought, price, taxes..etc ... //Pressed Purchase button, so even for when //button is pressed. //Uses Ioc to get the service from the factory again. IImplementationFactory factory = new ImplementationFactory(); IShoppingCartService service = factory.GetImplementationFactory<IShoppingCartService>(); service.Purchase(shoppingCart); //**********************Application Layer********************** public class ShoppingCartService : IShoppingCartService { public IShoppingCart GetShoppingCartByUserName(string userName) { //Uses Ioc to get the service from the factory. //This factory would be in the MyApp.Infrastructure.dll IImplementationFactory factory = new ImplementationFactory(); //Interface for repository would be in MyApp.Infrastructure.dll //but implementation would by in MyApp.Model.dll IShoppingCartRepository repository = factory.GetImplementationFactory<IShoppingCartRepository>(); IShoppingCart shoppingCart = repository.GetShoppingCartByUserName(username); //Do shopping cart logic like calculating taxes and stuff //I would put these in services but not sure? ... return shoppingCart; } public void Purchase(IShoppingCart shoppingCart) { //Do Purchase logic and calling out to repository ... } } I've seem to put most of my business rules in services rather than the models and I'm not sure if this is correct? Also, i'm not completely sure if I have the laying correct? Do I have the right pieces in the correct place? Also should my models leave my domain model? In general I'm I doing this correct according DDD? Thanks!

    Read the article

  • Is there a design pattern for this ?

    - by ytrewq
    I have a component that needs to call a specific service depending on the input it receives. So my component has to look at the input and based on a configuration that says "for this input call this service with this data" needs to call the proper service. The services have a common signature method and a specific one (each). I thought about an abstract class that includes the signatures for all three methods. The implementation for the two services will override all three methods (throwing NotImplementedException for the methods that are not supported by current service). A component that could be initialized with a map (that for each input type will have the type of the service to be called) will also be defined. Do you have a better approach to cope this scenario ?

    Read the article

  • Object model design choice

    - by spinon
    I am currently working on a ASP.NET MVC reporting application using C#. This is a redesign from a PHP application that was just initially thrown together and is now starting to gain some more traction. SowWe are in the process of reworking the backend to have a more OO approach. One of the descisions I am currently wrestling with is how to structure the domain objects. Since 95% of the site is readonly I am not sure if the typical approaches are practical. Should I create domain objects for the primary pieces of the application (ticket, assignment, assignee) and then create static methods off of these areas to pull the reporting data? Or should I just skip that part and create the chart data classes and have some get method off of these classes? It's not a real big application and currenlty I am the only one developing on it. But I feel torn as to which approach. I feel that the first one is the better choice but maybe overkill given that the majority of uses is for aggregate reporting. Anybody have some good insight on why I should go one way or another?

    Read the article

  • Looking for an appropriate design pattern

    - by user1066015
    I have a game that tracks user stats after every match, such as how far they travelled, how many times they attacked, how far they fell, etc, and my current implementations looks somewhat as follows (simplified version): Class Player{ int id; public Player(){ int id = Math.random()*100000; PlayerData.players.put(id,new PlayerData()); } public void jump(){ //Logic to make the user jump //... //call the playerManager PlayerManager.jump(this); } public void attack(Player target){ //logic to attack the player //... //call the player manager PlayerManager.attack(this,target); } } Class PlayerData{ public static HashMap<int, PlayerData> players = new HashMap<int,PlayerData>(); int id; int timesJumped; int timesAttacked; } public void incrementJumped(){ timesJumped++; } public void incrementAttacked(){ timesAttacked++; } } Class PlayerManager{ public static void jump(Player player){ players.get(player.getId()).incrementJumped(); } public void incrementAttacked(Player player, Player target){ players.get(player.getId()).incrementAttacked(); } } So I have a PlayerData class which holds all of the statistics, and brings it out of the player class because it isn't part of the player logic. Then I have PlayerManager, which would be on the server, and that controls the interactions between players (a lot of the logic that does that is excluded so I could keep this simple). I put the calls to the PlayerData class in the Manager class because sometimes you have to do certain checks between players, for instance if the attack actually hits, then you increment "attackHits". The main problem (in my opinion, correct me if I'm wrong) is that this is not very extensible. I will have to touch the PlayerData class if I want to keep track of a new stat, by adding methods and fields, and then I have to potentially add more methods to my PlayerManager, so it isn't very modulized. If there is an improvement to this that you would recommend, I would be very appreciative. Thanks.

    Read the article

  • How to program for constraints/rules

    - by Gaurav
    First the background, during interviews in the past, many times I have been asked to design some or other variation of card game as programming puzzle, and I have tried to design it in OO way, but I have never been satisfied with my solutions. However it was not until recently that I realized that I had been approaching the problem from the wrong direction. Specifically I was trying to solve the problem by modeling individual card as an object. Problem with this is individual cards don't have any non-trivial intrinsic behavior and therefore are not suitable (or primary) candidate as objects. What is interesting and important about cards are rules and constraints, such as there could be only four suits, or only thirteen cards in each suit. Of course, then there are any number of rules for games. So my questions are Are there any idioms/constructs/patterns to program for rules & constraints. How many in 1 can be applied in conjunction with OO paradigm.

    Read the article

  • Advice on designing a robust program to handle a large library of meta-information & programs

    - by Sam Bryant
    So this might be overly vague, but here it is anyway I'm not really looking for a specific answer, but rather general design principles or direction towards resources that deal with problems like this. It's one of my first large-scale applications, and I would like to do it right. Brief Explanation My basic problem is that I have to write an application that handles a large library of meta-data, can easily modify the meta-data on-the-fly, is robust with respect to crashing, and is very efficient. (Sorta like the design parameters of iTunes, although sometimes iTunes performs more poorly than I would like). If you don't want to read the details, you can skip the rest Long Explanation Specifically I am writing a program that creates a library of image files and meta-data about these files. There is a list of tags that may or may not apply to each image. The program needs to be able to add new images, new tags, assign tags to images, and detect duplicate images, all while operating. The program contains an image Viewer which has tagging operations. The idea is that if a given image A is viewed while the library has tags T1, T2, and T3, then that image will have boolean flags for each of those tags (depending on whether the user tagged that image while it was open in the Viewer). However, prior to being viewed in the Viewer, image A would have no value for tags T1, T2, and T3. Instead it would have a "dirty" flag indicating that it is unknown whether or not A has these tags or not. The program can introduce new tags at any time (which would automatically set all images to "dirty" with respect to this new tag) This program must be fast. It must be easily able to pull up a list of images with or without a certain tag as well as images which are "dirty" with respect to a tag. It has to be crash-safe, in that if it suddenly crashes, all of the tagging information done in that session is not lost (though perhaps it's okay to loose some of it) Finally, it has to work with a lot of images (10,000) I am a fairly experienced programmer, but I have never tried to write a program with such demanding needs and I have never worked with databases. With respect to the meta-data storage, there seem to be a few design choices: Choice 1: Invidual meta-data vs centralized meta-data Individual Meta-Data: have a separate meta-data file for each image. This way, as soon as you change the meta-data for an image, it can be written to the hard disk, without having to rewrite the information for all of the other images. Centralized Meta-Data: Have a single file to hold the meta-data for every file. This would probably require meta-data writes in intervals as opposed to after every change. The benefit here is that you could keep a centralized list of all images with a given tag, ect, making the task of pulling up all images with a given tag very efficient

    Read the article

  • Why use link classes in oql instead of classes that contain links

    - by Isaac
    itop abstracts its very complex database design with an object query language (oql). For this there are classes definded, like 'Ticket' and 'Server'. Now a Ticket usually is linked to a Server. In my naive way I would give the Ticket class an attribute 'affected_server_list', where I could reference the affected servers. itop does it different: neither Servers nor Tickets know of each other. Instead there is a class 'linkTicketToServer', which provides the link between the two. The first thing I noticed is that it makes oql queries more complex. So I wondered why they designed it this way. One thing that occured to me is that it allows for more flexiblity, in that I can add links without modifying the original classes. Is this allready why one would implement it this way, or are there other reasons for this kind of design?

    Read the article

  • Whatchamacallit: You know how there are breadcrumbs and sliders and whatnot

    - by Richard
    What do you call it when a web site (especially corporate/retail) has a series of rows with thumbnails, each with a little caption/description beneath explaining some benefit or feature of a product or service. Is there a name for this? I'm building a theme that incorporates this kind of design and I was hoping there is some kind of shorthand for this design feature. If you don't know what I'm talking about, check out one of the links below. http://themeforest.net/item/revolution-minimalist-business-html-template/full_screen_preview/2295335 http://themes.two2twelve.com/preview?theme=freshserve

    Read the article

  • Putting altered social media logo icons on my website, can I get sued?

    - by Håkan Bylund
    I would say most websites with a somewhat thought-through graphical design use social media icons (i.e twitter, facebook, youtube, et.c) which are altered to fit the theme and design of the site. Now, my boss insist we only use the ones provided by say facebook or twitter themselfes (in fear of getting sued or lose credability), but sometimes it just doesnt look very good on the site. What is the common practice for these things? What do you risk by using an altered logo? What should I tell my boss? I'll provide a few examples, what'd happen if I put any of these on a site?

    Read the article

  • Exposing warnings\errors from data objects (that are also list returned)

    - by Oren Schwartz
    I'm exposing Data objects via service oriented assembly (which on future usages might become a WCF service). The data object is tree designed, as well as formed from allot of properties.Moreover, some services return one objects, others retrieve a list of them (thus disables throwing exceptions). I now want to expose data flow warnings and wondering what's the best way to do it having to things to consider: (1) seperation (2) ease of access. On the one hand, i want the UI team to be able to access a fields warnings (or errors) without having them mapping the field names to an external source but on the other hand, i don't want the warnings "hanged" on the object itself (as i don't see it a correct design). I tought of creating a new type of wrapper for each field, that'll expose events and they'll have to register the one's they care about (but totally not sure) I'll be happy to hear your thoughts. Could you please direct me to a respectful design pattern ? what dp will do best here ? Thank you very much!

    Read the article

  • How to avoid code duplication for a system which has logic that may change year wise?

    - by aravind
    What would be the way to design a system which has logic that may change year wise? There is an application which conducts online exams. There are five questions for a particular subject. The questions may (or may not) change year wise. As per my current design, the questions in database are stored year wise. There are some year specific code logic as well. In order to enable the application for another year, the year specific database records and code will be copied or duplicated. How to avoid this code duplication?

    Read the article

  • Using packages (gems, eggs, etc.) to create decoupled architectures

    - by Juan Carlos Coto
    The main issue Seeing the good support most modern programming platforms have for package management (think gem, npm, pip, etc), does it make sense to design an application or system be composed of internally developed packages, so as to promote and create a loosely coupled architecture? Example An example of this would be to create packages for database access, as well as for authentication and other components of the system. These, of course, use external packages as well. Then, your system imports and uses these packages - instead of including their code within its own code base. Considerations To me, it seems that this would promote code decoupling and help maintainability, almost in a Web-based-vs.-desktop-application kind of way (updates are applied almost automatically, single code base for single functionality, etc.). Does this seem like a rational and sane design concept? Is this actually used as a standard way of structuring applications today? Thanks very much!

    Read the article

  • How do web-developers do web-design when freelancing?

    - by Gerald Blizz
    So I got my first job recently as junior web-developer. My company creates small/medium sites for wide variety of customers: autobusiness companies, weddign agencies, some sauna websites, etcetc, hope you get my point. They don't do big serious stuff like bank systems or really big systems, it's mostly small/medium-sized websites for startups/medium sized business. My main skills are PHP/MySQL, I also know HTML and a bit of CSS/JS/AJAX. I know that good web-developer must know some backend language (like PHP/Ruby/Python) AND HTML+CSS+JS+AJAX+JQuery combo. However, I was always wondering. In my company we have web-designer. In other serious organisations I often see the same stuff: web-developers who create business-logic and web-designers, who create design. As far as I know, after designers paint design of website they give it to developers either in PSD or sliced way, and developers put it together with logic, but design is NOT created by developers. Such separation seems very good for full-time job, but I am concerned with question how do freelance web-developers do websites? Do most of them just pay freelance designers to create design for them? Or do some people do both? Reason why I ask - I plan to start some freelancing in my free time after I get good at web-development. But I don't want to create websites with great business-logic but poor design. Neither I want to let someone else create a design for me. I like web-development very much and I am doing quite good, I like design aswell, even though I am a bit lost how to study it and get better at it. But I am scared that going in both directions won't let me become expert, it seems like two totally different jobs and getting really good in both seems very hard. But I really want to do both. What should I do? Thank you!

    Read the article

  • tdd is about design not verification what does it concretely mean?

    - by sigo
    I've been wondering about this. What do we exactly mean by design and verification. Should I just apply tdd to make sure my code is SOLID and not check is correct external behaviour ? Should I use Bdd for the correct behaviour part ? Where I get confused also is regarding TDD code katas, to me they looked like more about verification than design... shouldn't they be called bdd katas instead of tdd katas? I reckon that for example uncle bob bowling kata leads in the end to a simple and nice internal design but I felt that most of the process was more around vérification than design. Design seemed to be a side effect of testing incrementally the external behaviour. I didnt feel so much that we were focusing most of our efforts on design but more on vérification. While normally we are told the contrary, that in TDD, verification is a side effect, design is the main purpose. So my question is what should i focus exactly on when i do tdd: SOLID, external Api usability, what else...? And how can I do that without being focused on verification ? What do you guys focus your energy on when you are practicing TDD ?

    Read the article

  • "TDD is about design, not verification"; concretely, what does that mean?

    - by sigo
    I've been wondering about this. What do we exactly mean by design and verification. Should I just apply TDD to make sure my code is SOLID and not check if it's external behaviour is correct? Should I use BDD for verifying the behaviour is correct? Where I get confused also is regarding TDD code Katas, to me they looked like more about verification than design; shouldn't they be called BDD Katas instead of TDD Katas? I reckon that for example the Uncle Bob bowling Kata leads in the end to a simple and nice internal design but I felt that most of the process was centred more around verification than design. Design seemed to be a side effect of testing the external behaviour incrementally. I didn't feel so much that we were focusing most of our efforts on design but more on verification. While normally we are told the contrary, that in TDD, verification is a side effect, design is the main purpose. So my question is what should I focus on exactly, when I do TDD: SOLID, external API usability, or something else? And how can I do that without being focused on verification? What do you guys focus your energy on when you are practising TDD?

    Read the article

  • isometric drawing order with larger than single tile images - drawing order algorithm?

    - by Roger Smith
    I have an isometric map over which I place various images. Most images will fit over a single tile, but some images are slightly larger. For example, I have a bed of size 2x3 tiles. This creates a problem when drawing my objects to the screen as I get some tiles erroneously overlapping other tiles. The two solutions that I know of are either splitting the image into 1x1 tile segments or implementing my own draw order algorithm, for example by assigning each image a number. The image with number 1 is drawn first, then 2, 3 etc. Does anyone have advice on what I should do? It seems to me like splitting an isometric image is very non obvious. How do you decide which parts of the image are 'in' a particular tile? I can't afford to split up all of my images manually either. The draw order algorithm seems like a nicer choice but I am not sure if it's going to be easy to implement. I can't solve, in my head, how to deal with situations whereby you change the index of one image, which causes a knock on effect to many other images. If anyone has an resources/tutorials on this I would be most grateful.

    Read the article

  • How to design database for tests in online test application

    - by Kien Thanh
    I'm building an online test application, the purpose of app is, it can allow teacher create courses, topics of course, and questions (every question has mark), and they can create tests for students and students can do tests online. To create tests of any courses for students, first teacher need to create a test pattern for that course, test pattern actually is a general test includes the number of questions teacher want it has, then from that test pattern, teacher will generate number of tests corresponding with number of students will take tests of that course, and every test for student will has different number of questions, although the max mark of test in every test are the same. Example if teacher generate tests for two students, the max mark of test will be 20, like this: Student A take test with 20 questions, student B take test only has 10 questions, it means maybe every question in test of student A only has mark is 1, but questions in student B has mark is 2. So 20 = 10 x 2, sorry for my bad English but I don't know how to explain it better. I have designed tables for: - User (include students and teachers account) - Course - Topic - Question - Answer But I don't know how to define associations between user and test pattern, test, question. Currently I only can think these: Test pattern table: name, description, dateStart, dateFinish, numberOfMinutes, maxMarkOfTest Test table: test_pattern_id And when user (is Student) take tests, I think i will have one more table: Result: user_id, test_id, mark but I can't set up associations among test pattern and test and question. How to define associations?

    Read the article

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