Is a "model" branch a common practice?

I just thought it could be a good thing to have a dedicated version control branch for all database schema changes and I wanted to know if anyone else is doing the same and what have the results been. Say that you are working with:   1. Schema model/documentation (some file where you model the database visually to generate the schema source, say MySQL Workbench, with a .mwb file, which is binary)   2. Schema source (a .sql file)   3. Schema-based code generation The normal way we were working was with feature branches, so we would do changes to the model files (the database specific ones), and then have to regenerate points 2 and 3, dealing with the possible conflicts (or even code rewriting). Now say that your workflow goes the same way as the previous item numbering. With a model branch you wouldn't have to reconcile the schema model with binaries in other feature branches, or have to regenerate schema source and regenerate code (which might have human code on top of it). It makes so much sense to me it feels weird not having seen this earlier as a common practice. **Edit** : I'm counting on branch merges to be the assertions for the model matching the code. I use a DVCS, so I don't fear long-lived branches or scary- looking merges. I'm also doing feature branching.


Is it a bad idea to stray from CSS selector syntax in a JavaScript selector engine?

I'm designing a JavaScript selector engine, and I'm currently focused on parsing the selector string. Specifically, combinators. The CSS3 combinators I know of are:   * `>` (children)   * `space` (descendants)   * `+` (next sibling)   * `~` (all next siblings) Which is fine for how CSS works (how style rules are applied). However, I'm now realizing (now that I'm examining this paradigm more closely) that this seems a bit limiting in a JavaScript setting. Below I've created an alternative list of combinators. What I would like to know is:   1. Do any of the current selector engines stray from standard CSS selection methods? (I'm familiar with Sizzle and Sly, but none of the others)   2. Do you see any reason why any of the combinators I've listed wouldn't work well?   3. Do you think having more selector string options (more combinators, more filters, etc) is beneficial or are just a waste/confusing/dumb/etc? Thanks all in advance for your thoughts!   * `>` (children)   * `>>` (descendants) (also, space would still work)   * `+` (next sibling)   * `++` (all next siblings) (also, tilde would still work)   * `-` (previous sibling)   * `--` (all previous siblings)   * `*` (previous and next siblings)   * `**` (all siblings)   * `^` (parent) Example 1: `div ^ span` \- get all spans with a div child Example 2: `div ** span` \- get all span siblings of div Example 3: `.lastListItem -- li` \- all li previous to the li with class `.lastListItem` Example 4: `#thing ^ div ** .error` \- all items with class `.error` that are siblings of #thing's parent (assuming #thing's parent is a div) p.s. Oh, and I also thought of having a placeholder character that could stand in for any simple selector. So, Example 4 might look like this (with an underscore as a placeholder): Example 4 alt: `#thing ^ _ ** .error` \- all items with class ".error" that are siblings of #thing's parent (no matter what kind of element #thing's parent is)


Solving the last mile problem in software engineering

The more I write code the more I realize that writing the code is not the hard part. The hard part is making sure all the dependencies are in order, there are no hard coded paths, that I don't have weird implicit library dependencies, that there is documentation on how to get it up and running, etc. Tools like vagrant, rake, chef-solo, and fpm definitely help me with some of those problems but there is almost always something that I overlook and when it comes time to deploy the code something almost always goes wrong. I'm also a little disheartened by how little most programmers care about making sure their code is easy to deploy. So how do people usually solve the last mile problem? How do you make sure your code is deployable with as little fuss as possible?


What is a recommended pattern for REST endpoints planning for foresighted changes

Trying to design an API for external applications with foresight for change isn't easy, but a little thought up front can make life easier later on. I'm trying to establish a scheme that will support future changes while remaining backward compatible by leaving prior version handlers in place. The primary concern on this article is to what pattern should be followed for all defined endpoints for a given product/company. ## Base Scheme Given a base URL template of `https://rest.product.com/` I have devised that all services reside under `/api` along with `/auth` and other non-rest based endpoints such as `/doc`. Therefore I can establish the base endpoints as follows:               https://rest.product.com/api/...     https://rest.product.com/auth/login     https://rest.product.com/auth/logout     https://rest.product.com/doc/...      ## Service Endpoints Now for the endpoints themselves. Concern about `POST`,`GET`,`DELETE` is not the primary objective of this article and is the concern on those actions themselves. Endpoints can be broken down into namespaces and actions. Each action must also present itself in a way to support fundamental changes in return type or required parameters. Taking a hypothetical chat service where registered users can send messages we may have the following endpoints:               https://rest.product.com/api/messages/list/{user}     https://rest.product.com/api/messages/send      Now to add version support for future API changes which may be breaking. We could either add the version signature after `/api/` or after `/messages/`. Given the `send` endpoint we could then have the following for v1.               https://rest.product.com/api/v1/messages/send     https://rest.product.com/api/messages/v1/send      So my first question is, what is a recommended place for the version identifier? ## Managing Controller Code So now we have established we need to support prior versions we need to thus somehow handle code for each of the new versions which may deprecate over time. Assuming we are writing endpoints in Java we could manage this through packages.               package com.product.messages.v1;     public interface MessageController {         void send();         Message[] list();     }      This has the advantage that all code has been separated through namespaces where any breaking change would mean that a new copy of the service endpoints. The detriment of this is that all code needs to be copied and bug fixes wished to be applied to new and prior versions needs to be applied/tested for each copy. Another approach is to create handlers for each endpoint.               package com.product.messages;     public class MessageServiceImpl {         public void send(String version) {             getMessageSender(version).send();         }         // Assume we have a List of senders in order of newest to oldest.         private MessageSender getMessageSender(String version) {             for (MessageSender s : senders) {                 if (s.supportsVersion(version)) {                     return s;                 }             }         }     }      This now isolates versioning to each endpoint itself and makes bug fixes back port compatible by in most cases only needing to be applied once, but it does mean that we need to do a fair bit more work to each individual endpoint to support this. So there's my second question "What's the best way to design REST service code to support prior versions."


What licence for a FOSS that would sell packages on Mac and Windows but give them away on Linux?

The code should remains as open as possible, but I'm planning to sell it on Windows and Mac, and make free rmp/deb. Does the licence even matter? It feels like I'm just selling the service of compiling and distributing the software here.


Difference between functional and technical specification

I'm writing a specification for a project, and am struggling with separating functional specification from technical specification (see http://www.joelonsoftware.com/articles/fog0000000035.html). For example, I'm trying to specify the behaviour when a user requests a list of Foo objects they have visibility on. In the functional specification, should I describe what precisely is returned (i.e. the structure of a Foo object) or just that the system returns a list of them and then put the details of the Foo object in the technical specification? The design is for an API in case that makes any difference. I can't find many examples of how such an API specification is written.


Non-viral open source license but with clause for source disclosure?

I'm looking for a license (for a C library) which basically says: "Redistributions in binary form must be accompanied by the source code of Larger Work (My code + Your code)" i.e., L = M + Y, with '+' here meaning, for example, static linking / dynamic linking. And there must be no more restrictions other than this. If I choose my license 'X' as:   * GPL - source code of Larger Work, both M and Y, must also be licensed as whole under GPL.   * LGPL - My code continues to be LGPL, Your code can be kept closed-source if needed.   * BSD - source code of neither M nor Y need be disclosed. To be more clear, the binary must be under the license 'X' but source code of Larger Work must be made _available_ \-- under whatever license the Author of Larger Work wants, it need not be restricted to 'X'. LGPL comes close, but it does not mandate the source availability of Your code. Example use case: Author of Larger Work _must_ give the his recipient all of his source code (both M and Y) but can ask the recipient to sign an NDA restricting modification of Y, but the recipient is allowed to study Y. In short, 'X' shouldn't have hereditary characteristics (like *GPL) yet source code availability should be mandated. Is there such a "non-viral" FOSS license ? Thanks in advance ! PS: I asked this question first on StackOverflow, someone there suggested that I post it in this site. That question was closed as off-topic there, and I've deleted it from SO.


Service Layer - how broad should it be, and should it also be used from the local application?

**The background:** I need to build a desktop application with some operations (CRUD and more) (=winforms), I need to make another application which will re-use some of the functions of the main application (=webforms). I'm using service layer for reusing my functions. The service is calling the functions on the BL layer (correct me if I'm doing this wrong). so my desktop has 4 projects - DAL, BL, UI, WEBSERVICES. **The dilemma (simple but I still need some more experienced opinions):**   1. In my main winform UI - should I call the functions from the BL - bl.getcustomers(), or do it similar to how I call it in the webform, and call the functions from the service - webservices.getcustomers?    2. Should I create a service for every single function on the BL even if I need some of the functions only in one UI? for example - should I create services for all the CRUD operations, even though I need to re-use only update operation in the webform? _YOUR HELP IS MUCH APPRECIATED_


Giving employer power of attorney to obtain your inventions

Is it normal/just for a software company to ask for power of attorney to ensure they obtain patents on anything you invent while you are employed as a programmer? **Update:** In my case, I went back the the employer. They told me they have no interest in using my inventions which are not related the domain that were not invented during company hours, using company resources. The company encourages open source contribution, and will not interfere in that regard. I further examined the contract, and at the point where the term 'inventions' is defined in legal speak, it stated that inventions in the context of this agreement were only those developed using company resources within company time. Power of Attorney allows the company to ensure they can get my signature (or equivalent in my absence) for any inventions which they may wish to patent.


