title: Scrum decision making versus maintainability and development time?

text: I appreciate that this question may be controversial. In a sense, it is the flip-side of the question "Business trying to make technical decisions". In Scrum, the development team is supposed to be collectively responsible for making design and technical and code-level decisions, to fulfill the customer requirements. There is a division of responsibility and power between the product owner, who defines and prioritises the stories by communicating with stakeholders, and the team, who decide _how_ to implement the stories. I think this is motivated by the belief that, since developers are intimately familiar with the code they have written so far, and all the information they have memorised or noted about the project, and they will face the consequences of poor decisions when they have to modify the code in future, they are best placed to make design decisions. And if in hindsight they realise they made a bad decision, it will be a very valuable learning experience for them, and they won't be able to blame management for what went wrong. In theory, I agree with all this. But (to kind of play devil's advocate) I can see several situations in which following this principle _to the letter_ could be a bad idea:   1. The development team are mostly either temporary contractors, are (unbenownst to others) intending to jump ship, or are going to be made redundant after shipping this project, or are going to move to another project and there is an _entirely separate_ team which will do "code maintenance". (A good example of this might be: a typical outsourced government computerisation project.) So, for any of these reasons, the team mostly aren't the people who will be doing the actual maintenance.   2. Or, the development team are _all_ inexperienced developers who don't really have a clear idea of the maintainability problems that can be caused by slipshod development practices or poor design decisions. While they have an incentive _in theory_ to do the right things, the incentive isn't working yet because they haven't been burned enough times (or they haven't acknowledged the connection between sloppy coding practices and getting burned).   3. The development team _like_ making big mistakes and working crazy hours to fix or work around them because (a) they are workaholics, (b) they like wasting time writing boilerplate code or using some bad old framework because it gives them a sense of job security, or (c) it makes them look like or feel like heroes.   4. The team like to endlessly bikeshed, or discuss endless different permutations of ideas, or add "internally-visible features" which are low-value, while the business really needs them to deliver value faster, and come on, good enough is good enough! There may be others in the organisation who could provide a variety of useful inputs into design and technical decisions: More experienced developers; Polyglot developers; Specialists, including DBAs (who may not necessarily be in the scrum team); Managers, who may be cynical and may have seen over- ambitious or wrong-headed architectures go awry too many times. But it's not just about getting input from people with valuable experience. More than this, isn't it fundamentally sometimes necessary for management (at any level) to be able to say "No, this way of implementing it would be a bad idea. Do it this way instead", or at least "No, you can try that later if there's time, but do it this simpler way initially"? It seems to me that Scrum is too idealistic in this respect. I know that this does happen, obviously, but to say that because of this interference "your organisation is not doing Scrum" suggests that "doing Scrum" is not desirable in such cases!


title: Distribution of Event Listeners in a Distributed Service Oriented Architecture

text: I have a service architecture composed of services that service common areas of the application. Examples of services would be:   * AccountService (manages client accounts in the system)   * BillingService (bills clients for products that are configured)   * UserService (manages user and groups under a given client)   * NotificationService (sends notifications via email/SMS/push/any method when certain events happen) I have an ActiveMQ cluster where I push events to act on...which leads to the question... Where is the right place to put a message listener that reacts to an event for the purposes of sending a notification? A simple example would be: "I want to notify the account owner via e-mail when a new user is added to their account." Should this listener be in NotificationService (which is intended to be highly generic), or in UserService (where the action is being performed), or in a separate service entirely which acts as a sort of router?


title: Futures/Monads vs Events

text: In an application framework when performance impact can be ignored (10-20 events per second at max),   **what is more maintainable and flexible to use as a preferred medium for communication between modules - Events or Futures/Promises/Monads**? It's often being said, that Events (pub/sub, mediator) allow loose-coupling and thus - more maintainable app... My experience deny this: once you have more that 20+ events - debugging becomes hard, and so is refactoring - because it is very hard to see: who, when and why uses what. Promises (I'm coding in Javascript) are much uglier and dumber, than Events. But: you can clearly see connections between function calls, so application logic becomes more straight-forward. What I'm afraid. though, is that Promises will bring more hard-coupling with them... p.s: the answer does not have to be based on JS, experience from other functional languages is much welcome.


title: Best Way to Present a Report with Code

text: I'm in a statistic course at Uni currently. We have to present reports on the findings along with the code we used. I'm wondering what is the best way to present this code in the reports. A separate page with a reference to the report or inline. Or something else? Thanks


title: Minimising little coding mistakes

text: I make a fair amount of small mistakes when I code (things such as getting an angle bracket to the wrong direction). It adds a fair amount of time to my coding because I have to debug several times and iron out the dinks. Have you got any advice on how to stop these mistakes creeping in?


title: Version control and personal configuration file

text: Our project uses a user-specific configuration file. This file is currently not in version control, since it is different for each user. The problem is, whenever a developer adds a new module that requires configuration, or changes the name of an existing modules, the other developers get errors because their private configuration files are not updated. To solve the problem, we thought of working with two configuration files: a default/global configuration file that will be in version control and will be updated regularly by each developer that adds a new module, and a private configuration file that will be kept out of version control and will contain only the user-specific changes. However, this still seems like an ad-hoc solution. Can you propose a better solution? What do the professionals do?


title: What to do after reading a beginner's book on C#?

text: I am 16 years old and want to get a job in the programming field in the future. Since I will be applying for a foreign university, I want to start programming by myself and gain experience, both to increase my chances for quality education and for later employment. Last year I learned Java, but whatever motivation I had mustered fizzled out after finishing the book, and I only did some basic work on a project I came up with by myself, before getting stuck and abandoning it. This year, I decided to learn C#. My Java knowledge, however small it may be, would help me pick up and remember more information from a beginner book, and since an year of inactivity without much prior experience warrants a reread anyway, I thought I might as well learn a different-yet-similar language, as opposed to just going through my HF Java for a second time. I picked up Herb Schildt's "C# 3.0 A Beginner's Guide" and finished it. However, I have no idea what to do now. Come up with a random project and work on it (potentially picking up something far beyond my limited ability)? Read up on more advanced topics (even though I don't have any practical experience)? I'm at a loss regarding what to do to actually become a capable programmer, after reading a beginner's book.


title: Is it possible to write a program that pipes the sound from one computer through the sound card of another?

text: I have a case where I need to use one computer's sound card to play sound but I want the sound to be generated at another computer that's on the same network as the other. Ideally the program that does this would only run on the computer that was generating the sound, though I'm fairly certain that isn't possible based on the research I have been doing. What ever I do with it though the solution would need to be such that the computer actually playing the sound would be secure. Thanks for any input.


title: What is Android's payment system like?

text: I've heard that Apple pays the developers in lump sums (I forget how often) for their app downloads. My question is does Google work the same way with Android? If not, how do they operate their payment system? Kind of a side question as well, but how do Apple and Google get you the money from other countries? Do they automatically convert it for you and take a cut for swapping the currency or is that your job?


title: Learning PHP OOP

text: I have been coding PHP for about 2 years now and I THINK that I have a very good grasps of the fundamental parts of PHP, i.e.   * Functions   * foreach/IF statements   * sessions/cookies   * POST/GET Amongst a few others. I want to move on to learning OOP PHP now, so learning how to use classes and making it a really valuable skill. I have 1 requirement, the source must be a respected source that doesn't teach developers bad habits. I have the book: PHP and MySQL Web Development However, as useful as that is I would like an online source. I would like to know from people with experience in OOP PHP, how and where did they learn OOP PHP. Obviously by doing, but I would really appreciate some great resources which help me along the way.


title: Rails: controllers vs models which should handle file manipulation

text: This post by Jamis Buck about keeping Rails controllers skinny has always stuck with me. I have an app in which a zip file consisting of an XML file and some images is uploaded and used to create the model (mostly from the xml file, which points to the images). Should all the code dealing with extracting the files from the zip and moving them to their appropriate place go in the controller or the model? thanks!


title: Does it make sense to have a single tab interface?

text: This is more a web design / user experience question, but since programmers.stackexchange.com is more opinion based, I posted this here - Does it make sense to have a single tab in a web app? I don't see any reason to have a tab if you can't tab to it from some other tab. My PM is demanding a single tab. I honestly think my PM is making horrible decisions regarding the design (we have no official designer) and eventually we will lose customers. The design of the application was made early 2000's and it shows (HTML tables, lots of inline css, etc). I am afraid that if we don't update it to match this decade's expectations of application, it will just turn off our potential customers. The application is an enterprise app that we sell to potential customers. We are a small company - our team for this application is 6 (3 developers, 2 qa (one being the pm), and one of the company's partners). Everyone's opinion matters (so I have been told), but if someone happens to disagree with the PM (who can do no wrong), she gets all huffy....and I am rambling. So my question remains - what are your thoughts on a single tab?


title: Is it better to document functions in the header file or the source file?

