Do you have regularly schedule app updates? And if so how do you handle bugs that make it out?

We are trying to make our releases more frequent. As part of that we have blocked out a day of the week where we told users that we'll be doing updates. Similar how Microsoft has Patch Tuesday. This is for a web app running completely server side, by the way. So updates are not a huge problem to deploy. Though they can get time consuming. Occasionally an update has a bug that needs to be fixed before the next update window rolls around. I see two real options: either undo the update and restore a backup of the previous version, or make a fix and deploy it outside the scheduled time. Making a fix sounds easy, but often times there are other changes that have been made to the code base. And the fix needs testing before it can realistically go out. Rolling back isn't a bad option, but sometimes that will remove recent features or at least delay them until the next week.


Software markets for solo developer

I want to create something useful of my own which others can use it. This can be free or it can make a little money for sustaining its development and increase income little. However, when think about the market, I don't know what market is lacking applications, what types of domain can be possible for a solo developer or small development? For example, I can develop small game for the smartphone market, with me as the programmer, another person is graphic designer and another person is music composer, to create a functional and playable game. Or what types of domain/market in web development are possible for a single developer to produce a web application? Or should I include the forth person, business man to identify this for me? If you have experience on this, I would love and highly appreciate if you share for me and everyone. _EDIT:_ I want to do this as my part time job, not the main job until it's possible.


Change of the complexity class through compiler optimization?

I am looking for an example where an algorithm is apparently changing its complexity class due to compiler and/or processor optimization strategies.


What default features is Windows missing that are required for programmers?

What features is Windows missing that can improve the productivity of a programmer. I know a lot of people would want some features from Linux and OSX ported or being created for Windows as well. What is missing for you ? An example would be the option to have multiple workspaces. When not having the possibility to use dual monitors that can come in handy.


One language to rule them all? (Them being platforms.)

