instruction stringlengths 34 36.1k |
|---|
I might be wrong, but I feel like the best approach to TDD is Solution, Red, Green, Refactor (adding "Solution" to the standard formula).
By coding the solution first, I feel like I am much more efficient when it comes to writing the actual tests. Sometimes, it's hard to know what the solution will be, much less what t... |
Here is an example I asked myself to better understand microservices, but the thing is, I am confused on how to identify them in this particular case.
There are cinemas in each country,
those cinemas have a catalog of movies
and not every movie can be listed in this catalog.
As an example, say one movie is showed onl... |
In iOS App there is something called a “launch screen” (the screen that appear before the app actually launches and is not equivalent to the splash screen), which can be provided by two ways, either as a storyboard or a set of images.
Since I layout a large portion of my controls programmatically, there is no efficient... |
I have created a User service that controls user login using OAuth2 protocol and stores the user in the local database. So this service is aware of the user session and user identity.
Now I have another service Foo with some endpoint /foo. And the problem is that I need to know which user made the request to /foo endpo... |
To ilustrate my main concern let's start by considering a "trivial" typical problem, data filtering & parsing coming from a process and dumping the information onto something {gui console, file, stdout, ...}. Now, let's say we've got a common "codebase" like (minimal example and very simplified):
class Listener:
d... |
Is it acceptable for a framework to generate an XLS document of more than 300k rows and 6 columns in 2 minutes?
This framework took 2 minutes to generate the document while fetching data from a local database (MySQL).
Should this framework be enhanced?
|
Taking the following scenario.
A blog where anyone can see publications and comments and users with enough privileges who create, update or delete this publications or comments.
Publication list service (M1) is in charge to only list publications and comments.
Publication service (M2) which basically save, update or d... |
I am working on an open source project that should be compiled for multiple operating systems including Ubuntu and Windows.
I am working on how to structure the Git repositories and branches for this project.
My question is can the same code with different configuration files coexist in one Git branch? or should ther... |
This is one of the rules that are beaing repeated over and over and that perplex me.
Nulls are evil and should be avoided whenever possible.
But, but - from my naivety, let me scream - sometimes a value CAN be meaningfully absent!
Please let me ask this on an example that comes from this anti-pattern ridden horrible co... |
As an example, I have a POCO called Person which is used in my presentation layer and my business logic layer.
I don't want to use this POCO in the Entity framework because I don't want that class to contain database specific metadata such as those annotations used by the Entity framework.
Is there a naming conventio... |
I have a function that looks something like this:
function_name(step, ... , typ):
if typ == 'some type of calc method':
if step == 1:
do_me_at_step_1(...)
elif step == 2:
do_me_at_step_2(...)
elif ...
elif typ == 'another calc method':
if step == 1:
... |
Is there a story from Greek mythology about the goddess Demeter that somehow motivates the Law of Demeter? If so, I'd love to know it so I can tell it to my students when I teach this topic.
|
I'm developing a real-time system by making use of an mbed-OS (RTOS for ARM architecture). I'm not a software engineer and I want to know whether the following solution is practical or not, and how to improve it.
As it is shown in the figure, the elements of software are as follows:
Three different classes (ClassA, ...... |
I've always assumed that the output from diff (typically "unified", whether or not it's colorized) is universally understood among most if not all text-based language programmers. Whether it's used due to version control or just comparing two individual files, it seemed that it is rather prolific.
GitHub offers both u... |
Cython is a superset of Python that can be complied into C modules that can be imported and used normally in Python code. This can be used to speed up parts of a Python program. In a recent project, I used this to make a heavy part of the code run 90x faster. A downside of Cython is that to get significant performance ... |
The blockchain stores basically an immutable permanent record of every transaction. This means the data is constantly increasing. Wondering if one has a model for easily roughly estimating data usage. There is a link below that goes into some depth on financials for IPDB, but don't fully understand how to apply it to a... |
I am wondering how to construct a Kanban and generate meaningful cumulative flow diagrams in a scenario where steps are not required to be performed in the same order.
As an example, we might have columns "Development" followed by "Write-tests". But some developers write their tests first, in a "test-driven" or "behavi... |
The question sounds retrograde but I have about 50 variables being passed to a class. Basically an array of data I call 'filters' that is first passed to a prepFiltersMethod($filters). This prep filters method does some things sets some more filters needed in other methods for queries. It returns a larger subset of dat... |
I'm confused in designing a TCP server with C#.
Where should I put my TCP Listener ? inside Program class or
create Server class ? or ...
Where should I start handling client
? from Listener accept callback or create ClientHandler class
? or...
Do Client class is responsible for receiving messages or I have to create... |
The project is a read-only interface for a company database.
In the database, there is some 'static' data about departments, in a Departments table.
The value of these fields don't change with time (eg. DepartmentID, DepartmentName, DepartmentDescription, HistoryTableName, etc.).
There is also some timestamped data. Th... |
Before I would ask my question, here is the context: I am working on one part of a relatively big software. In its simplest form there are 3 layers of the software lets call them lower layer, middle layer and top layer. I am working on the middle layer. The job of middle layer is very simple, retrieve the information f... |
I've got an API (Java + Play Framework). I've got a website (React) who has to communicate with the API. I don't want my API being called by anything but my website.
How can I do?
|
I'm working with a 3rd party mobile app that has two methods of transmitting data...
Realtime via POST request - each POST request is a row of data per second. This will be for maybe 5 minutes at each execution of the app.
CSV file
I was able to set up a php file to get the data from the POST request and kind of pre... |
In most domains, there is an app that "prepares" data, and another app that "serves" the prepared data. The data, however, is from the same Core Domain, which causes some confusion in modeling.
Some examples:
In a shipping/cargo app, there will be one UI for management: staff members will add/update/delete cargos, voy... |
Although this isn't mandatory in the C++ standard, it seems the way GCC for example, implements parent classes, including pure abstract ones, is by including a pointer to the v-table for that abstract class in every instantiation of the class in question.
Naturally this bloats the size of every instance of this class b... |
I'm trying to port an application of mine from Java to C# and I can't for the life of me wrap my head around Wpf application structure.
In Java my application runs the main() method which registers native hooks and calls launch(args) for my Application class, which sets up the GUI and starts the FXApplication. I have ... |
I am trying to setup a flow in Git but I have no clue on how to start on it.
We have a master which will be forked by some teams.
When the teams are done, they will issue a pull request to the master.
Once the PR has been approved, the fork should automatically be merged with the master. Once there is a conflict which ... |
I have looked around but couldn't find an answer for my requirements of managing a large online project. By large, I mean a web based service that depends on multiple back-end technologies, massive amount of diverse computations on the fly, a lot of storage requirements; and by live, I mean that on the front-end it tri... |
i have a question concerning a best practice on application architecture and managment.
I have an application developed in Yii2 (php+mysql) that is the main company backend. At the moment there is the request to develope other Yii2 application in some way connected to the main one.
I look at two possible ways:
create ... |
This is my first shot at trying to develop an application using some of the ideas behind DDD. It's a Rails monolith application (at-least for now). I know i'm not being strict with DDD, but I'm trying to focus on the separation of my domains which seems like the most important concept.
I think this is probably quit... |
I'm building an Entity Framework Core-backed ASP.NET Core RESTful service and I have entities / models such as Product, Document etc with description in multiple languages.
I want to be able to dynamically query Products with relative Documents by providing their basic information with translated descriptions (based on... |
We are designing an authorization mechanism for a Product API where users have their own claims.
The api has a patch request like this:
PATCH https://product-fcd.com/api/product -d {"Products": []} -h "AuthToken":"xyz"
In this request, the process goes like this:
Validate user from token - handled by an authenticatio... |
Which solution is most logical? The value can be null, but when not null it must be a string.
This (First):
function setValue(string $value = null);
To me this is bad; since we can now call the method without anything:
$dependency->setValue():
Or this (Second)?
function setValue($value)
{
if(is_string($value) ... |
So we have 3 branches that match our environments for all our projects (Dev, Test, Main). We have a dev server, test server, then production server and when we commit to each branch a build and deploy is initiated to their respective servers. When we have a new feature we make feature branches from Main.
We have a web ... |
Why event sourcing an entire system is a big mistake and considered an anti-pattern?
And what situation it's consider an anti-pattern?
Reference 1
Reference 2
Updated Question :
Still don't understand why build whole event-sourcing create big monolith? What if I use process manager is it still a monolith?
As Greg Young... |
I stepped away from a project for a few weeks. Before leaving the organization was discussing an architectural pattern for our microservices. An instance typically serves two roles in our organization.
It receives RESTful requests and process them accordingly
It works as a batch processor, reading in large volumes of ... |
This might be a super nerdy, OCD-like, silly question, but... I love it when related variables have names of equal length, such that when written below one another, it lines up nicely. Eg:
min/max:
int min;
int max;
index/length: idx/len
inner/outer:
SpaceTime inner;
SpaceTime outer;
However, there are many words t... |
In the Java API specification for the Object class for the toString method, there is the line "It is recommended that all subclasses override this method."
While I don't have a better idea for what this method should do in the Object class, I would like to know if there is any particular reason it is defined the way it... |
I have been studying DDD and have been experimenting with Event Sourcing as a storage mechanism.
Prior to this (mostly CRUD-style applications with anemic data models stored in relational DBs), a "best-practice" I have tried to keep in mind is to decouple my data model from any persistence concerns.
However, I have bee... |
I have been study DDD along with CQRS and Event Sourcing. I recently listened to a talk Greg Young gave a couple years ago where he said that CQRS and Event Sourcing are not a top level architecture and should be used within the confines of specific bounded contexts. Doing otherwise would be an anti-pattern.
This makes... |
So a simple example i have:
public interface IFollow{
Transform Target {get;}
void LateUpdate();
}
public A : Monobehaviour , IFollow {
public Transform Target {get; set;}
public void LateUpdate(){
//follow the target
}
}
public B : Monobehaviour , IFollow {
public Transform Target {get; s... |
After having studied GoF Prototype pattern and taken a look into Java implementation using the Object#clone() method I am still confused about when to use this pattern in a real application?
Please, provide some use-cases from Java applications, frameworks, etc. if there are any.
|
I would like to ask you a questions that arose these days with GDPR new rules.
What I have is a payments service which use BrainTree to make the payments. In my side I store some information including the ID of the user. The problem is that I should not send the original User ID to Braintree directly and I need an ID ... |
I'm working on a small project and I've decided to move over from DI to singleton pattern. Although I know 2 ways to do singleton.
The first one is where every non-model class is a singleton. This means:
UserController
DatabaseHelper
ConfigurationModule
FriendComponent
Are all singletons, however:
User
UserFriendship
... |
I am working on a project to create a school parents evening booking system. This system needs to be able to generate the best order of appointments based on availability of teachers and the priority given from parents.
Parents will be given the option to select which teachers they would like to see, then rank these ch... |
I am making a use case diagram that includes multiple users. 2 of these users share the same use case but each with different usage.
In case a global use case diagram is already done and a detailed one I needed, how do I detail the difference in the usage of the use case shared by the two users ?
do I make a single d... |
I'm trying to get into using microservices, extracting functionality from a monolith into it's own (multitenant) service. However, one of the things i can't figure out how to deal with is this:
What if a microservice (triggered by an event) needs user interaction?
As an example, at the moment we have the following flow... |
So if I have a big function I break it to smaller ones to increase readability.
If I have parts in my big function where I want it to return. I want my subfunctions to have the ability to make the main function terminate as well, if a condition is true in the subfunction. What's the best approach for this?
Making sub... |
I'm doing the analysis for a software which I've had in mind for a long time. Its purpose is to turn sound into an image, apply graphical transformations on it, and turn it back into sound to hear the result. I plan to write it in C++ and I want to make it as modular as possible. As I am relatively inexperienced in mod... |
We are dealing with a third party API that doesn't handle concurrency, and we don't have access to the database directly. Our client application is deployed in a cluster environment and has multiple worker nodes sending update requests to this API. Our goal is to wrap this API in another REST API, so we could add a ser... |
I have a use case where I do internal data computations using English system, due to various precomputed graph coefficients and other data already using the English system. But for output I need to convert some of my data to Metric system and leave some data in English system to be used for debugging purposes to follo... |
I have heard the argument that Little's Law proves that you should limit the work in process in your Kanban columns, because the more work that arrives, the longer it will take to move through the system.
Is this an accurate conclusion? If I have N items of work in the backlog, they all need to flow to "Done". So if I ... |
Why do we need to specify the type of the data whose address, a pointer will hold, if all pointers are the same.
Since all pointers store addresses.
Also, the amount of space a pointer will require in memory depends on whether the machine is 32-bit or 64-bit.
Suppose my pointer ptr stores the address of an int and my m... |
A bulge in a cumulative flow diagram could indicate that there are blockers in this step of the value stream.
Or it could indicate that this column is producing faster than the next column can pull.
I was thinking that every column should be followed by a done column (I'm using Jira) which will distinguish between thos... |
I am new to garbage collection but have been looking around. I have noticed that Reference Counting has a very bad reputation (PHP, Python), as well as Conservative GC (Ruby) under certain conditions. However, I have also seen papers describing Fast Conservative GC and Fast Reference Counting. I am wondering if in the ... |
Typically when declaring a C++ class, it is best practice to put only the declaration in the header file and put the implementation in a source file. However, it seems that this design model does not work for template classes.
When looking online there seems to be 2 opinions on the best way to manage template classes:... |
Where I work, there is an Oracle data warehouse that is managed by another group that contains some pretty critical information for the company to run smoothly. The issue is that they (apparently, haven't confirmed with anyone on their team yet) take this server down for long periods bi-weekly.
Before I started here, m... |
I am relatively new to microservice architecture. We have a moderately sized web application and I am weighing the pros and cons of breaking it out into microservices instead of a monolithic system we have now moving forward.
As far as I understand it, consider microservices A and B each of which rely on a subset of da... |
I'm having some problems to think on a solution to control the amount of requests by minute to a external system on a micro services environment on Kubernetes.
The scenario
This external system is an e-mail marketing application (called Responsys) that permits only some amount of requests by minute for each login. Some... |
When doing oop in python where should I add the logger.
Should I add it:
before the class Rocket(): and give it a file global scope or
after the class Rocket(): and give it a class scope.
Syntax allows for both. But which would be consider more correct in the python culture.
Assume I have a class
class Rocket():
# ... |
I'm having trouble understanding how to provide an API to 3rd parties in order to allow extensions for desktop applications. I understand that if I'm using a compiled language (e.g. C++), I can load dynamic libraries as extensions at runtime, provided they link against my library and provide a well-defined API that the... |
At my first job as a software developer, my team used agile/scrum to manage our project workflow and it worked pretty good. I had some experienced mentors who set me on the right track - I owe them a great debt of gratitude. I worked there for a few years, then moved on to a new opportunity a couple months ago.
Fast fo... |
For example, for oauth, I may need to copy and paste oauth and oauth callback code like it (assume Client is the framework I use, I don't use real framework like google because I want to simplify the code):
sample code:
public function oauth(){
$client=new Client([MY_APP_ID,MY_APP_SECRET]);
$client->setCallbackUrl(... |
I want to extract lines from a stream that are preceded by the character L. The list comprehension below does the job, but calls next on the stream inside the comprehension in a way I've never seen before. Is it considered bad form?
clauses = [
list(map(int, next(stream)))
for line in stream
if line == 'L'
... |
Classes should be nouns and methods should be verbs. What about Groovy traits? Should they also be nouns? Or maybe should they be adjectives / ability words?
|
I'm quite new to microservices and I'm studying what is the best approach when it comes to microservice inter communication and fallback scenarios.
For example:
if service A is calling service B to get a particular data.
Case:
What if service B is not available? How should it reflect on the Front end? is the best solu... |
I'm struggling to implement disposable objects via dependency injection, as the dependencies are injected in the constructor (and live as long as their containing object does), whereas I want the disposable to only live in scope of a single method.
Brief summary
NInject is being used for dependency injection.
There ar... |
I'm still inexperienced to write high quality code, so I read books addressing the issue such as Clean Code by Robert C. Martin, and keep checking code of well-known libraries to improve my skills.
Although many open source libraries have been maintained for years, which means that it's very unlikely that they aren't o... |
I'm in the process of building a new API that needs to support multitenancy.
I can figure out how to implement reading and writing the data securely without having to worry about clients being able to know about (or see) other tenants data.
I can also understand how to determine the right tenant for authenticated endpo... |
I am working on a program language, and I came to the dilemma whether it should support virtual inheritance or not.
As a designer and implementer of the language, including that feature represents added complexity.
As a language agnostic software developer, it seems like the only benefit from including it is to facili... |
I'm looking for some insights about how to handle the read model in a CQRS Event Sourcing application, in order to do the best to ensure data consistency.
The missing point is how to be sure (actually not sure, but reasonably sure) that the projections inside the read model are able to process the events created from... |
I want to ask about Bernoulli Naive Bayes document model. Can we use Bernoulli Naive Bayes document model for multi-label classification of documents?
|
I'm looking to understand the high-level architecture, topology, protocols and componentry of ATMs and POS systems work with banking institutions worldwide.
I've read several half-way decent articles explaining the architecture to the layperson, including:
https://money.howstuffworks.com/personal-finance/banking/atm5.... |
For example, creating user accounts are a pretty common occurrence when developing a website. Is there any service that a software developer could use to "click and drag" a solution for this into their software (request a JSON response, for instance) instead of completely re-coding a new solution for this every time yo... |
I am a data scientist who programs in R, but am relatively new to using version control (yes, I know!) and I am still learning lots about it.
FYI: I use BitBucket and Sourcetree
I understand the general idea behind it - that you commit new updates / features / etc. - and that it acts as a safety net where you can reviv... |
Setup: Let's assume we have a type called Iterator which has a type parameter Element:
interface Iterator<Element> {}
Then we have an interface Iterable which has one method which will return an Iterator.
// T has an upper bound of Iterator
interface Iterable<T: Iterator> {
getIterator(): T
}
The issue with Itera... |
This is quite a silly question, but I really don't know what to do before starting a project.
Take this project for example:
https://github.com/kutlugsahin/smooth-dnd/
This project to me is quite complex. There are a ton of functions: simple as well as Higher-order functions and they interact with each other in a way t... |
The scenario is as follows. There is a PC running a complex piece of AI software wirelessly controlling a number of soccer robots. This software is written and maintained by a team of students that changes every year.
This means that every year a new team of a dozen relatively inexperienced developers has to learn to w... |
Is there a coding naming convention principal for SQL variables? Can variables be named the same as column names, I heard in different companies, this may cause confusion. However in C# below, its a generally accepted principle, resource below.
create table dbo.Product
(
ProductId int primary key null,
Product... |
Our team is reviewing our Agile process while we look at moving to Kanban style flow instead of Sprints. One question we are having a hard time answering is
At what level (what type of Work Item) should the Product Owner
be prioritizing at?
In our mind, it comes down to either Feature or User Story (Bug). However, ... |
Is it a right expectation that if a C# class deals with unmanaged resources and implements IDisposable, then it also should implement some kind of finalizer logic?
We have a vendor-supplied utility class that uses some unmanaged resources. We don't have the source code, so don't know too much implementation details, ap... |
When defining localization text, I often worried about whether I should translate the whole string including punctuation, or just translate the text part, for example:
Translate whole text:
"ARE_YOU_SURE_UNDONE_en":"Are you sure (It cannot be undone)?",
String message=map.get("ARE_YOU_SURE_UNDONE_en")
Translate text o... |
I was thinking about how people actually implement utilising results from a cache before a doing database lookup. When designing an API, should there always be a manual check to the cache first before doing a database lookup? I've read many books and seen many videos online but I have never seen someone do it like that... |
I use MVC + service classes in my project. My projects structure looks like this:
-MySolution.Web
-MySolution.Models
-MySolution.Services
-MySolution.Common
MySolution.Web is an asp.net web application project. MySolution.Models stores model classes that map directly to database by using Entity Framework. MySolution.S... |
I am a data scientist and do lots of programming in R/RStudio.
I like to be organised (as I'm sure (hope) most programmers do) and as such I always use the Project feature in RStudio to keep my work organised so that I can comfortably switch between projects in just a couple of clicks, keeping related files together.
D... |
Our service is in 5 cities right now. If someone tries to call our service API from any other city, we want to throw this error Service not available in your area.
The question is, what is the appropriate http code would be for this error?
503: Service Unavailable
403: Forbidden
or something else?
|
Recently Ive seen so many devs working with the stack Spring/JPA and returning all these JPA entities on their rest controllers.
In my opinion it's a BAD PRACTICE for several reason such: Transactions (should never start on the REST controllers), sensible informations can be exposed by mistake, maintenance of the entit... |
We are developing a tool from scratch based on a Spring backend and VueJs frontend. I am primarily working on the backend and came to know about the HATEOAS principle of developing REST APIs and adopted it. I will confess that one of the reasons for adopting it was the out-of-the-box implementation that Spring provides... |
While reading "Patterns, Principles, and Practices of Domain-Driven Design" by Nick Tune; Scott Millett (certainly not the first book on DDD I've read) I started to understand usage of Martin Fowler's EAA patterns with DDD and with that there came a question.
A single SQLAlchemy model is like Active Record (if I unders... |
Consider a large program with many different parts that have a single command line interface, as is the case with most applications. How best do I handle passing various command line parameters, that may be meant for various parts of the application, to them?
These parts may be hierarchical, for example, main() instant... |
I am working on a project which has a requirement to records in the database every day. I currently have a REST API which does the usual CRUD functions. Should I create a service within the architecture which interfaces with this API to update the database? Or should this functionality be hosted within the API itself?
... |
When web came, for years designers would create stunning designs in Photoshop, and developers would try to translate those designs to HTML/CSS/JS. This had many problems with itself. Lack of concurrent engineering would trigger many back-and-forth trips between design and development. Developers didn't have keen eye to... |
I'm developing an application which sends quotes to clients via email.
Since quotes are obtained from various resources (per each client) they end up in a single array which is then used as a source for the email.
The desired functionality is that the client doesn't receive the same quote until the full rotation is com... |
For obvious reasons (be a better developer) I desire to gain a deeper understanding of not just my code, but the systems / frameworks / libraries that I work with. As a senior-ish dev* I feel I should have more than a surface level understanding however I am struggling to bring myself to that level of expertise.
In mor... |
Good day
When starting a new project and you have access to the db as well as writing the code.
In this specific case it is PostgreSQL and Java EE with JPA and Hibernate.
Should one:
Aim to create a normalised as possible DB using lots of key constraints on table?
Create as much of the business logic as possible as... |
I am looking at a couple of SaaS Policy Solutions and want to integrate those with an On Prem Policy System.
I am listing some goals below and approach I am considering. I am looking for any input on this approach / suggestions.
Goals:
Create REST Apis that will return data from any of these 3 systems
The data retu... |
I've looked at various definitions of the builder pattern and whilst there's varying definitions, they tend to be focused on the broad definition of incremental construction. However, it seems that most of the examples of builders I've ever seen essentially just construct "value" types with method chaining.
I've found,... |
I was recently writing a small piece of code which would indicate in a human-friendly way how old an event is. For instance, it could indicate that the event happened “Three weeks ago” or “A month ago” or “Yesterday.”
The requirements were relatively clear and this was a perfect case for test driven development. I wrot... |
We have one single internal website.
Underneath this website (in IIS) we have two web applications:
1-Main web application
2-Web services (created using the visual studio web api project template)
The webservices are called by the pages in the main application.
They are also called by our database in some SQL CLR funct... |
I am new to machine learning. I have implemented a machine learning model which detects sound (for example: horn, siren, hammer etc) and predicts the type of sound. I have to physically test the model on actual sound of any object. How do I go about it?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.