title: What do you do if you reach a design dead-end in evolutionary methods like Agile or XP?

text: As I was reading Martin Fowler's famous blog post Is Design Dead?, one of the striking impressions I got is that given the fact that in Agile Methodology and Extreme Programming, the design as well as programming is evolutionary, there are always points where things need to get refactored. It may be possible that when a programmer's level is good, and they understand design implications and don't make critical mistakes, the code continues to evolve. However, in a normal context, what is the ground reality in this context? In a normal day given some significant development goes into product, and when critical change occurs in requirement isn't it a constraint that how much ever we wish, fundamental design aspects cannot be modified? (without throwing away major part of the code). Is it not quite likely that one reaches _dead-end_ on any further possible improvement on design and requirements? I am not advocating any _non-Agile_ practice here, but I want to know from people who practice agile or iterative or evolutionary development methods, as for their real experiences. Have you ever reached such _dead-ends_? How have you managed to avoid it or escaped it? Or are there measures to ensure that design remains clean and flexible as it evolves?


title: Does the ActiveRecord pattern follow/encourage the SOLID design principles?

text: I'm interested in whether ActiveRecord pattern, made famous from Ruby on Rails, encourages or discourages the use of SOLID design principles. For example, it seems to me that ActiveRecord objects both contain domain logic, and persistence logic, which is a violation of Single Responsibility.


title: Jump into Android or learn Java basics first?

text: I am quite proficient in C and know some C++, but never touched Java. Recently I got an idea for an app which I think has potential, and I want to develop it. I am planning to go Android first, cause it doesn't require a mac/iPhone. So my question is: can I go straight to learning Android development, picking up the Java syntax as I go along and need it (after all I don't think it's much different from C/C++), or should I take a couple of weeks to learn the basics of Java first and then start with Android development?


title: What are Silverlight, WCF RIA services or applications?

text: I asked a question here on programmers yesterday about learning HTML & CSS and the community was pretty generous to provide great answers. One of the answers was given by Emmad Kareem and that was : "if you can't do HTML, don't give up. Consider using Silverlight". This answer made me visit Silverlight.net and I came across the terms WCF RIA Services, Silverlight applications. After going through the website and some articles on website i am unable to draw a conclusive understanding on what this is all about. Is this another way of building websites using .NET, and is just like another framework like ASP.NET MVC3. What scenario's and requirements are basically targeted to silverlight applications or we are free to use either of Asp.net MVC or Silverlight in any web-application requirements.


title: How do you look for programmers when your project's not in a particularly popular language?

text: So, we've got a product, written in Perl. Mind you, it's _good_ Perl, pretty well object-oriented, with a strong functional-programming influence, extensive test suites, and it's an agile environment doing Extreme Programming with elements of Scrum. We also have about 4 open headcount that we're trying to fill sooner rather than later, and we've historically had trouble filling even just one or two. I've been taking a look at the sort of candidates that our existing postings seem to be attracting, and they're not particularly impressive. Most of them have a background in QA automation or something similar. We know that we can take good OO software engineers who know Python or Ruby or even just C++/Java and bring them up to speed quickly enough. We're pretty good at being able to pitch the actual job itself to qualified candidates if we have their ear. What we're not good at, it seems, is attracting these people to our postings in the first place.   * What sort of things can we do to market ourselves to these engineers?   * What sort of things should we be careful to avoid in job postings and the like? (The posting is omitted since I don't want to get in any trouble by doing an end-run around the job-board. Also, our current in-house recruiter isn't helping much.... rumors are his days are numbered and I'm not at all surprised...)


title: What needs to be done to sell software to the government?

text: I'm making software that could be of use by businesses and the US Government, but I hear that dealing with the government is a huge hassle business-wise. Why do they have such a bad reputation among ISV's? How difficult is it to sell my software to them?


title: What's the key innovation in the realization of the "cloud?"

text: I'm trying to figure out what are the key technological innovations or inventions that the "cloud" introduces as an improvement over web pages; or maybe over SAAS. Seems to me that "cloud" is merely a new marketing word for technology that's been around for a while.


title: What is meant by "native support for a feature" in a programming language?

text: I went through a line somewhat like this "PHP has no native support for Unicode". Also i read that Python has native support for Unicode. Now you can call a function `utf8_encode()` in PHP to encode a string into Unicode and you can use a function `unicode()` in Python to convert a string to unicode. So what does it mean to support Unicode natively? _Also some languages have native support for concurrency while some dont have a native support._ So what is meant by > X language natively supports feature Y


title: What is a good strategy for decoupling a web service that uses ACORD XML messages?

text: I work for an insurance company and we're getting ready to use a new vendor tool for creating insurance illustrations. The tool has a web service that accepts an ACORD XML message. We want to put a web service in front of the vendor web service to abstract it away, but the complexity of the data model makes it hard. Our first method on the custom web service will probably just pass through an ACORD XML message to the vendor service and return the result. But, I'd like to have methods on our service that are more succinct. I'm not sure if that is possible yet as we're still doing analysis. Is there a way to create simpler data models for ACORD? The ACORD message is a TXLife 111. Edit: We are a mixed shop with .NET and Java, so I need to consider that Java clients might, at some point, be requesting illustrations through our .NET web service.


title: Should developers be responsible for tests other than unit tests, if so which ones are the most common?

text: I am currently working on a rather large project, and I have used JUnit and EasyMock to fairly extensively unit test functionality. I am now interested in what other types of testing I should worry about. As a developer is it my responsibility to worry about things like functional, or regression testing? Is there a good way to integrate these in a useable way in tools such as Maven/Ant/Gradle? Are these better suited for a Tester or BA? Are there other useful types of testing that I am missing?


title: How to implement Scrum in a company with three similar web-based products

text: I am somewhat familiar with the concepts and benefits of Scrum. With that in mind, I am trying to improve the failing Scrum product management structure of a company I'm now working for that has three separate B2C products, catering to the same demographic and accessible on the same website. Each product has a product owner and a unique development team (5 - 9 people in each) behind it. Given that the target audiences are similar (not sure if it should matter) and the 3 web products are similar in nature, what are the potential benefits/risks associated with merging the teams and having just one product owner/scrum master/dev team? Some questions that come to mind are: does it make sense to have 3 product owners and three distinct backlogs if your website has three distinct products? Also, if you only have one product owner, what is the best metric off which to choose who that will be?


title: Is it normal to feel like you forgot many things in language after a lapse?

text: I'm coming back to C++ after a month. I still didn't start practicing but seeing my old code gives me nauseous feeling like I'm seeing something new even with simple small code. Is this normal? Will I retain everything as I'll start writing code back?


title: Readability vs benefits of polymorphism

text: We are dealing with a lot of CRUD operations in our application. Each database table has one or more corresponding SQLContainer instances to perform various types of operations. All of these SQLContainers are stored in one helper class, so that you could perform any type of CRUD operation anywhere from the program (once you have the reference to that helper class). Now that the scale of the application is growing rapidly, this database helper class has also grown immensely (5+ KLOC). The growth of this helper class was impacted by the fact, that every SQLContainer has a seperate set of methods for performing the same operations, e.g. if you had to commit employeesContainer, you would call commitEmployeesContainer() and so only reading the method name gives a clear idea of the action. (You could call getEmployeesContainer().commit(), but we also perform some additional operations after commiting, like returing the status code of the commit which is almost the same for each container except for few containers) Now we are considering to add some polymorphism to this helper class and create general purpose methods, e.g. for committing records the commitContainer(getEmployeesContainer()) could be used, but such polymorphism will have no typesafety whatsoever and if some table will have few different containers you could accidentally pass a wrong container. One of the benefits is that you won't have to add new sets of methods when new SQLContainers will be added, and also modifications to the committing algorithm would be easier to adapt. **Question:**   Which approach would ease the maintenance whilst keeping the readability or is there an alternative solution for this type of problem?


title: Free/low-cost online resources to study for certifications

text: So I am interested in working towards are few specific certs. Namely Oracle 11g, MySQL, and Java. I know there are tons of books out there, and I do plan to hit up my local library on these subjects in the near future. However, I find myself wanting to get some digital info, and was wondering if anyone knows of a repository that would have pdf books on these subjects, or knows of a better way to pursue the knowledge. Seeing as how I don't have $3k a pop for the classes, I'm looking for ways to get my knowledge a little cheaper? Thanks for the help in advance.


title: What's a neat project to help me get used to the modern environment?

text: I haven't been programming for almost a decade. I used to be able to program in QBasic, Turbo Pascal, C, C++, Visual Basic and Assembly. I have no knowledge in any other programming language (other than HTML). I want a project (in _some_ programming language) to help me acquaint myself with the new environment (unix, python, perl, java, flash?) in a way that would give me the feeling that I've gained a mini-super-power. By that I mean something that give me the feeling of hacking (not actually learn about hacking, but just like learning C for the first time feels like hacking). Something that would put my programming skills to use in a way that the programming languages I do (did) know don't.


title: Why would you use data structures (ie Binary Trees, Linked Lists) in your jobs/side projects?