How to communicate within a company what is being Continually Deployed

I work for a small development company, 20 people total in the entire company, 3 in actual development, and we've adopted CD for our commits to trunk, and it works great, from a code management and up-time side. However - we're getting flak from our support staff and marketing department that they don't feel that they're getting enough lead time on new features and notifications on bug fixes that could change behavior. Part of why we love the CD system is for us in development, it's fast, we fix the bug, add the quick feature, close the Bugz and move on with our day to the next item. All members of our company are now on HipChat at all times, and when a deployment occurs, a message is sent to a room that all company members are in, letting them know what was just deployed (it just shows the commit messages from tip back to the last recorded deployment). We in development are also attempting to make sure that when we're making a change that modifies the UI or a public facing behavior, we post a screenshot to the All Company room and explain what the behavior change is, seeking pushback or concerns. Often, the response is silence. Sometimes, it's a few minor questions, but nothing that need stop the deployment from happening. What I'm wondering is how do other users of the CD method deal with notifications of new features and changes to areas of the company that are not development - and eventually on to customers in the world? Thanks,   Francis


So Singletons are bad, then what?

There has been a lot of discussion lately about the problems with using (and overusing) Singletons. I've been one of those people earlier in my career too. I can see what the problem is now, and yet, there are still many cases where I can't see a nice alternative - and not many of the anti-Singleton discussions really provide one. Here is a real example from a major recent project I was involved in: The application was a thick client with many separate screens and components which uses huge amounts of data from a server state which isn't updated too often. This data was basically cached in a Singleton "manager" object - the dreaded "global state". The idea was to have this one place in the app which keeps the data stored and synced, and then any new screens that are opened can just query most of what they need from there, without making repetitive requests for various supporting data from the server. Constantly requesting to the server would take too much bandwidth - and I'm talking thousands of dollars extra Internet bills per week, so that was unacceptable. Is there any other approach that could be appropriate here than basically having this kind of global data manager cache object? This object doesn't officially have to be a "Singleton" of course, but it does conceptually make sense to be one. What is a nice clean alternative here?


How to evaluate code quality when you're not familiar with the language?

As a hypothetical, if I were to interview someone for a new PHP developer position when my experience is in .NET, how can I determine if the code sample they've provided me is efficient and of good quality? In other words, what is the best way to evaluate a programmer's code if you're not familiar with the language?


Is there a name for this use of the State design pattern?

I'm looking to see if there is a particular name for this style of programming a certain kind of behavior into a program. Said program runs in real time, in an update loop, and the program uses the State design pattern to do some work, but it's the specific way it does the work that I want to know about. Here's how it's used.               - Object Foo constructed, with concrete StateA object in it     - First loop runs     --- Foo.Run function calls StateA.Bar     --- in StateA.Bar replace Foo's state to StateB     - Second loop runs     --- Foo.Run calls StateB.Bar     - Third loop runs     --- Foo.Run calls StateB.Bar     - Fourth loop     --- etc.       So in short, `Foo` doesn't have an explicit `Initialize` function. It will just have `Run`, but `Run` will do something unique in the first frame to initialize something for `Foo` and then replace it with a different action that will repeat in all the frames following it- thus not needing to check if `Foo`'s already initialized. It's just a "press start and go" action. What would you call implementing this type of behavior?


Best method to organize/manage dependencies in the VCS within a large solution

A simple scenario:   * 2 projects are in version control      * The application      * The test(s)   * A significant number of checkins are made to the application daily.    * CI builds and runs all of the automation nightly. In order to write and/or run tests you need to have built the application (to reference/load instrumented assemblies). Now, consider the application to be **massive** , such that building it is prohibitive in time (an entire day to compile). The obvious side effect here, is that once you've performed a build locally, it is immediately inconsistent with latest. For instance: If I were to sync with latest, and open up one of the test projects, it would not locally build until I built the application. This is the same when syncing to another branch/build/tag. So, in order to even start working, I need to wait a day to build the application locally, so that the assemblies could be loaded - and then those assemblies wouldn't be latest. How do you organize the repository or (ideally) your development environment such that you can continually develop tests against whatever the current build is, or a given specific build, while minimizing building the application as much as possible?


FTP file compare

Are there any FTP programs out there that do a file comparison as well, so I can select the local and remote files and see what actually changed? I didnt find any when I googled. But it doesnt seem like a very advanced use case to me. Surely many others would have felt the need for it.. right?


What is the point of link rel="self" in a REST API?

I often see the following in HTML documents               <link rel="self" href="http://example.com/something">      or like this in JSON                link: {          rel="self",          href="http://example.com/something"      }      or in XML                <atom:link rel="self" href="http://example.com/something" />      So I had some questions:   1. Why include this link? What advantage does it bring? (Please tell me there is a reason to it and its not just a "good practice" talisman)   2. How should I exploit this link in my clients? What are the use case for this link?   3. When _shouldn't_ I use this link? When is it pointless to include it?


Is mentioning my blog on my resume helpful or hurtful to a job search?

I have a blog that I use mostly to record solutions to problems I have had, that I had some trouble finding an answer to. Mostly problems where the online doc I googled provided too much info, and I found the answer to my question on the fifth page of my third google hit. (Or if I asked the question here, I either didn't get an answer or I got slammed for asking a question that "the answer could be easily googled.") I frequently look up stuff on this blog to remind myself of how I solved a problem, and it gets a decent amount of hits from others as well. Anyway, I was wondering if mentioning this blog on my resume would help or hurt me in a job search? The topics are all over the map. What I would hope it shows is that   * I am a person who finds solutions to problems   * I have used many different technologies in my work   * I am not afraid to tackle a challenge  What I am concerned it shows is that   * This person had trouble with something that simple?   * Why is this person bothering to blog this stuff?


Choosing a web development framework?

So, I've sort of reached a point where I want to start developing a website. Originally, I planned to build said website using PHP and CodeIgniter, I'm familiar with both, but, truth be told, I'm not too fond of either. I find they just get rather messy, CodeIgniter helps somewhat, but no matter what, it seems that most PHP comes out more obfuscated than it has to be. Anyways, I've come to the point where I want to either use Python or Ruby. I'm familiar in both, though more so towards Python, but I've never done any web development in them. I'll take the necessary time to learn the frameworks (and further my knowledge in the language of my choosing), but I need to choose one. I don't like either language more than the other, they both have their benefits... However, since I've never done any web development with either language, I was hoping that you guys could give me some pointers. What are the available frameworks for each language? What do you recommend and why? Note: I've primarily looked into Rails and Django - but I'm still open to others. I'm looking for one that will work for just one (or maybe two) developers. It has to be fairly easy to learn (but I will take the time to learn it). Also, I'd like it to easily support clean code and agile development.


Who can call themselves a UI developer?

**Who can call themselves a UI developer, without being a poser?**   I've noticed people calling themselves UI developers, which I would categorize as web designers instead. I'm not knocking it, I'd just like to know _who's the real deal_.


Does *every* project benefit from written specifications?

I know this is holy war territory, so please read the question to the end before answering. There are many cases where written specifications make a lot of sense. For example, if you're a contractor and you want to get paid, you need written specs. If you're working in a team with 20 persons, you need written specs. If you're writing a programming language compiler or interpreter (and it's not perl), you'll usually write a formal specification. I don't doubt that there are many more cases where written specifications are a really good idea. I just think that there are cases where there's so little benefit in written specs, that it doesn't outweigh the costs of writing and maintaining them. **EDIT:** The close votes say that "it is difficult to say what is asked here", so let me clarify: The usefulness of written, detailed specifications is often claimed like a dogma. (If you want examples, look at the comments.) But I don't see the use of them for the kind of development I'm doing. **So what is asked here is: How would written specifications help me?** Background information: I work for a small company that's developing vertical market software. If our product is easier to use and has better performance than the competition, it sells. If it's harder to use, even if it behaves 100% as the specification says, it doesn't sell. So there are no "external forces" for having written specs. The advantage would have to be somewhere in the development process. Now, I can see how _frozen_ specifications would make a developer's life easier. But we'll never have frozen specs. If we see in the middle of development that feature X is not intuitive to use the way it's specified, then we can only choose between changing the specification or developing a product that won't sell. You'll probably ask by now: How do you know when you're done? Well, we're continually improving our product. The competition does the same. So (hopefully) we're never done. We keep improving the software, and when we reach a point when the benefits of the improvements we've added since the last release outweigh the costs of an update, we create a new release that is then tested, localized, documented and deployed. This also means that there's rarely any schedule pressure. Nobody has to do overtime to make a deadline. If the feature isn't done by the time we want to release the next version, it'll simply go into the next version. The next question might be: How do your developers know what they're supposed to implement? The answer is: They have a lot of domain knowledge. They know the customers business well enough, so a high-level description of the feature (or even just the problem that the customer needs solved) is enough to implement it. If it's not clear, the developer creates a few fake screens to get feedback from marketing/management or customers, but this is nowhere near the level of detail of actual specifications. This might be inefficient for larger teams, but for a small team with low turnover it works quite well. It has the additional benefit that the developer in question often comes up with a better solution than the person writing the specs might have. This question is already getting very long, but let me address one last point: Testing. Like I said in the beginning, if our software behaves 100% like the spec says, it still can be crap. In fact, if it's so unintuitive that you need a spec to know how to test it, it probably _is_ crap. It makes sense to have fixed, written tests for some core functionality and for regression bugs, but again, this is nowhere near a full written spec of how the software should behave when. The main test is: hand the software to a user who doesn't know it yet and tell him to use the new feature X. If she can figure out how to use it and it works, it works.


