How would I handle a set of differing event classes with differing handler interfaces in a single event processor?

I'm working on an event processor framework for a simple game I'm writing, in which multiple types of events are handled in a loop. Since these events carry distinct pieces of data (i.e. one carries a player and position, another carries a message and timestamp), I ended up creating different classes for them (though they still all implement a common interface, which is _currently_ a marker interface). Within my event processor, I have, for each type of event, a set of event handlers implementing a corresponding interface (e.g. anonymous class implementing `PlayerInteractHandler` that handles `PlayerInteractEvent`s). Since these interfaces are being implemented through a Javascript engine (Rhino) I am unable to use a single generic interface. In trying to implement the actual engine, I have currently code as follows (methods inlined to show idea behind code in a more compact representations):               if (recvdEvent instanceof FooEvent){         // getHandlerList() returns a List<EventHandler> due to limitations of generics         for(EventHandler eh : getHandlerList(FooHandler.class) {             FooEvent eventAfterCast = (FooEvent) recvdEvent         }     }      Obviously there are a bunch more `else if (recvdEvent instanceof BarEvent)` blocks, and I catch and handle ClassCastExceptions. The problem with this, is that it seems like a mis-use of an object-oriented language, and I have to stringently verify other code by hand to retain type safety. The other alternatives I know of are for my event to return the `Class<? extends EventHandler>` in a certain method, to use polymorphism / dynamic dispatch, but that would require a _reflective_ cast, or a polymorphic method in the handler class that would still break complete type safety (and another layer on top of the interface itself). Multiple event processors would lead to code duplication, and would imply having separate threads for each as the current event processor is designed. If I were to retain a single thread and processor I would need a single queue, whose declared type is `AbstractQueue<GameEvent>`, and I'd be back at square one. Am I approaching this in a completely incorrect manner?


How to convince a non-technical client that their application spec needs to be simplified?

Often times I am faced with the situation where a new client comes to me with an application that has literally 100s of unnecessary features and it is quite clear that things need to be drastically simplified for the project to have any chance of succeeding. How do you convince the client to take a more Minimum Viable Product (MVP) approach and simplify? edit: So the current top answer is to provide the client with a time/cost estimate for the huge application. I'm not too fond of this answer because it doesn't address the real problem with this situation. And that is - it's a bad practice to spec out a massive application and then try and build it from the get go. I feel much more comfortable initially building a small, simple MVP foundation. And then adding small features to that foundation one by one. So how do I convince the client to approach building software in this way?


Best Practice to Avoid "Playing Telephone" with Constructor Arguments

I find that the encapsulation required by OO has me frequently passing paramenters down the line from parent to child to great grandchild to second grand nephew once removed (not actually that bad). But inevitably in the process, and especially if graphics are involved there will be garbling the by the third iteration of `someConstructor(int minX, int minY, int maxX, int maxY)`. I found at least one question here suggesting that parameter objects are the solution. These seem to me more like a kludge designed to satisfy a low parameter count fetish than genuinely useful. Besides, in these scenarios, I am generally cutting the numbers into smaller pieces (of screen) with each step. It occurs to me if these constructor calls are laid out line by line higher up the chain, I'd have easy comparisons. But this seems to lose all semblance of OOPiness. In my most recent adventure with find-the-transposed-measurements, I was drawing a music keyboard. I don't want the main view to know or care what or exactly where the G# key is. So, best practices? Please don't say, go slower, be less sloppy.


Ethics of soliciting App store app reviews?

I see more than a few developers soliciting 5-star ratings and good reviews for their App store apps, in their blogs, websites, app store descriptions, even dialogs that pop-up in the app after you've used them for awhile. What do people consider to be the ethical guidelines regarding such review and ratings solicitations? What's over the line? (Besides obviously evil stuff, such as paying to have someone forge multiple negative reviews about your competitor's apps, etc.)


2 different tasks in template method

I've read about Template Method Pattern but I'm not sure about one thing. The steps (methods) of an algorithm are supposed to be in the template method. In the case my template method's algorithm is about 2 completely different tasks that I would like all my objects to perform, let's say the one is drawing and the other calculating, can I still put all these methods in one method and call this my template method?


Is Oracle WebCenter 11g equivalent to a larger version of SharePoint?

I have some experience with SharePoint. My company has decided to use Oracle WebCenter to create a internal portal. None of the IT staff have any experience with Oracle WebCenter, and I think we could use SharePoint for this job, as we have been using it until now. So, what are the advantages to using Oracle WebCenter? Which are your experiences with Oracle WebCenter 11g? And how different is it from SharePoint? What can I do with Oracle WebCenter that I cannot do with Microsoft SharePoint?


Should one use a separate database for application data and user data?

I’ve been working on a project for a little while and I’m unsure which is the better architecture. I’m interested in the consensus. The answer to me seems fairly obvious but something about it is digging at me and I can't pick out what. **The TL;DR is:** how do you handle a program with application data and user data in the same DB which needs to be able to receive updates to the application data periodically? One database for user data and one for application, or both in one? **The detailed version is..** if an application has a database which needs to maintain application data AND user data, and the user data all references application data, it feels more natural to me to store them in the same database. But if there exists a need to be able to update the application data within this database periodically, should this be stripped into two databases so that one can simply download the updated application data database file as an update and replace the old one? Or should they remain as one database, and the application data be updated via a script which inserts the new data into the existing database? The second sounds clearly preferable to me... but for some reason just doesn’t feel right, and I can't pick out quite why.


How can I work efficiently on a desktop sharing workflow?

I am a freelance Magento developer, based in Spain. One of my clients is a Germany based web development company and they're asking me something I think it's impossible. OK, maybe not impossible but definitely not a preferred way of doing things. One of their clients has a Magento Entreprise installation, which is the paid (and I think proprietary) version of Magento. Their client has **forbidden them to download the files** from his server. My client is asking me now to study one particular module of the application in order to interact with it from a custom module I'll have to develop. As they have a **read-only ssh access** to their client's server, they came up with this _solution_ : Set up a **desktop/screen sharing session** between one of their developer's station and mine, alongsides with a skype conversation. Their idea is that I'll say to the developer: > show me file foo.php The developer will then open this foo.php file in his IDE. I'll have then to ask him to show me the bar method, the parent class, etc... Remember that it's a read-only session, so forget about putting a `Zend_Debug::log()` anywhere, and don't even think about a xDebug breakpoint (they don't use any kind of debugger, sic). Their client has also **forbidden them to use any version control system**... My first reaction when they explained to me this was (and I actually did say it outloud to them): > Well, find another client. but they took it as a joke from me. I understand that in a business point of view rejecting a client is not a good practice, but I think that the condition of this assignment make it impossible to complete. At least according to my workflow. I mean, the way I work or learn a new framework/program is:   1. download all files and copy of db on my pc   2. create a git repository and a branch   3. run the application locally      * use breakpoints     * use Zend_Debug::log()   4. write the code and tests   5. commit to git repo   6. upload to (test/staging first if there is one, production if not) server I have agreed to try the desktop sharing session, although I think it will be a waste of time. On one hand I don't mind, they pay me for that time, but I know me and I don't like the sensation of loosing my time. On the other hand, I have other clients for whom I can work according to my workflow. I am about to say to them that I cannot (don't want to) do it. Well, I'll first try this desktop sharing session: maybe I'm wrong and it can actually work. But I like to consider myself as a professional, and I know that I don't know everything. So I try to keep an open mind and I am always willing to learn new stuff. So my questions are:   1. Can this desktop-sharing workflow work? What should be done in order to take the most of it?   2. Taking into account all the obstacles (geographic locations, no local, no git), is there another way for me to work on that project?


is using a PUT with side affects acceptable (REST)

I want to create an undo history whenever the user updates a form. Because it's an update, I want to use a PUT request. However, I read that PUT needs to have no side effects. Is it acceptable to use PUT here? Are there better alternatives? `PUT /person/F02E395A235`               {        time: 1234567,        fields: {           name: 'John',           age: '41'        }     }      In the server               doGet('person/:personId',        // create a new person snapshot     )      Edit: The history will be visible to the user, calling multiple times would result in multiple versions. The solution was to check if the version was unique before creating it.


Should a string constant be defined if it's only going to be used once?

We're implementing an adapter for Jaxen (an XPath library for Java) that allows us to use XPath to access the data model of our application. This is done by implementing classes which map strings (passed to us from Jaxen) into elements of our data model. We estimate we'll need around 100 classes with over 1000 string comparisons in total. I think that the best way to do this is simple if/else statements with the strings written directly into the code — rather than defining each strings as a constant. For example:               public Object getNode(String name) {         if ("name".equals(name)) {             return contact.getFullName();         } else if ("title".equals(name)) {             return contact.getTitle();         } else if ("first_name".equals(name)) {             return contact.getFirstName();         } else if ("last_name".equals(name)) {             return contact.getLastName();         ...      However I was always taught that we should not embed string values directly into code, but create string constants instead. That would look something like this:               private static final String NAME = "name";     private static final String TITLE = "title";     private static final String FIRST_NAME = "first_name";     private static final String LAST_NAME = "last_name";          public Object getNode(String name) {         if (NAME.equals(name)) {             return contact.getFullName();         } else if (TITLE.equals(name)) {             return contact.getTitle();         } else if (FIRST_NAME.equals(name)) {             return contact.getFirstName();         } else if (LAST_NAME.equals(name)) {             return contact.getLastName();         ...      In this case I think it's a bad idea. The constant will only ever be used once, in the `getNode()` method. Using the strings directly is just as easy to read and understand as using constants, and saves us writing at least a thousand lines of code. So is there any reason to define string constants for a single use? Or is it acceptable to use strings directly? * * * PS. Before anyone suggests using enums instead, we prototyped that but the enum conversion is 15 times slower than simple string comparison so it's not being considered. * * * **Conclusion:** The answers below expanded the scope of this question beyond just string constants, so I have two conclusions:   * It's probably OK to use the strings directly rather than string constants in this scenario, **but**   * There are ways to avoid using strings at all, which might be better.  So I'm going to try the wrapper technique which avoids strings completely. Unfortunately we can't use the string switch statement because we're not on Java 7 yet. Ultimately, though, I think the best answer for us is to try each technique and evaluate its performance. The reality is that if one technique is clearly faster then we'll probably choose it regardless of its beauty or adherence to convention.


System Analyst vs Computer Programmer?

My question here is relative to jobs. I currently hold a System Analyst position. What is the difference between System Analyst and Programmer/Analyst? Is this position higher than a programmer? Or how should I upgrade myself ?


Why is it preferred to write a commit message in present tense/imperative mood?

I often read/overhear that good commit messages should be written in present tense or to use imperative mood when describing the change eg. `Fix xyz` instead of `Fixed xyz`. What are the advantages of doing so? Are there differences between the various VCS (I mostly read these about git but that maybe because I mainly work with git)?


Controlling version numbers in sprints

Traditionally software build numbers fit into the format   * Major   * Minor   * Release   * Build Where a Major version is implemented whenever there are breaking changes, Minor when new mini features are added, Release when something is published and Build each time it's built. I find the last two digits work really well in a CI environment, each CI build increases the Build number and each release to live increments the Release number. However major waterfall work and breaking change developments are discouraged in more modern methodologies. We prefer to release little and often and so don't tend to make great breaking changes. Given this it's very difficult to determine when to create a new Major version. We try to avoid making major breaking changes and so are getting very high minor/release numbers but haven't had the excuse to move up a major version yet. What criteria should be used to determine when Major and Minor builds should be made (particularly web based applications)? I'm aware there are date style versioning but I'm interested in the Major.Minor.Build.Release only.


Code Analysis & Reporting: Maven vs. Jenkins

My team (~10 devs) has recently migrated to Maven (multi-module project, ca. 50 modules) and we now use Jenkins for continuous integration. As the overall setup is running, we are planning to include code analysis and reporting tools (e.g., Checkstyle and Corbertura). As far as I can see, we basically have two options to generate such reports: either use Maven's reporting plug-ins to generate a site **and/or** use Jenkins plug-ins to do the reporting. **Which approach is better, and for which reasons?** It seems both have their merits: Maven-Reporting: * everything is configured in a single place (the pom files)  * report generation on a local machine (i.e., without Jenkins) is straightforward and does not require any additional steps Jenkins-Reporting: * adjusting the reporting configuration seems more intuitive than with Maven and does not interfere with the main task of maven in our setup (building and deploying)  * a single web-interface to check the overall status of the project, so that the reported issues are easier to find and harder to ignore (i.e., no need to click through the maven site, some nice history plots, notifications, etc.) Has anyone made a similar decision in the past, or is this a non-issue for some reason? (How well does it work? Any regrets?) Is it advisable to go **both ways** , or is that setup too tedious to maintain? Are there aspects of the problem that I am unaware of, or some advantages I have not noticed (e.g., is Maven-based reporting integrated nicely with m2eclipse)? Any pitfalls or typical problems that we are likely to encounter? **EDIT:** We tried out **Sonar** , as suggested below (including its Jenkins plug-in). So far, it works pretty well. Sonar is relatively simple to install and works on top of our Maven setup (one just invokes `mvn sonar:sonar` or re-configures a Jenkins job, that's all). This means we do not have to maintain a duplicate configuration, as all our Maven settings are used automatically (the only exception being exclude patterns). The web-interface is nice, and -- even better -- there is an **Eclipse plug-in** that retrieves all issues automatically, so that no one really _has to_ browse to the Sonar website, as **all issues can be automatically displayed in the IDE**.


Can I use the patented Octree algorithm in a public programming challenge?

Similar to this question, but for a very different situation. I've been working-up some example code to accompany a proposed programming challenge and asking questions about the difficult bits. In my latest question, the answer I've received suggests that I use an Octree instead of a BSP-Tree. But Wikipedia says it's patented. And a public programming challenge -- much more than a private program or even free (beer) software -- really is encouraging people to reuse the idea without regard to ownership. So I can't ( _legally_ or _in good conscience_ ) use it here, can I?


What guidelines do you suggest for using Objective-C Properties?

Objective-C 2.0 introduced properties. While I personally think properties are nice addition to the language, I have seen a trend of making every instance variable as a property. Apple sample codes are no exceptions to this. I believe this is against the spirit of OOP, and since it exposes a lot more implementation details of a class to the client than they need to know. What guidelines do you suggest for the proper usage properties in Objective C?


Shouldn't recruitment be the other way round?

I really don't know why nobody's thought of this so far, but recruitment should be the other way round. Engineers should have some sort of a common platform where they register skills or domains they are interested in, demonstrate their capabilities and companies should take it up from there. I think this is way more effective since if you are paid well to do work that you love doing, you will generally make a fine job out of it. Does anybody know of some recruitment platform like this?


What are the best ways to get beta testers?

I have several projects coming up soon for public release, both commercial and open source. The projects are all downloadable, not web apps. I've worked on them alone and would like to get feedback during a beta period, but I don't currently have a large audience (though the markets are large). What are the best ways to get participation in the betas? Are there any existing sites or communities that specialize in software testing that I can reach out to? At this point, I'm specifically looking for technical testers who aren't intimidated diving into the code and can help spot security bugs, logical errors, etc. **Edit** : I'm looking for websites or communities similar to Invite Share. Invite Share itself would be perfect, but there doesn't seem to be any public information about how to submit a beta. **Bounty Explanation** : While Joel's article on running a beta is helpful, I wonder if there isn't an existing community available for beta testing of any sort, technical or user. As a self-taught and sole developer, I don't have a lot of technical contacts that would be appropriate approaching for testing. I did propose a Beta Testing site in Area 51 a few months ago, but it seems as if it either got buried, there wasn't a whole lot of interest, or it's a poor fit for StackExchange. If you know of existing testing communities, sites like InviteShare, or other ways to get testers, please share.


Which asp.net technology fits this situation best?

I think I can count WebAPI out, but WebForms, WebPages, and MVC are all possibilities. I want to create an asp.net web site that is primarily static content and links to other sites. The only "fancy" bit will be a Bing map with pushpins that I add - but even these are static. And there will be a photo gallery. Oh, and ads, too. And, finally, it needs to work well on phones and tablets as well as desktop browsers. Which asp.net technology "flavor" is most suited for this type of web site? ## UPDATE In VS 2012, Web Pages projects are not available beneath Templates | Visual C# | Web. What _is_ there:               ASP.NET Empy Web Application     ASP.NET Web Forms Application     ASP.NET MVC 3 Web Application     ASP.NET MVC 4 WebApplication     ASP.NET Dyanmic Data Entities Web Application      Does this mean that Web Pages are passe, or that Web Pages and Web Forms are the same thing?


Understanding the Microsoft Public License (MS-PL)

I'm looking at using a few open source products in a commercial software application I'm working on. One of them is licensed under MIT, which I understand as allowing commercial software linking. However, the other open source product is licensed under MS-PL but I don't understand if that license is fully compatible with commercial software. So the question is, can I use MS-PL licensed OSS in a commercial/proprietary/for-sale application? Thanks.


What does Dijkstra mean when he recommends an exceptionally good mastery of one's native tongue?

Dijkstra writes here: > Besides a mathematical inclination, an exceptionally good mastery of one's > native tongue is the most vital asset of a competent programmer. I do not understand the latter part of this quote. Can you please explain or elaborate? P.S. I have grown up in India. I speak Bengali at home; I speak Marathi in the community that I live in; Hindi is the national language and very widely spoken, so I know that, and in school and college I was taught with English as the first language. Of course, now I think in a multitude of languages and I must admit I don't have _mastery over any_. Is this really affecting my programming aptitude? If yes how ? and are there any _solutions_?


Flash development under Ubuntu

It's unfortunate, but I'm taking this course that would require me to work in Flash CS3 (specifically programming), which would make me use windows. I'm very used to development under Ubuntu, and booting into windows would require me to switch a hard drive. I was wondering if:   * I could use the Flex 4.5 SDK to develop (something like a console application), then later hook it in Windows with the GUI I'm required to design? (In other words, is Flex 4.5 SDK compatible with CS3)?   * Is there a good lightweight editor that I can edit actionscript 3 in?


What is the best practice to deliver a task to a developer?

As a very new software PM/Team Leader, I just want to know what is the best practice of a way to deliver a full required information about a task to the developers in my team. In this time, I just provide them with:   * GUI Interface (if it used)   * DB Schema (if it is used)   * Blueprint of main classes. I think that's not enough. We usually have long discussions about the details; I just want to decrease the area of the discussion. What should I do? Do you think we should at least have a code review process?


Does the Decorator Pattern exist in the Java IO classes?

For an assignment, I have to find out which of the Gang of Four design pattern the classes `java.io.Reader` and its subclasses `java.io.PushbackReader`, `java.io.BufferedReader` and `java.io.FilterReader` were built with. According to this post, the design pattern would be the Decorator Pattern. This only makes sense to me if `PushbackReader`, `BufferedReader` and `FilterReader` can be decorated to be used at the same time, creating effectively a `BufferedPushbackFilterReader`. Is that the idea?


Determining the cost of impediments (waste)

For some time now our Scrum teams have experienced recurring impediments caused by external factors to the team. The teams have discussed the impediments in their retrospectives and also brought it up on "Scrum of Scrums". It seems that the impediments may require involvement by management as it requires some rather significant changes in that way we do things and the way our technical environments have been configured. In a small setting these kind of issues would probably have been easy to deal with because the team would have more control, but in this setting there are multiple teams, stakeholders and parties. I’d like to hear your experience in making waste and costs visible. Do you simply estimate the hours wasted on the recurring impediments (such as, “we waste 10 hours every sprint waiting on the build server) or do you have a more systematic way of gathering and showing the waste? I would like to collect waste based on Six Sigma (and Lean Software Development) and estimate the waste cost in terms of story points. E.g. at every retrospective highlight the waste in seven categories with the number of story points wasted in each category. The seven categories would be: Partially Done work, Extra Features, Relearning, Handoffs, Task Switching, Delays, and Defects. In the end of the Retrospective, there would then be a clear indication of the cost of external impediments that management would easily be able to act on. What do you think?


Cross Compile Arm Program to Intel

I have searched around for a way to run a program meant for ARM processors on an Intel computer, but I can only find ways to do the reverse, to compile Intel programs for ARM. Are there any open-source cross-compilers that will allow me to do so? Thanks for your help.


Independency and estimation of user stories that rely on shared predecessor

Lest's say I have user stories about using product catalog in shop:   * As an administrator I can add/modify/delete catalog items (one or more user story, doesn't matter here)   * As a customer I can search product catalog   * As a customer I can view product details Each of this stories rely on predecessor: design and create database to store product information. I can express db creation as:   1. another story: As a shop owner I want to store information about products I sell    2. Task to be done in story which will be firstly chosen to do In first case I create story dependency, in second I wondering where estimate this additional task. Let's say it adds additional two story points. To which story should add this points? All (and re-estimate remaining stories in the future), none? I think that second option also can hinder estimation - I have to remember to add this story points to dependent stories and then possibly remove it. How to deal with such situations?


Which could be a good design pattern for complex numeric calculations between three or more different data models?

The source code I'm working on at the moment performs numeric calculations between a bunch of different properties belonging to different data models. All the calculations are coded in a big method with a lot of If statements than make it very complex, difficult to change and it contains some bugs. I have not found a design pattern that fits into this problem that I think is very common in any financial application. Any help with this? The source code is c# with .NET fw 4.


Ported Functions Licensing

I have found several functions in python 2.7.2 to be very useful and I recreated them in C++ for my own uses. How do I properly give python credit for them? Do I even have to? I never actually looked at their source codes. I just wrote functions that output the same values as the python versions of the function.


if/else statements or exceptions

> **Possible Duplicate:**   >  Defensive Programming vs Exception Handling? I don't know, that this question fit better on this site, or Stack Overflow, but because my question is connected rather to practices, that some specified problem. So, consider an object that does something. And this something can (but should not!) can go wrong. So, this situation can be resolved in two way: first, with exceptions:               DoSomethingClass exampleObject = new DoSomethingClass();     try     {          exampleObject.DoSomething();     }     catch (ThisCanGoWrongException ex)     {          [...]     }      And second, with if statement:               DoSomethingClass exampleObject = new DoSomethingClass();     if(!exampleObject.DoSomething())     {          [...]     }      Second case in more sophisticated way:               DoSomethingClass exampleObject = new DoSomethingClass();     ErrorHandler error = exampleObject.DoSomething();     if (error.HasError)     {          if(error.ErrorType == ErrorType.DivideByPotato)          {              [...]          }     }      which way is better? On one hand, I heard that exceptions should be used only for real unexpected situations, and if programmer knows that something may happen, they should use if/else. On the other hand, Robert C. Martin in his book Clean Code wrote that exceptions are far more object oriented, and more simple to keep clean.


Why are exceptions considered better than explicit error testing?

> **Possible Duplicate:**   >  Defensive Programming vs Exception Handling?   >  if/else statements or exceptions I often come across heated blog posts where the author uses the argument: "exceptions vs explicit error checking" to advocate his/her preferred language over some other language. The general consensus seems to be that languages that make use of exceptions are inherently better / cleaner than languages which rely heavily on error checking through explicit function calls. Is the use of exceptions considered better programming practice than explicit error checking, and if so, why?


Do We Have a Responsiblity to Improve Old Code?

I was looking over some old code that I wrote. It works, but it's not great code. I know more now than I did at the time, so I could improve it. It's not a current project, but it's current, working, production code. Do we have a responsibility to go back and improve code that we've written in the past, or is the correct attitude "if it ain't broke, don't fix it"? My company sponsored a code review class a few years ago and one of the major takeaways was that sometimes it's just good enough; move on. So, at some point should you just call it good enough and move on, or should you try to push projects to improve old code when you think it could be better?


Caching Business Objects in MVC application

I figured this was more of an architectural question, so I chose to post it here rather than Stack Overflow. So I'm building an MVC web application and have just finished writing the code that wraps my calls into the DB (DAL) and gives me access via an interface to Create, Update, and Delete my Business Objects. Quick example just so you can get familiar before I go into my real question - here's how I would load up a stored record in the database for someone on the front end:               BusinessObjects.Record record = DAL.LoadRecord(int recordId);      Now once the `record` is loaded up, I can provide it to the front end (web) via a `Model` to one of my pages, or by attaching it to the `ViewBag` or something similar. How it gets there isn't important or what I'm worried about, it's more so how I can maintain state in a stateless (web) environment. The problem I am dealing with right now is, say I provide this `record` to the front end, and my page reads from it and generates a UI around it. At this point, the `record` is more or less gone. It has been created, passed, and read, but because of the stateless environment, is now lost. I can re-create this record based on the data I have on the front end on its way back, but is something like this usually handled by adding this `record` to the cache, and then just working with it there until it's fully ready to be persisted once again (something like `Saver.SaveRecord(record);`)? This would make things a lot quicker for the user, because they wouldn't have to be calling `Save` and `Load` every single time a page switched or something happened, but I didn't know if this was the correct architecture or if there's a common pattern that I have ignorantly ignored. I've tried to load up some links and have just found examples of _how_ to set something like this up, but what I really want to know is, _should_ I be setting something like this up, or is there a better way to do it. You'll have to excuse the beginner question. It's pretty obvious this problem has been solved many times, I'm just unaware of some of the more common patterns for doing so, and therefore wasn't sure exactly what to search for.


What optimizations can be done for soft real-time code in C#?

I'm writing a soft real-time application in C#. Certain tasks, like responding to hardware requests coming in from a network, needs to be finished within a certain amount of milliseconds; however it is not 100% mission-critical to do so (i.e. we can tolerate it being on time most of the time, and the 1% is undesirable but not a failure), hence the "soft" part. Now I realize that C# is a managed language, and managed languages aren't particularly suited for real-time applications. However, the speed in which we can get things done in C#, as well as the language features, like reflection and memory management, make the task of building this application much easier. Are there any optimizations or design strategies one can take to reduce the amount of overhead and increase determinism? Ideally I would have the following goals   * Delay the garbage collection until it is "safe"    * Allow the garbage collector to work without interfering with real-time processes   * Thread/process priorities for different tasks Are there any ways to do these in C#, and are there any other things to look out for with regards to real-time when using C#? The platform target for the application is .NET 4.0 Client Profile on Windows 7 64-bit, with. I've set it currently to Client profile but this was just the default option and wasn't chosen for any particular reason.


Is there a tool or process to help FOSS authors agree on a license?

The Evercookie project has several contributors and there is no explicit license for the code. There is currently discussion on the dev mailing list trying to figure out what the licensing options are.   * Is there any tool or process that can be used to find consensus among the various licenses?   * What can be done if some contributors are non-responsive, can't be found, etc?


Where should Acceptance tests be written against?

I'm starting to get into writing automated Acceptance tests and I'm quite confused where to write these tests against, specifically what layer in the app. Most examples I've seen are Acceptance tests written against the **Domain** but how about tests like: > Given Incorrect Data When the user submits the form Then Play an Error Beep These seem to be fit for the **UI** and not for the **Domain** , or probably even the **Service layer**.


Demonstration of garbage collection being faster than manual memory management

I've read in many places (heck, I've even written so myself) that garbage collection _could_ (theoretically) be faster than manual memory management. However, showing is a lot harder to come by than telling.   I have never actually **_seen_** any piece of code that demonstrates this effect in action. Does anyone have (or know where I can find) code that demonstrates this performance advantage?


log4cxx: is it a stable option to include as part of distributed library?

We are porting our Java API library to C++. (Our target platforms are Linux and Windows.) Since we have minimal C++ experience, the learning curve has been pretty steep, but overall we have been able to make a clean port so far. In Java we use log4j, and are looking at to use log4cxx in the C++ version. It took us a few hours to get log4cxx to build on Windows (due both to our inexperience, and also build documentation seems out of date). We haven't yet tried to build on Linux. To my uninformed eye, log4cxx seems messy and somewhat outdated. Is there any consensus on whether this is a good logging framework to go forward with? (Log4j also seems to have been superceded by SLF4J and Logback.) I looked also at boost logging, but that does not appear to be part of the main distribution, so I wasn't sure if I was provided a more standard option with that or not. One other piece of information to add into the evaluation - the first client we are providing this to is already using log4cxx.


Gradual approaches to dependency injection

I'm working on making my classes unit-testable, using dependency injection. But some of these classes have a lot of clients, and I'm not ready to refactor all of them to start passing in the dependencies yet. So I'm trying to do it gradually; keeping the default dependencies for now, but allowing them to be overridden for testing. One approach I'm conisdering is just moving all the "new" calls into their own methods, e.g.:               public MyObject createMyObject(args) {       return new MyObject(args);     }      Then in my unit tests, I can just subclass this class, and override the create functions, so they create fake objects instead. Is this a good approach? Are there any disadvantages? More generally, is it okay to have hard-coded dependencies, as long as you can replace them for testing? I know the preferred approach is to explicitly require them in the constructor, and I'd like to get there eventually. But I'm wondering if this is a good first step. **EDIT:** One disadvantage that just occurred to me: if you have real subclasses that you need to test, you can't reuse the test subclass you wrote for the parent class. You'll have to create a test subclass for each real subclass, and it will have to override same the create functions.


What's a good strategy for managing static data in an SOA?

I'm working on a web application that sits on top of a number of RESTful web services, interacting primarily with those services through JSON formatted messages over HTTP. Our application has a great deal of static data that are read from these services (internationalization lookups, configuration, etc.) during operation. Unfortunately, we work pretty closely with the team who develops the webservces, so we know the backend architecture fairly intimately. Most of the services are using a MongoDB store for persistence, and our strategy thus far for managing the static data we require to be loaded is to utilize MongoDB dumps committed to version control that are loaded at deploy/upgrade time. We'd like to decouple our static data from the persistence store. The best ideas that have come forth thus far mostly involve storing static data formatted as it would be passed to services (JSON files) and then writing a "loader" process/script that will live as part of the deployment process which will interact with services to load the data. Are there patterns/strategies for managing/loading/deploying "application" data to services?


Generic Content Player?

The general idea on the web appears to be that video/audio are to be separated with plain text. By separated, I mean you have a place that plays video/audio and a place that you read text. This is because it is widely understood that they are vastly different. However, audio and video are just another way of communication, just like text. So why do we separate the two even if they are nearly the same thing? Correct me if I'm wrong but, most tutorials are either plain text how-to's (wiki-style) or visual/auditory instructional videos (YouTube). Why aren't the two combined? Or, if it's already been done can someone reply with the link? This might be bordering off-topic and if it is off-topic then please point me to the right place so it won't be. This might also appear to be an obvious question, however I'm not sure if this subject has really been deeply thought-out by more than a few individuals.


Better way of storing key-value pairs in the database?

I have a C#/SQL Server program that sometimes needs to store data. The data could be a response from a web service, a result of a database query, or any number of other things. There's no way of knowing before the data is stored how many fields it might have or what the data structure might be. We have this kind of painful table we're using for this... four columns and lots of rows. An example of the data might be easier than an explanation.               InstanceID RowID PropertyName PropertyValue     1          1     Property1    Value1     1          1     Property2    Value2     1          1     Property3    Value3     1          2     Property1    Value1     1          2     Property2    Value2     1          2     Property3    Value3     2          1     OtherProp1   Value1     2          1     OtherProp2   Value2     2          2     OtherProp1   Value1     2          2     OtherProp2   Value2      These values will then be pulled back and fed into a dictionary object, which can be updated, then the fields will be fed back into the database. This can be painful to code against, and also requires a lot of inserts which can make it very slow. I can't think of a better way of doing this, but I feel like there must be one. Any advice?


Help needed on a UI/Developer Interview

I have a phone interview with a major Internet company and it is a mostly front-end developer position. If anyone has experience with UI/developer interviews and can give some advice/questions asked etc. that'll be great. Additionally, what resources can be read and reviewed for the following:   * Designing for performance, scalability and availability   * Internet and OS security fundamentals **EDIT:** Now I am told that the interview I am told will be mostly on coding, Data Structures, design questions etc. Anyone?


What parts of functionality should be refactored into a directive?

I am creating an application from legacy code using AngularJS. I wonder what parts of my code should be moved into a directive. For example, iI had thought of moving a table which is used multiple times across the application into a directive. The tables alter from headings and size. Is it worth the effort or even a good practice to turn such things into their own directives or should I create each table in a unique way?


MVVM Clarification

We are about to write our first WPF application and are becoming familiar with the MVVM pattern. We've built many Winform applications and have an architecture that has been very successful for us. We're having a little bit of trouble translating that architecture or determining where certain pieces of our architecture fit in the MVVM model. Historically we have a Gui (the main exe) that then communicates to a BusinessLogic dll. The BusinessLogic communicates to a DAL dll through a web service and the DAL interacts with the DB. The DAL, BusinessLogic and GUI all reference the same BusinessObjects dll. ![AsIs Architecture](http://i.stack.imgur.com/uWIvW.png) Some of the transition to MVVM is fairly straight forward. Our Gui will still contain the views, our BusinessOjbects will still contain the model and our DAL will still interact with the DB (although the technology to implement them may change). What we're not sure of is our BusinessLogic component. Historically this would provide functions for the GUI to call to then populate controls in the views (ie. GetCustomerList which would return a list of Customer objects or the typical CRUD functions). The main hang up we have is whether the MVVM pattern would call for an additional component to house the ViewModels or if we just change our thinking and migrate what we have used as our BusinessLogic component to the ViewModels? Does our BusinessLogic component represent the ViewModels?


Best Practices for MVC Architecture

There are a number of questions on Stack Overflow regard MVC best practices, but most of those seem to revolve around things like using Dependency Injection, or creating helper functions, or do's and don'ts of what to do in views and controllers. My question is more about how to architect an MVC application. For example, we are encouraged to use DI with the Repository pattern to decouple data access from the controller, however very little is said on HOW to do that specifically for MVC. Where would we place the Repository classes, for instance? They don't seem to be model related specifically, since the model should likewise be relatively decoupled from the actual data access technologies. A second question involves how to structure the layers or tiers. Most example applications (Nerd dinner, Music Store, etc..) all seem to use a single tier, 2 layer approach (not counting tests) that typically has controllers directly calling L2S or EF code. If I want to create a multi-tier/layer application what are some of the best practices there in regards to MVC?


How to learn to draw UML sequence diagrams

How can I learn to draw UML sequence diagrams. Even though I don't use UML much I find that type of diagrams to be quite expressive and want to learn how to draw them. I don't plan to use them to visualise a large chunks of code, hence I would like to avoid using tools, and learn how to draw them with just pen and paper. Muscle memory is good. I guess I would need to learn some basics of notation first, and then just practice it like in "take the piece of code, draw a seq. diagram visualising the code, then generate the diagram using some tool/website, then compare what I'd drawn to what the tool result. Find the differences, correct them, repeat.". Where do I start? Can you recommend a book or a web site or something else? **Update** : I decided that it might be worthwhile to upskill myself in UML, and found this book: http://www.amazon.com/The-Elements- UML-2-0-Style/dp/0521616786 \- reviews say it is best practices book on UML. Have you read it? Can you recommend it? Thank you.


Accessing Repositories from Domain

Say we have a task logging system, when a task is logged, the user specifies a category and the task defaults to a status of 'Outstanding'. Assume in this instance that Category and Status have to be implemented as entities. Normally I would do this: **Application Layer:**               public class TaskService     {         //...              public void Add(Guid categoryId, string description)         {             var category = _categoryRepository.GetById(categoryId);             var status = _statusRepository.GetById(Constants.Status.OutstandingId);             var task = Task.Create(category, status, description);             _taskRepository.Save(task);         }     }      **Entity:**               public class Task     {         //...              public static void Create(Category category, Status status, string description)         {             return new Task             {                 Category = category,                 Status = status,                 Description = descrtiption             };         }     }      I do it like this because I am consistently told that entities should not access the repositories, but it would make much more sense to me if I did this: **Entity:**               public class Task     {         //...              public static void Create(Category category, string description)         {             return new Task             {                 Category = category,                 Status = _statusRepository.GetById(Constants.Status.OutstandingId),                 Description = descrtiption             };         }     }      The status repository is dependecy injected anyway, so there is no real dependency, and this feels more to me thike it is the domain that is making thedecision that a task defaults to outstanding. The previous version feels like it is the application layeer making that decision. Any why are repository contracts often in the domain if this should not be a posibility? Here is a more extreme example, here the domain decides urgency: **Entity:**               public class Task     {         //...              public static void Create(Category category, string description)         {             var task = new Task             {                 Category = category,                 Status = _statusRepository.GetById(Constants.Status.OutstandingId),                 Description = descrtiption             };                  if(someCondition)             {                 if(someValue > anotherValue)                 {                     task.Urgency = _urgencyRepository.GetById                         (Constants.Urgency.UrgentId);                 }                 else                 {                     task.Urgency = _urgencyRepository.GetById                         (Constants.Urgency.SemiUrgentId);                 }             }             else             {                 task.Urgency = _urgencyRepository.GetById                     (Constants.Urgency.NotId);             }                  return task;         }     }      There is no way you would want to pass in all possible versions of Urgency, and no way you would want to calculate this business logic in the application layer, so surely this would be the most appropriate way? So is this a valid reason to access repositories from the domain? **EDIT: This could also be the case on non static methods:**               public class Task     {         //...              public void Update(Category category, string description)         {             Category = category,             Status = _statusRepository.GetById(Constants.Status.OutstandingId),             Description = descrtiption                  if(someCondition)             {                 if(someValue > anotherValue)                 {                     Urgency = _urgencyRepository.GetById                         (Constants.Urgency.UrgentId);                 }                 else                 {                     Urgency = _urgencyRepository.GetById                         (Constants.Urgency.SemiUrgentId);                 }             }             else             {                 Urgency = _urgencyRepository.GetById                     (Constants.Urgency.NotId);             }                  return task;         }     }


Which Java framework meets these requirements? What set of frameworks would be best suited to meet these requirements? The requirements are:   * oriented for web   * support for transactions   * support for creating RESTful web services   * support for security, levels of security   * integration with some kind of ORM framework like Hibernate   * ability to change front-end without need of making changes to back-end. Firstly, I want to develop a flex based front-end but if I've ever wanted to change it to HTML5 then I don't want to make changes to my back-end   * ready for cloud   * free to use for commercial purposes To my mind comes Spring but are there any other alternatives meeting these requirements? What about if it is not necessary java? Do you know framework, set of frameworks combined together in other language which meet these requirements best?


Have Superclass Contain List of Subclass?

For the GUI of a program, I want it to list several items, all of which are, from a programming side, just subclasses. They can add one of these items to a list. I don't want to hard-code which subclasses there are. What would be the best way to allow the GUI to know about the subclasses, only having the base class to refer to?


Best way to develop a php open source application

I started to create a php application I'd like to make open source in the near future. However I do not know, if it's needed to follow any kind of code/documentation convention, to make it more usable and acceptable when released. Is there any model, to follow, to develop a good open source application? Do you think it is necessary(or better) to develop it entirely, or for the most, object oriented?


Storing application users in SQL: create a new "Users" table or use built-in database user management?

I am specifically interested in SQL Server, but the same question applies in general. When creating a new application, the way I see it, there are two options:   * Create a table called "Users" and store the user name, password, etc. Set up one database user called "application" (and possibly more users for various components of the system).    * Set up each application user as the database user. This may allow for easier single log on setup on Windows-based systems. Which approach is generally preferred? Why? What are the drawbacks and benefits?


Can we expect re-addition of Mobile SDK in future Visual Studio versions?

Microsoft stopped shipping the Mobile SDK in Visual Studio releases after the 2008 version. This wasn't a big surprise, as there were no takers for that feature and android made a big hole. But now, things have changed, Microsoft has partnered with Nokia, HTC rolling new mobiles with Windows OS. Also, Windows 8 is all set to make début on tablets. Can all these be seen as potential reasons for Microsoft to roll-out the Mobile SDK again in future releases of Visual Studio ?


How can I determine what level (entry, mid, senior) I am?

I have an interview with a company headquartered in San Francisco. They are pretty popular, well publicized, and recently acquired by a semi-notable player in Silicon Valley. The team is probably 20-30 people. They want at least a mid-level candidate, and offer "perks" for senior/lead developers. I got an internship (for backend development) at a small startup halfway through a state school CS program, and was hired full-time a week into my internship as lead (well... only) iOS developer. I've worked here for 5 months and released an app (iOS constituent of our realtime communication suite). I've also released a location-based app for a niche community. I am familiar with TDD, GitHub, API's, AFNetworking and all the recent popular jazz, as well as dated concepts like pre-ARC memory management and xib/xibless programming. I can demonstrate a basic knowledge level of algorithms and formal programming (competent in code competitions) and I am a good communicator. But my notable experience is somewhat lacking. Would it be fair to call myself a mid-level developer?


Adding correct documentation for a method

I have method like this:               methodA(someParams)     {       do some initializations,etc;       call methodB(someParams);     }          methodB(someParams)     {       do work;       if blah then raise exception::FileNotFound       if blahblah then raise exception::ResourceNotFound     }      When I am adding documentation for `methodB`, I am also documenting the exceptions it can raise. But how about documentation of `methodA` ? It IS consuming `methodB` that may raise exceptions, so should I still document those exceptions for methodA as well? Right? wrong?


How to convince boss to buy Visual Studio 2012 Professional

The main advantage is the use of ReSharper and other add-ons but we need to make a convincing argument for the purchase of Visual Studio 2012 Professional. We are currently using Visual Studio 2012 Express for Windows. It is quite good but is hard to switch from using the full Professional version in the past. So far the team has compiled the following list: >   1. Extract Interface function missing. Very useful for clean SOLID code. >   2. No add-on support. Can’t install StyleCop or productivity tools. > AnkhSvn, Spell checker, Productivity PowerTools, GhostDoc, Regex Editor, > PowerCommands. >   3. The exception assistant is limited in Express edition. This is a big > annoyance. See http://www.lifehacker.com.au/2013/01/ive-given-up-on-visual- > studio-express-2012-for-windows-desktop-heres-why/ >   4. Different tools provided by MS like certificate generation. >   5. Possibility of create a Test project based on source code. > We do server development in C# so any web add-ons or anything else is useless. The reason I am asking is I am sure that people have been in the same position. What approach did you use and can you think of additions or ammends to the above list? Thanks,


Layered Manufacturing Contour Generation

I am currently working on software for layered manufacturing (3D printing), and have come to a point where I no longer know what to do. I am at the stage where I must take a bunch of lines, and order them to create a seamless contour of a model. I have some basic ideas on how I am going to do this, but since I am using .STL files there are excess lines in some of the layers. ![sample](http://i.stack.imgur.com/S2wSL.png) In that image you can see that there is a simple square with a line connecting two corners to form two triangles. This is the base of a cube. Ideally the line connecting the two corners wouldn't be there, but because this was processed from a .STL file which uses triangles only it has to be there to turn the square into two triangles. My original thought was to print out that line too, but in a more complex model ( like a gear ) there would be too many and it would be impossible to create one seamless contour. My next thought was to just print it out as two triangles, but I cannot go over the same line twice, so that doesn't work especially in complex models. I have been thinking about this problem for quite a while, but I can never come up with a solution that would work for any model. I need to end up with series of lines that form contours of not just the outside, but possibly the inside as well if there are holes. For example a gear would have one set of lines that form the teeth all the way around, and another set of lines that form the hole in the middle. If anyone knows a solution to this, or has experience with this, I would greatly appreciate your input =)


How does EF 4.1 stack up against ADO.NET SQL for stored procedures?

This question is _solely_ about using these technologies against stored procedures. I've been doing quite a bit of reading on pitting these two against each other, and far more than anything I've been seeing them compared with CRUD operations and other more complex queries - very rarely for calling stored procedures. I've read that it's hard to beat ADO.NET for performance when calling stored procedures. However, when calling them with Entity Framework 4.1, you get the benefits of entities (rather than just the data reader) which can be nicer to work with and pass around (imo). I ran a few tests today (not sure of the accuracy of them) and they suggest that over 100 or 1000 iterations, calling the same procedure, that ADO.NET is something like 5 milliseconds, on average, faster per call. (I haven't been able to test how long it takes to convert from the standard data reader object to a similar kind of entity, but I doubt it makes up for the 5 milliseconds) Is it worth the trade off in performance for the benefits in design and writing? Or are those 5ms per query just too much? Does the answer change between small projects, and environments like e-commerce?


Use the filesystem or some noSql database for shared memory between processes?

I'm implementing a system that's basically a pipeline of XML documents: XML documents are retrieved over the Internet, validated, further processed etc. until they are ingested in a relational (non-XML) database. After the ingestion in the database they can be discarded. Since the various components of the pipeline are somewhat independent from each other I want to use a number of separate applications, each performing a "step" in the pipeline. What should be the reasoning behind choosing the file- system for data sharing between the above applications versus some noSQL database? The data to be shared is mostly XML files and total volume of data that goes through the pipeline maybe 10 gigabytes per day.


Understanding abstraction

I am trying to understand object oriented code better and I decided to start at abstraction. If I am not incorrect, abstraction means that you hide information that isn't relevant to what task you want to perform, i.e. If I turn on the TV I would not need to know the internal that is going on. Or If I have a class that handles Orders, and I would like to get the Total cost of a couple of Products, a getTotal() method would be the only thing that the User needs to know about to get the total sum of the products, and not how it's actually calculated. So per se, by using a class I am abstracting data?


Web-app filtering information client-side vs server-side?

I have a web-app that provides data (that is updated on an interval) for intranet users, who are able to filter information by location. I was having a discussion with a co-worker about whether that filtering should take place on the client vs server side. The amount of information isn't large, but the users are typically interested in a certain location. My question..Is it preferable to let the database filter the data and send the results to the client, or return all data back to the client and then sort by location? If it's not clear cut, when would you choose on method over the other?


When does a Monad become a hammer?

I realize my precursory understanding on Monads is severely lacking in detail considering my knowledge comes mostly from Douglas Crockford's Monads and Gonads talk and complicated with my sevear handicap with Haskell (which looks like a bunch of non-alpha numeric characters mushed between disjointed English words to my tragically disadvantaged brain). With that being said, I'd like to ask about programming practices concerning Monads and how they could be implemented in JavaScript. I'm prefacing this because I recognize that the very nature of the language can drastically affect how one perceives a concept and that because of my background in JavaScript this question could be inappropriate if it were based in a purely functional language like Haskell. Often times while designing an interface or coding an object I will find myself implementing a form of chaining which mutates the encapsulated data. I prefer this style over more declarative forms like passing in a multi-lined object literal.               function Declarative(options) {       this.options = options;     }     Declarative.prototype.compute = function() { ... }     var x = new Declarative({       foo: 'foo',       bar: 'bar'     });     x.compute();      Verses:               function Chained() { }     Chained.prototype.withFoo = function(v) {       this.foo = v;       return this;     };     Chained.prototype.withBar = function(v) {       this.bar = v;       return this;     };     Chained.prototype.compute = function() { ... }     var x = new Chained()       .withFoo('foo')       .withBar('bar')       .compute();      Both these examples (aesthetics aside) raise a few hairs on my back because a small voice mockingly squeals "Mutability much?" I begin thinking this might be a good time to conciser a Monad pattern. What I mean by that is each method would in short return a new object of the same type. Then adding composition functions on it like map, bind, etc. could off a world of potential like I get with Promises and other Monad type. (Obviously taking care to follow the three Monadic laws when implemented). Finally, my other half of the brain starts chiming in with "If all you have is a hammer, everything looks like a nail." Sigh. That is when my productivity and creativity crash here on SE curious and confused. While I continue my research for understanding (perhaps gaining enough courage to contemplate Haskell) I ask: When does the idea of Monads (that being composability of functions on objects (ie types) along with immutability) become a good idea to be cultivated and patterned? And, when is it nothing more then an over utilized hammer? (Concepts and learning opportunities welcomed, example code helpful)


Add arguments to mysql in Django's "dbshell"

I'd like to add a couple of command-line arguments to my Django's `./manage.py dbshell` command, and I can't figure out how. In specific I'd like to add `-A` to prevent MySQL from scanning every table and every column, and `--prompt=LOCAL:` since I frequently keep multiple shells open. I can't figure out how to do this! I'm only idea is to create my own "mysql" command in /usr/local/bin and have it be a wrapper for mysql with my own flags. But I'd really like to avoid doing that.


Starting all over again?

Have you ever been developing something and just came to a point where you think that this is rubbish, the design is bad and although I will lose time it will be better to just start all over again? What should you consider before making this step? I know it can be drastic in some cases, is it best to just totally ignore what you did before, or take some of the best bits from it? Some real life examples would be great.


Privilege (Access/Permission) Control for Hierarchial Structured Resource

Question: Is there any standard model or industry defacto implementation for modeling and implementing Access Control in (i.e.) a Document Management System? Note: I studied a bit the security mechanism of Windows (which I do not want to use), and I saw Users and Groups and Policies. But I can't understand: 1 - How a single policy object can contain all information about allowed/denied actions on a subject for all users and groups, at a specific moment of time. 2 - How multiple policies on a specific subject, merge into one to provide least possible access. 3 - What is the mechanism (data structures, database, caching, implementation) of hierarchical resources like folders? Those king of queries are usually slow.


Why bother with detailed specs?

When writing software, what's the point of writing a formal, detailed dead- tree specification? To clarify, a somewhat informal, high-level specification for people who don't want to read the code makes sense to me. A reference implementation in well-commented, readable source code is about the most unambiguous specification of anything you're going to get, though, since a computer has to be able to execute it. Formal specs are often just as hard to read, and almost as hard to write, as code. What benefits does a formal specification offer over a reference implementation plus a little documentation about what behavior is undefined/implementation-defined regardless of how it works in the reference implementation. Edit: Alternatively, what's wrong with the tests being the formal specification?


How do you determine velocity when the previous sprint was half User Stories and half Defects?

The following scenario often happens with my team at the office. Let's say we decided to plan our Sprint this way:   * 50% new features   * 50% bug fixing (they are high priority AND _unestimated_ as the fixes are easy, the hard and time-consuming bit is the investigation) The Sprint goes well and we finish all the features, say X story points, and quite a few unestimated bugs. Two questions come to mind:   1. What is our Sprint velocity? Is it X?    2. Assuming it is X; how do we plan the next Sprint using "yesterday's weather" (X story points) if we now want to do an 100% new features Sprint?


Separate namespace just for exceptions?

I was doing a code review and came across something odd which I've never seen before. The developer decided to create a sub-namespace just to contain all the assembly's exceptions. I thought I had read that this was explicitly not a good use of namespaces and that exceptions should be kept at the "lowest" namespace from which they are thrown, but I haven't found anything on MSDN (or anywhere else for that matter). At the same time, it seems odd that I haven't come across this before in the framework itself or the third party libraries I've used. Are there any guidelines exist that would push away from keeping all exceptions in a .Exceptions sub-namespace?


What kind of processes or static alaysis would you use to catch impropper buffer bugs such as the one that caused heartbleed?

What kind of process or static analysis would catch the heart bleed bug other than human code reviews which we already know failed. The Fix Commit is here.


How to contribute to jQuery?

I'm confused about the nature of the jQuery project. It can be licensed under either the GPL or the MIT license, according to the comments in the project. However, the jQuery web site provides a list of team members, as if this were a commercial product. I have written some code to improve jQuery to work around a nasty bug in Internet Explorer and I would like to know what is the best way to propose my idea to the project.


How to deal with code reuse philosophy?

I constantly find myself thinking about code reuse when starting a new project. To what extent should I make my code reusable?   Should I limit it to the application scope or should I make it reusable outside of the project? Sometimes, I feel like code reusability may stand in the way of a simple design. Please, share your own understanding and approach of code re- usability.


Jenkins without Automated Tests

I know that Jenkins is focused on continous building/testing, monitoring of batch jobs about the project. We have a legacy project which such condition : 1)Has a development team. 2)It has SVN for source code management 3)Some cronjobs for some operations. 4)Compile&Build don't take too much time, there is no very complex dependencies. 5)It doesn't have any automated test/junit classes and will not have. I'd like to ask to experienced users about Jenkins, is it still worth to use Jenkins for central build&management of the project ?


Unit of work principle is causing a problem in MVC3 application

I am implementing a website using MVC3, Entity Framework 4.1 and Repositoty pattern, Unit of work principle. But I am facing a big problem while implementing this. I have developed a static ObjectContext class. This class is used across all the repositories so unit of work pattern is followed. I have e.g. ICustomer, IProduct repositories. I use specifically only one repository in a controller and that too is injected using NInject.               CustomerController(ICustomer customer)     {     }          ProductController(IProduct product)     {     }      Since object context class is static and IProduct, ICustomer have parameterised constructor which accepts the objectContext class, these two will share the same ObjectContext instance. When the execution is single threaded everything goes fine, but in multi- threading I get an unhandled exception, because of one repository closing the connection which was being used by other. I think if I make ObjectContext class not-static then this will solve the problem(Not tested yet) but then Unit of Work will not be observed. Can you please suggest a solution for this?


Performance of One API vs Multiple API's

I was having a conversation with a colleague and although my opinion makes sense to me, I wasn't able to back it up. I'm in the process of creating an API that will be hit hundreds of thousands of times per day. It's fairly simple, and will just be doing some inserts into a relational database. There are essentially 3 functions I would need to create. The question is, what would have better performance, creating one API with different controllers (using .NET Web API or NodeJS something like that) or 3 different API's. My thought is that, for example with the .NET Web API, no matter whether there are 1 or 3 they are all being hosted, and using the same resources. His thought was that having 3 API's would be 3 times faster because it would have 3 times the resources. I simply didn't have the proof to disprove that.


Managing JS and CSS for a static HTML web application

I'm working on a smallish web application that uses a little bit of static HTML and relies on JavaScript to load the application data as JSON and dynamically create the web page elements from that. **First question** : Is this a fundamentally bad idea? I'm unclear on how many web sites and web applications completely dispense with server-side generation of HTML. (There are obvious disadvantages of JS-only web apps in the areas of graceful degradation / progressive enhancement and being search engine friendly, but I don't believe that these are an issue for this particular app.) **Second question** : What's the best way to manage the static HTML, JS, and CSS? For my "development build," I'd like non-minified third-party code, multiple JS and CSS files for easier organization, etc. For the "release build," everything should be minified, concatenated together, etc. If I was doing server-side generation of HTML, it'd be easy to have my web framework generate different development versus release HTML that includes multiple verbose versus concatenated minified code. But given that I'm only doing any static HTML, what's the best way to manage this? (I realize I could hack something together with ERB or Perl, but I'm wondering if there are any standard solutions.) **In particular** , since I'm not doing any server-side HTML generation, is there an easy, semi-standard way of setting up my static HTML so that it contains code like               <script src="js/vendors/jquery.js"></script>     <script src="js/class_a.js"></script>     <script src="js/class_b.js"></script>     <script src="js/main.js"></script>      at development time and               <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>     <script src="js/entire_app.min.js"></script>      for release?


Potentially Shippable Product Increment - what if users don't like the latest increment?

In our company we do usability test at the end of each Sprint. Many times we discover that the users don't like the implemented feature, so we either completely change it or scrap it in the next Sprint. However if we start doing potentially shippable product, thus fixing all bugs, running a lot of tests, preparing documentation for FDA and for users, fixing little UI issues - all this work will go to waste if users will not like the feature. Isn't it better NOT to do all this extra potentially shippable stuff until we are sure users actually like the feature?


What workflow do you find efficient when simultaneously developing multiple inter-dependent GIT branches?

Let me start by saying that my GIT knowledge is fairly shallow, so I'm guessing that there might be something I'm missing. **THE SETUP:**   As an example, we have a project which is being developed as a collection of plug-ins/modules. Some modules, such as contact management, depend on others, such as validation. Each module has it's own branch. **CURRENT WORK FLOW:**   Our validation module is being concurrently developed with our other modules, just in a separate stream. In doing so, I am finding that I am having to do a **lot** of checking out back and forth (as well as a lot of stashing (and merging, but that I'm fine with)). For example, say I'm developing module_x which needs a new validation rule (which will have uses in other modules as well) ... I then:   1. stash my work   2. checkout the validation branch   3. write the rule   4. commit   5. checkout the module_x branch   6. pop the stash   7. merge the validation branch into module_x. Now, if I come up with an improvement for something in the validation branch (or just need to fix a bug), I have to go through all that all over again. Between new development, refactoring/improvements, and bug fixing, I feel like I'm spending entirely too much time just switching back and forth between developments streams, and can't help but think that there's a better way. **DO's and DONT's:**   Is this _really_ how it's done, or am I completely missing the bigger picture? :)   What works for you?


Why doesn't java use a radix sort on primitives?

`java.util.Arrays.sort(/* int[], char[], short[], byte[], boolean[] */)` is implemented as a 'tuned quicksort' rather than a radix sort. I did a speed comparison a while ago, and with something like n>10000, radix sort was always faster. why?


As developers is it our job to report issues if no one else in the org seems to care?

**edit:** I should point out; My personal view was that I should be proactive. I know sometimes I have to bite my tongue, and I wanted to get the communities input(was this one of those times). I couldn't find a more appropriate place to ask it in the SO family of sites. Here is the scenario --   * small org < 70 employees   * no qa department   * website viewed by thousands everyday.    * I am the sole website developer   * I have never had a single complaint that the site is broken in IE6   * I've discovered our site has not worked in IE6 for years. The person I replaced who created it must have been "testing" it only on IE7. I fired up Virtual PC and with IE6, and our site is a complete mess. You can not select some menu items they are so garbled. It looks terrible. So again, Is it our job to proactively seek out bugs, or do we just fix what the customer requests.... Personally, I want to leverage this opportunity with my org to drop any expectation of IE6 support or compatibility.


Why do operating systems do low level stuff in C and C++? Why not just C++?

On the Wikipedia page for Windows, it states the Windows is written in Assembly for the bootloader and task switcher, and C _and_ C++ for kernel routines. IIRC, you can call C++ functions from an `extern "C"`'d block. I can get using C for the kernel functions so pure C apps can use them (like `printf` and such), but if they can just be wrapped in an `extern "C "` block, then why code in C?


Will correctness proofs of code ever go mainstream?

All but the most trivial programs are filled with bugs and so anything that promises to remove them is extremely alluring. At the moment, correctness proofs are code are extremely esoteric, mainly because of the difficultly of learning this and the extra effort it takes to prove a program correct. Do you think that code proving will ever take off?


Browser support for internal corporate tools

We are on the verge of a conversion. For years, our company supported only IE for its internal (intranet) home-built tools. Since a few of our users are still on XP, which means IE only goes up to 8... a heavily JS / jQuery site wont even load! We have been in the process of converting to use Chrome instead, to make use of its javascript performance. But, it has now been suggested that we support all common browsers... internally for these tools. Which means more development time to scale-back some of these new applications, more time to test in all browsers, and we are already under staffed. Are there any good informational sites/posts out there, that already make this argument?


What's with the aversion to documentation in the industry?

There seems to be an aversion to writing even the most basic documentation. Our project READMEs are relatively bare. There aren't even updated lists of dependencies in the docs. Is there something I'm unaware of in the industry that makes programmers dislike writing documentation? I can type out paragraphs of docs if needed, so why are others so averse to it? More importantly, how do I convince them that writing docs will save us time and frustration in the future?


Data Aggregation of CSV files java

I have `k` csv files (5 csv files for example), each file has `m` fields which produce a key and `n` values. I need to produce a single csv file with aggregated data. I'm looking for the most efficient solution for this problem, speed mainly. I don't think by the way that we will have memory issues. Also I would like to know if hashing is really a good solution because we will have to use 64 bit hashing solution to reduce the chance for a collision to less than 1% (we are having around 30000000 rows per aggregation). For example               file 1: f1,f2,f3,v1,v2,v3,v4             a1,b1,c1,50,60,70,80             a3,b2,c4,60,60,80,90           file 2: f1,f2,f3,v1,v2,v3,v4             a1,b1,c1,30,50,90,40             a3,b2,c4,30,70,50,90          result: f1,f2,f3,v1,v2,v3,v4               a1,b1,c1,80,110,160,120             a3,b2,c4,90,130,130,180      algorithm that we thought until now:   1. hashing (using concurentHashTable)   2. merge sorting the files   3. DB: using mysql or hadoop or redis. The solution needs to be able to handle Huge amount of data (each file more than two million rows) a better example: file 1               country,city,peopleNum     england,london,1000000     england,coventry,500000      file 2:               country,city,peopleNum     england,london,500000     england,coventry,500000     england,manchester,500000      merged file:               country,city,peopleNum     england,london,1500000     england,coventry,1000000     england,manchester,500000      The key is: `country,city`. This is just an example, my real key is of size 6 and the data columns are of size 8 - total of 14 columns. We would like that the solution will be the fastest in regard of data processing.


how to create database in which new columns have to be added periodically?

I want to create a database that tracks different projects and their finances. As finances are tracked monthly, a new column has to be created for each month. I could create all tables together at the start, yeah, but I guess it would be bad development strategy. Also I would be guessing the number of months. I will be creating an application to monitor those projects (like graphs and such)... so maybe I could code the program to do it at regular intervals.


Is code ownership a code smell?

This is something I've been thinking about ever since I read this answer in the controversial programming opinions thread: > **Your job is to put yourself out of work.** > > When you're writing software for your employer, any software that you create > is to be written in such a way that it can be picked up by any developer and > understood with a minimal amount of effort. It is well designed, clearly and > consistently written, formatted cleanly, documented where it needs to be, > builds daily as expected, checked into the repository, and appropriately > versioned. > > If you get hit by a bus, laid off, fired, or walk off the job, your employer > should be able to replace you on a moment's notice, and the next guy could > step into your role, pick up your code and be up and running within a week > tops. If he or she can't do that, then you've failed miserably. > > Interestingly, I've found that having that goal has made me more valuable to > my employers. The more I strive to be disposable, the more valuable I become > to them. And it has been discussed a bit in other questions, such as this one, but I wanted to bring it up again to discuss from a more point blank " **it's a code smell!!** " point of view - which hasn't really been covered in depth yet. I've been a professional developer for ten years. I've had one job where the code was well written enough to be picked up relatively quickly by any decent new developer, but in most cases in industry, it seems that a very high level of ownership (both individual and team ownership) is the norm. Most code bases seem to lack the documentation, process, and "openness" that would allow a new developer to pick them up and get working with them quickly. There always seem to be lots of unwritten little tricks and hacks that only someone who knows the code base very well ("owns" it) would know about. Of course, the obvious problem with this is: what if the person quits or "gets hit by a bus"? Or on a team level: what if the whole team gets food poisoning when they go out on their team lunch, and they all die? Would you be able to replace the team with a fresh set of new random developers relatively painlessly? - In several of my past jobs, I can't imagine that happening at all. The systems were so full of tricks and hacks that you " _just have to know_ ", that any new team you hire would take far longer than the profitable business cycle (eg, new stable releases) to get things going again. In short, I wouldn't be surprised if the product would have to be abandoned. Obviously, losing an entire team at once would be very rare. But I think there is a more subtle and sinister thing in all this - which is the point which got me thinking to start this thread, as I haven't seen it discussed in these terms before. Basically: I think **a high need for code ownership is very often an indicator of technical debt**. If there is a lack of process, communication, good design, lots of little tricks and hacks in the system that you "just have to know", etc - it usually means that the system is getting into progressively deeper and deeper technical debt. But the thing is - code ownership is often presented as a kind of "loyalty" to a project and company, as a positive form of "taking responsibility" for your work - so it's unpopular to outright condemn it. But at the same time, the technical debt side of the equation often means that the code base is getting progressively less open, and more difficult to work with. And especially as people move on and new developers have to take their place, the technical debt (ie maintenance) cost starts to soar. So in a sense, I actually think that it would be a good thing for our profession if a high level of need for code ownership were openly seen as a job smell (in the popular programmer imagination). Instead of it being seen as "taking responsibility and pride" in the work, it should be seen more as "entrenching oneself and creating artificial job security via technical debt". And I think the test (thought experiment) should basically be: what if the person (or indeed, the whole team) were to vanish off the face of the Earth tomorrow. Would this be a gigantic - possibly fatal - injury to the project, or would we be able to bring in new people, get them to read the doccos and help files and play around with the code for a few days - and then be back in business in a few weeks (and back to full productivity in a month or so)?


Applying the Art Gallery problem to optimal sensor placement

I am trying to design an algorithm for _optimal sensor placement_ in a given area. After doing some research I found the _Art Gallery Problem_. However, this problem assumes that the guards can see all the way to the perimeter from their positions, which is not the case with sensors (sensors have a range). Is it possible to solve the optimal sensor placement problem by mapping it to an art gallery problem, and trying some recursive solution? I would be grateful if someone could throw some light on this question or guide me to appropriate resource.


Recommendations for a web-based help system

I'm putting together a fairly large GUI. I'm a tech person, but more on the hardware side, not software. I'm wondering what software package would be best suited to enable me to generate a web-based help-system. Preferably it takes care of a lot of coding, allowing me to focus on the content. For example, the user would click on a link in the GUI when they have a question, that brings them to a web-based Help Guide, for example, providing an overview of how to use the GUI, perhaps a searchable index (key-word based index), table of contents, etc, for navigating through the Help Guide. My first thought was to program everything in XHTML using Dreamweaver, but my layout requirements are fairly modest (just figures and text, maybe a few equations), and I'd prefer not to spend a lot of time concentrating on the programming. Was wondering if any software existed that made generating web- based navigable pages easy to create/publish. Again, I'm not really a programmer, so if there's something obvious out there, I'm probably not aware of it.


Does taking a series of contracts hurt your career?

So I've been contracting for 6-7 months now. The problem I have is that I take a contract while looking for work and then don't want to bail on the people working in my contract. Then when the contract is up, I tell myself I'm going to take a contract while looking, etc. I'm concerned that if this trend continues it will not be good for my career. I'm particularly concerned about the fact that the contracts (3 to 6 months) aren't really long enough for me to participate in a full SDLC. Does taking a series of 3-6 month contracts make it more difficult to land a permanent, senior position later? For example, I can't imagine someone hiring a consultant to be a team lead. So if you are going from contract to contract, does it hurt your ability to eventually become a team lead?


Is there an antipattern to describe this method of coding?

I have a codebase where the programmer tended to wrap things up in areas that don't make sense. For example, given an Error log we have you can log via               ErrorLog.Log(ex, "friendly message");      He added various other means to accomplish the exact same task. E.G.               SomeClass.Log(ex, "friendly message");      Which simply turns around and calls the first method. This adds levels of complexity with no added benefit. Is there an anti-pattern to describe this?


Am I sending large amounts of data sensibly?

I am about to design a video conversion service, that is scalable on the conversion side. The architecture is as follows:   * Webpage for video upload   * When done, a message gets sent out to one of several resizing servers   * The server locates the video, saves it on disk, and converts it to several formats and resolutions   * The resizing server uploads the output to a content server, and messages back that the conversion is done. Messaging is something I have covered, but right now I am transferring via FTP, and wonder if there is a better way? is there something faster, or more reliable? All the servers will be sitting in the same gigabit switch or neighboring switch, so fast transfer is expected. EDIT:   The question goes on the server <-> server side of things. The servers are co- located in same LAN, so the security of the interconnection there is not expected to be the main issue.


Software trial: limited time or limited functionality?

I am currently developing my first serious piece of software in C#. It is a good learning experience so far. My software is basically a task scheduling tool with some advanced features and capabilities. I am not near the finishing stages yet, but I was wondering what people's opinions are on trial versions of software. Do you think it would be more beneficial, in general, to have a limited time trial (say 30 days) or a limited functionality version of the software? I think I know which I would go with, however I always like to listen to the opinions of others. Thanks,


entity framework 6 agnostic enough different sql server and OS platforms?

It's my first time using sql server, I usually go with MySQL, so I'm unsure how to do this. The project I'm assigned will be deployed to multiple platforms particularly PC's with different SQL server ranging from 2008 to 2014, some of them are express edition, some are standard edition and in Windows ranging from XP, 7, 8 and 8.1 for both x86 and 64 bit systems If I use entity framework 6 in my development PC, 64-bit windows 8.1 and SQL Server 2012 Express. Will this pose a problem during deployment?


How do you handle changes in client focus?

We are working on a large ongoing project that has continual feature changes. These features could take as long as 3 - 4 weeks to complete. This would of course be fine, except the client is always changing its priorities/focus based on pushes from THEIR clients who may want certain features implemented before others. So, we often have to shift gears in the middle of a major feature build and start a new feature that all of a sudden has a greater priority. We then of course have the time cost of merging everything together at some point, and also the cost of that lost momentum on the original feature. Our estimates are out the window at that point. Is there any good way to handle this? Some options I've thought of:   1. assume this is the way things will be, and apply a 'distracted client' factor of up to 100% on all estimates (this is dangerous in the case where we can actually complete a feature without interruption)   2. educate the client on the costs of shifting gears, and perhaps apply a change premium to previous estimates if they want us to change to working on a different feature   3. refuse to work on more than one feature/release at a time (aside from bug fixes). This is probably not realistic. I'm looking forward to hearing about how others have tackled this. It can't be uncommon.


Serving images from google cloud resized to 300x200

I am working on an application that uses Google Cloud storage to serve my app images. The images are submitted from an android app to google app engine code that is supposed to upload the images to gcs then create a link and update in my db. This works fine. The challenge am facing is i need different devices to serve the same image but in different dimensions. e.g device1 can request images to be served with size 300x300 while device2 can request the same image to be served with size 500x500. I have tried to google the issue but i dont seem to get a correct way to serve my image in different sizes but only got some url structure that will use a blob key then parse the size as a get parameter in the url and the image is cropped to the required dimensions. e.g. http://lh4.ggpht.com/TgjDT- cPRr6bjrpSVQeILk93o4Ouzjo1ygMB6KpmnCHhyH5vJKKRrqxCD2bC3T09CRIP6h5QFsV_l0hnhio5bN7z=s1000-c My images urls are in this format http://storage.googleapis.com/myappname.appspot.com/images/random_generated_imagename.jpg Can someone suggest an idea on how i can achieve this using the url that i have? I have tried reading image from the url, resizing it image to the size requested by the device then pushing back the image to the device but this looks tedious to me and utilizes alot of server resources given that i can have an average of 100 connections per second requesting for images.


Software licensing and code generation

I'm developing a tool that generates code from some various data. The tool itself will be licensed with the MIT license, which strikes a good balance for me in terms of allowing the freedom to use and modify it, while still holding the copyright. OK, but what is the legal status of the code _generated_ by the tool? Who holds the copyright for code generated by a tool? Do I need to give users of the tool a license for the generated code, or do they already have that by virtue of it being generated by them? What is different about this code generation system (which may be relevant) is that the source information about the code generation is provided by the system itself. The user doesn't feed source data in; the source data is bundled along with it. They simply have the means to transform it in various ways (filtering out parts of the data they don't want, etc). Obviously they could edit the bundled data. Does that affect anything about this?


What options are there to programmatically use windows application in VB.NET? (Button Press and Keyboard Strokes)

I have this complex windows application that I need to create an automated testing system for. I need to use VB.NET, and it needs to be able to click all kinds of things, be conscious of the windows that open in the application, the dialog boxes, and do the things that a human would do in this application. Through my research, I discovered FindWindowEx will be useful for me. I would appreciate any feedback as to what direction I should go on creating this automated testing system. (are there any function, libraries, or other built in stuff that can help me? If so, what are they) Thanks, Phil


Do we need Logging when doing TDD?

When doing the Red, Green & Refactor cycle we should always write the minimum code to pass the test. This is the way I have been taught about TDD and the way almost all books describe the process. But what about the logging? Honestly I have rarely used logging in an application unless there was something really complicated that was happening, however, I have seen numerous posts that talk about the importance of proper logging.   So other than logging an exception I couldn't justify the real importance of logging in a proper tested application (unit/integration/acceptance tests). So my questions are:   1. Do we need to log if we are doing TDD? won't a failing test reveal what wrong with the application?    2. Should we add test for the logging process in each method in each class?   3. If some log levels are disabled in the production environment for example, won't that introduce a dependency between the tests and enviroment?   4. People talk about how logs ease debugging, but one of the main advantages about TDD is that I always know what's wrong due to a failing test. Is there something I am missing out there?


Is it a good idea to do TDD on low level components?

I'm considering writing a low level driver or OS components/kernels. The osdev.org folks seem to think that the important bits are not meaningfully testable this way, but I have read some discussions where people thought differently. I've looked around, but have failed to find any real life examples of TDD on low-level components. Is this something people actually do, or just something that people talk about in theory because there is not a good way to do it in practice?