text: It seems to me that, for everyday use, more primitive data structures like arrays get the job done just as well as a binary tree would. My question is how common is to use these structures when writing code for projects at work or projects that you pursue in your free time? I understand the better insertion time/deletion time/sorting time for certain structures but would that really matter that much if you were working with a relatively small amount of data?


title: How is Agile different from XP?

text: I read few articles on web to find out how Agile, XP, Scrum, pair programming are different from each other / related to each other and I derived the following line:   1. Scrum and XP are almost same. XP has shorter period of releases than Scrum   2. Pair programming is employed in both Agile and XP methodologies But I was unable to identify how Agile is different from XP. More than providing a URL, I would be happy to read your experience and thoughts on this.


title: A possible loophole on the 3-Clause BSD license

text: In a license.txt file, this:                Part of this program uses the following clause           2. Redistributions in binary form must reproduce the above copyright       notice, this list of conditions and the following disclaimer in       the documentation and/or other materials provided with the distribution.      is definitely different from this:                2. Redistributions in binary form must reproduce the above copyright       notice, this list of conditions and the following disclaimer in       the documentation and/or other materials provided with the distribution.      When applying the second clause of a 3-clause BSD license without "Part of this program uses the following clause", does bundling the library mean that my created application has to be governed by the 3-clause BSD license also? E.g. my program should have no warranties, etc?


title: Lazy loading can lead to stale data, violates IoC?