I have been discussing a project with a client and they want to use a single language to deploy to as many platforms as possible. (I am not sure that it's such a good idea, because each platform offers a different user experience and UI metaphor. In some cases, screen sizes vary as well. Also, iPhone is out of the running no matter what language we use. But, I digress...) The project is going to display an arbitrary block of text each day and will track if the user has "read" it. Some other features on the table are "nags" and the ability to go to another days' text. I know Flash from the CS3 days, and I think that translates into AIR, but I dont know if AIR can do what we want. On the other hand, I have (a) little experience with Java or Python, but those seem like good contenders also. Which language should I use here? Why? **Edit:** This is going to run on desktop platforms too.


A design decision in composition or aggregation

I've recently had doubts about some design decisions that I frequently make, so this time I decided to take some time and try to analyze it to find the best solution. I will describe a simple scenario where the design decision can be easily understood. :) Suppose we are developing a game in Java where players can have any number of many different types of items.               /** Class that represent an item type existing in the game */     // you may prefer to call this ItemType,     // but for me appending the word "Type" is not necessary     class Item {         private String descrip;         private Image icon;     }      In this situation I need to keep track of how many of each item the player has in his bag, so I keep a collection of them, in each element of which I have item type and quantity. Additionally one can think of other attributes that belong to that relation (perhaps a max capacity), but the question is: how do I model this scenario in general but with a practical implementation in Java? Here are two approaches I've come up with: ### Using a List               class Slot {         private Item item;         private int quantity;              /** Auto generated */         public int hashCode()         {             int hash = 7;             hash = 13 * hash + (this.item != null ? this.item.hashCode() : 0);             return hash;         }              /** This method is also auto generated and just compares the Item,              independent of quantity */         public boolean equals(Object object)          {             if (!(object instanceof Slot))             {                 return false;             }             Slot other = (Slot) object;             if ((this.item == null && other.item != null)                   || (this.item != null && !this.item.equals(other.item)))             {                 return false;             }                  return true;         }     }      The above class relates one item with a quantity, and a collection of `Slot`s is the primary attribute of the `Inventory` class. The disadvantages of this appear as soon I design the `Inventory` interface to not expose `Slot` to the client (making `Slot` private or hiding it in some other way): in creating a simple interface but providing access to all the standard collection methods. In my humble opinion there is nothing wrong with this:               /** Class that represent the bag that holds the player's items */     class Inventory {        // this collection holds only one element for each type of item        private ArrayList<Slot> slots;               public Inventory()         {             slots = new ArrayList<Slot>(10);         }              public void add(Item item, int quantity)         {             Slot slot = new Slot(item, quantity);             // if we don't already have a Slot for the added Item, add it             if (!slots.contains(slot))             {                 slots.addElement(slot);             }             // if we already have a Slot for the added Item, increase the quantity             else             {                 Slot _slot = slots.elementAt(slots.indexOf(slot));                 _slot.addQuantity(quantity);             }         }              public void subtract(Item item, int quantity)         {             Slot slot = new Slot(item, 0);              int index = slots.indexOf(slot);                  // only if we actually have this item             if (index != -1)              {                 Slot _slot = (Slot) slots.elementAt(index);                 _slot.quantity -= quantity;                      // if we have fewer of the Item than the number to remove,                  // remove the slot from the collection                 if (_slot.quantity <= 0)                 {                     slots.removeElementAt(index);                 }             }         }              public void remove(Item item)         {             Slot slot = new Slot(item,0);             slots.removeElement(slot);         }              public boolean hasItem(Item item)         {             Slot slot = new Slot(item,0);             return slots.contains(slot);         }     }      As you see, we have to jump through some hoops to implement certain collection methods: in `hasItem` we have to create a `Slot` element just for that operation. In the add and subtract methods, we have to create the `Slot` object just to check if it's there. I wonder if this really necessary. I suppose that it is if we desire to provide an interface to the standard collection methods. Perhaps we can move all this logic to another class (for example: `Slots`), exposing a cleaner interface that lets us search by item without the need of creating a Slot, but we are just moving the same problem to another class. We will face the same problem there, besides the fact that `Inventory` is basically a set of `Slot`s, we're really just creating another class to be exactly the same thing, which doesn't make a lot of sense to me. Would it be more correct to change the interface of this class to work directly with `Slot` class instead? This implies moving from composition (having `Slot`s created within Inventory) to an aggregation (having `Slot` creation outside of Inventory). The result might look like:               /** Class that represent the bag that holds the player's items */     class Inventory {        private ArrayList<Slot> slots;              public Inventory()         {             slots = new ArrayList<Slot>(10);         }              public void add(Slot slot)         {             if (!slots.contains(slot))             {                 slots.addElement(slot);             }             else             {                 Slot _slot = slots.elementAt(slots.indexOf(slot));                 _slot.addQuantity(slot.getQuantity());             }         }              public void subtract(Slot slot, int quantity) // how would the client get the Slot?         {             int index = slots.indexOf(slot);                  // only if we actually have this item             if (index != -1)              {                 Slot _slot = (Slot) slots.elementAt(index);                 _slot.quantity -= quantity;                      // if we have fewer of the Item than the number to remove,                  // remove the slot from the collection                 if (_slot.quantity <= 0)                 {                     slots.removeElementAt(index);                 }             }         }              public void remove(Slot slot) // again, how would the client get the Slot?         {             slots.removeElement(slot);         }              // Hard to change a parameter type here. This strongly suggest there is         // a flaw in the design. I only keep this here to communicate the observation         public boolean hasItem(Item item)          {             Slot slot = new Slot(item, 0); // here we have no choice but to create it             return slots.contains(slot);         }     }      But again, is this convenient? I don't often put this approach into practice, so I'm not sure. ### Using a lookup Another approach is to use something like a Hashtable with `Item` objects as keys quantities as values, so only quantity is associated with Items, without the need for a `Slot` class. An `Inventory` implementation using Hashtable might look like:               public class Inventory     {         private Hashtable items;              public Inventory()         {             items = new Hashtable(10);         }              public void add(Item item, int amount)         {             int stock = amount;             if (items.containsKey(item))             {                 stock += ((Integer) items.get(item)).intValue();             }             items.put(item, new Integer(stock));         }              public void subtract(Item item, int amount)         {             if (items.containsKey(item))             {                 int stock = ((Integer) items.get(item)).intValue();                 stock -= amount;                 if (stock > 0)                 {                     items.put(item, new Integer(stock));                 }                 else                 {                     items.remove(item);                 }             }         }              public void remove(Item item)         {             this.items.remove(item);         }              public boolean hasItem(Item item)         {             return this.items.containsKey(item);         }     }      To me this seems much better than using a List because there is no need of the `Slot` class, and all interactions with the `Item` collection are much simpler, but I'm not sure if I'm right. The same type of problem is also evident in this scenario: Suppose that we are implementing an order application for a pizza shop; every order consists of types of pizzas and quantities.               /** Type of pizza */     class Pizza {         private String descrip;         private Image icon;     }          /** Customer request for pizza */     class Request {         // for each type of pizza we have to keep a count of how many the customer ordered     }          /** A pizza order */     class Order {         private Pizza pizza;         private int   amount;         privete BigDecimal price;     }      Knowing how to solve the first problem, I have a pattern to use for this similar situation; so the question is, what solution is best? I try to convince myself that I'm not the only person with this concern, that ordinary people like me face this problem on a regular basis, so I hope to find how other people solve this problem. On the other hand, I know that this question is quite big and maybe a little elaborate, so maybe I need to split it into several more specific questions. Maybe the answer to this problem is simple I'm over-complicating things, or even worse, my doubts about how to handle this situation arise because I really don't understand some basic design principle, like a captain on a ship using a spyglass in order to sight land but doesn't realize that his ship has been beached on solid ground that was close at the moment he draw his spyglass to look. Okay, enough cheap poetry (but it was hard to describe my feelings without it hehehe). I apologize for the length of the question, and would very much appreciate anyone's help with this problem.


Want to know performance issues of Class types & access modifiers

Someone suggested me to mark classes as SEALED that are not being inherited anywhere. I was using default style and was not concerned with the type of class. At present I don't have a benchmark tool to study the performance gains but read somewhere that Sealed Classes give performance benefits. Is this performance issue applicable to other class types like: Abstract, Static, New etc. and also with access modifiers like public, protected, internal, protected-internal and virtual? If it does make difference in performance, what type of optimization is done internally?


Is there a point to unit tests that stub and mock everything public?

When doing unit tests the "proper" way, i.e. stubbing every public call and return preset values or mocks, I feel like I'm not actually testing anything. I'm literally looking at my code and creating examples based on the flow of logic through my public methods. And every time the implementation changes, I have to go and change those tests, again, not really feeling that I'm accomplishing anything useful (be it mid- or long-term). I also do integration tests (including non-happy-paths) and I don't really mind the increased testing times. With those, I feel like I'm actually testing for regressions, because they have caught multiple, while all that unit tests do is show me that the implementation of my public method changed, which I already know. Unit testing is a vast topic, and I feel like I'm the one not understanding something here. What's the decisive advantage of unit testing vs integration testing (excluding the time overhead)?


Designing an scalable message queue architecture

I have recently started learning the nuances of scalable and enterprise computer architecture, and one of the central components is a messaging queue. In order to learn the most I can from any programming paradigm, I am trying to implement my own version of a messaging queue service. So far, my initial design runs on a threaded socket listener, but in order to prevent the same message being downloaded twice by two separate processing nodes, the message queue index register is locked when a read is initiated, and unlocked after the register has been updated. As such, this negates the need for it to be threaded, and means that there is a ceiling for the size of a scalable system based on the processing speed of the server the messaging queue service is running on. The way to get around this would be run the message queue service on multiple servers, but this will increase the likelihood of the same message being downloaded twice. The only way to prevent such issues occurring would be to include a revocation callback that (after the servers, or even the threads on a single server, have synchronized their information and detected such a re- issuance) would command the processing node to stop its current job, and re- query the message queue for the next message, but again, there would be a ceiling where most of the traffic being sent would be synchronizations, and revocation callbacks, causing a bottleneck and slowing the processing of information so that a lot of the processing nodes would be performing null operations and wasting time. The last way I can think of to get around this problem is to have each message queue server (and each thread on each server) would have a specific offset as to where in the queue it is looking, but that might have issues based upon the type of application, especially if the processing is required to be done in a specific order. So, all that being said, are there any designs of message queue architecture's that could show me how existing enterprise grade message queue services avoid these problems?


Is there a cleaner way of caching data

We've started implementing some caching code in our MVC project. We've derived from .Net's ObjectCache to store it in a SQL database. What we do right now is in each method we want to cache we have code like this:               public StatusCounts GetCounts()     {        var cache = new SqlCache<StatusCounts>("mykey");        if(cache.HasCachedData())           return cache.GetCachedData();             var data = StatusRepository.GetCounts();             cache.SetData(data, DateTime.Now.AddHours(2));     }      As far as caching goes, it works. But my concern is it seems like now GetCounts has multiple responsibilities. It's no longer just calculating counts, it's getting them from a cache (if they exist) and saving them to a cache before returning. Is there a cleaner way to do this?


Examples and resources for writing a development proposal for a client

We're looking into our processes and client relationships at work and part of this is creating a standardised template for our development proposals that we send to clients. The development areas we cover are mainly web development and design and mobile application development. On top of this we also offer native software developments for small to large companies. What we are aiming for is a template for each development area, something we can base future proposals on. How do you go about writing something like this? Are the resources to help on the internet? More importantly maybe, what would you guys say is important to include in a proposal? This is normally pre-"indepth technical spec", but I would suggest (for instance) including a wireframe or mockup of the finished product. How detailed must you be in order to portray the project to the client and understand the needs of the project yourself in order to charge accordingly?


Windows Phone 7 dev: C# or silverlight for a simple app?

I'm about to hire a programmer to develop Windows Phone 7 apps. The current app that shall be developed is quite simple.   * The app will download content from a Web-API.    * There are two lists to select content.    * There is a single item content page.    * Users can rate the content and upload photos. The screens will be produced by our artist. I am pretty sure that most of the available programmers haven't touched WP7 development yet. **Now the questions are:**   1. What technology is suitable for this kind of app?   2. What technology requires less research, learning and production time?   3. Do you already have experience of limitations of silverlight compared to C#? (I am also thinking of future projects)   4. My guess is that silverlight programmers are more experienced in UI programming than C# coders. Do you feel the same way?


For very short programming jobs, how should one approach the concept of a contract?

I am wondering what other contractors in the field of software development do when a potential client approaches them with a spec.. in terms of contracts. In my experience, clients will often be happy to proceed with no formal agreement. I know this is quite an open ended question, so I will break it down into a series of subquestions that can be actually answered. If the client does not have a contract for you to sign, do you present a physical contract to them? If you have such a contract to present to clients, how did you acquire such a thing? Obviously you can pay through the nose to have a lawyer write it, and other obvious answers, but are there other reasonable (cost effective?) solutions to acquiring such a contract? At what stage, if any, would you require the client to physically sign such a contract? (what if the job is just one day?) In some cases, the software you are providing to the client is a customized version of an off-the-shelf, open-source, or proprietary in-house software, how does this affect things? _I realise that the best answer is probably "It depends on the client, and other factors..", you don't need to tell me that. But what are your experiences and opinions about 'best practices' in this area? Or to put a programming slant on it, do you have a reliable algorithm for managing the contract side of things, ie keeping both sides happy, most of the time?_


Prefer algorithms to hand-written loops?

Which of the following to you find more readable? The hand-written loop:               for (std::vector<Foo>::const_iterator it = vec.begin(); it != vec.end(); ++it)     {         bar.process(*it);     }      Or the algorithm invocation:               #include <algorithm>     #include <functional>          std::for_each(vec.begin(), vec.end(),                   std::bind1st(std::mem_fun_ref(&Bar::process), bar));      I wonder if `std::for_each` is really worth it, given such a simple example already requires so much code. What are your thoughts on this matter?


When to skip solving the general problem and settling for the specific problem?

I've been working hard on trying to develop a general solution to my problem, but I cannot seem to formulate a proper algorithm for it, at least one that doesn't take a ton of inaccurate grunt work building a lookup table. I have a solution already for the specific requirement, but it requires the software's configuration to be changed every time the software is loaded with a different geographic area's datasets. So is it better to be finished and move on for now, or to keep attempting to solve the general problem knowing that the specific problems will keep popping up?


Are there any compilers that attempt to fix syntax errors on their own?

I heard a while back that there used to be a compiler that attempted to fix syntax errors by analyzing context and inferring what was intended. Does such a compiler really exist? Obviously it has little practical value, but would be very interesting to play with and learn from.


Should selenium tests be written in imperative style?

Is an automation tester supposed to know concepts of OOPS and design patterns to write Tests in a way where changes & code re-use are possible? For example, I pick up Java to write cucumber step definitions that instruct a selenium webdriver. Should I be using a lot of inheritance, interfaces, delegation etc. to make life easier or would that be overly complicated for something that should just line by line instructions?


For performance critical situations is storing file metadata in a database better?

As per the title of this question, for extremely performance critical situations, is storing a file's metadata (e.g. location, size, download on, etc) in a database going to allow for better performance than attempting to get it from the file system itself? Have there been any case studies into this problem? To provide a bit more detail on a specific situation, the application needs to mirror terabytes of data (hundreds of files) between a remote site on a continual basis and the current program architecture uses Unix commands (i.e. `ls`) to determine which files needed to be updated. The file themselves are split between Isilon IQ clusters and Sun Thumper clusters which I have been told good throughput but poor metadata performance. As the application will be the only process to have write permissions to the files we aren't concerned with things getting out of sync, but we are concerned with performance as it currently takes between six and ten hours to transfer the data.


Can an open source solution match or surpass Team Foundation Server's features?

Team Foundation Server offers a version control system, but with many more side features, such as bug tracking, user stories, project planning, and it is all integrated into visual studio. Someone put a more complete list of features over here: Over the past year I have been working with Mercurial and from the moment I typed "hg init" I was in love. My new colleagues are convinced that even though other scm solutions are probably better, TFS provides a better complete package for teams. What I would like to know is whether it is better to just use TFS, or to go the open source route and select various solutions and integrate them to get a better result, and if its even possible to get that level of integration? So in summation: Can it be done and is it better to go for various OSS tools?


What is a reasonable and secure password requirement for user registration?

This is the password policy I just got from UPS (just for package status checking): > Your password must be between 8 and 26 characters long. It must contain at > least three of the following character types: lowercase letters, capital > letters, numerals, special characters, or spaces. The password may not > contain your User ID, your name, or your e-mail address. (SSO_1007) I actually have to wrack my brain somewhat to generate this password, but not only that, most importantly, I am sure that after 3 days I will forget what this password is. Users won't be so happy. Password reset can be frequent. I think users will try to avoid using the site unless they have to. What is a reasonable and secure password policy when setting up a website? I think some companies may fear some hackers trying passwords a million times or more, so they add all those requirements for "special characters, lower case, upper case", but won't it be reasonable to turn off the account or just disable the password and require a password reset if a user has tried 30 times or 100 times? Or, add a 5 second delay each time after the user tried 30 times? If so, then those special characters won't be that much needed.


In need of a more technical answer for an interview question about how the internet works from beginning to end

I've had interviews with 5 separate people over the past two weeks and three of those five have all asked me this question: _Explain what happens between hitting "Google.com" and the page coming up on the screen._ Basically, how the Internet works. I figure after three times that I better be prepared if I ever get this question again. I know _some_ things, but I'm not fully convinced that my answer is good enough. Basically, I mention that the DNS server translates "google.com" into an IP address. I kinda gloss over TCP/IP, then talk about the web server literally serving up requested pages that get sent back to the browser which the browser then interprets and displays. As I said before, I'm not convinced my answer is technical enough. What are the steps that I'm leaving out? For what it's worth, two of those three times have been with the same company and I'm being called back for a third interview with them, so I can't have bombed it _too_ hard.


Why aren't design patterns added to the languages constructs?

Recently I was talking with a colleague who mentioned that his company was working on adding the MVC design pattern as a PHP extension. He explained that they wrote C code for adding `Controllers, Models and Views` to the language constructs to increase performance. Now I know that MVC is an architectural design pattern that is used widely in web applications, but I still have to come across languages that have a language construct for Controllers for example. IMHO integrating design patterns into a language can emphasize the importance of good OO design. So, **Why aren't the most used design patterns (MVC, Factory, Strategy,...etc.) added to the language constructs?** If the question sounds too broad then you may limit the question to PHP only. **Edit:** I'm not implying that one **must** use a design pattern when developing a project. Actually I promote the methodology of keep it simple as long as it works.


Issue with scrum adaptation by team

I have been playing with Scrum methodology since year and half. I am using VersionOne as scrum tool. I have tried to follow most of the scrum principles. Sometimes, I feel like there is an issue with transparency of the stories. As of now, the whole team can get an access to all stories defined for the project. This creates issues with different levels of developers like junior and senior level developer. People's complains are about the work distribution or type of work they are assigned to. There is an issue of comparison among the developers. I don't know if I am following scrum properly or not. In scrum, should we give access of the all stories to everyone? or only assigned person can view his/her story?


What makes a great user management interface great?

I'm currently working on user management for a project and while thinking about how I should design this I realised that there's really no standard in how these things look as it often vary a lot from application to application. So what makes an great user management interface great? What do the best ones have in common?


Why does Java not do type inference?

I have always wondered why Java does not do type inference given that the language is what it is, and its VM is very mature. Google's Go is an example of a language with excellent type inference and it reduces the amount of typing one has to do. Is there any special reason behind this feature not being a part of Java?


Do integrated systems increase development time and cause inflexibility?

I work for a large financial company that manages money for thousands of clients. This company has very complex business processes and they operate in a very dynamic environment. This is a fairly old company and over the years they have implemented many heterogeneous systems to automate processes within the company. There are rumors in the company that there may be an effort to move to "a system" (re-written from scratch) that consolidates the many disparate systems in place now. Debate has arisen that questions the value of such a move:   One side claims a single system is easier and cheaper to maintain due to greatly reduced redundancy i.e. properly factored business logic, unified data model, reusable UI components, etc. Other side claims that the company, clients, and products (financial instruments) are too complex and too dynamic to be pigeonholed by one system. Single system will risk breakages in one component when another is modified. There is no way and no reason to consolidate business logic because it is too client- and product-specific. Time to implement changes will increase because multiple higher level components will be affected by changes to lower level components. Question: Should the company seek to invest time and resources in creating a unified data model, factoring business logic and creating reusable code at all layers? Or should they "copy and modify" in order to speed development time, reduce the chance of regression, and reduce complexity? Is there a false dilemma presented here (i.e will there be a net change one way or the other and does one answer necessarily preclude another)? To be clear, this really a matter of **long term goals and priorities** , not about a specific product design. The company will never eliminate a certain amount of redundancy and it would not be desirable for them to do so.


How important is an in-depth knowledge of the Common Language Runtime to a .NET developer?

I wonder how many .NET developers have a working knowledge of CIL and where it has been useful to them. In case you are missing my meaning, here is a simple CIL example to add two locations together:               ldloc.0     ldloc.1     add     stloc.0    // a = a + b or a += b;


How do I Integrate a Former Team Member into the Current Team

Is it possible to re-integrate a former team member into a software project? We have a product with a looming customer deadline and we don't have enough hours to get it done! We have a former employee who left on excellent terms and wants to come back. They are familiar with the codebase and architecture (which has not changed significantly since they left). Can we use this situation to avoid Brooks Law? It seems like an ideal situation, team member up to speed with processes, tools, etc. What do we need to be careful of? Are there any dragons in the water? Or should we expect smooth sailing?


Is Rule 9 of Object Calisthenics applicable in Objective C?

Rule 9 in Object Calisthenics by Jeff Bay (RTF) is: > **Rule 9: No getters/setters/properties** > > The last sentence of the previous rule leads almost directly to this rule. > If your objects are now encapsulating the appropriate set of instance > variables but the design is still awkward, it is time to examine some more > direct violations of encapsulation. The behavior will not follow the > instance variable if it can simply ask for the value in its current > location. The idea behind strong encapsulation boundaries is to force > programmers working on the code after you leave it to _look for_ and _place_ > behavior into a single place in the object model. This has many beneficial > downstream effects, such as a dramatic reduction in duplication errors and a > better localization of changes to implement new features. > > Another way this rule is commonly stated is “Tell, don’t ask”. I get the point of the rule. But I find it only useful in garbage collected environments where modifying a reference is very simple. Will this be of any help in Objective C? Because it's always important to let only setter change the ivar and let it also take care of retaining new value and releasing the old one. and use the setter anywhere inside methods to alter ivars which are pointers.


How to let  teammates know what  changes I made to an object?

Suppose I have a PHP object, let's say: companyObj.               class companyObj     {       private company_name;       private company_address;            public function print_contact()       {         //logic       }     }      This is the object I wrote, and shared with the teammates. Now I would like to make it more powerful, like this:               class companyObj     {       private company_name;       private company_address;       private company_contact_person;            public function print_contact()       {         //logic updated       }     }      Now, how can I notify my teammates that my object had more attributes that they can set? Instead of sending e-mail to everyone in the development team, how do I make the team know what's going on, when I don't want my teammates to waste their time to look at what is changed at the source code level?


NP complete or NP hard problems in real life

Does anybody have real life examples where they regularly solve NP complete or NP hard problems (by heuristics, or chasing a suboptimal solution or whatever) in their job? I know they occur in scheduling, planning, VLSI design, etc., but I am trying to get an idea of the major industries employing programmers or engineers today that regularly do this. If one were to develop expertise or a library, in say, combinatorial optimization where could one use that as part of a programming job? Any personal accounts?


Components under what licenses can I use in my paid app?

I'm working on an application and I need to use some existing components such as libraries and JavaScript frameworks that are covered by licenses. My application will be paid (not free) and closed-source. Can I use components in my app that are under one of following licenses:   * MIT   * Apache   * BSD


Why does gmail use java? Is there really a advantage over something like php or python?

Note: I know that none of you (probably) work for google, so this is a lot more of a conceptual question. So yeah, i discovered that Gmail uses java and that got me thinking, Why? I personally never really learned java and am familiar with C/C++, Python, Php e.t.c But what i dont understand is why do some websites use languages such as java? (Note: This is in no way a thread saying one language is better than the other). What i want to know is why do some websites such as Gmail use java and similar languages?What advantages/disadvantages come with using java/similar languages over languages such as php/python/ruby for web development? Ps: I know that some sites prefer to compile their code for optimization(Like facebook's hiphop)


Recommendations on what technology to use to call REST API

I'm creating a small web-site that needs to call a REST API to retrieve some JSON and display it. What is the best tool for this job? There are so many Javascript libraries available now it is difficult to decide which one to choose. Is there are particular library that people would recommend that will do what I want both efficiently and without extensive development effort.


Given a situation, and some conditions, verify is that situation is possible

Well it's a problem me and my friend had thought of, and well, haven't come up with anything to solve the following problem(I'll try to phrase it in the best way I can): > Given that there are `n` number of teams, and the number of matches each > team has played, and that no team can play more than 2 matches with any > other team, predict if the distribution of matches played by each team is > possible. P.S. : I am a Python Programmer, so (if possible) post only python code for explaining..


Does keeping a journal help in your job?

Years ago, in my first real programming job, my boss encouraged me to keep a journal of my daily activities. I still do so, although no longer a paper and hand-written one. Do you keep a journal, if so, what do you write in it, and how does it help you in your job? Or, does it just take time that is not ever recovered?


Should code and data be treated seperately?

Is it really necessary to differentiate between code and data ? Is there any language where such differentiation is not there ?


What is the Best Collation for Use in MySQL Tables?

I'm curious what is considered the standard today for use as the Collation of MySQL Tables? I was told that Latin-1 was the best choice when I was beginning with MySQL, but came across this post from 2009. It states that US-ASCII and LATIN-1 Character Sets are on the way out, and that UTF-8 is on the way in and should be made the default by MSQ version 6. Does this gel with what you know, or with what you think, or with what you do? For this question, let's assume there is no specific need for non-english characters.


Hibernate building HQL queries

I just read hibernate reference and they say that you should use constans for HQL queries. However that is not always possible, for example if you do search function and have 10 criterias (not jpa criterias, just columns you are searching by). I bet you can do some hacky HQL that is transformed into badly performing SQL, but I feel that is not the best choice. I do know you can use The Criteria API, but its not as powerfull as HQL and some people just don't like it (I'm one of them). How you do it in Yours applications? I mean code like (its just an example!)               String hql = "from Biuro where ";     List parameters = ...     if (dateFrom!=null){        hql += " dateFrom>=? ";        parameters.add(dateFrom);     }


Strategy/algorithm to divide pot to chips

I want to split poker pot to chips. Example: Pot = $17.500. I have the endless piles of chips. I have the following types of chips: ChipsTypes = [$1, $5, $10, $25, $100, $500, $1.000, $5.000, $10.000, and so on]. Index starts from 0. I want to get an array that says which chips I have to take to divide the pot and in which order to have minimum number of denominations and chips after pot-to-chips conversion. For example Result = [7, 5] means that I have to take 3 * $5.000 + 5 * $500 which $17.500. Is there is any strategy or algorithm that would suit my need?


Starting developer fighting with webforms, is moving to MVC a good idea?

A young developer frequently hits me up for help with Asp.net web forms. Usually his problems revolve around the actual controls and how to manipulate them, rather than pure middleware type code. Since I work with Asp.Net MVC quite a bit I usually see simpler solutions to his problems, but he can not implement them because of the structure he is working in. I have discussed this with fellow developer, and he feels that it would not be a good move. His reasoning is that if you remove the structure that web forms provides, the young developer will flounder and not be able to do anything. I, on the other hand, feel that by removing the built in abstraction of web forms and their associated controls, and just focus on HTML and the code he will be more successful in his projects. Would it be a wise move for a developer in this situation to move away from web forms and start to learn Asp.net MVC?


Understanding comparison using Big O notation

I was going through this heavily discussed and highly voted question on SO and stumbled across one comment that got 5 upvotes. So I assume this was a great comment.But it got my head spinning at the same time. Can any one explain this comment? The comment says: > You can't compare big-O values directly without thinking about constant > factors. For small lists (and most lists are small), ArrayList's O(N) is > faster than LinkedList's O(1).


Testing-related methodologies except TDD/BDD

Are there any testing-related methodologies except TDD/BDD? I see a lot of people who practice their own testing approaches (e. g., see Ayende post), but I don't see any formalization for it, no naming for these approaches.


Is functional intellisense and code browsing more beneficial than the use of dependency injection containers

This question is really based on PHP, but could be valid for other dynamically typed, interpreted languages and specifically the methods of generating code insight and object browsing in development environments. We use PHPStorm, and find intellisense invaluable, but it is provided by some limited static analysis and parsing of doc comments. Obviously this does not lend well to obtaining dependencies through a container, as the IDE has no idea of the type returned, so the developer loses out on a plethora of (in the case of our framework anyway) rich documentation provided through the doc comments. So we start to see stuff like this:               $widget = $dic->YieldInstance('WidgetA', $arg1, $arg2, $arg3, $arg4...));     /**      * @var $widget WidgetA      */      So that code insight works. In effect the comments are tightly bound, but worse they come out of sync when code is modified but not the comments:               $widget = $dic->YieldInstance('WidgetB', $arg1, $arg2, $arg3, $arg4...));     /**      * @var $widget WidgetA      */      Obviously the comment could be improved by referencing a Widget interface, but then we might as well use a factory and avoid the requirement for the extra typing hints in the comments, and dic complexity / boiler plating. Which is more important to the average developer, code insight / intellisense or 'nirvana' decouplement?