Can the Abstract Factory pattern be considered as a case of polymorphism?

I was looking for a pattern/solution that allows me call a method as a runtime exception in a group of different methods without using Reflection. I've recently become aware of the Abstract Factory Pattern. To me, it looks so much like polymorphism, and I thought it could be a case of polymorphism but without the super class `GUIFactory`, as you can see in the example of the link above. Am I correct in this assumption?


Duplication of view access control logic in database queries and application component

Our web application has a complex access control system which incorporates role-based and object-level privileges. In the business logic layer, this is implemented by a component that obtains (and caches) all the necessary data with a batch query and computes the user's type and level of access to any object in the system. (A future optimization would be conditional batching based on the data we need for a particular request.) However, the **view** privilege logic in this component is duplicated elsewhere in database queries. (We need to hide data in listing screens that the user does not have privilege to view.) **How can we reduce or eliminate this duplication of logic between the application access control component and our database queries?** Two approaches come to mind. I'm sure there are others.   * Check view privilege in the application for each row that comes back from the server via queries from listing screens.   * Move more of the access control logic into a stored function that can be called from the queries as well as the application code. _Answers should defend the merits of the proposed method over other methods. For example, if my second suggested approach is desirable, why? If you have suggested a third approach, why does it win over both my approaches?_


Why such popularity with Python?

Other than being annoyed at whitespace as syntax, I'm not a hater, I just don't get the fascination with Python. I appreciate the poetry of Perl, and have programmed beautiful web services in bash & korn, and shebang `gnuplot`. I write documents in `troff` and don't mind REXX. Didn't find tcl any more useful years ago, but **what's the big stink about Python**? I see job listings and many candidates with this as a prize & trophy on their resumes. * * * I guess in reality, I'm trying to personally become sold on this, I just can't find a reason.


Random pairing algorithm

If you have a list of items and you want to randomly pair the items in the list together, what kind of algorithm would you use to do that, such that the items can only be matched to one other item.


Why should company choose VB.NET over C#

> **Possible Duplicate:**   >  VB.Net vs C# debate Are there any actual reasons why company should choose VB.NET over C#? I work for a company which develops medical software and switched from VB6 to VB.NET several years ago. There were two reasons to switch to VB.NET but not to C# at that moment:   1. VB.NET is more similar to VB6 and it should make it easier for developers to switch to .NET world   2. VB.NET had a better support for COM than C# The first reason is not serious as VB6 and VB.NET are two different worlds and there is no significant difference between switching from VB6 to VB.NET or C#. The second reason is not actual after C# 4 release. Our company eventually switched to C# (and yes, we now have modules in VB6, VB.NET and C#; and even some modules in C++) because: 1\. It is easier to find developers in C# 2\. .NET world is C#-oriented: Visual Studio works better with C#, Resharper has better support for C#, etc. I am just curious whether there are still some reasons for company to choose VB.NET over C#.


We use subversion - Should we place comments in my code anyways?

I brought up in a meeting an annoyance that code changes were not commented within the code itself. We use SVN (Subversion) for source control, and it was relayed to me that you can just go into SVN and check the history and see the changes. My question is is this a best practices? It seems easier to me to place the comment in the code itself with the defect/user story reference (we use Rally/Agile) **AND** in the svn header when you check in the changes. My bosses seem to think putting it the code is unecessary, and I told them I completely disagreed with that practice. I've always been taught that comments in the code are never bad. This is not my first gig. I was even more floored when he told me his boss has been known to rip out comments in some code. After I stopped having the shakes, I wanted to... vomit. What do you think about comments in code vs/with comments in source control and what do you do as a best practice?


What to do when TDD tests reveal new functionality that is needed that also needs tests?

What do you do when you are writing a test and you get to the point where you need to make the test pass and you realize that you need an additional piece of functionality that should be separated into its own function? That new function needs to be tested as well, but the TDD cycle says to Make a test fail, make it pass then refactor. If I am on the step where I am trying to make my test pass I'm not supposed to go off and start another failing test to test the new functionality that I need to implement. For example, I am writing a point class that has a function **WillCollideWith( _LineSegment_ )**:               public class Point {         // Point data and constructor ...              public bool CollidesWithLine(LineSegment lineSegment) {             Vector PointEndOfMovement = new Vector(Position.X + Velocity.X,                                                    Position.Y + Velocity.Y);             LineSegment pointPath = new LineSegment(Position, PointEndOfMovement);             if (lineSegment.Intersects(pointPath)) return true;             return false;         }     }      I was writing a test for **CollidesWithLine** when I realized that I would need a **LineSegment.Intersects( _LineSegment_ )** function. But, should I just stop what I am doing on my test cycle to go create this new functionality? That seems to break the "Red, Green, Refactor" principle. Should I just write the code that detects that lineSegments Intersect inside of the **CollidesWithLine** function and refactor it after it is working? That would work in this case since I can access the data from **LineSegment** , but what about in cases where that kind of data is private?


Has the emerging generation of programmers got the wrong idea about design patterns?

Over the years I've noticed a shift in attitude towards design patterns, particularly amongst the emerging generation of developers. There seems to be a notion these days that design patterns are silver bullets that instantly cure any problem, a proliferating idea that advancing as a software engineer simply means learning and applying more and more patterns. When confronted with a problem, developers no longer strive to truly understand the issue and design a solution - instead they simply pick a design pattern which seems to be a close fit, and try to brute-force it. You can see evidence of this by the many, many questions on Stack Overflow that begin with the phrase _"what pattern should I use to..."_. I fall into a slightly more mature category of developers (5-10 years experience) and I have a very different viewpoint on patterns - simply as a communication tool to enhance clarity. I find this perspective of design patterns being lego bricks (collected like pokemon cards) a little disconcerting. Will developers lose this attitude as they gain more experience in software engineering? Or could these notions perhaps steer the direction of our craft in years to come? Did the older generation of developers have any similar concerns about us? (perhaps about OO design or similar...). if so, how did we turn out?


What is this kind of architecture

I have looked at the Force.com videos, I am fascinated by the way it allows one to add custom fields to forms, create new forms, with the validations built in by just marking as the required kind, all on the fly. I am trying to implement the same kind of approach to my Java application.   1. Which of the Java frameworks support this kind of quick development.    2. Do we have a name for this kind of architectural approach? In case I need to provision this feature on the fly, what are the things I need to take care for implementation.  Basically I am not clear what is this kind of approach known as to google and find. Please point me any references. Thanks. _Edit: Here is it @barjak:http://www.youtube.com/watch?v=QkRbzd3vxHU#t=0m18s_


Help in ensuring unit tests are meaningful

I've just written a unit test for this function, which loops through a collection of dates and sets properties equal to true or false depending on whether they're before or after a given comparison date:               public void CheckHistory(int months)     {         var endDate = DateTime.Today.AddMonths(months);         Dictionary<Order, bool> orders = new Dictionary<Order, bool>();              foreach (var kvp in this.Orders)         {             if (kvp.Key.Date >= endDate)             {                 orders.Add(kvp.Key, true);             }             else             {                 orders.Add(kvp.Key, false);             }         }         this.OrderHistories = orders;     }      So here's the test I wrote:               public void Assert_CheckHistory_SelectsCorrectDates()     {         MyViewModel vm = GetVmWithMockRepository();         vm.OrderHistories = new Dictionary<OrderHistory, bool>();              OrderHistory ohOld = new OrderHistory();         ohOld.MailingDate = DateTime.Today.AddMonths(-12);         vm.OrderHistories.Add(ohOld, false);              OrderHistory ohNew = new OrderHistory();         ohNew.MailingDate = DateTime.Today.AddMonths(-3);         vm.OrderHistories.Add(ohNew, false);              vm.CheckOrderHist(-6);              int selectedOrders = vm.OrderHistories.Where(o => o.Value == true).Count();         Assert.AreEqual(1, selectedOrders, "Unexpected number of selected Order Histories");     }      Nothing wrong there. Test passes and all is good with the world. However, I'm haunted by a nagging feeling that I'm not actually testing anything useful, and am just writing tests for the sake out it. I get this a _lot_. A creeping paranoia that the tests I'm writing are incomplete in the sense that while they cover the lines of code in the target function, they don't really trap any likely problems and are therefore just a maintenance overhead. Is that sample test worthwhile? Is even a badly-designed test worth worthwhile over no test at all? And most of all are there any principles to help programmers identify whether a test is useful or not, or to guide them in constructing useful tests in the future? To be clear, I'm adding tests to an existing application. Going test-first in true TDD style isn't possible.


Project Organization

