Learning to write DSLs utilities for unit tests and am worried about extensablity

I'm trying to simplify our unit tests with hand written DSL's. So far I have DSL's that walk developers through processing a service after setting up all preconditions and the construction of an monster object that has a huge constructor and setters that conflict. The monster is one of the many preconditions of processing the service and they constructed by hand over and over as developers write unit tests for new services in our system. So it would be worth putting considerable effort into making constructing them easier. I'm tried of watching people copy and paste the "life support system" from unit test to unit test. I'm making a separate new classes, one who's job it is to build the monster class and one that walks them through the steps to process the service. These will be used by many developers. This means once it's used widely changes will be difficult. That's why I'm worried about extendability. Rather than a simple fluent interface builder (where every method returns a `this` and is always available) I've decided to use an internal DSL that returns a different nested class. This is a very powerful choice. It lets me limit the methods available at any one step to only the valid ones. It also lets me change what the return type of a method is based on the "state" previous choices put the DSL into. Briefly, the way it works is the first method returns the first nested class that has the next valid method that could not have been called before. This limits the choices intelisense will offer making writing the DSL's calling code easier.               //Final build() method doesn't exist on PersonBuilder.  Its on a nested class.     public class PersonBuilder {         public GotRequired doRequired() {             return new GotRequired();         }              //One of many nested classes          public class GotRequired {             public GotFirstName addFirstName(String firstName) {                 mFirstName = firstName;                 return new GotFirstName();             }         }              public class GotFirstName {             public GotMiddleName addMiddleName(String middleName) {                 mMiddleName = middleName;                 return new GotMiddleName();             }         }              ...          }      This can be used to ensure methods are called in some order and ensure that preconditions have been met. The inner classes can be thought of as states the DSL is in. More than one state change path can be supported. Simply being in a state can tell you what states came before so long as no state merges two state paths into one. This all just means if you're careful you can know every needed method was called before building or returning a result. Fair warning, what follows is java verbose boiler plate at it's finest. The full listing is here: Monster builder code. The monsters DSL code looks something like this:               public class PersonBuilder {          // -- Required -- //          private String   mFirstName;     private String   mMiddleName;     ...          // -- Required Alternatives -- //            //Not both; not neither     private int      mBeersToday;     //One or     private String   mHowDrunk;       //the other               // -- What all the fuss is about -- //          private Person   mPerson;          /** Call each required method in order offered.*/     public GotRequired doRequired() {         return new GotRequired();     }          public class GotRequired {         public GotFirstName addFirstName(String firstName) {             mFirstName = firstName;             return new GotFirstName();         }     }          public class GotFirstName {         public GotMiddleName addMiddleName(String middleName) {             mMiddleName = middleName;             return new GotMiddleName();         }     }          ...          /*        Client code example                   .doRequiredAlternatives()   //Either x or y. a, b, or c. etc.             .addBeersToday(3)       //Now can't call addHowDrunk("Hammered");             .addFavoriteBeer("Duff")//Now can’t call addJobTitle("Safety Inspector");          .addBuild();                 //Calls different constructors based on alternatives          */         /** Now the interesting forking bit */         public class GotRequiredAlternatives {             public GotPerson addBeersToday(int beersToday){                 mBeersToday = beersToday;                      //Got enough for constructor                 mPerson = new Person(                         mFirstName,                         mMiddleName,                          mLastName,                              mNickName,                                                 mMaidenName,                          mEyeColor,                            mHairColor,                           mDateOfBirth,                         mBeersToday, //GotBeersToday                         mAliases);                      return new GotPerson();             }                          public GotPerson addHowDrunk(String howDrunk){                 mHowDrunk = howDrunk;                      //Got enough for constructor                 mPerson = new Person(                         mFirstName,                         mMiddleName,                          mLastName,                              mNickName,                                                 mMaidenName,                          mEyeColor,                            mHairColor,                           mDateOfBirth,                         mHowDrunk, //GotHowDrunk                         mAliases);                      return new GotPerson();             }                 }              //Could have created GotHowDrunk and GotBeersToday          //but we're past the constructor choice so we can          //forget the path that brought us here.              public class GotPerson {             /** Build Person object leaving optional fields set to default values */             public Person doBuild() {                 return mPerson;             }             /** Call any or none of these optional fields */             public GotOptional doOptional() {                 return new GotOptional();                     }         }              //Since person is not immutable the only thing gained here is confidence that these were set according to persons whacky rules         class GotOptional {                  /** Build Person object */             public Person doBuild() {                 return mPerson;             }                  public GotOptionalAlternatives doOptionalAlternatives() {                 return new GotOptionalAlternatives();             }                  public GotOptional addClothing(String clothing) {                 mPerson.setClothing(clothing);                 return this;              }                  public GotOptional addTatoo(String tattoo) {                 mPerson.setTattoo(tattoo);                 return this;              }                  //Add any number of setters that have good default values and do not conflict with each other              }              //Ideally person wouldn't allow this anyway but person is set in stone so at least this provides a safer interface         public class GotOptionalAlternatives {                  /** Build Person object */             public Person doBuild() {                             return mPerson;             }                  //Optional but conflicting setters. Might never be called.  Must never be called together.                       public GotFavoriteBeer addFavoriteBeer(String favoriteBeer){                 //mFavoriteBeer = favoriteBeer;  //TODO remove                 mPerson.setFavoriteBeer(favoriteBeer); //GotFavoriteBeer                      return new GotFavoriteBeer();             }                  public GotJobTitle addJobTitle(String jobTitle){                 //mJobTitle = jobTitle;  //TODO remove                 mPerson.setJobTitle(jobTitle); //GotJobTitle                      return new GotJobTitle();             }         }              //These are not strictly needed.  They are like one-statement {}'s after an 'if'.  Simply there if more gets added.              public class GotFavoriteBeer {             /** Build Person object */             public Person doBuild() {                             return mPerson;             }         }              public class GotJobTitle {             /** Build Person object */             public Person doBuild() {                             return mPerson;             }         }     }      I'll spare you the service code that uses the same nested class technique to mix optional methods and required methods. It is also able to return different result types based on previous alternate method choices since even though the result() method has the same name and params it's coming off a different inner class. Despite the unreal amount of typing required to create these DSLs I've found the results to be very powerful. However, I expect people will want new features added, new preconditions for processing the service. If I use this style is there any hope of reuse or would it be better to just write a whole new DSL each time something needs to change? Cause once it's working and being used I do NOT want to dive back into the existing DSL classes and mess with them. If you can see other issues please let me know. I'm hoping for a peer review but I appreciate any feedback.


Is my 'variable-storing area' basically a 'heap'?

I'm planning to implement a simple VM/interpreter kind of thing for a simple language I'm making. The compiler of the language emits mostly stack-oriented instructions to be executed by the VM. The structure of the program will be something like this:   * The execution part (for lack of a better term): interprets the opcodes and executes them.   * The call stack: to keep track of function calling, and for parameter passing and return values.   * The data stack: for none function-calling-related computation, such as arithmetic.   * The variable-storing area, where variable names are matched with values. The "variable-storing area" will be implemented basically with a HashTable/dictionary thing. When the programmer creates a variable (assuming for now only numeric variables), a new entry is added to the table. When he/she assigns a value to a variable, the entry with the matching name in the table is assigned this value. When the programmer accesses a variable, again we fetch the value from the table. I'm pretty sure that's the only data-storing part I need in the application, aside from the data stack and the call stack. I don't see why I'd need anything else. Now, I looked at what a 'heap' is in Wikipedia and other sources online. I found mostly technical terms that I'm having trouble understanding. But in simpler non-very-technical terms, if I understand correctly, the heap is where the 'constant' data is saved, things that aren't local computation such as arithmetic. So if my understanding is correct, is my 'variable-storing area' basically a 'heap'? Why or why not? If my understanding of what a heap is is wrong please explain it.


Performing user authentication in a CodeIgniter controller constructor?

In "The Clean Code Talks -- Unit Testing" (http://youtu.be/wEhu57pih5w), Miško Hevery mentions that "as little work as possible should be done in constructors [to make classes more easily testable]'. It got me thinking about the way I have implemented my user authentication mechanism. Having delved into MVC development through CodeIgniter, I designed my first web application to perform user authentication for protected resources _in controllers' constructors_ in cases where _every_ public function in that controller requires the user to be authenticated. For controllers with public methods having mixed authentication requirements, I would naturally move the authentication from the constructor to each method requiring authentication (though I don't currently have a need for this). I made this choice primarily   1. to keep the controller tight, and   2. to ensure that all resources in the controller are always covered. As for code longevity and maintainability: given the application structure, I can't foresee a situation in which one of the affected controllers would need a public method that didn't require user authentication, but I can see this as a potential drawback _in general_ with this implementation (i.e., requiring future refactoring). Is this a good idea?


microsoft .Net license

Am about to start coding using microsoft .Net technologies, am just worried about the license, so if I compile my code using the .Net compiler " **not visual studio** " can I distribute, sell or use my product freely or I should have some sort of "microsoft license", same thing for sql server express installed(depolye) with my application


Learning basic algorithms - better C or C++?

I'm studying fundamental algorithms (quicksort, mergesort, binary trees, etc..) and I'm going to re-code every algorithm by scratch to learn how they work. Should I code them in C or C++? I think with C++ I should use STL, in C everything should probably be longer Is there a reason why I should pick one over another?


Setting up a new developer system - how to speed up the process?

When I get a new laptop, it usually takes me about two weeks to reinstall all my developer programs, utilities and tweak the O/S settings to how I like them. I know there are utilities out there to backup/restore systems, but this is usually if it is on the same hardware. What would you recommend?


Implement Haskell typeclass with C# interface

I'm trying to compare Haskell's type classes and C#'s interfaces. Suppose there is a `Functor`. Haskell:               class Functor f where       fmap :: (a -> b) -> f a -> f b      How to implement this type class as interface in C#? What have I tried:               interface Functor<A, B>     {         F<B> fmap(Func<A, B> f, F<A> x);     }      This is invalid implementation and I'm actually stucked with generic `F` type that should be returned by `fmap`. How it should be defined and where? Is it impossible to implement `Functor` in C# and why? Or maybe there is another approach?


How can a potential customer find "best" offer in agile software development?

If you have fixed-price software projects a potential customer can choose a software development company by the price to get best value for money. The software development company with the lowest price wins the contract. In agile software projects there are no fixed software-featuresets with fixed prices. Featuresets can change after every sprint. So how can a customer choose which software development company is best for him? (in price, quality or something else) [update] Lowest price is just an example how a customer _can_ choose a contractor. Background: Last week I was at a seminar about agile development. We found out that new customers often want fixed price price projects because that makes it easy for them to compare possible contractors. Customer and Contractor need a certain level of trust to agree to do agile development. If Customer and potential Contractor do not know each other what can a customer do to choose a contractor?


Algorithm for formating SQL code

I need a tool (for in house usage) that will format SQL code (SQL Server/MySQL).   There are various 3rd party tools and online web sites that do it but no exactly how I need it. So I want to write my own tool that will fit my needs. First question is there any standard or a convention for how the SQL code should be formatted? (the tools that I tried format it differently) The second question, how should I approach this task? Should at first convert the sql query into some data structure like a Tree?


Should I use a relational datamodel or Cassandra with ColumnFamily based indexes?

Currently we are working on some storage problems for log data from various servers and communication message logs (HTTP(S), XMPP). There will be many write operations and for read operations we will use search queries with filters. Should we stick with the classic relation database schema solution or concentrate on Cassandra with ColumnFamily based indexes?


DI: Can a stable dependency have a volatile dependency?

I've recently been reading through Mark Seemann's _Dependency Injection in .NET_ and have been attempting to apply some of what I've learned in a new project I'm working on, and I'm stumped on a particular scenario trying to determine what dependencies I should and should not inject. I've read several other questions on SO and elsewhere that discuss similar scenarios but in a roundabout manner, and I think I've narrowed the underlying conceptual question to that which is in the title: Can a stable dependency have a volatile dependency? Put another way: If a stable dependency has a volatile dependency, is the stable dependency really stable? A quick example:               public class MyClass     {         private IVolatileDependency1 _one;         private StableDependency _stable;              public MyClass(IVolatileDependency1 one, IVolatileDependency2 two)         {             _one = one;             _stable = new StableDependency(two)         }     }          public class StableDependency     {         private IVolatileDependency2 _two;              public StableDependency(IVolatileDependency2 two)         {             _two = two;         }     }      In this situation, `MyClass` has a stable dependency which I've chosen not to inject but instead instantiate internally and hold via composition. However, that stable dependency has a volatile dependency, which I'm injecting into `MyClass` and passing through to `StableDependency`'s constructor. For whatever reason, this smells a little bit to me. It's fairly straightforward in such a simple contrived example, but I can see things getting out of hand quickly in a more complicated real-world situation. Is `StableDependency` really stable, or should I be composing/resolving it prior to constructing `MyClass` and injecting it from there? I really don't foresee `StableDependency` changing or being replaced by another implementation, but on the other hand the practice of passing dependencies down through parent classes to their children (parent/child in the composition sense) seems to expose the details of the children up through the parent, which would be a violation of the Law of Demeter. **EDIT:** Changed VolatileDependency1 and VolatileDependency2 to interfaces to clarify that they are intended to be satisfied by multiple possible implementations (LSP-compatible). **EDIT 2:** Thinking on this some more, and reading KeithS's answer and default.kramer's comment below, make me realize that maybe I shouldn't have named `StableDependency` as I did, because I don't think it's a dependency in the first place. It's not something I ever expect to have multiple implementations for; it's merely an implementation detail that `MyClass` uses composition to contain a `StableDependency`, so `MyClass`'s knowledge of how to construct a `StableDependency` isn't a problem I don't think. The big question is, `StableDependency` _does_ have a dependency on `IVolatileDependency2`, so how do I inject that dependency? Do I reason that for all intents and purposes `MyClass` has a dependency on `IVolatileDependency2`, and the fact that it just passes that dependency down to `StableDependency` is an implementation detail unrelated to DI?


How to introduce code to a colleague

How do you go about introducing the codebase, which may be rather complex and tangled with a lot of "gotchas," to a new member of your team? I think the easiest way would be to have the overall architecture laid out with diagrams, and take a couple weeks (or months) giving the new person well defined (and well scoped) tasks as he becomes more accustomed to the code. However, as a consultant (and junior employee, at that,) I can't always have that either due to time constraints or team role designations. (I have been on this particular project twice as long as anybody else, so "junior" is in no way "knows less about the code/project.") I've been tasked quite a few times now to introduce a new member to the project and code, and sadly each time I find I'm not much better at it than the one before. I love diagrams and pictures, but often feel that they don't adequately account for the complexity in a system. (What about all the little's "gotchas"?) The project is getting to a point where we will be handing it off to the client, and to make things more challenging, the person I'll be doing a knowledge transfer with is essentially just out of college. (Not that I'm much better when doing knowledge transfers with senior developers.) I attend a user group once a month and other opportunities as they arise, so I'm not unused to be being introduced to new topics, but feel my ability to replicate effective knowledge sharing woefully inadequate. Any advice would be greatly appreciated. I am looking mostly for a guideline I can follow. For example: Where do you start? How do you proceed? How do you cover unfamiliar technologies or patterns on the listener's part without taking all day? Where do you tie in business logic vs. code-structure? Thank you! (As always, please feel free to edit the question as you see fit.)


Test-Driven Development with plain C: manage multiple modules

I am new to test-driven development, but I'm loving it. There is, however, a main problem that prevents me from using it effectively. I work for embedded medical applications, plain C, with safety issues. Suppose you have module `A` that has a function `A_function()` that I want to test. This function call a function `B_function`, implemented in module `B`. I want to decouple the module so, as James Grenning teaches, I create a Mock module `B` that implements a mock version of `B_function`. However the day comes when I have to implement module `B` with the real version of `B_function`. Of course the two `B_function` can not live in the same executable, so I don't know how to have a unique "launcher" to test both modules. James Grenning way out is to replace, in module `A`, the call to `B_function` with a function pointer that can have the value of the mock or the real function according to the need. However I work in a team, and I can not justify this decision that would make no sense if it were not for the test, and no one asked me explicitly to use test-driven approach. Maybe the only way out is to generate different a executable for each module. Any smarter solution? Thank you


sanity checks: when do they become paranoid checks

I normally add lots of sanity check clauses in my code. In other words, lots of assertions where the code is instructed to "panic" (usually print as much information as possible when a certain condition doesn't hold and then exit). The point is, many of these sanity checks are obviously redundant one way or the other. On the other hand I've often been bitten by situations were I didn't add a sanity check judging it to be fairly obvious that it can't fail and was proven wrong. So the question is: are there any guidelines / best- practices to decide how much sanity checking is reasonable? Too much sanity checking obviously clutters the code and is a pain to maintain when assumptions change.


Software licence giving full non-profit use

Are there any software licenses that explicitly allow somebody (a developer or otherwise) to have full access to source and/or assets of a project as long as it is for completely non-profit and/or personal use and otherwise needs to pay a commercial licensing fee?


class hierarchy with structurally different subclasses

I want to implement a protocol layer which sits on top of the TCP/IP stack. There is a limited set of PDUs that can be sent and for each PDU there is a class which represents it in a structured form. Each class has a function to serialize the structured data into a ready-to-transmit form, and deserialize them into a structured form. These PDUs are structurally very different, for example:               struct a_associate_ac : property      {           a_associate_ac() = default;           void from_pdu(std::vector<unsigned char> pdu) override;           std::vector<unsigned char> make_pdu() const override;           pdu::TYPE type() const override;                     std::string called_ae;           std::string calling_ae;           std::string application_context;                struct presentation_context           {                 enum class RESULT                 {                    ACCEPTANCE = 0x00, USER_REJEC = 0x01,                    PROV_REJEC_NO_REASON = 0x02,                    ABSTR_CONT_NOT_SUPP = 0x03,                    TRANFS_SYNT_NOT_SUPP = 0x04                 };                      presentation_context() = default;                 unsigned char id;                 RESULT result_;                 std::string transfer_syntax;           };                std::vector<presentation_context> pres_contexts;           std::size_t max_message_length;     };      compared to:               struct a_associate_rj: property     {           a_associate_rj() = default;           void from_pdu(std::vector<unsigned char> pdu) override;           std::vector<unsigned char> make_pdu() const override ;           pdu::TYPE type() const override;                enum class SOURCE : unsigned char           {              UL_SERVICE_USER = 0x01, UL_SERVICE_PROV_ACSE = 0x02,              UL_SERVICE_PROV_PRESREL = 0x03           };           enum class REASON : unsigned char           {              NOT_SPECIFIED = 0x01, APPL_CONT_NOT_SUPP = 0x02, CALLING_AE_NOT_RECOG = 0x03,              CALLED_AE_NOT_RECOG = 0x07           };                REASON reason_;           SOURCE source_;     };      All these classes inherit from an abstract superclass property. property is used by the layer class, which implements the protocol, in two member functions:               void send(const property* p);     std::unique_ptr<const property> receive();      This means if the user of the layer class receives a property and wants to access its members, they must check what kind of property was received using `property::type()` and downcast it to that type, which I find is quite irritating. What can be done to solve this problem?


How can I demonstrate my productivity to management?

My university has a module for software development with a real client. Some of my team members work in the computer lab all the time, which is an extremely noisy environment with lots of interruptions and distractions. There are about 30 people always talking. People always go on Facebook, YouTube, or tell jokes to each other in addition to doing "work". Some of my team members work 3 hours every day in this environment. I attend our weekly team meetings and use our online project management system extensively. I address all emails and have a chat client on busy, but I do get messages. I use online resources a lot when solving my problems. However, outside the team meeting and pair programming sessions, I do most of my work in a quiet environment where I can focus and concentrate and I block out all external as well as internal interruptions. I focus on my task 100%. I find that I'm about 10 times more productive this way than in the lab and I can get a lot of work done. The problem is that our tutors or "management" don't see me doing work in the lab. Thus, I do not appear to be working to them. Thus they think I do no team work. How can I convince them that I do team work because I have lots of communication with my team, but at the same time I like to work on my own? I would like to prove that, just because I work alone a lot and don't necessarily do all of my work in the lab, I'm still a productive member of the team. * * * **UPDATE** Management told me that the problem was that I spend working in a team 60% of my time, and I work alone 40% of the time. They told me I should spend 99% of my time working with my team face to face in the lab, aka office. * * * Some relevant comments of some answers, that some might miss: _"Problem is I don't really need to ask my team anything, because I rather google it myself. And I trust Google a lot more than my supervisor or team members for some reason. Hence I often disagree with them. I'm not doing team work, because essentially I'm doing "web" work."_ _" I trust information that I find online (i.e. SE) more than my supervisor's or team mates' expertise."_ * * * **UPDATE 2** I stopped doing any serious work at home, I just stay in the lab now and have fun with my team while also do some work occasionally. As the accepted answer shows, this isn't about me being productive but rather fulfilling my managers' and team mates' expectations. If I and my manager have different beliefs about how to do software development, it's the manager's that counts because they have the power to fail/fire me. In my opinion face to face meetings aren't as effective as online conversations, and working in a noisy lab isn't as productive as working in a quite environment. I think team mates shouldn't be able to interrupt me any time they want, while I'm in the middle of a task. I think one needs at least 50% of the time to do productive work alone and 50% of the time to synchronize with the team. Anyway, this is just my opinion, and that doesn't count in this case.


Optimal table shape for pair programming?

As the title suggests, what is a good shape of a table when doing pair programming ? Are there shapes that should be avoided? What are the reasons a certain shape is good or bad? (I _do_ have my own thoughts on this, but would like not to bias the discussion with that input just yet)


"Do Whatever You Want" License With Attribution

I'm looking for an open source license that lets people do whatever they want - just like the MIT license - just as long as they attribute the original author, i.e. me. Does a common license exist for this? If so, what is it?


How should I mention those sites in portfolio that have changed since I worked on them?

I have built many web sites and I would like put them in my portfolio. But now when I am checking I see that most of them are changed as they switched to another company. Now I am confused what should I do   1. Do I put old thumnail or screenshot of site or new one? (I have old screenshots)   2. If interviewer checks the site and ask me what part I have done, what should I say?   3. Does the interviewer or company contact the site owner to confirm that?


What's the proper way to merge two projects in source control software

I'm using Fossil-SCM to maintain my projects. Since I don't work in a team I usually have just a very linear branch of development: 1.0 -> 1.1 -> 1.2 I'm wondering what the procedure is when you have one project who's task is about to be given to a related project. And thereby rendering the first project obsolete. Although I tend to rewrite most of my code if I don't remember having already written it, I still would like to keep the code archived. And I'ld rather not have a fossil repo that just is dead. Can I merge it? Is that the proper way of handling this? For example the code was extracting data from an excel file in order to format an HTML page. Now, I've convinced my employer to move their excel spreadsheet into a database to decrease redundancy, increase efficiency and yaddy yadda. Since I can now make logical queries that don't have to jump hoops to preform using the database I won't need the extra vbs files that originally manipulated the excel file. Technically I would be porting part of the existing code into the current new project. Since it already has it's own trunk, would it be advisable to combine the trunk of a different project to this one, and how would I do that exactly?? SO I guess my tree would look like this, and I haven't seen examples of software branching that resemble this inverted tree before so I'm wondering what the norm for a situation like this? ![It merges at 1.8!!](http://i.stack.imgur.com/G4RXX.jpg)


Can map-reduce say "Hello World"?

Gathering that map-reduce is being used to process huge amounts of data, I set out to understand it. My queries were:   * What class of problems does it aim to solve?   * How does it help breaking down of complex problems?   * Can I write a sample app, (locally!) to get started? After a lot of googling, blogs and wikipedia, I know who is using it, who is selling infrastructure for it. But, I am still clueless about the above queries. The closest I got is this tutorial on Amazon: " _Contextual Advertising using Apache Hive and Amazon Elastic MapReduce with High Performance Computing instances_ " http://aws.amazon.com/articles/2855?_encoding=UTF8&jiveRedirect=1 This tutorial assumes understanding of online advertising and map-reduce, hence, tough to follow. Anybody have any clues to how a programmer can get started on map-reduce?


Agile product planning alternatives to aid goal-oriented feature quality

What do I mean by _high-level plan_? The kind of plan that outlines product's functionality that needs to be developed but not going into too many details that are done afterwards. This kind of plan helps deciding functionality development order (priority) or even eliminating non-necessary ones. A great high level plan isn't just a set of functional requirements, but rather a product vision with obvious goal in mind. In Agile terms these kind of functionality documentation is the Backlog. We're used to its content - user stories - as defined by Mike Cohn that go: > As a _role_ I want _functionality_ so that _benefit_. But as we know from experience this may lead to:   * **unusable stories**   Like: _As a visitor I want to login so that I'm allowed to do stuff._   But how would one improve this user story? What other benefits can we describe that are more relevant than _...do stuff_?   * **flat list of unmanageable seemingly unrelated stories**   Hard to see which ones are related or not (they shouldn't be but I don't think we can totally avoid this), or even which ones provide means for achieving the same high-level goal.   * **too many unrelated goals/benefits**   Goals just because we need to write them but without actual business value benefit - the high level business goal in mind. ## The problem As I have experienced there are more ways to write bad/unusable user stories than writing really good ones. And it's easy to get to the _wrong_ tracks even if you're careful. And how can one write better user stories when they are working on their own product, so they don't have means to learn from other fellow team members, and they have to provide user stories now. Not after 6 months of learning. That's why I would like to know about alternatives to planning a project on the high level that ensures better feature description and relevancy. I've heard of **Effect mapping** that seems very good in keeping goal focus and filtering relevant from irrelevant but I don't have any experience with it. I can imagine that setting a goal can be crucial. So if you set it wrong, everything else is wrong as well. Or better said _irrelevant_. The main question is: **Can we follow some easy to understand and narrow guideline that will lead us to a great high-level plan**. A guideline that allows less errors and better leads to valuable plan/results. I can see myself writing user stories afterwards that describe features to implement. The problem with user stories is that it's easy to get lost in them. If you don't have lots of experience with user stories that may hinder your product because they distract you from the actual goal. All you can see are product features described in user stories. Something else above that would allow us to create better stories and also easily filter out those that are extremely relevant. What are other more reliable approaches that simple user stories planning that are used in agile planning? ## Focus of this question I have been writing user stories on several projects in the past and know exactly how hard and vague this task is. I've also seen that writing these is even harder when you're writing them for your own project/product. You can easily over-design your product or incorrectly prioritise/evaluate features. So I would like to write feature set for my coming product in a way they are actually relevant and prioritise them accordingly to reach my goal as reliably as possible. So **feature relevancy and quality** along with **goal-oriented prioritisation**. And I'm talking about measurable quantitative goals like > **20% month over month income increase** or   >  **5% sale conversion rate of user visits** and not something vague like _increase users_ or _increase sales_. We can see that writing relevant features that support these goals is much harder.


How to use event weights in TMVA ROOT

I'm trying to train and perform classifiers from TMVA. My data set contains event weights besides event data. In the _TMVA::Factory_ there's a method _setWeightExpression_ to specify event weights. What are the event weights good for? Why it doesn't exist similar possibility to set event weights in _TMVA::Reader_? Regards, Vladimir


Is it bad practice to create new objects without storing them?

I've seen objects created in Java code without storing a reference to the object. For example, in an eclipse plugin I've seen a SWT Shell created like so:               new Shell();      This new Shell object is not stored in a variable, but will remain referenced until the window is disposed which [I believe?] happens by default when the window is closed. Is it bad practice to create objects like this without storing a reference to them? Or was the library poorly designed? What if I don't have need of a reference, but only want the "side effects" of the object? Should I store a reference anyways? UPDATE: Admitedly, my above example is poor. While I have seen UI elements created like this, creating a SWT Shell like this would probably be pointless because you need to call the open method on the Shell instance. There are better examples provided by aix such as the following from the Java concurrency tutorial:               (new HelloThread()).start();      This practice is seen in many contexts, so the questions remains. Is it good practice?


MFC and WPF similarities

What are the similarities between MFC and WPF? Is it worthy to learn MFC before WPF?


Design help with parallel process

I am re-factoring some code and an having an issue with retrieving data from two parallel processes. I have an application that sends packets back and forth via different mediums (ex: RS232, TCP/IP, etc). The jist if of this question is that there are two parallel processes going on. I hope the picture below displays what is going on better than I can word it:![enter image description here](http://i.stack.imgur.com/QCbX8.jpg) SetupRS232() class creates a new instance of the SerialPort by:               SerialPort serialPort = new SerialPort();      My question is, what is the best way that the Communicator() class, which sends out the packet via the respective medium, get access to the SerialPort object from the SetupRS232 class? I can do it with a Singleton but have heard that they are generally not the best design to go by. I am trying to follow SRP but I do feel like I am doing something wrong here. Communicator() will need to go out of it's way to get access to SetupRS232() to get access to the SerialPort class. I actually haven't found a way to even get access to it. Would designing each medium class, for example, SetupRS232(), SetupTCPIP, as a singleton be the best way to approach this problem?


REST vs RPC for mobile development

As many know, mobile development is skyrocketing these days and, I believe, it affects what we code. To be specific, I am interested in developing web services for a mobile application. I see two possible architectures - RPC and REST. I have developed both, REST and RPC services and what I have observed is that RPC services are way easier to code, especially in languages like PHP. The problem with it seems to be scalability - server-side can easily turn into a mess when many procedures are present. REST, on the other hand seems to be a lot more structured, server-side becomes relatively easy to maintain but it has a potential to break data into multiple resources which is bad for mobile applications (for multiple reasons). From what I have experienced, RPC seems a bit better in most cases:   * Both, client- and server- sides, are concerned to minimize number of procedures available and calls made.   * Following architectural rules does not counter with optimizations otherwise possible. I don't really expect someone to explain me what REST and RPC are, the web is full of that. **I want people who has experience developing mobile apps express their opinions about using these two architectures on the server- side.** Tips are also welcomed (who doesn't love tips, huh?).


Pure vs Applied Math For Programmers

Math has always been my thing in that I've always found the subject easy. Computer Science is my second love, though. Given the choice, I would prefer to major in Math. Since the only careers one would usually go into with an undergraduate degree in math are not appealing at all, I would be very content spending my days as a software developer. My question is this: Which math discipline would a future programmer reap more benefits from? Applied math or pure math? I enjoy teaching myself and I am confident that I can teach myself how to be a great programmer, but I still plan on getting a minor in CS!


Is this an MVC framework?

I have built a framework for my applications that has been working well, and I have always referred to it in my mind as an MVC. However, after reading some more on what an MVC is (not that I didn't to start with, but I gave it a very brief overview, and looked at other frameworks that used the mvc pattern), and it has given me pause for thought. The structure is as follows: The framework has a bootstrap that loads the required files for the framework and the initiation file for the application (`app_bootstrap.php`). The `app_bootstrap.php` file has three functions. First, it creates constants for the framework to use (i.e. Database connection setup, profiling setup, base url path, and internal file paths). Second, it requires all the files that would be pertinent to the application, primarily, what I have called "model" classes which contain information on the name and structure of tables in the database, validation rules, associations to other "models", etc. These "models" extend an abstract class that contains static functions for selecting and creating rows from the database, which will create instances of an entity class that deals with the row, such as `__get`, `__has`, `__set`, `__unset` for fetching columns and associations, and `save` and `delete` for saving the row changes to the database. Third, it calls functions within the `router.php` file that will setup bindings for environmental data (like the url, user login status, ssl, ajax, cookie existence, etc) to "controller" classes. The framework then runs an execution function within `router.php` that will go through the defined environmental data rules, and determine which "controller" to load, if it finds one, it will `require` the file (from the application/controllers directory, throwing an error if not found) and call the class with the appropriate entry point function (index is none defined), or throw a 404 error. Once the "controller" has been started, there are no more functions that the framework will execute, and once the "controller" has finished, the program will end (unless the profiling has been activated, where it will output the data, then end). But the framework provides functions to the "controller", and to name a few, an `input` class (for dealing with all input, such as `$_GET`, `$_POST` or `$_SERVER` variables, cookies, user agent, remote ip, etc, as well as providing a sanitized interface), an `output` class (for headers, cookies, status messages, etc), a `queryBuilder` class (for creating queries to the database in the event functionality that can't be done within the "model"), and a `view` class (for parsing variables into a view for rendering and returning to the client). But after reading some more information on MVC's, it appears that the `router.php` acts similarly to a Controller, the "controller" acts like the model, the "model" acts like an ORM, and the view is pretty much correct. So, would this framework still be classed as an MVC, or does it fit under another pattern (if there is such a pattern)?


Why do developers need to keep up to date with technologies and methodologies?

I am always given the advice that developers need to stay up to date with the latest in technology - things like webrtc, updates on html5 and css3 and new js libraries, software methodologies like TDD, DDD, and BDD. The question is _why_? Why do we need to constantly update ourselves? Can't we just stick with what we know and become better with it?


Do mixins create coupling with Ruby?

Let's say I have the following architecture:               module Keyring         @keyring = Keyring.new         class Keyring             def key             def add_key             def update_key             def remove_key         class KeyStorage         class Encryptor             class AesEncryptor     class Connection         def id         def user_id         def protocol         def name     class FtpConnection         include Keyring         def host         def port         def username_encryption_id         def passsword_encryption_id         def is_passive         def username             # Return the decrypted value given an encryption key id.             return @keyring.key(self.username_encryption_id)         def password             # Return the decrypted value given an encryption key id.             return @keyring.key(self.password_encryption_id)      As you see, FtpConnetion uses Keyring. Now, isn't Keyring coupled to the Keyring module (by name)? If I want to use FtpConnection in another project, I'd have to bring along Keyring or implement another module with exactly that name, right? Isn't this bad design?


What is the difference between development and R&D?

I was asked by a colleague to explain clearly the difference between ordinary development and research and development (R&D) and was unable to do it. After reading Wikipedia, I still don't have the precise answer. According to Wikipedia (slightly modified): > There are two primary models: > >   * In one model, the primary function is to **develop new products** ; > >   * in the other model, the primary function is to discover and **create new > knowledge about scientific and technological topics** for the purpose of > uncovering and enabling development of valuable new products, processes, and > services. > > The first model is confusing. Does it mean that development (not R&D) consists exclusively in adding new features to a product, solving bugs and doing maintenance? What if something which was previously developed as a new feature becomes a separate product? The second model is less confusing, but still, how to qualify whether something is new knowledge or existent knowledge which is just rediscovered? Later, Wikipedia adds that ordinary development is different from R&D because of its: > nearly immediate profit or immediate improvement. It's still not clear enough. How to qualify "nearly immediate profit"? What if a task has an immediate profit but requires heavy research? Or if it is basic but has uncertain profit, like the enforcement of a common style over the codebase? For example, does it belong to development or R&D to:   * Develop an engine which abstracts the access to the database, simplifying and shortening enormously the code of other applications (existent or ones which will be written in future) which should access to the database?   * Establish a new service-oriented architecture for the entire organization of company resources, in order to move from a bunch of separate and autonomous applications to a set of well-organized, interconnected web services, like what is used by Amazon?   * Design a new communication protocol to allow faster replication of data between two data centers of the company?   * Conceive a new type of software testing while working on a specific product, knowing that this type of testing will improve/simplify the testing process?   * Prove that Functional programming is more appropriate than OOP for a specific application, based on evidence, logic and previous experience?   * Enhance the existent application by adding gestures on tactile screens, after doing studies and testing that shows that those gestures improve the productivity of the users by a ratio of at least 1.4 for a precise set of tasks?   * Find a way to strongly enhance the Power usage effectiveness (PUE) of a data center?   * Create a Domain-Specific Language (DSL)? In short, how could I determine whether I'm doing R&D while working on something?


Find out whose turn it is to buy the croissants, accounting for possible absences

A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The purpose of this question is to determine an algorithm for deciding whose turn it will be to bring croissants tomorrow. Constraints, assumptions and objectives:   * Whose turn it is to bring croissants will be determined the previous afternoon.   * On any given day, some people are absent. The algorithm must pick someone who will be present on that day. Assume that all absences are known a day in advance, so the croissant buyer can be determined on the previous afternoon.   * Overall, most people are present on most days.   * In the interest of fairness, everyone should buy croissants as many times as the others. (Basically, assume that every team member has the same amount of money to spend on croissants.)   * It would be nice to have some element of randomness, or at least perceived randomness, in order to alleviate the boredom of a roster. This is not a hard constraint: it is more of an aesthetic judgement. However, the same person should not be picked twice in a row.   * The person who brings the croissants should know in advance. So if person P is to bring croissants on day D, then this fact should be determined on some previous day where person P is present. For example, if the croissant bringer is always determined the day before, then it should be one of the persons who are present the day before.   * The number of team members is small enough that storage and computing resources are effectively unlimited. For example the algorithm can rely on a complete history of who brought croissants when in the past. Up to a few minutes of computation on a fast PC every day would be OK. This is a model of a real world problem, so you are free to challenge or refine the assumptions if you think that they model the scenario better. * * * Origin 1: Find out who's going to buy the croissants by Florian Margaine.   Origin 2: Find out who's going to buy the croissants by Gilles.   This question is the same version as Gilles', and has been re-posted on Programmers as an experiment to see how the different communities address a programming challenge.


How much of a setback is a change of industry for a programmer?

My question is about changing industries as a developer, after having spent half a decade in one. Let's say I'm a full-stack web and mobile app developer, I use a good variety of languages and paradigms out there and have been around the block for a few years, both at a very large corp and as a startup founder in a mostly technical role. Hypothetically, let's say I'd like to see if I can make as a AAA game developer, perhaps start out as a gameplay programmer and go from there. I interned at a large game company before, but ended turning down their offer at the time as I didn't see the project going very far (it didn't). I could probably easily get a role in server-side development, but that would be close-ish to what I'm already doing. I know that because of my breadth of experience I won't have a particularly hard time ramping up fast in whatever technologies and paradigms the game will be using and will do great on the long run, but I'm not sure what the short term will look like. What kind of setback can I expect? Will I have to re-climb the totem pole from the ground up? Is there anything I can do to hit the ground running? Also, what has your experience been with changing industries (doesn't have to be the same industries as the ones I mentioned)? Did you end up regretting not being able to carry over your domain knowledge?


How do I implement the bg, &, and fg commands functionaliity in my custom unix shell program written in C

I am extending the functionality of a custom unix shell which I wrote as part of my lab assignment. It currently supports all commands through execvp calls, in-built commands like pwd, cd, history, echo and export, and also redirection and pipes. Now I wanted to add support for running a command in background e.g. $ls -la& I also want to implement bg and fg job control commands. I know this can be achieved if I execute the command by forking a new child process and not waiting for it in the parent process. But how do I again bring this command to foreground using fg? I have the idea of entering each background command in a list assigning each of them a serial number. But I don't know how do I make the processes execute in the background, then bring them back to foreground. I guess wait() and waitpid() system calls would come handy but I am not that comfortable with them. I tried reading the man pages but still am in the dark. Can someone please explain in a layman's language how to achieve this in UNIX system programming? And does it have something to do with SIGCONT and SIGSTP signals?


Should user stories be assigned to team members?

We are using JIRA to manage the scrum process. What I'm curious about is whether the User Story issue type should be assigned to a team member, the PO, or remain unassigned. My gut tells me it should remain unassigned to be assigned to the PO since the team should only be working on Task issues, but I wanted to see if I'm missing anything.


Struts action invoked without clicking the submit button on IE8

I use Struts 1 and my application only supports IE browsers. The following straightforward code works fine on IE9 and above, i.e. when click on action1button, action1 is invoked; click on action2button, action2 is invoked.               <html:submit property="someaction" styleId="action1button" styleClass="button">       <bean:message key="someaction.action1" />     </html:submit>          <html:submit property="someaction" styleId="action2button" styleClass="button">       <bean:message key="someaction.action2" />     </html:submit>      But on IE8 and below, when action2button is clicked, both action1 and action2 are invoked. Though action1button still only invokes action1. I am very confused. Does anyone have any idea what's going on here?


Why does Java have a "bad rap"

I hear a lot of people speak poorly of Java, especially the ones coming from C/C++. Is there a historical reason why? Is it because it used to be machines were too slow to run the JVM without lag?


Test Driven Development, has it reduced stress for developers?

I understand the benefits of test driven development, but have there been any studies that reveal the level of satisfaction with the product or stress levels of the authoring developers with the introduction of unit testing? I'm looking for case studies, or preferably research papers.


Should the gating question in hiring a web developer be  "Have you by yourself, or with one or two partners, ever brought a product to market?"

I've just met a guy, an engineer but a software naif, who's designed, produced, and is now selling a very nice product, a backyard zip line. He devised a new braking system for the thing and has a patent pending. He conceived and put together two zip-line kits and he's selling them on the web. I am guessing that he's put in at least 6,000 hours and $50K (counting the legal fees for the patent app), all on his own. Not the least bit unusual for starting a biz. The issue has been that the web developers (sic! plural -- you can imagine) he's contracted with have, out of immaturity or ignorance, just taken him right over the coals: he's spent, he says, many many more bucks than he should have bringing up his e-commerce site. I don't want to say how many bucks, but a lot. I think that if any of those developers had gone through the endless excruciating ass-pain of bringing up a business from scratch, it would have been a lot different and a lot happier all around. So I ask you: should the gating question in hiring a web developer be _"Have you by yourself, or with one or two partners, ever brought a product to market? I don't care if it succeeded or failed, but tell me about it."_


Class structure/pattern for validating several different Excel templates?

I'm trying to validate the contents of Excel sheets that follow several different templates. For each one, there are three possible validation actions for various cells:   * Regex (e.g. "XYZ-123" fails because it doesn't fit pattern "[A-Z]{4}-\d{3}")   * Date/Time format (e.g. "Jan 24, 2013" fails because it's not mm/dd/yyyy)   * Data type (e.g. "xyz" fails because it's not an integer) My first thought was to use the following class:               public class Validator     {      Excel.Worksheet vSheet;      List<Tuple<string,string,string>> cellActions=new List<Tuple<string,string,string>>();           //populates the list of cellActions based on the template type      public Validator(Excel.Worksheet sht)      {       this.vSheet=sht;       string templateType=templateCheck(sht);       switch (templateType)       {        case "type1":         cellActions.Add(new Tuple<string,string,string>("C5","regex","[A-Z\d]{6}");         cellActions.Add(new Tuple<string,string,string>("D3","datatype","long");         //and so on for another 30 list items         break;        case "type2"         cellActions.Add(new Tuple<string,string,string>("A3","date_time","yyyy-MM-dd HH:mm");         cellActions.Add(new Tuple<string,string,string>("A6","regex",".+\s[ACGT]{3}");         //etc.       }      }           private string templateCheck(Excel.Worksheet sht)      {       //return template type as string based on contents of worksheet      }           public void validate()      {       foreach(Tuple<string,string,string> cellAction in cellActions)       {        //check the contents of the cell in the vSheet property according to cellAction's rules       }      }     }      } Is this a case where Strategy Pattern would be appropriate? There are several different types of sheets, each with a different list of cells and rules for those cells, so maybe it would be right to think about each template as a strategy to be implemented as a class. Or is this not a situation where the pattern applies, given that each of the 3 validation action types is always the same regardless of which template it's applied in?


Visualizing temperature levels across a city

I have a list of temperature levels (0 - 30 degrees) in different parts of a city. I would like to visualize the different temperature levels in the different parts of the city. Hot places should be displayed in red and cold ones blue. If the user zoom out he will get the avarage temperature color of the city and if zoomed in he will get the average color of the temperate color of that place. I think that what I need is referred to as _heatmaps_. Is that the correct? I am not too expert in visualization techniques and would appreciate explanatory pseudocode to illustrate the internal workings and main building blocks for heatmap algorithms, and how I could handle the zooming.


What Types of Stories Should Be In a Sprint Review?

This is sort of a follow-up to my previous question Should We Quit Trying to Do Agile if QA Takes 12 Weeks? For the second time in as many sprints, we've set a sprint review that is scheduled to feature just a single issue that essentially amounts to an obscure bug fix or at most an esoteric enhancement to some small portion of our product. The only real stakeholders for this issue are the single developer and the customer who opened the issue. It seems to me that given these parameters, we are probably better off just not doing a sprint review. Is there a general consensus on what types of stories should be discussed during a sprint review and what should be left out, or should everything be fair game? We haven't been doing retrospectives at all unfortunately, so unless that changes, that reason is kind of out as a reason to go ahead with the review.


Testing Data : Should I Create a bogus test case?

I've written an Integration program that produces files from a source set of data and converts it to a target data file. These files contain field/record information that must be validated by our clients using their validation methods. I plan to create numerous test cases and expect to receive information on how well the data validated so I can tweak my program. I want to create a test case that I know will not pass their validation, however I need to know if their validation methods are picking up basics such as the file structure and layout. I am trying to prevent the situation if all my test cases pass, but later on the files were not in the correct format the client needed. Do you feel this is a good idea and would I get any valid information from it?


Why is there no service-oriented language?

**Edit:** To avoid further confusion: I am _not_ talking about web services and such. I am talking about structuring applications internally, it's not about how computers communicate. It's about programming languages, compilers and how the imperative programming paradigm is extended. **Original:** In the imperative programming field, we saw two paradigms in the past 20 years (or more): object-oriented (OO), and service-oriented (SO) aka. component- based (CB). Both paradigms extend the imperative programming paradigm by introducing their own notion of modules. OO calls them objects (and classes) and lets them encapsulates both data (fields) and procedures (methods) together. SO, in contrast, separates data (records, beans, ...) from code (components, services). However, only OO has programming languages which natively support its paradigm: Smalltalk, C++, Java and all other JVM-compatibles, C# and all other .NET-compatibles, Python etc. SO has no such native language. It only comes into existence on top of procedural languages or OO languages: COM/DCOM (binary, C, C++), CORBA, EJB, Spring, Guice (all Java), ... These SO frameworks clearly suffer from the missing native language support of their concepts.   * They start using OO classes to represent services and records. This leads to designs where there is a clear distinction between classes that have methods only (services) and those that have fields only (records). Inheritance between services or records is then simulated by inheritance of classes. Technically, its not kept so strictly but in general programmers are adviced to make classes to play only one of the two roles.   * They use additional, external languages to represent the missing parts: IDL's, XML configurations, Annotations in Java code, or even embedded DSL like in Guice. This is especially needed, but not limited to, since the composition of services is not part of the service code itself. In OO, objects create other objects so there is no need for such facilities but for SO there is because services don't instantiate or configure other services.   * They establish an inner-platform effect on top of OO (early EJB, CORBA) where the programmer has to write all the code that is needed to "drive" SO. Classes represent only a part of the nature of a service and lots of classes have to be written to form a service together. All that boiler plate is necessary because there is no SO compiler which would do it for the programmer. This is just like some people did it in C for OO when there was no C++. You just pass the record which holds the data of the object as a first parameter to the procedure which is the method. In a OO language this parameter is implicit and the compiler produces all the code that we need for virtual functions etc. For SO, this is clearly missing.   * Especially the newer frameworks extensively use AOP or introspection to add the missing parts to a OO language. This doesn't bring the necessary language expressiveness but avoids the boiler platform code described in the previous point.   * Some frameworks use code generation to produce the boiler plate code. Configuration files in XML or annotations in OO code is the source of information for this. Not all of the phenomena that I mentioned above can be attributed to SO but I hope it clearly shows that there is a need for a SO language. Since this paradigm is so popular: why isn't there one? Or maybe there are some academic ones but at least the industry doesn't use one.


Web Application Licensing - Open Source vs Proprietary

I am developing a web application based on a proprietary (but free) JavaScript API. My company is considering releasing our application as "Open Source", but we are unsure of the different licensing options and how they will work considering we are using a third-party proprietary API. Can anyone help me with the following questions?   1. If we cannot release the third-party API as open source, can we release the code that we have written as open source?   2. Are we, as the original developers, held to the same license that we release our code with? For instance, if we release our code under a "copy-left" license like GPL, would that restrict us from building on the original code base and releasing it in another product that is not open source?   3. What is the best resource for learning the difference among all the different license types? I looked at opensource.org, which listed all the licenses, but I have trouble understanding all the legalese of the licenses themselves.


Get income on a free app, offline?

I have an Android app which I added adMob ads to. They only work though when the user is online. Now the problem is, the app is specially made for offline use, so pretty much nobody will ever get to see one. The app is free to download, but I would still like to make a few cents out of it. It currently has around 300, which I guess will look at it about twice per workday. Any help on how to make some money with this free, offline app?


4x as much work as I can actually do, what now?

I work for a web development firm and currently have 9 projects in the programming phase waiting for me to do them, and deadlines are flying past quickly without the projects getting done in time. We have two designers who are underworked and just me as a developer. My boss keeps piling on the work and I don't know what to do, and they aren't happy I'm missing deadlines. Any ideas that don't involve me working a lot of unpaid overtime?


What exactly is "Binary Form"?

I am asking in the context of the licenses on code that one sees all over the place. Typically, they say something along the lines of "if you release a product containing this in binary form, it must contain X, Y, and Z." Does that mean that if I use the code in an app, the app has to have a screen somewhere that contains X, Y, and Z in human-readable form?


Is TDD viable in collaborative open source projects

Let's say I wanted to start an open source project that I hope/expect to have many people submit patches and whatnot. Is it viable to take a strict TDD approach? Can/should I expect/trust collaborators to write quality tests whenever they submit a patch? One thing I've been thinking about is writing test suites for individual bug reports and feature requests and requiring that all patches/pull requests make the tests pass, but at that point it seems like it would be better just to write the feature/bugfix myself. As far as I can tell, most of the major open source projects that use TDD (or at least write tests) seem to be mostly written purely by an individual or team, where it's easy to enforce practices such as TDD.


Detecting travel patterns in geospatial data

I need to analyze data uploaded from vehicle GPS devices to detect travel patterns and then attempt to learn about the normal travel patterns for that vehicle so that predictions can be made about maintenance, refueling etc. Some vehicles are domestic (exhibiting normal home->work->home travel patterns) and some are commercial with scheduled routing. I have loaded the GPS lats and longs to a database, and then constructed an ST_LineString with the data points for each vehicle (approx 1k points per vehicle per day). Vehicles will never have identical travel patterns (GPS accuracy, irregular ping times etc) and the patterns will be visible as subsets of pings - for example a one hour commute between point A (home) and point B (work) between 8am and 9.30am each morning, Mon-Fri. Now the difficult part - I am considering the options. I have to write this in a database procedural language using the usual toolbox of procedures, cursors, iteration etc. I could use Python if it is helpful - I'm a database guy trying to think laterally and spatially. A travel pattern could be identified by (i) a similar sequence of points that can differ by a tolerance (say +/- 300 meters) (ii) parking locations - if a car is parked at the same location for 8 hours a day (iii) temporal- the vehicle starts at trip at 0830 every day, +/- 10 minutes. I am planning to write a procedure that checks for each of these patterns for each point (or set of n points) by comparing it with all other points (or set of points) by iterating through the pings for each day in sequence. The easiest use case is to find recurrences of a vehicle parked at the same place each day. Detecting similar movement patterns is more complex. What could be a technique for this?


As a soon-to-be-grad, will my skills and/or career suffer if I join a startup where I'll be the (equal) senior-most developer?

**tl;dr** : I'm a grad, worried about not learning a lot and improving my skills if I join a startup where I won't have senior devs mentoring and helping me. I do have other offers. I'm in my final year of study, and I'm lucky enough to be in a course where all students do a final-year project with real-world commercial clients. So since March, 5 of my good friends and I have been building a system for a startup which is currently seeking funding, and planning to launch early next year. I should note that the product is not finished yet, and without it there is no business. We have already been told that, assuming they get the funding they're after, they want to bring all of us on-board ASAP, to continue building this thing. The reasons are obvious: we're all familiar with both the client and the product, and we're cheaper than more experienced devs. **If they get enough of us to sign on, we'll be the only developers involved.** So my question: **ignoring all of the usual startup issues of job security, pay, and all that** , I'm concerned about the issue of my continuing education and improvement as a programmer. I'm pretty confident in my skills, and most of what I know I taught myself rather than learnt in the classroom, because I'm passionate about coding, but I'm not so foolish to think that any grad doesn't have a hell of a lot left to learn. I already have a couple of offers from other larger companies, where I know that I'll be working under developers with a lot of experience, who hopefully can and will teach and mentor me, and I'm conscious of stagnating this early in my career by being at a company where it's only me and other grads, and **no one with 10+ years of experience to tell me when I'm totally wrong.** Is this an issue? Or can I learn just as much on my own if I'm really committed to it?


What are the benefits to a dev team for taking on an intern for the summer?

My Dev team is entertaining the idea of taking on a summer intern or two. It's clear the benefits the intern gets out of such an engagement, but what benefits would the Dev team hosting the intern for a couple of months benefit? Does anyone have first hand insight into this?


When to use PHP or ASP.NET?

I have worked extensively in developing web applications using PHP and ASP.NET, but one of the questions that I'm constantly asked by customers is whether to move forward with a php website or an asp.net website. So naturally the first thing that comes to mind is to answer the question like this: > PHP is open-source and ASP.NET is from Microsoft. Usually after something like that is said the customer has a blank look on there face. Apparently the fact that one is open source and the other isn't doesn't really faze them. And for good reason, because when I first heard it, it really doesn't tell me much. I know from working with both that each have their differences when it comes to developing websites. My question is what are differences between ASP.NET and PHP as far as   1. Features   2. Security   3. Extendability   4. Frameworks   5. Average Development Time I am trying to compile a list of facts to be able to compare with the customer so that an informed choice on the appropriate development platform can be made.


Building software with version numbers

This is not a question about how to number versions. We have an application with a certain version numbering scheme. We also have a Jenkins CI server (soon to be replaced with Atlassian's Bamboo) that regularly builds our software. The application displays the version number, so it's written in one of the files in our code base. We don't want to manually change the version number before releasing a version. Our current solution is that we have a Jenkins job that changes the version number in our code base, commits it, tags the repository with the version number, pushes it and then packages the application for distribution. The problem with that is that we have to decide to release a version before the build succeeds or fails. What we want to do is this: have Jenkins regularly build our product and run the unit tests. Afterwards, we want to select a passing build and release it with a certain version number. In summary, this is the process I want:   * Jenkins builds and tests our product regularly.   * When we want to release a version, we can select the last passing build from Jenkins and check to release it.   * The resulting release should include the version number.   * The commit that was built and released should be tagged with the release number. What is the best practice for releasing product versions? Is there a process that will meet my demands?


Git commit not finished but can't continue on that machine

So I was wondering what is the typical way that people handle working on a project with git and getting to a point where the work you have done is not committed and not in a form that should be committed but you won't be able to work on it at that location anymore? Is the best thing to do just to transfer your working tree files over to a new location and continue work then commit and wipe the working tree and pull the changes, or is there some git utility that I do not know about that would allow me to do something like a soft commit, or something where I didn't have to alter the history when the commit is ready.


Desktop client server application, limiting text area field compromise with customers

We have a textarea field in a desktop client server application which in the end stores all the data in a database server, this text area is used to take notes and similar text areas have been put throughout our application as a marketing choice so that users can never blame the application for missing some fields and the marketing department can always answer "put it in the notes field". Recently however we realised some customers use the notes area heavily to write letters or copy paste documents, so we had to increase the notes field in the database from 1024 to 10240, we are realising however that this way the desktop application takes always more time to download all this backlog of information. What is the compromise between giving practically no limit to user input length and letting the users use it as they deem necessary and putting a strict limit justifying the choice as "performance mandated"?


Organizing solution / project structure and classes for Line of Business Application (LOB)

The question how-do-you-organize-your-projects already has a few good answers. I would like to get a better understanding about this suggested structure:               MyApp.Core     MyApp.Model     MyApp.Presenter     MyApp.Persistence     MyApp.UI     MyApp.Validation     MyApp.Report     MyApp.Web      Assuming `MyApp` is a winforms rich client to administer students, courses, rooms and teachers Lets say i have a winforms user control to edit course information (name of the course, who teaches it, in which room and which students did register for the course). The class below reflects all the information i need for the user control               public class CourseDetails{         public int Id{ get; set;}         public Course Course{ get; set;}         public Teacher Teacher{get; set;}         public Room Room{get; set;}         public List<Student> StudentList{get; set;}     }      Where would you put this class? ### Methods of MyApp.Model I would like to know how complex or simple the classes inside the namespace `MyApp.Model` shoud be. Should the project `MyApp.Model` only contain very simple classes like               public class Course{         public int CourseId{ get; set;}         public string CourseName{ get; set;}         public int CategoryId {get; private set;}          }     public class Teacher{         public int TeacherId{ get; set;}         public string TeacherName{ get; set;}     }      or should `MyApp.Model` contain also   * complex classes like `CourseDetails`   * additional methods for each class like `Save()` or `GetById()` ? ### Additional topics Where (in which project) should interfaces be implemented and where should base classe be used. When should this additional methods (`Save()`, `GetById()`) be inherited from a base class or be contained in the class which implents an interface that has all the methods for saving and selecting.               public class CourseDetails: ModelBase{         ...     }          public class ModelBase{         public bool Save() {             Console.WriteLine("do something clever to save each entity");             return true;         }     }      Sorry for not beeing more clear; I would like to understand what kind of things (classes, interfaces, ressources, etc) should be put in which project and why. I hope you get the idea.


how to process document state transition?

Imagine there is an _application_ (`ASP.NET MVC`) that processes some documents. The `document` must be revised several times by _different group of users_. state/role rules:   * **simple user** can only **publish** document; (priority: **low** )   * **userGroup1** can switch it to **next state** or **reject** it; (priority: **higher** )   * **userGroup2** can **confirm** previous state and switch it to **next gradual** state or **reject** it; (priority: **highest** )     1. How to implement such a workflow in `ASP.NET MVC`? How to impelement `UI`, `views` so that group with lower priority can both visually/technically perform only `allowed transitions`? Can I somehow extend that system: link?     2. Do I need extras like service bus, event sourcing for that? ![enter image description here](http://i.stack.imgur.com/WoeKR.png)


Use a partial in a partial?

I'm a Rails newbie, so bear with me. I have a few places, some pages, some partials that use:               <%= link_to "delete", post, method: :delete,                                      data: { confirm: "You sure?" },                                      title: post.content %>      Would it make sense to make this a partial since it is used repeatedly, sometimes in other partials too? Is it o.k. to put partials in partials?


Would Python be too slow for client-side use in Browsers?

I've heard the statement that Python would be too slow to be of any use in browsers. I reckon Javascript is only superior in this aspect because of companies like Google who need it fast (and made it fast) because they need it to survive, but I could be wrong. Are there any differences in how Python and Javascript are designed that have an impact on how they (would) perform in browsers? Since as of now there isn't a client side Python implementation, my question comes from the statement someone made, so maybe it has something to do with the languages itself (although I don’t believe that).


Python programming patterns and practices?

What are the best python programming patterns and practices you are using every day? I don't mean only design patterns (there are lot of OO design patterns that can be used in python), I mean pure coding patterns and practices like:   * the best way to organize modules   * the best way for data parsing (performance wise)   * usage of private functions (does this make sense, because you can access private functions outside the class)   * what are the best modules for GUI, database etc.  Are there any new books or other kind of literature on this matter (2010/2011)? Of course question can not be answered in one answer or one book, I thought of this question like a discussion on this matter because there is not really much written about python programming patterns and it is a very powerful language.


How do employers measure "strong or solid knowledge of programming language"?

Yesterday I had received a great job opportunity. In requirements section I had seen the words:   * solid knowledge of python;   * solid knowledge of java;   * good technical background; Could you give me an answer, what does it mean? How to test my current knowledge? What type of measure will be actually accepted by employer?


Is it okay to call exception-triggered debugging "post-mortem debugging"?

I heard the term "post-mortem debugging", and Wikipedia says it's debugging done after the program has crashed. I often debug Python apps using a debugger that stops execution once an important-enough exception has been raised. Then I can use the debug probe to investigate. Does this count as "post-mortem debugging"? Because the program doesn't really crash. **EDIT:** If the answer is no, then what name would you use for the kind of debugging that I described?


What deters developers from using automated refactoring tools?

I was having a discussion with my colleagues about using the automated refactoring tools in IDEs (Eclipse, NetBeans, IntelliJ, Xcode, Visual Studio, etc) and was _surprised_ that many of them were uncomfortable using such tools. One of them is a seasoned developer (Smalltalk, C/C++, Java, Javascript) for 20 years and he seldom uses an IDE and _even_ when he does, he doesn't use the automated refactoring tools. He does a lot of refactorings, but he does them **all** by hand. Personally, I rely a lot on refactoring tools. Whenever I work on a project, I try to pick an IDE that supports automated refactorings and use those refactorings whenever possible. I am interested in finding out if professional developers here at Stack Exchange use automated refactoring tools. And, if you don't, why not? To get things started, here are some reasons why my colleagues don't use the automated refactoring tools:   1. _Trust_ \- Sometimes they don't trust what the tool is doing especially if it is a complex refactoring like Pull-Up which might affect multiple files; they are worried that the tool might introduce subtle bugs.   2. _Discoverability_ \- Sometimes they don't even realize that such a refactoring is available in the IDE because it is not immediately obvious   3. _Flexibility_ \- Sometimes the tool is too rigid and they always feel like they have to configure it too much to get it to work the way they want. **Updated - summary** Based on the responses so far, I think I can summarize three things:   1. Developers don't have the time to try out all the different refactorings available. And because they can't try them out, they are suspicious of what they will do to the code (all the corner cases). This suspicion is warranted for production code under time pressure (even if you have tests to check). Perhaps better UI tools can alleviate this.   2. Developers have also been frustrated by the limitations of the refactoring tools especially when they use metaprogramming/reflection or have external files (xml, configuration, properties). Automated refactoring tools keep on improving but there will always be limitations. Sometimes the limitations are acceptable and other times they are not. I've spoken to several other colleagues and some of them are more tolerant of the limitations. For instance, if rename refactoring doesn't rename all the files but does a good job of renaming 90% of it, they are still happy to use the tool and fix up the remaining 10% by hand because it still _saves_ time and effort.   3. [In my opinion from what I have gathered], developers feel that refactoring tools are _nice-to-have_ features so if it doesn't work the first time (or does something unacceptable), they seem to be more incline to abandon them and make changes by hand. Compare this to other tools like compilers/debuggers which also have limitations and bugs. Developers are likely to stick with them despite their limitations because they are _essential_ features that you can't just abandon in your workflow. Thanks for all the responses. If this topic is of interest to more people, I suggest turning it into a Community Wiki. It would be interesting to find out whether the size of the project, the availability of tests, the maturity of the IDE affect people's decision to use automated refactoring tools.


Why are SQL databases still used with ORM?

ORMs and persistence ignorance make perfect sense: if I am programming in a language, then I want to use the language's native implementation of objects and data structures to drive my program. I shouldn't need to worry about SQL or a database, and I always thought that inline SQL strings in a program was very cumbersome. Why is SQL still used as a backend? Why doesn't the ORM just persist objects to XML or a binary file(s) and avoid all the overheads and difficulties of administering a database server?


How to choose an agile methodology?

I'm working in a little firm about 10 developpers, we are working a kind of agile way but knowledgeless and without formalism. I think be aware of what are agile method, what can they afford to us, may render more productive our products. However there is a lot of agile method, which could be the simplest to "learn"?   * Rapid Application Development   * Dynamic systems development method   * Scrum   * Feature Driven Development   * Extreme programming    * Adaptive software development   * Test Driven Development   * Crystal clear


Big table with referential integrity or field typification?

I'm using an ORM (Propel) and PHP to create Objects and store them in a database. So, I'm facing a recurrent problem and I'm pretty sure this happened to someone before. My data model looks something like this: ![Strategy pattern situation](http://i.stack.imgur.com/UsMIc.jpg) So class A needs a reference to something from the hierarchy of `Clase Parent` (abstract class), this is not the problem. The idea behind this solutions is that in the future it would be very easy to create new strategies. But remember I said I'm using an ORM to store info in the database? Well, the database has 3 tables: `A_table`, `B_table` and `C_table`. So here comes the situation: `A_table` needs to be related to the strategy. Whats the best way to go?   1. Create a strategy type reference table, assosiate a type to the A_table and have a relation_id thats just an intenger with a value (no referential integrity whatsoever)   2. Create one field per strategy in the A_table, and allow them to be null Really looking forward for opinions and why its best one or the other.


Any ideas about puzzles and recruitment with Coderloop?

Does anybody have any experience with Coderloop? It is supposed to be community of developers solving programming puzzles, and they use that information to help companies recruit. Has anybody been hired through them?


What are the differences between Castle Monorail 3 over ASP.Net MVC?

I have been using Castle Monorail for some years now with great success, although I haven't bothered to update the version I'm using (2 or 3 year old). Now I'm making a decision on go to ASP.Net MVC 3 or update to the latest Castle version. I have been looking documentation on the newest version of Castle projects (specially Monorail), but there is really little or no info around (I may be wrong). Does someone knows what are the differences between Castle Monorail version 3 over ASP.Net MVC3? Thanks!


Commenting/In-Code Documentation Styles

This might be a stupid question, but it's been in the back of my head for a while and I can't find a decent answer anywhere else. I have a teacher who says we should explicitly list each parameter with a description, even if there's only one. This leads to a lot of repetition:               double MyFunction(const int MyParam);     // Function: MyFunction     // Summary: Does stuff with MyParam.     // Input: int MyParam - The number to do stuff with.     // Output: MyParam with stuff done to it.      When writing in-code documentation, how detailed are you?


What management/development practices do you change when a team of 1-3 developers grows to 10+?

My team built a website for a client several years ago. The site taffic has been growing very quickly and our client has been asking us to grow our team to fill their maintenance and feature request needs. We started with a small number of developers, and our team has grown - now we're in the double digits. What management/development changes are the most beneficial when team grows from small "garage-size" team to 10+ developers?


Am I making the right decision to take Information technology/system as my course in college?

I am a student who just ended my high school last year. I will be entering college any time between march to August. And.. I am thinking of studying Information technology/System as my course in college. The problem is, I am unsure if this is the right path for me. I don't know if this is what I really want for my future later on! Yes, I do love learning more about computers (prefer software to hardware). But what if I don't find them interesting later on when studying? I'm worried about that as I don't wanna regret later on. To add to that, my knowledge of programming and other software development is actually quite low. Can someone advise me on what should I do? Or tell me more about Information technology (what will I study later on in college and the career path)?


Communication between state machines with hidden transitions

The question emerged for me in embedded programming but I think it can be applied to quite a number of general networking situations e.g. when a communication partner fails. Assume we have an application logic (a program) running on a computer and a gadget connected to that computer via e.g. a serial interface like RS232. The gadget has a red/green/blue LED and a button which disables the LED. The LEDs color can be driven by software commands over the serial interface and the state (red/green/blue/off) is read back and causes a reaction in the application logic. Asynchronous behaviour of the application logic with regard to the LED color down to a certain delay (depending on the execution cycle of the application) is tolerated. What we essentially have is a resource (the LED) which can not be reserved and handled atomically by software because the (organic) user can at any time press the button to interfere/break the software attempt to switch the LED color. Stripping this example from its physical outfit I dare to say that we have two communicating state machines A (application logic) and G (gadget) where G executes state changes unbeknownst to A (and also the other way round, but this is not significant in our example) and only A can be modified at a reasonable price. A needs to see the reaction and state of G in one piece of information which may be (slightly) outdated but not inconsistent with respect to the short time window when this information was generated on the side of G. What I am looking for is a concise method to handle such a situation in embedded software (i.e. no layer/framework like CORBA etc. available). A programming technique which is able to map the complete behaviour of both participants on classical interfaces of a classical programming language (C in this case). To complicate matters (or rather, to generalize), a simple high frequency communication cycle of A to G and back (IOW: A is rapidly polling G) is out of focus because of technical restrictions (delay of serial com, A not always active, etc.). What I currently see as a general solution is:   * the application logic A as one thread of execution    * an adapter object (proxy) PG (presenting G inside the computer), together with the serial driver as another thread   * a communication object between the two (A and PG) which is transactionally safe to exchange  The two execution contexts (threads) on the computer may be multi-core or just interrupt driven or tasks in an RTOS. The com object contains the following data:   * suspected state (written by A): effectively a member of the power set of states in G (in our case: red, green, blue, off, red_or_green, red_or_blue, red_or_off...etc.)   * command data (written by A): test_if_off, switch_to_red, switch_to_green, switch_to_blue   * operation status (written by PG): operation_pending, success, wrong_state, link_broken   * new state (written by PG): red, green, blue, off The idea of the com object is that A writes whichever (set of) state it thinks G is in, together with a command. (Example: suspected state="red_or_green", command: "switch_to_blue") Notice that the commands issued by A will not work if the user has switched off the LED and A needs to know this. PG will pick up such a com object and try to send the command to G, receive its answer (or a timeout) and set the operation status and new state accordingly. A will take back the oject once it is no longer at operation_pending and can react to the outcome. The com object could be separated of course (into two objects, one for each direction) but I think it is convenient in nearly all instances to have the command close to the result. I would like to have major flaws pointed out or hear an entirely different view on such a situation.


what is the term for the class in the bottom of a class hierarchy?

You have a class hierarchy: D extends C which extends B which extends A, for example. A would be the top class, but how about D? I am looking for a short and concise way of describing the position of D within the hierarchy Is it the most specific class? the deepest class in the hierarchy? the last subclass? final class? The class might or might not be final (java) or sealed (c#). what matters is that it is the last one of the hierarchy at a particular moment. If a newer class (E) appears that extends D then the proposed term would apply to it. Also, there might be more than one class that fit this description (both D and E extends C), the term should apply to both classes.


Would a statically typed alternative to JavaScript on webpages be practical?

Preference for dynamic and static typing is largely a matter of taste, and different people find them more or less suitable in different situations. My question is, would it be technically possible to have a statically-typed alternative to JavaScript for client-side web page augmentation etc.?


Drop in service for account management, authentication, identity?

I'm building an Android app and associated set of web services for uploading/downloading data. I need a basic (no frills) solution for account management (register, login, logout, verify credentials/token). What open source / third party solutions exist for this scenario? I need:   * create a new account db based on a salt   * simple web service to create a new account   * simple web service to authenticate supplied credentials and return some sort of token That's it, I can get by without 'fancy' email activation or password reset for the time being. And then moving beyond simple account management, I will need some sort of 'token' based authentication for a web service. Are there off-the-shelf components for this? Should I just use a 'blank' django or rails app to get this done? Seems crazy for everyone to be doing CREATE TABLE user_accounts ... Thoughts? Thank you.


Why does Go have a special case for abs(0)

I was playing around with Go, and found this particular interesting code for the abs function in the math package: http://golang.org/src/pkg/math/abs.go               14 func abs(x float64) float64 {     15      switch {     16      case x < 0:     17          return -x     18      case x == 0:     19          return 0 // return correctly abs(-0)     20      }     21      return x     22  }      Why do we need to have the special case of x == 0? What will happen if I delete line 18 and 19?


Test planning for an Agile sprint

Can anyone offer any tips or experience on developing a test plan for an Agile sprint? Most of the time our team simply creates a "Test Feature X" task and goes about writing ad-hoc test cases. There typically isn't much strategic forethought put into how features will be tested and how we'll communicate the expectations and results to the rest of the development team and our users. Is it common to just write high-level testing tasks without making the actual test cases transparent to the development team? What sort of methodologies have you used when developing a test plan and what does it look like both at the beginning of a sprint and at the end? Any advice or tips on what comprises an effective and transparent test plan as well as a means of developing the test plan would be much appreciated.