text: Trying to be a better programmer I have an application that keeps track of Roles and Permissions, I had classes for Role and Permission which were just value objects.               class Role     {       int RoleID       string RoleName     }          class Permission     {       int PermissionID       string PermissionName     }      If I wanted to get the permissions for a Role I would do               List<Permission> permissions = PermissionDAL.GetPermissions(RoleID)      But for convenience (it's a Desktop application) I had to move the permission collection to the Role class so I could just do               permissions = roleInstance.GetPermissions();      and the Role class becomes               class Role     {       List<Permission> permissions = null;       int RoleID       string RoleName            public List<Permission> Permissions       {          get          {             if(permissions == null)                permissions = PermissionDAL.GetPermissions(this.RoleID);                  return permissions;          }       }     }      **Question 1** : the challenge - here is the scenario               Role r = getARole();        //for user to see     display(r.Permissions);              //user adding permission to role     RoleDAL.AddPermission(RoleID, PermissionID);             //display new permissions     display(r.Permissions);         //But no, data is not refreshed because of the null check.         //Do I need to call a new instance of this Role?      **Question 2** : I think this violate Inversion of Control? **Question 3** : How would you do an IoC for `List<Role>`, setting the permissions for each Role in the collection, if one were to use IoC. Thanks


title: java best practice to look for project essential files?

text: Usually when you do a new java project, there are several essential file such log4j properties file, other properties file and log file and you need to tell java where they are and where do you want to save the log file. I don't want to hardcode the absolute path to these file because I am putting the projects in different machines at different development stages. For example, I using Eclipse/PC in dev stage, Ant/Unix in UAT and Production machine. Here is my usual setup: Project: \--src \--build \--conf \--log \--output In my understanding, src and build directory are included in the classpath and could be read right away by `this.getClass().getClassLoader().getResource(".").getPath()` . However, there is not a logical method to locate the Project directory programmatically. If I could locate the Project directory programmatically, I could tell the program that the files are at ${Project}/conf and save the log file in ${Project}/log. Should I just use a shell script to define these variable before running the program?


title: How to replace inheritance with composition in this case?

text: I've recently read several articles about the advantages of the composition over inheritance. Their authors said that you can always replace inheritance with composition (to be precise, they say they don't know such situations where it can't be done). However, I can't think how to do this in the following case:               abstract class Reader     {         public Int32 ReadSum()         {             return this.ReadValue() + this.ReadValue();         }              public Int32 ReadSub()         {             return this.ReadValue() - this.ReadValue();         }              public Int32 ReadMul()         {             return this.ReadValue() * this.ReadValue();         }              public Int32 ReadDiv()         {             return this.ReadValue() / this.ReadValue();         }              public abstract Int32 ReadValue();     }          class RandomSource: Reader     {         public Int32 ReadValue()         {             return Math.RandomInt32();         }     }          class UserSource: Reader     {         public Int32 ReadValue()         {             return Console.ReadInt32();         }     }      Is this at all possible?


title: What is a good toy example to teach version control?

text: I am looking for practical examples to use when teaching version control. Breaking down the material to basic concepts and providing examples is an obvious way to teach version control, but this can be very boring, unless the examples are really practical or interesting. One idea I have is customizing a wordpress theme. I use wordpress a lot and no theme is ever perfect, so I typically just put the theme directory in version control using any dvcs and start recording changes. The problem with this example is that not many people in the audience may be familiar with wordpress, let alone have shell access to a wordpress site to try out the commands. Preparing a mock site and giving access to everyone is also not an option for me. I need a "toy example" that can be interesting to a broad audience of software developers, and something they can try on their own computers. The tutorial will use a dvcs, but the practical example I'm looking for is only to teach the basic features of version control, ignoring the distributed features for the moment. (Now that I think of it, instead of a mock site, a customized live cd might do the trick...) Any better ideas? **UPDATE** Thank you all. I ended up using textual data: dinner party planning with plain text files for guests, menu, invoices, and venue directions with images for some binary data. For teaching more advanced VCS features I later moved on to a collection of "hello world" implementations in different languages. Thanks again!


title: How do I know if the compiler broke my code and what do I do if it was the compiler?

text: Once in a while C++ code will not work when compiled with some level of optimization. It may be compiler doing optimization that breaks the code or it may be code containing undefined behavior which allows the compiler to do whatever it feels. Suppose I have some piece of code that breaks when compiled with higher optimizations level only. How do i know if it's the code or the compiler and what do I do if it's the compiler?


title: Dedicated graphics needed for developing 3D Android apps?

text: Intel 3000 graphics should be decent enough for developing 3D Android apps, correct? I mean, if the phone can handle it, so can onboard graphics?


title: How do we know to favour composition over generalisation is always the right choice?

text: Whether an object physically exists or not, we can choose to model it in different ways. We could arbitarily use generalisation or composition in many cases. However, the GoF principle of "favour composition over generalisation [sic]" guides us to use composition. So, when we model, for example, a line then we create a class that contains two members PointA and PointB of the type Point (composition) instead of extending Point (generalisation). This is just a simplified example of how we can arbitarily choose composition or inheritance to model, despite that objects are usually much more complex. How do we know that this is the right choice? It matters at least because there could be a ton of refactoring to do if it is wrong?


title: What language should an 11-year old start with to learn game programming?

text: I have a 11-year old son who wants to do game programming. I've started him on C++ (C++11) and he's learned iostreams, looping, functions, logic and flow control. I'm using the standard library and no memory management at all. But I would like to ask: What language would you suggest for a pre-teen (Python, ...)? What books would you suggest? We looked at one book that was just for console ASCII games. I liked the C++ that it taught but I think he'll get bored without some graphics at some point.


title: Arrow => in Perl

text: What does the `=>` mean in Perl?               my $CreateArray = [     objectClass => [ "top", "person", "organizationalPerson", "inetOrgPerson" ],     cn => "Jane User",     uid => "0000001",     sn => "User",     mail => "JaneUser@mycompany.com"     ];      produces               CreateArray:     0  'objectClass'     1  ARRAY(0x104ef40)       0  'top'       1  'person'       2  'organizationalPerson'       3  'inetOrgPerson'     2  'cn'     3  'Jane User'     4  'uid'     5  0000001     6  'sn'     7  'User'     8  'mail'     9  'JaneUser@mycompany.com'      It seems that even numbers are keys and odd numbers are values. Why don't they use hashes? Because they aren't ordered? Is there a name for this strange structure? Thank you.


title: Joda Time vs Java Time

text: Although Joda is feature rich and more sophisticated than standard Java time, it may not always be the best thing to use. How do I decide if I should use Joda Time or Java Time in any Java code? Is there some kind of guideline which tells us how to pick the right one depending on our requirements?


title: Build management: does this exist?

text: I want something that I haven't so far been able to find in anything but theoretical papers and books. If it doesn't exist I'm rather dumbfounded because it sounds like a lot of people use these kinds of systems and that they work very well. Maybe what I need is some sort of combination of things, I'm not sure. Here are my requirements for the system:   * Can hook into SVN to be triggered via checkin's.   * Can configure independent components as project "pipelines"      * I mean that a checkin to a component triggers that component to build, run unit tests, and spit out a distributable.   * Can configure components that depend on other components      * If I check in to component A and component B depends on component A, component B has its A dependency updated and rebuilds upon completion of component A.   * Uses native build processes like msbuild or make.      * I don't have to configure something totally new just for this.   * If a dependency fails the upstream components do not update it, but they will update other components that did not fail. That's the build server end. I want developer side integration as well.   * A new developer should be able to run a command that gets everything and builds it all for the first time.      * This would include all components for some given project.   * The same build, update, build process happens on a developer's machine.   * Use of any IDE All of the above is **automated**. My team currently has this but does almost everything by hand :( What I'm describing is described in many places including the book Continuous Delivery and the paper titled Continuous Release. The closest I seem to be able to find so far is Maven, but it doesn't seem to have the "can use native build system" feature (you tell it each file you want built and the compiler/linker....like an XML make file). It also seems very much geared toward Java and I want something language agnostic...in fact I want something that doesn't necessarily even build programs, it could be building anything that needs some form of compilation. So, how? What? Where? and How much?


title: Job title on Curriculum Vitae

text: Right now I'm preparing my CV. I think it's relevant to mention that I'm not native English speaker and my question is half-linguistic, half-programming related. I've been professionally hired as _software developer_ for nearly 5 years, some of the projects required designing small-scale applications architecture, I'm a MS in computer science. I have trouble figuring out how to call myself in professional light:   * a programmer   * a software developer   * a software engineer? Being translated all those notions have the same meaning in my mother's tongue, but I doubt, if they have a more specific usage. Can you help me figure out what's the difference between all three? Which one would you prefer the put in CV and why?


title: big gap in my resume - advice on getting back on the job market

text: My story in a nutshell: Some time after college, after many months of working on my portofolio and job hunting, I got a junior programming position in the games industry. But since I had to move to an expensive city in another country, my financial situation became quite terrible. Also I wasn't happy with the job itself. So, when after 1.5 year something unpleasant happened, I decided to leave, without securing next job. A day after I handed in my resignation, the news broke out about mass layoffs in the industry... I still managed to land a few interviews, but they were rather strange and not successful - it's like they weren't really interested in evaluating me. Also I got the impression that they suspected me of being fired (because I was already out of job) and therefore - not good enough. Since I wasn't happy about how the interviews were conducted and they were a big strain on my time and money, I gave up with job search. Over the last two years I had some non-development related, part-time jobs, that I would be ashamed to put on my resume. But I didn't give up on programming. I started a project, that turned out to be very difficult on many levels. Working on it got me burned out and depressed a few times, but I overcame everything and now I'm in beta phase. I believe I can monetize it, but I don't expect big income. Still, the experience made me think that I would rather have a "proper" career in a company and climb the ladder, than work for myself. I'm thinking about applying again for some positions, but I fear this may not be easy:   1. The HR people are very predictable. I'm sure they very much dislike 2 year gap on my resume.   2. The project that I have been working on, is quite unique. It takes very specific expertise to understand what problems I had to solve, how complex and laborious it gets, how many areas it spans. I fear the devs, who are going to interview me, will automatically assume it's something that they can complete in a 2 months time (I believed that too...), therefore - not impressive.   3. I do poorly in interview chats, both over the phone and face to face. Well, that is consistent with how bad I am at conversations in general life. Do you have any advice on what can I do to improve my chances of getting a job, under the circumstances? The thing that worries me most is the 2 year employment gap - is it a deal breaker?


title: Why "Fork me on GitHub"?

text: I understand how GitHub works, but one thing I've been confused about is, why almost every OSS project lately has a "Fork me on GitHub" link on their homepage. For example, http://jqtjs.com/, http://www.daviddurman.com/flexi-color-picker/, and others. Why is this so common? Is it that they want/need code validation, checking for security/performance improvements that they may not know how to do? Is it meant to show that this is a collaborative project - you're welcome to add improvements? Do they work for GitHub, or want to promote their service? Oddly enough, I don't think I've seen a "Fork project on Bitbucket" logo recently. My first reaction to that logo was that the project probably needs to be modified (forked) in order to integrate it with anything useful - or that they are encouraging fragmented codebase, encouraging everyone to make their own fork of the project. But I don't think that is the intent.


title: Accessing the same service more than twice in the nick of time

text: I have an application that will access interface service A which is to run from windows startup. This service is used by program B and my application functions on B's presence after getting a pointer to A. The scenario is translated as follows,               public interface A{}     ///my program     public class MyProgram     {         public MyProgram()         {           ProgramB.DoA();         }         public A GetA(){}     }          public class ProgramB     {        void DoA(){}     }      The translated source is not true, but that seems to be what I am looking for. In order to eliminate the overhead of allocating and realocating dynamic accesses to the same service used by other processes, would you please provide an actual solution to the problem ?(I am all out of any idea now)


title: Switching from ActionScript to JavaScript, tips for writing code?

text: I am quite comfortable with using actionscript3 and flash. I also have some experience with Java. But recently, I started learning JavaScript and node.js. I ultimately want to make a 3d game in threejs, but for now I simply want to make a chat application. I want to get into the habit of using JavaScript. Unfortunately, I am finding it very difficult to start using JavaScript. The difficulties I am facing are   * No suggestions for different methods and properties pop up, like they do in the Eclipse IDE and Flash Builder IDE. Like when you press dot after object, it shows all the methods and properties relating to that object and it becomes really easy to see what the parameters are and needed to be passed and stuff.   * How to organize code? In ActionScript3, I could simply make different classes in different packages. I could then import and use those classes in one main file. How does it work in JavaScript?   * Functions. I have seen people use anonymous functions in javascript. But I am compelled to write external functions as I am in the habit of it. What is better in JavaScript workflow? What do you advice?   * How is code executed within a HTML file? So if I have several `<script></script>` tags and I declare a variable in one of them, can the tags below it and above it access that variable?


title: Business Logic Layer in MVC Application

text: In my ASP MVC application I decided to add another Business Layer and made the model only to have properties. All other functionality like save to db, get from db is done on this new Business layer. So now the controller will be calling this business layer and model for various operations. Is it a good approach to design like this? I decided not to use model for this purpose because I would need a number of models for different actions. (for eg, one for edit and other for create)


title: Convention for using super class functions and members

text: Is there a Convention or common way for using super class functions and members? For example the super class has the function `protected void Foo()` and `protected int myInt;` In subclass would I want to refer to those simply as the `Foo()` and `myInt` or as `super.foo()` and `super.myInt` . Or some other way.


title: UserControl inside Placeholder good/bad? + Postback problem

text: Currently I'm working a bit with ASP.NET and trying to find the best way to navigate through pages. Right now I have an `UpdatePanel` which has a `Placeholder` inside it. This `Placeholder` will then add the `usercontrol` I need. I've been looking around on the internet and some say that this is a really bad thing to do, while others use it without trouble. Is this whole `UserControl` inside `Placeholder` inside `updatepanel` good/bad? While I've been trying to implement this I run into a problem with `postback`. When I click a button on my "Main page" to add a new `UserControl` to the `Placeholder`, the Page. `IsPostback` is of course the same on the `UserControl` and therefore it will always be true here. Am I doing something wrong or do I need to use a session variable to keep my `UserControlPostback` perhaps? I'm open to all options, just need to find the preferred way.


title: Why use link classes in oql instead of classes that contain links

text: itop abstracts its very complex database design with an object query language (oql). For this there are classes definded, like 'Ticket' and 'Server'. Now a Ticket usually is linked to a Server. In my naive way I would give the Ticket class an attribute 'affected_server_list', where I could reference the affected servers. itop does it different: neither Servers nor Tickets know of each other. Instead there is a class 'linkTicketToServer', which provides the link between the two. The first thing I noticed is that it makes oql queries more complex. So I wondered why they designed it this way. One thing that occured to me is that it allows for more flexiblity, in that I can add links without modifying the original classes. Is this allready why one would implement it this way, or are there other reasons for this kind of design?


title: MVC Best practices (view acquiring data directly from model) and Yii Framework

text: I'm using Yii for a few years and only right now I realized, that their demo application (empowered by CRUD auto-generation tool -- Gii) seems to be breaking key MVC architecture pattern. I'd like to discuss this here. As long as I've been using MVC (about four years), I was always told, that _view should not acquire data directly from model_. Every piece of text about MVC, I've read so far, was always underlining, that both view and models should be completely separate and the controller is the only element, that spins them together. If I need any model data in view (most often used mechanism) I should let my controller to retrieve it and feed view with it. Correct me, if I'm wrong, but finding this question and an answer to it makes me sure, that I'm right: while it is technically possible, it should be avoided. So, in terms of Yii, that would be:               $probes = Probes::model()->getAllProbesForCurrentUser;          $this->render('index', array     (         'probes'=>$probes     ))      (quite obvious, I think -- controller retrieves data from model and renders view, feeding it with that model) If all above is right, then how should I explain this:               <?php $this->widget('CGridView', array     (         'id'=>'users-grid',         'dataProvider'=>$model->search(),         'columns'=>array         (             'name',             'email',             'level'         )     )); ?>      (a widget placed **in view** acquires data _directly_ **from model** ) What am I missing?


title: What machine learning algorithm[s?] would be applicable here?

text: I have documents that contain an arbitrary amount of key/value fields. The value can be a primitive or a list. Completed documents all have an associated state (such as passed, failed, halted, etc.). Using completed documents as training data in a machine learning algorithm, my goal is to pass the system an incomplete document and determine the probable outcome. Is it more likely that the incomplete document I'm currently looking at will pass, fail or halt? The identifying information I'm looking to compare here consists mostly of unique keys. So a document could look something like:               id: 1     keys_of_type_x: [x1, x2, x3, ..]     keys_of_type_y: [y1, y2, y3, ..]     key_z: "sample text field"     etc.      I am not necessarily looking for a concrete answer, but more for a push in the right direction with information regarding what algorithm is best suited for this sort of multi-value based classification.


title: Equivalence partitioning understanding A<5 and B<5

text: I do not understand the following example. It says that a function X will be executed if either of A and B variables will be lower than 5. The go on and explains that there are three valid equivalence classes for inputs:               A<5, B<5     A=>5 B<5     B>=5 A<5      Why there is no class for A>5 and B>5? Is it because this would not be valid class? But why A<5 and B>5 is valid, is it because the function is still dependent on that?


title: Why is there both a short-circuit OR as well as unshort-circuited variation of that operator in C#?

text: Periodically, I wonder about this: The short-circuit OR would always return the same value that the unshort- circuited OR operator would? I expect that the short-circuit OR would always evaluate more quickly. So, was the unshort-circuited OR operator included in the C# language for consistency? What have I missed?


title: Testcase runner for parametrized testcases

text: Let me explain my situation. I'm planning a kind of test case runner for doing testcases on **external** devices, which are microcontroller based. Lets consider the devices:   * Device 1   * Device 2 There exist a lot of test cases which can be run with one of the devices above. For example:   * Testcase 1   * Testcase 2 The main reason that all the testcases can be run with any device is, that the testcases validates some standard and this software should be extensible for future devices. The testcases itself must be runnable with changing parameters. For example `Testcase 1` does some **Timing Verification** the testcase needs as input parameter the `datarate`: `4800`, `9600`, `19200`. Now hoping you understand the situation, let me explain my design questions. For implementing the test cases I thought about an `Attribute` based approach, like `nunit` does it. The more complicated problem is, how to define the parametrized testcases? Like this:               Device 1:        Testcase 1:            datarate: 4800, 9600, 19200        Testcase 2:            supply: 1, 2, 3          Device 2:        Testcase 1:            datarate: 9600, 19200, 38400        Testcase 2:            supply: 3, 4, 5      How would you design such a framework? I've done a similar desin in `python` where I had for every device a `XML` containing the testcase definitions like:               <Testcase="Testcase 1" datarate=4800/>     <Testcase="Testcase 1" datarate=9600/>     <Testcase="Testcase 1" datarate=19200/>


title: software architecture (OO design) refresher course

text: I am lead developer and team lead in a small RAD team. Deadlines are tight and we have to release often, which we do, and this is what keep the business happy. While we (the development team) are trying to maintain the quality of the code (clean and short methods), I can't help but notice that the overall quality of the OO design&architecture is getting worse over the time - the library we are working on is gradually reducing itself to a "bag of functions". Well, we try to use the design patterns, but since we don't really have much time for a design as such we are mostly using the creational ones. I have read Code Complete / Design Patterns (GOF & enterprise) / Progmatic Programmer / and many books from Effective XXX series. Should I re-read them again as I have read them a long time ago and forgotten quite a lot, or there are other / better OO design / software architeture books been published since then which I should definitely read? **Any ideas, recommendations on how can I get the situation under control and start improving the architecture. The way I see it - I will start improving the architectural / design quality of software components I am working on and then will start helping other team members once I find what is working for me.**


title: Best strategy for supporting multiple server communication from iPhone/android app?

text: I'm making an app that will be used in multiple hospitals in the US. As per `HIPAA` compliance requirement, every hospital will have its own server that complies with these requirements of ensuring patient data security, etc. Now the task is that the app should communicate with a particular server based on the login info. An additional requirement is that new hospitals(servers) are likely to be added along the way, even after the app is available on the market. So basically, according to some login credentials, the app should communicate with the server of the hospital assigned to that person. One pretty crude way is to set up our own server which links the hospitals with the login info and accordingly, provides a `base-url` for data exchange. Is there a more efficient way to handle this?


title: Are programming books in other languages useful for Python?

text: I'm a self-taught intermediate Python programmer; I frequently come across popular books on software development and programming written in other languages (often Java). Typical examples:   * Refactoring: Improving the Design of Existing Code   * Design Patterns, Gang of Four   * Test Driven Development: By Example   * The Art of Unit Testing: With Examples in .NET Generally speaking, how useful is it to read a book written for another language? Specifically, what about Python? Should one stick to language specific books? For example, a lot of people praise _Design Patterns_ by the GOF, I've never read it because the model applies to other languages (after all Python is about anti-patterns, right?) yet I feel the urge to because of it's place in the CS literature cannon. Likewise, would _The Art of Unit Testing: With Examples in .NET_ help a Python programmer learn unit testing even though the examples are in .Net?


title: Is equivalence partitioning part of negative testing?

text: I assume that negative testing is an approach to design the test cases and so is equivalence partitioning. But I am not sure if NT is a part of ET. An example:   A field can accept a numeric value from the range 0-10. So I have three partitions: to 0, from 0-10 and more than 10. Another invalid partitions would represent letters which is also negative testing, isn't it?


title: Write data to SQL Server directly from BizTalk or use external service?

text: An external source will be sending us XML data that BizTalk will pick up and transform into an internal schema. We need this data to be loaded into a SQL Server database as we're going to expose some of the data to our web front-end via a custom WCF service. The question is: what is the recommended approach for doing something like this? Options we're considering are having BizTalk write to the database directly or having BizTalk call a custom WCF service which would handle the save operation. Another briefly considered idea was having BizTalk write to an MSMQ and have a custom service pull from there and store it in the database. What are some of the guidelines or questions that should be asked in assessing these options? There are concerns related to overhead from calling the extra service, duplication of efforts if the schema is modified in the future (which it will be to some extent), and simply the best way to design within a service-oriented architecture that we're struggling with.


title: Does knowing Latin or other logical languages contribute to being a better programmer?

text: I'm currently studying Latin at school, and what I've learned is that it's a very logical language. I feel this has contributed to my programming ability, as it makes it my code easier to understand. Is there any relation between knowledge of a very logical language such as Latin and the comprehension of code?


title: Is there an appropriate use for #define for constants?

text: All over the Internet I see people advocating for the use of enum or const rather than #define for constant definition. Are there times when #define is more appropriate or equally appropriate? Please explain. Are there times when #define is just awful? Please elaborate. (You can say 'always' if you really wish, but I'm looking for more specific answers.) (Yes, I am trying to justify my use of #define, which to me looks so much neater.)


title: I18n strategy for java web apps

text: Internationalized applications usually display links in header for translating in different languages, e.g.: Spanish | English | Italian. These links usually translate current page in the selected language, and usually the url includes the language: http://www.mysite.com/myapp/es/somePage. Questions:   1. Does this only apply to static content?   2. Is it possible to internationalize this way dynamic content? For instance, a page which results in some form submission, clicking a different language might result in undesirable consequences. Some dynamic requests where transactions are not involved (simple queries, for example) might present no problems with this.    3. For authorized content, I guess I must ask for language in login page and use that language, i.e., disallow changing locale for authorized content, which, probably, has a lot of transactions. Is this correct?   4. How do I structure template files? One JSP for each of the languages? One JSP with a properties file for each of the languages?   5. How do I construct the link according to current request? I guess that url requested and param string should be remembered and reconstructed in JSP.


title: should I create a new class for a specific piece of business logic?

text: I have a Request class based on the same Entity in my Domain. It currently only has property definitions. I'd like to add a method for checking a duplicate Request which I'll call from my controller. Should I add a method called CheckDuplicate in the Request class? Would I be violating the SRP? The method will need to access a database context to check already existing requests. I'm thinking creating another class altogether for this logic that accepts a datacontext as part of its constructor. But creating a whole new class for just one method seems like a waste too. Any advice?


title: How to structure a class in python

text: I have come to python from C++ (I also know a little Java). I am writing code to exercise a server so I basically use http methods to send a load of requests to the server. As part of my code I created a class and called it testdata. This contains basically test input data (to send in requests) and output data to check against. With my C++ hat on I created a load of getter and setter methods which were one lines. I even had an `__init__` method to set eg `self.<some_attribute_name> = ""` or some safe default. I realise now that you can freely add attributes to a python object and there is no need to pre-initialise simple variables in init. So I have some questions.   1. For my testdata class, should I even be using a class?   2. I just add data items like this:              import testing          td = testing.testdata()     td.sessionid = "123"        3. But what about access eg to `td.sessionid` before I have previously assigned a value. I know I can use `hasattr` but that is an extra burden. Do I have to make sure I always assign first? What if I do `td.sessionid` before it is even assigned anything? I will get an AttributeError at runtime. How to handle this?   4. Due to problem 3. above. Should I always use `__init__` to initialise member data to safe default values? eg "" for strings.  What are recommended approaches in Python?


title: Which web site gives the most accurate indication of a programmer's capabilities?

text: If you were hiring programmers, and could choose between one of (say) the top 100 coders on topcoder.com, or one of the top 100 on stackoverflow.com, which would you choose? At least to me, it would appear that topcoder.com gives a more objective evaluation of pure ability to solve problems and write code. At the same time, despite obvious _technical_ capabilities, this person may lack any hint of social skills -- he may be purely a "lone coder", with little or no ability to help/work with others, may lack mentoring ability to help transfer his technical skills to others, etc. On the other hand, stackoverflow.com would at least appear to give a much better indication of peers' opinion of the coder in question, and the degree to which his presence and useful and helpful to others on the "team". At the same time, the scoring system is such that somebody who just throws up a lot of mediocre (or even poor answers) will almost inevitably accumulate a positive total of "reputation" points -- a single up-vote (perhaps just out of courtesy) will counteract the effects of no fewer than 5 down-votes, and others are discouraged (to some degree) from down-voting because they have to sacrifice their own reputation points to do so. At the same time, somebody who makes little or no technical contribution seems unlikely to accumulate a reputation that lands them (even close to) the top of the heap, so to speak. So, which provides a more useful indication of the degree to which this particular coder is likely to be useful to your organization? If you could choose between them, which set of coders would you rather have working on your team?


title: Not specifying a return in a function, good or bad?

text: I have coded like this many times, and I've never encountered an issue, but the compiler always warns when it expects a return and there is none. For instance, look at this:               -(NSString *)outputStringForInteger:(NSInteger)int     {         if (int == 0)         {             return @"Number is Zero";         }         else         {             return @"Number is not Zero";         }         //no "failsafe" or other explicit return     }      If the function will never get to the last line, ever, is it important to still have a failsafe option, or do you guys just deal with compiler warnings?


title: Where can I find an authoritative source documenting the relationships between standards bodies?

text: There seems to be a number of different so-called "standards" bodies interacting and/or competing with each other. For example, RFC 3629 references ISO/IEC 10646 and appears to be governed by the IETF, but no mention is made of IEEE, which has also documented programming terminology and standards. I'm looking for something like: The Internet Ecosystem http://www.isoc.org/pubpolpillar/docs/factsheet_ecosystem_20090310.pdf but less specific to the Internet, and more so to computing. Questions a good resource(s) might answer are: Which orgs are at odds with one another or have come about to fill a need not provided by the other? Which book(s), blog post (or series of blog posts), or some other document that defines the relations ship between the organizations and acronyms? I'm looking for a source or list of sources that might help me understand the history, authority, and importance of these organizations and standards in relation to one another. A good answer might include a link to get me going in the right direction or even just a list of sources that help me put the pieces together.


title: Why is an anemic domain model considered bad in C#/OOP, but very important in F#/FP?

text: In a blog post on F# for fun and profit, it says: > In a functional design, it is very important to separate behavior from data. > The data types are simple and "dumb". And then separately, you have a number > of functions that act on those data types. > > This is the exact opposite of an object-oriented design, where behavior and > data are meant to be combined. After all, that's exactly what a class is. In > a truly object-oriented design in fact, you should have nothing but behavior > -- the data is private and can only be accessed via methods. > > In fact, in OOD, not having enough behavior around a data type is considered > a Bad Thing, and even has a name: the "anemic domain model". Given that in C# we seem to keep borrowing from F#, and trying to write more functional-style code; how come we're not borrowing the idea of separating data/behavior, and even consider it bad? Is it simply that the definition doesn't with with OOP, or is there a concrete reason that it's bad in C# that for some reason doesn't apply in F# (and in fact, is reversed)? (Note: I'm specifically interested in the differences in C#/F# that could change the opinion of what is good/bad, rather than individuals that may disagree with either opinion in the blog post).


title: Run WebAPI on Azures free web site

text: Just a quick question. I see that Azure have an offering where you can host 10 websites for free? Is it possible to use this to host some WebAPI projects instead of a conventional website? Considering WebAPI projects are very similar to an ASP.NET MVC site, i'm going to assume the answer to be yes. But, just checking anyway. Thank you.


title: A legal/Copyright Situation - Employer refuses to pay me fairly (perhaps at all), but expects me to hand over code I've been working on

text: This is my first question here, I hope I'm not doing something wrong! I'll start by saying, I'm a 21 year old university student studying a science (this will be interesting later - you'll see why!). I came back from university for summer, and got myself a job at a web design firm in the town I live in. My parents had arranged the work while I was away, as they are a client of said firm. They were explicit in my requirement for earning some money whilst home for summer. I've been doing web design as a hobby for about 6 years, PHP/HTML/CSS/JS as well as C#/Java/vb.NET/Python. The day came to start work, I was enthusiastic and worked hard. The company is run rather badly, and since I started they've fired 2 of the other developers (out of a team of three) after seeing how little they really knew. The boss praises me daily, and asked me to even quit university to come and work for him. I politely declined, as it would be a waste of my time spent at university so far. Anyway, this is beside the point. Last friday (a week before I was due to finish) me and the boss have a meeting to talk about how much I will be paid. I wasn't expecting a fortune (I freelance for £16/hr, I was expecting less than half of that). Stupidly, when I started I didn't sign a contract regarding pay. And this is where the whole situation has devolved. I've spent 5 weeks there, 9-5, 5 days a week. I usually work through lunch, to impress the boss (hoping for a little bonus). So I've racked up some 200 hours of work in this time. The boss opens up the meeting asking how my "experience" has been. I tell him I've learned very little because I've been mentoring the other developers almost every day on best practises (they're still using image for buttons...) and introduced them to icon fonts, SASS, and other things to improve workflow. He accepts this, saying me being there has really opened his eyes (he's a non-developer, the root of his problems right there). Anyway, he tells me times are hard, and normally they don't pay people on "work experience". I immediately call him up on this, stating that I wasn't here for work experience, but to earn money. He shrugs it off, and says that I'm lucky to be getting anything. And offers me £2.50 an hour, meaning that after 5 weeks I've earned £500. And to make matters worse, I'm not confident I will be paid at all. I realise this is my fault, because no terms were agreed prior to me starting, but I assumed (wrongly) he would be fair and pay me in good faith. I've been working, for the past week, on a project that nobody else there can do (its really just a laravel site, responsive, from a design), and I've also written an API interfacing library to handle grabbing raw data from the Northern Ireland Tourist Board for one of their clients, along with all the other day-to-day work I have done for them. At the end of the week I will be expected to hand in this code (for the main project) and I was wondering if there are any legal grounds I can stand on. The main thing I'm worried about is that I hand in the code, and don't get paid at all. Could I perhaps license the code and prevent it's use? I guess I own the code? No company assets were used, all code was pulled directly via composer. I guess I did it while at the company, but its all on my laptop, and if I'm not being paid for the time spent there, does the company own it at all? The only issue I see is that the design was given to the company I work for by the client, and the client had that designed by another company. I wasn't planning on using the design, selling it or otherwise. Normally, I wouldn't be like this, I'm not a greedy person. But my living depends on this money. I only have a mere £1900 to live on for the whole year at university after paying for accommodation. So a decent wage would have really helped me in this regard. Any help on proceeding would be greatly appreciated! Tom


title: Don't Use "Static" in C#?

text: I submitted an application I wrote to some other architects for code review. One of them almost immediately wrote me back and said "Don't use "static". You can't write automated tests with static classes and methods. "Static" is to be avoided." I checked and fully 1/4 of my classes are marked "static". I use static when I am not going to create an instance of a class because the class is a single global class used throughout the code. He went on to mention something involving mocking, IOC/DI techniques that can't be used with static code. He says it is unfortunate when 3rd party libraries are static because of their un-testability. Is this other architect correct? update: here is an example: APIManager - this class keeps dictionaries of 3rd party APIs I am calling along with the next allowed time. It enforces API usage limits that a lot of 3rd parties have in their terms of service. I use it anywhere I am calling a 3rd party service by calling Thread.Sleep(APIManager.GetWait("ProviderXYZ")); before making the call. Everything in here is thread safe and it works great with the TPL in C#.


title: What is the purpose of a Code Review

text: I am in the process of trying to sell my organisation on the value of code reviews. I have worked at several places where they were employed. I have seen them used to nitpick styling choices, and functional decisions, and I have seen them used as nothing more than a gut check to make sure nothing dangerous is being implemented. My gut feeling is that the most effective purpose is somewhere between the two options. So, what is the purpose of a Code Review?


title: dealing with a very large state machine in a class

text: I am currently implementing a class for a network protocol. The protocol uses a quite complex and extensive finite state machine. A pair of an event plus a state is mapped to a function, which does some work and sets the new state. As there are about 150 valid state/event combinations and 28 distinct functions to be called, I refactored the whole state machine logic away from the associating/sending/receiving/... (let's call it service class) into a separate statemachine class. The problem is, that some of these 28 functions need access to the service class, for example to reset a deadline timer. What I could do is befriend the statemachine class and the service class, so they can access each other's internals. This would introduce a very tight coupling (albeit natural, as they belong together). I could also just leave both these classes in one, but this would result in a huge class. But since I doubt that I am the first one running into this problem, I assume that there exists a more or less canned solution to this I haven't found yet.


title: Problems of multiple threads sharing/accessing the same data

text: I have been researching into when data is being accessed or shared by multiple threads within Java. And looking into the problems such as:   * Thread Interference   * Memory Consistency    * Deadlock   * Starvation From this, solutions to solve these problems. So far all I seem find to fixing these problems is by using a synchronizing method. Are there other alternatives to using a synchronizing method? I have found most of this information from the sun Java tutorial. Any recommendations on further reading?


title: HTML Canvas: Should my app x, y values be global?

text: I have a large file of functions. Each of these functions is responsible for drawing a particular part of the application. My app has x and y parameters that I use in the setup function to move the whole app around in order to try different placements. So, naturally, I need to use these x and y values to anchor each function's component rendering so that everything moves in unison if the global x,y values ever change. My question is, is it bad practice/architecture to have these x,y values in the global namespace and having the each function directly access them like so?               function renderFace() {        var x = App.x;        var y = App.y;             // drawing here     }      is there a better way i'm missing?


title: Memory problems with singletons in a test suite

text: I am having a memory leak when running a test suite due to singleton objects are created and not cleared after each test case. And these singleton objects are holding references to heavy objects. So I don't know if there is a better solution than clearing the singleton objects in the `tearDown()` methods in each test class! What do you think?


I'v been working on sorting for a while now but I can't figure these two questions apart, I'm kind of getting mixed up somewhere ... Somebody help a) Which sorting algorithms have a different worst case complexity than their average case? b) Which sorting algorithms have a different best case complexity than their average case?


title: Sub-Resource data should be embedded in Resource entity or duplicated in NoSQL document?

text: I have a scenario similar to as depicted below,               public class Post {         private int id;         private int postType;         private int score;         private User originalPoster;         private String title;         private String body;         private String tags;          }          public class Comment {         private int id;         private int postId;         private String text;         private int score;         private User userId;     }          public class User {         int id;         String displayName;         int score;     }      How do I model my MongoDb document/domain object? My initial options are, **1) Have a separate Post and Comment collections and handle updates/retrievals hide behind my Rest Resource with possible duplicate of Comment in both Post and Comment.** **2) Have a single Document Post and include everything in it and have only one Rest Resource? This will limit my url templates or need for complex data retrievals at MongoDB end.** Whether I should go with 1) or 2) or there is other approach where I can have flexibility of urltemplates and minimize the NoSQL interactions?