I have been having a discussion with a colleague about the best way to organize a (C#)project after he reorganized a project I had been working on from something that looked like this: ![Combined](http://i.stack.imgur.com/h50vX.png) To something that looks like this: ![enter image description here](http://i.stack.imgur.com/6Gh2J.png) I tend to sway towards having a few big projects as opposed to many smaller projects, but I am open to new ideas and I would love for some input on this. Does anyone have experience with either of these approaches either really working out, or completely falling apart a few years down the line?


Does Fred Brooks' "Surgical Team" effectively handle the bus factor?

My team of 4 experienced developers works on a large, modular Windows application (approx. 200 KLoC). I have focused on the core codebase since the beginning of the project (3 years ago) and have gradually shifted to a semi- lead developer position, though I am not the team manager. Our current iteration is a high-priority UI refresh requested by upper management, involving about 15 changes to the core codebase. When asked by the manager, I estimated that each of the 15 changes would take less than four hours **for me to complete** , a total of less than 7 work days. I then volunteered to perform the work. Instead, the manager decided to evenly divvy up all 15 tasks to all four developers. In the three days since we started work, I have observed two things:   1. The other inexperienced team members completed about 1 or less task each.   2. **Brook's Law** in action: I spent about half of my time providing assistance (attempting to coach them on using the components). As a result, I only finished 2 tasks myself, instead of the expected 5 or 6. I approached my manager with my concern that we were running late and again suggested that I complete the remaining tasks. My request was kindly refused, and the stated reasons to split the load evenly was twofold:   1. Limit the **truck/bus factor** \- ramping up other developers on these skills now, so that in the future any work can be given to anyone, not just me.   2. To eliminate a "bottleneck" (me) and get work done faster. To be clear, I have no problems with: a) investing the time teaching, b) people touching my code, or c) job security. In fact, I regularly suggest to the team leader that I train other devs on certain aspects of the core codebase to reduce risk. In this iteration we also have a large collection of high-priority bug fixes targeted, so it would seem that more progress could be made if the workload were redistributed. In Mythical-Man-Month, Brooks' suggests a **"Surgical Team"** where every team is comprised of a lead + sub-lead (the manager and me), and some minor roles. I feel as though we are naturally falling into this organization, but my manager is working against it. I feel that the bus factor is already taken care of (the manager is well-versed in the core code), and that the bottleneck doesn't actually exist (involving more devs won't make the work go faster). I think that in this regard, a Surgical Team is a Good Thing. These are my feelings, but I'm not an experienced manager, nor have we had to deal with the bus factor (knock on wood). **Was Brooks right? Have you worked in a "Surgical Team" where the bus factor came into play? Are there better techniques to manage distributing expertise?** Similar questions:   * How to increase the bus factor and specialize at the same time?   * Always keeping 2 people expert on any one chunk of code


Which aspect of normal forms do entity-attribute-value tables violate, if any?

I'm not asking if EAV tables are good or bad. I'm wondering if they are considered "normalized", and if not, why? If they aren't normalized, which normal form are they violating and why?


As a programmer, are you professionally obliged to offer ongoing support after you've left a company?

I've had a few programming jobs in the past where I was the only developer working on a project. After I've left, I typically get several emails a week from these companies, usually from the developer(s) who's replaced me there. These emails are usually asking for details about how things work and how I'd best go about implement feature x based on the existing system. I'm usually polite and helpful, but these kind of communications really start to eat into my time making every job I work on another weight around my ankle. Not to mention they're projects that I chose to leave behind me for a good reason. My question is, would it be professionally 'ok' to tell them I'm just not going to offer support any more and refuse and answer inquiries? NB. None of these companies are paying me any type of retainer and the inquiries are often informal questions from developers and not management.


Data model for persisting queries to database

I have been asked to build what is essentially a query builder for a reporting application. The variety of objects to query, potential modifiers, number of conditions, and so forth to be reported on have made me conclude that a query builder would be the best way to go about this task. I am trying to decide the data model to back the storage of query parameters. I have seen the models in this SO question as well as in this tutorial. But since it feels especially important to pick a good model up front, I would really appreciate any input. Here is my current approach... please critique as I know it is not too good. **Query**   * QueryID   * QueryName, QueryDescription, etc **Entity** \- _ie Dog, Planet, Employee_   * EntityID   * EntityName, EntityDescription, etc **AttributeType** \- _ie INTEGER, DECIMAL, FLOAT_   * AttributeTypeID   * AttributeTypeName, AttributeTypeDescription, etc **BinaryOperator** \- _ie =, <, IS_   * BinaryOperatorID   * BinaryOperatorName, BinaryOperatorDescription, etc **AttributeTypeToBinaryOperator** \- _ie (INTEGER, >), (BOOLEAN, IS)_   * AttributeTypeID   * BinaryOperatorID **EntityAttribute**   * EntityAttributeID   * EntityID   * AttributeTypeID   * EntityAttributeName, EntityAttributeDescription, etc **EntityAttributeCondition** \- _ie Dog.Breed = 'dachshund'_   * ConditionID   * EntityAttributeID   * BinaryOperatorID   * ConditionRawValue - _ie 14, false, Tom_ **EntityAttributeConditionGroup** \- _ie (a AND b)_   * ConditionGroupID   * LeftConditionID   * RightConditionID   * LogicalOperatorEnum - _ie AND, OR, XOR_ **EntityAttributeConditionGroupToGroup** \- _ie (a AND b) OR (c OR d)_   * LeftConditionGroupID   * RightConditionGroupID   * LogicalOperatorEnum


What is the Controller in Django MVC?

Learning Django MVC and the way I thought of it is: **Models** are the database tables represented in Django as Python classes.   **Views** are the HTML returned from function in views.py.   **Controllers** are the actual functions themselves in views.py invoked from a HTTP request. However I read on Wikipedia (at the time of writing): > ... a regular-expression-based URL dispatcher ("Controller"). I would have thought the mapping of URLs to functions as routing - not the controller. But perhaps I am wrong - I guess I got my ideas because is ASP MVC the functions that handle the requests are contained in classes called Contollers...


Cannot understand a certain point in Agile Manifesto Principles

I was reading Agile Manifesto Principles. Everything seems clear and reasonable except for one point: > Simplicity--the art of maximizing the amount of work not done--is essential. I dont understand this. Does this mean that the work that wasn't done should be somehow exaggerated? If so, it doesn't really make sence.


Java code quality in methods calling methods

