instruction stringlengths 34 19.9k |
|---|
I have come across the term "programming to an interface instead of an implementation" a lot, and I think I kind of understand what it means. But I want to make sure I understand it's benefits and it's possible implementations.
"Programming to an interface" means, that when possible, one should refer to a more abstract... |
I've always used the repository pattern in my applications. But I have seen that many people use facades instead of the repository for naming convention, but the operation is the same, I Think. Why is there this difference? There are a real difference between them or not?
|
Scrum's great for new development and proactive tasks. But I've never been sure how to use it when the department's obligations also include analyzing/answering/fixing customer support questions, which come in unpredictably, typically have high enough priority to interrupt what we planned on doing, and whose complexity... |
We have 10 separate projects that all access the same database. Initially, all 10 projects had database credentials hardcoded into them. I decided to move the credentials into a utility method and have all of the projects call that instead. For example
public String getDBUser() {
return "username";
}
So instead of ... |
I want to release an npm (NodeJS) module that will be a development dependency for extensions built for my product (will be used in testing). I don't want this module to be used in any released derivative work (commercial or free, open or closed source).
Is there an existing suitable license that I can use?
|
Is there an anti pattern that describes a historically grown software system where multiple developers just added new features to the system but no one really kept an eye on the overall architecture nor were refactorings ever done?
I think this happens when management/customer asks for new feature constantly and no one... |
Are there conventions to follow when naming an application package for an Android application?
I'm coding in Xamarin Studio, using .Net, so I feel far from this "com.myapp.etc" naming convention.
Are there rules to follow when naming an Android package?
|
In our ASP.NET MVC application, we try really hard to separate concerns to each layer (we use DDD). Nevertheless, it seems that we can't avoid having at least some business logic in DAL.
For instance, there are named objects, where business requirement is that each name must be unique (but the name isn't a key). If the... |
In my company, we're working on adopting the Microsoft Secure Development Lifecycle, and part of the MSDL process involves establishing security and privacy bug bars at the onset of a project. I've heard the concept of a bug bar prior to MSDL, and I understand that it's essentially a definition of what level/amount of ... |
I am pursuing object oriented design. So we don't want to use globals but yet sometime we have a module that most other modules use. This means we have to just pass it to all other modules and this can be literally all modules!
class Logger
{
public:
Logger(void);
~Logger(void);
};
class Calculator
{
public:... |
I am working on a survey-based feature in our application and the survey has branching points at any given question depending on the answer given. Each path that a branch can take may not have the same number of questions. So if we evaluated each possible path that can be taken, you may end up with a different number o... |
Let's say I have a machine-readable description (such as in WADL, Swagger or RAML) of a REST API that provides interface to a database.
My users submit queries about underlying database in form of SQL or similar query language. However, I cannot access the database directly, only through the REST API.
What approach wou... |
How can NSObject contain an NSString if NSString is an NSObject
/* NSObject.h
Copyright (c) 1994-2012, Apple Inc. All rights reserved.
*/
(NSString *)description;
NSObject has a property named 'description' that is an NSString but isn't NSString an NSObject? How is it that this works?
|
I am learning how to work with XMLHttpRequests. I know that request.setRequestHeader() is an important factor. I just don't understand why. It took me a while but I have at least found a list of Headers here and here, but I still don't understand what each one of them does, and what value goes with each. Is there a res... |
I have a basic web application where users can login and edit their profile. In the profile they can submit an username and a password for a different application. I'd like to take that password and encrypt it. Later, when I want to connect to that different application I need to decrypt the password.
Is there a common... |
Here's how my code works. I have an object that represents the current state of something akin to a shopping cart order, stored in a 3rd party shopping API. In my controller code, I want to be able to call:
myOrder.updateQuantity(2);
In order to actually send the message to the third party, the third party also needs ... |
Context: I built an app which generates around 1000 domain names based on user input. I need to check if they are available or not by matching against a huge zone file of parsed domain names which is around 2 GB.
I have an amazon micro instance and cannot store the text file in there due to space constraints.
I am ex... |
Let's say I was working on a Swing application. Most of it is run on the EDT using SwingUtilities.invokeLater() inside the main method, because I heard (please correct me if I'm wrong) that that's what you need to do with Swing.
However, some parts of it shouldn't run on the EDT. These parts are parts that take long to... |
I ran across yet another new term in development methodology, and I haven't been able to find a definition for it. Specifically, it's called "train based development."
Here are some examples of where I have seen this term.
Earlier this week, I asked our engineering leads and release managers to take the Windows Metro... |
I wish to publish my program under Apache2 license. I have added the "APPENDIX" part of the license text to the top portion of my source.txt file and edited the copyright year and name.
But when I add the license.txt file in the same archive with sourcecode, should I edit the copyright line wih my name and year? Or... |
I am learning SQL Server 2012 along with C#. In the past, I took database class in college, and have good grasp on SQL language and can write queries. However, looking at SQL Server documentation (or Oracle), it appears that DB engine (along with all the technologies that comes with it) are highly complex and are requi... |
I'm attempting to teach myself the basics of finite automata and have been exploring the differences between Deterministic Finite Automata and Non Deterministic Finite Automita.
One thing that pops up quite often in the on-line examples, lectures slides and videos of various CS instructors is the epsilon transition. T... |
Some apps, I've noticed that developers are able to update their software without submitting them to the App Store.
For example, Game of War will occasionally tell you that an update is available and to restart your device. You can then watch the progress bar carefully and see that updates are being pushed to the app... |
If I quote a paragraph from Wikipedia about Optimization:
In computer science, program optimization or software optimization is
the process of modifying a software system to make some aspect of it
work more efficiently or use fewer resources. In general, a computer
program may be optimized so that it executes mo... |
Our UX designers usually have a story in Sprint X that the developers will implement in Sprint X+1 (The UX designers and the devs/testers are on one team). I think this makes sense because if you don't have screen mockups and clear specifications you can't really estimate the work during Sprint Planning.
However in Scr... |
I want to create an HTML scraper in Ruby on Rails and I want to implement a progress bar and an ability for it to pick up where it left off if it's interrupted while scraping.
I think the best way to do this be to create a database table with a record for every single page, with a boolean column called 'scraped?'
I'm t... |
We are a small software team (as far as programmers go) and have a team of vendors on the other side of the world that program for us. We own the product, and simply dictate to them some of the tasks to work on. I am one of the lead programmers and also the project manager of this particular project, so I am a programm... |
Say that you're doing a code review, and you find yourself faced with an orchestration pattern:
class OrchestrationClass {
private Configuration _configuration;
private DataStore1 _dataStore1;
private EfficientComputationService _service;
private ResultPrettifier _formatter;
public DoSomething () {
with... |
I'm learning and diving into Web API. I've used web services before but not specifically with web API. Below is how I am designing it so far and I was curious on the feedback.
I have a ReturnMessages object. This basically is a standard object that gets returned from any of the API calls, correctly executed or an er... |
Here is the problem, an enthusiastic man wants to build an app, however he only knows roughly how the app should work. There are a lot of details he didn't know.
How does he design his app?
-Option1:
Do not design, but just code the most important first & test to see how it goes then modify gradually. After the highest... |
I wanted to create a parser that can read a solidworks file and turn it into a protein data bank file. This has already been done in a program called DiamondCAD. http://www.zyvex.com/Research/DiamondCAD.html
I waant to make a parser that can parse the data and then visualize it the same way as DiamondCAD. I have down... |
I am following a tutorial. The guy keeps on adding different plug-ins such as subclipse, maven, spring source tool suite, etc after setting up jdk, eclipse, tomcat.
While installing spring, he was saying that spring makes it difficult to debug the programme. That didn't make me happy. He also added, it's up to you if y... |
I want to identify most matching sentence using some pattern. That means by using java algorithm I want to create identical value for each sentences.Each sentence when entering to that algorithm can be out some kind of identical value. How can I develop it? What can I refer any web sites do you know? What sort of sites... |
I am refactoring an old Codeigniter library to be php framework agnostic. There are these core parts:
the connection object - this will come from the "user"; ie, the framework's connection, or their own connection library. My library will not want to "know about it" except that (at first) it will be a PDO conn object ... |
I'm looking at how I can change the representation of a payload at runtime for varied potential advantages, but I'm not sure how to do it. Specifically collections.
Array of Pairs
[{ <resource_uri> : { <entity> }, ...}]
Array of Objects
[<entity>,...]
Array of Resources
[<resource_uri>]
Map of entities
{ <resource_u... |
I would like to send a CSV file via POST in a XMLHttpRequest, but I am unsure of two things. First is there anything to distinguish a CSV file from a string split up by comma's? And what sort of Content-Type am I supposed to put in to the setRequestHeader?
|
Most popular applications nowadays require account activation by email. I've never done it with apps that I've developed so am I missing some crucial security feature?
By email activation I mean when you register to a site they send you an email that contains a link that you have to click before your account gets activ... |
I'm trying to calculate every possible selection from different categories. 1 choice must be made from every category and the categories are always in the same order. I save a string where each character is the number of that choice from that category. I have solved this with recursion and it works well when there a... |
I would like to know what do you think about persisting an "autocomputed property" to the database.
For example I have these properties
decimal Price {get;set;}
decimal Tax {get;set;}
decimal PriceWithTax {get {return Price + Tax;}}
I think I need persist PriceWithTax. I can use this column, for example, in DB views.
... |
I'm thinking about building an Open Source, serverless, offline-replicated p2p CMS, but I'm concerned about it really working in a real environment. How would you go about doing that, reducing the exposition to risks/bugs?
I've thought about this schema for now.
On the local device we have a folder called "cmsfiles" co... |
Only 1% of our clients use particular features or scenarios. Do you think we should spend as much time testing these features and scenarios as we spend on our central features and scenarios, or we should test mostly the "happy path" for these features?
UPDATE
Maybe I should have asked the question in a different way.... |
From Wikipedia:
Quality Assurance refers to administrative and procedural activities
implemented in a quality system so that requirements and goals for a
product, service or activity will be fulfilled.[1] It is the
systematic measurement, comparison with a standard, monitoring of
processes and an associated feedback l... |
I often see something like "uncompressed for development / minified for production" when reading blogs or downloading frameworks. What is the real difference between the two, and if minified is "good for production" why is it not recommended for development?
|
I'm writing an HTTP API to a publishing server, and I want resources with representations in multiple languages. A user whose client GETs a resource which has Korean, Japanese and Trad. Chinese representations, and sends Accept-Language: en, ja;q=0.7 should get the Japanese.
One resource, identified by one URI, will t... |
In a moderately old blog post, Conal Elliot makes an interesting (if less than serious) argument that C is a purely functional language, by drawing a parallel between the combination of the C preprocessor and C itself, and that of Haskell's pure expression language and its impure IO action values. It's observed further... |
(I'm talking about HTML / CSS code (not programming languages) but I think we also face the same issue as with programmers.)
I am the senior front-end designer in a team and I often have to re-work my juniors' output in tight deadlines.
I am faced with 2 problems:
Their coding style is a bit of a mess.
The aestheti... |
I am using a ternary operator in super () method of my code. While the code went for review, I got a reply that
Strictly don’t use ternary operators in the Super() calls.
Is there any problem if we use ternary operators in the super() method?
|
Do you delete nodes from the underlying graph representation? Or is there a more elegant way to do it?
|
I used to select the default warning level in C++ programming. For example, in VS, the default warning level is Level3 (/W3) and No (/WX-) (don't treat warnings as errors).
I am wondering is it a good practice to choose highest warning level in C++ programming, e.g. EnableAllWarnings (/Wall) with Yes (/WX) (treat warni... |
I have used the JDT Annotation library in my Java project as I am quite fond of what it offers. To be more exact, I used the @Nullable and @NonNullByDefault annotations as I can use the synergy with Eclipse to automatically analyse possible null values and what may lead to NullPointerException bugs.
Unfortunately, JDT ... |
Would it be considered acceptable to use word compounds instead of numbers for version iterations?
For example in a pattern: "[Adjective] [Noun]"
The first version could be something like: "Auspicious Armadillo"
Thus on each sequential release the noun would change to the next letter of the alphabet and the version cou... |
I'm trying to make a realtime multiplayer web-game in node.js with express framework and socket.io library.
But I can't seem to make my server-side logic independent of client interactions.
I want client to interact only when I (server side logic) want but I can't seem to be able to do that. For example:
I want 2 use... |
I was doing a code review and came across something odd which I've never seen before. The developer decided to create a sub-namespace just to contain all the assembly's exceptions.
I thought I had read that this was explicitly not a good use of namespaces and that exceptions should be kept at the "lowest" namespace fr... |
I currently have a planning tool using SQL tables that are sort of setup like this:
Date table (Contains dates & indicates if that day is a weekend / holiday etc)
Employee (Simple data)
Project (Simple data)
Assignments (Associates the three tables, key date + employee id + project id)
I have one SQL query that, for ... |
The burn down chart displays a clear deadline and the progress towards the deadline. When the progress is slow and the completion of the committed work is at risk, people start to get sloppy on design and code reviews and on the depth of testing. Quality suffers.
The question is whether in your organization you were su... |
On the 'Interfaces' trail on the Oracle website, we are presented with the following scenario:
Imagine a futuristic society where computer-controlled robotic cars
transport passengers through city streets without a human operator.
Automobile manufacturers write software (Java, of course) that
operates the autom... |
For simplicity, my database has entities and transactions. Each transaction has a DateCreated and a foreign key to the entity. I'd like to have the ability to find entities that have had a recurring number of transactions within a close time proximity of other entities.
Simply, if entity A has had a transaction withi... |
I work for a university Digital Services team. Our university's main website uses the Ektron CMS (I have my own thoughts about this, but that's irrelevant). Because we maintain a university website, we need to make sure our website is extremely backwards compatible.
We are trying to make a decision as to whether Twitte... |
I maintain an open source Flickr app Glimmr for Android. There is currently an architectural issue around pagination that I've been trying to solve for quite a while, and would appreciate ideas.
Here are the components involved:
Tasks - various subclasses of AsyncTask that fetch photos from sources such as a users ph... |
I assume that when a user registers at a site, the password and username are stored inside of a database.
I've read that the password is often encrypted using a salt. So, is it safe to encrypt the passwords with a salt and to save it in the same schema with the username?
Secondly, how does authentication work? Companie... |
For the moment I'm strictly speaking in Pseudocode. I'd only like to see if i'm on the right track. The game I'm talking about is similar to a application called FLOW.
In this game, you're given a nxn board(Always a square) and need to fill out each slot in the board. Similarly, when a board game is initialized, it wi... |
In most OOP languages, objects are generally mutable with a limited set of exceptions (like e.g. tuples and strings in python). In most functional languages, data is immutable.
Both mutable and immutable objects bring a whole list of advantages and disadvantages of their own.
There are languages that try to marry both ... |
Can the Jacquard loom, pictured below complete with its chains of paper cards
be considered stateless? As far as I can tell I can tell, each operation is not dependant on the previous. Or did it have any concept of branching and/or looping?
|
I'm thinking to CSRF protect all public AJAX requests that return JSON, because what's to prevent another site from spoofing the AJAX header and using the JSON as if it were a public API? I think CSRF protection is the best solution for this, however I'm concerned with the way Laravel handles this:
Using laravel's CSR... |
Many years ago, I was talking with an Economics professor about design patterns, how they were establishing a common language for programmers and how they were solving well known problems in a nice manner, etc etc.
Then he talked back to me that this is exactly the opposite approach he would use to his Economics studen... |
In my project, on a security system, I was using a socket to get the details of the client and then store it in a database (his IP and port he connected from and service he accessed). I was wondering if the fetching of the details and storing them in a database should be done in separate threads or a single thread. Whi... |
I'm building a user friendly XML editor in HTML/JS.
Looking for some general advice on how to build the editor UI and which approach you'd recommend on mapping the data to the UI.
Details about the problem:
Basically I'll fetch a single object as XML from a sever.
The XML objects in question will be a small set of org... |
I have a project where I need to translate a lot of words and text fragments in different languages.
In these texts, underscores are currently added in these text (fragment(s)) to be used as keyboard shortcuts (used in Visual Studio).
However, I was wondering if this is the way to go, or if it would be better to remove... |
I am writing a program that creates backup of directories.
Which of the following approach is better for code organization?
Create separate class for Backup and Zip logic -
class BackupUtil:
def backup(self):
None
class ZipUtil:
def archive_dir(self):
None
Or use function nesting like this -
cla... |
Whenever I want to add a new functionality, I introduce a new private variable into the class. Declare it just above the first method definition. leave a small comment. Set it in a certain method. And then use this set value in another method.
Now the possible problems which arise are, I dont cover all the possible cas... |
I want to implement my first application using CQRS pattern along with Event Sourcing. I am wondering how creation of aggregate roots should be handled properly. Let's say someone sends CreateItem command. How it should be handled? Where the event ItemCreated should be stored? As first event of a new Item? Or should I ... |
Iv'e moved this from SO as it's more of a design question than a code one.
In many applications third party websites/programs can access the website via a key.
For example, a web application hosts applications each of which have a unique API key. These keys are issued to the various developers to ensure they don't make... |
In my database abstraction library I am extending SQL prepared statements syntax to hint a parser with expected literal type. I take it as a very essential improvement, my reasoning you can read here. If you want to question the idea itself, please let me know in the comments - I'd like to start another question instea... |
Alright so I've learned this:
Classes have public methods that perform operations on the class's data and they hide away their implementations.
Data structures on the other hand, completely expose their implementation through properties (getters and setters) and don't usually have methods.
So my question is, let's say ... |
Simple question: I understand that Serialization in C# requires default constructors. This would eliminate the possibility of using Constructor injected DI (which is generally the favored style of DI, in my reading[citation needed]). So is it really an either-or situation, or am I missing something?
(Side question): Do... |
I am working on a ‘brown-field’ project, with a team of programmers. I understand each programmer will have different styles.
I am running into some criticism with my coding style, specifically creating ‘too many class files' (aka too many CS Files, not number of classes).
I have always tried to separate project/busine... |
It's common practice to make some tweaks or fixes in 3rd-party code (be it a simple gist or an entire library). But it's also common that many of these code have their own licensing rules and eventually a header on every file with copyright informations.
After making those modifications what's the correct thing to do n... |
I just read this quote online:
XML is a very useful technology for moving data between different databases or between databases and other programs. However, it is not itself a database.
Which is quoted from the book 'Effective XML: 50 Specific Ways to Improve Your XML'.
I don't understand what you would bother movin... |
Although its generally agreed by organisations like the OSI and the FSF what is and isn't an open source software (basically, the the terms of the source code license) what are the guiding principals for open source projects?
Other software movements have principals like the Agile Manifesto. It seems as though open sou... |
In my humble view of unit testing a unit test tests a single unit of code. For me, this means a single class. Every dependency for that class is mocked in the corresponding test class, and passed in the constructor (or injected via a DI container). This allows you to test the class in complete isolation from the rest o... |
In our organization some of the resources (such as QA machines etc) are shared. Different folks get done at different times and some tests have to be run (during dev and QA) on these machines. Right now, we just skype a message to the team stating "I am going to run some destructive tests on such and such machines - le... |
http://www.cplusplus.com/reference/cstdarg/va_list/
According to the above link, va_list is an argument or parameter used in some macros - va_start, va_arg, va_end. These macros are present in the stdarg.h file.
I know that va_list can hold multiple values but what kind of an entity is va_list? My question is what is ... |
I'm considering passing xml back and forth for error messages but each error has different scenarios.
one situation at hand is passing diffed text comparison while others are as simple as passing a text message.
What kind of serialization/deserialization strategy could I use for such a scenario?
The main issue with a s... |
I follow TDD religiously. My projects typically have 85% or better test coverage, with meaningful test cases.
I do a lot of work with HBase, and the main client interface, HTable, is a real pain to mock. It takes me 3 or 4 times longer to write my unit tests than it does to write tests that use a live endpoint.
I k... |
We are working on a fulfillment system for an online book store. Everyday we receive tens of CSV files (about 90 files) with data about purchased orders.
Example:
OrderId | BookTitle | Quantity | Price | BuyerName | ...
1 |The hunger games | 1 | 10 | John ... |
I'm running public web site based on Drupal. Drupal is GPL 2 or 3 licence. Of course I wrote custom code which interacts with Drupal code (modules). Can anybody write me an e-mail and ask for the source code of that my custom code? In other words, have I to publish that my code somewhere?
|
I have a website that allows user uploads of content. Part of the design, to date, involves storing the user content on a NAS that has been configured with a separate app pool in IIS that has scripting disabled, shorter lifespans, no cookies, etc for CDN-type behavior as a subdomain (static.domain.com vs. www.domain.c... |
I am very curious as to thoughts and industry best practices regarding static members, or entire static classes. Are there any downsides to this, or does it participate in any anti-patterns?
I see these entities as "utility classes/members", in the sense that they don't require or demand instantiating the class in ord... |
I'm trying to find the number of points in a matrix with the same minimal distances.
Start with a MxN matrix, where M and N < 50000. There is given a set of fixed points, with their respective coordinates.
The problem is to find the number of points in the matrix such as the minimal distance from any point in the set ... |
I was reading this article, https://weblogs.java.net/blog/emcmanus/archive/2010/10/25/using-builder-pattern-subclasses, about subclassing a builder class. I understood the article but there was one small bit that bothered me. There was this method,
public static Builder<?> builder() {
return new Builder2();
}
... |
In a classic implementation of the Observer design pattern, the subject has a list of references to all of it's observers, and each observer might have a reference to it's subject.
Is this considered composition? As far as I understand, composition means one object 'includes' in itself another object, in order to use f... |
This is the first time I have dealt with licensing issues so I am sorry if I am making any stupid assumptions. My issue is that I have written a program in Python that uses PyQT for the GUI and also uses another library licensed under BSD.
PyQT comes with GPL v2 and GPL v3 as well as a commercial license. From what I h... |
For a binary tree we define horizontal distance as follows:
Horizontal distance(hd) of root = 0
If you go left then hd = hd(of its parent)-1, and
if you go right then hd = hd(of its parent)+1.
The bottom view of a tree then consists of all the nodes of the tree, where there is no node with the same hd and... |
My web application calls a third party API.
If I successfully call the API but invalid data is returned which cannot be processed by my system what is the most appropriate HttpCode to return to the user calling me?
500, I'm not convinced. Although it was an internal error it's due to external factors
503, Perhaps, alt... |
Let's say you have 10 database records which you need to process in the following way:
Start
Pull 2 records from the database with the 'Processed' flag set to 'false'
Call the external web service with the custom data from this 2 records.
Update those 2 records in the database and set them as 'Processed' = 'true'
Goto... |
I am trying to follow TDD in my proj but I can't get my head around how to verify I am calling a dependency correctly or even if I should be trying to verify it. Here's the requirement:
Write an AddSalesOrderTask class that is responsible for adding an order to an ERP system. The class can take any dependencies nee... |
My current automated workflow looks like this:
I commit changes
I push changes
Build (actually just a lot of tests using mock database) is triggered
If all tests pass, the new code is deployed to the server
Now assuming there is a change in database format - first 3 steps do pass, but the code will not work on server... |
I inherited a code base where there is a lot of code that goes something like this:
SomeDataAdapter sda = new SomeDataAdapter();
sda.UpdateData(DataTable updateData);
And then sda is never used again.
Is that a code smell that indicates that those methods should actually be static class methods instead?
|
I need to write a handler for server error during user logout. What is a common practice?
ajax.post({
url: '/auth/logout'
}).done(function (response) {
switch (response.statusCode) {
case 200:
{
//update UI related to userinformation
}
case 500:
{
... |
I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to exercise the device, etc. So, at a high level a test is essentially the following:
obtain handles to test equipment
a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.