title: How to document events?

text: Code documentation is usually related to a piece of code, be it small (method- level) or larger (class- or namespace-level). However, it is always about the _inputs_ and the _outputs_ of that piece of code, possibly describing its behavior and caveats. It doesn't make much sense to document events fired by a class in the methods that may fire them: they may be duplicated and, by the definition of events, the listener is not expected to care about what triggers them, only handling them. Documenting all events at the top of a class seems quite heavy, as someone willing to get an overview of the class behavior might not be so interested at deep diving at this “secondary interface”. This problem is mitigated in strongly-typed languages such as Java (yes, unless you use anonymous classes, but it doesn't seem so common), as the events will be defined in their own classes, which can then be documented. But, in languages with looser types, where an event is simply a String identifier and a series of parameters, it is much more difficult to find the proper place for documenting these id/params combinations. So: where should fired events be documented in languages that don't model them explicitly?


title: Will Java catch up with C#?

text: Today I posted a question asking about which language C# or Java would be better for me to study. I had some great answers. One thing that came up was that perhaps Java is now rather behind C# with new features. I saw some web links and most pointed out what C# had and what java did not have. So my question to you all is will Java catch up with C# again? And if you were to take a guess where would it stand in 5 years time. Would it have all the things that are maybe now missing? How about Java 7?


