instruction stringlengths 34 36.1k |
|---|
I am a software engineer of 10 years and wondered what other people have found effective in stopping a codebase from degrading over time. For example, some of the issues I have noticed are:
large technical debt
loss of knowledge from companies due to personel changes
complex upgrade and migration strategies between ... |
I have read for three days about the Model-View-Controller (MVC) and Model-View-Presenter (MVP) patterns. And there is one question that bothers me very much. Why did software designers invent MVP, when there already was an MVC?
What problems did they face, that MVC did not solve (or solved badly), but MVP can solve? W... |
I m studying DDD in a development context, and it seems that I've misunderstood something.
Actually, I was thinking that an Entity is the object that can be persisted on a storage support like a database.
But does it mean that the entity is the same thing than a row in my database ?
I mean there, can it exist objects b... |
What is the best practice for detecting piracy in a SaaS or Web based app where the user can share their login?
User is licensed to use the login on multiple devices. So how do you differentiate between that and sharing that login?
Approaches and issues
Detect simultaneous login on 2+ devices. Can be challenging to ca... |
If I have data that I will only need to update very rarely (once a month), would it be a good idea to use a JSON file instead of a database table with only 1 row?
|
Same system this site uses for example. You can vote down or up, but your votes are persistent between logins so you cannot cast duplicate vote, only change your vote to the opposite.
How would one go implement this?
Only thing that I thought of is having an extra field in database row, that would store the IDs of use... |
I am trying to learn the difference between a production system and a rule-based system because it seems to me that they are the same thing basically. I know that both refer to programs (system) that can create Artificial Intelligence Software and Expert Systems.
Can a production system be something else than a rule-ba... |
I want to create a minimal polygon which approximates the boundary of an arbitrary (semi-random) shape.
By "minimal" I mean, "as few points as possible".
The original shape (to be bounded) is in bitmap format, with simple coloring.
The complication is that the shape may have lines (i.e. long thin areas/shapes) coming o... |
Why does Swift use this function notation:
func greet(person: String, day: String) -> String {
return "Hello \(person), today is \(day)."
}
Like, I don't get why it uses the small arrow -> notation to specify return type. func identifier() -> Type instead of something more sensible, like Type identifier().
I have ... |
So I'm currently building an application that allows a user to fill out paperwork digitally, and then that information is taken in by the server and a PDF is populated and returned to the user.
The internal logic for each page is pretty similar:
Receive Request from client
Open proper PDF template from file system
Ite... |
I have a service which is an API client.
It's goal is to instantiate a concrete client you tell it (different providers), implement it's methods (createRequest and doRequest) and forward their call to the concrete client, so, it is a proxy.
But also, it needs to persist the response of clients to a database in a trans... |
Assuming I have a RESTful service and it always responds in this format:
{
"error": {
"code": ...,
"message": ...
}
}
or
{
"data": ...
}
and there is a method like POST /users/me/change-password.
What would be the correct and RESTful behavior:
Business logic / validation errors are data... |
I have a question about the object X.equals(Y).
I use Sonar and it says that I have to move the "" string literal on the left side of this string comparison: !date.equals("").
So I did that: !("").equals(date) but I don't really know if it is right or not.
|
Now I'm commenting on both on interface class and implemented class.
But sometimes, I feel it's unnecessary commenting both.
So I want to hear from Pros which is a better way? commenting on both? or only on interface class?
Example)
/**
* Google Analytics service interface
*/
interface IGoogleAnalyticsService {
... |
I've run into bit of an issue on implementing a count system in my project.
I have a system where users can like a post. Should I keep a count of it in the same table like
or should I remove the like_count column from the post table.
My concern if I have like_count column in the post table is -- frequent update of the... |
I'm building a smallish library (few kLOC) which processes stream data in C++. From the streamed data (comes in packets) the library compiles a database piece by piece and naturally has to convey that information back to the host application.
Since this is my first library I'm unsure how to proceed with the API/Interf... |
This article claims that a data class is a "code smell". The reason:
It's a normal thing when a newly created class contains only a few
public fields (and maybe even a handful of getters/setters). But the
true power of objects is that they can contain behavior types or
operations on their data.
Why is it wrong ... |
A scrum team has grown over the dezired size, which makes it difficult to organize and plan work. The team works on a component that is used on multiple projects, that every now and then needs customizations that are based on the baseline product. The reason of the team growth is that there was increase of the load of ... |
One of the things I struggle with when unit testing is deciding what behaviors to actually test. I think part of my struggle stems from how most unit testing tutorials don't use good examples of things you would actually want to test in real life. For example, the tutorial I'm looking at now has a test basically like t... |
Haskell keeps the computed values of functions. This can be done only up the the storage limit. When the storage limit is reached, how does Haskell decide which computations to keep and which to discard?
|
I've been experimenting with layered, use-case-centric architectures as described in Uncle Bob's Clean Architecture blog post. Most of the examples I've seen are simple "update the customer record" use cases, which make sense. Where I get a little lost is when it comes to creating objects.
To make things a little mor... |
I am looking for an efficient way to compare 2 images and get the changed areas as a result.
My current attempt has the following steps:
Compare each horizontal line and keep the changed line index in a list
Compare each vertical line and keep the changed line index in a list
Iterate over each changed horizontal line,... |
The code is difficult to follow but it appears to be (mostly) working well, at least with superficial testing. There might be small bugs here and there but it's very hard to tell by reading the code if they are symptomatic of deeper issues or simple fixes. Verifying overall correctness manually via code review however ... |
I have to design a Stock-Keeping Unit (SKU) for my downloaded products and I am looking for any advice on how to choose a standard.
More specifically, I would like to know:
Are there any character limitations, or could I use unicode in my sku?
Could I use Linebreaks or Tabs in my sku?
Should I bother with bar codes o... |
Based upon definitions I have read of the term deprecation, I get a general sense that deprecation is usually reserved for moving on to other methods/classes for good for reasons such as (and I borrow from Wikipedia):
The feature has been replaced by a more powerful alternative feature.
The feature contains a design f... |
I'm a novice at Object-Oriented Designing and have read some OOD books & tutorials recently. Now I'm planning to implement a video player(based on existing media api, AVFoundation or MediaPlayer etc) to practice what I've learned.
The idea is that given a video file, open it through certain media api, and then feed eac... |
I have built a Windows-only desktop application which is composed of two main executables and various configuration files.
The two applications are developed in different languages (JS and C++, respectively) and should always be in sync with versions (ie. appA-v1.0.exe would probably be incompatible with appB-v2.0.exe... |
What I mean by Internal and External API's:
Internal API: will be used by my front-end Apps (Web or Mobile).
External API: will be exposed to developers in order to integrate with my API from their systems.
Who can access my API:
My Admin Panel Web App (with multiple roles: Admins, Managers,..).
My User Web App (regis... |
That's a very vague title but I couldn't think of a better way to word it. But, just as an example, think about the direction that a character in a game is moving in. It just feels kind of wrong to be using a string and then doing things like if(character.direction == "left"). It seems to me that it leaves too much roo... |
I'm trying to implement a generic graph search algorithm in C++, as part of assignment at university, and I encountered problems when trying to implement it, mostly struggling with templates. this is the basic UML of what I'm trying to implement
Currently I have the bfs implemented, but our instructor told us we migh... |
I've just recently noticed there is an option to have static methods in interfaces. Same as with static fields of interface, there is an interesting behavior: These are not inherited.
I'm unsure it's any useful in the actual interfaces that are to be implemented. However, it enables the programmer to create interfaces ... |
I'm in the early stages of learning design-by-contract (DbC). And I think that if followed correctly, it can produce very high quality software. This gets me wondering though... why isn't it used a lot? Are there some issues in using it effectively within the typical software development process? For instance, does it ... |
All of us have some utility classes, which contain only static methods, for usage from different sources. Now, there can be two approaches which can be taken towards testing this piece of code.
Approach 1:
Have separate unit tests for utility classes. Wherever they are being called, mock out their interaction using som... |
Within IEEE Std. 12207-2008 is a description of the Software Development Life Cycle. Important for my purposes are the standards that derive from this regarding documentation. What I'm looking for is an IEEE (or ISO/IEC/IEEE) standard which describes documentation requirements for a Software Development Plan (SDP).
I'm... |
Firstly, some context.
I'm working in a project with more than 10 years of development and without any documentation. My task now is to create a comprehensive documentation for the database (it is a SQLServer database), including a dictionary with all columns of each table.
After some analysis, I found some obsolete co... |
in android, who takes care of the screens flow?
A screen closes after an operation and another screen opens. Which screen will be opened is a result of a complex logic.
I tried to do the flow in service, passing views as parameters to service methods, to let the service decide in which case will the screen close and st... |
in Gradle, when you include a library, you have to add the version number at the end, as such:
com.android.support:appcompat-v7:X.X.X
But a lot of times, understandably, the website for libraries don't tell you what the actual latest version number is on their front page, or in their "getting started" guide, and I end ... |
My company has several products on the market, developed in multiple offices in Europe and the US, which use the same common library. This common library wraps up a lot of industry-specific details, as well as adds some enhanced user controls, extension methods, math bits, etc.
Problems arise when QA comes back with a ... |
Using the Tree representation(mentioned below),
typedef enum {Running, Warning, Critical}Status;
struct TreeNode;
typedef struct List{
int childCount;
struct treeNode **childList;
}List;
typedef struct Resource{
char *resourceName;
Status resourceStatus;
}Resource;
typedef struct treeNode{
struct treeNode... |
I'm a developer still learning the complexities of a software system on a SCRUM team I joined recently.
I will be asked for a story point estimate for a piece of work that touches areas of the system that I have never worked on before. I am familiar with the technology used to build these areas, however I will need to ... |
Sometimes I discover that a commit I made two months ago had a bug. So I write a fix for the bug, but then I must choose one these ways of committing it:
I can commit the fix directly onto the main up-to-date branch (the trunk).
I can use a branch at the point of the original buggy commit, and commit the fix immediat... |
TL;DR - What criteria should you use to decide whether to 'do micro services'?
I lead a team of developers and one of them insists that we adopt a micro services approach to architecture. I was hesitant at first, because I had been coding under a rock for several years and never knew that micro services was a thing.
I ... |
I am working in WPF application and in need of a best design decision for one scenario. Basically, I am reading a .net assembly to extract the types and properties and mapping it to my own created custom classes to hold that data to make it serializable. While extracting, i required a way not to read the same type agai... |
I work on a big .NET project. It started more than 10 years ago, there is no ORM (NHibernate or EF I mean) and there is no chance to migrate to some widely used ORM (and for complex SQL queries ORM doesn't suite anyway). We use ADO.NET MS SQL provider with custom facade for datareader. We build select queries as string... |
I made some basic multi-threading tests here, and noticed that the speed increase when using the exact is bigger than I expected.
I assumed that speed would increase linearly until I hit the limit of cores, and then either stop increasing, or even slow down.
Instead speed increases linearly, and then JUMPS upward, but ... |
In my own variation of the command/query (CQRS) pattern, I define the following for a query handler:
public interface IQueryHandler<in TParameter, TResult> where TParameter : IQuery<TResult>
{
TResult Execute(TParameter query);
}
public interface IAsyncQueryHandler<in TParameter, TResult> where TParameter : IAsync... |
I'm a Scrum Master of a team that is working on developing a software & maintaining its production issues.
I'm planning to combine Scrum and Kanban. Where Scrum is for development, and Kanban is for production support, as suggested on many posts here.
I started with creating two separate boards for the product, but th... |
I'm building a RESTful API that uses JWT tokens for user authentication (issued by a login endpoint and sent in all headers afterwards), and the tokens need to be refreshed after a fixed amount of time (invoking a renew endpoint, which returns a renewed token).
It's possible that an user's API session becomes invalid b... |
1)
Below is a python function summation, that can perform sum of cubes/squares/.., similar operations.
def identity(k):
return k
def cube(k):
return pow(k, 3)
def square(k):
return pow(k,2)
def summation(n, term):
if n == 0:
return 0
else:
return term(n) + summation(n-1, term)
d... |
I recently completed a C project that uses GTK and OpenSSL. I have native binaries in linux and they run just great. However my new goal is to make as close to native as I can with a build for windows.
I've tried MinGW and it produces as a exe, however it crashes very easily, and gdb performs poorly when attempting to ... |
According to mdn's "Set" documentation, entries is provided as a convenience method
...to keep the API similar to the Map object, each entry has the same value for its key and value here, so that an array [value, value] is returned.
My question is what is the purpose of keeping the API similar in this case? i.e. whe... |
Please take a look at this AI system architecture proposal:
As you can see this is a multi-agent AI system for starcraft brood war that utilizes BWAPI AI framework, and I proposed this idea for the bot infrastructure architecture which consists of two primary neural networks where each one of these placed at specific ... |
I have a printer and SDK to work with it in Java. Printer working well with english letters and digits but doesn't print correctly special symbols like 'ä' or 'ê'.
I suppose that I need to convert string in charset used by printer. But I don't know what is the charset and has no chanse to get it now.
I run test printin... |
For this question I want to present my current design and my idea of using a trait. I would like to know whether my understanding of traits is correct and whether my problem can be solved with another design not involving them.
My current class hierarchy in my framework looks like this:
interface IPage { /* ... */ }
in... |
Brief description of my project structure.
I have some base classes like BaseView, BasePresenter ... .
Also my project consists of modules, module represents one complete part of the application.
Each module has it own Presenter, View ...
But also each module has it own Base<ModuleName>Presenter ..., where specific m... |
Let's say I'm programming a chess game. At some point I have to check, which moves are valid for a given piece. What would be the proper way to select the correct pathfinding function for a given piece (king, queen, etc.)?
I came up with three different approaches:
Store the pathfinding method (alongside the other dat... |
When I attended an interview, the interviewer asked me "Is MVC used for Windows Applications?" But I said no.
Is my answer correct or not?
|
I am working on a project in C++ that has the classes Driver, User, and Admin. I am including this classes in the UML diagram of my project. Now, there are many client functions in my project which do not belong to any classes but are placed in specific header files according to their functions. For example, I/O functi... |
Before you start reading:
I didn't know if I should post this here or on Workplace, but since my question is more about the "programming language" part I thought it would fit better here. My apologies if it's not the case.
Also, I'm aware there is a similar question here, but the context is slightly different and I tho... |
What is the best way of preventing of events from being handled more than once?
Imagine a system where customers can place orders and when successful an OrderCreated event is raised. There are some separate processes which listen to events on a message bus.
One process is to send an email to the customer, assume there ... |
I am trying to implement Microservice to understand the architecture and how communication works. Many articles state that Services should follow the Single Reponsibility Principle, but it's kinda hard to achieve. For example, I have to search Item and get all the information (including stock).
So I have two services:
... |
I have to develop a logging system for my project which has multiple features. I am stuck at a choice. I could either make a centralized database and front end for everything. Or I could have one log table for each feature and a common front-end none the less.
Centralized seems like the way to go but it has its disadva... |
I'm creating an ASP.NET MVC application to work with data from an API that has a couple of different endpoints for different geographical regions. Each region has a name, an alphanumeric ID and a host URL. e.g.: Western Europe - WE1 - we.api.com.
There are less than a dozen regions and their values won't change, though... |
I have been tasked with developing a web based (i.e runs in browser) viewer for a proprietary log file.
I have no control over the format of the logs, I just consume them. The log file contains binary data appended by a text message on each line, so part of each line must be de-serialized on read.
What I am posing, is ... |
"0", as a string containing one character, is not something empty intuitively. Why does PHP treat it as FALSE when converted to a boolean, unlike other programming languages?
|
To me this is a totally irrelevant unit-test and I don't understand why someone would spent time writing it, since there is very little value to gain from it. I would know perfectly well if this controller returned the wanted type by executing the method in a browser. Really, do you believe a test is needed for this an... |
I'm designing an entity to represent a log-in object. The unique username value is an email address, that will go onto the username field.
Should I add a second field called email to indicate a contact email address for the user considering that it would be valued copied from the username field?
My requirements are em... |
I'm looking for a formal way for a front-end and a back-end team to communicate on the shape of a JSON web API. For example, let's say you are on a client-side team writing the JavaScript & HTML for a AJAX SPA app. Another team writes the back end -- say, in Java. It's important that the data you see returned from thos... |
In our organaziton to make the testing process a QA can start the QA process by deploying a feature branch to a QA machine. My question is that while doing so should the build process include running the integration/smoke tests as well or can we skip that.
This makes the build fast and makes it easy for anyone to get ... |
My office is trying to figure out how we handle branch splits and merges, and we've run into a big problem.
Our issue is with long-term sidebranches -- the kind where you've got a few people working a sidebranch that splits from master, we develop for a few months, and when we reach a milestone we sync the two up.
Now,... |
I have a multi tiered project made up of three sub projects, i.e. Data access project, Business Logic project and Presentation project, where should interfaces be defined?
I'm guessing that there should be interfaces defined in both the DAL and BLL..
In the context of testing the Business Logic Layer by using "test" da... |
I am coding a Java EE application that provides REST services via JAX-RS resource classes, the application makes extensive use of CDI.
My resource classes are @RequestScoped, the application returns HTTP Status 202 Accepted to the caller and executes the work asynchronously.
I would like to return a "process ID" so th... |
I want to write a few modules for ERP system, which is licensed under GNU GPLv3, and I want to sell them. However I don't want my users to be able to redistribute the code without my permissions. Considering the fact that I won't touch the code of the ERP system, but I would use it's API, could I do this? I've read a f... |
I've looked around a bit and probably haven't found the right medium for this question so let me know if there's a different forum I should bother.
First, there is an application managed by another group that does some simulations and communicates to our system via Ethernet. Let's call this App.
Now, we have the foll... |
I'm in the USA, and essentially only have visibility to coding languages in typical use in my USA-based business. These are primarily C++, C#, and Java. Are these languages that are common here also ones that are commonly used world-wide? To help narrow down the question, I am mostly curious about the former USSR co... |
I'm making a Windows Forms app:
It is client-server. Authorization, then load some data from server, then send back some statistics from time to time.
You should go through a bootstrapping procedure, then it starts computations (a separate process). Then you can pause it anytime, probably scheduling it to start comput... |
I have many Users for every Group. Each User has an array of objects in the following form:
User.groups
[
{
"name": "My Group",
"group_id": "1337xD",
"is_admin": true
}
]
As you can see, each User contains a reference to the group they are part of. The application then makes a subsequent re... |
I've found that there isn't a concept similar to "arity-based subtyping" in many languages that I've programmed in, where higher-order functions could consume functions of lower arity than their argument type, differing in a consistent way: say, preserving leftmost arguments in order, or requiring name-type pairs to ma... |
A while ago I asked a question about custom text data formats, instead of using existing tools such as XML, JSON, YAML, etc. Now, in favor of converting our custom format to a relational database and some segments of JSON (in a JSON field), I'm running into the problem of 'data bloat'. By this I mean that there will be... |
Abstraction - Creates barrier between representation & usage of List ADT
Encapsulation - Ensures maintaining in-variants of List ADT.
An invariant is a fact about a data structure that is always true (assuming the code is bug-free), no matter what functions are called by user.
With this understanding, below is th... |
The assumption is that we're working on a large legacy Java codebase - with active ongoing development.
I had a team member say:
We should use lots of smaller JUnit tests that are focused on one class - because the fast feedback and ease of maintanence gives us value.
I had another team member say:
We should focus... |
In Python, if you have a classvar, it's accessible from an instance, but if you set the variable on the instance it doesn't actually change the classvar, rather it assigns a new name which shadows the parent value:
>>> class Foo:
... classvar = 10
...
>>> f = Foo()
>>> (Foo.classvar, f.classvar)
(10, 10)
>>> f.clas... |
If in class diagram I have a parent "Account" and three childs "Child1", "Child2", and "Admin". The "Admin" has control over "Child1" and "Child2" accounts. Will the relation be like this?
|
I need to work with some payment gateway API. The API is divided into two parts. There are some methods based on REST and a few methods accessible through SOAP webservice. I would like to create some bridge to combine it into single API class in my application. However I am not sure it is a good choice.
The question is... |
I am working on an app for universities. The case is this:
Each university has several academic programmes. Each programme has many subjects (modules). Each subject can be offered in different locations. The academic year is split into terms and each term lasts for a number of weeks. Not all modules are offered in the ... |
I have a SQL query that is around 50 lines long.
I'm wondering what would be the be the most maintainable and readable method for executing this, as it looks quite large. So far, I have thought of the following options:
Create a stored procedure in the database
SQL query is inline, in the method
Store the query as a S... |
Let's say I'm having a domain-model and I want to read and save it from any persistence layer - right now it might be a json file but in the future it could be xml or a database (which might also change in its type).
To generate the domain-model from the persistence layer, I've got an implementation of a simple Interf... |
My scrum team consists of developers who are experts in various fields. For example, we have two front-end and two back-end developers. Assume our velocity is 10. It seems that we can put tasks which sum of estimated story points is less or equal to 10.
We have task to do something on front-end side and this task esti... |
I am wondering if there is a difference between Haskell's type classes and Go's interfaces. Both define types based on functions, in that way, that a value matches a type, if a function required by the type is defined for the value.
Are there any differences or are this just two names for the same thing?
|
I have the following problem-
About ~60 tables on SQL that some have foreign key to each other,primary key as identity had to change to something else with logic. It was replaced by triggers that checks what is the next number and change the primary key field (by sequence)
Now this makes several problems on EF when try... |
So, I have Aggregate root that has some sub-entities with some sub-value objects (classic DDD design). I wanted also to use Event sourcing in Aggregate design. In AppService layer I receive Command, decode it and call method on the aggregate (I understood that this is common practice in ES):
public class AgRoot {
... |
Irony includes two phases. In the first phase it create a parser tree. After that its optional to create an AST tree.
What are the differences between the parse tree and the AST tree?
What is the reason to implement that?
|
Implicit typing in languages like C# permits compile-time type checks without necessarily referring "directly" to a target class:
var toy = SantasWorkshop.Build();
toy.amuse();
In this scenario, we don't need to know what type of toy it is. And yet, we'll still know at compile-time whether our toy fails to amuse().
Ho... |
In my basic understanding of ByteArrays the benefit is that it is smaller in file size.
The down size of a ByteArray is that for any given format you have to know the about the file format to get information out of it. You need a specification and software tools or software to find information.
For example, to get inf... |
Good day, I'm a beginner in Java and I was wondering if, in Java, I'm able to do a beta reduction with a given lambda expression in Java. Basically lambda reduction is like this:
1.)
Expression : (λa.abc)x
Beta-Reduced Expression (without parenthesis) : xbc
2.)
Expression :(λabc.abc)x)y)
Beta-Reduced Expression (wi... |
When submitting an app (especially iOS and android), there are some different size of app icons need to add into the app. Among of them, some sizes are optional, is it a good practice that I just provide the required icons that leads to submission fail when missing, and don't provide optional icons?
My idea is, if I p... |
So I am writing a method to check and throw if a new transaction is being made in another transaction.
I first came up with straight forward checkNestedTransaction, but this seems vague since I cannot see what this method actually do.(like, when does this method throw)
What would be the preferred name for this method?
... |
In the framework I am using, I shall group things into models, controller, and views (I added services).
When getting things out from database, it is pure data in array form. So they won't have methods with them.
As the title asked, is it common sense to convert database data to object first? That is to say, I may the... |
Here's the scenario:
I'm showing to the user (let's call him UserA) 10 items per page, ordering them by date (newest first).
As UserA still viewing page 1, another user (let's call him UserB) posts a new item.
Then, UserA decided to click on page 2. Now UserA is surprised to see the last item that appeared in page 1 i... |
With Oracle starting to collect license fees from different customers for using Java SE I've asked myself if the usage with a server runtime is still free. I'm no lawyer and all these licenses are more confusing than ever. There are BCL, GPL and others.
As far as I read this the use of Java for software development and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.