instruction
stringlengths
34
19.9k
After dealing with DDD for months now, I'm still confused about the general purposes of domain services, factories and aggregate roots in relation to each other, e.g. where they overlap in their responsibility. Example: I need to 1) create a complex domain entity in a saga (process manager) which is followed by 2) a ce...
From time to time we face difficult problems which are hard to reproduce. Creating a planning for solving such an issue is (nearly) undoable. What we do at the moment is break these up in analyses/reproduction and solving the problem. As long as know nothing we plan a number of hours to investigate and book off these h...
I am currently learning about memcached/redis, and I am trying to figure out how could I use this kind of technology at work. Now I understand that you should mostly cache data which is common to many user and which does not get modified every second. In our architecture, we have a very relational data model data model...
We have a university programming course and fellow students are asking some programming questions in our Facebook group. I'm a little hesitant to share all of my programs, especially if it's something cool for one of the assignments, since these are looked at by the TAs and they might notice if somebody has the same pr...
I'm going to include MongoDb(AGPLv3) in my product. My product is SaaS, I don't install this to client directly. My software is ASP.NET MVC website. But MongoDb's drivers for .Net is under Apache My questions are: 1) Should I license my software under AGPLv3 license if I use Mongo? I use them across drivers which writt...
There are businesses and people. People could be liked and businesses could be commented on: class Like class Comment class Person implements iLikeTarget class Business implements iCommentTarget Likes and comments are performed by a user(person) so they are authored: class Like implements iAuthored class Comment impl...
For the needs of a project, I would persist the datas contained in Core Data in several places depending on the state of the user. If the user is logged to my API -> Persist the datas on my API. If the is logged on iCloud -> Persist the datas on iCloud In all case -> Persist the datas on the device. Indeed, with ...
I need to implement a flexible Access Control system for a framework used by a couple of .NET applications. I have looked into Attribute-Based Access Control (ABAC) and XACML and this seems to provide the necessary flexibility to make decisions not only based on the user identity, but also on information about the requ...
I am doing my thesis on the subject of automated UI testing at a company that applies continuous integration to their projects. The company builds intranets in Microsoft SharePoint 2013 and my task is to create an automated test framework that can be used on any project as a smoke test, and that integrates with the con...
I'm building a medium-sized "single-page" JavaScript application using jQuery. If you include all possible functionality of the application, there are 134 click bindings. Since most of the content is dynamically loaded, I can't just do this: $(element).click(function() { ... }); Instead, I'm doing this: $(document).on(...
The main reason I use Shelve is to be able to quickly develop code without worrying about db table structure. Unfortunately changing a class name from, say, 'class1' to 'class2' gives "AttributeError: 'module' object has no attribute 'class2'" on the next run. What is the canonical way to rename a Shelved class? What o...
Often times users cannot comprehend the complexity of software. They think that because a problem is easy to describe then it is easy to solve. I want to equate the complexity of a "simple program" I have built with the complexity of a process with a tangible result. Is there a system that can take tangible process...
I want to save/serve multilingual data in my CMS application using Mongoose. Is this the correct way? name: { global: { type: String, default: '', trim: true, required: 'Please fill name', }, en_US: String, tr_TR: String, sv_SE: String }
I am not very good at estimating how long a piece of work will take to complete. I am guilty of putting my finger in the air and guessing. Usually things are later than expected, however sometimes they are earlier than expected. For example, a recent individual task was delivered in four months instead of five month...
I have 3 pages to my site. The 1st page allows you to select a bunch of options. Those options get sent to the 2nd page to be displayed with some data about those options. From here I can click on a link to get to page 3 on 1 of the options. On page 3 I can create a new/edit/delete all on the same page where reloads co...
I have a few HTTP resources, and i'm wondering if including the models of one in the other is acceptable or if there is a cleaner method. In this example, we have a ton of "news" resources, and users can subscribe via a resource called "subscription": ==>/news-items/{id}/ { "id": 987, "url": "http://example.com...
I don't know what scalar means exactly, but I'm trying to see if I'm thinking about it correctly. Does scalar relate to arbitrariness where the type of data could be any type, or a system is not able to know what the data is in advance.
I'm new to dependency injection and though I've really liked it so far, I'm not sure where bindings should go. I'm using Guice in Java, so some of what I say might be specific to just Guice. As I see it, there's two options: Accompanying the class(s) its needed for. Then, just write install(OtherClassModule.class) in w...
With the latest trends about C and C++ applications, and with latest I mean the latest years, I was expecting to see std::allocators to be used way more frequently than what it really is. Modern applications are usually multithreaded or with form of concurrency in them, and they manage a significant amount of memory, e...
I have some classes that represent, for the most part, data that's deserialized from XML. They also have some behavior in them, because I don't want to suffer from an anemic domain model. These domain objects don't have any XML specific code in them, but they do have properties that correspond exactly to the tags and a...
This is my first question so please indicate if my question is too vague and not understandable. My question is more related to High Level Design. We have a system (specifically an ATCA Chassis) configured in a Star Topology, having Master Node (MN) and other sub-ordinate nodes(SN). All nodes are connected via Ethernet...
I want to implement a system which store the profiles of employee and the resources that they have. There are many types of resources, such as the documents they produced, the techniques they have...etc. I store the properties of nodes and relationships on MongoDB, and only store the relationship on Neo4j. But I face a...
I've built a REST API and have been using Backbone models throughout a couple different applications to communicate to it. I would really like to build a single JS SDK that can be used in any application that contains that reusable code. I have started by creating an npm, bower, and component.json so that it can be eas...
I am programming a game engine as a hobby project, and I would like to separate physics and drawing into two separate threads. The position vectors of entities are subject to modifications by the physics thread, while the drawing thread only requires read access. In pseudocode: Physics thread: loop ... ...
This is more of a theoretical question. If jvm is implemented in go which itself is a garbage collected language, then does that jvm need a separate garbage collector to be implemented for its own operation?
Does comparison of floating point numbers takes (considerably) longer time than comparison of Integers in C? I just wrote a C program of heap sort to sort floating point numbers. I am on ubuntu 14.04 and I used time command to check the time taken by this program for sorting 50, 5000 and 50000 random numbers and then I...
I've been trying to learn more about generics, and I finally felt that I ran into a situation that it would be more useful to use it instead of only regular classes. Would the following be a practical use of generics? A spaceship has hardpoints that can equip only certain types of equipment. The equip function has code...
I am fairly new to OO design and have problems with the design of some software and looking for a pattern or a combination of patterns that could help me solving my problem. I have a type that has a collection of different geometric shapes (say lines, rectangles, and cubes). I actually even have composites of these sha...
Note: Even though this contains Python, it's not specifically about Python. It's more generally about expecting a certain behaviour from a language which is not necessarily the same across compilers/interpreters. So I came across this question: How do I convert a boolean to int in Python? Can I just do int(mybool)? ...
My workplace mostly uses C# for writing code. I'm trying to figure out a good way to indicate that a class with referentially transparent methods is intended to be referentially transparent (i.e., given the same set of arguments, you will always get the same return value) for future maintainers. I've considered just us...
I'm fairly new to MVC and I'm trying to get a better understanding of it. There is endless information about the theory and general responsibilities of each part of an MVC app, which I've read a good deal of, but I find myself constantly second guessing my implementation. I currently have my application setup where my ...
An app I'm working on is designed with MVC. The components often interacts with each other by passing int constants, which then have to be interpreted with if statements. I'm wondering if this is considered bad OO design. (Not specifically with MVC, but in general). For example: When the user clicks a specific button, ...
I am currently developing a web application for my thesis.I was asked by my professor to make diagrams to describe the business logic. Since I don't have a prior experience, I am pretty confused with all the terminology. I managed to clarify,I think, what business rules and business logic are, but I can't find out how...
Given 2 strings s1 and s2, if I do a simple equality check , it is considered to be O(n) when calculating algorithm efficiency. So, if I am using a brute force approach for the rotated substring question the efficiency is O(n^2) (take the 2nd substring, rotate by 1 and check. Repeat till rotations = strlen or matched) ...
I am using Android's internal storage to hold data for my application and I am trying to find a good way to handle reading data of an older schema. For example, let's say I have serialized and written several instances of class Data to a file public class Data{ private String text; public Data(text){ th...
I'm a fairly experienced desktop .NET developer with a solid feel for MVVM and WPF, and I've worked with JavaScript, jQuery and HTML/CSS in the past - though I'm pretty dated and haven't had a ton of experience with the new frameworks (Angular, et al). My question is, for anyone who has had to do it, what are the key p...
Closely related to: https://softwareengineering.stackexchange.com/q/45447/48651 I asked a question on SO and it led me to ask this here. If I'm faced with a choice of having a circular reference or just not enforcing the restraint, which is the better choice? In my particular case I have customers and addresses. I want...
Update: Most answers are about how to write a wrapping interface or what is a good wrapper around ADO. but my question is more about when to do so and when not. I never found a good rule for deciding when to write a wrapper and when not. As nobody came up with a suggestion I think the reviewers are right in that this q...
I'm thinking of building a website using mustache.js to render the website and having PHP as the backend. The PHP will then mainly contain queries to the database and some SESSION checkings. Previously I've used plain PHP to render the frontend but it gets way too messy. An example of what I'm thinking: HTML File <ht...
I read about CI/CD, loved it, but I'm having trouble with the details as everything I read was high level. Some authors seemed to suggest that there couldn't be any failing commits on the repository (or master branch?), so a programmer that is delivering bad code would be stopped and he wouldn't be able to create a big...
Say I have this code: if ($this->ship == "e") { $this->price->addLine($this->price->base * $this->price->e, 0, "Export"); $this->price->total += $this->price->base * $this->price->e; } elseif ($this->ship == "d") { $this->price->addLine($this->price->base * $this->pr...
I'm just starting to learn about DDD, and I'm trying to understand how Bounded Contexts can be reconciled with client facing API's like REST/WebServices that use DTO's. For example: your system exposes it's API to the public with a standard WebService, with CRUD style operations for DTO objects with many fields define...
I've been interested in uniqueness types as an alternative to monads in pure functional languages for some time; unfortunately, this is kind of an esoteric area of CS research and online resources about programming with uniqueness types are few and far between. It's obvious how uniqueness types may be used to implement...
I know I have quite frequently heard that C typically has a performance advantage over C++. I didn't really think anything else of it until I realized that MSVC doesn't even seem to support the newest standard of C, but the newest it supports it C99 (as far as I know). I was planning on writing a library with some code...
This is about the third time I've had to write software to control a cellular modem. For those unfamiliar with the process, you have a sequence of steps you have to take. Each step takes a certain amount of time, and there's a few responses you should receive in that amount of time. There are also some responses you...
I've been a C# developer for long time, focused on ASP MVC the most. Two years ago, basiclly due to the lower costs and ease of deployment/management I began to migrate my projects to linux using Node.js for serving HTML and Mono for all the backend operations. They talk to each other using HTTP REST API. As my skills ...
If I use Spring Data Neo4j to develop a software, and I want to publish it for commercial use with charging, does there exist any license issue? I survey many posts about the license issue of Neo4j and Spring Data Neo4j. It seems Neo4j has two versions, community and enterprise, respectively. The Community version is G...
For reference, I am a JavaScript developer learning C++. The browser is a pretty powerful debugger, and I can easily place a breakpoint in my code, hover over a variable or expression and get the value of that expression. Is this even possible in C++ or am I in a different world entirely? I'm starting to write a bit of...
If a Square is a type of Rectangle, than why can't a Square inherit from a Rectangle? Or why is it a bad design? I have heard people say: If you made Square derive from Rectangle, then a Square should be usable anywhere you expect a rectangle What is the problem here? And why would Square be usable anywhere you exp...
Whether or not a value is null could be checked implicitly like this: assertThat(value).isEqualTo("something"); Or it could be checked explicitly: assertThat(value).isNotNull(); assertThat(value).isEqualTo("something"); The latter makes the expectations a bit more clear, but it blows up the test code. Is there a good...
Suppose that there are two class 'A' and 'B' 'A' has a lot of nested conditions that have all unit test covered. 'B' has a property that will call class 'A' and return value according to the result of class 'A' On class 'B', when i want to write unit test. Should i just mock class A and verify on class B that it has be...
I have a table which stores user information, one column stores their ID. I had implemented four different attributes in the same table which stored a bit indicating which file operations that user could perform (read, create, update, delete). Thankfully, I realized that was terrible implementation and instead created ...
I'm modelling part of a software architecture on which several processes run as a workflow. The architecture involves data parallelism, where a certain serial process produces N pieces of data which need to be distributed to N processes that must run in parallel. I'm looking for a good way of expressing parallelism in ...
I'm writing a web service for some physical visualizations of data we are collecting and showing as part of a project we are running locally http://tenisonroad.com/ Some of the visualizations will be screen based and some will be physical (e.g. page 25 of this presentation from Resonate 2014). One thing my web service ...
I work on a Java project with a suggested structure (separate src folders for java files and resource files). After moving the message / text related properties files to that folder, the externalize strings mechanism in Eclipse does not work as before. Usually when hovering over the key string in a getString("") call, ...
I wrote some code about two years ago, which was deployed to the production environment. The code deletes information that is six years old from a system. When it was first deployed there were only 300 records deleted (because only 300 were six years old). Now there are now 10,000 - 10,000 records become six years ol...
This question is about what methodology to follow when evaluating one or more PHP frameworks to see which one would suit the needs of my project best. In other words, given the time pressures that every developer faces, what concrete steps can I take to assess one or more PHP frameworks without having to go to the ext...
I've just written a unit test for this function, which loops through a collection of dates and sets properties equal to true or false depending on whether they're before or after a given comparison date: public void CheckHistory(int months) { var endDate = DateTime.Today.AddMonths(months); Dictionary<Order, boo...
I have been having a discussion with a colleague about the best way to organize a (C#)project after he reorganized a project I had been working on from something that looked like this: To something that looks like this: I tend to sway towards having a few big projects as opposed to many smaller projects, but I am ope...
It feels like it is not enough for working programmers just to "walk" 5 to 8 hours a day, and "quick walk" is not enough, but they have to "sprint", every day, year after year. For the company, it makes a lot of sense because to get the most out of workers, sprinting all day long, day after day is better than people w...
I've written a program to control a bluetooth device. I'm trying to test cases when the bluetooth disconnects, i.e. if its out of range. Physically taking the device out of range is one possibility, but its quite cumbersome and I have to go outside my office to achieve this. What can I do to trigger a disconnection? Is...
I'm having difficulty grasping how to structure/architect a canvas application using an MVC like approach in Javascript. UI will be fairly fluid and animated, the games fairly simplistic but with heavy emphasis on tweening and animation. I get how MVC works in principle but not in practice. I've googled the buggery out...
I have a similar question to this, but not quite the same. I would like for the user of my app to install it with whatever dependencies are needed for the way he would want to use it. So, for example, if they want to persist to MongoDB, then only Mongo-related libraries will be installed, but if they want to persist to...
I am starting with AngularJS. The back end will be Web API (which is new to me as well) and I'd like to use just one IDE, so I'm trying to figure out how to setup a project in Visual Studio 2013 for AngularJS. I'd like to keep it as a separate project, to keep it loosely coupled to the API (or keep the UI decoupled fr...
In the company I work for there is a requirement that all the code should be covered by a test of any kind because they want to have as few user reported defects as possible. With this is mind I decided to put a policy that the code should be unit tested to C0 (100% coverage of each line, not each condition). Now other...
Scenario This was a project that I once had to maintain. After reading Working Effectively with Legacy Code, I started to think how I would refactor this system in a live environment, if I had to (thankfully, I didn't). The system was a legacy system without documentation and extremely tightly coupled. Database relatio...
My understanding is that a Daily Scrum meeting should be very quick, hosted in a friendly way and that it requires all the team members present. Because it is objective is to have everyone up to date with what everybody else is doing. I like Scrum Daily Meetings that are held like that. In my latest project our Daily ...
How must i change the Standard Implemplementation of the Serpent Algorithm that i can use it with the javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream? I must implement/extends the Cipher class and when i do it, what must i change? The Original Implementation of the Serpent Algorithm is here http://www...
I am in a situation where I have a Web Application (WAR) that is accessing a REST service provided by another application. The REST service uses Basic HTTP Authentication. So that means the application calling the REST service needs to store user credentials somehow. To further complicate things, this is an enterprise,...
Often when I design a program with MVC, the controller is useless half of the time. What I mean is this: something happens on the view (e.g. a button click). The view then notifies the controller. The controller then directly delegates to the model and does nothing else because it has nothing to do. For example: User p...
I've just spent hours debugging some code because I forgot (actually never considered it) that TextView.getText() returns CharSequence that may be in fact a mutable class... Shouldn't it return (immutable) String instead? I mean I can't imagine a situation when you want to share a state with a text field, at least not ...
To design in such that it is easy to deploy dependencies with your app, and so that development environments are easy to set up, it is advantageous to isolate an app's dependencies from it's environment. That means the app can get its dependencies from a package manager, and it will not be affected by it's deployment e...
I have been assigned to audit third-party dependencies for one of my company's products to make sure we aren't in danger of running afoul of any licenses. This is probably a job for a lawyer, but such is life when you work at a small company. At my company, we are using CS2J, an open-source project, to translate C# to ...
As I am currently struggling with learning WCF for a project at work, for the past several days I have been looking at online tutorials and examples on the best way to make a WCF client; and today, when I told my boss I was having a hard time finding good tutorials because some of them would not go into details with th...
I have just been working on a new project and doing things the same way I have for years now. However for the first time, I am constantly thinking about scalability and performance of both the application code and the database. So in times past, I have been more than happy to insert a new row, then grab the last_insert...
I don't know what to call this question. This is my example: foreach (var item in lstItem.Where(item => stock.ItemCode == item.ItemCode)) { stock.ItemName = item.ItemName; stock.ItemUnitName = item.ItemUnitName; stock.BrandName = item.BrandName; stock.FamilyName = item.FamilyName; } or // Assume l...
My application generates text files that need to be synced with remote servers, which may be windows or linux. Sync has to happen without user's intervention. I tried with rsync but windows doesn't come with rsync by default. Also it is not possible to supply password in the command line for rsync. Currently I'm going ...
I've got a route that contains objects. Each one has value 0 or 1. I need unique route ID which will identify any objects order. Currently I'm doing it using binary number that is converted to decimal (see picture). The problem is, that amount of objects in route is up to 15. So, decimal number will be very big (up...
I'm developing a application based on two technologies: ASP.net (SharePoint) and JavaScript. I use server-side code for retrieve data from database and manipulate it whereas I use client-side code for build front-end(I'm using JSON format). I have very problem with this "architecture" because ASP.net is strong-type whe...
Are there any industry standards or best practises on how to manage a rapidly changing code base? The types of applications I am developing always have a custom aspect to them. So there will always be some code written which is client specific for every project. The method we are using now is as follows: Several 'CORE...
This is probably a damn fool question, for which I apologise, but I can't seem to get the google syntax right to find an answer. Imagine a Property, like this: private int _type public int Type { get { return _type; } set { _type = value; //raise an event in your chosen language or tech ...
Suppose I have MyClass with a very simple dependency. It uses constructor injection. public class MyClass : IMyClass { private IA A; public MyClass(IA a) { A = a; } } This code get shipped and some other developers are using it. At some point in the future I need to add in a second dependency...
I got into a debate on this question which distilled to if it is a good idea for a specialization of a class to add business rules. Unfortunately this point got trampled in the comments so I'm asking it again as a separate question. I believe two things: An object is responsible for its internal consistency A speciali...
Please consider a program, where the user chooses an algorithm from a list, and the Strategy pattern is utilized to set this algorithm as the model's operation. For example, an image procession application. There are a number of algorithms that can be used to manipulate an image (darken, brighten, contrast, etc). They ...
So I'm a little concerned about my error handling... Currently my execution path looks something like this: Users.aspx -> App_Code/User.cs -> Data Layer/User.cs So now when I try to update a user record, I put my Try/Catch block in the event handler and ensure that only the App_Code class interacts with the data laye...
If you have a menu "Admin tasks" and different admin tasks (like 10) that you could separately assign to each user, but there are users who don't have any admin tasks, how would you deal with "Hiding admin menu" for those users? I was thinking of 3 ways: 1) Javascript, check if Admin menu is empty and then hide it. 2)...
I'm coming from a winforms background and trying to get ahold of MVVM and XAML. Right now I'm wondering how I can take advantage from a data-shaping control (either native or provided by a third party) while maintaining separation of concerns intact. An example: I have a typical third party grid that comes with data gr...
Our team consits of junior and senior developers. Problem I am facing is with the code written by seniors. They are not following MINIMUM coding standards. I am also still learning but I wouldn't declare the inline style or give improper names for variables and controls. I tried to mention it indirectly but they were l...
Note: there is a similar question that addresses my subject: Better style for member variables? ... but that question does not address "dealing with large legacy code base and comprehension of functions that grew too large". I am looking for confirmation or rejection of whether my situation warrants it to be a is a ...
Is boxing of primitives required in OO languages to keep them consistent with the rest of the object system (generics etc.)? Or is it avoidable - is it possible to avoid any additional performance cost of having both primitives and objects in a language? One solution I can come up on the spot is having references big e...
I'm working on a Github repo called Designemplate at https://github.com/benwatkinsart/Designemplate and was thinking of developing some example uses of the CSS file to show how it's used. Should I use a branch called examples and store them there?
I'm creating a website where trust is a big issue, I want to prove by making it open source I actually do what I claim. Question 1. If I make my source code open, how can I prove the actual website runs on this code? But I also have a dilemma, it is a commercial project and I don't want others to run off with it and cl...
Testing code for correctness is important. Whether you do strict TDD or not, tests are really the only way a project can scale in size beyond a point where every team member can reasonably keep all the code knowledge loaded in their brains at once. After that point, tests are imperative in order to ensure future mod...
I'm with an org that is trying to transition to Agile. One thing that I've been struggling with is what they call user stories. In my experience, a user story would be this: Use should be able to accomplish task x using tool y During the sprint, we'd then design a solution to enable this. However, this is what we're...
I wrote a program with Java that plays simple music. Currently chords have only one way ('strumming pattern') to be played. I want to expand this and create different 'strumming patterns' that chords can use to play their notes. The Chord class has a play() method that is responsible for playing the chord. Currently it...
When I've written tests for some code and want to make sure that it's actually testing what it's supposed to, I'll mess up or remove the code-under-test, and see if the tests fail. If they don't, I've got a problem. Is there a name for this technique? It's a real bother having to talk in sentences everytime I want to s...
Category theory has applications in theoretical computer science and obviously is central to abstract mathematics. I have heard that it also has direct practical applications in programming and software development. What type of programming is practical category theory necessary for? What do programmers use category t...
I have an excel sheet which has a large amount of data. I am using php to insert the data into mysql server. I have two problems 1) I have to update a row if the id already exists, else insert the data. 2) BIG PROBLEM : I have more than 40,000 rows and the time out on the sql server which is set by the admin is 60 sec...
What is the best way to track any change made to the SQL Server database before moving to production in case of a large team ? We have used excel sheets but quite often things get missed which come out with SQL compare only during moving changes to production?
At the office we just got a new colleague who is visually impaired. I'm in charge of organizing the planning poker sessions and the new colleague must participate as a member of the team. We have these nice sets of poker cards with planning poker numbers on them, but that doesn't help of course for our new colleague. ...