Good practice on Visual Studio Solutions

Hopefully a relativity simple question. I'm starting work on a new internal project to create tractability of repaired devices within the buildings. The database is stored remotely on a webserver, and will be accessed via web API (JSON output) and protected with OAuth. The front end GUI is being done in WPF, and the business code in C#. From this, I see the different layers Presentation/Application/Datastore. There will be code for managing all the authenticated calls to the API, class to represent entities (business objects), classes to construct the entities (business objects), parts for WPF GUI, parts of the WPF viewmodels, and so on. **Is it best to create this in a single project, or split them into individual projects?** In my heart I say it should be multiple projects. I have done it both ways previously, and found testing to be easier with a single project solution, however with multiple projects then recursive dependencies can crop up. Especially when classes have interfaces to make it easier to test, I've found things can become awkward.


Can programmer experience be expressed in hours of coded like hours of flight for a pilot?

How useful would it be for a recruiter? In martial arts there are a minimum number of trainings, not years of practicing, to be evaluated for a higher level. I saw some exceptions but there are rare. In software, maybe this would be valuable to express experience in particular technologies such as OO, OR/Mappers or specific DBMS.


What is the most effective grammar to use for issue titles?

When choosing a title for a new issue, there are several grammatical options to choose from. Here are four different options for an example issue I just made up:   * **Descriptive** : "Newlines are not stripped when multi-line headers are parsed"   * **Imperative - negative** : "Avoid leaving newlines when parsing multi-line headers"   * **Imperative - context first** : "Fix parsing of multi-line headers: strip newlines"   * **Imperative - desired action first** : "Strip newlines when parsing multi-line headers" At my workplace the issue titles alternate between all of these formats, but I keep thinking it's better to pick a convention and stick to it. Which option (from the above, or a different one) is the preferred one, i.e. the one that will minimize the effort of developers reading these issues? **Edit:** as noted in the comments, different issue types may warrant a different choice of grammar, where an especially important distinction is between bugs and new work. To make the question more specific, let's say we choose, as msell offers in his answer, the descriptive option. Now let's look at a suggestion to improve an existing feature:   * "Add city information to geolocation" If we stick to the descriptive grammar, we should replace that title with   * "City information missing from geolocation" However, this seems less clear, since the lack of city information is not a bug, it is the expected behavior. The reporter is merely suggesting to improve that behavior. So it seems the imperative option is the way to go with that issue. Let's look now at an entirely new feature. Consider these options:   * "No ability to export report to XML"   * "Add ability to export report to XML"   * "Export report to XML" Describing the current behavior seems even more ridiculous here, but the imperative option doesn't look so good too. The third option simply describes the new feature itself, which might be the way to go here, assuming the issue has meta-data that indicates this is a “new feature” issue.   * **So what's more important - sticking to one convention, or matching the grammar to the issue?**   * **Where would you draw the line between a descriptive title and an imperative title?**   * **When would you describe the current behavior and when the desired behavior?**


How should I recursively process a file in Haskell?

Basically I'm expanding a literate program in Haskell. There are two things I need to look for to expand. Here's an example file:               program.c.lit:     ==============     Some comments in the source file that I can ignore         <main>=         code.. code ...         code..         <a>           Some comments in the source file that I can ignore         <a>=         code... code...         code..      In a file, I need to look at each `<some var>` and substitute it with its matching definition defined below `<some var>=`. All the lines which are indented with 4 spaces below a `<some defn>=` are included in that chunk. In the end i should have a file consisting of only `code ...` lines. How should I approach this problem in terms of file processing, what's a good approach? I'm comfortable with recursion, less comfortable with monads.


Is eventual consistency a wrong solution for e-commerce applications?

I'm reading about eventual consistency in couchDB. I'm somewhat confused by the term and its consequences on an application. Let's say I'm building a distributed e-commerce website where monetary transactions are critical. There could be online auctions running and people bidding on them in real time. Will using a eventual consistent DB such as couchDB be a wrong solution? Should I favor a more consistent solution such as a relational database? Is couchDB suitable for something non critical such as a social network where one wouldn't mind if his news feed isn't up to date or when comments on his posts are somewhat delayed by few seconds? Update I'm talking about building a distributed system. I think in case of a single server nothing of this will matter.


Search results in PhpStorm

I have two questions on the search results panel (Find Occurrences of...) in PHP Storm:   1. What does "Unclassified usage" mean? How can results be classified?   2. Is there any way _not_ to group results by file? I am using the latest version (3.0.3)


What are the Top Developer Productivity Tools/Plugins for Java in Eclipse?

I personally use CodeRush in Visual Studio 2010 to do refactoring, write code faster with templates and generally navigate my code 10 times faster than stock VS. Recently, I've been working on another Android app and got to thinking... **What are the top productivity plugins for Eclipse?** Preferably free. I'm looking for plugins that help write in Java, not PHP or Rails or any of the other languages Eclipse supports.


Modeling objects as functions

I want to model simple objects as functions, to see where the pure functional approach gets me. Let's say my object is a person. There is some function that returns me a new person, but instead of just some data structure, it returns me a function that represents the person. I'm having difficulties to see what this function should exactly look like, because I mostly associate data/state with a person but not any function. So if I call this person, which is a function now, what input should it take and what should it return? If I look at the lambda calculus and some examples of how to model numbers, 0 is just the identity function. 1 is a function that takes another function and a value as input and returns the argument function applied to the value. 2 applies the function twice, etc. So should the implementation of a person be a function that takes another function as input and applies it to the person, returning its output? So it's actually just a container for the person's data allowing other functions to operate on it. May be it makes no sense to think about this without knowing exactly what a persons consists of. In a most simple case a person could be just a name. A briefly tried to outline this in Clojure:               (defn new-person [firstname lastname] (fn [f] (f firstname lastname)))     (defn get-firstname [person] (person (fn [x y] x)))     (def p (new-person "Maja" "Abel"))     (get-firstname p)     "Maja"      Then again the names are strings and not very functional ... Hope this makes some sense, glad if anybody has some thoughts on it!


Pattern for group of entities with one required primary member

