The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
1answer
25 views

Abstracting end-to-end test cases across multiple pages

I am using Protractor and Jasmine to create end-to-end tests for a webpage. To test this initial page, I have abstracted made some common utility functions to create about 20 test cases for this ...
1
vote
1answer
143 views

Improving a try/catch

I'm a python programmer trying to get to grips with Java's inflexibility; I'm trying to parse a date from a string into a Calendar object private Calendar parsedDate ( String dateString ) throws ...
39
votes
4answers
12k views

Developing a feature which sole purpose to be taken out? [closed]

What is the name of the pattern in which individual contributors (programmers/designers) developed an artifact for the sole purpose is to serve as a diversion so that management can remove that ...
1
vote
1answer
133 views

What is the minimal prototypical program to demonstrate the differences between the major programming paradigms?

Clearly the prototypical "Hello World" program does not suffice to demonstrate the difference between the major paradigms of programming. What would be the minimal program to show the differences ...
4
votes
2answers
89 views

Should I use the same object for individual instances and collections?

One of the functions of an application I manage is to operate a fleet of vehicles. I have an object vehicle with which I can do tasks that are vehicle-related; getMileage(), setDriver(), etc. I also ...
0
votes
1answer
66 views

Is it a bad practice to use external files for storing SQL templates?

I am working on a report system which aggregate a lot of data from multiple sources (databases and internal APIs). Among other things I communicated with another departaments and told them I need some ...
5
votes
3answers
210 views

Design: How to avoid breaking backward compatibility because of database changes