C++ project organization to reduce unit testing build time

I want to organize tests for a project large enough that build time matters (especially for the CI server). Say I have this code that I would like to test :               //foo/greet.cpp     #include <stdio.h>     #include "foo/greet.h"     int greet() { return printf("Hello, World!\n"); }      And I have this main program that is boilerplate that I will not test.               //main.cpp     #include "foo/greet.h"     int main() { return greet(); }      I will use this code to generate a unittest program               //testgreet.cpp     #include <some_test_framework.h>     SOME_TEST_FRAMEWORK("Testing greet")         SOME_TEST_FRAMEWORK_ASSERT(greet() > 0)     SOME_TEST_FRAMEWORK_END()      I thought of the following   * Skipping the build of `greet.cpp` for the unittest target, and linking with the objects   * Create a separate project structure for the tests, but share the output folder   * Pile everything in one place, maybe with a new folder named test   * Make a `greeting` library and link both main and unittests targets to it How can I organize my project so that I can build `greet.cpp` only once, yet reduce confusion caused by having two targets that share a lot of code ? This question is related, but not duplicate (IMHO). (+I tried making my question generic, reusable and future proof. If you think that this is too opinion based, vote to close and I will not repost)


What are the most efficient code review processes?

I am looking for an efficient code review process where nothing can be pushed without being reviewed by another dev. For instance (we are using Mercurial):   * push to another branch and the reviewer will merge with the 'head'   * push directly to the reviewer The main issue here is that everybody can push to the default branch, so it doesn't enforce the code review.