title: How to document an algorithm properly with sample data?

text: I am wondering what should an algorithm documentation contain? Can't locate a proper guideline to follow. I have in mind to include   * summary of the algorithm   * description of the algorithm   * flowcharts   * pseudo codes   * sample input data set(multiple)   * output data   * unit tests   * experiments The client requests such a documentation to: _Maintain confidence in our own numbers as well as to describe our process to potential customers so they know we are taking steps to check and verify our calculations._   * How would look like such a documentation? (example PDF)    * What would you include more in this documentation?    * What I enumerated is that good, or this should be somehow documented differently?    * How would you search in Google for such documentation samples?


title: How to create Job Security?

text: I just started a new programming job and have been told that I am doing well. However, I'm worried about being laid off because of the economy and how the company is faring. Currently, I'm quietly going about the job as normal and hoping I don't get let go. But I'm worried that isn't a good answer. Is there anything I can do to help create job security? (Besides writing terrible mortgage code that only I can maintain, thus forcing(?) the company to keep me)


title: Choosing which application instance will do the updates when dealing with multiple workstations w/o server involved?

text: So, I've got an interesting design problem and I honestly don't know how to tackle this. I have an application that will be ran on a dozen of workstations. Of those workstations, it is impossible to know at any given time how many of them will be on or using my application. Every 4 hours of local time if any of the applications are on, they would check database and perform some changes. The problem is that if more than one tries to do that, there will be some major complications. So I need a way for only one application to perform the updates if more than one are running. I was thinking of creating a file that would reside on the network drive where applications would append their workstation addresses as they're turned on and remove as they're turned off. Every 4 hours of local time, applications would check the file and whoever is at the top would be the one to run the update. The problem with that is that if an application is shut down in the way that it can't remove itself from the top of the list, no updates will appear from there on. I don't have an option to put any applications to run on the server itself, besides storing files there, so that's out of question. Does anyone know of a solution to this problem? I can't seem to wrap my brain around it. **Edit:** What I have implemented right now is this:                       int updateTimerOffset = (Convert.ToInt32(DateTime.Now.ToString("mm")) * 60000) - 120000;                  updateTimer = new System.Timers.Timer(3600000 - updateTimerOffset);             updateTimer.AutoReset = true;             updateTimer.Enabled = true;                  updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(PerformUpdates);      and then down in my PerformUpdates I have some code that looks like this:                       int currentHr = Convert.ToInt32(DateTime.Now.ToString("HH"));                  if (currentHr % 4 >= 0 && currentHr >= fileNum)             {                 // change fileNum in the file to currentHr + 4 if currentHr is not 24,                 // if it is, then make the value equal to 4                 // Update database stuff             }      fileNum is a number that is stored in a file on the server. This is done on every application's start up. So, every application, unless started absolutely at the exact same second will have a difference of 2 minutes (120,000 milliseconds) plus some seconds that I didn't account for between their start ups. What I can do is have a simple file holding a number for the target hour (fileNum). So that when the application checks it, it looks at the number to do comparison. So let's say that it's 16:00, in which case 16 % 4 gives us 0 and it's time for an update. That application checks the file and sees that the value is 12. 16 is equal to or greater than 12. So it changes the value to current hour (16) + 4, which is 20. The next application's timer elapses a minute or so later, and it has 0 for its hour mod value. So, it looks at the file and sees that value is 20, which is greater than 16, so it doesn't do anything. What do you guys think of this solution? It wouldn't work if there were hundreds of workstations, since chances of having both applications trying to do this at the same time are higher, but with a dozen or so workstations I can pull this off? Unless someone has a better solution?


title: A practical use of "yield" keyword in C#

text: After almost 4 years of experience, I haven't seen a code where **yield** keyword is used. Can somebody show me a practical usage (along explanation) of this keyword, and if so, aren't there other ways easier to fullfill what it can do?


title: How can I make myself more attractive to software publishers?

text: I have a good amount of experience developing software (5 years) in the corporate/enterprise world and would like to start working for a software publisher such as Microsoft, but never seem to get much of a reception when I talk to recruiters or respond to ads. I don't think it's specific language experience that's holding me back; I've spent the past 2.5 years doing web development in C#/.NET. Before that, I worked with mainstream technologies (C, C++) as well as legacy ones (MVS JCL, COBOL, etc.). I'm concerned that it might be my academic background (physics) or my relatively limited experience with any one _specific_ platform that's holding me back. My specific questions are:   * How should I market myself to get the best response from recruiters and hiring managers?   * What type of additional experience would improve my chances of getting interviewed/hired by software publishers? Should I try to start focusing on a single technology/platform instead of being a jack-of-all-trades, as I am now?


title: How does SCRUM manage an enviroment where team members are shared?

text: Well, the questions said itself. In my workplace those cases happen, but also, many Agile books promote working in the same workplace and being concentrated in the current project to become faster in the pace of work. Maybe i'm not that informed about the topic, maybe is not that strict but, that's why I wanted to know what does Agile proposes in cases like those. Anybody?


title: Cross-Platform: Develop in parallel or series?

text: When starting a new software project that will be used on several platforms, how do you determine the best way to start development? Do you develop for one platform and then port to the next? Do you try to develop all platforms simultaneously? For example, I'm going to start developing a Windows Phone app in C#. Much of my code could theoretically be reused with the .NET Framework and Silverlight. However I find that as I try to develop on all platforms simultaneously, refactoring and redesign tends to be 3 times as difficult and slow. I could try writing my app for Windows Phone and then port to other platforms, but I have no ideas what hairballs await me there, and it seems like there would be a lot of potential for design decisions to bite me in the bum only after I start porting. So which is better: develop the code for all platforms at once, or refactor and port to new platforms one at a time? What traps await me on either road?


title: NDA, a search for partner

text: I have an idea for what i believe would be a profitable Apple app store application. I also know that i don't have sufficient knowledge to complete it from start to finish and need help from more experienced iOS developers. Is there a standard NDA you have used and liked that would allow you to discuss details of the application with a 3rd party having a reasonable comfort that your idea won't be stolen?


title: Story Point Estimation - Component Based

text: I have read that story point estimation is not intended to actually tie with number of hours , but is used to identify the relative capacity. I have a java application which has a adapter layer , a service implementation layer , a DAO layer and an external connector service layer. If I am given a high level requirement , is it a good practice to a classification of story points for each layer - eg: Adapter : small : 1 SP , medium 3 SP , Large : 5 SP , Extra Large : 8 SP Impl : small : 3 SP , medium 5 SP , Large : 8 SP , Extra Large : 11 SP DAO : small : 1 SP , medium 3 SP , Large : 5 SP , Extra Large : 8 SP Is it a good way of estimation? Or should we always estimate by looking as application as whole for each change? For eg, If I have got 2 user stories , should I estimate size of user story as a whole , say 1 US takes up 5 SP and other takes 13 SP? Does component-wise breakdown make sense for story point estimation?


title: Programming-Related Summer Jobs For A High-School Student?

text: I'm a high school student, currently finishing my grade 12 year of high school. I have already been admitted into a software engineering program at at least one university, and I have decided on this as a career choice. I have taught myself almost everything I know about programming, and have worked on numerous open source projects. This past year, I wrote a website for my school, working with a team of ~3 people to do so, learning many things about git source control, and other skills related to working with a team on projects like this. In order to finance my education, I will need to get a summer job of one sort or another. Although I have no objection to working at the local grocery or tech store, I would prefer a job related to the career I will be pursuing long-term, as I believe it will   1. Be more interesting   2. Look better on a resume   3. Teach me more   4. Possibly be better payed (not a primary motivation, just a thought) My issue is, I have no idea where to start, or what companies, if any, will hire me. I have looked into GSOC, but I do not turn 18 until the fall, and as such am ineligible. I have considered going around to various local companies and asking if they want their website done/redone, but even then i'm not sure of the best way to go about it. Going the way of the entrepreneur is also a possibility, but could be risky as a summer job that my education depends on, especially considering I have very little experience deploying things in the real world. Furthermore, coming up with a product that would generate me enough profit over the course of a summer seems extremely unlikely, given that wild successes like Youtube and Facebook were not profitable for several years after they started. So, ultimately, my question is:   * Is it worth the effort to look for a programming-related job, since I am under 18 and don't have a degree? Do I have a decent chance of getting one?   * If it is worth the effort, where should I start my search, and what advice do you have regarding this search? Are there specific companies or websites you would recommend for my case? Not sure if this question is off-topic for this site, but I have seen several others asking for career advice, and this seems to fall under that same category. Let me know if there is anything I should do to make it clearer.


title: How should I approach this from a problem-solving point of view?

text: I'm currently working on a project to replace some excel worksheets. There is a lot of industry specifics that change quite often and nobody really knows how things should be but every sure enough thinks they know how they shouldn't be. **Project Priorities:**   * Maintainability - The business processes change frequently. There are like 3-5 different excel templates floating around.   * Agile - My boss wants visible changes every week (sometimes less).   * Structure - This application will work with several other systems for the entire business process. **Approach & Design**: The DB Schema we took was one where we defined some business logic in the database. EntityTypes, Properties of those types, and their values are stored in the database (each having their own table ofcourse). ![DBSchema](http://i.stack.imgur.com/vNDiH.png) Now, I originally thought about the typical approach, having an Estimate Table defining its properties, Bid Table, Joist Table, etc. (Each of these are EntityTypes by the way). My boss wanted the DBSchema we're using now (See picture). **Pros/Cons:** Current Schema:   * Pros: (Theoretically) Adapts to the data allowing for later changes to be as simple as adding the data to the database.   * Cons: Overly complex. I have difficulty even getting my mind around this schema when trying to create the class that will handle it. Typical/Traditional Schema:   * Pros: Simplistic, Anyone without knowledge of the project will be able to pick it up in the future.   * Cons: Many Many Tables. Not what we have now. **Situation:** I am currently retrieving the data using a class I made to represent an entity, then converting them into business model classes (Estimate, Bid, Joist...) to pass to the view. This obviously is extra work for the current schema, but I felt that the other way of having the view/controller parse through the model to determine how to display the data (making us only require a few views/controllers) seemed like bad design/programming (though I'm not entirely sure why). Am I correct thinking this schema/design is bad? If, so why? My Boss wants this Schema because "it may be complex but once the programming is done no more changes should need done." Now obviously the way I'm doing this, that's not true. If I were to do it the way he wants I feel like I might fail to do so as I kept confusing myself with the complexities. One of my boss's arguments is that you find yourself with a lot of NULL fields when you do the traditional schema (which I feel like you're doing it wrong if that's the case. Maybe in some instances but they have tables with like 30 columns where 10+ majority of the rows have a NULL value for that column). Will doing all the programming for supporting the current Schema the way he desires be worth the theoretical simplicity to add things in the future? It's not all that much work to add a small feature to a class, and add the display to the view's template using knockout. Especially considering the project is being done in an Agile environment and doing all the work at once then having something to show for it doesn't sound very Agile to me, which is basically what would need done to code the complex classes and display them in the views, not to mention I'd have to code a bunch of HTML helpers (coupling them a bit with Knockout) in order to do this. So personally it sounds like it's just moving the work not saving any. Am I correct in this thought process? **Proposed solution:** I suggested the other day to switch to the other schema and use Entity Framework Code-First to make changes easier (as the way I'm doing it now I have the change the Business Models regardless. Code-First would theoretically allow me to not have to do the Database Changes as well). My boss's main concern is that with a traditional schema the schema changes and then other systems will need updated as well. Whereas, he states that if we have the current schema then the other systems won't need updated if something changes in the database. Which I don't quite understand since how would it know how to deal with the data? Wouldn't it just mean it too would need complex coding/processes to back it up initially? **Questions:**   * Why is this schema design bad (if it is)? How can I argue this schema design is bad?   * If it is not a bad design, How can I better prepare myself for it? I do my best to Abstract classes/functionality and keep things with single responsibilities.   * If it is a bad design, How can I convince my boss to switch to my suggestion (assuming my suggestion is the best/only alternative)? I understand the last two questions are a but subjective, so it's understandable if they are ignored.


title: What does "GPL with classpath exception" mean in practice?

text: Oracle seems to license all their Java-related open source code under the GPL with a classpath exception. From what I understand, this seems to allow to combine these libraries with your own code into products that do not have to be covered by the GPL. How does this work? What are examples of how I can and cannot use these classes? Why was this new license used as opposed to the LGPL, which seems to allow for pretty much the same things, but is better established and understood? What are the differences to the LGPL?


title: How to handle frequent ajax requests in shopping cart

text: Is it common and/or acceptable to have Ajax requests every time a button is clicked on a shopping cart page? This is not a high traffic site. It will only have a few users at a time, like 5 max. I'm calling it a shopping cart for lack of a better term. The site is intended to let customers create highly customized orders, which benefits from logic being on the server instead of on the client. I have many questions regarding the best practices in this sort of design. Like, should I block user input until the ajax request is received? Should I be sure to display an error message if the ajax request fails? Should I automatically repeat the ajax request if it fails? Are there any other considerations?


title: What key factors should a university have for a computer science program?

text: I'm planning on heading to college, and I'd like to know what I should be looking for in a school when making a decision about going there for a computer science degree. What are good signs? What are red flags?


title: Is Windows a "second class citizen" in the Django community?

text: I'm currently doing R&D for a web application which we plan to host ourselves initially and then allow customers to self host. My task has been evaluating web frameworks to see which would give us the biggest productivity initially and ease of maintence while also allowing us to easily support deployment to customer controlled environments. Our team has experience with ASP.NET (MVC and Webforms) and Ruby on Rails. Our experience with Rails is that Windows deployment is a very taboo subject and any questions on IRC or StackOverflow are met with knee jerk "why not Linux" responses. However in this case our target market may be running windows or Linux servers.   * Is this also the case in Django land?   * Is it possible with rubbish performance?   * Is it possible with lost of pain?   * Is it seen as reasonable and not treated as a completely stupid idea for not wanting to run Linux?


title: How can I refactor client side functionality to create a product line-like generic design?

text: Assume the following situation similar to that of Stack Overflow: I have a system with a front-end that can perform various manipulations on the data (by sending messages to REST back-end):   * Posting   * Editing and deleting   * Adding labels and tags Now in the first version we created it well modularized but the need as of now for 'evolving' the system similar to Stack Overflow. My question is how best to separate the commonality and how to incorporate the variability with respect to the following: Commonality:   * The above 'functionalities' and sending/receiving the data from the server   * Look and feel (also a variability as explained below)   * HTTP verbs associated with the above actions Variability:   * The RESTful URLs where the requests are sent   * The text/style of the UI (the commonality is analogous to Stack Overflow - the functionality of upvotes, posting a question remains the same, but the words, the icons, the look and feel is still different across sites) I think this is entirely a client-side code organization/refactoring issue. I'm heavily using jQuery, javascript and backbone for front-end development. My question is how best should I isolate the same to be able to create multiple such aspects to the tool we are currently working on?


title: How to choose a server side language / framework

text: I am trying to come up with a list / ranking system on determining which server language to choose for a particular website. Assume that familiarity with a certain language is not important and the implementation can be done in any language. Here are some things that might be important but I am not sure how to rank them :   * Maintainability.   * Libraries. For example, Memcached and NoSql support right out the box would be really nice addition to a particular framework.   * 3rd party SDK's. For example, if I need Paypal on my site they openly provide SDK's for all senarios in Java, PHP and .Net. If I choose Django I would have to rely on 3rd party libraries that are don't support everything and are not officially maintained. Would that be dealbreaker for Django?   * Performance This one is tricky to put on a generic list because it can be a deal breaker but for many websites performance will not be an issue that the language/framework is responsible for.   * Cost (hosting, open source). edit - Any reason for the votes to close? I didn't see any duplicates mentioned and the question should not drum up a flame war.


title: How do quick & dirty programmers know they got it right?

text: If you ask programmers why they should write clean code, the number one answer you get is maintainability. While that's on my list, my main reason is more immediate and less altruistic: I can't tell if my new code is correct if it's too dirty. I find that I have focused on individual functions and lines of code so much that when I finish my first draft and step back to look at the big picture again it sometimes doesn't fit together very neatly. Spending an hour or two refactoring for cleanliness frequently uncovers copy/paste errors or boundary conditions that were very difficult to detect in the rough draft. However, some people feel it's occasionally okay to intentionally check in dirty code in the interest of shipping software, with a plan to "clean it up later." Is there is some practicable technique that gives them confidence in the correctness of their code when the readability is less than ideal? Is it a skill worth trying to develop? Or is a lack of confidence in the code something some people just find easier to accept?


title: What is the difference between these senior software engineer titles?

text: I'm currently a senior research software engineer at a large company and am being offered a "senior staff engineer" position somewhere else. I am not sure if the new position's title conveys a sideways move or an advancement. So, all other things being roughly equal (salary, domain of expertise, etc.), what is the external difference between these software engineer titles (in general and regardless of any particular company, if possible):   * senior engineer   * senior research engineer   * senior staff engineer   * member of technical staff   * principal engineer Edit: Let me elaborate on "member of technical staff" since it's kind of uncommon. I think it's a high title, commonly associated with research. I know that Oracle, VMWare, and the old Bell Labs have these titles. See: Member of Technical Staff . I know what it means, but I don't know how it stacks up against the other titles, which is why I asked.


title: Should testers automate their work?

text: We are trying to setup our testing process. We wonder if our testers should develop automated regression tests, or if the developers should do that. And what about other types of automated tests? Should testers develop them?


title: Anti patterns - Worth spending time or not

text: I have read this question and after a very long time it's clear I still don't understand anti-patterns. perhaps, it raised a new level of curosity to know why should I read Anti design pattern if they are actually nothing but a "Bad Practice". Is there any chance I should implement those anti design patterns in my application ? **EDIT** > When Jeff said: “A basic rule of programming is to never write what you can > buy or get for free,”. Which I believe is the way to implement copy & paste programming then should I say that SO is ,in some way or another, following Anti-Pattern?


title: What is the standard for describing functions and objects?

text: What is the standard for describing functions/methods (function name, number of arguments, argument type, return type, etc...) in a manner that is language independent? EDIT: More specifically, how does one describe a function without the use of diagrams? I thought there was a pure text standard.


title: Java language constructs to enforce design decisions

text: What constructs in OOP languages (specifically Java) allow you to enforce design decisions and intent? I think some examples would be the 'final' keyword, access modifiers, template methods, perhaps interfaces - but clearly I am having trouble coming up with an exhaustive list. Some constructs, like inheritance, feel like they fit this criterion but I find it difficult to explain exactly why. [edit] Turns out I took down a few more notes: Enum types, constructors, constants, and generic types. Although as in all things explaining why will be more important than just listing examples.


title: What is the recommended MongoDB schema for this quiz-engine scenario?

text: I'm working on a quiz engine for learning a foreign language. The engine shows users four images simultaneously and then plays an audio file. The user has to match the audio to the correct image. Below is my MongoDB document structure. Each document consists of an image file reference and an array of references to audio files that match that image. To generate a quiz instance I select four documents at random, show the images and then play one audio file from the four documents at random. The next step in my application development is to decide on the best document schema for storing user guesses. There are several requirements to consider:   1. I need to be able to report statistics at a user level. For example, total correct answers, total guesses, mean accuracy, etc)   2. I need to be able to query images based on the user's learning progress. For example, select 4 documents where guess count is >10 and accuracy is <=0.50.   3. The schema needs to be optimized for fast quiz generation.   4. The schema must not cause future scaling issues vis a vis document size. Assume 1mm users who make an average of 1000 guesses. Given all of this as background information, what would be the recommended schema? For example, would you store each guess in the Image document or perhaps in a User document (not shown) or a new document collection created for logging guesses? Would you recommend logging the raw guess data or would you pre-compute statistics by incrementing counters within the relevant document? * * * Schema for Image Collection:               _id "505bcc7a45c978be24000005"                date    2012-09-21 02:10:02 UTC          imageFileName   "BD3E134A-C7B3-4405-9004-ED573DF477FE-29879-0000395CF1091601"            random  0.26997075392864645          user    "2A8761E4-C13A-470E-A759-91432D61B6AF-25982-0000352D853511AF"     audioFiles       [     0        {     audioFileName   "C3669719-9F0A-4EB5-A791-2C00486665ED-30305-000039A3FDA7DCD2"     user    "2A8761E4-C13A-470E-A759-91432D61B6AF-25982-0000352D853511AF"     audioLanguage   "English"     date    2012-09-22 01:15:04 UTC     }     1        {     audioFileName   "C3669719-9F0A-4EB5-A791-2C00486665ED-30305-000039A3FDA7DCD2"     user    "2A8761E4-C13A-470E-A759-91432D61B6AF-25982-0000352D853511AF"     audioLanguage   "Spanish"     date    2012-09-22 01:17:04 UTC     }     ]


title: Does this violate the using exceptions for flow control "rule"?

text: I plan to make use of this interface in a plug-in architecture.               /// <summary>     /// Generic interface allowing you to react to an event.     /// You can block the event or just use it for notification.     /// </summary>     /// <typeparam name="T"></typeparam>     public interface IEventObserver<in T> where T : class     {         /// <summary>         /// Throw an exception in here if you want to prevent the event firing.         /// </summary>         /// <param name="o"></param>         void CanFireEvent(T o);              /// <summary>         /// This is only called if no handler threw an event in the CanFire.         /// </summary>         /// <param name="o"></param>         void OnBeforeEvent(T o);              /// <summary>         /// This is called after the event has happened.         /// </summary>         /// <param name="o"></param>         void OnAfterEvent(T o);     }      Example usage:               public interface ISendMessageObserver : IEventObserver<SendMessageEventArgs>     {     }      A plug-in can then implement `ISendMessageObserver` and prevent message sending by throwing an exception in the `CanFireEvent` method. However, I know that exceptions should not be used for normal program flow control, yet it is normal and expected for plugins here to stop the flow. I went for this because I'd like the plugin to provide a reason for blocking the event that can be logged or presented to the user. I could change `CanFireEvent` to:               bool CanFireEvent(T o, ref message);      or:               SomeTypeContainingAbortReason CanFireEvent(T o);      But both of those don't smell ideal either. So what do people think, exceptions for flow control OK in this instance? **Edit** I've separated the `CanFire` into it's own interface and renamed it as `PreviewEvent`.               /// <summary>     /// Generic interface allowing you to react to and block an event.     /// </summary>     /// <typeparam name="TArgs"></typeparam>     /// <typeparam name="TBlock"></typeparam>     public interface IEventPreviewer<in TArgs, out TBlock>         where TArgs : class         where TBlock : class, IEventBlock     {         /// <summary>         /// Return an IEventBlock to prevent the event from firing.         /// </summary>         /// <param name="args"></param>         TBlock PreviewEvent(TArgs args);     }          public interface IEventBlock     {         string BlockReason { get; }     }


title: Which is better: many class definitions in the same file or every class definition in a separate file?

text: Which is better: many class definitions in same file or every class definition in separate file? **Examples:** 1) Many classes in same file. Say, `myManyClasses.cs`:               namespace myPack     {        class myClass1()        {        }        class myClass2()        {        }        class myClass3()        {        }       .        .        .     }      2) Every class in separate file: _myClass1.cs_               namespace myPack     {        class myClass1()        {        }     }      _myClass2.cs_                namespace myPack      {        class myClass2()        {        }       }      **. . .**


title: Where to read from file?

text: In Java: I have a class Students. I would like to read a list of students from a file. Which one is more elegant:   1. Reading and constructing the list in main(), and creating a Student object with the new list passed to the constructor   2. Passing a FileReader to the constructor, who does the reading?   3. Something else?


title: Python reading from stdin while doing other tasks

text: I am trying to write a system log parser. It will receive messages from the FreeBsd syslog daemon through stdin. It will use those messages to determine if an ip should be banned or not. The problem I have is that after x seconds the ban should be removed, but if I won't get any input from stdin, my program will just block waiting for it. So in the mean time I can't do anything. I fixed it using threads, but isn't there a better way to do it? For example something like this:               while true:         while <data in stdin>:             handleData              doSomeStuff()      So as long nothing comes in from stdin I want to execute doSomeStuff, and if there is data handle it.