instruction stringlengths 34 36.1k |
|---|
Knowing that BDD somehow avoids using the term "test", I am trying to understand the process as described in a book called The Journey to Enterprise Agility: Systems Thinking and Organizational Legacy.
They describe the BDD process like that:
Select a scenario from a feature
Write a failing scenario step
Write a faili... |
I am an Electrical Engineer now training and working as an embedded software developer, so I have little formal computer science and software design training. I have until a few months ago only worked in C and functional programming, but started recently working with C++ and OOP for Embedded Linux with a team whose dev... |
In university, at our algorithms courses, we learn how to precisely compute the complexity of various simple algorithms that are used in practice, such as hash tables or quick sort.
But now in a big software project, when we want to make it faster, all we do is look at individual pieces -a a few nested loops there that... |
I'm hesitating between algorithm and implementation as most of the questions here on how to prevent coupling between implementation and tests are about using spies/stubs or mocks.
The typical problem is that the tests are merely mirroring the SUT because tests are focusing validating behaviour instead of state.
The cou... |
I have a Product entity with a Category value object (contrived example).
There's an API endpoint /products?category=Keyboards,Mice
The classes at play here are the:
ListProductsController (interfaces layer)
ProductsRetriever (application layer)
ProductRepository (domain / infrastructure layer)
Product (entity / aggre... |
In our organization, we have several databases. Each of them has lots of schemas with tons of packages, procedure, functions and so on. Now, I wonder what approach is best in terms of organizing those objects in a git repository. Should I have repositories based on schemas or application they're used by? There are lots... |
I have a class that contains an object (set in this case). The set is modified by the standard function operators __add__ and __sub__, but I also want to explicitly expose a method of getting this set.
Should the @property decorator be used instead of a simple get() method, even if there is no intent to allow setting ... |
[Node.js / CommonJS]
I'm creating a single GitHub repo for my tool which has a Core, Control, Server, and Client library. It's unlikely that all of them will be used at the same time.
I'd like my fellow coworkers to require one entry point for all four libraries. So I made this questionable implementation: exporting th... |
I'm developing an application with Python. I want to have a Boolean variable that represent whether something is buy or sell but I'm not sure how I should name it. Here are my current ideas:
isBuy
isSell
buy_sell
sell_buy
buy1_sell0
actually I like the last one the most although it's somehow the ugliest because it te... |
In Typescript/Angular 6 (2+), is it considered a good practice to have a base abstract http service from which derives all the application services? for example:
//import the angular Http ...etc
export abstract class MyBaseService{
...
protected get<T>(url: string): Observable<T> {
return this.http.get(...)
... |
What is preferred and why?
void PrepMyInstantiatedObject(SomeComplexDTO someComplexDto){
someComplexDto.Name = SomeOtherClassHelper.DerivedName(someComplexDto.Name);
someComplexDto.Ids = SomeOtherClassHelper.Resolve(someComplexDto.RelatedIds);
someComplexDto.SingleId = SomeOtherClassHelper.FindId(som... |
Have read about "Repository pattern", before it, I have used pattern DAO (data-acess-object).
How should I implement table relations with this pattern? Should I create entity for links between tables?
Thank you!
|
Given the need to log only in debug mode the easiest way would be to use if conditions:
def test(x, debug=False):
if debug:
print(x)
# ...Some more code
if debug:
print("Something else")
# ...More conditional logging
return x * 2
This leads to the cluttering of the actual functi... |
This morning I had a presentation on PHPSPec which the official website describes as follows:
A php toolset to drive emergent design by specification.
As defined within an adjective context the word "emergent" is defined as follow:
the process of coming into being
On the other hand PHPUnit is said to focus on quick... |
I had been learning python and i know Java. if i were to write a simple program, can i write both programming language in one document or compiler?
I got into this problem because if i cannot merge both the programming language , what is the meaning there to learn them.
Another reason for this is that; I found some co... |
Do logging impact application performance?
First thing to know is , whether logs are written serially as processing takes place or are logged into file i a separate process?
In java world how should I improve performance of my application where I need to log a lot in that case?
Micro optimization is a side effect but... |
When testing RESTful JSON APIs with ATDD/BDD practices in mind is it good practice to test the structure of the response?
I'm thinking that it could too easily change, thus making for a brittle test. If this is true, then how should one approach testing REST API endpoints? Perhaps only test the status codes?
|
As always I came here to ask for some light in a design issue I am facing.
I have a system that issues some notifications :
PackageReceivedNotification
PackageSentNotification
DisccountAvailableNotification
More in the future
I want to store the text of them in the DB in multiple languages (imagine english and spani... |
Currently, we've been working on the architecture team on defining the database models. What has been troubling me is my superior's advice when it comes to working with audit fields.
He advocates for the updated_at and updated_by fields to be Nullable, reasoning that these should be initialized as NULL because the data... |
Let's say that I have a group of report types to be created and all of them inherit from base abstract class:
abstract class Report
{
public abstract void GenerateReport(IReportData data);
protected virtual string SaveReportFile(string filepath)
{
// common code to save the report file
}
}
Generate... |
I need to build a data store for transactions that meets the following requirements:
A 'transaction' is effectively a state machine which moves through a number of statuses during its lifecycle and the incoming data messages represent changes to a transaction's state (eg, transaction moves from 'Created' to 'Open' to ... |
I've seen trace tables listed under white-box testing in one part of my syllabus, and separately under dry-run testing in another part. Could anyone please clarify whether trace tables are generally considered to be part of one or both types of testing?
I have researched this thoroughly and found nothing that addresses... |
I don't think I completely understand what a component diagram should show. Let's say I have a 3-tier web application for a homestay booking system, similar to airbnb. The 3 main components are clear: client, webapp/Back-End, and DB. But when it comes to drawing the component diagram, I don't know how to name the inter... |
I want to develop a Factory of INotifications.
public interface INotification
{
string Text { get; }
string UserId { get; }
NotificationType NotificationType { get; }
}
The problem is, that the NotificationFactory has to be ready for getting multiple types of inputs , why? because there are multiple implem... |
I frequently come across this problem when developing games and simulations. As an example, I'm currently writing an implementation of chess. I'm using it as a vehicle to experiment with entity-component systems and responsibility chains, inspired by Brian Bucklew's talk on Roguelike architecture (https://www.youtube.c... |
According to Domain Driven Design and Development In Practice:
Spring Security (a sub-project in Spring Portfolio) provides a
fine-grained access control in both presentation (URL based) and
domain (Method Level) layers of the application. The framework uses
Spring's Bean Proxy to intercept method invocation and... |
I have read many articles explaining the overview of black- and white-box testing, including this Stack Overflow question: https://stackoverflow.com/questions/7258524/unit-testing-black-box-testing-and-white-box-testing
However I still have some confusion around black-box and white-box testing at a basic level.
In term... |
"Solicited output" means a user issues a command to a GUI and the GUI displays the corresponding output.
In this context, I include Web apps in the term "GUI".
However, often a GUI needs to display unsolicited output.
For example, the SE/SO websites often display an icon indicating the number of new email messages and ... |
Some user actions quite naturally lead to find-or-create situations. For example, user logs into a system by alternative method and find-or-create is called give email. Or, another example, User is created given Buyer's email. But of course, if there already is a user, that action causes find-or-create. Some databases ... |
Suppose I have a private project with 100 commits. I don't add a software license until the 101st commit. If I make the project open source, does that mean all first 100 commits are unbound by the software license in the 101st commit?
Should the project be rebased when a license is added?
|
While going through Decorator Pattern from Wikipedia 1 and reading pattern from Head First Book . One thing that struck me and is missing from both the sources or i may have missed it.
Why exactly do we need a Decorator Interface ?
Is it because we need to put all the Concrete Decorators under categorical umbrella.... |
I've got a project that is sort of a virtual operating system.
In this project, the Kernel class is responsible for creating Process classes. The process class consists of Thread classes and the Thread class will consist of a CPU class. The CPU class is actually a CPU emulator and the Thread is therefore an "emulated" ... |
I am currently working a data science team, and we write small utilities all the time to consolidate data, extract data, etc (an example is go through a folder of excel workbooks, convert all the sheets into csv files, and consolidate those sheets that have the same column headers, adding columns for the source locatio... |
If you run the statement:
System .out.println( (Integer.MIN_VALUE)-(Integer .MAX_VALUE ));
In java it returns 1 as the answer. Is this because Java just considers those values as 32bit integers without considering their sign?
Integer.MIN_VALUE = 10000000000000000000000000000000
Integer.MAX_VALUE = 111111111111111... |
My use case is that I have a real-time broadcast app where users get feed items based on a geolocation, i.e. a user will receive posts that were broadcasted from within a user-defined radius where (s)he currently resides.
As a backend implementation I want to use cqrs. The procedure is as follows:
Broadcasters uplo... |
Following SOLID first principle, the Class should be responsible for only a single part of the functionality provided by the software.
The same, I guess, goes with the Methods design principle. They should handle only a single "thing".
Let me give an example:
Suppose I have some program in which, at the end of some met... |
I want to share with you and know what your opinion/improvements are regarding a solution I was tasked with a technical interview I faced.
The exercise:
You need to create an API which will indicate based on a DNA if a person is male or female. This API must have two endpoints:
POST /genre:
It will receive a ... |
I'm looking for a way to quantify where my team should spend it's time addressing technical debt in our codebase. One idea for this is to measure file churn (edits over time). I got the idea from this video where Michael Feathers talks about escaping the technical debt cycle:
https://youtu.be/7hL6g1aTGvo?t=16m53s
What ... |
I manage co-curricular programs for the school I work at. Until now, they have signed up on a google form on a first-in best-dressed capacity, but there is lots of complaints about how some students get all of their preferences, while some get none.
As there is 1000+ students at this school and over 50 activities, it w... |
I have been reading a bit about code readibility and found conflicting information about the following: some say that flexibility (and-or extensibility) actually increase readability, while some others claim it decreases. Is there any generally accepted opinion about that?
|
We have Customer transaction table with many foreign key relationships.
We only want to see certain columns of the 3 tables joined in a web interface.
Eg just Date, PurchaseAmount, ProductName, and StatusDescription.
I hear repository should not select certain columns, it should select All columns. So we should not ... |
I have been tasked to increase code coverage of an existing Java project.
I noticed that the code coverage tool (EclEmma) has highlighted some methods that are never called from anywhere.
My initial reaction is not to write unit tests for these methods, but to highlight them to my line manager/team and ask why these fu... |
In doctrine (or any ORM in general), the easiest way to execute a delete/update operation is to select such entity, then remove entity or update single attribute in the code, ended by persist the changes to database.
This is the native way to execute delete/update operation in most of the ORM frameworks. It is very han... |
We're building two microservices that use CQRS and Event Sourcing: an Order Service and an Inventory Service. When an order is made, the inventory of that item must be decreased by the amount ordered. An order can also be canceled. In that case, the inventory must be increased again.
So in the Order Service we store an... |
I've got a .NET Core application that takes HTTP requests. I'm a little bored, so I decided to stress-test it using West Wind Web Surge, and putting an example request as the body.
My question is, since the request is exactly the same every time, am I seeing artificially high performance because the application has alr... |
I have some B2B services already exposed to customers who manufacture products and ships to end consumer.
These B2B services are implemented using asp.net web API and is performant enough to handle millions request per day.
Now I need to expose services to end consumer for there product activation and hence it is B2C i... |
I am trying to understand UML abstract syntax seen in the UML Specifications. This example below is hard to understand. For example, I don't understand:
the {subsets ownedElement},
the hybrid composition-association,
the /relatedElement (heading slash),
Is there any tutorial or course that explain these points?
I ha... |
I am trying to model an external system in Java and running in to some issues.
I have a handful of related types that I have mapped together through abstract (and sometimes concrete if it made sense) classes.
In a few cases some of the SubClasses turned out to be only implementing a caller method that just picked an ... |
I was having a discussion with few friends about inheritance and composition and what I learnt from that discussion is that the use of inheritance more or less condemned in industry nowadays and either replaced with composition or copy and paste.
Doing a quick Google search confirms this with many articles with titles ... |
I'm new to eventsourced apps and since the beginning I'm facing an issue that I'm unsure how to resolve.
I work in ecommerce and I always try to convey meaningful events to my aggregates like PriceIncreasedEvent, ProductDeactivatedEvent, OutOfStockEvent etc
But many times I just want to do a simple "CRUD" style with my... |
Say I have a program using Java or C, that will interface with a hardware device and either read streaming data or write it to a database before applying a few complex mathematical equations to this data for analysis.
Where would the equations be applied (ie the data layer, application layer)? Is
this possible in SQL,... |
I am currently learning about compiler construction and language design and I am thinking about what native datatypes I want to support in my language. Now there is a whole lot of languages that make a distinction between integer- and real numbers. However, I remember watching a talk by Douglas Crockford in which he sa... |
We are a recently formed team of 4 developers, some of them new to the company, some of them assembled from other, disbanded teams. I would like to know my team members better, how they "tick", how they want to learn, problem-solve, cooperate, communicate, how we see each other, etc. I would like to do that through som... |
Dependency injection (DI) is a well known and fashionable pattern. Most of engineers know its advantages, like:
Making isolation in unit testing possible/easy
Explicitly defining dependencies of a class
Facilitating good design (single responsibility principle (SRP) for example)
Enabling switching implementations quic... |
I am beginning with unit testing in c#.
Here is my converter:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int c = 0;
if (value != null)
{
var path = value.ToString();
for (int x = 0; x < path.Length; x++)
{
if (c == 2) { ... |
I'm new to coding and I don't know how what I'm trying to do is called, and I want to find out so I can do more research and not re-invent the wheel. I looked for things such as data consolidation/combine input but the results are either too vague or if I add the name of a language I get irrelevant libraries (eg javasc... |
I am new with the user story map approach, I started with to compose the stories to be implemented from user perspective, and it seems very promising.
However, I am not sure about the non-functional stories, how to place them within the story map. Especially when are talking from user perspective, that is not aware of ... |
I'm finding it tough to test my client-side code without testing implementation details.
For example, lets say you are testing a login form that displays client-side validation errors and does not submit unless the email and password are present and correctly formatted.
You could write a test independent of classnames,... |
Scenario
We have an application which has a session timeout of 20 minutes. However we have a requirement in which users must be able to access a certain page in the site for 8 hours after the original(20 minute) session was created. The page in question needs to use the session ID of the original session to pull saved ... |
The PHP framework Laravel allows to make an API and a website on the same application. As both of them will communicate with the same database, I was asking myself what is better between consuming my own API for my website and making a DAO proper to the website.
On one hand, consuming my own API would make a single ent... |
Is it, at least theoretically, possible to convert a Java application into native code that can be run by something else written in Java? One example of this could be a Minecraft Spigot server. You can code plugins and stick them in the plugins folder of the Spigot server. The server then runs and then runs the plugins... |
I have seen this question and do not believe this to be a duplicate What software models are appropriate for daily builds and continuous integration? .
I don't fully understand what advantage automatic daily complete builds may have over building on every commit in practice (continuous integration being the term I beli... |
I am developing a web-app, currently the application is being developed in both NodeJs and in ASP Net. We are structuring the application in micro-services. Lets say we have a service that calls some functions in a dll and we have the possibility to choose which dll to call the functions from, but the client wants to m... |
I recently reviewed code that read as follows:
if (!condition) {
do_something();
} else {
do_something_else();
}
In other words, in the if statement we checked that a condition was false, and ran one of two functions depending on its truth value.
I thought this was a confusing style, and recommended that the condi... |
I have Java microservice that exposes multiple APIs. Under each API there are many exceptions could be thrown. The last method that catches them all has big catch block ...
catch(exc1 e1 | exc2 e2 | exc3 e3 ..... | exc10 e10){ ...}
They are all of the same level. Now I thought of combining them all under one exception... |
I'm new to server-side programming and I'm building a small "test" web application in NodeJS. Each time the clients need to view data from the PostgreSQL database, NodeJS will execute a "SELECT" query and will give me the result in JSON (which I then add to a webpage and serve it to them). Instead of executing a "SELEC... |
During a code review, I suggested to my coworker that he had questionable parameters for one of his methods. In particular, the parameters revealed too much about the method's implementation details. My coworker argued that a method's inputs must reveal the method's implementation details, so, where does one draw the... |
I read in the book "Clean Code" from Robert C. Martin (at page 71) that the better way to handle try/catch block is to separate process (the "try" part) from the error handling (the "catch part"). Each part should have a dedicated function
Example from the book, illustrating a better way to handle try/catch :
public vo... |
I am developing an n-layer app.
One of the layer is the BusinessLayer and consumes a set of POCOs defined in the CoreLayer. Also I have a PresentationLayer (WinForms)
CoreLayer
POCOs (classes with properties)
Repository interfaces (use the POCOs as parameters types) For example :
public interfaces ICarRepository
{
IE... |
Sorry, maybe it's a well known design principle, but because I don't know a name for this kind of relation, I was not able to find any existing answer.
So, let's say we have a parent which may have many children, but only one child can have some property active (or set). Think about properties like "selected", "current... |
I asked this question on an IRC channel, sadly I am going around in circles.
I am aiming for a high level overview (but with some technical details if necessary) on how a function such as printf() from stdio.h "talks" to the Windows operating system.
I know a bit about MSVCRT.dll, bits of the Windows API such as how it... |
This may be a stupid question, and it would certainly take one Hell of a lexer, but do any extant programming languages allow you to do something like:
c# (1.2) {
// c# code
}
Perl (5) {
# perl code
c# (2.0) {
// some more c# code
}
}
To utilize multiple languages in individual source files? I... |
My example might be slightly contrived, because I've modified it so that the project isn't recognizable by my employer. I'm a newer developer at a very small company.
We have an object - Posts - that has a number of defined attributes (title, tags, content) and an unknown number of unknown attributes. These attributes ... |
I have the following tables:
Organization.
Articles
Templates
Organization is the parent of both articles and templates.
On the articles index page, I display (by default) all templates for the organization.
Here's my problem. How do I add the ability to customize which templates are shown for each article?
I could ... |
Also, if my argument and parameter are the same value can I just use the same identifier for both? Thanks
|
I am building an intranet web app with ASP.NET. We are using Windows authentication for granting access to different web pages. We grab your Windows login server side, then build web pages accordingly. I have a need for a group of tech users to be able to impersonate business users so that the tech users can see the ... |
Given three classes Apple, Fruit and Seed ;
Apple is a kind of Fruit and it has Seed in it. With the knowledge of Apple Class uses directly or indirectly the properties of Fruit and Seed. Can we say Apple is inherited from Fruit and Seed ?
|
I am project manager and I struggle with gaining the attention of the Reviewer of a pull request when the author has replied to a question from the Reviewer. In other words, the Reviewer initially put the PR in the "waiting for author" status because he had questions. The author has now replied with the answer to those... |
I am working on an application that will support working in multiple tabs at the same time. Currently, when a document is locked by a user, other users won't be able to acces the same document but the same user could, if he wanted, open that same document again in a new tab.
My problem at the moment is, when the user c... |
To be a bit more clear, I'll state that I've spent lots of time with different languages. But until now it's been either it'll use it all the time or it doesn't support it at all.
Now work has me starting on projects that require VB.net and I see it provides it both ways in terms of AND and ANDALSO. The first one doe... |
Below is the context,
Right now i'm developing an android application, which will allow the user to upload the video and image to the server. I want to allow the users(his friends) to download the video/image with a watermark on the video/image. So I would like to know what are the advantages of doing watermark on ser... |
Let's assume that I have an Order object that has a List<OrderItem> , the user goes to page and creates his order, now I should save his selection to the database, I have two data service classes one for each entity, OrderDataService and OrderItemDataService, which is more correct?
1- At presentation level in the Add ... |
So I'm trying a few token based authentication in Laravel, each user have token they can use to access certain database. But there is something I still don't understand from these tutorial. The tutorials seem to only check whether a user have token, if yes then authenticate the profile to do certain api call, but obvio... |
I really hate dealing with DB first, it is honestly the bane of my existence.
How can I convince my manager that, although the work to switch is a lot. It will be worth it.
|
The task
The piece of software I'm writing operates on the following object types:
Agents
Calls
CallQueues
These objects can be linked together, and each of them contains some additional information. For example, a Call contains the caller number, an Agent contains it's name, and so on.
This model should react to ex... |
I'm coding a "small" application using MVP pattern that gets it's data from a SQL database.
I'm not using an ORM out of the box, and for the sake of learning, I'm writing my own simple ORM/DAO type of setup. I'm utilizing some of the ideas from ormlite
With regards to the model layer, Here's where I'm at:
DatabaseObje... |
I recently saw a code base which had a data class Address defined somewhere and then in a different place:
fun Address.toAnschrift() = let { address ->
Anschrift().apply {
// mapping code here...
}
}
I found it confusing to not have this method on address directly. Are there any established patterns or... |
C had Procedural Paradigm, then C++ came with OOPS and success of JAVA make it best suitable Programming Paradigm.
Now, Look at recent trends, Kotlin, Swift these languages are not like JAVA these are providing a flexible way of coding, Neither Procedural nor OOPS, and also these languages are being accepted widely.
I... |
Problem Statement:
I have a class that does some validation and it looks something like this:
func a() {b()}
func b() {c()}
func c() {d()}
func d() {e()}
func e() {return}
This is a simplified view, but the idea is that these function calls are dependents of one another as I am doing some transformations and validatio... |
We have an object-oriented database. So, our persistence is truly object oriented.
The example is the object person and the attribute VIP. We have to store, if a person is a VIP or not. Usecase: Ordinary users of our application aren't allowed to see VIPs.
Now, my co-worker claims, not to store the attribute as prope... |
I am working on an a data collector which could be called an API of some sorts, which is based on .Net Core 2.1 .
It's job is to receive and pull (ask for) data from data collectors(executable, DLL,service), those can be in any language, but in this case let's stick with C++.
Collector (API) has to be platform independ... |
I have a function which returns the availability of a module, where the module is only available if multiple conditions are all met. The code looks like this:
bool isShipAvailable() {
bool isAvailable;
isAvailable = this->areSystemsCalibrated;
isAvailable = isAvailable && this->areEnginesFunctional;
isAvailabl... |
Let's say we have three types of objects:
Agents
Calls
CallsQueues
They all can be linked with each other (1to1, 1toM, MtoM) or have no links, and these links change over time. Calls wait in CallsQueues for a free Agent, each Agent serve one Call at a time, and Agents wait for calls in zero, one or multiple CallQueue... |
I had a few questions around value objects in DDD.
I had a class ReportDefinition (basically a schema for a specific report that users can create) with the following properties (in Java):
UUID id;
UUID ownerId;
UUID organizationId;
ReportDefinitionName name;
ReportTitle reportTitle;
ReportDescription reportDescription;... |
I am using a GPL licensed library which stated clearly that it is OK to link to it in commercial projects without the need to publish your own source code (as an exception to the regular GPL that force you to publish the source along with your product).
Let us call this library with an modified GPL license "Library A".... |
We have a single solution Visual Studio web application with multiple projects.
One of the projects (Services project) has APIs for our App clients (Android/iOS). There's separate project for MVC application that powers our Desktop and Mobile website. There's one project for DTO that has POCO classes for request/res... |
I'm looking for guidance about DRY vs Code coupling.
I do not like to duplicate my code and I also do not like code coupling between unrelated modules. So I refactor duplicate code if I find identically duplicate code a year after the duplication was introduced. However, I have increasingly experienced situations where... |
I'm working on a program developed in different variants: a common basic version and various customizations that not only use different logos and images but also add functionalities.
I'm trying to figure out what can be the best approach to saving the project inside our DVCS GIT (I was thinking of using gitea but I'm o... |
When installing application on client's server at the end of the project, how to give admin's password to client? (On paper, by word?) Client may not be very technical so script generating password could be to hard for him.
And should I keep other/same admin credentials for myself for later support?
|
I have a file on the disk. I want a clear distinction of responsibilities between my reader and parser. The reader reads the file and extracts the content as a string.
This string is input to the parser.
When should I share the content as a String vs InputStream between the two classes?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.