Any basic difference between Unix and Linux in design and other aspects?

I keep reading this sentence: > Linux is a Unix-like system, but it is not Unix. I don't know what's the real difference between the two. I know Linux got a lot of ideas from Unix and the licenses of the two are different. Apart from that, as I am not an expert in either one of them, I want to know whether there are basic differences between them in design or other significant aspects.


How to learn microcontroller programming?

I am interested in learning how to program microcontrollers. It seems to be quite interesting, but I don't know, where to start. I am particularly interested in:   * What platform is worth learning?   * Are there any cheap systems that make it easy to write own programs for them?   * Pointers to good books / tutorials


What are good books for learning C++11?

I'm just starting to get interested in C++11 (late I know). Does anyone have any recommendations for books available that cover the new features in depth?


Python - 'if foo in dict' vs 'try: dict[foo]'

This is less a question about the nature of duck typing and more about staying pythonic, I suppose. First of all - when dealing with dicts, in particular when the structure of the dict is fairly predictable and a given key is not _typically_ present but sometimes is, I first think of two approaches:               if myKey in dict:         do_some_work(dict[myKey])     else:         pass      And of course Ye Olde 'forgiveness vs permission' approach.               try:         do_some_work(dict[myKey])     except KeyError:         pass      As a journeyman Python guy, I feel like I see the latter preferred a lot, which only feels odd I guess because in the Python docs `try/excepts` seem to be preferred when there is an actual mistake, as opposed to an, um… _absence of success?_ If the occasional dict does not have key in myDict, and it is _known that it will not always have that key,_ is a try/except contextually misleading? This isn't a programming error, it's just a fact of the data - this dict just didn't have that particular key. This seems particularly important when you look at the try/except/else syntax, which looks to be really useful when it comes to making sure that try isn't catching too many errors. You're able to do something like:               try:         foo += bar     except TypeError:         pass     else:         return some_more_work(foo)      Isn't that going to lead to swallowing all kinds of weird errors that are probably the result of some bad code? The above code might just be preventing you from seeing that you're trying to add `2 + {}` and you may never realize that some part of your code has gone horribly wrong. I don't suggest that we should Check All The Types, that's why it's Python and not JavaScript - but again with the context of try/except, it seems like it's supposed to catch the program doing something it shouldn't be doing, instead of enabling it to carry on. I realize the above example is something of a straw-man argument, and is in fact intentionally bad. But given the pythonic creed of `better to ask forgiveness than permission` I can't help but feel like it begs the question of where the line in the sand actually is between correct application of if/else vs try/except is, in particular when you know what to expect out of the data you're working with. I'm not even talking about speed concerns or best practice here, I'm just sort of quietly confused by the perceived Venn diagram of cases where it looks like it could go either way, but people err on the side of a try/except because 'someone somewhere said it was Pythonic'. Have I drawn the wrong conclusions about the application of this syntax?


Module vs. Package?

Whenever I do `from 'x' import 'y'` I was wondering which one is considered the 'module' and which is the 'package', and why it isn't the other way around?


Why is it recommended to close all programs before installing a new program?

