instruction stringlengths 34 36.1k |
|---|
I am researching about Extreme Programming, and saw in Scott Ambler book 'Agile Modelling : effective practices for extreme programming' that XP has an lifecycle.(exploration phase, planning phase, iterative development,maintenance So whenever someone wants to use XP process to develop, can we follow this lifecyc... |
I'm mainly interested in answers in regards to a Swift language, but more general answers are always welcome.
I want to test a class (CUT), and for that I will use dependency injection. Now, I can:
Create some protocol that my CUT will use, which some concrete class and some stub class will conform to.
Just use concre... |
I have some properties in a property file that I referenced in a singleton so that I can access them easily from different parts of my application. For each property, I put the properties along with some additional information for each property in a list of objects. I'm doing this in the singleton's private constructor... |
I had to develop an application in Java for a school project, so I designed a UML class diagram oriented towards Java (including structures, attributes and types). For example:
-getLists() : List<String>
So the question is: should I assume which language I'll be using when creating a UML class diagram or should I take... |
Background:
Developer is the best person to know/understand the dark corners after any development/enhancement of enterprise software, compared to QA technician.
Developer can assess the depth/breadth of production problems that can arise from such dark corners.
FOR Quality reasons(only) but not for cost cutting, my... |
I am using MongoDB in a project, where relationships between collections are created via referencing a unique document ID of a special BSON ObjectID type.
So I can have a School document like this:
{ name : 'Country School', _id : ObjectId("aaaaaaaaaaaaaa") }
Also, I can have a Subject document like this:
{ name: 'Mat... |
What would you call the function that takes a list of n lists of values, and returns a list of all the unique lists of length n where the ith element is chosen from the ith input list?
For example:
[[a,b], [c], [d, e]]
=> [[a,c,d], [a,c,e], [b,c,d], [b,c,e]]
At first I called it permute, but then I realized that woul... |
According to Python documentation, super() can be used without arguments inside class definitions, because the compiler implicitly feeds it with contextual arguments:
class C(B):
def method(self, arg):
super().method(arg) # This does the same thing as:
# super(C, self).meth... |
Sometimes I ran into errors which are really hard to debug. So my meta question is the following:
You have multiple chunks of code, let's say A -> B -> C -> D
Your code don't crash but the result isn't what you expected
You clearly don't know from where the error comes, so you tried to change all chunks one by one t... |
To prevent long, procedural business classes like e.g. BookService with many, many methods that does the same, we decided to make a command class instead of each method - or set of similar methods. For example, if BookService has the following method:
Book createBook(String name, String author, String description) {
... |
I've come across a problem like this more than once and I'd like to know the recommended approach(es) for dealing with it. Alternatively, I'd like to know if it has a name.
For concreteness, let's suppose we have a Colony object, one of whose members is a list of Organism objects. Organism objects have an Update meth... |
in my situation i have too many parameters(1000 parameter or more ...) the number of parameter may change. every parameter contains a defined number of values .the problem is that the combination of all parameter values is too long which make it impossible to cover all the testing cases , so is there a solution to gene... |
This is the first time I'll be writing an application (personal) that involves money computation.
One of the potential issues I found is with regards to precision and repeating decimal.
Ex.
1 / 3 = 0.333
0.333 * 3 = 0.999
Where'd the 0.001 go?
What's the correct way of doing this operation without losing 0.001 that m... |
I am an amateur programer in a CS class trying to learn proper programming skills.
This is how my code looks, the edges of it extends to 103 columns.
int extractMessage(char keyWord[25], char cipherText[17424],
int rowSize, char message[388])
{
int keyColumn = 0;
int cipherColumn = 0;
... |
Here is a json which comes in the request param. I am constructing a class with getter and setter for accessing the values in json so that I could be able to pass the class object to different methods and able to access the member variables in them.
public class RequestParams {
private String student_id;
privat... |
In application which has about 1.5 mln lines of code there is using many pointers as a class members and in other places in code. Classes are usually very huge.
It is possible to change to make it safer in quite fast way? Refactor it can take years. It will be hard to change all methods to check if pointer is not null ... |
In our code we have some classes that represents business logic. Prior to usage, they are created and populated with two types of inputs:
business data required for execution (e.g. name, maxValue...)
infrastructure references to e.g. database, message bus, http client... etc, anything that is not related to business, ... |
I'm finishing off work on a complex rule-engine for Hotel Rates with real-time queries. There is a lot of conditions addressing intersections of periods for options, restrictions and policies. All of these are per date, meaning the time of day is irrelevant.
It varies wildly, from customer to customer, whether period s... |
I am focusing on writing easy to test code these days and I realize that most of my classes follow the skeleton below:
Some class ObjectManager needs a DatabaseRepo, while there is only one type DatabaseRepo in production (OracleRepo), I am still implementing it against an interface because I want to be able to mock o... |
Most of my production code has fixed types of dependencies, illustrated below: the House for example, at run time, always depends on the same Kitchen.
Therefore, I am wondering what I gain by having the House force whoever constructs it to inject its dependencies as opposed to provide the option to inject the dependen... |
I have an application which basically inserts some rows from the current front end web application.
All the calls before the service layer checks/validates if the user is allowed to insert data or not (This is where I am stuck with my current approach outlined below).
I have to create a REST API which will allow other... |
It is easy enough to create unit tests for conditional blocks which follow the expected path, but it can sometimes be difficult to contrive data for sources/objects I do not directly control, (databases I do not want to modify or access, environmental variables, etc.) without modifying the source code to add debugging ... |
I recently built a small web application using riotjs, a library that facilitates creating UIs in the spirit of functional reactive programming, i.e. defining the UI as a pure function of the application's state, much like the far better known reactjs.
Or so I was told, I think. I'm still not sure if I grasp the concep... |
I am designing application for multiple users.
Their data (e.g Surname) might change in time.
But documents they create should contain their data for moment they created it.
For now i am adding new record for any change in user data except those that change password or account expiration. Thus if document record is "si... |
For a completely fun project, I want to write a Markov chain chat bot.
The algorithm used is quite simple - break down incoming sentences into tokens, storing what words tend to come after each token (with perhaps a "weight" as more usage is brought in). This would mean that, on average, a sentence would take up twice ... |
I am trying to understand a general pattern. Suppose I have an application where I show User and all the Jobs listings where he has applied, here User and Job are many2many relationship. In the same interface I need to show the all the Address of the logged in User.
So, I will have following classes:
class User {
Lis... |
I am a user of SVN and now I am learning Git.
In SVN I usually checkout on my local machine a repo, which includes all branches in my project and I used to select the folder for my branch I am interested to and work there.
I see a difference using Git.
Currently I am cloning a repo and clone a specific branch using git... |
If I need to design the system architecture for a scalable site like amazon/BestBuy, what can be high level system architecture. googled it but did not get much data points.
Below is the high level system diagram based on mine understanding
To illustrate mine understanding I will take two use cases
Inventory addition... |
Basically the lamport clock helps the host to order the events rather than the exact time. How does all the logical clocks end up being converged in the long term?
|
We have a Symfony backend server for our Android and iOS application. Recently we need to extend our application by supporting real time interaction such as chatting, and we decided to use NodeJs with SocketIo to support it.
Currently our design is to let NodeJs acts as man in the middle. Nodejs would just receive requ... |
Given:
a list of 'leaves' that each have a cost,
the cost of creating an 'edge'
The constraint that a constructed tree node can at most have two children.
We now want to find the tree with the lowest maximum cost when adding up the cost of edges from each leaf up to the root node.
When naïvely attempting to build al... |
We are a big team (10-12 developers and 4 qa) working on multiple projects with the same git repository. Its a spring boot based backend web service. We are looking for a good git branching and deploy strategy. we also have a qa team who ensures that our features are working as expected (bug free to a certain extent).
... |
I want a class which will have a single method on its interface to add updates. These updates will be stored in an internal variable of the class until a specified batch size is reached. At that point all updates will be sent and the list of updates is cleared.
When my program is exiting, and there are still updates... |
I would like to automate the following sequence of events;
A new version of Angular is released on Github
'Something' triggers causing all our angular applications to update their npm dependencies for angular to the latest
The applications build, run unit tests and push to UAT on success, notify success/failure condit... |
I have a parser that can be defined as
int = a:/[0-9]+/ {parseInt(a)}.
It is supposed to match an int and convert it into a number. There can also be a parser like
sum = a:int b:int {a+b}
As you can see, it is a series of tokens, which means that they must be parsed as an array of tokens. When we start such an array... |
I am currently refactoring a piece of code to keep things testable and maintainable in our c# application.
I've stumbled upon a scenario where an existing method returns data with lists and enums that is then processed with lots of if else conditions in a big long method that is 800+ lines long. Lucky me!
I was tryi... |
This is going to be a very non-technical, soft question and I am not sure if this is the right platform. But I am a beginning CS student so I hope you guys tolerate it.
In the first semester we were introduced to OOP concepts like encapsulation, data hiding, modularity, inheritance and so on through Java and UML. (Java... |
I'm currently developing an app using the Azure Service Fabric. My question comes in regards to balancing outgoing connections. One of my services is going to be making a large number of outgoing connections to remote services. I'd like to be able to load balance these connections out, so when nodes go up, the new node... |
This is a simple example, but it reflects a tension between SOLID principles that I often find myself struggling with.
A popular example of the Open/Closed Principle (e.g. [1], [2]) imagines that you have many Shape classes, and a drawShape() method, e.g.:
// Open-Close Principle - Bad example
class GraphicEditor {
... |
I'm working on an in memory on disk cache and am starting to think about strategies for scaling the system. At the moment the system persists data by creating a file for each key value pair, where the key is the filename and its contents are the value. I want to be able to scale the system horizontally but am unsure of... |
I'm doing an essay on this for college and I can't really find sources.
So far I've found these:
https://www.quora.com/Which-is-the-best-programming-language-for-embedded-system
http://www.eetimes.com/author.asp?doc_id=1323907
Why does C dominate in the embedded software market?
I'm meant to evaluate the suitability of... |
In Angular 2's official tutorial, any operation involving getting or saving a class necessitates using a service. For a Hero class, they had to create a HeroService to perform all HTTP calls. This includes getting a single Hero object with heroService.getHero, and creating or updating a single Hero object with heroServ... |
I have a table, let's call it Widgets, a Tags table with about 30 tags, a WidgetsTags table that joins each widget with any number of tags, and a table called LandingPages, the landing pages are for SEO purposes, they offer pre-filtered versions of the widgets table that match popular searches. That way when someone s... |
I read this article from the google testing blog. Basically, the idea expressed in the article is that it's a good practice to avoid writing "change-detector tests". This code is given as an example to avoid
// Production code:
def process(w: Work)
firstPart.process(w)
secondPart.process(w)
// Test code:
part1 = ... |
I am trying to implement a message that contains sub messages. The format would look something like the following.
Message: Field 1, field 2, ..., sub type, buffer
Depending on the sub type there could be one of several ways to interpret the buffer. Some of the sub messages might look something like the following.
Sub ... |
This is going to be a very non-technical, soft question and I am not sure if this is the right platform. But I am a beginning CS student so I hope you guys tolerate it.
In the first semester we were introduced to OOP concepts like encapsulation, data hiding, modularity, inheritance and so on through Java and UML. (Jav... |
I often find myself writing functions that look like this because they
allow me to easily mock data access, and still provide a signature that accepts parameters to determine what data to access.
public static string GetFormattedRate(
Func<string, RateType>> getRate,
string rateKey)
{
var rate = get... |
We have a simple CRUD application. QA has a test script where they are doing the following:
Call Create Customer service
Query the database for the newly created Customer
Verify the Customer in the database matches the expected result
Call the Get Customer service
Verify that the Customer returned from the services m... |
I am using the same final constants in different classes,
like
class A { private static final String NAME = "Name"; }
class B { private static final String NAME = "Name"; }
class C { private static final String NAME = "Name"; }
I am trying to simplify the code here instead of using the same constants in multiple cla... |
I will be developing a mobile app, which will mainly act as a client. There will be an API on the cloud that these mobile clients will interact with, and there will also be a web application for administrative purposes.
I'm thinking if I should use two separate applications for the API and the admin application. My tho... |
I am constructing an enum Flower which contains the fixed set of constants for Flowers as described below. I'm writing it in a separate file and importing it to other classes so that it could be used across my project.
Is it a good practice to write an enum in a separate file in Java. Can someone give me some advice on... |
I am integrating an external library that declares a singleton, like this:
public class External : MonoBehaviour {
public static External Instance { get {/*setup inner stuff*/} }
public void Method1(int arg);
...
public bool MethodN(): // N is large
}
I created a wrapper with an interface, so I can un... |
Studying some in-depth concept of Spring framework, I'm facing this doubt.
Has the Model, as inteded in Spring MVC, the same meaning of the M in MVC?
I mean: I always considered the Model of the MVC pattern a layer where is residing all the data and the logic that is retrieving it from a DB.
But in Spring MVC model is ... |
I keep hearing the term and all google searches lead me to articles on compilers. I just wanna understand what the term compile target means :|
UPDATE: To give some context: I've heard it said that web assembly is a compile target for for other languages such as C, C++, Rust etc.
|
Right now I am working with embedded systems and figuring out ways to implement strings on a microprocessor with no operating system. So far what I am doing is just using the idea of having NULL terminated character pointers and treating them as strings where the NULL signifies the end. I know that this is fairly commo... |
Having one e-commerce system for multiple markets.
Having markets related 1:1 to currencies.
Having one database storing all order information (cost, price, invoicing)
How to manage different currencies?
normalise all saved data to one single currency (and at display time apply conversion rate)?
save everything in the... |
I have a large codebase of Java/JSP files that needs to be compiled and checked for errors. The compilation time is long enough that we only run it once a day. However, I'd like it to be more frequent than that, say every 15 minute interval.
But I'm not able to figure out how to minimize the build time to allow this. R... |
Does code-review typically involve UAT/QA testing? We are trying to establish a meaningful code review process and we have come to a disagreement among our development team. Some of are holding that a reviewer should checkout a development branch from TFS, and actually perform UAT based on the acceptance criteria of th... |
In C, almost everything requires a function. What nags me is that I don't know exactly what's going on. If there was no msvcrt.dll file, my C programs would all break because that's where all the standard library functions are. I would like to know what the equivalents to the standard library functions are, but without... |
In the GUI application I'm working on I have a number of custom (composite) widgets that I've created, with each widget having an update_gui function where I access my SQLite database so I can fill in text areas, set checkbox status, etc
I constantly run into the problem of events being fired when the gui_update code i... |
It sucks being on the critical path as normal developer, especially if you're late. When you're the senior developer, that the team is looking to for leadership, it's even worse.
When work for most of the team is stalled waiting on some critical piece what should the rest of the team do? We have limited access to th... |
I go on challenging the Erlang-promoted practices. I see that they advise to hide the messaging behind API
We love messages, but we keep them secret:
Something annoying with the previous example
5> Pid ! {self(), {store, bacon}}.
{<0.33.0>,{store,bacon}}
6> Pid ! {self(), {take, bacon}}.
{<0.33.0>,{take,bacon}}
7... |
In our company, we have large ear files to which developer groups contribute jars. This is a many-to-many relation, where each ear has 30-50 jars and some of the jars are within 10 or more ear files.
We are thinking about introducing more automatic testing to move in the direction of CI. Integration tests usually happ... |
I need to process a large number of data items, and I need to restrict the speed at which they are processed. For example, not more than 20 items per minute.
I've thought about an algorithm for that, where I'd keep a list with the time when each past item was processed, then I can know how many more I can process at a ... |
Imagine an ORM system, independent of language but let's assume PHP. Data is encapsulated in PHP objects and stored into and loaded from database.
Let us have a theoretical object "Person" with multiple addresses (so mapped to 2 tables in database), which can be added by a function.
Do NOT consider how access on data e... |
I have a service running on AWS exposed via a rest API. The service processes files.
Clients of the service post a file to the api and are returned a Job ID.
Clients can then request the status of the job, if it is complete the job result is returned as JSON.
The API essentially consists of a simple gateway service th... |
I'm currently working on a project that requires using a database. This system may be required to use an SQL database in the future, but for now we are using Google Spreadsheets via API because we need to access the data quickly, easily and for free.
My question is: Should we create a DB API in case we change the data... |
In the context of sports scheduling, a scheduling rule violation (let's call it simply violation from now on) is produced when trying to allocate a match in an illegal timeslot. There is a wide variety of reasons of why this can happen and this is precisely the purpose of the scheduling violation object: a list of them... |
We have a relatively simple version control process: master branch, dev (otherwise known as integration) branch, and our individual branches for every user story.
We check out from dev, branch at the beginning of a new user story to a new branch and once we finish, we merge again to the dev branch.
There is the opinion... |
I'm trying to understand the age old facade vs adapter confusion.
Most languages and frameworks have a data access library designed for RDBMs. In the case of the examples provided above you have a connection interface, and one connection type for each driver type. All of these types besides ODBC have a ODBC connection... |
I'm new to Docker and containers in general, and was wondering if:
this approach is possible, and
are there better/more-proven approaches
I have a "Command Central" web app that's responsible for maintaining the data for multiple teams. The teams will each work with their own containers, which come in pairs; one web... |
I know this question has probably been asked several times before, but my question is specific to my situation.
I am implementing a notification micro service. It has an email table and a queue table. The service is exposed using a REST API. Each email can have multiple to addresses and cc addresses. The queue has an e... |
I've seen this in C#, Hack, and now Kotlin: await or an equivalent operation can only be performed in special "async" contexts. Return values from these are, to borrow Hack's terminology, "awaitable" in turn, so the special async-ness of some low-level async system function call bubbles to the top unless it transformed... |
I have general parallel programming question.
Suppose there is a directed graph with cycles. Let’s assume that each node has fairly small amount of incoming edges ~ from 0 to 20 and potentially pretty big amount of outgoing edges ~ from 0 to 500. Let’s say that each node is a function that getting all incoming edges as... |
I'm an owner of some Product, where I have different clients who use that product, and the attributes of that product alter the experience that my clients have on my page.
For an example, lets say that clients have a key called "product1" and that would yield a "Product" object with values
Product:
{
"id": produ... |
I am trying to come out with high level architecture for product search in big scalable ecommerce application like amazon/best buy etc.
Use case :- Search any item in free text. Say user search product "galaxy white" , it can be mobile phone, air condition, garment brand , beaty product etc. I need to display all pro... |
I know that ReentrantLock use AbstractQueuedSynchronizer(AQS) to implement Lock.
But the detail of the realization, I can not understand.
I know that AQS use volatile, CAS and spin for synchronizing. But, these actions only control the "state" member.
Although, LockSupport.park and LockSupport.unpark can synchronize th... |
I'm a C++ developer and in an attempt to better understand cross-platform development, I'm trying to get a better understanding of some implementation details of compilers and how exactly they create OS specific binaries. In the midst of my study I realized that, at least for a while, most compilers you downloaded for ... |
Let's say that I have a JSON file like at example below.
How would I go about finding all possible values of item combination time sums that exist between let's say 00:03:04 to 00:25:55 without finding every single permutation combination that exists and adding them for that set?
For example item 1 and item 3 would be ... |
It's a language agnostic question. Seems like a common problem, but I can't find answer anywhere.
I need to pick a name for a variable to hold the values of one attribute of a list of objects, and I would like the variable's name contain the attribute name as well as the object's name. My question is how to use the plu... |
Edit: the difference between my question and What are the differences between abstract classes, interfaces, and when to use them, What are abstract classes and abstract methods? is that the chosen answers didn't mention about the compiler-warning part. One even mention the re-use of code by inheritance, which is bad pr... |
I am trying to model a design for a C# project. Trying to follow the SOLID principles, this is what I've got so far:
SDKClient class which has three (for this explanation) important properties (IAuthProvider, IHttpProvider and IFileService). The SDKClient should be decoupled, so I am always free to exchange the auth cl... |
At several times in the past while writing software documentation -- including user manuals, user stories, bug reports, test cases, and emails to users/colleagues -- I've needed to be able to refer to items inside a menu. Sometimes ones nested several submenus deep.
I've seen and/or used several styles in the past:
Pa... |
I have 20 entities and 50 user requests. And i have very complex business-logic (set of rules). How can i make my architecture so I'm not confused when adding new rules.
Now if i add property "InTheBattle" to fleet, i must consider this in 5 requestDispatchers and 3 methods in Verifications classes.
What will happen w... |
My sincere apologies, if this question is too vague but I am really curious in understanding how payment redirection works in web development without exposing data in url parameters.
In detail with example:
I go to Jet blue website(jetblue.com), search for flight, choose flight, fill all the necessary information and ... |
Given the interfaces that major OSes (Windows, macOS/OS X/Mac OS X, Linux) provide to file systems, can file systems be designed and implemented in a way that is largely independent of OS?
I'm not at all an expert on file systems and I've never implemented one but I am an enthusiastic user of file systems. My naive exp... |
Domain object "Contragent"
Let's say I have an hierarchy of classes:
public class BaseContragent
{
public int Id { get; set; }
}
public class PersonContragent : BaseContragent
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class CompanyContragent : BaseContragent
{
... |
I have a problem and I want to know what is the best way to solve it.
Problem:
I have a Binary Decision Tree. Each leaf node has an object (called Matrix) that stores some information and performs some calculations. At some point during execution, I want to ask Matrix if I should split the leaf node. If yes, I should c... |
I have a mysql database in server, storing user accounts information (username and password). I'm developing the Android login/ register page for an app.
When the app is first loaded on client mobile, should the Activity takes all the accounts information from the server and store in the local sqllite? and then when u... |
I am a C++ programmer with limited experience.
Supposing I want to use an STL map to store and manipulate some data, I would like to know if there is any meaningful difference (also in performance) between those 2 data structure approaches:
Choice 1:
map<int, pair<string, bool> >
Choice 2:
struct Ente {
... |
I ask this because I am interning as a QA Engineer and one of my bugs got rejected by a remote project manager because I performed an unrealistic test.
Basically, the bug involved a large text field to hold notes of 2000 characters max. I performed a test in which I entered a 2000 character long string to see how it wo... |
As far as I understand, the domain model should not know about the persistence layer. But then... How can I deal with removing element that are dependant of a father object?
For example, in my domain, if I have a ShoppingBasket with Products, and I want to remove a Product. I can remove the Product in my Domain Model.... |
We have a GitHub repository where we distribute our source code. For that, we want to use a really permissive license, like MIT. Of course, some of our projects have GPL or similarly licensed dependencies. However, we do not include their source code there but rather (since we're using maven) list them in our POM files... |
How do you think we should handle 1 external collaborator/developper within scrum method ?
For example : Should we isolate the tasks that he must do ?
|
I've come across two Stack Overflow posts that seem to offer conflicting answers:
https://stackoverflow.com/questions/4831307/is-it-bad-to-store-all-instances-of-a-class-in-a-class-field
https://stackoverflow.com/questions/12101958/keep-track-of-instances-in-python
Can anyone confirm whether or not storing instances ... |
I'm a seasoned programmer but a novice with DDD. I have a project that I'm trying to implement with DDD and my understanding is that there is some ambiguity with regard to the use of domain models and application services. In the purest of DDD implementations, my understanding is that domain models are supposed to co... |
tl;dr Can I have a repository depend on another repository, where they both implement the same interface?
I am working on a website analytics system that involves getting data from different sources. One of these sources is very slow for large datasets and the other is deprecated and we are moving away from it.
interfa... |
I want to make some enhancements in some still-functional code that was written a long time ago, before the programming language it is written in grew in features. In theory, the whole project uses the up-to-date version of the language; however, this particular module (and in fact, many other modules) are still writte... |
On a regular Hard Drive a secure delete of a file is possible by overwriting it, does simply overwriting the registry key is enough to secure delete the key ?
If not how I can proceed to secure delete my registry key ?
|
Introduction
I'm working at a software company building software as a service. Currently we have version x.y in production and x.z on acceptance. Let's say we find a critical bug on production and want to test the fix on an acceptance environment. I don't know how to work with this.
Options
Create a second acc enviro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.