instruction
stringlengths
34
19.9k
I work on projects which are usually of a duration, not more than 3 months. Recently there has been a discussion about the use of JUnit in the projects. There are activities being planned related to that and, there could possibly be some kind of training too. But I was wondering whether it is a good idea to use JUnit f...
The principle is defined as modules having one reason to change. My question is, surely these reasons to change are not known until the code actually starts to change?? Pretty much every piece of code has numerous reasons why it could possibly change but surely attempting to anticipate all of these and design your code...
Trying to convert some entities into value objects I am stuck in a case where what seems a value object must be unique within an aggregate. Suppose we have a Movie entity which makes the root of an aggregate. This Movie entity is related with some set of AdvertisementEvent objects with the role of displaying an adverti...
I'm currently on a project, which integrates domain specific techniques in the modelling tool Enterprise Architect through UML Profiles. The domain specfic model almost matches the structure of the composite structure model, with a couple of restrictions though, so I'm trying to use the model as a foundation for my res...
If you are working on something new you have less than the required time to do it, and sometimes you are expected to work late, weekends etc (even when you are waiting on people who are not working those hours). I even had a boss once who came by and told me to make sure I had something to do on Saturday. This seems to...
We are working in a Visual Studio Environment using TFS. When developers get the latest source code it includes a copy of the 'update' sql scripts for the database of the application. The challenge is keeping our local copies of the DB up to date. When changes are made to the DB by another developer, we are looking f...
I write a lot of javascript applications and in many different circumstances the browser will become unresponsive or give a "slow script" error. Even when following best practices, initializing large data sets, complex animation, or when too many event handlers fire at once, I have to include extra setTimeouts or reque...
I'm designing my own programming language for fun, and I'm thinking of making it fully Object-oriented (no statics, no globals, no class variables, no class methods), so I need to find a way to completely eliminate the needs of class methods, but, first, I need to make sure that I know all the problems that could only ...
Is a grid or p2p architecture a subset of a broker architecture? what are the key features that make these similar or distinct?
In an attempt to write some generic code I find myself putting, in my abstract class, a method that returns some static information about how the class should be treated. This method doesn't use any state data and would be static, except that static abstract methods aren't allowed. Is this a code smell? is there som...
I have a simple domain with about 6 objects in the model. For the most part they have a clear child/parent relationship with parent having multuple children. I'm going to have all of them be immutable. However, at some point I'll need to both fetch a set of all objects of a given type, and be able to fetch a specifi...
We've all been there - a product feature is called "gold", and then a week before launch they decide it is to be called "platinum". Luckily, you had some nous about you so the UI code is easy to change. But...what about all the variables and methods? Sure, you could change all these but what about the testing time? Obv...
So I went to a job interview today. Long story short, the interviewers were delighted with my knowledge and experience, they were practically showing me to my new desk. Needless to say, what delighted them was a factual and unexaggerated description of things that I've actually worked on. But then suddenly, as I was ge...
class Boxer: def punch(self, punching_bag, strength): punching_bag.punch(strength) class PunchingBag: def punch(self, strength): print "Punching bag punched with strength", strength boxer = Boxer() punching_bag = PunchingBag() boxer.punch(punching_bag, 2) No doubts that punch is a good me...
I am taking an introductory course on python and the instructor says that python is a high level language and C and C++ are low level languages. It's just confusing. I thought that C, C++, Python, Java, etc were all high level languages. I was reading questions at stackoverflow on C, C++, etc and they all seem to refe...
Here's a question that's always bugged me. I'm going to use java as an example because I've almost never run into a problem in java where I didn't need to use helper methods in its class structure. Let's say I have a method that does a thing or two and then calls a helper method: public void doStuff() { int x = 4;...
Essentially it is a branch of software engineering but SE itself is too large an umbrella. I was curious if there was a title for the knowledge base that encompasses TDD, BDD, mocks/stubs/spys, unit tests vs. integration tests, code coverage, etc.
I need to validate some form inputs in complex way. E.g. <select id="options" multiple="multiple"> <option>A</option> <option>B</option> <option>C</option> <option>D</option> <option>E</option> </select> For example, if user selects A and B, user should be given an error if user also selects D. Note, I'm...
It seems to me that instanceof comes from the land of functional programming and is a watered down version of pattern matching and that the OO altenative to it should be dynamic dispatching. In OO languages (think Ruby), is there any situation where instanceof is the only solution? I can't think of any myself, especial...
I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned. For example: array[]={23,17,9,45,78,2,4,6,90,1}; query(both inclusive): 2 6 answer: 78 Which algorithm or data structure do I construct to quickly retrieve maximum value from any range. (There ...
Why a single page application is a desktop client replacement why should I show certain url`s in the url bar of the browser. Why is mysite.com not enough. My question to you guys is now: What are the reasons and advantages for the user to show such an url like mysite.com/customers/3 Are there any reasons like the user ...
Most people say do not use JSPs. But what if I have a JSP that does not show anything, it only acts as a controller? Why would I do that? Because we do not need to redeploy complete webapp to make a small but significant change in a servlet -> instead can just put my new JSP in the JBoss tmp folder till we do a full de...
Note: I know that none of you (probably) work for google, so this is a lot more of a conceptual question. So yeah, i discovered that Gmail uses java and that got me thinking, Why? I personally never really learned java and am familiar with C/C++, Python, Php e.t.c But what i dont understand is why do some websites use ...
Well it's a problem me and my friend had thought of, and well, haven't come up with anything to solve the following problem(I'll try to phrase it in the best way I can): Given that there are n number of teams, and the number of matches each team has played, and that no team can play more than 2 matches with any other ...
Is it really necessary to differentiate between code and data ? Is there any language where such differentiation is not there ?
My coworker and I are arguing very hard about this topic. He's thinking that every single class should have an Interface that the class implements (also Single-Implementations). He uses this design for documentation principles. In my mind that is obsolete because in Java you can comment on implementations, too. I think...
I heard almost all parts of Windows are written in C and C++ with some assembly. Why did Microsoft skip C#? Is there any scope for C# in the development of future Windows versions?
As far as I know Linus holds the copyright to Linux. While looking around in the kernel sources, I see that almost every file has it's own copyright holders. For example the file module.c in the Linux kernel contains: Copyright (C) 2002 Richard Henderson Copyright (C) 2001 Rusty Russell, 2002, 2010 Rusty And the COPYI...
I am wondering... Recently I have observed github; I saw many Java projects' codes which don't have copyright at their headers... I mean, as I may guess, in this case the only thing which can prove the code author is - it is author's github account; So my question is... is it safe to protect open source code with githu...
I thought it would be very useful if there is an embedded application development tool like Visual Studio for web development. I mean when we develop web applications we have a toolbox and we drag and drop components and generally use events. In embedded systems events are interrupts. So why don't we have a toolbox whi...
Are there any obvious flaws to this OO architectural model which I intend to implement using javascript? It is similar to the MVP model but instead the role of the model is broken down into three modules: the cache (stores data instead of rerequesting from server) the model (manages requests for raw data, retrieving i...
I am a sole developer working with an offshore employer. I do realize the importance of unit testing (although haven't practiced before) but currently, the code hasn't ever been tested. The problem with the code is that it isn't what I call "been moduled well", some parts are really messy, extensive use of globals and ...
Well in my book it is says that "there are non-decidable languages" And the proof is: Every algorithm is a word. Then there are only countable algorithms. But there are uncountable languages and therefore more than algorithms Why is it said that every algorithm is a word? A word is a concatenation of symbols, element...
In divide and conquer algorithms such as quicksort and mergesort, the input is usually (at least in introductory texts) split in two, and the two smaller data sets are then dealt with recursively. It does make sense to me that this makes it faster to solve a problem if the two halves takes less than half the work of de...
Some pseudo code or resources will be appreciated.I was thinking if implementing it in form of a BST stored in an array. However,not all operations can be performed easily using this approach. I am open to using STL's for this purpose as well.My main purpose is to implement it in the simplest manner possible.
I'm currenetly struggling with choosing how to proceed as a programmer. I mainly programmed games and would like to continue. And for about 5 years or so I just used C++ and OpenGL, so I spent a lot of time on infrastructure, strange bugs, and mostly getting basic things to work. A friend of mine then recommended pytho...
I am developing an application which will handle many virtual stores and I would like to have many themes that the user could choose anytime. I would to know what's the main ideia to implement it. I will be developing it using Symfony 2. I was thinking about implementing own views and assets for each theme Resources ...
So I'm a relatively junior programmer, been doing it for a couple years now and have been recently working on a redo of the company's website, and have ran into some frustrations and was just wondering if that's the way it goes or if I'm missing something. I am by no means a designer, I focus on the code and don't pay ...
I have an open source project that is licensed under the GNU General Public License v3 and it's done in Windows Presentation Foundation. I came across someone that sells themes/skins for WPF projects and he is willing to donate one of the skins for use with open source project. However, he only wants the skin to be all...
I have a java program which listens on a port for input. Based on Input, it calls a webservice and then returns a success/failure back to the client program. I fork a thread for each client connection. The response back to the client which connects to the program has to be quick. These are the choices I am considering ...
I am working as a software engineer turned team leader in a large software company. One of my areas of strength is node.js, and we are in the process of moving a lot of our services to separate node.js services, which is proving to be very successful so far. However, I am supposed to stop day to day development of sma...
I'm reviewing my notes on Kruskal's algorithm and have a question about getting the runtime down to O(E lg V). By using a PQ with edges and a boolean array of which vertices we have added to our tree T, the running time is O(E lg E), but in my notes there is also a variant with running time O(E lg V), by using a PQ wit...
I have an application that consists of a set of Java and C++ of processes running on one or more systems and need to ability to monitor and control the components as if they were one complete system. My requirements: runtime statistics (messages per second etc..) log of events control: "service X set rate to 1000 mps"...
I usually feel reluctant to use any third party or open source controls while coding in Objective-C iPhone due to following reasons. Open source controls are developed in incremental manner. So once integrated I have to keep looking for update and will have to update my code. Will increase effort. Open source controls...
I am working, with a co-author, on a data modeling toolbox that will someday be sold. Part of the functionality is the extremely common PCA, which we are doing in a more robust way. Thus, we need a PCA function that has the usual algorithm with some modifications. For non-commercial peer-review academic research, I cou...
I have a rather odd problem. I love the practicality of PHP - specifically that I can fairly safely assume that on any random server I'll have access to the MySQL libraries, and that I can go between PHP/HTML with <? and ?>. That said, I find the language atrocious - Ruby and Python are considerably more expressive, ye...
In refactoring a lot of MVC code, I have run into an issue with my URL design. For example, let's say we have a Venue object public class Venue { public long ID { get; set; } public List<Event> Events { get; set; } } and an Event object public class Event { public long ID { get; set; } public Venue V...
It's a common issue to see a company's sales team promise new features in order to close a sale. Many times these new features are still in development or are still being designed. Sometimes features are sold before the development team even knows about them. If the customer understands the features are not yet impleme...
I am reading "Javascript : The good Parts" to improve my Javascript bases and knowledge. I was reading stuff about prototype and I encountered in this function : var stooge = { ... } if(typeof Object.create !== 'function'){ Object.create = function(o) { var F = function () {}; F.prototype = o; return new ...
Is there a guide out there on how to choose when to pay for web hosting vs. hosting your own? Assuming that root access is a must I would like to compare things like cost, scalability and personal stress. Here is what I could come up with. Paying for web hosting: Benefits: Much cheaper for a small scale. I assume any...
Given that we do not know the encoding of a string what is the best way to make sure that it is transformed to say ASCII? Also in such situations we are willing to accept potential loss of data.
How do I include the copyright/license for a library if I use on 1 function? Say if I have a class that I have taking 1 function from another library: class MyClass { ... public function someOtherLibrariesFunction() {} } And the at the top of the file I took the function from it says: /* * This file is part o...
I have been working freelance for a few years, and before that I worked as an entry-level coder for a non-technical company. I "understand" how delegates, and MVC, and how to make an app and make it work, but I have done a few interviews recently and they are throwing questions at me that I don't know the answers to. T...
I developed a pretty big website. I tested it myself to the best of my ability, but I cannot test all scenarios that my users may run in to. I found a testing team in India, but they don't seem to have any systematic approach to testing website functionality. They test each individual page rather than the full process ...
I am new to Clojure. I can understand the code I write but it becomes too difficult to understand it later.It becomes difficult to match parentheses. What are the generic conventions to follow regarding naming conventions andindentation in various situations? For example I wrote a sample de-structuring example to under...
I started reading some tutorials about OOP, because I want to learn the basics. I have a question about it. I understand how you can have a object "Car" and give it a color like this $oCar->setColor("white"); But there are some things unclear to me. Let's say I have a database with all kinds of cars. What is the best ...
This is part of a series of questions which focuses on the sister project to the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. The sister project is called OILexer, which aims to construct a parser from grammar files, without the use of code injection on ...
I wrote a comparator for a custom class of mine and when I ran my code I realised the output of my list of these objects was in the reverse order as to what I wanted. It was "ascending" as opposed to "descending". This was because I stuck to the spec of compare where a return value of less than 0 means the other object...
I've extracted interfaces from my repository classes, like ICustomerRepository, IProductRepository and so on. The project which contains the repositories is named X.DataAccessLayer. Should I call the project with the interfaces X.DataAccessLayerInterfaces, or what is better? And I definitely have to keep the interfaces...
Do you write your code then optimise it? Or do you write an optimised code from the beginning. I always believe in writing optimised since I really dont like to rewrite code, But please share your thoughts.
I use eclipse for coding, and the language which we use is Java. Once it was suggested by someone that to properly format the code, using the auto formatter(CTRL+SHIFT+F) While this command does format the code, but sometimes I feel that overall look becomes weird, and it is not actually very readable. So is this a rec...
This is in summary the TDD method: Write a test check if thes test fails write production code run test I think that TDD as presented works only in ideal circumstances. I'll take a simple example: Specification: Write a program that calculates the square root of a number, the user must enter a number. If the number...
I have a large project with a driver part and about 5 libraries doing various associated tasks. Many of the libraries require access to 'global' configuration data which is read from a database at startup by the driver code. By driver I just mean the part which contains the main function. My idea on how to handle thi...
I have an application, where font size, font type, color, background color, image and a lot of things change based on theme. I realised in the beginning itself that using enums to denote themes and then checking the theme everywhere was a horrible mistake. So I have two approaches now and I am confused which one to go ...
I've created an app that has some sound file that I've downloaded from Macloops. The user can only listen these sound files (he can't create any new sound files using them) with the app. Now, I want to distribute the app over the internet and I'd like to know if I can do this legally. I've only found the following the ...
I am currently reading a draft of the C11 specification. The new introduced keywords: _Bool, _Alignof, _Atomic all feel like custom extensions, instead of standard reserved keywords like struct, union, int. I realize that the standard basically consists of standardized extensions ... but still, this is awful! Maybe we ...
My team is just getting started integrating agile practices (we've chosen kanban) into our dev, test and design teams, but we have a lot of bug cases and feature cases not written in user stories left over from the old system and we're trying to find a good way to take care of the bugs but still keep the devs that need...
I currently have four projects in my website's solution: Project.Data This holds the EntityFramework DbContext object and also the Repositories that interact with it. It references Project.Models. Project.Models This holds the business objects and doesn't reference any other project Project.Web This holds all ViewModel...
I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the parsed data (the DTO has fields in the like of name, birthdate, id...) So, my question is, what is the best practice: Parsi...
I am developing a web application based on a proprietary (but free) JavaScript API. My company is considering releasing our application as "Open Source", but we are unsure of the different licensing options and how they will work considering we are using a third-party proprietary API. Can anyone help me with the follow...
I am test-driving a method that is to generate a collection of data objects. I want to verify that the properties of the objects are being set correctly. Some of the properties will be set to the same thing; others will be set to a value which is dependent on their position in the collection. The natural way to do this...
I'm jumping back into ASP.NET development after spending the past 7 years playing manager, dba, and winforms developer. I've dabbled with a few things web related, primarily maintenance of existing webforms apps, but I haven't done anything with newer technologies. My, how things have changed! After watching a lot of...
I am trying to convert decimals, (0.05, -0.28, 25.00, etc), to a 17-bit 2's complement Signed Number. The parameter data I am sending is SysEX Midi Data (to some external Synthesizer). The data parameters are composed of 3 bytes. For example, the example given is as follows: The parameter data to set the value to ...
I was looking over the evolutionary history of Unix and Unix-like systems on Wikipedia and one operating system name stood out to me: OpenServer. Judging from the image, SCO's OpenServer is completely closed sourced; so why does SCO OpenServer have the word "open" in its name if the operating system is proprietary and ...
I see all the examples that demonstrate unit testing code and mocking the calls to the DB since you are not suppose to touch the DB. But it seems to me having a set up tasks that uses the actually schema, loads the lookup tables and then populates it with data using the methods to be tested... This way it is more real ...
Recently, it was suggested that many projects (where I work) should be implemented using some combination of stored procedures (on SQL Sever / T-SQL), SSIS, and SSRS. In one specific project, SSIS would get a file from a SFTP server. The file contains the daily price of ten stocks. A data warehouse will store the dail...
I've started to work with web development using PHP as server side programming language. In that time I didn't know the benefits of object orientation and had a hard time trying to write more maintainable code (for instance, spliting presentation from logic, and etc). After some years I knew about ASP.NET MVC and I gav...
In the Go Language Tutorial, they explain how interfaces work: Go does not have classes. However, you can define methods on struct types. The method receiver appears in its own argument list between the func keyword and the method name. type Vertex struct { X, Y float64 } func (v *Vertex) Abs() float64 { re...
I just came across the article "Rule of Three" in wikipedia Rule of three is a code refactoring rule of thumb to decide when a replicated piece of code should be replaced by a new procedure. It states that the code can be copied once, but that when the same code is used three times, it should be extracted into a...
I'm using iPage as my cloud based server provider. I haven't had any problems with them yet. They hold the scripts for my RESTful services for the mobile app I'm developing. My problem however is that tonight the service went down. I got a "This is a 500" error. I'm wondering how do I build redundancy into my RES...
What is the time complexity of the algorithm to check if a number is prime? This is the algorithm : bool isPrime (int number) { if (number < 2) return false; if (number == 2) return true; if (number % 2 == 0) return false; for (int i=3; (i*i) <= number; i+=2) { if (number % i == 0 ) return fal...
At projects.eclipse.org Mylyn Build 1.1.0 is slated for June 2013. At www.eclipse.org/mylyn The "news" says Mylyn 3.8.3 was released on March 1st. Why is there little or no correlation between the two?
I have a sparse matrix that contains several islands of unknown size. I would like to find the highest peak of each islands. Consider this matrix as an example: 0 0 1 0 0 0 0 0 0 1 2 1 0 0 0 0 0 3 2 1 0 0 1 0 0 0 0 0 0 2 3 4 0 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 In this case I would like to get the position of 3 at (3, 2)...
Background: I'm an apprentice and am handling the project of developing a particular IS-System. Currently I'm only managing the requirements analysis and the information-processes design, but as a Software Developer, I would also like to implement the concept as an actual Web-Portal. When it comes to choice of technolo...
Hopefully this question will be a good suit for P.SE since it is a whiteboard-level 'how can this be done' conceptual question. I'm trying to build a product that needs to be available to someone on the move with a mobile device when their connection may be quite poor (due to travelling between cities where 3G coverage...
We were trying to figure out the optimal sprint length for our project. After working on a 3-weeks basis we thought that cutting the sprint to 2-weeks would provide better velocity. The advantages were clear - shorter feedback loop, small stories (with user value) and so on. On the other hand, there are a lot of disadv...
So as a general rule to avoid a stack overflow, big objects should be allocated to the heap (correct me if I am wrong). But, since the heap and the stack expand towards each other, wouldn't this cause heap overflow or alternatively limit the space for the stack and higher the chances of stack overflow?
I never coded on VS and I'm a junior programmer in C# and I would like to know if the entity framework is available only for ASP .NET applications ?
Ok, I have this human here, but what can it do, how would you discover its special abilities? And when you find out what kind of expert you've got then how would you actually make use of its unique responsibilities? An example for this architectural pattern question: Base Interface with Characteristics Common to All in...
I plan to write an network application whose use steps is the following : Connect to the server and choose a name (and enter your email "id") The list of others "free" (not playing a game) players is shown to you : so you have to select one. The server use the two players ip adress in order to connect them But I thin...
Context: I was looking to see if there was a tool to do something (in my case I was looking for a proxy that would allow for http log inspection from a python test framework). There turned out to be a tool that would require only minor adjustment, and it seemed to be reasonably stable/mature, with no updates in the pas...
Different types of dependencies have particular names, such as linear dependency, circular dependency, self-referencing object, etc. What is the name of the dependency where those rules are true? A has zero or more B, B has zero or more C, and: A has zero or more C. If there is no particular name for such relatio...
I am working on adding test coverage for an application that previously didn't have any. One additional requirement that emerged is that one of the background processes should be able to process 100,000 rows at a time. I've written a unit test that ensures that the background process is able to work with the 100,000 e...
TL;DR - I'm trying to design an optimal data structure to define units within a unit of measure. A Unit of measure is essentially a value (or quantity) associated with a unit. SI Units have seven bases or dimensions. Namely: length, mass, time, electric current, temperature, amount of substance (moles), and luminous...
What I am doing is creating a DBProject.. importing a DB.. then creating scripts in the PostBuild that are DATA scripts for each table (so that the post build can populate the tables after the schema is generated.. Then problem is some of these tables containg 50,000 rows and when you put a 50,000 row insert into ONE ...
I work in a fairly large team (~15 developers) which is currently discussing our working methodology. The software we work on is quite feature-rich and expanding rapidly in terms of scope so the number of developers has increased lately and will continue to increase. At the moment the different developers have differen...
In reading this blog post about Photoshop 1.0 I was surprised to learn that it was written in Pascal (Object Pascal to be exact). But you never hear about Pascal anymore. Why is that?
This question is purely hypothetical. I use WordPress a lot and know the filter structure from an implementation point of view. I'm now wondering what's the best way to implement such a structure (not the way WordPress uses, but the best way). I will give a short overview of what the WordPress filter structure is. Aft...
I know that std::vector uses a contiguous block of memory, but I often see people use vectors of vectors, even when they modify the number of elements in these vectors contained within an outer vector. Won't this lead to efficiency problems when an inner vector need to be resized as all the following vectors will have ...
I understand services should have no state and no business logic. How can you implement a service like AuthentificationService considering these rules? All the methods in a service should be static?