instruction stringlengths 34 36.1k |
|---|
Let me give a bit of background on the problem.
We have a java application which has MQ integration and an Integration Test pack which is also written in java.
The test pack runs all scenarios (positive and negative) by running the test cases (methods) and changing the parameters depending on the scenario. The way it d... |
My application follows repository pattern in the data access layer. However, I see, in repositories' data retrieval methods, column names and table name are hard-coded strings, which I think is not the right way since it is becoming a boilerplate code in many other methods too, with minor differences due to one or two ... |
Normally in java the RowMapper is placed in its own class.
Instead, what about this design, putting the RowMapper inside each domain object, and giving all of them a consistent name:
public class Address {
private String city;
public String getCity() {
return city;
}
public void setCity(Str... |
I am currently making an html-based editor, i know there are lots of editors out there especially html based but i want to do it myself once. What i am concerned about is, for e.g, when a user press a key, following operations will happen.
check if some text in the editor is already selected, if selected delete that t... |
The Iteration Planning Meeting (IPM) is equivalent to Sprint Planning. Before IPM, our team holds a Pre-IPM meeting which helps us avoid long IPM and get more details about the stories. This technique was suggested by one of our Agile consultants, but I couldn't find much info about Pre-IPM on the Internet.
What is the... |
So I just came across an extension method built into ASP.NET MVC: ChildActionExtensions.RenderAction(...). This invokes an action method using the given parameters and renders the result inline in the view.
This surprised me because I thought the MVC architecture had the controller setting up the model and passing it ... |
I'm struggling to understand the differences between an API such as a REST API and an ORM such as Entity Framework. I would also like to understand the benefits of each and in what situations either should be used.
It seems to me that they both act as a middle man and enable you to access and manipulate data from a dat... |
I'm putting together some ideas and personal conventions on how to configure state machines when using a language specific library.
Because I'm adding state machines to existing model classes in my project, some of the states I wish to leverage are distributed across their relations. State is not contained in a singul... |
My problem concerns two services: NotificationService(should be used by more than just the SurveyService), SurveyService.
I want to send recurring notifications to the user asking for participation in a survey. These should be sent in a certain interval until the max notification number is reached or until the user par... |
I need to design the feature like in encommerce(consider hotel booking site) we can enter the keyword/partial-keyword and need to return the relevant results.
For Example :- If site admin or hotel owner needs to add the below hotel details in system , It will be added in cache also(basically it will be write through ca... |
I was looking at this documentation.
https://laravel.com/docs/5.6/passport
it is quite long and I asked myself, why would one use this, over just a normal login where you store necessary information in the session?
E.g. when to use proper API, and when to just use web form login in a normal way?
|
I'm new to javascript environment (I have background in C++ physical simulations and game engines). With rise of HTML5 and WebGL I was thinking I'd like to try make some games/3D editors using javascript.
Problem is that larger project like game with 3D engine starts to be very messy. Instead of build system (makefile... |
When I think about the pros and cons of a static library folder and a package manager I feel like the library folder is a better approach.
Pros I see with a library folder:
No need for an external tool to manage packages.
No internet connection required to build.
Faster build (no package checking).
Simpler environment... |
I'm building web API. I have a problem where input differs from the output, for example, input expects just the id and output returns entire object.
Also, there are few things specific to the output that should never be sent in the input. For example, something that server calculates and returns it, but the client doe... |
In C if i declare
int x[4]
Which tells me its an integer array with each array element size fixed of size 4.
So after initialization when I access x[3] : address of array +element size which is 2 * index => (x[3]=2000+2*3) Assuming 2000 is the array address
In Javascript
We have
var a=[3,"rohan",6] //Dynamically type... |
Having a component that represents the database is wonderful! You can use it from the business logic to read and write data. But should that component be unit-tested?
I would argue that it should not. Unit-tests are all about testing the contract of a component with its external actors.
Let's take a typical interface ... |
C# 6 added auto-property initializers and so we can do
private List<LinearLayout> layouts1 { get; } = new List<LinearLayout>();
Is this better or worse than
private readonly List<LinearLayout> layouts2 = new List<LinearLayout>();
(N.B. this is related to the 2011 question .NET Properties - Use Private Set or ReadOnl... |
I've read answers to the following:
Why is Windows registry needed?
However I am curious about how this might apply to the practice of storing software license keys. I've seen developers store license information in the Windows registry, such as keys used to keep the software activated over a period of time (until the ... |
I'm struggling with the separation of logic between entities and interactors or Use Cases. If I design the entities with DDD principles, each entity would have methods corresponding to use cases, instead of setters and getters. In that case, I would case, I would have roughly a one-on-one mapping of interactor classes ... |
SQL Server 2008 reaches its "end of support" date next year: 7/9/2019
But it reaches end of life much later: 7/31/2023
link
What is the difference?
Is this terminology common to Microsoft, or to the software industry? Or is this uncommon?
|
We are discussing the system configuration module design in our Java medical device software. The system has a voice instruction function used to guide patient during the examination. Different patient may speaking different language or dialect. So we need to set up (add/delete and add/delete again) what kind of langua... |
I know there has been 1 million and 1 discussions about Singletons on SO and here and I have had to clean up my fair share of terrible singletons in our code base; one of the reasons I am gun-shy here. But I am running into a situation where I feel like a Singleton is a reasonable solution and wanted to see what others... |
I want to create Logout Functionality in Angular 5. The logout function will contain following pseudo code:
Clear local storage authentication JWT token
Redirect to login page
My question is; where should the above code be; In a component or in a service?
I believe, a service should contain logic which interacts with... |
According to Why should I prefer composition over inheritance?, I should prefer composition over inheritance. But what if I need to access the interface and class member in generic way? For example, I have parent class Shape and some child classes:
public class Shape{
private String customId;
public String getC... |
I have done weeks researching this question for my App Idea.
Background of the APP - Simply a multi crypto currency wallet which users sign up with ONLY username and Password - no email, FB, or Google etc...
Users can search other users to add to address book etc. When a User registers their account on one of the three... |
Please settle an argument between me and a friend.
We'r currently designing a product API. Our Product entity looks like this
{
"Id": "",
"ProductName": "",
"StockQuantity": 0
}
Product sales are handled by a 3rd party and they are obligated to inform us with the purchased quantity so StockQuantity field c... |
I'm working in a C# codebase that was largely written by a former developer and this pattern is used extensively...
public class AuditInserter
{
public static void Insert(
DataContext dataContext,
Person person,
AuditableAction action)
{
return
new AuditInserter(
... |
I am creating a Parser assembly in C# to parse a XML structure. I have a XML schema defined for the XML files.
Using XSD tool I have created Class structures from XML Schema. The XML has various level hierarchy. So there are lot of class structures available.
Now In my Parser assembly I have serialize code which dese... |
I'm designing an app architecture using OAuth 2.0. I have a separate Resource Server and Authorization Server. The latter keeps a database of users and the scopes available to them.
Now, my question is: How and where to store/model fine-grained, per-resource permissions?
I'm talking about a scenario similar to what hap... |
The title is intentionally hyperbolic and it may just be my inexperience with the pattern but here's my reasoning:
The "usual" or arguably straightforward way of implementing entities is by implementing them as objects and subclassing common behaviour. This leads to the classic problem of "is an EvilTree a subclass of ... |
I've got a set of classes that all inherit from a base class that are responsible for different functions (sort of like a group of "operators") They all work on the same input and output the same output type, just different operations are performed internally with some other state. They need to be serialized to JSON ... |
GPL requires all source code be made available, but I am unsure how trained neural network models interact with GPL since it's unclear if these models count as source code.
To have a concrete example to discuss, consider this example:
Suppose you are working on a mobile application. Because the application contains GPL... |
I have been learning angular for a while now and I understand the point of modules and components (briefly) but now I am starting my own project using the framework I am somewhat confused. When should I choose either a component or a module. Can you help?
For example, for the site's basic wire-frame (ie headers, footer... |
I have a software project which grows rapidly in an unexpected way, many customers request similar tasks but with slightly different needs and parameters. I start to dislike my current code structure and I have two ideas in mind how to improve my code:
I have a shared library with shared functions in it. This library i... |
We are "extending" a product developed by a third party and working with them on that. There's a small problem though. They have some functions (written in java) that they use in their Android mobile app and we need to use these functions in our development too. The other side is not too sure on what is the best way to... |
I'm building a Selection class that holds and allows manipulating selected Items on a canvas.
The Selection is part of the Document, the top-level app-container if you will.
I'd like to be able to clear the selection from inside the Selection class.
The problem is that selection creation/clearing is done on the Docum... |
So we're having a rather heated debate at work as to what would be the best practice going forward while refactoring our reporting system. Most of us have some strong opinions one way or the other, but we are all also mostly failing at articulating what we feel would be the best approach. I'm mostly looking for some in... |
Is there a memory penalty to passing around large objects (like an entire http request, or the blob contents of an uploaded file) between functions within the same (Erlang) process?
It is my understanding that Erlang passes arguments by value. This would mean passing large objects means their "value" is passed each ti... |
I have a normalized relational database. I often find I need traverse multiple tables to get the related object of a related object and so forth.
So by that I mean let's say I have related tables A->B->C->D. In a process that uses both A and D, this might be a costly traversal to go from A to D. I'm thinking of adding ... |
I am confused (easily done). To me model is the data from the database sent back as JSON.
When I think of that in an Angular context, when two-way binding is configured, it makes me think the framework is watching/polling the database so that when some other user/process/etc. updates the database, the other user(s) w... |
I have a simple relationship where top-level items (Recipe) have a one-to-many relationship to children (Ingredient) and each item has a unique identifier (ID).
For simple CRUD operations the flow is:
RecipeService -> RecipeManager -> Recipe
IngredientService -> IngredientManager -> Ingredient
I struggle wi... |
I've been coding in C++ professionally for six odd years, and it's my go-to language for performance-critical projects. When working to a deadline, the scope expands to fill the time available. Without that deadline, such as in personal learning projects, the scope exponentially grows until I'm exhausted. I start wanti... |
I have a suite of microservices:
ConnectorRegistrar
ConnectorTypeA
ConnectorTypeB
...
ConnectorTypeZ
"Someone" can make a call to the ConnectorTypeA microservice to create a connector of type A, and it is needs to be known that "Someone" is the owner of that connector.
When ConnectorTypeA is created, it needs to regi... |
I have a .NET application (actually this can be a problem for any N-Tiered application) which has 3 separate components.
ClassLibrary
Has Cross Cutting Concerns like logging, authentication and IoC resolving.
Has static Utility classes for Encoding/Decoding, Encryption etc.
ThirdPartyApps
Has external library r... |
I have an open-source library that provides multiple services around a particular domain. I would like to know how the various components are being used so that I can prioritize updates and new features.
The primary way of collecting that data in applications is usually through anonymous stats collection. But as a us... |
i have made a normal text editor.Now user can enter text to that.Now how can i generate html that is text enclosed within p tag and /p tag(tag p because at this i only want normal paragraph),now ok somehow i will enclose every word with that p tag but what if in future i want to add extra features such as links,etc.Als... |
I'm wondering what is the proper way to send structures as char array by sockets.
At this moment I have somethig like below but it isn't good solution because it causes undefined behavoiur. Is it possible to send types like string or other user-defined types?
Or maybe structures which works as protocol frames should on... |
The Developer Certificate of Origin appears to be widely used in open source at this point, including support at GitHub and use by GitLab community edition.
In accepting a pull request, many folks (including me) like to use a "squash" merge where all commits are concatenated into a single commit. But then, this isn't e... |
I have seen examples where even though the object is immutable there are situations in which we need to update some fields and as I understand it, the object is passed to a constructor which makes a copy with updated values but the original is not changed. Fine, but what if two threads want to do this? Do we not run in... |
We use Google Pub/Sub for event streams which we want consumed by transient websocket clients. What is a good pattern for creating subscriptions and cleaning them up when the client is no longer connected? The main use case is an admin portal where we want to update the display in real-time based on data change events.... |
Lets say we are making an API with two resources: Author and Book where books can have many authors and authors can have many books.
So we design the REST api like so:
/books
/books/:id
/books/:id/authors
/authors
/authors/:id
/authors/:id/books
Should, for example, /books/:id return the Book with the given id and the... |
ER model appears in both database design and software design.
I was wondering if ER models in both designs are the same concept? If not, what are their differences?
Thanks.
|
I'm working with visual studio. The solution contains the 4 following projetcs :
DAL
Works with Entity framework + Repository pattern. It contains the DB classes + Repositorys.
BLL
It contains the DTO classes + Services.
Services map the DTO classes with the DB classes. It references the DAL project.
IMessageReposito... |
I need to fill a Products table in file A with their manufacturing costs that are in another Costs table in file B.
Currently, I read Products and Costs tables into their respective arrays and for each product I iterate over each cost looking for the right one. Basically, VLOOKUP done with arrays.
Isn't it O(n^2)? I fe... |
Let's say I have microservice A and B.
Microservice A calls microservice B for some piece of information.
Microservice B requires parameters 1, 2, and 4 for the request to be valid.
If I'm simply mocking the API call & response between Microservice A and B, how does that enforce the contract for B, in that, B requires ... |
I'm in researching phase of CQRS+ES. Never done in real world yet. But very soon.
However what I saw in StackOverflow and projects, CQRS seems to be fire and forget.
So what if there is a chain command which need result from another command.
First example, reward management and account management bounded contexts
Appl... |
I am maintaining a old .aspx page in which all the data required by the page to show the content is passed in the URL of the GET request as a part of query string. The result of this is that, as we keep on adding features, the URL keeps getting bigger.
I am thinking of shifting all the parameters from the query string... |
I have an Android library used by a decent amount of people, let's call it library A.
I am building a second library, library B.
The two libraries are conceptually related, they solve different problems in the same domain. It's likely that the two libraries will be used together, but it's not mandatory.
The problem: li... |
I have a rather simple (i thought) setup that causes me some grief.
I am using a queueing system (AWS SQS) and a few worker docker containers with code written in .net core that pull from a queue and process messages.
Multiple workers can pull from a queue at the same time.
Certain operations belong to a single job. E.... |
This is almost everywhere. For example, I need to pick a fruit from a list of fruits from a dropdown. And the last option on that dropdown is "Other", by selecting that another text field appears to allow users to type their favorite food.
Assuming all the data comes from database, what would be the best way to impleme... |
Our line-of-business software allows the user to save certain data as CSV. Since there are a lot of different formats (all called "CSV") in use in the wild, we are tying to decide what the "default format" should look like.
Regarding line/field separators and escaping, there is a standard we can use: RFC 4180.
Regard... |
Let's imagine we have a service CustomerService:
public class CustomerService
{
public Customer GetCustomer(string customerName)
{
if(string.IsNullOrWhiteSpace(customerName))
throw new ArgumentNullException(nameof(customerName));
try
{
var customer = customerRepo... |
Let's say I have an application that works around departments and employees. Each department has a set of rules that defines which employee is assigned to each department. For instance the system will auto assign the employee to a specific department based on some properties like number of years experience or spoken la... |
Going through the Command design pattern I understand that we need to create a Command by setting the context via constructor and then calling the execute method to perform some action on the context. Example:
public class Command implements ICommand {
Device device;
public Command(Device device) {
th... |
This question is about the application's architecture and is thus language independent. Should it matter: I'm using python 3.6 and http.server.
Context and architecture
I'm writing a software that downloads some items from an online provider. The application will run locally but the design will be done with html so I'm... |
For the concurrency programs I have been writing in C#, my locks/synchronization tend to follow this pattern:
try
{
Monitor.Enter(locker);
// critical region
}
finally
{
Monitor.Exit(locker);
}
This is a classic pattern I've discovered in one of Paul Deitel's C# books years ago, and have been following ev... |
I'm trying to remove some restrictions programmed into a game like Sims 3 but some features like age restriction are hard-coded in the game's code so I read some tutorials and I found out that it's something hard-coded in the game's programming. What does hard-code mean in programming?
|
Just got off a retro call where developers expressed concern around the integration of their stories into the master branch each sprint. The developers all code within their own branch and towards the end of the sprint they all merge into one master branch.
Then, one developer (usually the same one) is left with the t... |
I'm setting up an AWS API Gateway + Lambda micro-service that will return non-sensitive but user-specific data.This means that the responses from the service can't be cached and served to multiple users.
There is a possibility that unauthorized third parties will hit this service and cause large spikes in resource usag... |
I'm creating a Web API with a lot of REST Resources.
My service also have some tasks which should be started on demand. for instance "Start sending emails".
For now I do have a specific URL which I call "api/v1/start" in order to start emails queue sending. But I'm afraid that it is not in comply with the REST standard... |
We're currently in the process of designing our new version of an existing application. This new version will not reuse any existing code as the old code is over 10 years old and tightly coupled.
With this new application we'll be designing a persistence layer. And as we want to adhere to an agile development cycle. We... |
I will use the following popular todo list example for demonstration. Let's say I wanted to create a very basic todo list with this structure as the app state:
{
todos: {
todoKey1: {
content: "todoKey1 content",
...
},
todoKey2: ...
}
}
Because of the recursive n... |
While doing Android development. There is really no clear way of doing network operations, sending and receiving data.
Currently I am handing it using HttpsURLConnection and having streams to build a request and response.
But I've seen on Android developers under Connectivity. Transmitting data using either Volley or C... |
I often received messages objects and for each of them I need to query the database in order to achieve some additional information from one database table. Since we are performing many requests to dabatase that it's very inefficient.
So, how I could improve the performance ? I think I need to persist the table data to... |
I'm working on a module for clustering algorithms, clustering.py.
I noticed several functions in the module only pertain to the mean shift algorithm, so I thought it might make sense to group them under a MeanShift class.
Right now, it looks something like this:
class MeanShift:
def cluster(args):
*code*
... |
For the past few months I've been messing around with implementing my own version of a well-known board game. After much experimentation I've arrived on a few key points that describe my system:
The game state is centralized and serializable. The server can be interrupted at any time, but simply by pulling the state f... |
I have a SQL DB2 table where the first two fields are the primary keys (not including the third field which is date/time stamp).
The table was designed by another team with the intent to make it generic.
I was brought into the project after the key value for the second field was coded, for when it was inserted onto the... |
As an exercise to building websites and putting DDD to practice, I am currently in the planning stages of creating a crowd voting app based on a video game I play often. The video game allows people to build bases of which can then be attacked by other players. In the app, I want users to be able to either vote up or v... |
In DDD we defined domain's identifier as ValueObject. Regard here
How ever in last project I implement those ID like so
public struct UserID {
public readonly string GUID;
}
public struct UserAggregateRoot {
public readonly UserID userID;
}
As it a ValueObject, However in most projects I've saw don't really r... |
How would I implement a shortcut finder into an A* path-finding algorithm? Assume that every tile is represented by an (x,y) coordinate, and I know where every "good" tile and every "non-walkable" tile is on the grid. How could I best find the solution to this problem on a large scale where the starting and ending spot... |
I'm not exactly sure what the history behind this, but Debian and Ubuntu currently wraps around some of the PostgreSQL utilities with something called pg_wrapper. This utility uses LD_PRELOAD to instruct the linker to linker against libreadline. So there are two libraries here that are similar:
libreadline a GPLed ver... |
I have a MDI MyMDIWinForm that needs an instance of IGUIErrorHanlder for error handling, At the same time IGUIErrorHanlder depends on the MDI MyMDIWinForm for having a place from where to launch pop-ups and other stuff.
public class MyMDIWinForm
{
readonly IGUIErrorHanlder GUIErrorHandler;
public MyMDIWinForm(I... |
Let us say I am working on a project with maybe 100 nuget packages installed and 50 of these packages require an update.
I would ike to get a clear overview on which package updates cause any problems. I was thinking of something like this but any other ideas are welcome:
Foreach nuget package installed
Check if it n... |
I have developed a restful WEB API 2 (C#, .NET 4.7) for an internal integration project. In my API's backend, I need to use a vendor's dll in order to process the provided input.
The vendor's dll is written in C, and it has a limitation that, there cannot be more than 8 initialized instances at the same time.
Since my ... |
For example, to create flow indicator like:
Step 1 > Step 2 > Step 3
I can either:
1.Use html+css
.concave{
border-left:1em solid transparent;
border-top:1em solid orange;
border-bottom:1em solid orange;
}
.middle{
background-color:orange;
}
.convex{
border-left:1em solid orange;
border-top:1em solid tra... |
I understand that a each service in a microservice architecture should have its own database. However, by having its own database, does it actually mean simply having another database within the same database instance or literally having another database instance?
By this, I don't mean sharing of databases, which is a... |
I've recently read this blog post regarding what a constructor should do and I am also reading Eric Evans' book on Domain Driven Design.
Both the blog post and the book state that a constructor should have a bare minimum amount of logic in it, as to bring the object to a sane default state. But my question is, shouldn... |
My course notes have stated that a system should have a system class which coordinates the behaviour of all other objects in the system and should be one which is instantiated only once.
In many real life examples encountered such as a Library or a Hotel, it is clear that the Library or Hotel class would be the system... |
Suppose if I have an abstract Weapon class, and the subclass ReloadableWeapon which implements the interface Reloadable.
interface Reloadable {
void Reload();
}
public abstract class Weapon{
@override
public abstract void attack(Player enemy){}
}
public final class ReloadableWeapon extends Weapon implement... |
I am currently trying to test a file manager class. This class is responsible for keeping track of how long the file is good for. The file will have a date written into it that denotes when it was generated as well as the duration of how long the file is good for. Consumers of my interface will be agnostic to these det... |
I have a few big services, that uses the same database and tables for managing roles and permissions. Each service ask the database directly for the permissions.
Now I need to build a new service. The idea is to create a centralized service that would handle all permission staff. Afterwards, my team is going to migrate... |
I have a written a function and intend to provide an input variable so that when it is true, user-information is printed to the console. If the variable is false the function is 'silent'. Console data is not necessarily for debugging purposes.
In the course of choosing a name, I came up with "verbose" and this led me... |
Hi I am working on application 2.
My application interacts with application 1 and 3.
Clients of application 1 need to be to share their linkedin profile information with application 3.
I have created a simple authorization to linkedin and presented it to application 1 as api.
I now would want to build :
1) Either d... |
This is an MVC design/refactoring question.
I am using a Controller and inside I do these tasks:
I get Price of an object from a database, for which I use a repository pattern
Create a LineItem object, which I initialize with the price and other data
I Execute the "save to database" command, for which I use a SaveLine... |
So been doing a lot of reading/research into clean code/design, OOAD, refactoring, TDD, etc. Just trying to improve my designs to be easier to extend and maintain. One thing that is come up quite often is avoiding doing "real work" in a constructor.
I won't post the resources here but names like Misko Hevery, Bob Mar... |
I've got 'Lists' that contain different objects sometimes with similar class, sometimes with different class.
So I have a table 'lists' to store a list.
I have a table 'strange_objects' to store a strange object and
a table 'regular_object' to store a regular object.
Now I want a list to have several objects in order. ... |
Disclaimer: I realize this is not the easiest or even best way to handle this and I am asking largely out of a sense of curiosity, not because I'm convinced this is the proper way. It's a fun puzzle I've been wrestling with for a day or so now and can't figure out (and can't seem to find a good answer online either!)
... |
Is it a good practice to redefine unavailable keywords with macros?
I use GCC 4.8 in one of my projects which isn't exactly C11 standard compatible. At least not the extent of 4.9. But there are some cases where I'd like to use the modern static_assert to statically assert some expression at compile time which isn't su... |
I understand the concept of mocking API responses and their uses in unit testing, but in functional/integration testing, I actually don't want to mock because that defeats the purpose.
For example, if I have microservice A and B. A user creates a record with A, and A needs to send some data to B, and B creates another ... |
I feel this is so basic, but it just seems too easy and obvious and why didn't someone suggest this 10 years ago. And I know there a lot of much brighter people than me in the software dev business...
So I've been asked to do a quick-n-dirty job (2 days) for a web page app - collect a form, retrieve and duplicate for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.