I am currently working with an "interesting" code-base and see the following type of thing alot in the code.               public Object doSomething()     {         Object obj = new Object();              // Do some stuff to the object              obj = doSomthingElse(obj);                  return obj;     }      I always feel when looking at this kind of code that it is somewhat incorrect to have an object be passed into a method as a parameter but also set the object returned by the method to the same variable that was referencing the passed object. I would usually do something like the following, where I create a new variable to avoid any confusion.               public Object doSomething()     {         Object obj = new Object();              // Do some stuff to the object              Object anotherObj = doSomthingElse(obj);                   return anotherObj;     }      Am I wrong in thinking the second code snippet is more readable/correct?


Why isn't functional programming more popular in the industry? Does it catch on now?

During my four years at university we have been using much functional programming in several functional programming languages. But I have also used much object oriented programming to, and in fact I use object oriented languages more when doing my own small project to prepare for my first job. But I often wish that I was coding in a functional programming language when doing these projects. However, when looking for a job, it is very rare to see a job where knowledge of a functional programming language is required. Why isn't functional programming languages used more in the industry? There is quite much news about functional programming languages these days, so I wonder if functional programming is catching on in the industry now?


JavaScript and the paradigm shift in web programming

If my memory serves me right, there was a time when using JavaScript for web development was hugely frowned upon, because among other things, it was a privacy and security concern for users and some people just had it off. Nowadays, you can hardly see a major website that doesn't use JavaScript, and many websites will cease to function altogether without JS, graceful degradation be damned. Either that, or usability will be severely impacted, like on SE sites. What has changed between then and now that made JavaScript practically ubiquitous in web development? Or is my assertion that JS was frowned upon a figment of my imagination and it has always been this way?


How to unit test Visual Basic 6 legacy code?

I am doing legacy software programming in Visual Basic 6.0. How do I unit test it?


Are RAD tools worth the trouble?

I have used RAD tools for windows and web development for many years (primarily Infragistics). I invariably find myself in some situation where I have a very difficult time figuring out what is going on because these controls have layer upon layer of indirection and abstraction. This goes for all sorts of RAD tools, including AJAX update panels, AJAX grids, etc. More than once I have found myself asking "Is this worth the trouble?" For all the trouble and time I take debugging what often are bugs or quirks in these controls, would it be better to just code my own AJAX? Code my own extra functionality instead of using these RAD tools? The other problem with them is it keeps us unfamiliar with the technology they are using, for instance I have never done my own AJAX because I have always had update panels etc. But I imagine this would be useful to know. What is your take on this? Note: Please don't just say "Well you should try XYZ RAD tools instead of Infragistics...they are better". This isn't a debate on the RAD tool itself. This question is about RAD tools in general, not the merits of the one I mentioned in my question.


Ubiquitous Language - conflict between correctness and usability

A core part of Domain Driven Design is the consistent use of a ubiquitous language across the system - in conversations, code, database schema, UI, tests, etc. I'm involved in a project in which there is a well-established domain language already, defined by an international standards organisation. However, the work we're doing is for a public web site, and the 'correct' terms for the domain aren't necessarily how the public typically use and understand them. The compromise we're using at the moment is to use the 'official' terms everywhere, except for in our acceptance criteria which refer to UI components, where we use the informal names. Does this seem like a reasonable approach?


How can I use unit tests and TDD to test an app that relies mostly on database CRUD operations?

At work, one of my projects is mostly about taking data passed in from an external client and persisting it in a database. It's a Java enterprise app using JPA and most of our logic revolves around CRUD operations. The majority of our bugs involve JPA in one way or another.   * Example 1: If you click the save button twice, JPA might try to insert the same entity into the database a second time, causing a primary key violation.   * Example 2: You retrieve an entity from the database, edit it and try to update its data. JPA may try to create a new instance instead of updating the old one.  Often the solution is needing to add/remove/change a JPA annotation. Other times it has to do with modifying the DAO logic. **I can't figure out how to get confidence in our code using unit tests and TDD. I'm not sure if it's because unit tests and TDD are a bad fit, or if I'm approaching the problem wrong.** Unit tests seem like a bad fit because I can only discover these problems at runtime and I need to deploy to an app server to reproduce the issues. Usually the database needs to be involved which I consider to be outside the definition of a unit test: These are integration tests. TDD seems like a bad fit because the deploy + test feedback loop is so slow it makes me very unproductive. The deploy + test feedback loop takes over 3 minutes, and that's just if I run the tests specifically about the code I'm writing. To run all the integration tests takes 30+ minutes. There is code outside this mold and I always unit test that whenever I can. But the majority of our bugs and the biggest time sinks always involve JPA or the database. * * * There is another question that is similar, but if I followed the advice I'd be wrapping the most unstable part of my code (the JPA) and testing everything but it. In the context of my question, I'd be in the same bad situation. What's the next step after wrapping the JPA? IMO that question is (perhaps) a step to answer my question, but not an answer to it.


Pattern for SQL data mining app

We have an app that is used for data mining on our client database. Typical uses include getting a list of clients and their email addresses, running reports about user transactions between certain dates and returning clients that live in a specific area. High level functional requirements are:   1. Each data mining query needs to be able to exported to excel.    2. Parameters need to be supported (so that we can filter results etc).    3. Other apps would need to be able to access these queries as well as their results. It has been implemented as follows:   * A database function is created for each SQL query.    * There is also a table that contains details of each function as well as required parameters as their types.    * There is a web front end where the SQL queries are maintained, and can be run and exported.    * A web service exists that other apps can use to run queries. The method to run a query returns a dataset and gets passes parameters and their values in XML.  Our current solution works but there are some problems with maintaining the hundreds of DB functions (would it be necessary to use functions - couldn't we just store SQL in tables?). I also have some security concerns around SQL injection as our front end basically allows the users to input any SQL. Has anyone had to develop something similar and what approach did you use? What was your reasoning for using that approach?


HTML/CSS plagiarism

I'm facing an issue here. A customer asked me to copy an exact site, and even though I'm trying to convince him of going for a new design he does not accept it. He loves this design so much (on a side note it's horrible and outdated, but I wouldn't say that to him!) It's been a couple of weeks since we are discussing this and I don't know what to do. Do you have similar experiences? I don't want to lose the customer, he pays well and his jobs are really easy. At the same time, I don't want to put my signature on someone else's work. Any suggestions? Similar experiences? Thank you!


Age of Design Patterns

When did these design patterns originate? Balking, Builder, Delegation, Facade, Memento. I have looked for days across the net, so if someone points me to a simple google search I may shoot myself. The real question I have is only which is the oldest and which is the youngest, so the specific dates for each are not important. I have already found that the Balking pattern originated in 2002.


Can freelancers ask their client to sponsor an iPad for project needs?

I do freelance web projects for a client. The client has been asking me to buy an iPad for testing purposes. Should I ask him to get me an iPad ? I otherwise don't have any need for the iPad. Is it ethical to ask for sponsorship when you are getting paid for the projects ? Should I try it out ?


What do you call a problem caused by a design flaw

Is there any terminology for a problem that is caused by a previous wrong decision? For example you build your own framework, with a flawed MVC design. This in turn leads to weird situations when routing requests. A person then asks how to solve the latter problem, while the actual problem is the wrong design of the framework. I've tried searching several descriptions but as I'm looking for the word, it's hard to find anything relevant. It's not one of these Anti-patterns


How to test the render speed of my solution in a web browser?

Ok, I need to test the speed of my solution in a web browser, but I have some problems, there are 2 versions of the web solution, the original one that is on server A and the "fixed" version that is on server B. I have VS2010 Ultimate, so I can make a web and load test on solution B, but I can't load the A solution on my IDE. I was trying to use fiddle2 and jmeter, but they only gave me the times of the request and response of the browsers with the server, I also want the time it takes to the browser to render the whole page. Maybe I'm misusing some of this tools... I don't know if this could be usefull but:   * Solution A is on VB 6.0    * Solution B is on VB.Net Thanks in advance!


Domain-specific language for text search/processing?

I work for an organization that does a lot of work with government data. We have a couple of different projects where we've abstracted out common text search/manipulation operations into reusable libraries, for things like standardizing the way politicians' names are displayed (e.g., transforming "MCDONALD, BOB (R-VA)" into "Bob McDonald (R-VA)"), or finding legal citations in text (e.g., finding a reference to (e.g., finding occurrences of things like "1 U.S.C. 7" in text, determining that it's a US Code citation, and returning a structure that says it's referring to section 1 of title 7). These are relatively simple operations, and lots of collaborators in our space would like to use them, but we end up having to pick a language in which to implement each (the former is in Python; the latter, Javascript), and we freeze out potential consumers/contributors who work in different languages and don't want to resort to hacks like shelling out to a node process to handle their text. This all seems like a shame because what we're expressing is so simple, and ought, one would think, to be pretty easy to share. What would be ideal would be a tiny DSL that could express a few basic text processing operations: regular expression search/replace, a few list- processing operations like map and filter, and the ability to store stuff in JSON-ish data structures (maps and lists), and a mechanism to either translate this DSL into or allow it to be consumed from the actual higher-level languages we and our collaborators want to work with (Python, JS, Ruby, and PHP are probably the main ones). Does anything like this exist? I've considered building one myself... maybe a declarative thing on top of something like YAML, or maybe a tiny subset of Scheme or Lua, or maybe something entirely invented for this purpose. But I wanted to see if anything was already out there first.


How to unit test code which is intended to have different results on different platforms

I noticed some duplicate code in a codebase I am working on that appended a filename to a directory path, so I decided to refactor it into its own method. The application I am working on is not well tested, however; I just set up the first unit tests on it two days ago, so I am very concerned to get as much code under test as possible whenever I touch it. So I began to write a unit test like this (pseudocode):               Directory directory("a")     Expect(directory.prependPathToFilename("b")).toBeEqualTo("a/b")      However, I then remembered that the application is cross-platform. So I thought about this:               Directory directory("a")     String separator = "/" if (platform is *nix) else "\"     Expect(directory.prependPathToFilename("b")).toBeEqualTo("a" + separator + "b")      But I remembered that Roy Osherove says in section 7.1.2 ("Avoiding logic in tests") of _The Art of Unit Testing_ (178): > If you have any of the following inside a test meethod, your test contains > logic that should not be there: > >   * `switch`, `if`, or `else` statements > >   * `foreach`, `for` or `while` loops > > > > A test that contains logic is usually testing more than one thing at a time, > which isn't recommended, becauset he test is less readable and more fragile. > But test logic also adds complexity that may contain a hidden bug. Now, it does not seem that in this case I am testing more than one thing at a time. Would this be a case of an acceptible logic block in a test? Is there a pattern for cleanly testing behaviors/results that are _expected_ to be different on different platforms?


What programming language and framework has best support for agile web development?

If I would like to quickly set up a modern website, what programming language + framework has best support for this? E.g. short and easy to understand code for a beginner and a framework with support for modern features. Disregard my current knowledge, I'm more interested in the capacity of web programming languages and frameworks. Some requirements:   * Readable URIs: http://example.com/category/id/page-title similar to the urls here on Programmers.   * ORM. A framework that has good database support and provide ORM or maybe a NoSQL-database.   * Good support for RESTful WebServices.   * Good support for testing and unit testing, to make sure the site is working as planned.   * Preferably a site that is ready to scale with an increasing number of users.


getting back to c# programming after dabbling in non tech world

Whats the best way to get back and stay abreast to latest stuff going on with C#3/4? I do have Jon Skeet's book


Should companies consider remote employees or stick to local employees?

Elite developers can be 10x more productive than an average developer. Clearly it's easier to find an elite developer around the whole world than in a company's backyard. If a company is not located in a programming hot spot, should they consider hiring people who work from home?


Maintaining SVN history for a file when merge is done from the dev branch to trunk?

In my org, we use SVN for version control So for each build (done periodically), we merge the code to trunk from the development branch (all the developers checks in to this branch). So when we want a new branch say for a new release, we create from the trunk doing a svn copy. Now in the new branch we have the _history only from the trunk_ and not from _the previous development branches_. Is there any way to maintain the history when merge is done from the dev branch to trunk? **Update :** By history I meant revision History of each and every file . Who created it and who edit it. Unfortunately we are using svn 1.6 right now


On MVC can several views have the same controller or one view must have one unique controller?

I'm having some questions while designing a architecture for a project around MVC. (It's a C++/Marmalade SDK project, I'm not using any particular MVC framework, I'm making one.) On several articles (like on the original Steve Burbek article) I keep reading the concept "MVC triad" which bogs me since I took this concept rather literally. When I read it the first time looked like an application is built around "MVC triad" units - one for each UI piece I supposed -, but I find this rather un-flexible and I think that's not how MVC was intended to be used. Then, researching further on the issue, I found several examples of tight coupling of the controller and the view, namely, 1-to-1 relationship - TextEditView has TextEditController. But when I get back to my project I find that could be useful to have one controller (by 'logical unit', like AddElementController) and several views for that particular controller. I'm clearly thinking about something like an AddElementController that should have some sort of tab UI. Should I have a AddElementController that has a AddElementTabView and several AddImageView, AddSoundView, etc for the tabs? Or should I have a different 'sub-controller' for each tab view? In sum, and regarding the MVC pattern (not the X framework particular understanding/implementation of this pattern), is it correct to have several views for a controller or should each view have it's particular controller? Also, is it correct to keep some state information on the controller or should it be stateless (meaning that the state should be placed on some non-domain state model)? Thanks to all in advance.


Good architecture for user information on separate databases?

I need to write an API to connect to an existing SQL database. The API will be written in ASP.Net MVC3. The slight problem is that with existing users of the system, they may have a username on multiple databases. Each company using the product gets a brand new instance of the database, but over the years (the system has been running for 10 years) there are quite a few users (hundreds) who have multiple usernames across multiple "companies" (things got fragmented obviously and sometimes a single Company has 5 "projects" that each have their own database).   Long story short, I need to be able to have a single unified user login that will allow existing users to access their information across all their projects. The only thing I can think is storing a bunch of connection strings, but that feels like a really bad idea. I'll have a new Database that will hold the "unified user" information...can anyone suggest a solid system architecture that can handle a setup like this?


When to (enforce) linting in a software project

I'm heading a new team of developers working on a software project that makes use of continuous integration (circleci) w/ a pretty fleshed out suite of busterjs unit/integration/acceptance tests. Our project is primarily written w/ coffeescript, and I try to make use of coffeescript-linter to ensure everyone working our code base keeps code consistent and as organized as possible. My question is, does anyone have any thoughts on when/if/how to enforce linting? Should I integrate linting into my tests that are executed by circleci before deployment? Another thought I had was writing a simple shell script that combines git-push and the linting utility into one step and then including it in the project & having everyone use it. I'm pretty new to managing teams of programmers so anyone else's feedback is much appreciated. EDIT: In the last 3 seconds it just occurred to me that git-hooks is probably perfect for this. Specifically a git-hook on commit.


Who should register input listeners: the controller or the view? (MVC)

I'm using an (C++) SDK (Marmalade) and building a project around the MVC pattern. On my app, user input listeners may be registered on certain UI elements/widgets/etc providing a proper callback function (according to MVC should be a method of a controller, right?). In this scenario, who should register these listeners:   * The controller? (must have access to the view UI elements, less decoupling of control from presentation)   * Or the view? (direct access to UI elements but must have a reference to the controller, isn't this incorrect in MVC?) Between the two, I think the latter makes more sense and does better separation of concerns, but I'm afraid that I overlooked some problem with that design. Thanks in advance.


Precedence of operators

int x=2,y;     y= x++  + x-- - ++x;     printf("%d",y);      When I compiled using Turbo C++, I got 3 as the output. For the GCC compiler, I got 1 as the output. Why does the output vary?


What to do when client have unrealistic expectations?

I've been working on a project for the past six months at a client site since they require data confidentiality and didn't want us to work at our own office. When I showed up alone to this client site, I was told that I needed to finish the project in two months. Since the client is not a software company, and because of various policies, it took around 20-25 days just to give me rights on my machine to install stuff like eclipse, tomcat, etc. Even after the delay in getting the environment setup, they were still expecting me to complete the project in the same two month period. They did not give me any requirement documents, but since I'm working at the client site, we used to have meeting regularly to discuss the requirements. After six months the application is still not finished, and everyone is blaming me, but they fail to realize that we have added many more features than those discussed in the first few meetings. I've had to redo many things during this period, e.g. separate a form into two sections; a few weeks later, they ask me to merge the two forms again as its confusing, and so on. The scope of the application is increasing every day but they still think it's a two month project that got delayed. When I told them that scope has increased they ask why I didn't ask for requirements at the beginning. I already work 11-12 hours everyday and Travel 3-4 hours, and now they expect me to come on Saturdays also. I have to do everything here: take requirements, design, code and test. Please advise me what to do in such a case? Additional details: We did have a list of deliverables, but then they added a few more things to it saying these are also important. They also changed a few deliverables. They dont even have their UAT server, they test on my development machine itself via IP address.


How to design JavaFX client with JEE server. what is possible design?

I am using JavaFX as thin client as a view technology. Design is like...   * On Client Side:=> (View) JavaFX with client side validations   * On Server Side:=> (Controller and Model) Server side validations Servlets, WebServices, EJBs, JPA. There may be a possible need of HTML5 in future. I chose this design so that the application can scale and meet future needs. I have a form with some data which need to be submitted and its values are validated on client side as done in HTML with JavaScript. But after validation how can I submit my form values actually name/value pairs to server side where actual business is done. For getting data from server to client web services are good choice. How to send data from client to server on submit a form. So the question is:- Is there any `<form action='server/AuthenticateServlet'></html>` counterpart of html in JavaFX or it should be done using HttpClient like api? I have read about CaptainCasa framework but It is very thin client. For every change in view it connects to the server that is unnecessarily making the network busy and can not provide a good performance in a slow connections. Many things could be done in client site. I wan't some javascript like processing on client side. Except that I didn't find any framework or design pattern which fits to this problem. Any other ways to achieve this???


How Can I Improve my Workflow?

So I design and develop websites myself, mostly in WordPress. Once I'm happy with the site on my local server, I upload it and its database to the web server and let the client make whatever changes to the site. When he/she needs me to make changes to the code or the backend of WP, I usually work on the remote version of the site from then on, which is a pretty slow process compared to working locally. I guess what I'm asking is, is there a way to work on a local version of the site which syncs any changes made to the remote version of the site? Is this version control by any chance? Here's my typical workflow:   * Set up local database   * Code local WordPress site   * Export local database   * Import local database to remote server   * Upload all files to remote server   * Continue to make any changes post-launch remotely Is there any way to improve my current workflow?


Career in SQL Server Development

I am a fresher and i have started my career as "associate data analyst" in one of the reputed MNC. Right now i am working on microsoft sql server for queriong the database using T-SQL and also working on SSRS(SQL Server reporting Services). I want to know future scope for these technologies. Waiting for your answers


Does this happen in Common Lisp?

From Steve Yegge's "Lisp is Not an Acceptable Lisp":                Lisp has a little syntax, and it shows up occasionally as, for instance, '(foo)      being expanded as (quote foo), usually when you least expect it.      What is he talking about with `'(foo)` being expanded into `(quote foo)` in some situations? (As opposed, I would imagine, to `(quote (foo))`).


When are multimethods useful in practice?

The Common Lisp Object System (CLOS) supports multiple dispatch (multimethods). When is this a useful feature in practice? I'm not just looking for an example of hypothetical functionality that would be easier to implement with multiple dispatch[1]. I'm looking for examples of where it's useful in real software, for any value of real that means it would get written for something other than just an example. [1] In programming tutorials, are examples contrived more often than not?


How should we deal with multiple transaction-report requests?

We are developing a system for the retail market and of its features will enable clients (actually consumer clubs) to go through all transactions made by end-clients. One of the ways to get this information will be via an API. The idea is that there will be requests for reports with a start date and an end date, and a response will have all the transactions between those dates. We worry that some reports will be very large, and that some clients will repeatedly request for reports, in this case the DB and CPU will be very overloaded. The same server that is going to service those requests will also take care of the actual retail transactions (received by proprietary devices) and of the Web application. We are not sure about how to limit the report requests from the API so that it won't affect the system too much. **So, how should we deal with this scenario? any thoughts?** EDIT: just to make it clear: When I mentioned proprietary devices I meant "On- Location" devices which are used during sales with end-clients, this means that these requests shouldn't get delayed, and this is the main concern. **One more question : Some people here suggested the use of prioritized threads, i.e. - giving lower priority to the threads retrieving the reports, is this a good idea?**


What is Rainbow (not the CMS)

I was reading this excellent blog article regarding speeding up the badge page and in the last comment the author waffles (a.k.a Sam Saffron) mentions these tools: > dapper and a bunch of custom helpers like rainbow, sql builder etc Dapper and sql builder was easy to look up but rainbow keeps pointing me to a CMS, can someone please point me to the real source? Thanks. _Obviously the architecture of these [SE] sites is uber cool and ultra fast so no comments on that thanks._


Observer pattern for unpredictable observation time

I have a situation where objects are created at unpredictable times. Some of these objects are created before an important event, some after. If the event already happened, I make the object execute stuff right away. If the event is forthcoming, I make the object observe the event. When the event triggers, the object is notified and executes the same code.               if (subject.eventAlreadyHappened()) {         observer.executeStuff();     } else {         subject.subscribe(observer);     }      Is there another design pattern to wrap or even replace this observer pattern? I think it looks a little dirty to me.


What are the differences between aspect-oriented, subject-oriented, and role-oriented programming?

I know there are many papers describing these three paradigms but I'm looking for a schematic explanation. There are a few very good descriptions of aspect-oriented programming on here so I'm asking this question in the hope to get the kind of high-quality answer people at Stack Overflow are used to delivering.


What if a team member start listing aggressive deadlines and management is happy and programmers know they will work overtime?

A team member start listing fairly aggressive deadlines (for the project everybody is working on) -- something that is to be done well can take 4 to 5 days, and he lists it as 2 to 3 days. The program manager and the CEO are both happy, because that means people will work overtime and salary is lower as a result, and faster goal reached, etc. People do get burned out and it is not so long term sustainable. Are there good ways to handle it? I can talk to the management but sure it is a conflict of interest, because they want people working overtime and people don't want to always work overtime. (unless you tell them sprint for 2 months and we will give you 2 weeks extra holiday). If enough coworkers say this is not good, we can tell the management, but some coworkers don't care about quality as much (if shorter time just sacrifice quality), and some coworkers also like to please the management, and the remaining may not want to make noise to suggest that they don't want to work hard. What are some good ways to handle this?


Can observer pattern be represented by cars and traffic lights?

I wanted to verify with all of you, if I have a correct Observer Pattern analogy. The scenario is as follows: Consider, at a junction, there is a traffic signal, having red, yellow and green lights respectively. There are vehicles facing the traffic signal post. When it shows red, the vehicles stop, when it shows green, the vehicles move on. In case, it is yellow, the driver must decide whether to go or to stop, depending on whether he/she has crossed the stop line or not. At the same time, there are vehicles that do not care about the signal. They would do as they like. The similarities are that, the Traffic Signal happens to be the subject, notifying its states by glowing the appropriate lights. Those looking at it and following the signal are the ones subscribed to it, and behave according to the state of the subject. Those who do not care about it, are sort-of un- subscribed from the traffic signal. Please tell me, if you think this is a correct analogy or not?


Isn't striving for elegance counter-productive?

Many questions have been asked about the nature of elegant code and design, but the underlying assumption seems to be that _elegance is a good thing_. Therefore it is acceptable or even desirable to make some extra effort to create elegant solutions. **But is it really worth it?** I am not asking what is elegant; neither am I asking about good code. I assume that "you know it when you see it", and it can also be vaguely characterized by verifying that there is nothing left to take away, in a sense that the mental model you have in your mind is expressed directly and unobscrured in the language of your choice (programming language, object oriented design, relational schema etc.), without distractions. However, a corollary to it is that elegance is always relative (and in a way subjective); it depends on what you think the problem is and what the solution should look like. The problem of course is that both the problem domain and your understanding of it constantly change (additionally, your knowledge about the programming language / patterns / tools develops, but that's not what I am mainly concerned about). This implies that in order to keep your design elegant, you have to constantly rethink it as the problem / your undestanding of it evolves. Practically, doing so would result in almost endless refactoring. Furthermore, I even maintain that by striving to develop elegant solutions maintainability necessarily suffers. The most elegant solutions are the most tightly coupled to the problem domain, for if they weren't, then there would be something to take away from it, hence they would not be most elegant anymore. If there is something abundant in your solution, then you can simplify it and make it more elegant by removing that abundant part, right? But then, sometimes, when you have a really elegant design and are required to implement a change, you first have to "untighten" your solution, just in order to be able to make an unforeseen (as are most of them) change at all. However, the open/closed-principle states that this should not be necessary. So, another more concrete formulation of the question is: **To some degree, aren't elegance and open/closed-principle at odds with each other?** What do you think?


Finding header files

A C or C++ compiler looks for header files using a strict set of rules: relative to the directory of the including file (if "" was used), then along the specified and default include paths, fail if still not found. An ancillary tool such as a code analyzer (which I'm currently working on) has different requirements: it may for a number of reasons not have the benefit of the setup performed by a complex build process, and have to make the best of what it is given. In other words, it may find a header file not present in the include paths it knows, and have to take its best shot at finding the file itself. I'm currently thinking of using the following algorithm:   1. Start in the directory of the including file.   2. Is the header file found in the current directory or any subdirectory thereof? If so, done.   3. If we are at the root directory, the file doesn't seem to be present on this machine, so skip it. Otherwise move to the parent of the current directory and go to step 2. Is this the best algorithm to use? In particular, does anyone know of any case where a different algorithm would work better?


Confusion in my If Else ,Else If Condition. in C#

I have three column as follows:   * Month   * Tech   * Circle According to this column I need to fetch the data. In Month Column, Data is : Jan,feb, March... and so on.   In Tech Column, Data is : Gsmnqi, Gsmboi... and so on.   In Circle Column, Data is : Ap ,Kol, Mumbai.. and so on.   I want to prove four condition as follows:   1. if I select the month it will fetch the data related to month, tech and circle will not be selected.   2. if I select the month and tech it will fetch the data related to month and Tech, circle will not be selected.   3. if I select the month and circle it will fetch the data related to month and circle, Tech will not be selected.   4. if I select month, tech and circle it will fetch the data related to month, tech and circle. But my if condition is not working, seriously I get confused in if, else and else if for this four condition.                 if (nqiSqiEntity.Month != string.Empty)       {           query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "'  order by id asc");       }       else if (nqiSqiEntity.Month != string.Empty && nqiSqiEntity.Tech != string.Empty)       {           query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' and TECH = '" + nqiSqiEntity.Tech + "' order by id asc");       }       else if (nqiSqiEntity.Month != string.Empty && nqiSqiEntity.Circle != string.Empty)       {           query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' and CIRCLE = '" + nqiSqiEntity.Circle + "' order by id asc");       }       else       {           query.AppendLine("select * from K2_NQISQI with (nolock) where MONTH = '" + nqiSqiEntity.Month + "' and CIRCLE = '" + nqiSqiEntity.Circle + "' and TECH '" + nqiSqiEntity.Tech + "' order by id asc");       }      In condition, instead of `string.Empty` I need to put the value or I need to check if the value is present then only condition should get executed. Please kindly help me in my understanding this code.


What to use for simple cross-platform games instead of Flash?

In short, for simple games:   1. Is Flash still a good option for browser-based PC clients? It still has 90%+ penetration.   2. What is a good alternative for mobile devices? Is HTML5 + JavaScript **the** choice for mobile? Or does one have to learn a new native language for each target platform? (Android, Apple, Windows Phone)... If you desire further background: There are more blogs about the official demise of mobile Flash than I can count, along with endless useless and vitriolic comments. I'm actually trying to do something practical: build simple games that can be served accross multiple platforms. Several months ago I plopped down $1100 for CS5.5 Web and am wading into Flash. Bummer. My question to people who actually develop simple games and apps: What platform should I use instead? Is Flash still a sensible platform for web-served PC users? For example, let's say I build a simple arcade game that I would like to serve as an app to mobile users and as a browser-based game to PC users. Should I still invest the time and effort to learn and develop in Flash for the PC users, while building a parallel code set in some other language for mobile users? My games are simple enough that it would be annoying but not inconceivable to maintain parallel code sets.


What's the point of adding Unicode identifier support to various language implementations?

I personally find reading code full of Unicode identifiers confusing. In my opinion, it also prevents the code from being easily maintained. Not to mention all the effort required for authors of various translators to implement such support. I also constantly notice the lack (or the presence) of Unicode identifiers support in the lists of (dis)advantages of various language implementations (like it really matters). I don't get it: why so much attention?


Programming Without A Computer

> **Possible Duplicate:**   >  Learning to program without a computer I have a bit of experience programming (6 Months) and am soon to go on a 2 month trip where I will be without a computer, but with lots of spare time. Is there a way I can keep programming (or learning to program) even without a computer? Should I read language-agnostic books like Code Complete or PragProg?


Is "responsive web design" becoming a "badge to wear" for front end devs?

This may seem like an odd question. However, more and more I am seeing web applications that are built on the "mobile first" / "responsive design" principle that are about as responsive as a wasp in winter. Mobile isn't a "trend" but it's being treated like that. It's "trendy" and "eye-catching" for digital agencies to be "mobile first", but for most that only means one or more of the below:   * @media queries   * Jquery mobile   * Twitter bootstrap I've recently seen a site which was billed as "mobile first" which only used @media to differentiate between devices. It was a .NET webforms application that heavily relied upon view state and the download size for just the homepage (pre postbacks) was over 1mb! Responsive? Not on my crappy Samsung in the middle of a field. I know that this just sounds like a rant, but I'd really just like to know what peoples opinions are on how to tackle device differentiation? Personally, I show / hide markup (ie sections of a page / includes) based on device to ensure, not only the layout and functionality are optimized, but the download total too. Am I a dinosaur?? Am I wasting my time??


What exactly is a Search Engine Indexer. Where to start building one?

For one of the projects at uni we were given the task to create a custom, niche search engine. My colleges and I split the tasks amongst each other so that we can tackle the overall project more easily. My part is to create the indexer. I already read the wikipedia page on search engine indexers and some other related articles but I'm still struggling to understand exactly how it works and how it looks. To me it is obvious that it is not just a regular table with an index and a descrption column. So my question would be, what is a search engine indexer comprised of, how does it architecture look, and where to start from in building one?


When presenting a software design to upper management

I'm presenting a software design for approval today and as I'm going through the hundreds of pages of design documentation, cherry picking what's important, I'm unsure if I should start with the activity diagrams or use cases. I was thinking of having it stacked like so:   * Activities Diagrams   * Use Cases Diagrams   * Sequence Diagrams   * Class Models I've spent the last 7 months of my life creating this and I want it to be presented in the most logical order and done with.


What modelling technique do you use for your continuous design?

Together with my teammates, I'm trying to self-learn XP and apply its principles. We're successfully working in TDD and happily refactoring our code and design. However we're having problems with the overall view of the design of the project. Lately we were wondering what would be the "good" practices for an effective continuous design of the code. We're not strictly seeking the right model, like CRC cards, communication diagrams, etc., instead we're looking for a technique to constantly collaborate on the high level view of the system ( _not too high though_ ). I'll try to explain myself better: I'm actually interested in the way CRC cards are used to brainstorm a model and I would mix them with some very rough UML diagrams (that we already use). However, what we're looking for are some principles for deciding **when** , **how** and **how much** to model during our iterations. Have you any suggestion on this matter? For example, when your teammates and you _know_ you need a design session and how your meetings work?


As a young developer, should I be worried about having to use "out-of-style" tech at work?

I'm a recent college graduate (last May!). While I was still in school, I wanted to make sure that I had a job before I graduated, and very early (probably too early) in my job search I settled on one in a region I'd been hoping to move to after undergrad. However, I've been second guessing this decision for months now, for several reasons. One is that I'm not very challenged at work, and I feel like I haven't improved much at programming since starting here. I can always make time to work on open source (and have in the past) outside of my job, though, so I do have a venue to get around this disappointment. More importantly, I'm worried by the fact that my job is basically to work on a creaky old Perl web application (using Mason and a weird in-house ORM). Am I shooting myself in the foot here by working with a technology that's no longer popular, and won't really help me out getting a job in the future? I rarely see Perl jobs, and when I do, it's usually doing something I'm not interested in (front-end web development stuff). Systems programming, visualisation, network programming, or at least backend web development stuff are the sort of topics that I'd actually enjoy working in -- it doesn't seem like my current work experience is helping me towards positions doing any of these things.


Does JavaFX have a future?

I have not intended to hash and rehash the same matter, but just to decide, what to learn first (JavaFX, Flex, HTML5, etc.) I would pull through a kind of survey, especially as the recent similar questions here came out since at least one year. So, what is JavaFX prospect as a RIA technology for the next couple of years?


Why was Scala not implemented with C or C++

Does anybody know why was Scala implemented in Java and .NET instead of C or C++? Most languages are implemented with Cor C++ [i.e Erlang, Python, PHP, Ruby, Perl]. What are the advantages for Scala implemented in Java and .NET other than giving access to Java and .NET libraries? **UPDATE** Wouldn't Scala gain more benefit if it were implemented in C because it can be tuned better rather than relying on JVM?


New C++11 analogous to python 2 ->3?

1. I'm a Python2 developer and I just ordered The C++ programming language, 4th edition, from Bjarne Stroustrup's, to learn C++11. But right after I ordered it, I started to wonder if I made a mistake. Are the changes made to C++ in C++11 analogous to how Python moved from 2 to 3 insofar as code significantly breaking and not being backwards compatible? Or is learning C++11 safe to do?   2. If I coded C++11 in XCode, the latest version being whatever it is, would it work on say a Windows machine? Or does that depend more on what will compile the code, fairly certain that XCode uses LLVM.


"Open-source" licenses that explicitly prohibit military applications

I am a researcher, and in my research I do a lot of programming. I am a big fan of the open-source concept - especially in research, where transparency and reproducibility is already a big part of the culture. I gladly contribute as much as I can to the community, and releasing my code for anyone to use is part of that. However, in research there is always a certain measure of uncertainty about what the stuff you produce will be used for. I fully understand that I can't copyright any results or conclusions - but I can protect how others use my code, and I would like to make sure that there is no (legal) way to incorporate software I produce in military applications. I've read through a few of the shorter ones of the common OSS licenses, and summaries of some more, but they all seem to focus solely on the questions "do you earn money on my code?" and "do you make my code available with your program?" - nothing about what the program actually does with the code. Are there any good open-source licenses that explicitly prohibit all kinds of military applications? ### Update: After reading up some more on how OSS works, I've realized that a license that meets my needs by definition will not be open-source, since open-source licenses cannot discriminate against fields. Thus, I'm rather looking for a license that is _like_ an open-source license, except that it prohibits military use. I want this license to be already existing, authored or at least reviewed by someone who actually knows licensing, since I don't. Also, in response to a couple of remarks that this will be difficult to enforce: yes, I realize that. But this is more for myself than for the legal implications; if I use a license like this, and a military organization uses my code anyway, they are breaking the law and they are doing it despite my explicit instructions not to. Thus, the potentially gruesome things that they do with applications that include software I've written are no longer "on my conciousness", since they stole the software from me. (And somewhere I have a naïve hope that if they need something I've done, and my license prohibits them from using it legally, they'll get someone elses program that does the same thing and allows them to use it. Not that governments always do, but they always _should_ abide by the law...) It's a moral safeguard, so to speak, rather than something I actually expect to bring up in court (if my mediocre code is ever used by CIA...)


What does the word Relational in "Relational Database" imply?

I tried searching but didn't get any useful information. What does the word "Relational" mean here? Is it tables being related to each other just like the real life entities, or does it mean something else?


Using object flow and control flow in UML

I have a UML activity diagram below, where there are two ways are shown in which actions can be done. ![enter image description here](http://i.stack.imgur.com/bhttT.jpg) Since the setting of values of **a** and **b** can be done any order before the action 2 is executed so, I'm wondering if both of the ways shown here are correct or if there is a difference between them?


Are there any languages that have both high- and low-level facilities? If not, is it feasible to create one? Why or why not? In theory, it would be very helpful to have a programming language that has both shell and regular programming language facilities, like Forth for example can easily be made to, and also to have high-level facilities; Forth does not seem (and it would probably take a good bit of work to make it) like a natural fit for high-level things. Of course, languages like C or C++ can be made to simulate features of high- level languages, but at the cost of ugly or difficult syntax, and the addition of considerably more complexity, or at the cost of a lot of work, which would be unnecessary since it would often be easier just to use a more standard high-level programming language. **Clarification** : Low-level meaning things like manual memory management, limited data structures, only one return value, and the like. Examples: Assembly language, C, C++ to some extent, and Forth. High-level language examples would be: Python, Perl, JavaScript, Java and C# to a big extent, Lisp.


How can I compute maximal area including only given integer pairs of (x,y) coordinates?

The values of a function of two variables z = f (x, y), where x, y, z take integer values are stored in sql db. Calculate (appoint) the largest surface area of the flat. By 'flat area' we mean an area about which for each pair of x and y lying inside the area about the value of the function is constant (z = const). I have already tried to use this flood fill algorithm, but I am not sure if this is the right way. e.g. if I have pairs(x,y) as follows: (0,0),(0,2),(2,0),(2,2) for which z equals to 5(z=const) and have point (1,1) where z=1 - how should I compute "flat area"?


MySQL proficient?

I've been looking to apply to various web development intern jobs, and I feel comfortable with the PHP/CSS/HTML that they are asking for, but what does MySQL proficient mean? I've designed my own databases in phpAdmin and used them in the CMS I created, does that mean I'm proficient in MySQL? Do you just need to be able to create a database and then update/delete/insert fields in there? Would knowing this much allow me to put MySQL on my resume?


How do you QA and release software quickly with a large team?

My work used to be a smaller team. We had less than 13 devs for a while. We are now growing rapidly, and are over 20 with plans to be over 30 in a few months. Our process for QA'ing and releasing each build is no longer working. We currently have everyone develop the new code, and stick it onto a staging environment. A few days before our weekly release, we would freeze the staging environment and QA everything. By our normal release time, everything was usually deemed acceptable and pushed out the door to the main site. We reached a point where our code got too big so we could no longer regress the entire site each week in QA. We were ok with that, we just made a list of everything important and only covered that and the new stuff. Now we are reaching a point where all the new stuff each week is becoming too big and too unstable. Our staging environment is really buggy week after week, and we are usually 1-2 hours behind the normal release time. As the team is growing further, we are going to drown with this same process. We are re-evaluating everything, and I personally am looking for suggestions / success stories. Many companies have been where before and progressed beyond, we need to do the same