The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
98 views

Are the Repository Pattern and Active Record pattern compatible?

Currently I am developing a webapp where I have defined models implementing the Active Record pattern. Each model also is defined by an interface that specifies the Entity properties and makes it easy ...
1
vote
2answers
103 views

Is it a good idea to install more libraries than you need? [closed]

I decided to try Anaconda, it seems that too many large companies are using it. I was amazed by the number of libraries included by default installing: python-2.7.9-2 ... installing: ...
0
votes
1answer
50 views

JSP in Javascript file or multiple AJAX requests

I've been thinking about how I want to load my data for some checkboxes in an AngularJS app. I'm generating multiple checkboxes based on 2 JSON objects that are currenty hard-coded in the a Javascript ...
2
votes
2answers
89 views

Is it OK for an MVC view to request data from other sources than just the model?

I'm working in ASP.NET MVC, but this question is pretty much applicable to any MVC framework (and maybe even others). In a typical MVC application a request arrives at the controller, which then ...
2
votes
1answer
35 views

Queue rescheduling naming convention (Command pattern)

For my project I'm creating a queueing mechanism based on the Command Pattern, which can execute one of a number of jobs. Jobs can add other jobs to the queue or can be added by a human. Most of the ...
7
votes
1answer
208 views

Should I build undo stack in model or its wrapper?

I am building an application (Python/PyQt). The first-order item will be a tree view/model with many helper functions to add new items, move them around in the tree, etc.. Then I will have a main ...
5
votes
3answers
368 views

How to solve the Lava flow anti-pattern?

In this blog post, the author describes an anti-pattern called the "lava flow" In a nutshell, the lava flow anti-pattern happens when many programmers lead the development of an application, each of ...
5
votes
1answer
145 views

Is it poor decision making that using promises for GUI inputs?