text: In languages that distinguish between a "source" and "header" file (mainly C and C++), is it better to document functions in the header file: _(pilfered fromCCAN)_               /**      * time_now - return the current time      *      * Example:      *  printf("Now is %lu seconds since epoch\n", (long)time_now().tv_sec);      */     struct timeval time_now(void);      or in the source file? _(pilfered from PostgreSQL)_               /*      * Convert a UTF-8 character to a Unicode code point.      * This is a one-character version of pg_utf2wchar_with_len.      *      * No error checks here, c must point to a long-enough string.      */     pg_wchar     utf8_to_unicode(const unsigned char *c)     {     ...      Note that some things are defined in the header only, such as structs, macros, and `static inline` functions. I'm only talking about things that are _declared_ in a header file and _defined_ in a source file. Here are some arguments I can think of. I am leaning toward documenting in the source file, so my "Pro-header" arguments may be somewhat weak. Pro-header:   * The user doesn't need the source code to see the documentation.      * The source may be inconvenient, or even impossible, to acquire.     * This keeps interface and implementation further apart. Pro-source:   * It makes the header a lot shorter, giving the reader a birds-eye view of the module as a whole.   * It pairs the documentation of a function with its implementation, making it easier to see that a function does what it says it does. When answering, please be wary of arguments based on what tools and "modern IDEs" can do. Examples:   * Pro-header: Code folding can help make commented headers more navigable by hiding the comments.   * Pro-source: cscope's `Find this global definition` feature takes you to the source file (where the _definition_ is) rather than the header file (where the _declaration_ is). I'm not saying don't make such arguments, but bear in mind that not everyone is as comfortable with the tools you use as you are.


title: License for freeware but closed source application

text: I have developed a simple application which I want to put release for free but I'm not planning releasing the source code. I want the application to be freely available but I do not want anyone to sell it or reverse engineer it. MIT License looks simple and nice but it also allows anyone to sell it. Is there any license out there suitable for me or should I just modify MIT License?


title: How to manage ratings system of my web app?

text: I am making a website where in users would rate posts by other users, according to how useful they are. The posts will be about products - mobiles, tablets, and other personal consumer electronics only. I want to make sure no trolling or slandering goes on, so I'll need a system that will make sure the good ratings of posts are genuine, and not just from people hired by those products' companies, or the bad ratings aren't from that product's company's competitors. I like the StackOverflow system of upvotes and downvotes. But that requires a lot of moderation, and frankly, I don't have the resources for that. I mean, the SO community has a lot of trusted mods, and admins, but in my site, in the beginning only me and my friend who are making this site would be the ones to trust, in order to keep only legit posts and legit ratings in our database, for the public to value from. EDIT 1: One solution I have in mind is, to include Facebook Like button as the only way to "upvote" a post. That way, leveraging the authenticity of users offered by Facebook (atleast to some extent), would benefit me. I'd count the number of likes and store them as upvotes for a particular post. There would be though, no downvotes. I'm thinking storing a ratio of "X users found it useful" as `Viewers that liked this post`/`Total number of viewers of that post`


title: Should the controller pass data to a view in the MVC pattern?

text: I work with ASP.NET MVC (and other web-based MVC implementations) quite often, but this is something I've never been sure of: Should controller and view communicate? Of course the controller should be choosing which view to use, but what I is mean should the controller be passing data to the view? In my opinion, if the view is expecting data from the controller, then they're effectively tied together as a (controller, view) pair. Instead, I usually have the view communicate with the model itself and be independent of any controller. Do I have the right approach, or is this a case of there being no one correct answer? Does the answer change when working in the web versus other environments? Does the answer change when you have the concept of a strongly- typed view (like in ASP.NET MVC) or not?


title: Subclass only have methods without variables

text: Is it ok to have subclass which does not declare its own variables (instance variables) and inherits from super class or base class? It has methods and there are some common methods which it overides but do not have variables of its own. Is it ok to have subclasses which defines behavior only or I am missing something? I want to divide in subclasses to separate logic of my classes. I have `Medication` class and I want to subclass to `DailyMedication` , `WeeklyMedication` but I have all my instance variable in `Medication` as I do not have any specific for these classes. I want to make subclasses to divide logic as I have too much if conditions in my code.               MedicationEntity     name     dose     weekdays    //in case of daily and monthly this is null      monthdays   //in case of weekly and daily this is null     frequencyType  //Daily or weekly or monthly     etc      EDIT: I want to make subclasses because these all classes have diffrent logic.I have enum of `frequency`(for Daily,Weekly etc) in my `Medication` class and this makes worse as i have to put all the checks in my code for these frequency type as if frequency is that than do that and if daily than do that as now i want to remove these switch conditions. 1)Also please suggest any good idea as weekdays is null if frequency is daily or monthly.But i need to send null to server.So where i can put weekdays if i subclass as it is not null only in case of weekly frequency but as i have to send null to server in request for all other frequencies.Should i put `weekdays` in subclass if yes than how i send null to server if frequency is daily as `DailyMedication` have no information about `weekdays`.


title: API method placement guidelines?

text: Are there any guidelines for placing methods in API when the placement isn't obvious? Example: I have classes `A` and `B` and a method `X`. The work being carried out can be phrased in two ways:   1. `A does X with B`   2. `B does X to A` Given the two ways of phrasing this, it's unclear whether `X` belongs in `A` or `B`. **Are there guidelines for placing the method in this scenario?** * * * For a more concrete example, consider think of a user (`A`), an event (`B`) and a sign-up action (`X`). A user can sign up to an event (`A does X with B` ), or an event can add a user to the sign-up list (`B does X to A`).


title: Property or Method to obtain information about a collection?

text: Suppose I have a `MyList` class which extends `ObservableCollection<MyObject>` where `MyObject` has the `Boolean` Property `Enabled`. Let's say I want the number of `MyObject` objects that have the Property `Enabled` equal to `true`. Should define this as a Property or a Method? In `MyList` class, should I use:               public int GetNumEnabledMyObjects(){         return this.Count(o => o.Enabled == true);     }      or               public int NumEnabledMyObjects {         get {             return this.Count(o => o.Enabled == true);         }     }      I looked at Properties vs. Methods in MSDN Design Guidelines and I'm leaning towards a method since it might be considered expensive enough.


title: Return interface or class

text: Suppose I have a method               public List<User> GetBatchOfUsers(IEnumerable<int> userIDs)     {         List<User> users = new List<User>();              // some database stuff              return users;     }      I have read that it would be better to return an interface (either `IList` or `IEnumerable`) as opposed to returning a `List`. Some arguments I have heard for doing so is that it hides data, and gives the API developer the flexibility of changing the internal representation of the data at a later date. My concern about just returning an `IEnumerable` is that you lose functionality, such as random access and the `Count` property. I know that accepting an `IEnumerable` as a parameter makes sense, as it gives the consumer the best flexibility to send data to my method, the minimalist set of requirements for the method to operate. What is the best practice for the return type?


title: Solutions to C# 5 async re-entrancy

text: So, something's been bugging me about the new async support in C# 5: The user presses a button which starts an async operation. The call returns immediately and the message pump starts running again - that's the whole point. So the user can press the button again - causing re-entrancy. What if this is a problem? In the demos I've seen, they disable the button before the `await` call and enable it again afterwards. This seems to me like a very fragile solution in a real-world app. Should we code some sort of state machine that specifies which controls must be disabled for a given set of running operations? Or is there a better way? I'm tempted to just show a modal dialog for the duration of the operation, but this feels a bit like using a sledgehammer. Anyone got any bright ideas, please? * * * EDIT: I think disabling the controls that shouldn't be used while an operation is running is fragile because I think it will quickly become complex when you have a window with many controls on it. I like to keep things simple because it reduces the chance of bugs, both during the initial coding and the subsequent maintenance. What if there is a collection of controls that should be disabled for a particular operation? And what if multiple operations are running concurrently?


title: What's the difference between WTFPL, CC0, and public domain?

text: What's the difference between WTFPL (NSFW text), CC0, and public domain? Are they essentially the same thing?


title: Patterns for maintenance login

text: Are there any reliable strategies to implement a login mechanism that will allow access to an application for maintenance purposes? Kind of like how some routers have a list of default logins that technicians can use. But the way routers do it is insecure, and I was wondering if there are better ways to implement this sort of access control. EDIT: Here's a possible solution I came up with. Generate a list of passwords for a given time window, say a month, with a different password for every day. This list would exist in the software in encrypted form. Maintenance technicians would have access to this list, and its use would be logged so we know when to block access should unauthorized personnel gets a copy of the list and use it to log in. Periodic updates would renew the application's password table.


title: Problem regarding DRY principle and Polymorphism

text: I have a class that is 99% identical to its counter part. Sample code goes below:               public abstract class BaseClass     {         void Method1() { }         void Method2() { }         void Method3() { }         public void MainMethod(List<Object1> listObject)         {             Method1();             Method2();             Method3();             Method4();         }              abstract internal void Method4();          }          public sealed class DerivedClass : BaseClass     {         internal override void Method4()         {             throw new NotImplementedException();         }     }          public class BaseClass2     {         void Method1() { }         void Method2() { }         void Method3() { }         public void MainMethod2(List<Object2> listObject)         {             Method1();             Method2();             Method3();         }          }      As You can see that BaseClass and BaseClass2 are almost identical with Method1 ... Method3. Is there a better alternative that can be used to minimize duplication of code. * * * I initially started this polymorphism as an encouraging stuff, I have over 11 derived classes on BaseClass, and because of the second implementation of MainMethod2, I am stuck with duplication of code. I just cannot think of any clever way to get out of it. * * * **Update:** So this question is potentially containing two parts: **1. How to avoid duplication of code?** I solved this by using Composition successfully as suggested by wonderful answers below. **2. How to avoidleaky abstractions?** With this I am still struggling...


title: Forcing users to use Javascript

text: This is more of a business / ethics type of question that incorporates programming principles. So I as a developer will be selling a database driven web application to a local college university. I am currently working on the program and I coming up across a couple issues that would be easily worked with using javascript. Now I know some people do not use javascript at all so I wanted to know would forcing the usage of javascript (for the user interface only not the sites functionality) be wrong in an ethical / professional / business aspect? - I can't really find much information on this. My way of thinking about it is, that since it is a intranet application that the college is actively wanting and understand the features that come with the application it shouldn't be a problem right? * * * I just want to state that currently the app is not intensively javascript, but a lot of things that would be "easier" with javascript or just make the UI look better are not there. I also want to stress that the functionality will be PHP based and not dependent on Jquery.


title: ASP.NET deployment code?

text: I have a question regarding uploading an asp.net website to a real web sever. What type of files will be uploaded is it ASP.NET files or is it assemblies? To be more clear if someone got an access to my ftp and downloaded all the files will he be able to edit those files?


When you write wrappers for APIs how do you handle usage errors? Do you assume that the user uses it right and write the wrapper such that it makes the call to the server and let the server return the error? Or do you check for the missing parameters and return an error? If yes, how do you convey the error? a string or an error code?


title: Technical reason of why you need to use Class::static_method() instead of Class->static_method() in PHP

text: I'd like to know if there's a technical reason of why PHP's designers decided to invoke a static method using `Class::static_method()` instead of `Class->static_method()` (like any other method). Does the syntax change reflect any technical requirement? I'm asking this because the syntax for every single other language I know to invoke a method is always the same, despite it being static or not.


title: How to deal with a teammate who rather has his design ideas over good ideas

text: We have a situation in our team in which one member prefers his own ideas no matter what problems it has. When confronted with issues about a specific design he made - this teammate can get very protective and does not see the problems. In a result, this is a serious Software design issue for our team, because in the end some of the teammate's design will fall through to the end-design, and it will damage our software. Should we confront the teammate about his overall behaviour? Should we go the boss and tell him we can't deal with it and it's hurting our design?


title: What services exist for finding someone specific to then run your own peer to peer software with?

text: If you give people peer to peer software (such as a web sockets application if the peer to peer part gets implemented, but could be anything) the first step for some kinds of applications is to find a specific person and try to connect with them. If neither of you has a URI (and knows what it is) you need a third party to handle finding each other and verifying your identities. After that the third party isn't needed because you go peer to peer. I could of course write that third party software and put it up on a website, but then I would have to write that third party software and put it up on a website (or a server that isn't a website if that's how I want to do it). Does anyone offer this service? Ideally as a website and of course ideally free.


title: DDD – A rookie’s unanswered questions

text: I’ve decided to use DDD in one of my pet projects to find out what the fuss is about! Let me start off by saying that this (DDD) is the way software SHOULD be written, I’ve seen some strange patterns and conventions but DDD is really the most natural way of writing code. Interesting points that I noted started with DDD:   * I can now dream about code without being reminded of constraints set upon us by databases Persisting data now takes the backseat when developing a complex system (This might come back to bite me)   * I feel a lot closer to the business and business problem at hand   * Discussions between you and the client is now done on their neutral ground   * Discussions between developers are in line with the code   * I learned to love refactoring (You better make peace with that right now) Question 1: Is an entity allowed to make repository calls? For instance, if you need to validate that a certain field is unique in the system, should you write a domain service or can the entity make a call to the repo? Question 2: What is the best practice for validating a new entity? Should you have a Validate() function, or can the validation be done in the constructor? Your thoughts on this?


title: Job interview for Trainee Programmer, how to increase chances of success?

text: I have my first programming job interview today (in a few hours!) and would like some advice.      **The job title is Trainee Programmer and it is for a secure printing company.** I have found a lot on the internet about programming interviews, but since this is a Trainee role I have no idea what to expect. I know that the company prefers Java and C#, and I have a little knowledge of them, but my main language is C++. **I would like:** * Some pointers on what to expect from this Trainee interview. * Tips on how to improve my chances.


title: Is the List interface a leaky abstraction?

text: If I have a variable containing a `List` it could contain objects of a lot of different types e.g. `ArrayList` or `LinkedList`. The difference between a `LinkedList` and an `ArrayList` is pretty big. The big O behavior of the methods differs greatly. For example sorting the `List` and then using it to do binary searches is perfectly ok for an `ArrayList` but would not make sense with a `LinkedList`.


title: When to use interfaces (unit testing, IoC?)

text: I suspect I've made a schoolboy error here, and am looking for clarification. A lot of the classes in my solution (C#) - dare I say the majority - I've ended up writing a corresponding interface for. E.g. an "ICalculator" interface and a "Calculator" class that implements it, even though I'm never likely to replace that calculator with a different implementation. Also, most of these classes reside in the same project as their dependencies - they really only need to be `internal`, but have ended up being `public` as a side- effect of implementing their respective interfaces. I think this practice of creating interfaces for everything stemmed from a few falsehoods:- 1) I originally thought that an interface was necessary to create unit test mocks (I'm using Moq), but I've since discovered that a class can be mocked if its members are `virtual`, and it has a parameterless constructor (correct me if I'm wrong). 2) I originally thought an interface was necessary to register a class with the IoC framework (Castle Windsor), e.g.               Container.Register(Component.For<ICalculator>().ImplementedBy<Calculator>()...      when in fact I could just register the concrete type against itself:               Container.Register(Component.For<Calculator>().ImplementedBy<Calculator>()...      3) Using interfaces, e.g. constructor parameters for dependency injection, results in "loose coupling". So have I gone mad with interfaces?! I'm aware of the scenarios where you would "normally" use an interface, e.g. exposing a public API, or for things like "pluggable" functionality. My solution has a small number of classes that fit such use cases, but I wonder if all the other interfaces are unnecessary, and should be removed? Regarding point 3) above, won't I be violating "loose coupling" if I was to do this? **Edit** :- I'm just having a play with Moq, and it seems to require methods to be _public_ and virtual, and have a _public_ parameterless constructor, in order to be able to mock them. So it looks like I can't have internal classes then?


title: Github Organization Repositories, Issues, Multiple Developers, and Forking - Best Workflow Practices

text: A weird title, yes, but I've got a bit of ground to cover I think. We have an organization account on github with private repositories. We want to use github's native issues/pull-requests features (pull requests are basically _exactly_ what we want as far as code reviews and feature discussions). We found the tool hub by defunkt which has a cool little feature of being able to convert an existing issue to a pull request, and automatically associate your current branch with it. I'm wondering if it is best practice to have each developer in the organization fork the organization's repository to do their feature work/bug fixes/etc. This seems like a pretty solid work flow (as, it's basically what _every_ open source project on github does) but we want to be sure that we can track issues and pull requests from ONE source, the organization's repository. So I have a few questions:   1. Is a fork-per-developer approach appropriate in this case? It seems like it could be a little overkill. I'm not sure that we need a fork for every developer, unless we introduce developers who don't have direct push access and need all their code reviewed. In which case, we would want to institute a policy like that, for those developers only. So, which is better? All developers in a single repository, or a fork for everyone?   2. Does anyone have experience with the hub tool, specifically the pull-request feature? If we do a fork-per-developer (or even for less-privileged devs) will the pull-request feature of hub operate on the pull requests from the upstream master repository (the organization's repository?) or does it have different behavior? **EDIT**   I did some testing with issues, forks, and pull requests and found that. If you create an issue on your organization's repository, then fork the repository from your organization to your own github account, do some changes, merge to your fork's master branch. When you try to run `hub -i <issue #>` you get an error, `User is not authorized to modify the issue`. So, apparently that work flow won't work.


title: If I release a program under GPL, do I have to continue to do so?

text: Consider this scenario:   * I am developing a program FooSuite that uses a GPL-licenced library QuuxTools   * I release the program FooSuite 1.0 under GPL Later on I discover that, for some reason, I need to licence the program to someone on different terms.   Hence:   * I remove the dependency on GPL via QuuxTools, by either...     * rewriting the program not to use this library any longer     * obtaining a different licence for QuuxTools (if it's dual-licenced; see PyQt)   * I release FooSuite 1.1 under a non-GPL licence. However, _FooSuite 1.1 is still a derivative work from FooSuite 1.0_. I understand that it's not legal for a stranger to do what I did, but am I myself - as the owner of FooSuite - free from this restriction?


title: Java editor/IDE for beginners?

text: I teach some beginners the fundamentals of Java these days and they need to see the output for their small programs such as Hello world, etc. I need basic editor that contains code highlighting and contains the compiler with it so they can quickly run and see the result of their programs. What would you recommend?


title: Translating variables into english

text: I have recently came across some code where the variable names are in french, I could not use google translate because only part of the code needs translated, and it would not be that practical to copy and paste each of the variables into the translator. How can i easily translate the variable names? what translator could i use? Here is some french that i tried to translate.               #include <stdio.h>          int main()     {         unsigned int nombre;         unsigned int diviseur;         unsigned int reste;              for (nombre = 2; nombre != 0; nombre++)         {             for (diviseur = 2, reste = 1; (diviseur < nombre) && (reste > 0); diviseur++)             {                 reste = nombre % diviseur;             }             if (reste > 0)             {                 printf("%d\n", nombre);             }         }              return;     }      But when i tried to translate the code using google translate i got this bad translation.               # include stdio.h          int main ()     {         unsigned int number;         unsigned int divisor;         unsigned int left;              for (count = 2, number = 0;! number + +)         {             for (divisor = 2, left = 1, (divisor <number) && (rest> 0) + + divider)             {                 remainder = number% divisor;             }             if (left> 0)             {                 printf ("% d \ n", count);             }         }              return;     }


title: to teach or not to teach GUI for beginners in CS

text: I have been teaching an OOP course for almost one year from now. The premise of the school is to use Java by using NetBeans for the programming part. I have seen the following scenarios:   * The students get overwhelmed by the amount of information about the different controls to use, so they lost focus on the programming paradigm taught (in our case OOP)   * They rely on their memory, mainly of the different Java GUI tools Is the best approach to teach the OOP topics by making use only of console and with little or no use of the Net Beans GUI? Could that help the students to focus more on the logic of the program and maybe to learn how to do quick tests? Thanks


title: Is it okay to add time for "unexpected delays" to a time estimate?

text: I've landed my first contract (hooray, self employment!) and the company is asking for time estimates. Programmers are notoriously bad at time estimates, and I know I've been laughably wrong before. It's fixed bid, so I'm not concerned about charging. I'm just concerned about expectation management. So far I've itemized the work I need to do, estimated the time it would take, then significantly padded that time. I'm still nervous about it, though. Is it acceptable to write in time for "unexpected delays"? I've estimated 4 weeks, and I'd like to add a 5th week for problems I haven't thought of. Is that something people do? Would you balk if someone gave you an estimate with that in it?


title: Memoization Memory

text: Memoization is definitely a powerful technique. But Dynamic Programming is slightly better IMO, since it does not involve the memory strain (in a recursive program, the parameters occupy memory and this memory increases as we go deeper into the recursion). But speed-wise, both are pretty equal. But definitely memoization is a lot more straight-forward than Dynamic Programming. My question: Is it somehow possible to use memoization without the memory constraint ?


title: How is machine learning incorporated into search engine design?

text: I am currently building a small in-house search engine based on Apache Lucene. Its purpose is simple - based on some keywords, it will suggest some articles written internally within our company. I am using a fairly standard TF-IDF scoring as a base metric and built my own scoring mechanism on top it. All of these seem to be working excellent except for some corner cases where the ranking seems messed up. So what I am planning on doing is to add a small Relevant/Not Relevant link to the search results page so that users can click on one of those depending on their perception of whether that result should have been included in the first place. # My Idea   1. Treat these Relevant/Not Relevant as labels and create a training data.    2. Use this data to train a classifier (such as SVM)   3. Incorporate this model into the search engine i.e., every new result will pass through the classifier and will be assigned a label on whether it is relevant or not. This approach seems intuitive to me but am not sure whether it will work in practice. I have two specific questions:   1. What all features should I extract?   2. Is there a better way to integrate the machine learning component into the search engine? My final goal is to "learn" the ranking function based on both business logic as well as user feedback.


title: Is more dependency inversion always better?

text: Is there any situation in industrial object-oriented programming when the dependency inversion principle should not be used?


title: What data should QR-Code contain to serve both my own and external QR-Code reader

text: My webapplication uses codes (in form of `http://www.url.com/code/105820582020204`), that I want to encode as QR-Code. I assume that such generated QR-Code will be scanned by both people using my mobile application (and bundled built-in QR-Code scanner) and by some 3rd party, external scanners. Exactly what data should I encode to support both of them -- code itself only or full URL? First scenario fails with external QR-Code reader. It will decode a QR-Code to just a long number and will get no idea, what it should do with such number. Only my own, mobile application QR-Code scanner will know, that it should exchange data with server, using decoded code. In second scenario, I assume that external QR-Code reader open up entire URL, so the whole thing will work as supposed, while my on, in-app QR-Code reader will extract code itself from the URL, and also be able to use it (just as in first scenario). So, second scenarion seems to be the only one to support both kinds of QR-Code readers. The problem is, that I read in this answer, that I shouldn't encode entire URLs in generated QR-Codes.


title: High Level Configuration of Constructor Injection in C++

text: My questions are specifically dealing with dependency injection through the constructor. I understand the pros/cons of service locator pattern, constructor/setter injection, and their flavors, however there is something I can't seem to get past after choosing pure constructor injection. After reading many materials for testable design, including a thorough perusing of Miško Hevery's blog (specifically this post) I'm at the following situation: Assume I'm writing a C++ program, and I have correctly injected my dependencies through their constructors. For readability I have given myself a high-level object which has a single Execute() function called from main:               int main(int argc, char* argv[]) {         MyAwesomeProgramObject object(argc, argv);         return object.Execute();     }      Execute()'s responsibility is to simply wire up all required objects and kick off the highest level object. The highest level object requires a couple dependencies and those objects required a few objects and so on and so on, implying a function that looks like this:               MyAwesomeProgramObject::Execute() {         DependencyOne one;         DependencyTwo two;         DependencyThree three;              MidLevelOne mid_one(one);         MidLevelTwo mid_two(two, three);              // ...              MidLevelN mid_n(mid_dependencyI, mid_dependencyJ, mid_dependencyK);              // ...              HighLevelObject1 high_one(mid_one, mid_n);         HighLevelObject2 high_two(mid_two);              ProgramObject object(high_one, high_two);         return object.Go();     }      From what I take from Miško's blog (and I would ask him, but figured he wouldn't have time to get back to me), this is the only way to satisfy pure constructor injection of dependencies. In the blog post mentioned, he states we should have factories on a per object lifetime level, but this is essentially what Execute is doing, making my code look identical to his example:               AuditRecord audit = new AuditRecord();     Database database = new Database(audit);     Captcha captcha = new Captcha();     Authenticator authenticator =         new Authenticator(database, captcha, audit);     LoginPage = new LoginPage(audit, authenticator);      ## Questions:   * Is this the standard approach?   * Is this a pattern that I'm not aware of (seems similar to Maven's context.xml)?   * For pure constructor injection, do I simply suffer the cost of "upfront" allocation?


title: Was there ever a serious push for partial classes in java

text: was there ever any serious attempt/demand to introduce C#-style partial classes to the java language? an abandoned JCP? a mailing-list flame-war? anything? or was this never even suggested?


title: Learning Smalltalk as a Java programmer

text: I am a Java programmer willing to learn smalltalk. As of now I am working within the Pharo environment. Trying to switch from Java to Smalltalk is being a bit of a headache, honestly. I would like to learn Smalltalk with the help of a code base available but I believe that there aren't many Smalltalk example projects available on the web. So are there any particular websites that involve learning Smalltalk (Pharo) based on some simple examples? Currently I am taking the help of Pharo By Example doc but I feel it is just not sufficient for me. I am looking for more some code examples in Smalltalk.


title: What are the advantages of having a built-in datatype in a data interchange format over not having it?

text: Due to the requirement of a project we had to develop a data interchange format with a built in data types. The format served the purpose well in the scope of that project. But I was thinking that does it have any advantages of having a built-in type system (int, long, bool, string etc.) in a more general scope of data interchanging? Take XML as an example. It has been serving the purpose very well, but if XML would have a built-in data type system (forget about dtd/xml schema), would that be of any extra advantage than its currently having? e.g, we generally use xml for serialization, during the operation if we would be able to store the datatype along with the data, would that be more helpful?


title: We need a DVS. They need an SVN repo. What should we do?

text: We are a team of two people who need a versioning system for their university project. Due to administration issues, the graders need us to register on a site that happens to only support SVN; however, we cannot commit to SVN from inside the university as the required protocols are filtered out by the proxy (including the HTML extensions that would make SVN checkins over HTTP possible). Sigh. Is it possible to have a hg repo for ourselves that can then be converted to SVN for purposes of hosting on this site? * * * **Please note that practically all students commute to university,** so the "we can't commit from university so we can't do this" is not as strong of an argument as you'd think.


title: Measuring risk of source code changes?

text: My manager asked me to write a estimation of work hours and a risk estimation of source code changes for a defined task. While the first is no problem for me and there are many resources on the web, I cannot get my head around the latter one. I already asked for a clearer description of risk estimation and got the answer that the risk for the need of "follow-up code changes due to the changes made" and "potential loss of stability of the overall software" should be stated. How can I approach this task (thumb rules, documents about risk estimation, ...)?


title: What are good Information System design resources?

text: After taking a class about information systems, I want to find additional resources for learning the various patterns, concepts, and examples of their implementation. The course did focus on Martin Fowler's Principles of Enterprise Application Architecture and had a project that attempted to implement some of them. Basically, where can I learn more about Information System design and implementation?


title: Algorithm to Select Sequential Subarrays from an Array

text: I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem. Let's say I have an array such as [1, 10, 250, 9, 8,8, 249, 249, 248, 247, 2, 4, 9, 10, 9, 7, 6] I need to find subarrays [6,7,8,9,10] [8,9,10] [247, 248, 249, 250] Subarrays should be min. 3 length size. I dont want a solution but a similar algorithm would help me refactor my code. I'm currently doing this with nested loops and using buffer collections.


title: What is the best way to prepare for CSDA-like certification exams?

text: I am interested in taking the IEEE CSDA exam. What are some of the better, individual strategies for learning software engineering practices in preparation for the exam?


title: Can rabbitmq client have its own exchange and queue in client environment itself?

text: Is that possible to create exchange and queue in client environment by the client? Below is the quote from http://blog.dtzq.com/2012/07/amqp-exchanges-and- rabbitmq.html > AMQP clients are free to create their own exchanges or use the predefined > defaults. Or exchange and queue can be only at the server where the broker is?


title: How does user confirmation box work?

text: How does the client know to send request to server only when the confirmation box result is ok and stay on page if cancelled? Also, is this mechanism any different in ASP.Net and ASP.Net MVC? I want to know the internal working of when user clicks OK/cancel what happens internally. How does browser come to know it has to proceed to server call or close itself and do nothing? What I have researched so far tells me, that on a web forms page, the Page.IsValid property is somehow responsible for browser to determine the outcome.Is it correct? Also what happens with MVC?


title: Open source: what is the definition of "derivative work" and how does it impact copy-left

text: I am a commercial software developer and I want to make use of open-source in my proprietary software. As I understand the concept of copy-left, it uses the original authors copyright to ensure that their ultimate end users (which would include my customers) are not deprived of benefits of the original work that the original authors of the OS components intended for them to have. I also understand that there is an incentive to produce more free software and I often find that sites that clarify and recommend various licensing terms are mixing the legalities with the ideology. All I am asking for is a clear picture. The people who want to create OS exclusively for other OS projects should be allowed to do so. The people who want to put code out there for anybody to use should be allowed to do so. Also, there are many claims which have no legal precedence and are not as clear cut as authors of OS interest sites would like them to be. And we all know that code is not just code. There is a difference between:   * Copying somebodys source code into your source code.   * Consuming a library compiled as-is from github.   * Consuming a library compiled from a locally altered version from github. Let's pretend that I use an open source library for accessing Excel spreadsheets. It makes sense that I would contribute back bugfixes/additions etc that had anything to do with the general problem of accessing excel spreadsheets. This is to make an excel plugin for an application that already accepts XML, SQL db etc as alternative input mechanisms for the same data. ** Does this mean that the application is considered "derivative" even when it does not expand into the problem domain of importing excel sheets? **


title: What makes Agile software development so appealing?

text: Agile software development is becoming a pretty fun buzzword these days. As a developer, I understand the pragmatic value of iterative development, but (most often) it isn't a developers choice to embrace an Agile approach to software development. It's a top-down management choice! Whether it is crystal, agile methods, dsdm, rup, xp, scrum, fdd, tdd, you name it. It's not a developer choice. For all the managers out there, **what are the biggest reasons for choosing to do Agile development** when (in my experience) most managers haven't even touched a piece of code in their life!


title: Why does it seem so hard for non programmers to understand versioning?

text: In the past I have worked with designers, BAs and project managers, all who regularly produce project artifacts, yet very really do they understand the concept of versioning. When I try to explain it to them (even in its most simple form of mulitple differently named files) they seem to have some kind of mental block. Why do you think this is?


title: Future-proofing myself when learning to program

text: I want to learn to program in a 'future-proof' manner, if you like. Whilst Windows dominates the desktop OS marketplace (for now), obviously there is a lot of value in learning its languages/frameworks/API's and so on - this might be subject to change as new devices emerge or Windows shoots itself in the foot (over-friendly previews of Windows 8 don't look too appealing...). Would I be right in thinking that having a solid knowledge of C/C++ for back- end logic/low level programming and the like, combined with an extremely portable language like Java for GUI's and so on, would be a good basis for software development that will prove useful on the most amount of systems? - I'm talking desktop PC's, tablets, phones.


title: Advantages to Multiple Methods over Switch

text: I received a code review from a senior developer today asking "By the way, what is your objection to dispatching functions by way of a switch statement?" I have read in many places about how pumping an argument through switch to call methods is bad OOP, not as extensible, etc. However, I can't really come up with a definitive answer for him. I would like to settle this for myself once and for all. Here are our competing code suggestions (php used as an example, but can apply more universally):               class Switch {        public function go($arg) {           switch ($arg) {              case "one":                 echo "one\n";              break;              case "two":                 echo "two\n";              break;              case "three":                 echo "three\n";              break;              default:                 throw new Exception("Unknown call: $arg");              break;           }        }     }          class Oop {        public function go_one() {           echo "one\n";        }        public function go_two() {           echo "two\n";        }        public function go_three() {           echo "three\n";        }        public function __call($_, $__) {           throw new Exception("Unknown call $_ with arguments: " . print_r($__, true));        }     }      Part of his argument was "It (switch method) has a much cleaner way of handling default cases than what you have in the generic __call() magic method." I disagree about the cleanliness and in fact prefer call, but I would like to hear what others have to say. Arguments I can come up with in support of `Oop` scheme:   * A bit cleaner in terms of the code you have to write (less, easier to read, less keywords to consider)   * Not all actions delegated to a single method. Not much difference in execution here, but at least the text is more compartmentalized.   * In the same vein, another method can be added anywhere in the class instead of a specific spot.   * Methods are namespaced, which is nice.   * Does not apply here, but consider a case where `Switch::go()` operated on a member rather than a parameter. You would have to change the member first, then call the method. For `Oop` you can call the methods independently at any time. Arguments I can come up with in support of `Switch` scheme:   * For the sake of argument, cleaner method of dealing with a default (unknown) request   * Seems less magical, which might make unfamiliar developers feel more comfortable Anyone have anything to add for either side? I'd like to have a good answer for him.


title: How do you structure computer science University notes?

text: I am completing a year of postgraduate study in CS next semester. I am finishing a law degree this year, and I will use this to briefly explain what I mean when I refer to the 'structure' of University notes. My preferred structure for authoring law notes:   * Word   * Two columns   * 0.5cm margins (top, right, bottom, middle, left)   * Body text (10pt, regular), 3 levels of headings (14/12/10pt, bold), 3 levels of bulleted lists   * Color A background for cases   * Color B background for legislation I find that it's crucial to have a good structure from the outset. My key advice to a law student would be to ensure styles allows cases and legislation to be easily identified from supporting text, and not to include too much detail regarding the facts of cases. More than 3 levels of headings is too deep. More than 3 levels of a bulleted list is too deep. In terms of CS, I am interested in similar advice; for example, any strategies that have been successfully employed regarding structure, and general advice regarding note taking. Has latex proved better than Word? Code would presumably need to be stylistically differentiated, and use a monospaced font - perhaps code could be written in TextMate so that it could be copied to retain syntax highlighting? (Are notes even that useful in a CS degree? I am tempted to simply use a textbook. They are crucial in law.) I understand that different people may employ varying techniques and that people will have personal preferences, however I am interested in what these different techniques are. **Update** Thank you for the responses so far. To clarify, I am not suggesting that the approach should be comparable to that I employ for law. I could have been clearer. The consensus so far seems to be - just learn it. Structure of notes/notes themselves are not generally relevant. This is what I was alluding to when I said I was just tempted to use a textbook. Re the comment that said textbooks are generally useless - I strongly disagree. Sure, perhaps the recommended textbook is useless. But if I'm going to learn a programming language, I will (1) identify what I believe to be the best textbook, and (2) read it. I was unsure if the combination of theory with code meant that lecture notes may be a more efficient way to study for an exam. I imagine that would depend on the subject. A subject specifically on a programming language, reading a textbook and coding would be my preferred approach. But I was unsure if, given a subject containing substantive theory that may not be covered in a single textbook, people may have preferences regarding note taking and structure.


title: How to handle or prevent all Admins and users being removed

text: I have a website that stores all users in a database. A user can log on to the website and if they have sufficient privileges can add/delete users, as well as change their privileges. How do I ensure there is always at least one Administrator (to create/edit/delete users) in the system or that an administrator can easily be added to the system. Surely I can put rules in place so that the Admin can't delete himself, or other rules like that. But what if someone deletes all the users in the SQL table. The passwords are hashed so it's not as if the DBA can just go in and add a new user with Admin rights. Do I hardcode some special username/password that automatically gets added to the system if no Admin exists?


title: How to handle "can you add just a few more fields" type of requests from customers?

text: Very commonly we have feature requests for fields that only one customer wants. This, at best, clutters the application's code. Often when we look in their database a few months after adding the fields, we can see that they are not actually even using the extra fields. Also, it's quite an old application so adding a single field requires multiple code changes, changing reports, and making sure that it doesn't affect other customers who do not need to see the field.   * How can we make sure that a customer actually needs these feature requests?    * How do we politely say "you don't really need that"? Currently we are beginning to charge for certain feature requests. (Previously, feature requests were free usually) Is there anything else we can do?


title: C++ Performance vs. Java/C#

text: My understanding is that C/C++ produces native code to run on a particular machine architecture. Conversely, languages like Java and C# run on top of a virtual machine which abstracts away the native architecture. Logically it would seem impossible for Java or C# to match the speed of C++ because of this intermediate step, however I've been told that the latest compilers ("hot spot") can attain this speed or even exceed it. Perhaps this is more of a compiler question than a language question, but can anyone explain in plain English how it is possible for one of these virtual machine languages to perform better than a native language?


title: What are good unit tests to cover the use case of rolling a die?

text: I'm trying to get to grips with unit testing. Say we have a die which can has a default number of sides equal to 6 (but can be 4, 5 sided etc.):               import random     class Die():         def __init__(self, sides=6):             self._sides = sides              def roll(self):             return random.randint(1, self._sides)      Would the following be valid/useful unit tests?   * test a roll in the range 1-6 for a 6 sided die   * test a roll of 0 for a 6 sided die   * test a roll of 7 for a 6 sided die   * test a roll in the range 1-3 for a 3 sided die   * test a roll of 0 for a 3 sided die   * test a roll of 4 for a 3 sided die I'm just thinking that these are a waste of time as the random module has been around for long enough but then i think if the random module gets updated (say i update my Python version) then at least i'm covered. Also, do I even need to test other variations of die rolls e.g. the 3 in this case, or is it good to cover another initialized die state?


title: Is HTML5 more secure to develop for than Silverlight?

text: I'm learning Silverlight, and I know that if I master it, I can apply the same concepts to WPF, which means I can do either web or desktop development pretty easily. But I've read articles and followed the discussion online, and I understand HTML5 is gaining traction for being cross-platform, and a lot of people seem to be moving to HTML5. From my understanding, any HTML5 application would be built with HTML and JavaScript (or Flash). But is it secure? It seems like anyone can easily use their browser's "view source" option and grab your code. Is this something I should be worried about, or is there a way to protect against it?


title: How should I manage a team with different skill levels?

text: I'll be working on a software project with some friends of mine, and I've been appointed technical lead. None of these guys is a bad programmer at all, but I do have significantly more experience than them. I need to be able to distribute the work among everyone on the team, while also making sure that we don't tread on one another's toes; that they meet the relatively high standards of quality and scalability that we need to make this project successful, without requiring me to review everything they commit. How should I maintain standards while avoiding micromanagement? Is it enough to make some diagrams, schedule some code reviews, and trust that I'll be able to fix anything that they might break, or should I go the TDD route and write explicit tests for the team to satisfy?


title: What is a reasonable number of threads for a Java program?

text: In Java (or probably most other languages targeting the JVM) what is a reasonable number of threads to use? Presumably, this will be expressed as a ratio to the number of cores/processors available, is that correct? At least initially, it seems like twice as many threads as cores might make sense, but 20+ times as many seems unreasonable. Is the ratio likely to be affected by the type and/or architecture of the software? Are there types of software and/or situations in which a much larger number of threads really makes sense? [And yes, I know that's phrased as a number of separate questions, but I think they're closely enough related for a single answer to cover all of them, since they're all really about how many threads make sense under what circumstances.]


title: How do you help your fellow programmers to grow?

text: As a team lead, how can you help your programmers to grow? The reason I ask this is because there are a few programmers working with me, and I really want to "turn them on the loose", to realize their maximum potential, and to keep them happy. But I don't quite know how to do this, do I have to   1. Interact with them frequently, or give them quiet time, leave them undisturbed?   2. Ask them to follow coding guidelines, such as enforcing unit tests, coding styles, or let them do whatever they see fit?   3. Be lenient with them. Such as don't really care whether they really come into office for 8 hours or 4 hours, or need to enforce some "disciplines" in the work place? Guess what, each positions have their own points, and different people would argue for different things. Such confusions make managing people indefinitely harder. What do you think?


title: How Do You Handle Non-Functional Work With Scrum in Embedded Systems?

text: I have two issues with scrum in embedded systems. First, there are many tasks to do, especially in the early stages, which are not demonstrable. We started with a dev board, no OS, no display, no serial comms, etc. We didn't have our display for 6 sprints. The first 4 sprints were:   * Getting the RTOS up and running    * Creating tasks Writing network and serial drivers   * Writing interrupt routines for buttons, comms, etc   * Writing the primary database classes and methods   * Writing a serial debug menu Most of these tasks are not well suited for user stories. In fact, the only interface into the whole system was the serial debug menu, built in sprint 3 so there was nothing to demonstrate at the end of the sprints. Even the serial menu was meant for internal use and not an end user. Never the less, I still want to track and manage these development activities via scrum. We ended up writing "user stories" phrases like, "As a developer...", which I'm not happy with but in using Target Process (www.targetprocess.com), there is no concept of a backlog item which is a task or chore. Second, how do you handle releases and testing? It's a real pain for us because the testers don't have the hardware debuggers so we have to build flash versions of the code and burn them on their dev boards to test. The testers are not technically as sharp as the developers and often require a lot of support in getting things working in the early stages (resetting the board, connecting the serial comms, etc), or even in understanding the output. Finally, regarding the definition of done, a sprint can't be complete until all stories are complete. All stories aren't complete until verified by the testers. There is no way to avoid "robbing" developer time to give to the testers. In other words, if the last 3 user stories in the sprint will take 5 days to test, they must be coded and unit tested 5 days before the end of the sprint. What's the developer supposed to do, stop working? I'm being facetious but it is a real problem trying to conform to the rules. Now, I'm fine with bending the rules but the issue I have is, it screws up all my burndown metrics if I can't mark things done until their tested. I'd love to hear how others have handled these situations.


title: What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?

text: I have been going through interview questions and I saw one which made me stop and think for a while. It starts with a quote and asks about your interpretation and whether you agree or not. "For infrastructure technology, C will be hard to displace." Dennis Ritchie From a bit of background reading you can find that he was the mastermind behind C language as well as the UNIX OS. At the time it was a phenomenal improvement and at the forefront of cutting edge techniques. I feel that C++ and Java are becoming increasingly popular languages, but C will always be an important language. What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future. On a side note, does anybody know which year this quote was made? I just want the opinions of people who use these languages a lot, I myself use python language and would love to learn a bit more about the framework around C and it's importance firsthand.


title: Can you get fired from a work-for-hire contract with no pay, and a lawsuit?

text: The story is like this: I was hired under a work-for-hire contract that didn't specify what the pay is going to be. I was told it would be on the 15th of every month, depending on what work was completed. On the 15th of the first month, I was told it was going to be at the end of the project. Then the project got halted (required client response on some matter). Then another project was given to me, one that would take at least two months to complete. Few weeks after that, I have told the boss that I will refuse to do any work until at least a partial payment is made. I got fired and got promised a lawsuit. We're in different countries. He's from US. Contract doesn't have his signature in original, in my country this would render it invalid. There are a few questions here, the main one is how to handle this from this point forward? Maybe you could give me some advice to avoid this in the future? Does this lawsuit have any chances to be taken seriously?


title: how do I write a functional specification quickly and efficiently

text: So I just read some fabulous articles by Joel on specs here. (Was written in 2000!!) I read all 4 parts, but **Im looking for** some methodical approaches to writing my specs. Im the only lonely dev, working on this fairly complicated app (or family of apps) for a very well known finance company. I've never made something this serious, I started out writing something like a bad spec, an overview of some sorts, and it has wasted a LOT of my time. Ive also made 3 mockup-kinda-thingies for my client so I have a good understanding of what they want. Also released a preview (a throw away working app with the most basic workflow), and Ive only written and tested some of the very core/base systems. I think the mistake Ive been making so far is not writing a detailed spec, so Im getting to it now. So the whole thing comprises of   * An MVC website (for admins & data viewing)   * 2 Silverlight modules (For 2 specific tasks)   * 1 Desktop Application Im totally short on time, resources and need to get this done quick, also, need to make sure these guys read it up equally quick and painlessly.   * So **how** do I go about it, **Im looking** for any tips, any real world stuff, how do you guys usually do it?   * Do you make a mock screenie of every dialog/form/page? Im thinking of making a dummy asp.net web forms project, then filling in **html** files in folders and making it look like my mvc url structure. Then having a section in the spec for the website and write up a page for every URL Ive got with a screenie. For my win forms app, Ive made somewhat of a demo Win Form project, **would I** then put in a dialog or stucture everything as I would in the real app and then screen shot it? * * * For some background into this question. I've always been a crazy jump-to-code kinda guy, which has worked ok, but for the app I'm working on, its not only complex, its for a very very reputed and large company and I have to get it right! (And it has been going well so far, today I gave a demo of the preview version which a lot of people liked!! =D ) If I do get the initial design right I will also have a great business with this company, there are already many thinking about new "awesome" features which they're ready to pay for.


title: How can I organize my implementation notes to use as a future reference?

text: How should I document my designing of the app better so that I avoid programming by coincidence? How can I structure notes so that it is clear how an app works so that when I refer to it a year later I'm not lost for the first 3 days?


title: Why does Java compiler decide whether you can call a method based on the "reference" type and not on actual "object" type?

text: I was just wondering why does Java compiler decide whether you can call a method based on the "reference" type and not on actual "object" type? To explain I would like to quote an example:               class A {         void methA() {             System.out.println("Method of Class A.");         }      }          class B extends A {         void methB() {             System.out.println("Method of Class B.");         }         public static void main(String arg[]) {             A ob = new B();             ob.methB();       // Compile Time Error         }     }      This will produce a Compile Time Error that method methB() not found in class A, although Object Reference "ob" contains an object of class B which consists of method methB(). Reason for this is that Java Compiler checks for the method in Class A (the reference type) not in Class B (the actual object type). So, I want to know whats the reason behind this. Why does Java Compiler looks for the method in Class A why not in Class B(the actual object type)?


title: What is a first class connector?

text: I was reading Towards Architecture-based Self-Healing Systems, and came upon the term `first-class connectors`. What are they? Searching some more finds this paper Systematic Construction of Software Architecture Supported by Enhanced First-Class Connectors, which looks like it might have an answer, and I might read it in detail later, but regardless, it would be useful to have the question up here with an answer shorter than that paper. :) An example of why having a connector being first class might also be relevant.


title: What is the best setup for distributing a PHP application?

text: What is a recommended setup in terms of source control, builds, testing, bug tracking, and deployment for a downloadable PHP application (a la Wordpress, phpBB, Magento, etc.)? As a developer working on the application, what would you expect? What about as a user of the application? Please describe a setup and workflow, as well as any resources you think might be relevant or helpful.


title: Why don't people use white space inside parentheses?

text: Clearly, this:               if( foo( 5, 6, 7 ))       do_something( arr[ 5 ]);      if more readable than:               if (foo(5, 6, 7))       do_something(arr[5])      yet very few people use whitespace inside their parens. The venerable **indent** program doesn't really provide useful options for this behavior (the option to include whitespace inside parens adds a space between consecutive occurrences, which is pretty hideous), and certainly some people will argue that it's a waste of horizontal space (but those same people would probably omit the spaces after the comma as well, so their opinion is clearly suspect), but surely there's some valid reason that this style is not more popular. Why don't you use any whitespace inside your parentheses and/or braces?


What are the real life use cases for tagged pointers? This is mostly coming from reading about small 64-bit systems and possible uses of 64-bit word pointers. To my understanding tagged pointers are addresses which can containing extra information in bits due to possible address space on that particular architecture is much smaller. But then, is it possible to use tagged pointers beyond trivial cases? Any cool ideas / examples? Are there popular libraries, frameworks taking advantage of 64-bit pointers via tagged pointers? Is that possible on every hardware?


title: When to use private methods in Python

text: I have a class, but every method in it should be private (apart form `__init__` and `__str__`). Should I denote every method with a double underscore, or is that deemed bad practice?


title: Mocking static methods

text: Having recently returned from a Test Driven Development (TDD) course I had the following thought. While writing unit tests using Mockito we came up against of the problem of mocking static methods. It was suggested by one developer we use PowerMock, which allows mocking of static methods, and then we got into a big discussion on how we should approach this problem. However, in my experience static methods should only really be used as utility type methods. The classic example in java being Math.random(). So a static method should only, execute one defined action regardless of any interaction with a class instance. If this is not the case, and you require class instance interaction, your method should not be static and you need to rethink your design. So my question is, with this in mind should you need to mock static methods at all? If they are always performing a simple action, then surely you should just call them as you would in real code.


title: How representative is Ohloh?

text: My colleague recently pointed me to Ohloh, a website providing statistics on FOSS based on versioning repositories. It's quite a fun procrastination tool, e.g. to compare programming languages by active projects: ![enter image description here](http://i.stack.imgur.com/ekEZT.png) Which makes me wonder: how representative is such a comparison? Can we draw conclusions from this such as "Javascript is the most used programming language in FOSS, followed closely by Python, Java and C++"? Or are there some big caveats to take into account?


title: PHP file_put_contents File Locking

text: **The Senario:** You have a file with a string (average sentence worth) on each line. For arguments sake lets say this file is 1Mb in size (thousands of lines). You have a script that reads the file, changes some of the strings within the document (not just appending but also removing and modifying some lines) and then overwrites all the data with the new data. **The Questions:**   1. Does 'the server' PHP, OS or httpd etc. already have systems in place to stop issues like this (reading/writing half way through a write)?   2. If it does, please explain how it works and give examples or links to relevant documentation.   3. If not, are there things I can enable or set-up, such as locking a file until a write is completed and making all other reads and/or writes fail until the previous script has finished writing? **My Assumptions and Other Information:**   1. The server in question is running PHP and Apache or Lighttpd.   2. If the script is called by one user and is halfway through writing to the file and another user reads the file at that exact moment. The user who reads it will not get the full document, as it hasn't been written yet. (If this assumption is wrong please correct me)   3. I'm only concerned with PHP writing and reading to a text file, and in particular, the functions "fopen"/"fwrite" and mainly "file_put_contents". I have looked at the "file_put_contents" documentation but have not found the level of detail or a good explanation of what the "LOCK_EX" flag is or does.   4. The scenario is an example of a worst case scenario where I would assume these issues are more likely to occur, due to the large size of the file and the way the data is edited. I want to learn more about these issues and don't want or need answers or comments such as "use mysql" or "why are you doing that" because I'm not doing that, I just want to learn about file read/writing with PHP and don't seem to be looking in the right places/documentation and yes I understand PHP is not the perfect language for working with files in this way.


title: How can I make the transition from being a beginner to an Intermediate/advanced level iPhone developer?

text: I've been programming for the iPhone for quite some time now. I have read books like Beginning iPhone 4 Development by Jeff LaMarche and Programming in Objective C by Stephen Kochan. Right now I am pretty comfortable with view controllers, table views, gestures, GCD, Core Data etc. I am now seeking to build a career in iOS (instead of a hobby as it has so far been). How can I take my knowledge to the next level so that I can be hired as a profesional iOS developer. What are the other technologies I must be familiar with in order to be comfortable building enterprise level applications for different industries like banking, telecommunications etc? Are there any good books that talk from the perspective of enterprise architecture for mobile applications ?


title: How can I work on my reverse-engineering skills?

text: I would like to start building up some software reverse engineering skills, and I'm looking for exercises or "challenges" to work on. Are there definitive or go-to sites, like Project Euler, specifically for reverse engineering? For example, exercises where I have to figure out why a program is crashing or behaving incorrectly.


title: Can non-IT people learn and take advantage of regular expressions?

text: Often times, not-IT people has to deal with massive text data, clean it, filter it, modify it. Often times normal office tools like Excel lack the tools to make complex search and replace operations on text. Could this people benefit from regexps ? Can regexp be taught to them ? Are regular expressions the exclusive domain of programmers and unix/linux technicians ? Can they be learned by non-IT people, given regexps are not a programming language? Is this a valid or achievable goal to make some users regexp-literate through appopriate training ? Have you have any experiences on this issue? and if so, have it been successful ?


title: How to wrap console utils in webserver

text: I have a big dataset (100Mbs/day) and a bunch of console a TCL/TK tools to view it - I want to turn it into a web app that I can build, and others can maintain. * * * In long: my group runs simulations yielding 100s of Mbs of data daily, in multiple (mostly but not only) text forms. We have a bunch of scripts and tools, mostly old school 1990's style stuff requiring a 5-button mouse, as well as lots of ad-hoc scripts that engineers build out of frustration every month or so. These produces UIs, graphs, spreadsheets (various sizes), logs, event histories etc. I want to replace (or at least supplement) the xwindows / console style UI with a web-based one, so I need the following properties:   * pleasant to program   * can wrap existing command-line tools in separate views (I don't need to scrape GUIs or anything)   * as I port logic from the existing scripts I can create a modularised and pleasant codebase to replace it   * I can attach a web-ui to navigate between views - each view is likely to contain keys which might make sense to view in another I am new to building systems that have logic on the back-end and front-end of a web-server. from that point of view, they do this:   * backend wraps old-school executables, constructs calls into them and them takes the output and wraps it up, niceifies it and delivers it to the web client. For instance the tool might generate a number of indexed images (per invocation) which I might deliver all at once or on-demand. May (probably) need to to heavy stats on some sources.   * frontend provides navigation connecting multiple views, performs requests from one view for data from another (or self to self), etc. Probably will have some views with a lot of interactivity. Can people please point me towards viable solutions for this? I know it's a bit of an open question so as answers come in I hope to refine the spec until we have a good match. I guess I expect to see answers like "RoR!" "beans!" "Scala!" but please give an indication of why those are a good fit; I know nothing! I'm not asking for _which is best, Scala or RoR*, but rather which have been a good fit for people doing what I'm trying to do? * * * I got bumped off SO for asking an open-ended question, so sorry if its OT here too (let me know). I take the policy that I use the best/closest matched language for a project but most of my team are extremely low level (ie pipeline stages and CDyn) so I don't have the peer group to know where to start.


title: Scrum for Embedded system devices

text: In our company, we are going to deliver a new product which will be used for mass notification, so it is an embedded software project and we are going to use the SCRUM as a framework for the product. We have started to write down the product backlog. Based on what I understood the product backlog should reflect a business value for each item. The nature of embedded software is that it has a lot of technical details that will consume a large amount of time to create drivers for microcontrollers, like the SPI, UART, ethernet, WIFI, so on. for example the System is sounding by playing message for notification, so it is pretty obvious that playing a message is a business value but to achieve this goal i have to write down the -requirements which are what also not how - for many drivers like the SPI, MP3 decoder chip driver, SD card driver and finally the FAT, so all of the previous drivers have requirements that should be written in the product backlog, such that the requirements started with a one business value requirement while it has a lot of technical sub- requirements. These don't reflect a business value for the client; can someone tell me how am I going to create my product backlog?


title: Why are there no package management systems for C and C++?

text: There are some programming languages for which exist their own package management systems:   * CTAN for TeX   * CPAN for Perl   * Pip & Eggs for Python   * Maven for Java   * cabal for Haskell   * Gems for Ruby Is there any other languages with such systems? **What about C and C++?** (that's the main question!) Why there are no such systems for them? And isn't creating packages for `yum`, `apt-get` or other general package management systems better?


title: Is the Adapter the correct design pattern for this situation?

text: I have an instance of a class `UntouchableClass` of which I need to access the member variables to use in my DotLiquid template. Problem is, `UntouchableClass` has to inherit from `Drop` if I want to use it in my template, but I can't change it since it is from an existing library. I've read about the Adapter pattern, but `UntouchableClass` does not have an interface from which to inherit the Adapter. Also, I can't use multiple inheritance (I would create a class which inherits from both `UntouchableClass` and `Drop` but this is C# and from what I know this isn't possible). Is there a design pattern that would suit this situation? Or is there a particular way to do this using DotLiquid?


title: Correct Seam for Stub

text: In Chapter 3 of his book The Art of Unit Testing: with Examples in C#, Roy Osherove illustrates the issue of undesirable external dependencies in code under test. He shows this with a method named `IsValidLogFileName` which takes in a filename string as an argument, reads in a config file from the local filesystem and checks whether the given filename extension exists in the config file. Here's what such a class would look like:                  public class LogAnalyzer         {             public bool IsValidLogFileName(string fileName)             {                      string [] extensions = System.IO.File.ReadAllLines(@"C:\Users\Public\ext.config");                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;             }         }      The issue here is that testing `IsValidLogFileName` has a dependency on the local filesystem. The author introduces the concept of **stubs** as a means of removing this dependency. In particular, he describes the following design: Create an interface:                   interface IExtensionManager         {             bool IsValid(string fileName);         }      an implementing production class:                   class FileExtensionManager : IExtensionManager         {             bool IsValid(string fileName)             {                 string [] extensions = System.IO.File.ReadAllLines(@"C:\Users\Public\ext.config");                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;             }         }      a stub:                   class FakeExtensionManager : IExtensionManager         {             bool IsValid(string fileName)             {                 string [] extensions = { "txt", "c", "cpp", "cs"};                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;             }         }      refactor `LogAnalyzer` as follows:                  public class LogAnalyzer         {             IExtensionManager em;                  public LogAnalyzer(IExtensionManager extensionManager)             {                 em = extensionManager;             }                  public bool IsValidLogFileName(string fileName)             {                 return em.IsValid(fileName);             }         }      run production code like this:                   LogAnalyzer la = new LogAnalyzer(new FileExtensionManager);      and test code like this:                   LogAnalyzer la = new LogAnalyzer(new FakeExtensionManager);      The part I don't understand is why we have to extract the validation logic from the original `IsValidLogFileName` by making an `ExtensionManager` interface. Wouldn't it make more sense to create something like a `ConfigManager` interface and refactor as follows: interface:                   interface IConfigManager         {             string [] GetFileExtensionConfig();         }      an implementing production class:                   class LocalConfigManager : IConfigManager         {             string [] GetFileExtensionConfig( )             {                 return System.IO.File.ReadAllLines(@"C:\Users\Public\ext.config");             }         }      a stub:                   class FakeConfigManager : IConfigManager         {             string [] GetFileExtensionConfig( )             {                 string [] extensions = { "txt", "c", "cpp", "cs"};                 return extensions;             }         }      refactor `LogAnalyzer` as follows:                  public class LogAnalyzer         {             IConfigManager cm;                  public LogAnalyzer(IConfigManager configManager)             {                 cm = configManager;             }                  public bool IsValidLogFileName(string fileName)             {                 string [] extensions = cm.GetFileExtensionConfig( );                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;         }      run production code like this:                   LogAnalyzer la = new LogAnalyzer(new LocalConfigManager);      and test code like this:                   LogAnalyzer la = new LogAnalyzer(new FakeConfigManager);


title: What's that rule where you aren't supposed to give visibility into an object called?

text: I forget the name of it but there's a rule that you aren't supposed to allow visibility into an objects inner makeup. It has to do with not allowing more than one dot in the implementation like this for example:               return world = foo.bar.hello.world();


title: Applications Architecture - fewer big systems vs more smaller systems

text: re: Applications Architecture, that is, " _the science and art of ensuring the suite of applications being used by an organization to create the composite application is scalable, reliable, available and manageable._ " When looking at a range of applications in an organisation, I can see various reasons for merging apps together, but sometimes also good reasons for keeping them separate. _In general_ , what are the pros and cons of having fewer big systems versus more smaller systems (bearing in mind that many of the systems will exchange information). I'm thinking things like: fewer, bigger apps means less plumbing between apps, but more smaller apps means more flexibility for individual departments. Is there any literature on this, or has anyone got a list of pros and cons that they've discovered? edit: In my scenario, a lot of the apps might be customisable off-the-shelf ones rather than in-house developed, but feel free to consider more general scenarios.


title: Establish connection between parent and child class

text: Assume you have two classes, a `Manager` who holds a set of `Client`s and the `Client` holds a backreference to the `Manager`.               class Manager {     public:         void addClient(Client* client) {             m_clients.push_back(client);             client->setManager(this);         }     private:         std::list<Client*> m_clients;     };          class Client {     public:         void setManager(Manager* manager) {             m_manager = manager;         }          private:         Manager* m_manager;     };      The confusing, probably even dangerous feature of this API is that Client exposes a setManager() method that can be called by anyone, yet should only be called by the Manager::addClient() method. `assert(manager->hasClient(this))` in setManager() would prevent wrong calling at runtime, however I would prefer a solution that doesn't allow the user to call methods he isn't supposed to call. What would be common solution? I don't   * want to use `friend` to expose all of Clients members to Manager so that he can establish the binary connection in `addChild()`   * want both classes to share some kind of Composite base class. They should remain unrelated inheritancewise.


title: c# naming - What are common conventions for a suffix to distinguish between read-only and writable interfaces

text: Assume an interface that allows queries on a spatial tree               public ISpatialTree     {         int FindChildIndex(Vector point);         bool IsLeaf { get; }         ICollection<ISpatialTree> Children { get; }     }      and another one that allows changing the tree:               public ISpatialTreeWriter : ISpatialTree     {         void Add(Vector point);         bool Remove(Vector point);         void Clear();     }      I am looking for a name to denote the writeable interface. Ideally it would be reasonably short and readable word. It's not only for this example, but I would like to use a convention for all code in the project because this is a common case. Does anyone know of a good convention for this problem? What conventions are used in other projects? Words that were discussed include Writer (ambiguous, often used in other contexts), Mutator (confusing), Rw (unreadable, not a word). A good solution would be a single word, not longer than 6-8 letters and that makes it obvious that this is the writer interface.


title: ruby-idiomatic hashes vs arrays

text: So I am still fairly new to ruby, though I have noticed that it is very hard to create 2d-array and that hashes seem to be more of the go to data structure than arrays. I was wondering why the Ruby community is so focused on Hashes and maybe if there is something more ruby-idiomatic than a 2d-array when trying to create something like a game board.