What kind of problems arise from installing a new program while other programs are running? I'd imagine the GAC solved a lot of the old problems of shared dll's being locked. So what kind of issues still arise? I can see issues with upgrading a single program for sure, but outside of this its hard to see why apps would stomp on eachother's toe's.


What is involved in learning Eclipse-RCP, from zero Java background?

I've not yet started working on a new project where everything is done with "Eclipse RCP" which I never heard of until last week. We'll use lots of Java and SWT for GUI. I'd like to get up to speed on this new technology ASAP. (Or else I'll be the company "coffee boy" for the next several months...) Given a starting point of zero Java experience, zero use of Eclipse and zero use of SWT, zero computer science background (I'm into physics, engineering and art) and only modest experience working on the applications level in any sense, but OTOH, years of low-level programming and doing various neat cutting-edge things in areas that don't overlap at all with the Java or Eclipse worlds, how big a chunk of learning curve do I need to climb? To be clear, while I need to become more fluent in Java, and learn the end user basics of Eclipse and beyond, I don't need to learn the fundamentals of programming, OO, what a "compiler" is, etc. and am an old pro at Linux, C++, event-driven GUIs and much more. How to guesstimate how many days I'll need to become competent at working on Eclipse-RCP based apps? (No need to become a master guru. Of course that comes with time.) How to judge my level of skill along the way? How might I come up with a checklist of topics I should cover? What to tell the boss about when I'll be ready to work on this thing? What books, tutorials, etc are good for this learning curve climb? (No budget for classes, workshops, or books pricier than what I can get at Barnes & Noble.) (Actually I do have some modest experience in Java, but let's pretend it's zero, to make the question and answers more fun and useful to others.)


Handling requests RESTfully?

There is a push in modern scripting frameworks to use RESTful request routing instead of a one-size-fits-all URL path routing.               respond('GET',    '/posts',       callback);     respond('POST',   '/post/create', callback);     respond('PUT',    '/post/[i:id]', callback);     respond('DELETE', '/post/[i:id]', callback);      vs               respond('/posts',       callback);     respond('/post/create', callback);     respond('/post/[i:id]', callback);     respond('/post/[i:id]', callback);      I must confess that I am still using the old-and-busted method where the resource is accessible at the given URL regardless of the request type. **Is there anything I'm missing by using the old format?**


Ruby module namespacing advice

in my current project have:               module Stats            class Site         ...       end            class Product         def initialize(product_id)           @product_id = product_id         end       end            class Profile         ...       end          end      now in my `Product` class have methods to get/set product `views`(day, week, month) and methods to get/set product `sales`(day, week, months) is better to namespace like `Stats::Product::Views` and `Stats::Product::Sales` or simply prefix methods like `sale_add` and `view_add`? example calls with namespace:               Stats::Product::Sales.add(product_id) # increment sales counter      Stats::Product::Sales.today(product_id) # get n. today sales       Stats::Product::Sales.week(product_id) # get n. week sales            Stats::Product::Views.add(product_id) #increment product page view counter     Stats::Product::Views.today(product_id) #get n. today product page views     Stats::Product::Views.week(product_id) #get n. week product page views      example with current structure:               Stats::Product(product_id).sale_add # increment sales counter      Stats::Product(product_id).sales_today  # get n. today sales      Stats::Product(product_id).sales_week # get n. week sales           Stats::Product(product_id).view_add #increment product page view counter     Stats::Product(product_id).views_today #get n. today product page views     Stats::Product(product_id).views_week #get n. week product page views      Now, what you think is more elegant solution? and why?


Manual memory allocation and purity

Language like Haskell have concept of _purity_. In pure function, I can't mutate any state globally. Anyway Haskell fully abstracts memory management, so memory allocation is not a problem here. But if languages can handle memory directly like C++, it's very ambiguous to me. In these languages, memory allocation makes visible mutation. But if I treat making new object as impure action, actually, almost nothing can be pure. So purity concept becomes almost useless. How should I handle purity in languages have memory as visible global object?


Adding Methods In Addition to an Interface

Let's say I have `ThingImpl` and `IThing`. The former is an implementation of the latter, which is an interface. IThing has 1 method: `do(arg1)` Is it considered a hack/bad practice to add a method in addition to do()? Example: `do(arg1, arg2)`


The bracketless if statement is frowned upon, but is it still bad style if your IDE is equipped for it?

This type of conditional statement is generally frowned upon               if(condition)       statement;      because if you add another statement, like this               if(condition)       statement;       statement;      it gives the impression that the second `statement` is part of the `if` block when it isn't. That said, my IDE does automatic indentation, which I think makes this problem moot. Furthermore, when I want to add another statement, it automatically does the bracket completion--which makes the issue about having to manually add brackets when you want to add another statement moot. Is there any reason why this would still be bad style?


If I am developing a hosted payments page, what should the infrastructure look like?

If I am not storing credit card info, do I have to be concerned with PCI- compliance? I will be using a payment processor with a bank in my country. Literally just taking the credit card info and passing it to the gateway and processor. I would love to get an idea of the various technologies I might need to consider from an software architectural point of view. What are the best practices in terms of accepting credit cards and reducing fraud risk on my end? I will be creating the app in Rails.


What to do if I hate C++ header files?

I was always confused about header files. They are so strange: you include .h file which doesn't include .cpp but .cpp are somehow compiled too. Recently I joined a team project, and of course, both .h and .cpp are used.   I understand that this is very important, but I can't live with copy-pasting every function declaration in each of multiple classes we have. How do I handle the 2-file convention efficiently?   Are there any tools to help with that, or automatically change one file that looks like example below to .h and .cpp? (specifically for MS VC++ 2010)               class A     {     ...         Type f(Type a,Type b)         {             //implementation here, not in another file!         }     ...     };          Type f(Type a)     {          //implementation here     }     ...


Is api user authentication with oauth possible for both email/pw and 3rd party services

I have an api only application (rails-api) and I'm looking to authorize a user on both email/password or 3rd party services like facebook or twitter etc, so I know I will have to use Oauth at some point. My question is, can I solely use Oauth, or do I have to implement my own authentication (or something like Devise) to do the manual email auth. I don't understand Oauth well enough to know whether I can do manual authentication with my single endpoint, it seems like it only works with 2 endpoints (my server and a 3rd party service). I would much rather not use Devise is not built for an api and adds alot of overhead IMO.


How to deploy C# application to be used in branch / remote office(s)

Have very recently started a new position. One of my key challenges is a C# WinForms application (let's call it AppX) that causes a lot of non-planned work. The main reason for this is that it needs to be deployed to several hundred branch offices. Currently, this is done via GP update or bespoke application. Both of these methods are unreliable and means we can't effectively deploy version upgrades. Bit of background to what the software needs to do and some of the technical issues / background:-   1. AppX needs to produce results in real time    2. AppX needs to connect to a SQL server (express or full edition) which is physically located in the branch office    3. AppX needs to ensure that after a version upgrade all remote sites are on the same version    4. AppX can't be deployed via a thin client solution such as Citrix or Remote Desktop services    5. The headquarters network can see the entire branch office network and connect into their SQL servers My initial thoughts were ClickOnce deployment -- however there seems to be some suggestions that there may be some issues with conflicts of the .Net framework with other software Deploy the solution as a web app at the headquarters which connects back into the remote SQL server - technically I'm not sure how I would go about this I guess that this is something that others may have come across so I would be interested to know if there are any other suggestions on how to approach this Thanks


equals and hashcode methods autogenerated, is it always a good practice?

Preamble: Let's say I aim to cover all my classes with test coverage. Despite the common opinion (expecially in Java community) to "not pay too much attention to Cyclomatic Complexity (CC) and code coverage", I really think that these information are extremely useful: When you have a very high CC, or an uncovered zone in your code, very likely you wrote a dead code, or either is a smell that you have problems in design. In my personal experience I can say that many time dead code _is_ code smell. This problem become a little tricky when you have to deal with auto-generated code, and that's the point, how can I easily deal with `hashcode` and `equals` autogenerated methods? I came across this question in StackOverflow and I realized some very good point: http://stackoverflow.com/questions/5764380/unit-testing-equals-and-hashcode-a- complexity-story But this question is not a duplicate because I want to use a different approach: The best options available in the answers of that question are, as far as I can see, EqualsBuilder of Apache Commons Lang or Guava. Both uses reflection (correct me if I'm wrong) and that could be a problem for performance in some situations. But my actual question is: Since most of the times both `equals` and `hashcode` methods are **not** covered, is that a hint that this particular class does **not** need those 2 methods? Since many Java developers a lot of time generate equals and hashcode even when not needed, what am I missing? Shouldn't be a better solution to generate those methods only when you need, for instance, to sort objects of that class, to use that objects as an Hashtable key, and so on? As I said, I think that goals of low complexity and high coverage are admirable, but the solution of using EqualsTester , seems to me like "Force to cover code that you don't actually need in your program".


Code review guidelines for CSS, JS and HTML

I have been asked to create guidelines for review CSS, JS and HTML. I know there are coding guidelines for JS but I don't know any about HTML and CSS. To review JS I will certainly follow those guidelines and mention them. But what about CSS and HTML? Apart from logical errors and indentation issues, are there any specific things I need to check when I review markup and or CSS?


What are the advantages to developing with outdated technologies?

**A little background** : I am working at a large company, using Windows XP and coding Winforms in VB6/VB.Net and some WebForms in VB.Net (95% maintenance code). I have one 4:3 19" screen. A more modern version of Windows isn't happening soon, neither is any greenfield work by the sounds of it! I wasn't told about any of this when I joined the company, I was mislead to think I would be working with much more up to date technologies and frameworks. I have much more up to date experience from previous jobs, both with more modern frameworks and other programming languages, and when I am catching up with developer friends from other companies all I hear about is how they are using the latest ASP MVC framework, or Vagrant/Ruby on Rails/etc and I am getting the green eyes! I could sort myself out with another job pretty quickly, but I feel as though I should give this one more of a chance. **The question** : I am trying to convince myself that my current job isn't that bad. So what are the advantages to this sort of role? Are there advantages to working with outdated technologies? Maybe some techniques that I wouldn't pick up working with more modern ones? Or is this the sort of place where careers go to die, and I should get out while I still have my soul?


Functional as a first language

What are some pros and cons to learning functional programming before other paradigms?


Exchanging program results in Java

I wrote a calculator similar to the windows calculator using Java. And now I want to integrate this calculator into other projects as a separate package and use results obtained with the calculator in these projects with a single click (not using copy and pasting). How can I do this. (I'm using Netbeans to code Java)


Transforming theoretical knowledge into practical knowledge

I have got good grades and ~ 10 years of professional embedded s/w development. However I have come to realize that and also been pointed out in performance appraisals that although I have good theoretical knowledge and have even read lots of programming books - Code complete, pragmatic programmer etc.. , my hands on practical knowledge is weak and I am unable to translate my theoretical ability into practical expertise. I need to figure out a plan on how to do this. Any ideas in this regard? EDIT : I take too long in understanding specs and in developing code and and miss some aspects in development particularly domain knowledge.


About clean code

Example: I have a method that formats the output based on a parameter from an object. The question is, should I pass the object that holds the parameter to the method, or just the required param? Still trying to grasp clean coding so I might be wrong, my take is that the 2nd approach is cleaner because it doesn't require you to pass the entire object, and is easy to test.   However, it makes calling the method ugly now since I have to check for the param every time when I call the method. And its used very very often. In contrast, the first approach while not that easy to test, because I have to mock the requestObject, is much easier to use. So which method should I go with? Or is there an even better approach?               // The output method with object as input     public function outputResponse($message, $requestObject) {         if (isset($resquestObject->param['response_type']) && $requestObject->param['response_type'] == 'json') return json_ecode($message);         return xmlOutput($message);     }          // So you call it like     $this->outputResponse($message, $requestObject);      The other approach...               // The output method with just the param as input     public function outputResponse($message, $responseType) {         if (responseType == 'json') return json_ecode($message);         return xmlOutput($message);     }          // So you call it like     $responseType = (isset($resquestObject->param['response_type']) && $requestObject->param['response_type'] == 'json') ? 'json' : '';     $this->outputResponse($message, $responseType);


What *are* the programming concepts I should master to have a deep understanding of my craft (programming)?

In order of importance, if its possible to do so and it may not be, what are the most important foundations of knowing how to program. Algorithms, iteration, recursion, etc? Note that where I put etc. is where my question lies. I recently read an Internet post that said 9 out 10 programmers can't _gasp_ program! http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html I want to have a deep knowledge of what it is I am actually trying to accomplish when programming and an exhaustive comprehension of the basic tools at my disposal. Basically I want to be able to paint with all the colors of the wind.


What is the point of using lists over vectors, in C++?

I've run 3 different experiments involving C++ lists and vectors. Those with vectors proved more efficient, even when a lot of insertions in the middle were involved. Hence the question: in which case do lists make more sense than vectors? If vectors seem more efficient in most cases, and considering how alike their members are, then which advantages are left for lists?   1. Generate N integers and put them in a container so that the container remains sorted. The insertion has been performed naively, by reading elements one by one and inserting the new one right before the first larger one.   With a list, time goes through the roof when dimension increases, compared to vectors.   2. Insert N integers at the end of the container.   For lists and vectors, time increased by the same order of magnitude, though it was 3 times faster with vectors.   3. Insert N integers in a container.   Start timer.   Sort the container using list.sort for lists, and std::sort for vectors. Stop timer.   Again, time increases by the same order of magnitude, but it is in average 5 times faster with vectors. I might continue to perform tests and figure out a couple of examples where lists would prove better. But the joint experience of you guys reading this message might provide more productive answers. You might have come across situations where lists were more convenient to use, or performed better?


Different Project Type in a Single Website

I have developed a website in asp.net and I have some additional tasks, improvements to develop. In order to get experience in asp.net/mvc, I want to create an admin panel using asp.net mvc. **Is this a logical next step?** * * * P.S. The project is small and 20% of the website is mine, so there are not any restrictions. There is no problem if I do not meet deadlines! :)


Dealing with Feature Intersections

I have recently witnessed more and more problems similar to the ones explained in this article on feature intersections. Another term for it would be product lines, though I tend to attribute these to actually different products, whereas I usually encounter these problems in the form of possible product configurations. The basic idea of this type of problem is simple: You add a feature to a product, but somehow things get complicated due to a combination of other existing features. Eventually, QA finds a problem with a rare combination of features that no one thought of before and what should have been a simple bugfix may even turn into requiring major design changes. The dimensions of this feature intersection problem are of a mind-blowing complexity. Let's say the current software version has `N` features and you add one new feature. Let's also simplify things by saying that each of the features can turned on or off only, then you already have `2^(N+1)` possible feature combinations to consider. Due to a lack of better wording / search terms, I refer to the existence of these combinations as _feature intersection problem_. (Bonus points for an answer including reference(s) for a more established term.) Now the question I struggle with is how to deal with this complexity problem on each level of the development process. For obvious cost reasons, it is impractical up to the point of being utopian, to want to address each combination individually. After all, we try to stay away from exponential complexity algorithms for a good reason, but to turn the very development process itself into an exponentially sized monster is bound to lead to utter failure. So how do you get the best result in a systematic fashion that does not explode any budgets and is complete in a decent, useful, and professionally acceptable way.   * Specification: When you specify a new feature - how do you ensure that it plays well with all the other children?  I can see that one could systematically examine each existing feature in combination with the new feature - but that would be in isolation of the other features. Given the complex nature of some features, this isolated view is often already so involved that it needs a structured approach all in itself, let alone the `2^(N-1)` factor caused by the other features that one willingly ignored.   * Implementation: When you implement a feature - how do you ensure your code interacts / intersects properly in all cases. Again, I am wondering about the sheer complexity. I know of various techniques to reduce the error potential of two intersecting features, but none that would scale in any reasonable fashion. I do assume though, that a good strategy during the specification should keep the problem at bay during implementation.   * Verification: When you test a feature - how do you deal with the fact, that you can only test a fraction of this feature intersection space?  It is tough enough to know that testing a single feature in isolation guarantees nothing anywhere near error-free code, but when you reduce that to a fraction of `2^-N` it seems like hundreds of tests are not even covering a single drop of water in all oceans combined. Even worse, the most problematic errors are those that stem from the intersection of features, which one might not expect to lead to any problems - but how do you test for these if you don't expect such a strong intersection? While I would like to hear how others deal with this problem, I am primarily interested in literature or articles analyzing the topic in greater depth. So if you personally follow a certain strategy it would be nice to include corresponding sources in your answer.


Solving Scrabble board?

I recently saw a question on SO about solving the scramble/boggle game, where the letters are in a 4x4 grid and you have to find as many words as possible. I looked at some of the solutions, tried it myself, and would now like to move onto solving a scrabble game. The boggle solving code is rather simple; store the board state in a matrix and iterate over every move from every position and checking if words exist with the current letter chain. With scrabble, the idea is similar, but I'm still having trouble figuring it out. My currently thinking of:   1. Storing the board in 2 dimensional array.   2. Iterating over each position and skipping if the position is empty.   3. Creating some sort of regex pattern for the letters on the rack and the letter at the position... I'm still really iffy on what to do at step 3 because I know the tile at the position could be the beginning end, or some point in the middle of a word. And then there's the matter of making sure that if a word does fit that it also makes words with other tiles it touches.. I'm not asking for code samples, just the thought process from more experienced programmers. To clarify, my goal is: > Given the current state of a board and a person's tiles, calculate the legal > moves and the points for that move. For anyone following this and waiting for an answer, I found this: http://www.chaddington.com/portfolio/project.html#scrabble I might look through what he wrote, but I do want to try to figure it out myself first.


Logistics of becoming a iOS development Firm

We've had a lot of success in our company with the iOS apps that we have made that we are now looking at branching out and offering our services to people who want iPhone/iPad applications made for them or their company. What options do we have for deployment scenarios? If they want it up on the app store than this is quite easy and we will just submit it in the normal process. But what clauses do people put on these contracts because I know Apple still holds all the cards and could decline an app in the end if it doesnt suit their guidelines (which can be unclear sometimes). What if the customer does not want to deploy it to the app store but just want an in-house app? Is it on the customer than to purchase an Apple developer/enterprise license allowing them to do Ad hoc deployments to devices and we just supply them the application?


Scrum, is there a Critical Path for release planning?

Mike Cohn in Agile Estimating and Planning, page 154, defines a "natural order" for implementing user stories - this, according to him, is a intuitive sequence that makes sense to both developers and the team. I understand and endorse this idea. Though, I am having trouble letting go the concept of "critical path"; I see the value of ordering stories based on their dependencies. Even if the backlog is an always evolving tool, we could derive the "critical path" of the current backlog to prioritize and derive for 3-6 months worth of releases. It just does not sound right considering all I know about Agile. How do you apply the concept of critical path in Scrum? Your personal opinion would be much appreciated!


Functional Programming approach for a simplified game using Scala and LWJGL

I, a Java imperative programmer, would like to understand how to generate a simple version of Space Invaders based on Functional Programming design principles (in particular Referential Transparency). However, each time I try to think of a design, I get lost in the morass of extreme mutability, the same mutability which is shunned by the functional programming purists. As an attempt to learn Functional Programming, I decided to attempt to create a very simple 2D interactive game, Space Invader (note the lack of plural), in Scala using the LWJGL. Here are the requirements for the basic game:   1. User ship at the bottom of the screen moved left and right by the "A" and "D" keys respectively   2. User ship bullet fired straight up activated by the space bar with a minimum pause between shots to be .5 seconds   3. Alien ship bullet fired straight down activated by a random time of .5 to 1.5 seconds between shots Things intentionally left out from the original game are WxH aliens, degradable defense barriers x3, high speed saucer ship at at the top of the screen. Okay, now to the actual problem domain. For me, all the deterministic parts are obvious. It's the non-deterministic parts that seem to be blocking my ability to consider how to approach. The deterministic parts are the bullet's trajectory once they exist, the continuous motion of the alien and the explosion due to a hit on either (or both) of the player's ship or the alien. The non-deterministic parts (to me) are handling the stream of user input, handling fetching a random value for determining alien bullet firings and handling the output (both graphics and sound). I can do (and have done) lots of this type of game development over the years. However, all of it was from the imperative paradigm. And LWJGL even provides a very simple Java version of Space invaders (of which I began moving to Scala using Scala as Java-without-semicolons). Here are some links that talk around this area of which none seem to have directly dealt with the ideas in a way a person coming from Java/Imperative programming would understand:   1. Purely Functional Retrogames, Part 1 by James Hague   2. Similar Stack Overflow post   3. Clojure/Lisp Games   4. Haskell Games on Stack Overflow   5. Yampa's (in Haskell) Functional Reactive Programming It appears that there are some ideas in the Clojure/Lisp and Haskell games (with source). Unfortunately, I am not able to read/interpret the code into mental models that make any sense to my simpleminded Java imperative brain. I'm so excited by the possibilities offered by FP, I can just taste the multi- threaded scalability capabilities. I feel like if were able to grok how something as simple as the time + event + randomness model for Space Invader can be implemented, segregating the deterministic and non-deterministic parts in a properly designed system without it turning into what feels like advanced mathematical theory; i.e. Yampa, I'd be set. If learning the level of theory Yampa seems to require to successfully generate simple games is necessary, then the overhead of acquiring all the necessary training and conceptual framework will vastly outweigh my understanding of the benefits of FP (at least for this over-simplified learning experiment). Any feedback, proposed models, suggested methods of approaching the problem domain (more specific than the generalities covered by James Hague) would be greatly appreciated.


Managing lots of little (sometimes contradictory) changes

I work in a large company and most coding projects are fairly structured with a project plan and review process. However, for existing support there are occasional periods where a department will need lots of tiny changes made to an existing app or site such the accounting department at the end of a fiscal year. The problem is that they get incredibly busy and my team gets a slew of tiny emergency changes thrown at us. We need to be flexible enough to support their needs as they are real and provide a great deal of value to the company. On the other hand, given how crazy their environment is, they sometimes give us contradictory changes (change the text to 10pt, then the next day change it to 12pt). Again, the changes are trivially tiny but they can suck up a developer's day given how frequent they are. I'd like to push back and set some fair limits for how we'll handle these requests going forward. Is there a best practice for handling these types of small changes? The department in question is far to busy to commit a lot more time to working with us. We also don't charge back so it's hard to communicate the problem to them. What's a good approach to resolving this?


Should Item Grouping/Filter be in the ViewModel or View layer?

I'm in a situation where I have a list of items that need to be displayed depending on their properties. What I'm unsure of is where is the best place to put the filtering/grouping logic of the viewmodel state? Currently I have it in my view using converters, but I'm unsure whether I should have the logic in the viewmodel? e.g. ViewModel Layer:               class ItemViewModel     {         DateTime LastAccessed { get; set; }         bool IsActive { get; set; }     }          class ContainerViewModel     {          ObservableCollection<Item> Items {get; set;}     }      View Layer:               <TextView Text="Active Items"/>     <List ItemsSource={Binding Items, Converter=GroupActiveItemsByDay}/>     <TextView Text="Active Items"/>     <List ItemsSource={Binding Items, Converter=GroupInActiveItemsByDay}/>      or should I build it like this? ViewModel Layer:               class ContainerViewModel     {        ObservableCollection<IGrouping<string, Item>> ActiveItemsByGroup {get; set;}        ObservableCollection<IGrouping<string, Item>> InActiveItemsByGroup {get; set;}     }      View Layer:               <TextView Text="Active Items"/>     <List ItemsSource={Binding ActiveItemsGroupByDate }/>     <TextView Text="Active Items"/>     <List ItemsSource={Binding InActiveItemsGroupByDate }/>      Or maybe something in between? ViewModel Layer:               class ContainerViewModel     {        ObservableCollection<IGrouping<string, Item>> ActiveItems {get; set;}        ObservableCollection<IGrouping<string, Item>> InActiveItems {get; set;}     }      View Layer:               <TextView Text="Active Items"/>     <List ItemsSource={Binding ActiveItems, Converter=GroupByDate }/>     <TextView Text="Active Items"/>     <List ItemsSource={Binding InActiveItems, Converter=GroupByDate }/>      I guess my question is what is good practice in terms as to what logic to put into the ViewModel and what logic to put into the Binding in the View, as they seem to overlap a bit?


Do we set the bar too high by requiring that code tests not suffer from buffer overflow?

We are currently recruiting for a Junior Developer position working mainly in C on Linux. As part of the process, we require candidates to complete a code test at their leisure in C. So far we have rejected two candidates on the basis that their code, although readable and in one case rather idiomatic, suffered from buffer overflow errors due to unbounded buffer writes. Are buffer overflows acceptable from a graduate developer? Are we setting the bar too high? What is the expected capability of graduate/Junior engineers? **[Edit]:**   * We explicitly ask for error-checked, production quality code.   * We provide a test & build framework for the candidates **[Update]:** As a result of this thread, and conversations we have had with other developers in person, we are changing the way we carry out code tests and who we target with our recruiting. We decided that a candidate being unable to fix or understand a buffer overflow means that he would be unsuitable for the work we carry out, in particular he would take more mentoring than we are comfortable with. We will therefore still reject candidates that cannot eventually submit a robust code sample. However, we have put in place some measures to make the recruitment process more productive for both us and the candidates. In particular:   * We make our expectation more explicit, with clear explanation of what we mean by production quality, and a warning that the code is expected to be robust with respect to input and errors.   * We now link candidates to resources on defensive programming and the C standard library in the description of the code test.   * We changed our target audience from Junior developers and graduates to target people with some relevant experience.   * In case the submitted code fails in some way but would otherwise be accepted, we now provide a minimum test case that causes the error condition and give the candidates a chance to correct their mistakes (unless the code is rejected for some other reason). We'll also point out problematic lines/functions if appropriate.   * The goal of the tests itself has now slightly changed from a front end filter to a chance to build a better picture of the candidate, in particular it will inform our phone discussion. That said, we are still willing to reject based solely on code.


Is the use of security conditionals in a view a violation of MVC?

Often what's displayed to a user (e.g. on a web page) will be based partly on security checks. I usually consider user-level / ACL security to be part of the business logic of a system. If a view explicitly checks security to conditionally display UI elements, is it violating MVC by containing business logic?


Two components offering the same functionality, required by different dependencies

I'm building an application in PHP, using Zend Framework 1 and Doctrine2 as the ORM layer. All is going well. Now, I happened to notice that both ZF1 and Doctrine2 come with, and rely on, their own caching implementation. I've evaluated both, and while each has its own pro's and cons, neither of them stand out as superior to the other for my simple needs. Both libraries also seem to be written against their respective interfaces, not their implementations. Reasons why I feel this is an issue is that during the bootstrapping of my application, I have to configure two caching drivers - each with its own syntax. A mismatch is easily created this way, and it feels inefficient to set up two connections to the caching backend because of this. I'm trying to determine what the best way forward is, and would welcome any insights you may be able to offer. What I've thought up so far are four options:   1. Do nothing, accept that two classes offering caching functionality are present.   2. Create a Facade class to stick Zend's interface onto Doctrine's caching implementation.   3. Option 2, the other way around - create a Facade to map Doctrine's interface on a Zend Framework backend.   4. Use multiple-interface-inheritance to create one interface to rule them all, and pray that there aren't any overlaps (ie: if both have a "save" method, they'll need to accept params in the same order due to PHP's lack of proper polymorphism). What option is best, or is there a "None of the above" variant that I'm not aware of?


Can multiple CPU's / cores access the same RAM simutaneously?

This is what I **guess** would happen:   1. If two cores tried to access the **same** address in RAM, one would have to **wait** for the other to access the RAM. The **second** time that each core would try to access the same address, they may still have that RAM cached, so they could access their respective **caches simultaneously**.   2. If two cores tried to access **different** addresses in the same RAM, one would have to **wait** for the other to access the RAM. In other words, I would imagine that for RAM intensive programming tasks, multiprocessing won't help much unless it involved reading from the same address in RAM multiple times per core. So, can multiple CPU's / cores access the same RAM simutaneously, or is what I'm saying correct?


How do you handle domain logic that spans multiple model objects in an ORM?

So I know that business logic should be placed in the model. But using an ORM it is not as clear where I should place code that handles multiple objects. E.g. let's say we have a `Customer` model which has a `type` of either `sporty` or `posh` and we wanted to `customer.add_bonus()` to every posh customer. Where would we do this? Do we create a new class to handle all this? If yes, where do we put it (alongside all the other model classes, but not subclass it from the ORM?)? I'm currently using django framework in python, so specific suggestions are even more wanted.


What are the reasons one would use fully qualified class names in source code?

I recently ran across code where the developers used both fully qualified class names AND imported class names in their source code. Example:               import packageA.Foo;          public class Example {         public packageB.Bar doSomething() {             final Foo foo = new Foo();             ...         }     }      I was under the impression that the only reason one might want to use fully qualified name for classes in source code is when they have identical class names in two different packages and they need the fully qualified name to distinguish between the two. Am I wrong?


How should I distinguish between built-in types in Python?

I have a function that accepts either a string or a dictionary as an argument. That is, it can be called as either:               lookup_person({name: "John Smith", age: 57})      or               lookup_person("John Smith")      My first inclination is to use `type` or `isinstance` to distinguish the type of the argument, but I've seen a lot of ink spilled over whether and when rigid type detection is appropriate. The prevailing wisdom I've read suggests that I should test if my object implements some interface, but testing for particular string or dictionary methods seems significantly less safe than simply testing if the type of the object is a string or dictionary. Is it possible to employ duck typing here, and is it appropriate to do so? Or do I have a larger problem, and my approach here somehow fundamentally not Pythonic? **EDIT:** To clarify, passing a dictionary is the "typical" use. Passing in a string is simply an API shorthand for a single-entry dictionary with `name`, i.e., `lookup_person({name:"John Smith"})`.


Sorting : Useful for more than just viewing data?

**Context** I'm currently working on a personal project involving functional reactive JavaScript, and I've come up with an odd question. Note that this question is not JavaScript specific, but that is the context in which I am asking it. **Scenario** When filtering a collection of data, you end up with a smaller set of data. Therefore, correctly filtering your data earlier (rather than later) ends up optimizing your later code, as it does not need to iterate through the portion of data which will not be used. (think filtering before mapping, instead of visa-versa) However, I was wondering if there's a scenario in which sorting provides similar benefits, or if sorting is generally used as a way of formatting data to be displayed, so that an end user may more easily absorb it (sort by name, city, state, etc). **Question** When is sorting your _data_ more desirable than sorting the corresponding _views_ of that data?


One method with many behaviours or many methods

This question is quite general and not related to a specific language, but more to coding best practices. Recently, I've been developing a feature for my app that is requested in many cases with slightly different behaviours. This function send emails , but to different receivers, or with different texts according to the parameters. The method signature is something like               public static sendMail (t_message message = null  , t_user receiver = null , stream attachedPiece = null)      And then there are many condition inside the method, like               if(attachedPiece != null)     {     }      I've made the choice to do it this way (with a single method) because it prevents me to rewrite the (nearly) same method 10 times, but I'm not sure that it's a good practice. What should I have done? Write 10 `sendMail` method with different parameters? Are there obvious pros and cons for these different ways of programming? Thanks a lot.


How does a search functionality fit in DDD with CQRS?

In Vaughn Vernon's book Implementing domain driven design and the accompanying sample application I found that he implemented a CQRS approach to the iddd_collaboration bounded context. He presents the following classes in the application service layer:   * CalendarApplicationService.java    * CalendarEntryApplicationService.java   * CalendarEntryQueryService.java   * CalendarQueryService.java I'm interested to know if an application will have a search page that feature numerous drop downs and check boxes with a smart text box to match different search patterns; How will you structure all that search logic? In a command service or a query service? Taking a look at the CalendarQueryService.java I can see that it has 2 methods for a huge query, but no logic at all to mix and match any search filters for example. I've heard that the application layer shouldn't have any business logic, so where will I construct my dynamic query? or maybe just clutter everything in the Query service?


I'm a little bit confused about 'function' and 'lambda'. I've seen some examples showing that the scheme keyword `lambda` works very similarly to the JavaScript keyword `function`, but I really don't know how they are related. I'm told that 'function' and 'method' can be used interchangeably when speaking about objects in .net. I'm wondering if 'lambda' and 'function' similarly mean the same thing. I wonder if 'lambda' has some esoteric meaning, seeing that the Greek letter lambda (λ) appears in so many avatars on this site. To make things even more confusing, in .net, the functional parts of C# refer to function expressions passed to another function as 'lambda expressions', so the word really seems to be all over the place. I'm also vaguely familiar with the term 'lambda calculus'. What is the difference between a function and a lambda?


Pure Front end JavaScript with Web API versus MVC views with ajax

This was more a discussion for what peoples thoughts are these days on how to split a web application. I am used to creating an MVC application with all its views and controllers. I would normally create a full view and pass this back to the browser on a full page request, unless there were specific areas that I did not want to populate straight away and would then use DOM page load events to call the server to load other areas using AJAX. Also, when it came to partial page refreshing, I would call an MVC action method which would return the HTML fragment which I could then use to populate parts of the page. This would be for areas that I did not want to slow down initial page load, or areas that fitted better with AJAX calls. One example would be for table paging. If you want to move on to the next page, I would prefer it if an AJAX call got that info rather than using a full page refresh. But the AJAX call would still return an HTML fragment. My question is. Are my thoughts on this archaic because I come from a .net background rather than a pure front end background? An intelligent front end developer that I work with, prefers to do more or less nothing in the MVC views, and would rather do everything on the front end. Right down to web API calls populating the page. So that rather than calling an MVC action method, which returns HTML, he would prefer to return a standard object and use javascript to create all the elements of the page. The front end developer way means that any benefits that I normally get with MVC model validation, including client side validation, would be gone. It also means that any benefits that I get with creating the views, with strongly typed html templates etc would be gone. I believe this would mean I would need to write the same validation for front end and back end validation. The javascript would also need to have lots of methods for creating all the different parts of the DOM. For example, when adding a new row to a table, I would normally use the MVC partial view for creating the row, and then return this as part of the AJAX call, which then gets injected into the table. By using a pure front end way, the javascript would would take in an object (for, say, a product) for the row from the api call, and then create a row from that object. Creating each individual part of the table row. The website in question will have lots of different areas, from administration, forms, product searching etc. A website that I don't think requires to be architected in a single page application way. What are everyone's thoughts on this? I am interested to hear from front end devs and back end devs.


Language for Chess Position Evaluation (experimental)

My aim is to, via pattern analysis and statistics, (as well as piece mobility and position) build a chess position evaluation analyzer (rather than simply going brute force ply-searching). Id like to hear some thoughts a language that will be interesting/fun/challenging to learn and reason with. Ideally the language would have be well suited for:   1. Statistical Analysis   2. Pattern Analysis    3. Native Array and Vector Operations    4. Native Mathematical Functions Note:   1. I have no need for a GUI, and may not even get to the point of a 'move engine' but simply stop at a position evaluation engine   2. I am not interested in speed.    3. I am personally most comfortable with Python but I might be interested in trying something else. (though feel free to suggest this if you think it fits).   4. I am particularly curious about how good a fit a functional language would be in this context.


What was before MVC?

MVC is used a lot (not only in web apps) and it seems it's the 'go to' approach when designing software. There are also a lot of MVC versions. My question is: what was before MVC? How did people structure large software systems? Obviously 'separation of concerns' wasn't invented with MVC (even if it wasn't called that). I assume this type of thinking, which is crucial for building and maintaining software, was present long ago. But in more technical terms, how was software structured before MVC?


How should I organize bugs in redmine?

I'm helping to reogranize several redmine projects; although I have a lot of experience with issue tracking systems, I've never worked with redmine before. What is the best way to organize Issues in Redmine so that they can be easily grouped by:   * feature (e.g. "Upload a file", "Login to site", "Send message")   * system component (e.g. front-end, back-end, database), and   * target version ("beta 1", "beta 2" "GA") Right now, most "Bugs" are child issues of "Features"; unfortunately, this means that the Target Version of each bug is automatically populated with the Target Version of the parent feature. Is there some way to fix this?