Given a parent entity with a collection of child entities where there must be exactly one primary child of the group? To make the question more concrete, I've seen a number of ways that this pattern might come up -- a group of people where one person is the leader or the contact details for a person where one is primary. Here are two different approaches that I've seen. **1\. Flag the member as primary** In this approach, a field is added on the member to designate it as primary. The advantage is that it is simple to implement and avoids additional relationships. The disadvantage is that it is more difficult to enforce in the data model that one and only one member is primary and from an object perspective, potentially puts the responsibility on the child that should be on the parent. **2\. Additional association** In this approach the parent tracks the primary member of the group and stores the id of the child. This is in addition to the children storing the id of the parent as a member of the group. This makes it explicit in the data model that there is only one primary member and an index can be added to enforce it. The disadvantage is that it requires two relationships and there is a chance that they can disagree (parent points to a child that doesn't belong to the parent). It seems to me that this is a common pattern and must be documented as a design pattern or model pattern in an architecture book somewhere. A similar pattern might be where the collection is a history and there is one current, but that is a bit easier as each member would have a date range that can be indexed. Are there better approaches? Or can someone point to where this pattern might be documented more formally?


How to Console.WriteLine from [TestMethod]?

I am trying to show some information from a [TestMethod] method. Usually we use NUnit and a line with Console.WriteLine runs fine and we can see it in 'output' window, but on this project we must to use Testing tools embebed with VS2010 and Console.WriteLine doesn't run because we cannot see anything.


Agile development challenges

With Scrum / user story / agile development, how does one handle scheduling out-of-sync tasks that are part of a user story? We are a small gaming company working with a few remote consultants who do graphics and audio work. Typically, graphics work should be done at least a week (sometimes 2 weeks) in advance of the code so that it's ready for integration. However, since SCRUM is supposed to focus on user stories, how should I split the stories across iteration so that they still follow the user story model? Ideally, a user story should be completed by all the team members in the same iteration, I feel that splitting them in any way violates the core principle of user story driven development. Also, one front end developer can work at 2X pace of backend developers. However, that throws the scheduling out of sync as well because he is either constantly ahead of them or what we have done is to have him work on tasks that not specific to this iteration just to keep busy. Either way, it's the same issue as above, splitting up user story tasks.


How are my licensing options limited when I use and/or include other projects in my own?

### Setup I have a project (pynliner, a python module) on github that I never gave much thought about licensing. Today I got an email asking what license it is under because someone wants to use it in their commercial software. My first thought is that I would love to have 2 licenses one that is free for non-commercial use and one for commercial use. So I started researching software licenses... and got very dizzy. Then I realized I may not even be able to use most of them because my module uses several other modules. So I have a few questions about how licenses filter down. My module uses but does not include code under:   * **MIT License** BeautifulSoup   * **LGPL3** cssutils And my module uses and includes code under:   * **MIT License** soupselect.py This is a relatively minor project but I would like to use it as a learning process for the right way to approach licensing. ### Questions   * If I include someone else's code then any licenses I use must not break the included code's license correct?   * Does the same hold true for other software I use but don't include? _Am I limited by the MIT License on BeautifulSoup or LGPL3 on cssutils if I use them but don't include the source in my project?_ * * * ### edit Thanks for pointing out the licenses I had missed on cssutils and soupselect.py. Once these were pointed out the rest of my questions really come down to what is allowed within the MIT License since it is the only one over code I have included and whether or not the output of cssutils is free. I'm comfortable with looking these up the rest of the way. Thanks all.


Applicability of the Joel Test to web development companies

**QUESTION** : How can you re-write the questions of the Joel test to apply to web developers? > 1\. Do you use source control?   >  **(source control for _all_ aspects of your app, including configuration, > database and user-based settings?)** > > 2\. Can you make a build in one step?   >  **(can you deploy a site from staging to prod in 1 step?)**   >  ...   >  10\. Do you have testers?   >  **(how do you test AJAX and CSS?)** **BACKGROUND** : This is for people who work in a shop that does some web development but also uses some off-the-shelf tools like Drupal and Wordpress, but doing custom development on top of that. RELATED LINKS: http://www.joelonsoftware.com/articles/fog0000000043.html What do you think about the Joel Test?


Is it usual if my employer asks me to get MCP certificates for higher salary?

I just got a salary negotiation this morning (I passed three interviews last 3 weeks), and it was like a game. I was stubborn with my expectation, or that number, or I leave. OK, to be honest, it's not about money, but I, a not-very- experienced developer, want to see how much the employer pays me, and it was fun. And at last, my employer gave me this: "OK, _*_ $, but with two conditions, first, you get your spoken skill improved (English is not my native), and second, you got MCPs before the end of the year". He asked me to get 3 MCP certificates. The company will buy any books that necessary to the exam, but I must read them at free time, take and pass the exams . If I not get them, my employer will not kick me out, but, salary discussion will be harder, for me. I accepted that offer, I thought it's good enough. But I wonder, is it usual? If you're an employer, have you ever given that offer to a candidate? If you're an employee, have you ever got, or will you accept an offer like that?


Does immutability entirely eliminate the need for locks in multi-processor programming?

# Part 1 Clearly Immutability _minimizes_ the need for locks in multi-processor programming, but does it eliminate that need, or are there instances where immutability alone is not enough? It seems to me that you can only defer processing and encapsulate state so long before most programs have to actually DO something (update a data store, produce a report, throw an exception, etc.). Can such actions always be done without locks? Does the mere action of throwing out each object and creating a new one instead of changing the original (a crude view of immutability) provide absolute protection from inter-process contention, or are there corner cases which still require locking? I know a lot of functional programmers and mathematicians like to talk about "no side effects" but in the "real world" everything has a side effect, even if it's the time it takes to execute a machine instruction. I'm interested in both the theoretical/academic answer and the practical/real-world answer. If immutability is safe, given certain bounds or assumptions, I want to know what the borders of the "safety zone" are exactly. Some examples of possible boundaries:   * I/O   * Exceptions/errors   * Interactions with programs written in other languages   * Interactions with other machines (physical, virtual, or theoretical) Special thanks to @JimmaHoffa for his comment which started this question! # Part 2 Multi-processor programming is often used as an optimization technique - to make some code run faster. When is it faster to use locks vs. immutable objects? Given the limits set out in Amdahl's Law, when can you achieve better over-all performance (with or without the garbage collector taken into account) with immutable objects vs. locking mutable ones? # Summary I'm combining these two questions into one to try to get at where the bounding box is for Immutability as a solution to threading problems.


Are injectable classes allowed to have constructor parameters in DI?

Given the following code:               class ClientClass{              public function print(){             //some code to calculate $inputString             $parser= new Parser($inputString);             $result= $parser->parse();         }     }          class Parser{         private $inputString;              public __construct($inputString){             $this->inputString=$inputString;         }         public function parse(){             //some code         }     }      Now the `ClientClass` has dependency on class `Parser`. However, if I wanted to use Dependency Injection for unit testing it would cause a problem because now I can't send the input string to the parser constructor like before as its calculated inside `ClientCalss` itself:               class ClientClass{             private $parser;             public __construct(Parser $parser){                 $this->parser=$parser;             }             public function print(){                 //some code to calculate $inputString                 $result= $this->parser->parse(); //--> will throw an exception since no string was provided                  }     }      The only solution I found was to modify all my classes that took parameters in their constructors to utilize **Setters** instead (example: `setInputString()`).   However, I think there might be a better solution than this because sometimes modifying existing classes can cause much harm than benefit. So,   * Are injectable classes not allowed to have input parameters?   * If a class must take input parameters in its constructor, what would be the way to inject it properly? **UPDATE**   Just for clarification, the problem happens when in my production code I decide to do this:               $clientClass= new ClientClass(new Parser($inputString));//--->I have no way to predict $inputString as it is calculated inside `ClientClass` itself.      **UPDATE 2**   Again for clarification, I'm trying to find a general solution to the problem not for this example code only because some of my classes have 2, 3 or 4 parameters in their constructors not only one.


Documentless platform, how to overcome scarce resources?

I am working for a client and the platform we are using is vBulletin. I'm so frustrated with its almost zero documentation and non-existence in Google. We don't have resources and all we have is the source. I almost want to give up now and get a job which I am familiar and uses tools that are open source.


Standard GPL friendly clauses in employment contract?

My employer is happy for me to release certain work under GPL, however the standard contract has a "All IP belongs to the company" section of the contract. They are happy to amend this to something which is more GPL friendly, but we don't know the precise wording to use. Are there any online resources for such clauses? It would seem to be a sensible thing to exist. I am sure we will have to run it by a lawyer but if there was a standard template, it would simplify the process I am in the UK, so I would imagine that such a resource would have to be specific to that.


Is there such a thing as feature bloat?

I have come across the expression software/feature bloat, but is this a real thing or should we rather be talking about things like performance problems, memory and disk footprint, user experience and on-demand installation? What am I missing here?


Best way to unit test methods that call other methods inside same class

I was recently discussing with some friends which of the following 2 methods is best to stub return results or calls to methods inside same class from methods inside same class. This is a very simplified example. In reality the functions are much more complex. Example:               public class MyClass     {          public bool FunctionA()          {              return FunctionB() % 2 == 0;          }               protected int FunctionB()          {              return new Random().Next();          }     }      So to test this we have 2 methods. Method 1: Use Functions and Actions to replace functionality of the methods. Example:               public class MyClass     {          public Func<int> FunctionB { get; set; }               public MyClass()          {              FunctionB = FunctionBImpl;          }               public bool FunctionA()          {              return FunctionB() % 2 == 0;          }               protected int FunctionBImpl()          {              return new Random().Next();          }     }          [TestClass]     public class MyClassTests     {         private MyClass _subject;              [TestInitialize]         public void Initialize()         {             _subject = new MyClass();         }              [TestMethod]         public void FunctionA_WhenNumberIsOdd_ReturnsTrue()         {             _subject.FunctionB = () => 1;                  var result = _subject.FunctionA();                  Assert.IsFalse(result);         }     }      Method 2: Make members virtual, derive class and in derived class use Functions and Actions to replace functionality Example:               public class MyClass     {               public bool FunctionA()          {              return FunctionB() % 2 == 0;          }               protected virtual int FunctionB()          {              return new Random().Next();          }     }          public class TestableMyClass     {          public Func<int> FunctionBFunc { get; set; }               public MyClass()          {              FunctionBFunc = base.FunctionB;          }               protected override int FunctionB()          {              return FunctionBFunc();          }     }          [TestClass]     public class MyClassTests     {         private TestableMyClass _subject;              [TestInitialize]         public void Initialize()         {             _subject = new TestableMyClass();         }              [TestMethod]         public void FunctionA_WhenNumberIsOdd_ReturnsTrue()         {             _subject.FunctionBFunc = () => 1;                  var result = _subject.FunctionA();                  Assert.IsFalse(result);         }     }      I want to know wich is better and also WHY ? Update: NOTE: **FunctionB can also be public**


Does LINQ require significantly more processing cycles and memory than lower-level data iteration techniques?

## Background I am recently in the process of enduring grueling tech interviews for positions that use the .NET stack, some of which include silly questions like this one, and some questions that are more valid. I recently came across an issue that may be valid but I want to check with the community here to be sure. When asked by an interviewer how I would count the frequency of words in a text document and rank the results, I answered that I would   1. Use a stream object put the text file in memory as a string.   2. Split the string into an array on spaces while ignoring punctuation.   3. Use LINQ against the array to `.GroupBy()` and `.Count()`, then `OrderBy()` said count. I got this answer wrong for two reasons:   1. Streaming an entire text file into memory could be disasterous. What if it was an entire encyclopedia? Instead I should stream one block at a time and begin building a hash table.   2. LINQ is too expensive and requires too many processing cycles. I should have built a hash table instead and, for each iteration, only added a word to the hash table if it didn't otherwise exist and then increment it's count. The first reason seems, well, reasonable. But the second gives me more pause. I thought that one of the selling points of LINQ is that it simply abstracts away lower-level operations like hash tables but that, under the veil, it is still the same implementation. ## Question Aside from a few additional processing cycles to call any abstracted methods, does LINQ require _significantly_ more processing cycles to accomplish a given data iteration task than a lower-level task (such as building a hash table) would?


Using cost estimation models to predict C# software development costs

I'm a student currently on an internship. I've been asked to determine the feasibility of migrating an existing Windows-only C# software package to Mono. I've already conducted an analysis to identify the native libraries that will need to be ported or replaced with managed code, and identified the Windows- only API calls for which equivalents on Linux/OS X will need to be found. From this, I've cultivated some (very rough) estimates on what percentage of each assembly will need to be rewritten. I would now like to develop a time estimate for implementation of those changes. It appears people seem to like the COCOMO II for this type of task. However, I'm having trouble deciding on numbers for the SLOC (source lines of code) input. I have used USC's Unified Code Count tool to determine the Logical Lines of Code (LLOC) in the project as a whole and in specific assemblies of interest. Under one strategy, I estimate somewhere around 10% of the 165k LLOC project will need to be rewritten, and about 5% of the remainder will undergo significant modification. Using these numbers, COCOMO II gives me something like 30 man-months of effort. This seems high to me - is it actually? I don't think I have the experience to know for sure. I'm wondering if I should apply a twiddle factor to the LLOC input - I know people do something like this for some languages when using LOC (eg: dividing Python LOC by a factor of 6). Should I do this with C#, and if so, what factor? Finally, is using COCOMO-II even a reasonable method of doing this? All I want is an order-of-magnitude approximation. Fermi-scale inaccuracy is okay here. Is there a better way?


question related to iPhone programming certification

Dear All, I am working for iOS application developement. Now am considering to go for certification in iOS application development. I am thinking about expertrating.com. Please guide me if you know any other certification in iOS development with more market value of the certification. Thanks in advance and have a great life ahead.


How can you denote the access modifiers "friend" and "protected friend" in UML?

The symbols for access modifiers that I know are relevant for many different languages: > **public** :        +   >  **private** :       -   >  **protected** :  #   >  **package** :    ~ ( _or none_ )   >    _However_ , in VB.NET there are other such access modifiers -- `friend`, and `protected friend` ( _these are called`internal` and `protected internal` in c#_). What are the UML symbols for these access modifiers?      Is `friend` close enough to "package access" that it could be denoted with a tilde "`~`"? Would that then mean that `protected friend` could be denoted as "`#~`"?


In MV* pattern where does non-business model goes?

I am passing Menu items to View from ViewModel. My menu definition is a model with properties title, image, hasChildren and isEnabled. But this model is meant for UI unlike business domain models like Person, ContactDetail, Transaction, etc. So, when i see this menu model sitting along with business domain models i felt like polluted. Is there a right place to put these kind of UI specific models? Thanks.


How can I explain C# interfaces, and constructors to a 8 years old kid?

How can I explain C# interfaces and constructors to a 8 years old genius kid?


What are the strategies to become a good open source developer?

I always hear that involving with open source projects is good for career and the more (good) open source you release, the closer you will be to getting your dream job before you've even had an interview. I am expert in Java and I am trying to become fluent in Scala. I always think about getting involved in open source development in Java/Scala but the following confusions stopping me to do so. How/where do I start in open source development projects in GitHub etc? Or How to find active/busy open source development projects? How to find an area where improvement is required or enhancement required in such projects? It looks too complex in the first analysis or its pretty hard to find such opportunities. What are the common strategies to follow if I want to become hobbyist/free time open source developer? People who have experience in open source development please share your learnings/expertise from scratch. Thanks in advance.


Is it a bad idea to have many protected variables, events and procedures in a unit?

I am writing a full fledged p2p networking library on top of Indy's UDP server with an intention of publishing it online. The design I have implemented has a P2P manager ( TIdUDPServer ) which can act as a server or a peer. Each connected peer is represented by a separate object which contains additional features and information about them. The classes are both contained in a single unit. For the purpose of simplification, I have declared those members used by either, under protected. Somehow, my instincts are giving me a bad feeling about this. The P2P manager has very few members but the peer object has nearly everything under protected. Going the other way will most certainly introduce a whole lot of code and method calls. I need to know;   1. Is it a good practice for networking libraries to have protected members?    2. Should I replace the variables with properties under protected? With getters and setters or direct access would be fine?


How do I get feedback about whether escape analysis had any affect on my code or not?

One problem I have with compiler optimization is, that I actually never know what the compiler (or in this particular case the Jit) does with my code. So is there any possibility for me to know whether a particular compiler optimization took place or not? I just want to be sure about that some objects (math vectors) are created on the stack and not on the heap.


How to maintain an example project owned by an area-XX for each organisational area of my company?

My company is migrating from SVN to GIT. We have several projects in an only repository. Since SVN basically understands only folders and files, we have folders representing areas of the company, that contains the projects of that area. But in GIT, it seems that projects are owned by users, so if I want to maintain an example project owned by an area-XX of my company, I would need to create an user called "area-XX" to do this? And again and again for each organisational area of my company? I want a structure like `my_git_server/area-XX/project-A` for a project, instead of `my_git_server/user/project-A`. How can I do this?


Should developers be forced to check-in before leaving work each day, even if the code does not compile?

During a previous consulting position, the developers where told to check-in code on a nightly basis, regardless if it complied or was complete. Managers were afraid of losing any code and said now we only lose one day at most. The place I'm currently it is investigating whether to implement this. Anyone have any pros/cons on this? Should developers be forced into check-ins?


If functional testing is referred as black box..how can it be done on unit test level?

Preparing myself for ISTQB, I found a bit odd many things in their textbooks. E.g. they call black box testing as functional testing when you are not concerned with structured but only observe the ouput based on inputs. But later they say that functional testing is done at levels..well, how can I do unit testing without the knowledge how it works if I can just see it (and must see it). It is white box but then it is in the conflict..


How do i put my head around ISAPI Filters

I am a newbie. I have decent command over C++ but i lack domain knowledge when it comes to servers and stuff. My current assignment is to write ISAPI filters for IIS Web Server. I have been googling for a couple of days and have found out that its quite a challenging task. I found some examples here. I need to understand and implement some filters which would log requests to the server and take a count of requests on each resource. I do not seem to understand the code examples. Can you guys please suggest a plan or list of to do's for me. I ask this because i know there are a lot of prerequisites to this project. Where should I start ? How should I proceed ? I am expecting you guys to look at the code examples here and tell me what stuff I should read up to grasp the examples. Then i could imagine writing my own filters.


How do scalable bloom filters work?

I was reading up on scalable bloom filters and could not understand how each time a constituent bloom filters fills up, a new bloom filter with larger size is added. The elements that contributed to the set bits in the initially created filters cannot be looked up for presence. Perhaps I am wrong in my understanding of this? I do understand basic bloom filters. However, I cannot wrap my head around dynamic bloom filters.


How far should I take email address validation when the cost of bad emails is high?

**When it's more important to prevent typos than to cover 100% of all possible email addresses, what syntactic email validations do you do?** Imagine this: > You're with the local gas & electric company. 10% of new installations are > cancelled because the customer is not home and it costs your company $50 a > pop. You start taking email addresses with the new install orders so that > you can send reminder emails the day before the appointment. You bring that > number to 0% _when you have a deliverable email_. The only problem is that > 15% of all the emails you take bounce back because of some typo. Email > addresses are recorded by call center agents who talk to the customer over > the phone. In this case, it's important to collect a valid email address. It's also not all that bad if someone cannot successfully use an email address like:               "Big Momma D.'s #1 CA$H Maker, BOY!!!"@naturalhistory.museum      My guess is that Big Momma D. can't use this email anywhere and either doesn't really use email, or has more conventional email address to use. This is related to this more general question: How far should I take e-mail address validation? Let's throw a few more assumptions on here:   1. This is in the US, so it's unlike people will have email addresses like 漢字@gmail.com (good luck communicating that to a call center agent in Austin, Texas)   2. Validation emails are not suitable, since the customer is only in contact with us by phone


Necessitas or Java for android application development

I'm a Qt/C++ developer for Windows and Linux. Now I need to switch to Android OS and program for this operating system. I'm wondering whether it is reasonable to stay with Qt and use Necessitas project for Android Application Development or switch to Java?


Need some input on storing stdin, stdout, stderr information for debugging

I am working with a legacy system that is not too bad, but I thought of making some improvements to it, and I wanted to solicit your feedback to help me make good decisions. The platform is Linix (different flavors of it). The system revolves around running [sometimes long] "jobs" - command line programs. The jobs usually succeed but sometimes may fail, and when they do it is very important to diagnose what went wrong efficiently, and fix the underlying problems (if any) and restarting a job. We are not using any third-party software for this because we need full control over the process. Right now information about a job is being saved on disk as files - there is one file for stdin, one file that stores the exit code, one file for stdout and stderr combined, and I also know exactly how the process was started - what was the name of the command and what were the arguments. Now ... I thought about splitting stdout and stderr outputs into different files, but then realized that when they are combined together, one can see the chronological order of messages, except that it now takes a human judgement to tell which was output and which contains the errors. Taking this to a further extreme - why not throw stdin into the mix? It might matter for debugging purposes what the specific line of input was that caused a failure. Ideally the error message would be descriptive enough to give plenty of context, but this does not always happen. I am looking for a clean way to organize this data so that automated logic could be used to aid humans with error diagnostics. With many jobs running these failures do happen rather often. An example of something that I might want to query for - what were the last 20 lines of input that preceded the first line in stderr? I suppose the exact time stamp can be useful, but not that critical. Also, since a logging module is being used, often the output lines already contain time stamps, but not always - I did not write every bit of this legacy system. I can make changes to it; I just do not want to rewrite it. Could you propose a good way to massage these streams (add some sort of metadata perhaps) to organize things cleanly? The requirement is that not much extra computing power or disk / ram space should be utilized. I suspect that my problem is not unique. Thanks in advance.


Why doesn't Haskell have type-level lambda abstractions?

Are there some theoretical reasons for that (like that the type checking or type inference would become undecidable), or practical reasons (too difficult to implement properly)? Currently, we can wrap things into `newtype` like               newtype Pair a = Pair (a, a)      and then have `Pair :: * -> *` but we cannot do something like `λ(a:*). (a,a)`. (There are some languages that have them, for example, Scala does.)


How to create Button/Switch-Like Tile where you can step on it and change its value?

If the player steps on a Button-Tile when its true, it becomes false. If the player steps on a Button-Tile when it is false, it becomes true. The problem is, when the player stands on (intersects) the Button-Tile, it will keep updating the condition. So, from true, it becomes false. Because its false and the player intersects it, it becomes true again. True-false-true- false and so on. I use ElapsedGameTime to make the updating process slower, and the player can have a chance to change the Button to true or false. However, it's not the solution I was looking for. Is there any other way to make it keep in False/True condition while the Player is standing on the Button tile?


To MVC or not MVC, that is the question

Originally, I started off doing jQuery plugins, then moved onto Backbone.js applications, then been experimenting with MicroJS MVC modules, but these days I'm even wondering if there is any need for them at all. Recently, I've been prototyping a new application, and the code is slim, sleek, and beautiful. I then proceeded to rewrite it over 3 hours into a Backbone.js application, and the code turned away from its fitness model petiteness, into a bloated, complex, and ugly mess. The problem is, these days, this always happens. As soon as the MVC/MV* architecture is introduced, it all goes to puke. I'm wondering if the day and age of requiring these things on the client-side are over now, now that browsers are actually quite capable beings, maybe we don't need all the bloat of MV* frameworks anymore. What are your thoughts? Has others run into this? To MVC, or not MVC?


How to decompose / model a chessboard

As someone new to programming, I am building a chess web application in JavaScript, both for fun and to learn more about design patterns. I keep running into a wall, which is how to decompose the program. To start, I have picked a straightforward representation of a chessboard, here:               Board = function() {       var turn = 0;       var model = [[-4, -2, -3, -5, -6, -3, -2, -4],                    [-1, -1, -1, -1, -1, -1, -1, -1],                    [ 0,  0,  0,  0,  0,  0,  0,  0],                    [ 0,  0,  0,  0,  0,  0,  0,  0],                    [ 0,  0,  0,  1,  0,  0,  0,  0],                    [ 0,  0,  0,  0,  0,  0,  0,  0],                    [ 1,  1,  1,  1,  1,  1,  1,  1],                    [ 4,  2,  3,  5,  6,  3,  2,  4]];      with some basic access routines, such as                 this.move = function(pt1, pt2) {         turn += 1;         model[pt2.x][pt2.y] = model[pt1.x][pt1.y];         model[pt1.x][pt1.y] = 0;       };       ...      It makes sense that the board encapsulates state and is responsible for changing state but may not know the rules of the game--I like the idea of being able to plug in some sort of `RulesContoller` and completely change the nature of the game at runtime. But beyond that, I'm a little paralyzed as to how granular to model the pieces. I see a few options. First, I could define a `Piece` constructor and instantiate a new piece for each index in the nested array, something like:                 _.each(state, function(row, y) {         _.each(row, function(val, x) {           state[y][x] = new Piece(x, y, val);         });       });      `Piece` could easily deduce its color, type (e.g. 'king'), and location from that information. But it also feels redundant, since I'm just translating a model that already completely represents the board. Also, it doesn't seem like the primary purpose of the `Piece` 'class' is this translation, e.g. "Oh, I'm a -5, must be a dark Queen." Another option is to make the pieces dumber, i.e. not able to deduce this information from the model. But then I just build the array in-line, like                 var model = [new Rook(1,1,'dark'), new Knight(1,2,'dark'), new Bishop(1,3,'dark')... ],       ...      This seems closer to the way a chessboard is actually setup: there isn't some elegant formula; rather, you just put pieces in their correct location. But it's also just brute force. There are a few symmetries involved and patterns that might be simplified. Anyway, I'm just spitballing at this point. Any ideas would be useful. Thanks.


How should I structure my namespace tree so that I have a Math class and Math namespace?

I don't know if this is a good or bad idea, or if it's technically even possible... but I'd like to have something of the following sort:               public class Math {       public int gcd(a,b) // Method for Greatest Common Denominator       public int lcm(a,b) // Method for Least Common Multiple       public int factorial(a) // Method for factorial       ...     }      and then I'd also like to have a namespace called `Math` that has subclasses such as `Math.Matrix`, `Math.RowVector`, `Math.ColumnVector`, etc... so I can define my own Matrix data structure and its associated actions. Is this advisable? I am not too keen on the idea of using some other name for my `Math` class, as I want it to be a static class with all sorts of functions/methods that are useful to me, and at the same time, I want to gather all my relevant data structures under a `Math` namespace.


JSON Library - Jackson or Play Framework?

Working on a Java and Scala code-base, there's a debate about whether to use Java's Jackson JSON or the Play Framework's JSON Library. After reading the Play JSON Docs, as well as Chapter 9 (JSON) of Play for Scala, I also ran through an example from Mykong on Jackson. Based on looking at a few simple examples, Play's JSON Library seems like the superior choice due to, overall, its Functional Programming Approach:   * Providing compile-time safety when parsing JSON with Option/JsResult data types.   * As a result of the above, higher order functions (map/flatMap) are available and provide power and succintness   * As I understand, Jackson parses via the typical try/catch paradigm. Dealing with JSON errors at compile-time(Play) v. run-time(Jackson) is a no brainer Bottom line - Play's JSON library uses a functional programming approach that results in code that is easier to reason about than the Jackson library. Overall, the choice seems clear to me. Am I missing any pros/cons for either library?


Use Case Structure

I am creating use cases for a project. A generic user is extended by user "categories" which then is extended by an administrator (that can do all tasks possible). Is the following acceptable to portray? Is there a better way to portray such info? ![sample use case](http://i43.tinypic.com/adm0b4.jpg)


Help with learning the C++ Qt Framework

I've been a longtime PHP web developer. But now I've reached the limits and web doesn't fascinate me anymore. I am interested in learning cross-platform development. I have learned Java for almost a year and know much of its OOP concepts but I would like to develop high-performance cross-platform programs and I find Java to be somewhat slower unless you have a beast hardware. Searching for programming books on C and C++, I have only found that they only covers the basics which are same for every language. Datatypes, Loops, Conditionals, Operators etc. But the languages are no more this minimal. C++ provides STL and I've yet to find a book which shows you how to develop real- world programs using these standard features. I know PHP very well, I have known ins and outs of MVC and Singleton Design Patterns, but then I stumbled upon Qt Framework and some of the apps it has powered: Skype, VLC, KDE and they all are rock-solid. I've NEITHER faced any bugs or crashing issues with these applications on Windows NOR on Linux. **My request** _How should I approach learning Qt?_ The biggest difference I'm encountering is C++'s static typing which is very different than the dynamically-typed languages (PHP, Python etc.) I have already worked with.


CFO's Expectations and Scrum Development

When it comes to financial topics, I'm admittedly not well versed. I'm trying to lead my organization in our software development effort using a Scrum based development life-cycle. I am often discouraged when trying to coach executive leadership due to their belief that Scrum and Agile don't play well with their finanacial objectives. The other day I was challenged to show how my software developers could capitalize %60 of their work hours. I've found a few articles on the web ( http://itprojectfinancials.com/insights/2011/06/05/capitalizing-software- development-costs-from-sdcl-to-agile/ ), but haven't come up with any great arguments. I'm looking for advice or examples of organizations that capitalize software costs effectively in an Agile development environment. This article sums up the issue pretty well, but offers no advise http://blogs.collab.net/agile/2007/12/20/the-scrum-gaap/


What does backup procedures and troubleshooting guidelines mean for a system

I am writing the documentation for a piece of software which I have made but I don't understand what it means in some aspects. It asks me to write about backup procedures but what exactly does this mean? Does this mean like backing up the database on another hosting service or something else entirely? I am dumbfounded by what troubleshooting guidelines are as well. If you have any idea what this could mean feel free to give your insight even if you aren't 100% sure in case it could spark what it means inside of me. Thanks.


Handling tough or unexpected technical questions in meetings

Depending on the project I'm working on, I may be required to attend more meetings with both internal stakeholders or technical management in client companies. During the course of these meetings, there will inevitably be a few questions crop up that either:   * You do not have an answer to.   * You have not thought about for one reason or another.   * You deem to be irrelevant or completely out of scope of the current meeting. In each case, how do you answer these questions? Any tips or tricks on remaining authoritative while remaining honest?


How can open source projects be successful without documentation about their design or architecture?

I want to improve my programming skills by studying famous open source projects, but I find it is easy to get lost by just jumping into their source code. So I decided to read their documentation about their design or architecture (such as UML diagrams) to get a general idea about their code's organization first. To my surprise, however, I can't find any architectural documentation for large open source projects such as Hibernate, Spring, ASP.NET MVC, Rails, etc. So I've started to wonder: How can an open source project can be successful if new-comer developers have no architectural/design documentation to read, or if the project manager just opened the source code but closed its documentation?


ffmpeg: cut multiple input files with seeking to one output file

I have list of video files (loaded from database), each with start and end time of requested interval:                 # file   begin  end       v1.mp4   1:01   2:01       v2.mp4   3:02   3:32       v3.mp4   2:03   5:23      And I need to create single video file containing these intervals:                [0:00]---v1---[2:00]---v2---[2:30]---v3---[5:50]      I preffer usig ffmpeg, since it is installed on server. Caller program is written in PHP. It is easy to cut one input to one output (argument escaping removed for clarity):                 exec("ffmpeg -ss $begin -i $input_file -ss $begin -c copy $output_file");      I there any easier way than executing ffmpeg for each interval and then execute it once more to concatenate prepared clips together? I really do not like to have a lot of temporary files or dealing with complex process handling.


Freelancing as an individual. Products as a company. Should I integrate the two to grow?

When I started my company in 2005, I began with freelancing projects, but quickly moved to products. My personal site listed my consulting availability and portfolio pieces, which included a selection of the products sold by my company. Over the years, the company has gained rep through the products, and my personal site gained rep through the contract work. Of course, it's no longer just myself either for the products or the consulting work; other people in the company are involved, and the consulting work is technically billed through the company, as it always was. I want to maintain both sources of work; the consulting work that comes through from people finding my personal site, and the products sold by the company. But recently, the company has started receiving requests for custom development work directly, and I'm having trouble deciding what to do to reconcile the two "faces", or even if I should do anything about at all. Basically, the company has a small "services" page, which presents our products as portfolio pieces, and I have my original site which gets a lot of incoming client work, and also presents the same list of portfolio pieces (and some other client work). If I forward clients who contact the company for custom work to my personal page, we may lose some of the bigger clients, whom we are fully capable of serving, but who would prefer to deal with a company rather than a single developer. If I drop my personal site and refocus on the "services" side of the company, then I'd be ignoring the years of reputation building that the personal site has (and the client stream that still arrives at that door). Has anyone dealt with this? Any advice and suggestions would be appreciated. **EDIT:** To clarify, one of the disadvantages of having the two be separate channels is the lack of focus when it comes to marketing. Where do you point the signature in forums that may lead to clients seeking you out? Where do you point the people you hand your business card to? It just seems "cleaner", somehow, to integrate them or select one to concentrate on -- or maybe it's just the programmer in me trying to categorize things and put everything into its proper place.


API design pitfalls in C

What are some flaws that drive you nuts in C APIs (including standard libraries, third party libraries, and headers inside of a project) ? The goal is to identify API design pitfalls in C, so people writing new C libraries can learn from mistakes of the past. Explain why the flaw is bad (preferably with an example), and try to suggest an improvement. Although your solution might not be practical in real life (it's too late to fix `strncpy`), it should give a heads up for future library-writers. Although the focus of this question is C APIs, problems that affect your ability to use them in other languages are welcome. Please give one flaw per answer, so democracy can sort the answers.


Future of web development - Front-end > Back-end development?

People used to say it's "better"/"Make more money" to do back-end programming (PHP, asp.net) instead of front-end(HTML, javascript) for web development. But I notice that HTML5, CSS3, WebGL, Javascript are gaining importance. We can even use HTML5, CSS3 and JAVASCRIPT for building mobile web applications(For both iphone/android) and even Windows 8 applications in the future! Does it mean new web developers should now focus on front-end development instead of server-side development?


What is meant by binary compatibility? What is its importance during serialization/deserialization in a language like Java that deals in byte code?

In computing what is meant by _binary compatibility_? I read about it in context of serialization/deserialization that this process of serialize/deserialize should be binary compatible. What does it mean in this context? In particular I am interested in understanding the role of binary compatibility in a language like Java that deals with byte code. This quote is from Effective Java: > When a serializable class is revised, it is important to check that it is > possible to serialize an instance in the new release and deserialize it in > old releases, and vice versa. The amount of testing required is thus > proportional to the product of the number of serializable classes and the > number of releases, which can be large. These tests cannot be con-structed > automatically because, in addition to binary compatibility, you must test > forsemantic compatibility. In other words, you must ensure both that the > serialization-deserialization process succeeds and that it results in a > faithful replica of the original object. The greater the change to a > serializable class, the greater the need for testing. The need is reduced if > a custom serialized form is carefully designed when the class is first > written (Items 75, 78), but it does not vanish entirely.


Do you want to work alone or in a team?

If you can choose whether to work on a project alone or in a team, what would be your choice and why? And if you want to work in a team, what is the ideal team size?


Java Method Returns Unbounded Type

I was reading this article, https://weblogs.java.net/blog/emcmanus/archive/2010/10/25/using-builder- pattern-subclasses, about subclassing a builder class. I understood the article but there was one small bit that bothered me. There was this method,               public static Builder<?> builder() {             return new Builder2();     }      When I changed `Builder<?>` to `Builder`, a raw type, the compiler would not compile the code. What is the additional information was passed to the compiler via with the additional `<?>`? I have pasted the code here:               public class Shape {            private final double opacity;               public static class Builder<T extends Builder<T>> {              private double opacity;                   public T opacity(double opacity) {                  this.opacity = opacity;                  return self();              }           /*              public T height(double height) {                  System.out.println("height not set");                  return self();              }      */              protected T self() {                  System.out.println("shape.self -> " + this);                  return (T) this;              }                   public Shape build() {                  return new Shape(this);              }          }               public static Builder<?> builder() {              return new Builder();          }               protected Shape(Builder builder) {              this.opacity = builder.opacity;          }      }           public class Rectangle extends Shape {          private final double height;               public static class Builder<T extends Builder<T>> extends Shape.Builder<T> {              private double height;                   public T height(double height) {                  System.out.println("height is set");                  this.height = height;                  return self();              }                   public Rectangle build() {                  return new Rectangle(this);              }          }               public static Builder<?> builder() {              return new Builder();          }               protected Rectangle(Builder builder) {              super(builder);              this.height = builder.height;          }               public static void main(String[] args) {              Rectangle r = Rectangle.builder().opacity(0.5).height(250).build();          }     }


Configuration Settings Service/Repository: Are They Used in a Real World

I’m currently enjoying reading "Continuous Delivery: Reliable Software Releases Through Build, Test, and Deployment Automation" and the part that caught my attention is that on managing configuration settings for applications. What's proposed in the book is that all configuration settings are externalized and centralized in a repository of some sort, be it an LDAP directory, ESCAPE Server or somesuch and then retrieved from there. This sounds really compelling to me as this approach can provide a number of tangible benefits, but after Googling around for a bit it seems to me that this is not exactly a widespread approach. I know there is a Twelve-Factor App article on this subject, but it suggests using environment variables instead of a centralized repository. This approach seems to be the most commonly used one, but it feels like a dirty one compared to a repository-based solution. So, is the central-configuration-repository approach used in any significant manner in a real world, and if not -- what are the reasons for this?


Does this in the Observer pattern count as composition?

In a classic implementation of the Observer design pattern, the subject has a list of references to all of it's observers, and each observer might have a reference to it's subject. Is this considered composition? As far as I understand, composition means one object 'includes' in itself another object, in order to **use functionality of that object**. In the Observer pattern, the subject does include in itself references to it's observers, but it doesn't exactly use their functionality internally to do things outwardly. It keeps references so it can notify them. On the other hand, the subject and observers maintain a relationship of HAS-A, which often characterizes composition (the subject has observers, the observers have a subject). Is this considered a kind of composition?


What are the different aspects to consider when porting code from a single threaded environment to a multi threaded environment or vice versa?

I want to provide some library functionality and a reference application, which will run on a fully-featured, POSIX-compliant platform. The app and library will need bi-directional serial port communication, user input from keyboard, user display to text console, and probably timers. I also want to provide a porting guide so that users of the library can port it (with or without the reference application) to their own platforms, which may be POSIX-compliant or not, and may or may not support multiple threads. I am taking care of the main platform portability issue by writing portable code for everything as far as possible and providing a self-contained porting layer for platform-specific code. In my porting guide I will tell the user to replace the porting layer functions with implementations for their own platform. However as far as the threading model goes, I have two choices:   * implement my reference application as a very simple single-threaded program (main loop would poll keyboard, poll serial port, check timer status, and call library functions as needed)    * use the pthreads library and have a main app thread with separate threads for user input, serial port receive, and timer expiry, all of which would post messages to my main app thread for processing.  Whichever model I choose I will have to explain to users how to port it to a platform which may be using a different model. Even if I use a single-threaded implementation for the reference app, I will make sure any library functionality is re-entrant (or put big caveats around it if that isn't possible). What considerations should I bear in mind, in my implementation and the porting guide? What information would you want if you were porting some multi- threaded code to a single threaded system, or vice versa?


When and how much should we validate input when working with (C)AP storage?

Herein, we consider a server-client architecture. Suppose we keep the details flexible, but there's more than one layer of servers supporting our hypothetical service. The general question is **"When and how much do I validate client data?"**. From other questions and answers I've read, the answer may be summarized as one of the following strategies (or a combination thereof).   1. Validate all data as soon as it arrives from the client. Other servers trust each other.   2. Validate all data on every server in the system. _(this is not heavily favored)_   3. **Validate all data _rigorously_ when it reaches the database, and optionally elsewhere as required by the application.**   4. At all levels, validate exactly as much data as that particular server needs to do its job. Number 3 seems particularly popular. In the answers I've seen, however, there seems to be an **implicit assumption of the classical RDBMS** ("OldSql") centralized data storage. These are the MySQLs and Postgres's of the world. Taking cues from the CAP theorem, let's call these **CP databases** , as they tend to provide tools for consistency at the expense of some class of availability: usually, only a delegated _master_ can write to a particular partition. Recent alternatives to the classical RDBMS (specifically Voldemort, Riak, and Cassandra, which are modeled after the Dynamo storage system) are better classified as **AP databases**. These tools allow natural inconsistencies to appear upon data retrieval (e.g. multiple data values with vector clocks) in exchange for "always writeable" availability. Given that these data stores have rather **unique properties** , I pose the question: **Does the client data validation story change when we use AP datastores? How much of my client data should I validate before and after insertion to an AP database?**


Creating a layer of abstraction over the ORM layer

I believe that if you have your repositories use an ORM that it's already enough abstracted from the database. However, where I am working now, someone believe that we should have a layer that abstract the ORM in case that we would like to change the ORM later. Is it really necessary or it's simply a lot of over head to create a layer that will work on many ORM? ### Edit Just to give more detail:   1. We have POCO class and Entity Class that are mapped with AutoMapper. Entity class are used by the Repository layer. The repository layer then use the additional layer of abstraction to communicate with Entity Framework.   2. The business layer has in no way a direct access to Entity Framework. Even without the additional layer of abstraction over the ORM, this one need to use the service layer that user the repository layer. In both case, the business layer is totally separated from the ORM.   3. The main argument is to be able to change ORM in the future. Since it's really localized inside the Repository layer, to me, it's already well separated and I do not see why an additional layer of abstraction is required to have a "quality" code.


what's proper class name for manager/browser/editor

I've read somewhere that it's a bad idea to name classes after verbs (manager/browser/editor) but what's the proper name for manager/browser/editor? EDIT: the problem is that system could turn in a big ball of "services" - tiny objects which does something specific and does not contain any data - which is bad (at least because it just queries other objects) but I also need to be able add new "managers" easily (right now app needs to manage users, ftp accounts, mail accounts, etc.)


How to implement a safe password history

Passwords shouldn't be stored in plain text for obvious security reasons: you have to store hashes, and you should also generate the hash carefully to avoid rainbow table attacks. However, usually you have the requirement to store the last _n_ passwords and to enforce minimal complexity and minimal change between the different passwords (to prevent the user from using a sequence like Password_1, Password_2, ..., Password_ _n_ ). This would be trivial with plain text passwords, but how can you do that by storing only hashes? In other words: how it is possible to implement a safe password history mechanism?


What are the advantages of Maven when it comes to single man, educational projects

I've spend a few hours playing around with Maven + reading some stuff on the apache official site and also a few random googled articles. By this I mean that I really tried to find the answers myself - both by reading and by doing things on my own. Also maybe worth to mention that I installed the `m2e plugin` so most of the time I've tried things out from `Eclipse` and not using the command line too much. However aside from the generated project that for example prevent me from using the default package I didn't see that much of a difference with the standard way I've created my projects before try Maven. In fact I've almost decided to skip Maven for now and move on to the other technology I wanted to learn more in-depth - `Hibernate`, but when I start with opening the official page the first thing I've read was the recommendation to use Hibernate with Maven. That get me confused and made me taking a step back and trying once more to find what I'm obviously missing right now. As it's said in the `maven.apache..` site, the true strength of Maven is shown when you work on large projects with other people, but I lack the option to see how Maven is really used in this scenario, still i think that there are maybe advantages even when it comes to working with small projects alone, but I really have difficulties to point them out. So what do you think are the advantages of Maven when it's used for small projects writing from a single person. What are the things that I should be aware of and try to exploit (I mean features offered by Maven) that can come in handy in this situations?


What metadada to save and whether to include it inside the binary file?

I'm wondering if there are any general guidelines or best practices regarding when to split data into a metadata format, as oppose to directly embedding it within the data. (Specific example below). My understanding of metadata is that it describes data (without the need to actually look at the data), allowing for data to be quickly search/filtered for easy access. Let's take for example a simple 3D model format. The actual data file is itself a binary file containing vertices and colors. Things like creation date, modified data and author name would be things that describe the binary data, so I would say these belong as metadata (outside of the binary file). But the following questions arise:   * What if the application had no need to search or filter by these fields?    * Would it be acceptable to embed these fields directly into the binary data itself?   * Could they be duplicated in both the binary data and the meta data, or would this be considered bad practice?    * What about more ambiguous fields such as the model name, which could be considered part of the data itself, but also as data describing the binary data?   * How do you decide which data to embed in the actual binary file, as opposed to separating into a more flexible metadata format? Thanks!


Coordinating between developers on common resources

In our organization some of the resources (such as QA machines etc) are shared. Different folks get done at different times and some tests have to be run (during dev and QA) on these machines. Right now, we just skype a message to the team stating "I am going to run some destructive tests on such and such machines - let me know if anyone has an issue". This approach obviously has many issues (what happens if someone missed the message etc.) Apart from maintaining a shared google doc that needs to be constantly updated - is there an easier way that folks use for such coordination?


Java best practice Interface - subclasses and constants

In the case where a couple of classes implements an interface, and those classes have a couple of constants in common (but no functions), were should I put this constant ? I've had this problem a couple of times. I have this interface : DataFromSensors that I use to hide the implementations of several sub classes like DataFromHeartRateMonitor DataFromGps etc... For some reason, those classes uses the same constants. And there's nowere else in the code were it is used. My question is, were should I put those constants ? Not in the interface, because it has nothing to do with my API Not in a static Constants class, because I'm trying to avoid those Not in a common abstract class, that would stand between the interface and the subclasses, because I have no functions in common, only a couple of constants (TIMEOUT_DURATION, UUID, those kind of things) I've read best practice for constants and interface to define constants but they don't really answer my question. Thanks !


Why does the boolean type in C++ support `++` but not `--`?

Why does the operator `--` not exist for bool whereas it does for operator `++`? I tried in C++, and I do not know if my question apply to another language. I will glad to know also. I know, I can use the operator `++` with a bool. It makes any bool equal to true.               bool b = false;     b++;     // Now b == true.      Why can't we use the operator `--` in an opposite way?               bool b = true;     b--;     // Now b == false;      It is not very useful, but I am curious.


Doesn’t active record violate SRP and OCP?

I have watched the active record classes in our project grow into large, do- it-all classes. When you need anything about a user, for example, you should go to the `Person` class. While this makes perfect sense when you consider the domain, in reality, the `Person` class is a mishmash of lots and lots of functionality, which do get modified sometimes as the domain becomes clearer, which means both SRP and OCP are violated. Is this one of the things that comes with the Active Record pattern, or are we doing it wrong?


Validating Objects With XSDs: Is Re-Serializing Redundant or Negligible?

**Context:** I've got a web service that deals with request / response objects. There are strict, externally-defined schemas constraining both the structure and the content of both requests and responses. I need to validate all requests as they are received and all responses before they are sent back (on the web service end of the wire). I don't want to replicate the validation rules in code, so I'll be validating serialized request / response objects (XML), probably using XmlReader as a starting point (for speed). It'll be 1-way object --> XML validation method that screams if validation fails, otherwise the original object will be used for the actual work. I'm using WCF, but with XMLSerializer as the schemas are complex and I need the additional XSD support. **Question:** 1) Is there a way to avoid re-serializing the objects as they hit my end of the wire? _Ideally_ I'd like to get at the XML before it's de-serialized on the way in, and after it's serialized, just before it goes, on the way out. I'm aware of [OnSerializing] and [OnSerialized] annotations, but they won't work with XMLSerializer. I don't think I should be writing ReadXml() and WriteXml() using IXmlSerializable either - the schemas are complex and subject to change. 2) Given the XML documents are quite small (122kb seems to be the top end in the sample data set I have) am I right in asserting that the performance hit of re-serializing will be negligible? 3) Any better ideas?


Cleaning Up Generated Code: Refactor or Map?

**Context:** I recently had to deal with a class file generated by XSD.exe. It was 3500 lines long with ridiculously-verbose class / variable names (think `someRidiculouslyLongPrefixThenMaybeOneThingUniqueAtTheEnd` \- difficult to compare at a glance with `someRidiculouslyLongPrefixThenMaybeOneOtherThingChanged`) and annotations all over the place. Bottom line is it took me ages to work out what the heck was going on. I read it and thought I would never put my name next to something so... Un-clean. **Question:** 1) Is it bad practice to mess with generated code (i.e. clean it). 2) Would it be better practice to write a mapper to map the generated classes to my own nice, clean classes (which I could then get to work with, quite happily)? **EDIT:** Thanks for all the comments. If I was actually going to do anything interesting with it (i.e. if there were domain objects which were anything but transport objects) then I think I'd map them to 'cleaner' classes, which I'd have to do anyway to get any kind of functionality out of them. In this case the classes are effectively DTOs so perhaps it makes sense that the naming matches the corresponding elements. As stated, I don't need to touch it - just to call accessors / mutators before passing the data down to another layer for processing. For now, I think I'll leave them well alone.


When changing a class/method and you already have passing unit tests, should you change then test or write a test then change?

Say I have a class with a single constructor that accepts 2 parameters and initialises itself using those parameters. I have written tests for this and they are all passing. I later realise I need to make an addition to the constructor to accept three parameters. Should I a) Add in the new parameter, watch my tests break and try and fix it b) Rewrite existing tests to test for the new expected behavior, watch them initially fail and then add to the class (this to me seems a more TDD way) From a TDD point of view, I think that option 'b' makes more sense. However, option 'a' (to me) seems like a more natural approach. Is there any standard way that most people do this?


Software architecture which allows for growth, real life situation

I know of Interfaces, Abstract classes that serve as Base class, I've been reading up on loose coupling, ... But I can't come up with a decent solution when a property of a class changes, and the new type needs to be implemented in other classes using this updated class. **Example** Below is a simplified representation of a real life situation. Invoice contains a Contact object which has an Address property.               Abstract Class Contact{         string Name{get;set;}         string Address{get;set;}     }                    Class Customer:Contact{         string CustomerNumber{get;set;}     }                    Class Invoice{         string DocumentNumber{get;set;}         Customer Customer{get;set;}     }      Next, we decide to upgrade the Contact class to contain multiple Addresses. Of which the Invoice will need one.               Class Address{         string Street{get;set;}     }                    Abstract class Contact{         string Name{get;set;}         List<Address> Addresses{get;set;}     }      Logically, the Invoice class needs to be changed to something like               Class Invoice{         string DocumentNumber{get;set;}         Customer Customer{get;set;}         Address InvoiceAddress{get;set;}     }      **Problem** You immediately see that _everywhere_ I used the **string** property `Address` before, I will now have to change it to an occurence of the type **Address** As stated before, this is just a simplified example. The real life problem would be much, much bigger as contacts will be used throughout the entire software. **Conclusion** I want to develop the software with a principle that will keep my software light for new versions of certain modules. So that if I decide to create a new Contact module, the impact to the other modules is close to non-existing. So, the added functionality can be implemented gradually. I want to know how I can tackle such versioning problems. This project is currently still in the architectural design stage, and I want this sorted out before we continue.


Bitwise-OR vs Adding Flags

I've seen others use Bitwise-OR to combine flags before:               #define RUN 0x01     #define JUMP 0x02     #define SHOOT 0x04          const byte madPerson = RUN | JUMP | SHOOT;      That's also the way I do it. But I've also seen some (not as many) combine flags using addition:               #define RUN 0x01     #define JUMP 0x02     #define SHOOT 0x04          const byte madPerson = RUN + JUMP + SHOOT;      Which one is more "readable"? (Which one do you think more people will recognize?) What is the "standard" way to do it? Which one do you prefer?


Automatic programming: write code that writes code

After reading the book The Pragmatic Programmer, one of the arguments I found most interesting was "write code that writes code". I tried searching over the net for some more explanations or articles about it, and while I found some good articles on the subject, I still haven't found any specific code implementation or good examples. I feel it's still not a so common argument, something that lacks documentation or it's not embraced by so many people, and I would like to know more about it. What do you think about the subject? Is it something that will really increase your productivity? What are some good resources on the subject, among books, blogs, slideshows, etc? * * * Some code examples would be greatly appreciated to allow me to better understand its implementation. * * * Here's the wiki page on the subject with various relevant programming techniques, like Meta Programming, Generative Programming and Code Generation.


What are the 'must know' Emacs commands?

I'm a fairly new convert to Emacs and I really love it as an editor, primarily because I keep finding new and super-useful commands. Are there any other programmer 'must known' commands missing from my list?               M-x replace-string     - Find and replace a given string.     M-x goto-line          - Goto a specific line     M-x column-number-mode - Show the current column number in text bar


How do you evaluate a small piece of code?

I'm creating a website based on users' code, a place where they can share code in a social way and one of the features I'm currently developing is Code Review. This feature will allow users to evaluate code in certain aspects, from the top of my head I came out with things like:   * Legibility,    * Performace and    * Modularity. What are the general characteristics that you evaluate when reviewing code?


For email interviews, is it bad to research some answers?

So I got an email "interview" with questions to be answered. I'm not too sure only about one of them, so I wanted to google the answer. Of course in a real interview I can't do this, so should I say "I don't know", or research it? I mean, if I were on the job, I'd research it, so it can't be frowned upon? Right?


Intelligence as a vector quantity

I am reading this wonderful book called _"Coders at Work: Reflections on the Craft of Programming"_ by Peter Seibel and I am at part wherein the conversation is with Joshua Bloch and I found this answer which is an important point for a programmer. The paragraph, goes something like this. > There's this problem, which is, programming is so much of an intellectual > meritocracy and often these people are the smartest people in the > organization; therefore they figure they should be allowed to make all the > decisions. But merely the fact they are the smartest people in the > organization does not mean that they should be making all the decisions, > because intelligence is not a scalar quantity; it's a vector quantity. Here at the last sentence, I fail to get the insight which is he trying to share. **Can someone explain it in a little further as what he means by a vector quantity, possibly trying to present the same insight.** Further down, I get the point that he is not taking about having an organization where non-technical people (sometimes clueless) can be managers of the technical people for some reason that they can spend more time to write emails well, because the very next statement following the above paragraph was. > And if you lack empathy or emotional intelligence, then you shouldn't be > designing APIs or GUIs or languages. I understand that he is saying that in Software engineering, programmers should know how the users will see their product and design for them. I felt the above paragraph was very interesting.


How could you reconcile declarative database development and non-trivial data 'motions'?

Coming back to SQL Server after several years away, I find the Visual Studio Database projects (and now SSDT) very exciting, as they are aiming to offer a way to develop databases declaratively, rather than having to mess around with change scripts. However, the elephant in the room is the 'data motions' (I'm not too sure whether that's an official term): it's not too hard to automatically script a simple change in one table, but if you're normalising/denormalising, things get hairy very quickly. Gert Drapers said as much in this TechEd video, and that they're trying to work out a way of working with these complex data migrations too. **The question:** This got me thinking. How could you do this? Is there a way - even in theory - to define these data migrations declaratively? Or even a non-declarative way which could be combined elegantly with the declarative bits? Does anything like this already exist in other frameworks (I've vaguely heard something about Ruby/Rails?) _(I wondered whether to post this ondba, but I'm not sure whether they like 'good subjective questions (if this is one), feel free to migrate if necessary)_


Making a configurable Java formatter?

AFAIK there's just `java.util.Formatter` and `java.text.Format` and AFAIK none of them is extensible. I mean not subclassing, but the possibility to specify how to handle objects by class, e.g., saying > please format `char[]` as string and > format `byte[]` in hex It's no big deal to do it manually, but it's verbose and then the `Formatter` (or `String.format`) make little sense if I have to do half the work manually (`java.text.Format` is a different story as it's meant for i18n). Also things like               String.format("%1$tY-%1$tm-%1$te", new Date())      aren't exactly appealing. So I'm asking for ideas how to create such a thing, e.g., how to structure it and possibly what else should it do.


CRM in the context of C++ programming

I was asked by an employer about CRM in the context of C++ software development. The position I was applying for was C++ Software Engineer. I told them: As far as I know, CRM is an acronym that stands for Customer Relationship Management. It also refers to software tools that track the responses and actions of customers and employees that are involved in some business relationship. But they seemed disappointed that I didn't know how to code or implement a CRM framework in C++ and I couldn't seem to find much on the Net either. Does anyone know what an employer is looking for at this stage - before they hire you and train you up? I would appreciate some pointers to get started.


Is Java free software?

Free software as defined by FSF. Are its standard libraries free/open source? Is its implementation free/open source? Which parts of it are not free/open source? Any other relevant information.


MQTT, GWT, ActiveMQ stack to bring jms to the browser

I am in the preliminary stages of architecting a legacy replacement project. They already have sub half second performance on their green screens and they want the same on their web app. We have a 390 mainframe that can handle anything we throw at it but they don't have a good jvm for it, so we have two tiers of websphere servers between the mainframe and the browser, The ui server, and the bl server. For the ui, I'm leaning towards GWT. But one thing that I think would seal the deal is to add messaging capabilities to the browser. The idea is say you click on a link that displays a second panel of information, instead of the classic GWT where it triggers a GWT-RPC call to the ui server, the ui server routs it to the bl server, the bl sends it to the mainframe and back out, it drops an MQTT message directly to the bl server or directly to the mainframe. Say writes go to the bl, reads go to the mainframe. This is an easy enough thing in classic jms because you can issue a message that has an expected response. Then have your callback ready to get the resonse. But from what I'm reading so far. It looks like mqtt doesn't have that. It looks like it's strictly fire and forget, which would make it really tough to come up with a way to get a response back to the workstation that called it. Am I right here? Has anyone tried this stack before with gwt.


Avoiding "Smart Guy" Syndrome on Team Projects

A lot of bad practices were being committed at the beginning of a project, and I recognized them and fought against all of them. Since I didn't pick and choose my battles, my boss now assumes anything out of my mouth is an over complicated response, and spends a lot of time defending himself personally, instead of looking out for the best interest of the project. How do I push the team in the right direction, without waiting four months for everyone to come to the consensus I was trying to get in place all along, or scarring my reputation on the team as a difficult know-it-all?


Explanation needed, for “Ask, don't tell” approach?

I'm taking a course on design patterns in software engineering and here I'm trying to understand the good and the bad way of design relating to "coupling" and "cohesion". I could not understand the concept described in the following image. ![enter image description here](http://i.stack.imgur.com/Tft7E.jpg) The example of code shown in the image is ambiguous to me, so I can't quite clearly get what exactly "Ask, don't tell!" approach mean. Could you please explain?


Creating New Scripts Dynamically in Lua

Right now this is just a crazy idea that I had, but I was able to implement the code and get it working properly. I am not entirely sure of what the use cases would be just yet. What this code does is create a new Lua script file in the project directory. The ScriptWriter takes as arguments the file name, a table containing any arguments that the script should take when created, and a table containing any instance variables to create by default. My plan is to extend this code to create new functions based on inputs sent in during its creation as well. What makes this cool is that the new file is both generated and loaded dynamically on the fly. Theoretically you could get this code to generate and load any script imaginable. One use case I can think of is an AI that creates scripts to map out it's functions, and creates new scripts for new situations or environments. At this point, this is all theoretical, though. Here is the test code that is creating the new script and then immediately loading it and calling functions from it:               function Card:doScriptWriterThing()         local scriptName = "ScriptIAmMaking"              local scripter = scriptWriter:new(scriptName, {"argumentName"}, {name = "'test'", one = 1})         scripter:makeFileForLoadedSettings()              local loadedScript = require (scriptName)         local scriptInstance = loadedScript:new("sayThis")         print(scriptInstance:get_name()) --will print test         print(scriptInstance:get_one()) -- will print 1         scriptInstance:set_one(10000)         print(scriptInstance:get_one()) -- will print 10000         print(scriptInstance:get_argumentName()) -- will print sayThis         scriptInstance:set_argumentName("saySomethingElse")         print(scriptInstance:get_argumentName()) --will print saySomethingElse     end      Here is **ScriptWriter.lua**               local ScriptWriter = {}          local twoSpaceIndent = "  "     local equalsWithSpaces = " = "     local newLine = "\n"          --scriptNameToCreate must be a string     --argumentsForNew and instanceVariablesToCreate must be tables and not nil     function ScriptWriter:new(scriptNameToCreate, argumentsForNew, instanceVariablesToCreate)              local instance = setmetatable({}, { __index = self })              instance.name = scriptNameToCreate         instance.newArguments = argumentsForNew         instance.instanceVariables = instanceVariablesToCreate         instance.stringList = {}              return instance     end     function ScriptWriter:makeFileForLoadedSettings()         self:buildInstanceMetatable()         self:buildInstanceCreationMethod()         self:buildSettersAndGetters()         self:buildReturn()         self:writeStringsToFile()     end          --very first line of any script that will have instances     function ScriptWriter:buildInstanceMetatable()         table.insert(self.stringList, "local " .. self.name .. " = {}" .. newLine)         table.insert(self.stringList, newLine)     end          --every script made this way needs a new method to create its instances     function ScriptWriter:buildInstanceCreationMethod()         --new() function declaration         table.insert(self.stringList, ("function " .. self.name .. ":new("))         self:buildNewArguments()         table.insert(self.stringList, ")" .. newLine)              --first line inside :new() function         table.insert(self.stringList, twoSpaceIndent .. "local instance = setmetatable({}, { __index = self })" .. newLine)              --add designated arguments inside :new()         self:buildNewArgumentVariables()              --create the instance variables with the loaded values         for key,value in pairs(self.instanceVariables) do           table.insert(self.stringList, twoSpaceIndent .. "instance." .. key .. equalsWithSpaces .. value .. newLine)         end              --close the :new() function         table.insert(self.stringList, twoSpaceIndent .. "return instance" .. newLine)         table.insert(self.stringList, "end" .. newLine)         table.insert(self.stringList, newLine)     end     function ScriptWriter:buildNewArguments()          --if there are arguments for :new(), add them         for key,value in ipairs(self.newArguments) do           table.insert(self.stringList, value)           table.insert(self.stringList, ", ")          end         if next(self.newArguments) ~= nil then --makes sure the table is not empty first           table.remove(self.stringList) --remove the very last element, which will be the extra ", "         end     end     function ScriptWriter:buildNewArgumentVariables()         --add the designated arguments to :new()         for key, value in ipairs(self.newArguments) do           table.insert(self.stringList, twoSpaceIndent .. "instance." .. value .. equalsWithSpaces .. value .. newLine)         end     end          --the instance variables need separate code because their names have to be the key and not the argument name     function ScriptWriter:buildSettersAndGetters()         for key,value in ipairs(self.newArguments) do             self:buildArgumentSetter(value)             self:buildArgumentGetter(value)             table.insert(self.stringList, newLine)         end         for key,value in pairs(self.instanceVariables) do             self:buildInstanceVariableSetter(key, value)             self:buildInstanceVariableGetter(key, value)             table.insert(self.stringList, newLine)         end     end     --code for arguments passed in     function ScriptWriter:buildArgumentSetter(variable)         table.insert(self.stringList, "function " .. self.name .. ":set_" .. variable .. "(newValue)" .. newLine)         table.insert(self.stringList, twoSpaceIndent .. "self." .. variable .. equalsWithSpaces ..  "newValue" .. newLine)         table.insert(self.stringList, "end" .. newLine)     end     function ScriptWriter:buildArgumentGetter(variable)         table.insert(self.stringList, "function " .. self.name .. ":get_" .. variable .. "()" .. newLine)         table.insert(self.stringList, twoSpaceIndent .. "return " .. "self." .. variable .. newLine)         table.insert(self.stringList, "end" .. newLine)     end     --code for instance variable values passed in     function ScriptWriter:buildInstanceVariableSetter(key, variable)         table.insert(self.stringList, "function " .. self.name .. ":set_" .. key .. "(newValue)" .. newLine)         table.insert(self.stringList, twoSpaceIndent .. "self." .. key .. equalsWithSpaces .. "newValue" .. newLine)         table.insert(self.stringList, "end" .. newLine)     end     function ScriptWriter:buildInstanceVariableGetter(key, variable)         table.insert(self.stringList, "function " .. self.name .. ":get_" .. key .. "()" .. newLine)         table.insert(self.stringList, twoSpaceIndent .. "return " .. "self." .. key .. newLine)         table.insert(self.stringList, "end" .. newLine)     end          --last line of any script that will have instances     function ScriptWriter:buildReturn()         table.insert(self.stringList, "return " .. self.name)     end          function ScriptWriter:writeStringsToFile()         local fileName = (self.name .. ".lua")         file = io.open(fileName, 'w')         for key,value in ipairs(self.stringList) do           file:write(value)         end         file:close()     end          return ScriptWriter      And here is what the code provided will generate:               local ScriptIAmMaking = {}          function ScriptIAmMaking:new(argumentName)         local instance = setmetatable({}, { __index = self })         instance.argumentName = argumentName         instance.name = 'test'         instance.one = 1         return instance     end          function ScriptIAmMaking:set_argumentName(newValue)         self.argumentName = newValue     end     function ScriptIAmMaking:get_argumentName()         return self.argumentName     end          function ScriptIAmMaking:set_name(newValue)         self.name = newValue     end     function ScriptIAmMaking:get_name()         return self.name     end          function ScriptIAmMaking:set_one(newValue)         self.one = newValue     end     function ScriptIAmMaking:get_one()         return self.one     end          return ScriptIAmMaking      All of this is generated with these calls:               local scripter = scriptWriter:new(scriptName, {"argumentName"}, {name = "'test'", one = 1})     scripter:makeFileForLoadedSettings()      I am not sure if I am correct that this could be useful in certain situations. What I am looking for is feedback on the readability of the code, and following Lua best practices. I would also love to hear whether this approach is a valid one, and whether the way that I have done things will be extensible.


The clock problem - to if or not to if?

Let's say, we have a simple digital clock. To "power" it, we use a routine executed every second. We update seconds part in it. But, what about minutes and hours part? What is better / more professional / offers better performance:   1. Ignore all checking and update hour, minute and seconds part each time, every second.   2. Use `if` \+ a variable for checking, if 60 (or 3600) seconds passed and update minute / hour part only at that precise moments. This leads us to a question, what is better -- unnecessary drawings (first approach) or extra `if`s? I've just spotted a Javascript digital clock, one of millions similar on one of billions pages. And I noticed that all three parts (hours, minutes and seconds) are updated every second, though first changes its value only once per 3600 seconds and second once per 60 seconds. I'm not to experienced developer, so I might me wrong. But everything, what I've learnt up until now, tells me, that `if` are far better then executing drawing / refreshing sequences only to draw the same content.


Successful Common Code Libraries

Are there any processes, guidelines or best practices that can be followed for the successful implementation of a common code libraries. Currently we are discussing the implementation of common code libraries within our dev team. In our instance, our common code libraries would compliment mainstream .net software packages we develop against. In particular, im interested in details and opinions on:   * Organic vs design first approach   * Version management    * Success stories (when the do work)    * Horror stories (when they dont work) Many Thanks