This is my scenario, I have this interface: public interface hitTheDataBase { public void insertMe(String [] values); public void modifyMe(String [] values); public DataTable selectMe(); ...
1
vote
4answers
100 views

File-Directory Implementation: Does a a file have to own a reference to it's dir?

I am currently issuing a problem while forming the program-design, which is exact like a File-Directory relationship, and to ease it, I am using that as an example. I think it is usual, that a ...
3
votes
1answer
543 views

Reading from a file and inserting into a database, a good practice

I am making an Android application which reads several JSON files and inserts the read information into tables in my database. For instance, there are three files: countries.json { ...
1
vote
1answer
190 views

Is defining only one method against S in S.O.L.I.D

The first version of pseudo code I consider a code smell because of (I think) the Command Query Separation principle and/or the S in S.O.L.I.D. What I like to see is in the 2nd version. Should I keep ...
0
votes
1answer
44 views

How to design interface communication beween objects?

I'm stuck on a lightly philosophical question for me. I have three classes and I'm not sure how to make them related to each other. I have few competing approaches all of them standing on equal ground ...
1
vote
1answer
62 views

Best practices for working with public_html folders and git

Currently, everything that is in the public_html folder automatically gets published live. The git repository is also inited in this folder (though this can change if it's necessary). What is a good ...
0
votes
1answer
66 views

Architecture of approval process

I want to design an approval process for my work flow but I wonder if there is an architecrural pattern or desing pattern for this solution. For example an engineer will create a work. And program ...
1
vote
1answer
59 views

Is it a common pattern in Python to have instance variables assigned in a constructor start with an underscore?

I recently started using UtilSnips, a Vim plugin allowing for a certain level of automation while coding by using template-like code snippets for common code fragments (class and function definitions, ...
2
votes
4answers
94 views

Keeping a ratio column that's the division between two other columns

I'm about to build a SQL table where I want to store currency orders. That means that I need to store how much I paid for a certain quantity, and the ratio between both quantities. So for example: ...
26
votes
4answers
34k views

Should angularjs directive directly interact with services or is it considered an anti-pattern?

Which one is considered better: having a directive that interacts with services directly or having a directive that exposes certain hooks to which controller may bind behaviour (involving ...
8
votes
4answers
354 views

Is there a Haskell idiom for trying several functions and stop as soon as one succeeds?

In Haskell, I can use the type a -> Maybe b to model a function that either returns a value of type b, or returns nothing (it fails). If I have types a1, ..., a(n+1) and functions f1, ..., fn, ...
0
votes
0answers
20 views

Relying on file hash for data synchronisation across mobile and server

Imagine a client-server app that lets user upload images/documents etc. to server and then lets users who have access, retrieve and view them later on their respective mobile devices. So the flow is ...
9
votes
8answers
815 views

Designs and practices to guard against erroneous null entries from database

One part of my program fetches data from many tables and columns in my database for processing. Some of the columns might be null, but in the current processing context that is an error. This should ...
4
votes
2answers
150 views

Should a RESTful API be able to return files, or just a location

This has been puzzling me for a while. For example, we have a REST API that provides basic content to a system, consuming and producing JSON. At this endpoint it produces a URL to a picture and a ...
2
votes
0answers
35 views

Should my application call statsd directly or should I call statsd based off logs?

I'm planning on incrementing counters in statsd based of various events within my application. I have logging in place for these events. So, from my viewpoint I have two options: Update the ...
8
votes
3answers
3k views

When is Efferent / Afferent coupling good or bad

I have a software patterns exam this week and one of the topics we are to study is Efferent and Afferent coupling. I understand a package has a high Ce (efferent coupling) if it depends on a number ...
0
votes
2answers
2k views

How to implement a hybrid role-based access control model?

I am writing an enterprise web-forms-frontend application for in-house use. It has Direct access control (DAC) masquerading as Role-based access control (RBAC). For anonymization purposes, let's ...
0
votes
1answer
62 views

Reusing array with static test data across test classes

I have a Map which takes in an a String key, and an array of custom objects as the value. the map usually contains two entries, and the arrays for both entries never change in terms of data; once they ...
5
votes
5answers
536 views

Advantages of Strategy Pattern

Why is it beneficial to use the strategy pattern if you can just write your code in if/then cases? For example: I have a taxPayer class, and one of its methods calculates the taxes using different ...
2
votes
3answers
263 views

CRUD operations in DDD

I'm designing an application with DDD. I'm moving from flat POCO objects to strong domain models, so my question is: Would I have to call my basic CRUD operations (located in my repository layer) ...
4
votes
1answer
342 views

How to make sure people call methods in the right order?

Situation I'm designing a database abstraction layer for sql (mysql, sqlite) and mongoDb. The goal is to give the user/developer a library which is able to create queries for different databases. ...
1
vote
1answer
477 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 ...
0
votes
1answer
324 views

MVC Best practice mixing Partial View and JavaScript

I searched the internet and really can't find a good answer to this question. Imagine there is a View that contains a simple tab-element. Each tab-content is loaded dynamically (via ajax) when the ...
1
vote
2answers
94 views

Explaining concepts [closed]

How can I explain a concept when I don't know its name or any formal reason for it? The reason I ask is this... A new programmer has entities with a property title in his system. He uses the title to ...
6
votes
1answer
881 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 ...
1
vote
0answers
77 views

Algorithm for evaluating line breaks efficiently [closed]

Consider following problem : Given: String input with the length n Font(-metrics) - potentially slow in usage Bounds of an abstract Textview which shall contain the text in a specific manner: e.g ...
2
votes
1answer
560 views

prism and multiple screens

OK - I am studying Prism a little because of a "free weekend" offer on Pluralsight. As this is proving too complex for me, I went to the Prism book and looked at the forward, and this is what it said: ...
1
vote
1answer
56 views

Name pattern for quickly find descendents with SQL (PATH column with [TopId]…[DirectAncestorId].[OwnId]) NO nested sets

I read a long time ago about a pattern/technique for easily querying for all "descendants" of a record (no need to use CONNECT TO, which is not standard and not available with JPA). I remembered the ...
1
vote
1answer
90 views

Pattern for passing in a field as a parameter

I'm writing a Rails app which uses ActiveRecord ORM and a Postgres DB. I've got two attributes which are similar but are separate fields in the database. The assignment and saving of these is kinda ...
3
votes
4answers
454 views

Where to store average value in db?

I have a restaurant review app which stores reviews in a db, MySql. There's 2 tables. 1 for Restaurant. Another for reviews. To increase the performance, I am considering to store the avg review of ...
2
votes
2answers
274 views

Is there a name for this pattern?

A while loop can be written as follows in C# (and many other languages): int someValue; int someTerminatingValue; while ((someValue = GetSomeValue()) != someTerminatingValue) { // Do something ...
67
votes
2answers
8k views

Are there any OO-principles that are practically applicable for Javascript?

Javascript is a prototype-based object oriented language but can become class-based in a variety of ways, either by: Writing the functions to be used as classes by yourself Use a nifty class system ...
1
vote
1answer
467 views

What is the “Find-Fix-Verify” pattern? [closed]

What is the "Find-Fix-Verify" pattern, as related to the process of doing editing/spellchecking/debugging, etc.? Where is this pattern best described? What are some advantages and disadvantages of ...
9
votes
4answers
647 views

Reducing boilerplate in class that implements interfaces through composition

I have a class: A that is a composite of a number of smaller classes, B, Cand D. B, C, and D implement interfaces IB, IC, and ID respectively. Since A supports all the functionality of B, C and D, A ...
1
vote
2answers
396 views

Joshua Bloch Enum Singleton and Third Party APIs

In the book Effective Java he give the best Singleton pattern implementation in his, that is implement by a Enum. I have doubt to how to implement this pattern with a third party API. I'm using an ...
2
votes
2answers
186 views

Does it break SRP to have concerns of data handling and object mapping inside a single class, as part of the DataMapper pattern?

Summary I want to look into separating the concern of "creating a populated object from database", to use inside my application. DataMapper pattern seems to be doing just that for me. DataMapper ...
3
votes
4answers
296 views

Function wrappers with no args: bad practice?

My colleague likes to write classes containing methods looking like this: public function doTaskA() { return $this->doTask('A'); } public function doTaskB() { return $this->doTask('B'); ...
2
votes
2answers
851 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
214 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: ...
12
votes
5answers
2k views

How to migrate my thinking from C++ to C#

I am an experienced C++ developer, I know the language in great details and have used some of its specific features intensively. Also, I know principles of OOD and design patterns. I am now learning ...
0
votes
1answer
152 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 ...
3
votes
2answers
188 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 ...
7
votes
1answer
403 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 ...
2
votes
1answer
58 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 ...