So as you know the context: DOM with JavaScript, even though I think it is mostly a language agnostic issue (I know I put both language-agnostic and JavaScript tags, but it's only to let you see ...
0
votes
4answers
278 views

2 methods that are 75% the same? [closed]

I have code that violates the DRY principle and I would like to consolidate 2 methods as much as I can, but the problem I am facing is that they have some differences, I would say they are about 75% ...
0
votes
1answer
126 views

Why use the Singleton pattern over class functions and fields? [duplicate]

I'm going to start by saying that I understand that programming in mostly class functions and variables can be harmful to object-orientation, and that most of the time an instance is preferred. I'll ...
0
votes
3answers
209 views

Check a boolean before setting it in a loop, or just set it

I have a rather tight loop with the following check to see if balance had ever been positive: balance_null = True while (crazy_loop()): ... if 0.0 < balance: balance_null = False ...
2
votes
3answers
395 views

How to implement the repository pattern for an app that will change its database from sql to nosql on in couple of years?

I have been reading a lot about repository implementation. I am confused about which way to implement it for a project I am sure would change its data layer methods because of db migration from MS Sql ...
2
votes
3answers
682 views

Why is it a good practice to keep Javascript code in separate files?

In web development we are commonly used to keep Javascript code in separate files, but sometimes we need this Javascript code to manipulate server side data locally. For example, making an Ajax Call ...
4
votes
2answers
98 views

Is it a good idea to have a database row that represents an unknown value within a system [closed]

We have two systems, System A imports a list of sports events from system B, it only wants to import the events we will be providing live data for, the filter used to hide events that we are not ...
2
votes
1answer
70 views

Combining Patterns: Fluent Builder and Null Object Pattern

I am currently wrestling around with some GUI code where I have a table whose rows correspond to some object, let's say a Person object. When the table initializes, it fills the table with the Person ...
2
votes
2answers
260 views

TDD with repository pattern

In my new project, I decided to try with TDD. And in very beginning I encountered a problem. First thing that I want to do in my application is to give ability to read data from data source. For this ...
0
votes
1answer
324 views

Design Pattern for Cron/Schedule in MongoDB

I am looking for a good pattern to handle cron-type data in a MongoDB collection (or collections). I have been peeking at the O'Reilly book MongoDB Applied Design Patterns and poking around the ...
2
votes
1answer
110 views

In a Table Data Gateway, where do I put queries that use joins

The book Pattern of Enterprise Application Architecture has the following description over the Table Data Gateway pattern: “A Table Data Gateway holds all the SQL for accessing a single table or ...
0
votes
1answer
78 views

Does a create() method exist as part of a pattern? [closed]

Is there something special(i.e. a design pattern being related) to a method named create()? Background The case is, I often make some instances of objects (of the same class/prototype). These ...
4
votes
3answers
663 views

DDD, modularizing the application and domain layers without breaking the DIP

Quoting DDD theory: The application layer is thin in terms of domain logic - it merely coordinates the domain layer objects to perform the actual work. When it comes to modularization, and ...
0
votes
1answer
56 views

Control (avoid) changing fields with side-effects

I have been thinking about a design problem and possible solutions in my own. I am pretty sure I am not the first one to have noticed it, but I cannot google for it since I do not know the standard ...
1
vote
0answers
82 views

Decreasing MongoDB Load

I have some stream workers. They are listening to twitter stream and save into mongodb. I need to aggregate saved tweets for intermediate analyze result. I have analyzer workers. They are periodically ...
1
vote
1answer
104 views

Obsessed with filling hashmaps instead of using else if cascades or switch statements [duplicate]

Whenever I feel like choosing from a list of implementations I always prefer to fill a map first and then call whatever I need based on a parameter, instead of using switch or else if statements. ...
12
votes
5answers
2k views

What is the best way to initialize a child's reference to its parent?

I'm developing an object model that has lots of different parent/child classes. Each child object has a reference to its parent object. I can think of (and have tried) several ways to initialize the ...
2
votes
0answers
137 views

Callback pattern handling exceptions - Best practices in .NET 3.5

I am looking to implement the callback pattern with error handling such that error is caught and pass to the callback code with the response. Since I am using .NET 3.5, I cant use Task (TAP) pattern ...
0
votes
1answer
69 views

How to save entities relations using unit of work pattern

I use Unit of work pattern to commit all new, dirty, deleted entities to the DB (using a db_mapper). Example of entities are: Student and Class So Student->registerDirty() will add this entity to ...
-1
votes
1answer
240 views

Is class with callbacks a code smell in JavaScript? [closed]

When writing JavaScript (especially in node.js), I tend to use plain functions and callbacks. However, sometimes there's some context to share between some functions and I don't like to pass this ...
-1
votes
1answer
94 views

Best solution for future maintenance of a website with hardcoded ids, custom CMS using bad database design [duplicate]

Recently I was put into a position of a tech-lead on a very interesting project that I have been partially working for two years. This project carries a lot of legacy stuff with it even though we try ...
4
votes
2answers
91 views

Factors for choosing between using a wrapper library or issuing command line process from my web application

I have a Java web application that makes use of certain libraries for example: Ghost Script for converting PDFs to TIFFs and Tesseract for OCR. There are java wrappers for both of these: Ghost4J and ...
0
votes
2answers
98 views

When should you create/destroy underlying object in a class that wraps it

(note: I used Java to make it easer to explain my question, but the actual language is irrelevant for this dilemma) TL; DR: I have a wrapper around some underlying class. At which point should I ...
0
votes
1answer
79 views

Strategy vs Publiser-subscriber pattern

Let's say I have a channel endpoint where I receive messages. Because I want to process messages in a different way depending on its Header property, rather than create a massive switch I create ...
1
vote
3answers
166 views

How to signal that a method chain should not continue?

When doing method chaining, you have methods that return the object allowing you to continue the chain. However, you need to get values out of the object somehow. Usually I've added a method that ...
6
votes
2answers
617 views

Which is a better pattern (coding style) for validating arguments - hurdle (barrier) or fence? [duplicate]

I don't know if there are any accepted names for these patterns (or anti-patterns), but I like to call them what I call them here. Actually, that would be Question 1: What are accepted names for these ...
0
votes
1answer
81 views

SQL Dev and Prod Environments

I have been tasked with setting up a SQL Development environment, and i was wondering if anyone has any advice on getting this right? So far, I have restored the prod DB onto another box, and ...
-1
votes
2answers
146 views

How do developers deal with “where to start” problem in a context of overwhelming difficulties caused by too much heterogeneous information? [closed]

A friend of mine, a beginner PHP programmer, needs to link the product his company develops with a third-party product (a set of web services). He received the "relevant" documentation (a few hundred ...
2
votes
1answer
414 views

Best practice for unused inherited virtual functions (implementing superclass methods)

Let's assume I have a hierarchy of several classes each derived from each other using virtual functions. The base class acts as an interface and defines functions, which may not be required by all of ...
20
votes
6answers
1k views

Should I place functions that are only used in one other function, within that function?

Specifically, I'm writing in JavaScript. Let's say my primary function is Function A. If Function A makes several calls to Function B, but Function B is not used anywhere else, then should I just ...
2
votes
5answers
468 views

I have generally read that having many (>4) arguments to a function/constructor is a bad practice. Is this still considered a bad practice? [closed]

I have generally read that having many (>4) arguments to a function/constructor is a bad practice. Is this still considered a bad practice? And is there a non-obvious reason? In something like a ...
4
votes
1answer
379 views

Which patterns/architecture to apply for “Import Data, Process Data, Export Result”

I was wondering which architecture/patterns to choose for the following problem divided into three steps: Import TestScript Description from File (e.g. .xls, .txt) Process Described TestScript ...
0
votes
0answers
36 views

update methods in simple factories

I have simple factory class with differently named methods which create the same object but differently. These created objects are persisted to db. These are then retrieved from the db elsewhere and ...
37
votes
11answers
4k views

Are error variables an anti-pattern or good design?

In order to handle several possible errors that shouldn't halt execution, I have an error variable that clients can check and use to throw exceptions. Is this an Anti-Pattern? Is there a better way to ...
0
votes
0answers
93 views

How to cleanly write a multi step process with user feedback and multiple callback

When you have some process that has several steps and you multiple entry points the code gets ugly pretty fast. I encountered this with Facebook integration in my mobile app: User wants to share ...
0
votes
3answers
127 views

One method with many behaviours or many methods

This question is quite general and not related to a specific language, but more to coding best practices. Recently, I've been developing a feature for my app that is requested in many cases with ...
0
votes
1answer
215 views

Using a progress dialog and multi threading

My .NET Windows desktop application creates an HTML report, and has 3 main phases. It may create multiple reports. I show a progress bar so the user knows (estimates) how long it will take (as well ...
0
votes
3answers
1k views

How can I explain this is an anti-pattern? [closed]

I recently started at a new job. The existing system works OK but is poorly designed and hard to maintain, and they are planning to rebuild it in MVC and I fear it will be much worse. (Not because ...
0
votes
0answers
45 views

What should I do with too much interfaces needed for a dialog

Let me start by doing a small summary of the changes we did in our code in the last year. We have a software (VERY big) that is used to visualize multiples underground networks, enter data in the ...
14
votes
4answers
1k views

Is it bad practice to allow user defined fields?

Generally speaking, is it considered bad practice to allow for user created fields in a database for a webapp? For example, I am making a home inventory webapp for my wife, and she is going to want ...
0
votes
3answers
431 views

“Property Container” design-pattern in-depth definition

Could anybody, please, explain what is a Property Container or at least where can I get information about that pattern on the Internet? I've found that it exists as one of the Fundamental patterns in ...
0
votes
5answers
761 views

Is it a good practice to wrap collection in Java? [closed]

I came across a snippet like this, and find it's over engineering. Is it a good practice? public class SchoolList extends ArrayList<School> { } public class School extends ...
4
votes
2answers
918 views

When is it worthwhile to replace working mature code with frameworks+patterns

I fear that frameworks in many cases have become a fashion or trend and are being abused. In many ways people are sacrificing speed just because they want to keep up with every single lib that comes ...