instruction stringlengths 34 36.1k |
|---|
I'am little confused about how business logic should be implemented using web services. For example, think about an education management application. There are simply students, teachers and courses. Now, the server side of the application may provide getStudents operation via a WSDL interface. This operation returns li... |
It may not be clear so I'll develop the idea:
The point is to develop a web interface to write down notes (and anything you like), and track its evolution. My question is then: how can I store such information such that I can also keep track of modification history?
On the relational database world it would ideally loo... |
The application will continuously (approximately every second) collect the location of users and store them.
This data is structured. In a relational database, it would be stored as:
| user | timestamp | latitude | longitude |
However, there is too much data. There will be 60 × 60 × 24 = 86,400 records per user, daily.... |
I'm not sure if I am in the right place to ask this question. Please tell me if I'm not. I have the following problem:
I have a production process, where a product first has to be produced, it is then stored, and packed afterwards. Hence, it can be seen as that the product has to go through two machines in series. How... |
We are moving to Self-Hosted TFS and I am having a difficult time with setting things up properly. What we want to do is:
1) Have some user accounts be testers on Project 1 and thus they can create and manage work items, but not have access to the code on the project. We got this done by setting those user accounts up... |
This question is about refactoring existing database design.
My data flow is
User generates some data for product lines A, B, C
Data is saved into the database once
Data is later retrieved multiple times
Current design has 3 tables: data_a, data_b, data_c, where each table shares some columns that are identical (in ... |
I have a client who insisted that we keep our new development separate from the main branches for the entirety of 2016. They had 3-4 other teams working on the application in various capacities. Numerous large changes have been made (switching how dependency injection is done, cleaning up code with ReSharper, etc). ... |
I still remember good old days of repositories. But repositories used to grow ugly with time. Then CQRS got mainstream. They were nice, they were a breath of fresh air. But recently I've been asking myself again and again why don't I keep the logic right in a Controller's Action method (especially in Web Api where acti... |
Let's say I have a users resource, with two properties: name and email as specified by a users JSON Schema document, which right now looks like this:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
... |
My company employs people who add and edit records in a PostgreSQL database using a web interface. These updates then need to be compiled into a mobile app (Android, iOS) via SQLite and released as a new version every few months. We haven't quite gotten around to 'hot patching' the SQLite database; that is to say, down... |
After picking up some Swift skills with Java as my strongest language, one feature of Swift that I really like is the ability to add extensions to a class. In Java, a pattern I see very often is Utils or Helper classes, in which you add your methods to simplify something you're trying to accomplish. This might be a s... |
For example, to keep a CPU on in Android, I can use code like this:
PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE);
WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "abc");
wakeLock.acquire();
but I think the local variables powerManager and wakeLock can be elimin... |
I'm using Java Eclipse EMF to model my Composite Pattern. What would be the right UML representation to model aa new class (Root) which implements a unique root directory. This is the original Composite pattern.
This is my representation:
Target representation would be:
root
|___ dir1
|___ dir2
|___ dir3
| ... |
How is software architecture decided in a scrum/agile project environment, if everyone is focused on just one small piece of the problem how is over all system design decided upon.
There doesn't seem to be a role where one person take ownership over the technical execution of the project so you could possibly end up i... |
I'm looking for some assistance and ideas for developing an algorithm for choosing random soccer teams based on the skill levels of the participating players.
What I have so far is a list of particpating players with arbitrary skill levels between 1 and 100. e.g.
PlayerA: 30,
PlayerB: 45,
PlayerC: 50,
PlayerD: 55,
Play... |
I have a Google App Engine app which is used by a small amount of users of a certain niche website. The app's only function is to get data about the user from that website's API, use that data to produce a CSS file, and deliver that CSS to the user. There are a few apps (made by others) like mine for this website; mine... |
I am currently designing a system to support our employee staffing process. I collect weekly preferences from employees, and feed that into a system for staffing. Availabilities can be defined as absolute dates (e.g. Employee John is available on 01/01/2017 from 14:00 to 16:00). Or by recurrence, where one can define a... |
This is something I see all over Cocoa:
func someAction(_ sender: Any)
which is called like:
someAction(someObject)
This can be very confusing to me. The infamous example is in NSView subclasses:
print("Hello, World!")
Despite this being standard Swift syntax for printing to the console, in an NSView, this will open... |
I have an application which works with pure JDBC. I have a dilemma where should transaction handling go, in Service or DAO layer. I have found that in most cases it should be implemented in Service layer since DAO must be as simple as possible and exists solely to provide a connection to the Database. I like this appro... |
I am currently working with a system which has been upgraded piecemeal from an original Visual FoxPro solution, to a system that now has the following parts:
Local FoxPro installation (this is a Point Of Sale system, so designed to be used on touchscreens in stores / salons)
Local windows service which syncs data from... |
I have an intern and he writes code fast.
However, I have difficulty making him understand the importance of writing classes and follow the OOP paradigm.
We recently had a discussion that went like something this:
"Instead of having this long function that extracts data from two different queries and then combine the d... |
Let's suppose we have a nullable variable.
int? myVar = null;
If we wish to use it's value, there are at least two options:
Explicit casting
DoSomething((int)myVar);
Calling Nullable<T>'s .Value property
DoSomething(myVar.Value);
I've noticed that when the conversion fails, in both cases the same exception is thrown... |
Let's say I have a reverse proxy set up getting traffic at http://gluten-free-snacks.example.com. It serves different URLs by sub-directories, not sub-domains, for a better web UX.
Its default behavior is to route all requests to a WordPress site which I handed over to the marketing team which they will definitely use ... |
Android developers probably are familiar with Ceja's Clean Architecture, where use cases are classes that implement the Command Pattern.
Shvets defines the pattern intents as follows:
Encapsulate a request as an object, thereby letting you parametrize clients with different requests, queue or log requests, and support... |
When we call the same function on a list of things, we call that "map". What do we call it when we call a list of functions on the same data? I don't mean pipe - not feeding the output of each function in turn into the next function - but simply iterating over a list of functions, passing each the same input?
|
Suppose you set up a Redis cluster with one master and two slaves. Two clients are connected to each of the slaves. Both clients make conflicting changes at the same time:
What happens if these changes are replicated to Master at around the same time? Are they just applied to Master in the order they are received, ... |
I need to send messages from a Windows Service to a Azure Service Fabric Stateful service. The network connection is not very reliable, and there must not be lost data. I was hoping I could use NServiceBus with a store & forward pattern to send the messages. Is my thinking fundamentally flawed?
|
According to this clean-code guide you should encapsulate conditionals:
function shouldShowSpinner() {
return fsm.state === 'fetching' && isEmpty(listNode);
}
if (shouldShowSpinner()) {
// ...
}
Why not just write:
const shouldShowSpinner = fsm.state === 'fetching' && isEmpty(listNode)
if (shouldShowSpinner) {
... |
I am developing a website where client needs that any notification should reach as soon as it is created. so i am using setinterval function of jquery and using ajax requests to get the notifications. the time interval I set is 2 seconds. and its not the only ajax request which is going this way.
there are following a... |
For the first I would like to mention that I'm newbie in real-time systems programming
That's why I'm not sure if my questions are correct. Sorry for that
But I need some help
Question in short:
How to implement hard real-time software to be sure it meets hard deadlines? It is necessary to use some QNX features? Or it... |
A little bit of confusion over here.
I am trying to reproduce Git's behavior regarding pagers and editors (as I think Git developers already done good (maybe the best) design choices in this scope).
While trying to break it down I found that Git uses the pager/editor set to the environment variable $PAGER/$EDITOR. Howe... |
Is it a best practice to initialize class dependencies in a constructor or should a class be initialized in the method where it is used. Let's say we have the following situation, and PriceCalcService is used only in a couple of methods. Order also takes other parameters, and sets its state.
public class ShippingServic... |
I'm trying to rewrite some code I wrote time ago using some C++ good practices. To achieve such a goal I'm using as reference Effective C++ (1) and google coding convention (2). According to (2) a function should be declared inline if it is 10 lines or less, according to (1) furthermore the compiler could ignore the in... |
Let's suppose I have a backend with API-only Rails. There is also a Javascript single-page application (Aurelia, but could be something else) talking to this API.
Should I keep these together, in the same Git repository, integrating Rails with Aurelia to some extent, maybe with the Rails asset pipeline building/bundlin... |
A recent bug fix required me to go over code written by other team members, where I found this (it's C#):
return (decimal)CostIn > 0 && CostOut > 0 ? (((decimal)CostOut - (decimal)CostIn) / (decimal)CostOut) * 100 : 0;
Now, allowing there's a good reason for all those casts, this still seems very difficult to follow. ... |
I have been spending quite a lot of time trying to decide if I should use apache** or nginx. I am very biased towards nginx due to the simple configuration, better scalability and it just feels more secure overall.
However, AJAX is a must have on my list of requirements, so if nginx prohibits the implementation of AJAX... |
I think I've got the hang of writing a GA when you know the number of genes in a chromosome. For example, if you're searching for a string, and you know the length, you can just generate your initial population of random strings, then breed and mutate until you (hopefully) converge on a solution. Similarly, in the trav... |
I'm designing a configurable api and I've seen a few ways to accept options from the caller.
One is using an options object like so:
var options = new MyApiConfigurationOptions {
Option1 = true,
Option2 = false
};
var api1 = MyApiFactory.Create(options);
Another is using a configuration function:
var api2 = ... |
Say I'm writing a GA to solve the travelling salesman problem. I don't know in advance what the shortest path is, so how does my GA know when to stop?
If I wait until the best fitness doesn't reduce for a few generations, how do I know I'm not temporarily stuck in a local minimum, which some mutation in the next genera... |
I am working on a very basic driving simulation. I am trying to decide the relationship between the following objects: Freeway, Vehicle, Driver, ProximitySensors.
My real-world analysis suggests the following relationships:
A. Freeway has a vehicle: because a freeway can have multiple cars and a car can only have one f... |
Say that I have a C++ class with some fields with static storage duration, call it class A.
Is there some way to use inheritance to "inject" these static fields into classes which derive from class A? That is to say, if class B and class C derive from A, B and C will have the same static fields as the base class A, sha... |
I wrote abstract base for some turn-based games (like chess or tic-tac-toe) and wrote game based on this base. And I stuck with choosing how to design class hierarchy. Here is two variants for wich I came up:
And here is second screenshot (it is too long to post here as image)
In first variant all classes in different... |
I am designing a SaaS application where thousands of users will be using this application. This application will do lots of data crunching and analytics. I am considering creating a main database which will hold all user credentials and configurations, then I will create individual databases for each customer for stori... |
I have few async REST services which are not dependent on each other. That is while "awaiting" a response from Service1, I can call Service2, Service3 and so on.
For example, refer below code:
var service1Response = await HttpService1Async();
var service2Response = await HttpService2Async();
// Use service1Response ... |
We all may have seen applications like JIRA, or many CRM or other applications that allow its users to define their own custom fields to an entity, and do a variety of stuff with it, like making them mandatory, validate their values and so on.
I want to do just that in the Product we are creating.
Let's assume our pro... |
I'm a newer developer who has worked on some personal projects as well as non-profit/charity projects. However, I seem to be the most "senior" developer in my circle, meaning, most guys come to me for help and when I need some help, they can't help me.
As I don't have a full-time programming job, I'm sort of lost in te... |
NULL is the billion-dollar mistake but there is nothing in the type system of C++ to prevent it. However, C++ already has const-correctness so implementing NULL-correctness seems trivial:
introduce a keyword, __nonnull, as a specifier in the same class as const, which can only be placed after the * in a declaration.
A... |
My model objects are generated by the library using hard-wired new operators, which makes dependencies injection using the constructor impossible. However, they also have methods, which are called by the library (i.e. adding service objects as parameter is not an option), using external service objects for the logic.
I... |
I'm planning to add a feature to my application where you can switch to the "Translation" locale and then see the names of the translation placeholders in the application instead of the actual translations. Another nice thing are "context descriptions" where you see explanations in plain english what the placeholder ac... |
Due to some issues with other shorteners like goo.gl (disabling my links for example) I want to create my own URL shortener.
I am looking to have a single table that will contain the following columns :-
links_id - autoincrement id
url - the actual full URL
abbreviation - the shortened version
In a nutshell, when a n... |
I've heard both about use cases (I'm talking about the description, not the diagram) and user stories being used to gather requirements and organize them better.
I work alone, so I'm just trying to find the best way to organize requirements, to understand what has to be done in the development. I don't have, nor need, ... |
I recently asked a question about design and got suggestion about how to structure my code. I'm still working on design so I only have pseudo code, but this is what I had in mind.
class TableManager()
{
int init(DBManager manager, String name)
{
this.name = name
this.manager = manager
}
... |
I have a situation where I need to make a decision between choosing multiple environments or sticking to one. The Business wants to use multiple, but it is simple glossary (list of terms and definitions) which we link to our development tools. Considering the fact that it is simple glossary and not code development, I ... |
Given a system with static permissions (1 permission for every action that can be made: create a resource, update a resource, etc), and dynamic roles (can be created and assign permissions to it dynamically).
The system have a preconfigured set of roles with the purpose of initial setup and/or testing. These can be de... |
Both classes below implement the same interface and are in fact intended to be interchangeable one for the other. Why is the second one not referred to as a "client" in the literature?
There are many references to service layers, repositories, etc.:
How essential is it to make a service layer?
https://www.asp.net/mv... |
For an example,
In a testing phase if i got a defect which is due to some delayed job restarting,can I raise it as a bug?
In our project,devteam merges and deploy their codes into test site.
usually there occurs some issues which is due to not restarting a delayed job.
We used to log it as a bug.
but development team p... |
As I understand in the 3-tier architecture, the presentation layer talks to business logic layer, which talks to data access layer. And, ideally, business layer knows nothing about presentation, and data access layer knows nothing about business layer. I want to write classes to do CRUD database work that are separate ... |
I'm currently writing an application and I'm struggling with the decision of how to correctly design a class to connect to a database. I came up with something like this:
public class DatabaseConnector {
private Connection databaseConnection = null;
public DatabaseConnector(String url, String user, String pass... |
How do we compile analytics from millions of rows in a PostgreSQL table?
We pull order data from multiple CRM's and need to compile the data for reporting and each CRM has it's own orders table. We compile these tables into a compiled_orders table in 24 hour increments.
Our current implementation uses SQL Views to agg... |
I was reading through a Java book by author Herbert Schildt and he writes how the advantage of Java over C++ in portabilaty is that while C++ can be run anywhere, it still requires each program to be compiled with a compiler that was created for that CPU, and creating compilers is difficult, while Java doesn't need to ... |
I have 2 JVMs on the same machine that I want to pass about 1Mb of (serializable) data between ideally in under 5 ms.
Under load, using HTTP to localhost takes about 70ms average.
I tried hazelcast, passing the data via a distributed queue - about 50ms average.
Is there a faster way?
I'm using spring boot.
|
I am planning to write some financial modeling software targeting enterprises. It will be based on an existing open-source project that already has a BSD-3 license. I do not own the copyright to the original project but will be using it to create my derivative work. I would like to keep my project open-source as well b... |
When people talk about MapReduce you think about Google and Hadoop. But what is MapReduce itself? How does it work? I came across this blog post that tries to explain just MapReduce without Hadoop, but I still have some questions.
Does MapReduce really have an intermediate phase called grouping as the article describe... |
I'd like to follow the RAII(resource acquisition is initialization) idiom throughout my code but I'm also doing the template pattern where I'm developing generic versions of my classes and using them to build a common codebase for certain things. Sometimes I need to enforce an initialization sequence where I would need... |
Below is the working List abstraction design,
List is a generic abstraction holding any type.
Below is the code directory structure. Currently symbol table(ST) and file api fileIO is using List abstraction.
./Code$
.:
fileIO list ST tinyTale type.h frequencyCounter.c frequencyCounter.exe
./fileIO:
file.h fileRead... |
After 50 years of software engineering, why are computer systems still insecure? I don't get it.
Two questions: (i) What's so hard about just denying or restricting networked access to bad actors who lack passwords? It's not like these bad actors arrive with crowbars and dynamite; they only have bits and bytes, right? ... |
Let's say I have a complex software product about which the information or knowledge is scattered all over the organization that built it. There are requirements and features about which even the Quality Assurance/Testing department is not very sure.
There are also many facets of the same generic software product and t... |
In Domain-Driven Design much is said about the domain experts. They are the ones who knows about the domain, and which should be in contact with the developer in order to build the ubiquitous language and hence the domain model.
The only problem I have is that from a practical point of view I don't know who the domain ... |
Scenario: An open-source PHP project that has existed for several years has too many classes in the main namespace that we want to refactor some of them into another namespace, but we have a widely used and diverged plugin API, and refactoring may cause a major backwards incompatibility. This plugin API is basically lo... |
Garbage collection happens during runtime, real time, while managed code is running. In C++ however, we need to write destruct statements into the code. So we could say that GC is built into the code (by us). So why can't managed languages behave like this? The compiler would analyse the code and insert the destruct me... |
The point of redux is to decouple "what happened" from "how the state changes" according to Dan, anyway, but I'm having trouble figuring out how to handle side effects without having getters and setters.
Here's where I am now:
User enters email + password and taps "log in"
App fires off { type: "USER/LOGIN", payload: ... |
I'm developing a Ruby on Rails app. The app contains a service wrapping an external REST API, called from a controller, with several possible error states. The current implementation returns the response body on success and raises a service specific catch-all exception otherwise.
I want to refactor this to be able to d... |
As many other questions and answers already stated, there is no syntax in C++ which allows you to declare and fill a dynamic-sized array with non-default constructible objects.
Obj* array = new Obj[size];
Here, if Obj has a default constructor, it will be used to fill array with size default-constructed instances of... |
I'm trying to learn proper object-oriented design, with class relations and avoiding anemic domain models[1]. I'm creating an application to store and retrieve information about "cyberattacks". There are five relevant classes to this question:
Directory: the class representing the collection of the data indicated belo... |
I would like to modelize some nucleotid chains : ADN & ARN.
ADN is a list of nucleotids : A,T,G,C.
ARN is a list of nucleotids : A,U,G,C.
ideally, I would like to define e.g. ADN as a list of data types A,T,G,C.
I have this code, which works but doesn't suffice:
data NtADN = Td | Ad | Cd | Gd deriving (Eq)
data NtA... |
I was wondering if a value that is defined by the user at the start of a program, and not modified by the program, is considered a constant or a variable. I know that a constant is a word/letter that holds a value that is not changed during the execution of a program (EG: pi or e), and a variable is also a word/letter ... |
I have a data model based around users. User owns records on several derived entities, e.g. A user have tasks and each task have documents. Documents don't have the User ID in their properties, only the task ID.
I want to allow users to read and update only their own documents via the /documents endpoints.
What is the ... |
When encoding our chromosome's characteristics (for want of a better word), binary seems to be the favoured method. I understand that this gives the maximum possibilities for crossover and mutation, but it also seems to have a serious limitation.
For example, suppose I am trying to solve the problem described here, giv... |
I create Application for my client. I use some libraries released on GitHub under MIT, BSD and Apache license. I create also documentation (PDF file) where I would like to point what libraries and components I've used.
What details about libraries should I place beside the name/source of library to satisfy MIT, BSD and... |
I was hoping you could give some feedback on an idea I had for designing functions.
I am trying to think of a unifying principle for choosing what functions should return. The specific project is mostly data access classes.
So the principle is this: "When deciding what value to return as a status code, either True or F... |
The Scrum Team
3 x Developers
2 x Testers
1 x Automation Test Analyst
We are not a multi-functional team in that the developers don't test and the testers don't develop. I believe this is the root cause of the issue.
We currently do two-week sprints.
At the start of the sprint everyone is busy, the developers are m... |
I'm in a bit of a tricky situation where I need to use the Observer pattern but I don't really know the best way to go about it.
Here's a quick briefing on my application:
I'm implementing a GUI application that allows users to create flowcharts and mindmaps by dropping shapes onto a canvas and then manipulating the sh... |
In Test Driven Development (TDD) you start with a suboptimal solution and then iteratively produce better ones by adding test cases and by refactoring. The steps are supposed to be small, meaning that each new solution will somehow be in the neighborhood of the previous one.
This resembles mathematical local optimizati... |
Below is the design, that is implemented similar to design used in Linux/net/socket.c.
Below design provide List abstraction,
where, list.h provides List interface, show here
Background:
Reason to implement List abstraction in this approach is to consider as a prototype inspired from Linux/net/socket.c design, wher... |
In JS you can return a Boolean having custom properties. Eg. when Modernizr tests for video support it returns true or false but the returned Boolean (Bool is first class object in JS) has properties specifying what formats are supported. At first it surprised me a bit but then I began to like the idea and started to ... |
I have been a developer for past 3 years and I have been seeing interface in most of the places as a contract for the developers to write their own implementation or a marker (eg. Serializable). But I quite dont understand how this concept is named as INTERFACE in literal meaning. Am I missing something pretty basic?
|
I have a general question and unfortunately no background in programming apps, so I'm sorry if this is a stupid question:
If my app has to process difficult calculations for which the power of the phone or tablet would not be enough, would it be possible to outsource these calculations to an external server?
And if th... |
I'll try word this as succinctly as possible.
I currently have an object called a StoresAdaptor which inherits from a base class ERPAdaptor, that takes a Stores object and pushes it into a 3rd party ERP system via an adaptor design pattern.
Now, there are multiple types of these Stores movements. Each has their own imp... |
I'm looking at implementing a new RESTFul call where a User can follow/unfollow a generic 'thing' item, but I need to know the best or common approach below, 1 or 2?
1) A GET or POST on the following URL's:
user/{thing_to_follow_id)/follow
user/{thing_to_follow_id)/unfollow
Or
2) A POST containing thing_to_follow_id... |
I am wondering if it is a good idea to do the following:
I have a Django model (which is related to a migration, therefore it has a database entry) with a bunch of properties. Accessing these are obviously hitting the database every time.
I also have many methods using these properties, like:
def is_good(self):
retur... |
I am facing problems structuring projects and libraries.
In the company I am working for I often see, that things would be more maintainable and less error prone, if we could extract common code and build libraries with that code.
A simple example may be the usage of a custom logging library instead of copying code fro... |
For developing a C++ dynamically-linked library (i.e. shared object) which may interface with C programs, what is the best practice to save program state across exported function calls?
I as a not-experienced C++ programmer can think of the following methods:
Compilation unit level static variables.
Instantiate a stru... |
After looking at a lot of session/state debates with regard to REST and finding nothing concrete, I'm just going to cut to the chase and ask myself.
Developing a RESTful API as a backend for a mobile app, I (think I) want to keep track of all users (even unregistered ones) with guest sessions. This allows me to customi... |
I am a budding software engineer (now a sophomore, major in CS) and I really struggle to understand other people's programs. I want to know if this skill (or lack of it) can be a handicap for me, and if yes, then how can I develop it?
|
When using bpmn to specify a process model. And using UML to specify a use case diagram. Don't they both describe processes? What's the difference between the two?
I'm reading a course which states:
A process model makes the processes in which the system is used
readily understandable, but does not hold enough detai... |
How do you collaboratively develop software in a team of 4-5 developers without acceptance criteria, without knowing what the testers will be testing for and with multiple(2-3) people acting as product owner.
All we have is a sketchy 'spec' with some screen shots and a few bullet points.
We've been told that it will be... |
I have a number of web services that form a web application. Clients can access these services through REST APIs calls.
Should these services be able to talk directly to each other? If so wouldn't that make them couple which goes against the concept on microservices?
Should the client call them directly one after anoth... |
I am going to build raspberry pi based device which reads data from sensor bus (serial port), analyzes it and present it on touch screen.
Touch screen will be also used for configuration.
Device needs to have web interface with equal functionality.
What I am planing to do is to split application for 2 or 3 separate ... |
I am currently perusing through Jdk 8 and I came across the feature where you have multiple interfaces that overlap with the same method signature for a default method, the compiler will throw an error if you try to have one class implement both interfaces, to prevent the problem of ambigious methods with multiple inhe... |
I want to keep a dependency decoupled, but at the same time, once it's passed to the constructor, I want to allow changes only through Whatever (in the following example) because changing the dependency from the outside would invalidate the state of the Whatever object that depends on it. So I keep a copy instead:
clas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.