title: Regarding interpreters

text: I understand that an interpreter could do one of the following things (and probably more):   1. Execute programming-language source code directly.   2. First translate the source code to some intermediate code (which is less human-readable and more efficient or easier for the interpreter to execute), and then execute this code. My questions are:   1. Is this assumption true? Am I understanding correctly the general function of an interpreter? Or is something I wrote wrong?   2. If my assumptions are true, which one of these two possible functions are more common? Please show examples.


title: Where should I define constants in scripts?

text: When writing scripts using a modern scripting language, e.g. Powershell or JavaScript, where should I define constants? Should I make all constants global for readability and ease of use, or does it make sense to define constants as close to their scopes as possible (in a function, for instance, if it's not needed elsewhere)? I'm thinking mostly of error messages, error IDs, paths to resources or configuration options.


title: What is the best practice for when to check if something needs to be done?

text: Let's say I have a function that does `x`. I pass it a variable, and if the variable is not null, it does some action. And I have an array of variables and I'm going to run this function on each one. Inside the function, it seems like a good practice is to check if the argument is null before proceeding. A null argument is not an error, it just causes an early return. I could loop through the array and pass each value to the function, and the function will work great. Is there any value to checking if the var is null and only calling the function if it is not null during the loop? This doubles up on the checking for null, but:   * Is there any gained value?    * Is there any gain on not calling a function?    * Any readability gain on the loop in the parent code? For the sake of my question, let's assume that checking for null will _always_ be the case. I can see how checking for some object property might change over time, which makes the first check a bad idea. Pseudo code example:               for(thing in array) {         x(thing)     }      Versus:               for(thing in array) {         if(thing not null) x(thing)     }      If there are language-specific concerns, I'm a web developer working in PHP and JavaScript.


title: Is VB.NET a viable migration path for an application currently scripted in VBScript?

text: Our C++ MFC application gives the user the ability to define custom scripts in vbscript (via the VBScript engine). Since (parts of) the application are moving to .NET anyway, and since vbscript seems to be a legacy technology, we are thinking about adding a new scripting component where the user can add his scripts as VB.NET. Arguments for VB.NET are:   * Users already are "used to" the syntax   * Automatic conversion from vscript scripts to VB.NET scripts will be easier due to syntactic similarities What other arguments pro (or con) VB.NET as a in-application scripting language are there? Note that the users writing these scripts are _not_ programmers by trade, so any alternative has to take that into consideration.


title: Classless tables possible with Datamapper?

text: I have an Item class with the following attributes: `itemId,name,weight,volume,price,required_skills,required_items`. Since the last two attributes are going to be multivalued, I removed them and create new schemes like: `itemID,required_skill` (`itemID` is foreign key, `itemID and required_skill` is primary key.) Now, I'm confused how to create/use this new table. Here are the options that came to my mind: 1) The relationship between Items and Required_skills is one-to-many, so I may create a RequiredSkill class, which belongs_to Item, which in turn has n RequiredSkills. Then I can do `Item.get(1).requiredskills`. This sounds most logical to me and provides me methods and queries like:               sugar.components.create :raw_material => water.name     sugar.components.create :raw_material => sugarcane.name     sugar.components     sugar.components.count      2) Since required_skills may well be thought of as constants (since they resemble rules), I may put them into a hash or gdbm database or another sql table and query from there, which I don't prefer. My question is: is there something like a modelless table in datamapper, where datamapper is responsible from the creation and integrity of the table and allows me to query it in datamapper way, but does not require a class, like I may do it in sql? I solved my problem by using the first way: I created a new class for each normalization process (which appears as one-to-many association above). However, I am new to object oriented programming and I don't know if creating a new class for each such normalization is the usual way to do it in datamapper, or rather a hack? This, and whether there is a better way to do this, is what I would like to know. # @JustinC **Rereading thedatamapper.org Associations several times, now I see that datamapper certainly requires separate classes for joins. So you answered my question. However, since Robert Harvey placed the bounty, I feel the responsibility to wait a little more for a response about a dynamic way.** Your code complained with `Cannot find the child_model Container for Item in containers`. I managed to get it work with the second example of self referential association like below (putting here as a reference to others):               class Item       class Link         include DataMapper::Resource         storage_names[:default] = "requirement_links"              belongs_to :require, "Item", :key => true         belongs_to :required, "Item", :key => true       end            include DataMapper::Resource            property :id, Serial       property :name, String, :required => true            has n, :links_to_required_items, "Item::Link", :child_key => [:require_id]       has n, :links_to_requiring_items, "Item::Link", :child_key => [:required_id]            has n, :required_items, self,         :through => :links_to_required_items,         :via => :required       has n, :requiring_items, self,         :through => :links_to_requiring_items,         :via => :require           def require(others)         required_items.concat(Array(others))         save         self       end            def unrequire(others)         links_to_required_items.all(:required => Array(others)).destroy!         reload         self       end     end      So I can do:               jelly = Item.get :name => "Jelly"     sugar = Item.get :name => "Sugar"     jelly.require sugar      to require items and:               jelly.required_items.each { |i|; puts i.name }      to list requirements, which are really great. After reading your answer, I see that I am yet to normalize my database schema further. To be honest, I don't see the point of defining the relationship between rawmaterials and products as self referential. I mean, if that would be a small program, I certainly would use a hash like `{:jelly => ":sugar => 3, :water => 5"}` to reflect required items and amounts, according to YAGNI principle. Doing it as in the 1st option already provides me queries and methods as simple as the ones provided by the self referential association. **(However, I must admit that it looks more like a stored procedure rather than a method call to an object.)** So, could you very mind to explain the benefits of using a self referential association, which is difficult to understand/implement for me, compared to my simpler approach? I am new to OOP and wonder if I'm sort of undermodelling.


title: Empty virtual method on base class VS abstract methods

text: I couldn't find a question that was not too specific to some case, so I'll try to make this very generic. We need an extractor base class to a set of documents, for example. Each document has its specific properties, but they're ultimately documents. So we want to provide common extraction operations for all of them. Even though they're all documents, as I said, they're somewhat different. Some may have some properties, but some may not. Let's imagine that we have the `Document` base abstract class, and the `FancyDocument` and `NotSoFancyDocument` classes that inherit from it. The `FancyDocument` has a `SectionA`, the `NotSoFancyDocument` doesn't. That said, what would you defend as the best way of implementing this? Here's the two options:   * **Empty virtual methods on the base class** Empty virtual methods on the base class would allow the programmer to only override the methods that make sense for the different types of documents. We would then have a default behavior on the abstract base class, which would be returning the `default` for the methods, like this:               public abstract class Document     {         public virtual SectionA GetDocumentSectionA()         {             return default(SectionA);         }     }          public class FancyDocument : Document     {         public override SectionA GetDocumentSectionA()         {             // Specific implementation                     }     }          public class NotSoFancyDocument : Document     {         // Does not implement method GetDocumentSectionA because it doesn't have a SectionA     }        * **Concrete empty methods or concrete methods throwing a`NotImplementedException`** Since the `NotSoFancyDocument` **does not** have a `SectionA`, but the others do, we could either just return the _default_ for the method in it, or we could throw a `NotImplementedException`. That would depend on how the program was written and some other things. We could come up with something like this:               //// Return the default value          public abstract class Document     {         public abstract SectionA GetDocumentSectionA();     }          public class FancyDocument : Document     {         public override SectionA GetDocumentSectionA()         {             // Specific implementation         }     }          public class NotSoFancyDocument : Document     {         public override SectionA GetDocumentSectionA()         {             return default(SectionA);         }     }      **OR**               //// Throw an exception          public abstract class Document     {         public abstract SectionA GetDocumentSectionA();     }          public class FancyDocument : Document     {         public override SectionA GetDocumentSectionA()         {             // Specific implementation         }     }          public class NotSoFancyDocument : Document     {         public override SectionA GetDocumentSectionA()         {             throw new NotImplementedException("NotSoFancyDocument does not have a section A");         }     }      Personally, I do think that the abstract method approach is better, since it means "Hey, I need you to be able to get a SectionA to be a document. I don't care how." while the virtual method means "Hey, I do have this SectionA here. If it's not good enough for you, feel free to change the way I get it.". I do think the first one is a sign of object oriented programming smell. What are your opinions on this?


title: Can a system be 100% Data Driven?

text: My new boss has been working on this project for many years. I've only been here a few weeks, but I am not sure it's possible. He would like to design a system that is "100% data driven". So if we put in enough data, we can define and generate any application. I've managed to at least get him to concede some things like users, or apps should have predefined values, but he likes the concept of the structure of the system, the user interface and the logic all being stored as data. There are some demos of simple things and he's basically rediscovered some simple ideas of object oriented programming and your basic template systems, but I think overall that this goal might be actually impossible. I don't know how you can define logic using data without the system becoming so complex that you are doing actual programming anyway. I think theoretically it isn't because the thing that interprets the data ends up needing to become turing complete to describe the application so you've just shifted the problem one level higher to no net benefit. Is such a 100% Data Driven Application possible?


title: Language that embraces mutable state?

text: There seems to be a trend towards immutable objects, and pure functional programming. While I recognize the benefits, I find it hard to apply these principles to GUI programming, for example. But I also find classical imperative languages with mutable objects lacking. I was wondering whether there is a language or system that _embraces_ mutable state, and makes it especially easy to work with. Below are some features I would consider to be "designed around mutability":   * The ability to hook up events and get a change notification for any variable. It would make it very easy to write GUIs and MVC applications. And you could just make a `List<MyObject>`, and stuff it into a list widget, and with a bit of configuration it would manage your list for you, no manual listview.insert() etc..   * A type system that considers state. For example, If I pass a `Car` into a function that requires a working one, the compiler should try to proove that `car.broken == False`. If it can't proove it, it won't compile, and I have to ensure it (by putting the code in an `if` block, or setting it manually to False).   * A take on concurrency that makes sense for mutable objects. For example an `atomic` statement, that guarantees that certain statements are run together, using transactions or locks. The goal is not performance, but ease of use and GUI responsiveness. I should be able to manipulate data and the GUI from any thread, using `atomic {step1; step2}` to ensure invariants. I'm not looking for a system with these _exact_ features, but one written in a similar spirit. The closest I've seen to this is C#/.NET with its data binding features. Gtk+ has custom ListModels that keep a GtkTreeView in like with your data without manual inserts/updates. Android has ListAdapters which are similar. I haven't found a thread-safe GUI, but you can get pretty close with a liberal use of `Invoke()` in C#/WinForms, or `gobject_idle_add` in Gtk+. Are there any systems like what I describe? Or research material, references, etc.?


title: How can Scrum be adapted to a Volunteer setting?

text: I have recently joined a young hackerspace still in the process of setting itself up. We're fortunate because the space has a few internal projects that need working on and no shortage of volunteers to work on them. There have been some discussions on how to organize these projects. My most recent professional experience has been with Scrum so I'm considering pitching a Scrum approach for our software projects, but I'm not sure it will be a good fit. Although I've seen Scrum work well for small full-time teams, the nature of this organisation is different:   * The members are **volunteers**. Some are full time students. Others work jobs full time. We can't expect a constant level of contribution from anyone as their real lives take priority.    * While pretty much everyone has years of experience writing software, not many members have done so professionally or in teams.   * There is **no Product Owner**. The requirements for these projects are determined by a committee. The members of this committee will also be working on the implementation. This means we will have no single, dedicated, Product Owner.   * We have **no deadlines** (soft or hard). The projects will get done when they get done. These are pretty significant differences, but I'm not convinced they will be blockers to applying Scrum. I think some minor tweaking could get us over this hurdle:   * If we change Sprints to have a fixed story-point size, but **fluid duration** (time), we can still benefit from iterative releases without putting unrealistic delivery pressure on volunteer devs.   * We can ditch **burndown charts** and **velocity** calculation. If I understand correctly, these are tools and metrics that work as a bridge between the dev team and the Management. They serve to report progress in a form that is meaningful to both the developers and the stakeholders. Considering we have no one to report to (no Project Manager, no Product Owner, and no outside stakeholders) I believe we can drop this altogether. Things I think we could benefit from which won't require tweaking:   * The **Requirements Gathering** meeting(s). Where everyone sits around a table and discusses User Stories, sketches up UI mocks, and builds up a Product Backlog.   * Sprint **Retrospectives**. This will be an interesting way for us to converge on a development process that works for us as a team of volunteers. Things I'm not sure about:   * How should daily **Stand-ups** be treated? I wonder if they would have much value at all in our setting. My understanding of the stand-up ritual is that it helps communication by naturally disseminating information throughout the team. Considering the fact that our Sprints will likely be delivering much less complexity than an average Sprint there might be less need to be abreast of all the other team members' progress/developments.   * Should I push for **XP** things like Continuous Integration, Code Reviews, and TDD? I'm concerned this will be asking for a lot. I'd be more tempted to bring these concepts in on future projects once people are more familiar with Scrum and working as a team. ### My Questions: Can Scrum be adapted to a volunteer-based environment?   And, is my planned approach so far going in the right direction?


title: Should I redo an abandoned Dynamic Data project with Lightswitch?

text: I had a small project that I was doing on the side. It was basically a couple of forms linked to a DB. Access was out, because it was a specifically meant to be a web application. Being a small project I used ASP.NET Dynamic Data, but, for various reasons, the project ended before deployment. I met the client recently, and he said there was a need for it still. I'm considering restarting the project with Dynamic Data, but I've seen some Lightswitch demos, and was suitably impressed with the BETA. I will wait for RTM if I use it, but is it a good idea to use Lightswitch to replace the Dynamic Data? The amount of work I put into the Dynamic Data site isn't really an issue. Additional information: It's a system that tracks production in a small factory, broken down by line, machine, section and will generate reports. I would guess that the data structure will remain fairly constant over time, but that the reporting requirements will grow. The other thing is that the factory is part of a larger group, and I'm hopeful that, if this system succeeds, similar work with be forthcoming for other factories.


title: Mostly produce output at programming job but don't learn anything

text: When I started working a programmer, I learned lots at first, on the job. Although Ive been given more responsibility, which is good in a way, it is mostly in the form of increased workload. I havent had much time or energy left to learn anything much new day to day. Sometimes I have 1 hr of time and energy left at the end of the day to keep up, but I mostly just produce a lot of the same type of code. It does make sense to spend working hrs producing, since it's the reason why a programmer is trained and hired. However, I am concerned about if Im falling behind as a programmer, by doing what I was hired for, even if not learning much new. Is this standard for most programmers?


title: Most efficient way to rebuild a tree structure from data

text: Have a question on recursively populating JsTree using the .NET wrapper available via NuGet. Any help would be greatly appreciated. the .NET class JsTree3Node has a property named Children which holds a list of JsTree3Nodes, and the pre-existing table which contains the node structure looks like this > >     NodeId    ParentNodeId     Data            AbsolutePath >     1         NULL             News            /News >     2         1                Financial       /News/Financial >     3         2                StockMarket     /News/Financial/StockMarket >   I have a EF data context from the the database, so my code currently looks like this.               var parentNode = new JsTree3Node(Guid.NewGuid().ToString());          foreach(var nodeItem in context.Nodes)     {        parentNode.Children.Add(nodeItem.Data);        // What is the most efficient logic to do this recursively?     }      as the inline comment says in the above code, what would be the most efficient way to load the JStree data on to the `parentNode` object. I can change the existing node table to suite the logic so feel free to suggest any changes to improve performance.


title: Tips for / pitfalls of working on an outsourced project

text: My company has retained an outside firm to develop an iPhone app for us. As the only internal developer with any knowledge of Objective-C, I've been assigned to develop the relevant APIs on our site, but also to do anything I can to make sure the whole thing comes together on time. Any suggestions for things I should do or things I should watch out for, particularly from those who've been down this road before?


title: Common Lisp Implementations - threading and multiplatform?

text: I'm learning Common Lisp, mostly as a "mind gym" hobby thing, but I want to end up with a set of skills that would also be usable "in real life", because when you learn a language you also accumulate knowledge about module and package management, deployment and stuff, whether you like it or not, so I want to learn with a CL implementation that is also usable in production. So my question is: **What CL implementation is most usable "in production", having attributes like these? :**   * it's **multi-platform** \- one should be able to use the same language implementation and languages on a Linux server, a Windows dev machine and a MacOS one (the coolest thing would be being able to also compile for Android, Windows Phone and RT and maybe even iOS)   * it has good **concurrency** , **parallelism** , **multi-threading** features - and these features work _cross-platform_ , otherwise it doesn't count   * it's easy to **interface with other languages** \- working with C libraries is a must, but anything else, like an easy CL-Python interface would be nice I insist on the multi-platform part because I know that one of the serious arguments for Reddit ditching CL (CMUCL - btw, I know SBCL is fork of CMUCL, but how do they compare?) was that developers couldn't just use their Macs to develop without being ssh'd into a dev server environment (quote: _"On my Mac, my choices of threaded Lisp implementations was limited to OpenMCL, and in FreeBSD it's CMUCL."_ ). Yeah, one can use a dev VM, but still... * * * _**Note #1:** I was close to settling on **CLISP** but I don't know about its concurrency features, and I also came across this: "it all-but-forces your code to be released as GPL" (I can't understand what this means or how can a languages's license become forced on your code, but I'm not fluent in legalese...)._ _**Note #2:** I'm not really fond of the JVM, and if I were to use a Lisp on it it would be Clojure and nothing else, so no JVM Lisps suggestions, please :)_


title: Is there a quick and practical (hands on) way to learn another programming language?

text: Due to rather strange circumstances, I only have until Monday to learn (at least) the basics of PHP and .NET programming. I'm already fairly competent (though there is a lot of room for improvement) in C++ so I feel I have some of the concepts nailed already, but I need to get into the two languages in a bit more depth in a very short time frame. Unfortunately I won't have time to get any books so will need to exclusively use online resources, I'm more of a 'do-er' so any way to test my skills in a practical way would be a huge bonus :-)


title: CLISP Common Lisp license - can it force my code to be released under GPL?

text: I came across this about CLISP: *"it all-but-forces your code to be released as GPL" here, when looking for a good Common Lisp implementation. **How can a language force a license on your code?** Is this just FUD? I'm asking because I really don't speak "legalese" so maybe there's something I don't understand here... I get it that the language is GPL and it compiles to a form of bytecode, but can't I have my program with whatever licences I want? * * * EDITED: CMUCL -> CLISP (had my head in the wrong place when I wrote the question first time, sorry...)


title: Does a mobile app need more access than the public API of a site?

text: I have a site with a public API, and some mobile app developers have been brought in to produce an iPhone app for the site. They insist they need to see the database schema, but as I understand it, they should only need access to the documented public API. Am I right? Is there something I've missed? I've told them that if there's a feature missing or data they require I can extend the API so that they can access it. I thought a web service API held to much the same principles as OOP object API's, in that the implementation details should be hidden as much as possible. I'm not a mobile app developer so if there is something I don't quite see then please let me know. Any insight or help will be much appreciated. * * * Update: The mobile team are part of a government funded advisory service for start ups. I've since found out that the project manager, who was the one pushing so hard to see the database and other internals, also works for a web development agency. I can't say for sure what his reasons were for wanting to see this stuff, but considering he didn't once give a _valid_ technical reason I find this even more concerning than I did at the time.


title: Why do we sign a .JAR ? or a tag on github?

text: I have a question :   * Why do I need to sign a `.JAR` using `jarsigner`?    * is there a specific reason or use of that ?    * Same question when I tag a version on github ?


title: As a student, what techniques used by faculty helped you learn the most?

text: I'm getting into the more advanced programming classes at my university, and feel like I am running into some obvious shortcomings with producing quality code. For example, my data structures class has us reading in a list of songs, creating Song objects, then using various structures to implement searches for artists, titles, lyric words and lyric phrases. The professor gives us a list of test examples to prove the code produces the expected results, and the grades are based on functionality, completeness, and bug awareness. Currently I am holding a 90 average in that class, but am not really satisfied that my code is of good quality. So, what techniques did your college professors use to get you to write better code?


title: Clarify the Open/Close Principle

text: As I have had it explained, the open/close principle states that once written code should not be modified (aside from bug fixes). But if my business rules change shouldn't I modify the code implementing those changes? I suspect I'm not understanding something about how the principle because it doesn't make sense to me.


title: Why doesn't the DART language use a special character to identify variables?

text: I come from a PHP background and I have been considering looking at DART in more detail. DART is an, open source, front-end/back-end, language for web development. PHP has a special $ (dollar) character to indicate variables:               $variable     CONSTANT     'string'     "etc"      I find that dollar sign to be really useful for speeding up the proces of refactoring, especially if PHP code is mixed with HTML or content. It reduces the number of false positives when, say, doing a _find and replace_. As DART is a completely fresh language (with no legacy) that can be embedded in HTML, it surprised me to see that it does not have any special identifier to indicate variables. What's the reasoning behind that design decision?


title: How to get OOAD and Design Patterns hands-on experience in C#?

text: I have read the concepts and practiced some examples on OOAD and Design Patterns. But when I was asked to implement the singleton pattern in a little bit different manner, I was unable to do it and failed to reach my goal. I think I need some more in-depth understanding of the basics and some real experience with the concepts. Please suggest me some good books and mini projects for me to get hands on experience on OOAD and Design Patterns in C#. I have almost 9 months of time frame to retake the test. I have done this for singleton. It's valid code. But i was asked to implement in such a way that, i should be able to create instance of DBConnection class only once. use that instance to get the Connection object. This is where, i have failed to implement singleton :(               class DBConnection      {         private Connection _conn = null;         static Connection GetConnection()         {              if(_conn ==null)                   _conn = new Connection(...);              return _conn;          }     }


I am a mathematics student and am just starting to learn about programming. I am stuck on a particular program I am trying to write for fun. I want to find an algorithm to create all possible column vectors of size N containing only ones and zeroes and combine them in one large matrix by putting all the columns after each other. The order of the columns is of no importance. For instance if N=3 I want to get the matrix: 0 1 1 1 1 0 0 0   0 0 1 0 1 1 1 0   0 0 0 1 1 0 1 1 which vertically contains all possible combinations of ones and zeroes of length 3. Does anyone have any idea how to do this? I am not necessarily looking for a very efficient or clever way to do this because the value I will be using for N is 14, so my matrix will be 14 x 2^14 which is 14 x 16384 which is not too big. Also, sorry for the formatting of my question, I am used to the math stackexchange where you can use LaTeX text to make your matrices and equations look nice. Thanks to anyone who can help me along!


title: Steps to solve or approach towards a solution

text: Please share your experience about how do you approach towards a solution or solve a problem. Include description about what ever tools you use,sources you follow,algorithms you choose etc. It would be great help in moving further and works as a guidance too.


title: Am I getting Scheme wrong?

text: Inspired by the numerous posts about the importance of learning Lisp/Scheme I started to learn Scheme two days back, I am using the book "The little Schemer" and have completed half of it. But I still haven't learned anything new, the book teaches about recursion which I already understand and uses lambda (which I can think of a way to define a function in C). I still haven't got the concept of functional programming (please point to some example of functional compared to normal programming methods in C/C++ so I can get it). Am I learning in the wrong way? or is "The little Schemer" for a newbie in programming and I should look for some other books?


title: How much freeware is downloaded by an average user?

text: I am interested in the amount of usage of freeware (closed source) running under Windows, which is not preinstalled on PCs. The closest I expect to get to such statistics is the amount of freeware downloaded by an average user. A good answer refers to a source, which says something like: "The average Windows user downloads 2.3 freewares per year". An even better answer is: "An average Windows user spends 0.04 hours per day using freeware". Edit: I see this as the equivalent of: "How many kilos of chocolate does an average russian eat per year", which is the sort of statistic widely used for initial market analysis. I agree that you still do not know whether a mint chocolate with a slight taste of banana will sell, but you have a better idea.


title: Are unit tests really used as documentation?

text: I cannot count the number of times I read statements in the vein of 'unit tests are a very important source of documentation of the code under test'. I do not deny they are true. But personally I haven't found myself using them as documentation, ever. For the typical frameworks I use, the method declarations document their behaviour and that's all I need. And I assume the unit tests backup everything stated in that documentation, plus likely some more internal stuff, so on one side it duplicates the ducumentation while on the other it might add some more that is irrelevant. So the question is: when are unit tests used as documentation? When the comments do not cover everything? By developpers extending the source? And what do they expose that can be useful and relevant that the documentation itself cannot expose?


title: Help with complex MVVM (multiple views)

text: I need help creating view models for the following scenario:   1. Deep, hierarchical data    2. Multiple views for the same set of data   3. Each view is a single, dynamically-changing view, based on the active selection   4. Depending on the value of a property, display different types of tabs in a tab control ![enter image description here](http://i.stack.imgur.com/dIvrO.png) My questions: **Should I create a view-model representation for each view (VM1, VM2, etc)?**               1. Yes:         a. Should I model the entire hierarchical relationship? (ie, SubVM1, HouseVM1, RoomVM1)         b. How do I keep all hierarchies in sync? (e.g, adding/removing nodes)          2. No:         a. Do I use a huge, single view model that caters for all views?      Here's an example of a single view Figure 1: Multiple views updated based on active room. Notice Tab control ![enter image description here](http://i.stack.imgur.com/YQ0qj.png) Figure 2: Different active room. Multiple views updated. Tab control items changed based on object's property. ![enter image description here](http://i.stack.imgur.com/bfZIC.png) Figure 3: Different selection type. Entire view changes ![enter image description here](http://i.stack.imgur.com/Ta17v.png)


title: Are web application usability issues equal to website usability issues?

text: I've been reading two books about web usability issues and tests (Rocket Surgery Made Easy¹ and Prioritizing Web Usability²) and they claim some strategies and typical problems about website usability and how to lead them. However, I want to do a web application, and I think I lost track of what I am trying to solve. These two books claim to work with raw websites (e-commerce, business sites, even intranet), but I'm not sure if everything about web usability is applicable to web application usability. They sure talk about always having available (and usable) the Back button, to focus on short information rather than big amounts of text, etc., but they could be inaccurate in deeper problems that may be easier (or just skippable) in regular websites. Has anybody some experience in this field and could tell me if **both web applications and websites share their usability issues?** Thanks in advance **Edit:** Quoting Wikipedia, a website _is a collection of related web pages containing images, videos or other digital assets_ , and a web application _is an application that is accessed over a network such as the Internet or an intranet_. To sum up, both shows/lets you search/produce information but websites are "simple" in interaction and keep the classics of websites (one- click actions) and the other one is closer to desktop applications in the meaning of their uses and ways of interaction (double click, modal windows, asynchronous calls [to keep you in the same "environment" instead of reloading it] etc.). I don't know if this clarifies the difference. **Edit 2:** Quoting @Victor and myself, a website is anything running in your browser, but a web application is somewhat running in your browser that could be running in your desktop, with similar behaviors and features. Gmail is a web application that could replace Outlook. GDocs could replace Office. Grooveshark could replace your music player, etc.


title: Creating REST-ful web-services without adhering to the REST principles

text: I have built an application which acts as an interface between an EAI layer and third party vendor applications. I am using REST-ful web services for this, making use of JAX-RS API and Jersey framework. Although the web services can do different operations like Cancel, View, Create, Reschedule orders, I have implemented all of them as POST methods. But for the web-services to be REST-ful, we need to use the HTTP methods GET, POST, PUT and DELETE appropriately. Here there are no users who can view the url to be used and hence no 'User Experience' involved. It is just a url configured at the EAI layer, which gets the request from the UI\Order Management screens. In this scenario, do we really need to make the web-services REST-ful? Whatever I have created, can they be called REST-ful web-services?


title: What is the best way to discuss/plan/negotiate about code architecture remotely?

text: Our team is distributed in space and time, so we have no ability to discuss the architecture of the code in real time. How can we discuss it via documentation: write code interfaces/ comment/ modify, track history of the code architecture? Are there some specific tools for this? What are the best way: class diagrams, code interfaces, something different? We are using c# and VS2010


title: Do you write unit tests for all the time in TDD?

text: I have been designing and developing code with TDD style for a long time. What disturbs me about TDD is writing tests for code that does not contain any business logic or interesting behaviour. I know TDD is a design activity more than testing but sometimes I feel it's useless to write tests in these scenarios. For example I have a simple scenario like **"When user clicks check button, it should check file's validity"**. For this scenario I usually start writing tests for presenter/controller class like the one below.               @Test     public void when_user_clicks_check_it_should_check_selected_file_validity(){         MediaService service =mock(MediaService);         View view =mock(View);              when(view.getSelectedFile).thenReturns("c:\\Dir\\file.avi");              MediaController controller =new MediaController(service,view);         controller.check();              verify(service).check("c:\\Dir\\file.avi");     }      As you can see there is no design decision or interesting code to verify behaviour. I am testing values from view passed to MediaService. I usually write but don't like these kind of tests. What do yo do about these situations ? Do you write tests for all the time ? **UPDATE :** I have changed the test name and code after complaints. Some users said that you should write tests for the trivial cases like this so in the future someone might add interesting behaviour. But what about “Code for today, design for tomorrow.” ? If someone, including myself, adds more interesting code in the future the test can be created for it then. Why should I do it now for the trivial cases ?


title: When to go Fluent in C#?

text: In many respects I really like the idea of Fluent interfaces, but with all of the modern features of C# (initializers, lambdas, named parameters) I find myself thinking, "is it worth it?", and "Is this the right pattern to use?". Could anyone give me, if not an accepted practice, at least their own experience or decision matrix for when to use the Fluent pattern? **Conclusion:** Some good rules of thumb from the answers so far:   * Fluent interfaces help greatly when you have more actions than setters, since calls benefit more from the context pass-through.   * Fluent interfaces should be thought of as a layer over top of an api, not the sole means of use.   * The modern features such as lambdas, initializers, and named parameters, can work hand-in-hand to make a fluent interface even more friendly. * * * Here is an example of what I mean by the modern features making it feel less needed. Take for example a (perhaps poor example) Fluent interface that allows me to create an Employee like:               Employees.CreateNew().WithFirstName("Peter")                          .WithLastName("Gibbons")                          .WithManager()                               .WithFirstName("Bill")                               .WithLastName("Lumbergh")                               .WithTitle("Manager")                               .WithDepartment("Y2K");      Could easily be written with initializers like:               Employees.Add(new Employee()                   {                       FirstName = "Peter",                       LastName = "Gibbons",                       Manager = new Employee()                                 {                                      FirstName = "Bill",                                      LastName = "Lumbergh",                                      Title = "Manager",                                      Department = "Y2K"                                 }                   });      I could also have used named parameters in the constructors in this example.


title: Signing redistributed files

text: In order to submit a desktop application for the Windows 8 app store, you need to digitally sign any driver or .exe associated with the application. However, the application I was trying to submit contains several files that are redistributions of other companies' software, and some of these are not signed. My application was rejected on these grounds. Is it legal (or ethical) to sign other companies' work so that we can submit our application? I think it might be considered some form of false representation but I'm not sure.


title: Coding to SOA, External Dependency

text: This has happend to me more than once, thought someone can give some insight. I have worked on multiple projects where my project depends on external service. When I have to run the application locally, i would need that service to be up. But sometimes I would be coding to the next version of their service which may not be ready. So the question is, is there already a way that can have a mock service up and running that i could configure with some request and responses? For example, lets say that I have a local application that needs to make a rest call to some other service outside to obtain some data. E.g, say, for given a user, i need to find all pending shipments which would come from other service. But I dont have access to that service. In order to run my application, i need a working external service but I dont have access to it in my environment. Is there a better way rather than having to create a fake service?


title: articles in variable names and hard-coding strings

text: re-edited by author: no this is not 2 questions. This is one question about code review questions containing two separate points. Please do not edit my question. For naming variables, the two sides are regarding using articles (a, an, the) in the variable name (e.g. theBook vs. book -or- parseTheString vs. parseString). For hard-coding strings, the three sides are whether to put all strings into constants (public static final) in a separate file (class or interface), put them all in the same file (private static final), or don't use constants for strings at all. (e.g. new Button("Click Me") vs. new Button(BUTTON_LABEL_CLICK)). We also discuss the Hungarian notation issue quite a bit but I've seen that discussed here in other questions. For a very long time it has been the defacto standard to not use articles in variable names (adds visual clutter without adding value) and to not have hard-coded strings sprinkled through the source code (a potential maintenance nightmare and very poor for internationalization). Now we are starting to see violations of these and the developers seem truly surprised when someone marks these as defects or at least needing attention. The manager has said they don't care one way or the other and these points are not in our company coding standards.


title: Rpc transferring data or Replication

text: I have services on 10 machines that stores data in database on these machines. And I have main server that needs to pull that data from these ten machines. What is better for this. Implement some rpc or use replication?


Wikipedia defines software orthogonality as: > orthogonality in a programming language means that a relatively small set of > primitive constructs can be combined in a relatively small number of ways to > build the control and data structures of the language. The term is most- > frequently used regarding assembly instruction sets, as orthogonal > instruction set. Jason Coffin has defined software orthogonality as > Highly cohesive components that are loosely coupled to each other produce an > orthogonal system. C.Ross has defined software orthogonality as: > the property that means "Changing A does not change B". An example of an > orthogonal system would be a radio, where changing the station does not > change the volume and vice-versa. Now there is a hypothesis published in the the ACM Queue by Tim Bray \- that some have called the _Bánffy Bray Type System Criteria_ \- which he summarises as: >   1. Static typings attractiveness is a direct function (and dynamic typings > an inverse function) of API surface size. >   2. Dynamic typings attractiveness is a direct function (and static typings > an inverse function) of unit testing workability. > Now Stuart Halloway has reformulated Banfy Bray as: > the more your APIs exceed orthogonality, the better you will like static > typing My question is: **What is the evidence that an API has exceeded its orthogonality in the context of types?** * * * **Clarification** Tim Bray introduces the idea of orthogonality and APIs. Where you have one API and it is mainly dealing with Strings (ie a web server serving requests and responses), then a uni-typed language (python, ruby) is 'aligned' to that API - because the the type system of these languages isn't sophisticated, but it doesn't matter since you're dealing with Strings anyway. He then moves on to Android programming, which has a whole bunch of sensor APIs, which are all 'different' to the web server API that he was working on previously. Because you're not just dealing with Strings, but with different types, the API is non-orthogonal. Tim's point is that there is a empirical relationship between your 'liking' of types and the API you're programming against. (ie a subjective point is actually objective depending on your context).


title: Documenting and enforcing programming standards and guidelines for shared library

text: Myself and another developer with the go ahead from our IT director have started a general purpose library in .NET with the intention that it will provide many common purpose classes that we use in our day to day development. During discussions and design of the library we have come up with a set of standards that we want the library to follow to ensure it is maintained and expanded on in a consistent manner. What is the best way to ensure these decisions we made for the library get feed to the other developers who might be using and adding to this library in the future. One of our decisions was to ensure we review all checked in code so we expect initially there to be some differences in coding styles of individuals not fitting in with the project standards. Some ideas I had were:   1. Add a Read-me.txt to the project that outline the guidelines and standards   2. Send an email out to everyone in the team to let them know about the project etc   3. Call a team meeting to go through this new project and our expectations and standards we were aiming to follow   4. Try and enforce the standards via Visual Studio (not sure if this would be possible or how just an idea) At the moment there is no general company programming standards so this would be a first really insofar as we are creating a standard that different project teams would need to adhere to.


title: Best way to handle class relationship

text: Take a User class and the idea that a User is to be profiled. I see four ways to handle this:   1. Write the code for the profile into the User class. I am dismissing this right away.   2. Create a Profile class and make it a property of the User class.   3. Write a User class (with the boiler-plate name, address stuff), write a Profile class, and write a UserProfile class - UserProfile is the union of User and Profile.   4. Write a User class and a Profile class that each have an ID property and let the ID act as the intersection. This way the User and Profile are independent and another class, possibly an abstract class with nothing but static methods handles the logic that describes the connection. Choices 3 and 4 each require at least three classes. For this case, which is the best choice? If possible to generalize this, would it generally be better to use one of these possibilities?


title: Is there a way you'd implement a fast tree traversal method that would support dated versioning?

text: I've got a catalog at work and I want to juke it up a bit because I'm tired of it being extremely slow. I'd like to support the modified preorder tree traversal storage method for the category tree of the catalog but i'd have to support dated versionning. I've thought about creating versions of trees based on dates, so as soon as something changes I create a copy of the tree at hand at current date and then create my modifications. But the problem with that is that an import of a catalog that occurs every night would create, at long range, an extremely heavy table of tree traversal elements. Combined with the fact that a user could go and change a date anytime in the admin, it could then again generate another tree version. Most of our catalogs are comprised of 100-250 categories, so a few versions would not create more than a few thousand elements, but mix that to a year of operation, that would easily go up to 90000 entries just to store the tree that can change. So my question is this: Is there a way you'd implement a fast tree traversal method (preferably modified preorder with left and right columns) that would support dated versioning?


title: Dijkstra's example of an ambiguous program

text: Salutations. Dijkstra wrote that even a few lines of seemingly simple code could be hopelessly ambiguous. In at least one work, which I can't find now to save my life, he gave a little example program to demonstrate this ambiguity. Can anybody point me to a paper of his where he includes one of these examples?


title: What responses disqualify a candidate from hiring during the interview?

text: You are in the process of looking for candidates for a software development position, all the resumes are reviewed, and you made a couple of interview invites. Now, the folks show up in the conference room onsite, and you begin the back-and-forth talking about past experience, reviewing the resume, the personal development interests, etc. In your experiences of hiring, what were the responses (and questions) that you wished you had processed better initially that may have stopped you from hiring a poor candidate? I am looking for some _red flags_ to watch out for, and hoping to be discerning enough to not fall into any of this: Is there a correlation between buzz words and ability?


title: Writing Unit Tests for a Class That Starts External EXE

text: I wrote a C# class that is used to start a list of EXEs (not one of mine - third party EXEs I have to run) and keep them running (will check occasionally to make sure it is still running, and start them if not). I am able to test the basic logic of adding, removing, etc fine. How do I Unit Test that the actual work of keeping EXEs will work? My initial thought is to start some dummy EXE that closes itself after 1 second, then use that to test. Is that out of the realm of Unit Testing?


title: Is there ever a reason to do all an object's work in a constructor?

text: Let me preface this by saying this is not my code nor my coworkers' code. Years ago when our company was smaller, we had some projects we needed done that we did not have the capacity for, so they were outsourced. Now, I have nothing against outsourcing or contractors in general, but the codebase they produced is a mass of WTFs. That being said, it does (mostly) work, so I suppose it's in the top 10% of outsourced projects I've seen. As our company has grown, we've tried to take more of our development in house. This particular project landed in my lap so I've been going over it, cleaning it up, adding tests, etc etc. There's one pattern I see repeated a lot and it seems so mindblowingly awful that I wondered if maybe there is a reason and I just don't see it. The pattern is an object with no public methods or members, just a public constructor that does all the work of the object. For example, (the code is in Java, if that matters, but I hope this to be a more general question):               public class Foo {       private int bar;       private String baz;            public Foo(File f) {         execute(f);       }            private void execute(File f) {          // FTP the file to some hardcoded location,           // or parse the file and commit to the database, or whatever       }     }      If you're wondering, this type of code is often called in the following manner:               for(File f : someListOfFiles) {        new Foo(f);     }      Now, I was taught long ago that instantiated objects in a loop is generally a bad idea, and that constructors should do a minimum of work. Looking at this code it looks like it would be better to drop the constructor and make `execute` a public static method. I did ask the contractor why it was done this way, and the response I got was "We can change it if you want". Which was not really helpful. Anyway, is there ever a reason to do something like this, in any programming language, or is this just another submission to the Daily WTF?


title: How best to enable a web service consumer to integration test a transactional web service?

text: I want to allow consumers of a web services layer (web services are written in Java) to create automated integration tests to validate that the version of the web services layer that the consumers will use will still work for the consumer (i.e. the web services are on a different release lifecycle than the consumers and their APIs or behavior might change-- they shouldn't change wihtout notifying the consumer, but the point of this automated test is to validate that they haven't changed) What would I do if the web service actually executes a transaction (updates database tables). Is there a common practice for how to handle this without having to put logic into the web service itself to know its in a unit test and rollback the transaction once finished? (basically baking in the capability to deal with testing of the web service). Or is that the recommended way to do it?


title: Status "Open" and "Reopened"

text: Why issue tracker systems usually have distinct "Opened" and "Reopened" statuses?


title: Is it legal to implement methodologies published in literature by others?

text: Many developers have read Getting Things Done and turned it into an app in one way or another. Some have have even dared to write programs based on other books despite the overwhelming popularity of GTD. Thinking Rock was the first one that I tried out. When you look at all of them out there on various platforms, both desktop and mobile, there have probably been far too many to list by now. Is this legal or are they just getting away with it? I would like to produce a mega-app, an integrated productivity environment, that minimalistically implements not only GTD, but as many books on my bookshelf as possible. This covers a broad range of topics: productivity, time-management, motivation, procrastination, brain/mind improvement, etc. I would also like to throw in ideas I get at random from articles, interviews, and other media. Finally, my personal favorite, I would like to implement the major categories of a game I've been addicted to for about twenty years now as a time-management methodology. Very briefly: **_Growth_** \- exercise, diet, meditation and other related tasks; **_Science_** \- math (Project Euler, Khan Academy), reading fiction and nonfiction, and other brain improving tasks; **_Gold_** \- working a job, selling plasma, balancing your checkbook, and other finance-related tasks; **_Culture_** \- writing, drawing, playing an instrument and other artistic tasks; **_Production_** \- housework, yardwork, routine work, honey-do's and other high-urgency low-priority tasks; **_Wonders_** \- projects of high importance: writing a book, writing a program, writing an album, starting a business, building a sculpture, re- building an engine, etc. I call all of this CivLife. If it makes a difference, I don't intend to profit from it. I would like it to be free/libre/open-source software. Is using the ideas of others like this legal? Would I get away with it? Is it dead in the water? I'm asking because it's an idea that's been stewing in my head for years. I got my BS-IT, but I don't have any experience, so I'm unemployed. I would like to make this program my experience and my life's work, but I don't want it to come back and bite me in the behind. p.s. If this is the kind of open-ended, debate-stirring, not-beneficial-to- everyone question that gets closed, I apologize and would be happy to refactor it.


title: problem in building my portfolio

text: i was working for a company as a php developer since last two years and worked on many websites and now the company is closed along with all of its websites and so i have to look for another company to hire me. But since the websites are down i can't write them on my resume. Actually i have tried that out telling them i worked on these sites but since the company is closed the websites are closed too and they did thought that i am lying and did not hire me. i am really stuck i will have to apply as a beginner and hence won't get much salary and will very hardly get a job (if at all) since some experienced programmers will be competing me. Anyone got a solution? **Edit:** actually you guys are right, i shouldn't work for a company who doesn't trust me. And i like the Josh K's solutions the most, thanks guys :)


title: Google Datastore and deep records

text: I'm in the beginning of creating a website that uses Google Datastore to store information related to clients and I'm curious if the record is too deep for NoSQL or if I'm fine. Essentially I'll be storing details about clients at a fitness business that get's fairly detailed. A completely made up record example could be               {       firstName : "Jon",       lastName : "Doe",       assessment : [         {           date: "2013-01-31",           flexibility:             {               leftShoulder: "12 whatevers",               rightShoulder: "15 somethings",               ...etc...             }           strength:             {               legPress: "100lb",               shoulderPress: "22lb",               ...etc...             }           ...etc...         },         {           date: "2013-02-28",           flexibility:             {               leftShoulder: "13 whatevers",               rightShoulder: "14 somethings",               ...etc...             }           strength:             {               legPress: "110lb",               shoulderPress: "25lb",               ...etc...             }           ...etc...         }       ],       appearance: [         {           date: "2013-04-12",           image: "http://blah"         }         ...etc...       ]       ...lots of other sub items...     }      This record would exist long term for clients and could become a very large record over time. I've seen on MongoDB, which is also NoSQL, has a 16MB limit on a record. While this is is a large amount of space for text and is plenty for big records, I want to make sure this just doesn't indicate that I should be separating these out in regards to NoSQL. Instead, should I be separating out `assessment` and `appearance` records into their own separate records, linked by a _foreign key_ of some sort or does that defeat the purpose of NoSQL? What is the best practice for designing potentially long term, deep NoSQL records.


title: Is user story the best form of requirement in agile project?

text: Statistically speaking, user story maybe the most popular requirement technique in Agile but I am curious to know the alternatives and why.


title: Formal definition of "concepts / type system" for parametric types - Where to start?

text: I would be interested in formally defining (and consequently demonstrating) a "type system" for, well, a type system. More specifically, I would like to explore the idea of what C++ calls concepts for my bachelor's thesis. **How would one go about defining such system (formally) ?** It's basically a meta- language for generic programming I suppose, but all the material I've found so far is basically bound to syntax of a specific programming language. The basic idea is to provide an interface for parametric types. For example:   An argument for the function `foo(T)` is some (unfortunately any) T. (This type is known **statically**.) And, I would like to define an interface for such type, so that this T is actually not any T, but some type that complies to an interface, such as: " _In order for this type to be legal for the function foo, it needs to comply to: This and that concept / interface to statically check against_." Concepts would define related, meaningful "interfaces" that would constrain the type T. Currently, the language C++ doesn't do any such checks, it simply tries to do whatever it is that `foo(T)` does on **any** type and hopes it works. If it doesn't the error message is of length of a decent novel, as the error is detected too late and the compiler needs to "spit out" the entire process of how it got to an error. I would eventually like to show the concept (errm, idea, sorry for the ambiguity) on the C++ specifically, if that's any relevant. Thanks, ~Scarlet


title: How do programmers quit a job?

text: I'm thinking about leaving my current employer and wondering how one goes about that process in the programming world. We have a lot of projects on the go at the moment and I'm the only developer. We have 4-5 projects that are fairly big and need to be done in the next few months and even a few longer than that. I'm leaving because I'm the only employee and that's doing me no good. I'm young and want to learn, so a team would be nice. It's also too much work and the company is managed horribly. I have no contract to worry about so I could theoretically quit and just not come back without notice. Just wondering how this is _normally_ handled.   * Should I write a resignation letter   * How much notice should I give   * Should I give a reason for leaving   * Should I go to my boss who is the main reason I'm leaving or go to his boss? **Overview of replies** From the feedback here, it looks as though it's best to give 2-4 weeks of notice, and present a written resignation. Don't go into detail explaining why you're leaving in most cases. Don't burn bridges. Be professional.


title: More code = more bugs

text: Back in college I remember a professor teaching the class one of the laws of computer science. He said something like "More code equals more bugs" and gave it a name (The Law Of Whatchamacallit) and attributed it to someone. Does anyone know where this "law" comes from, who said it or what it's original verbiage is?


title: Ruby on Rails and DRY

text: I've started to learn a little ROR and everthing I read says that ROR espouses the DRY principle and they seem to imply that this is a big thing that makes ROR different from other languages/frameworks. What language _does_ encourage duplicate code?


title: Should I forward the a call to .Equals onto .Equals<T>?

text: So, I've got you bog standard c# object, overriding Equalsand implementing IEquatable                   public override int GetHashCode()         {             return _name.GetHashCode();         }              public override bool Equals(object obj)         {             return Equals(obj as Tag)         }              #region IEquatable<Tag> Members              public bool Equals(Tag other)         {             if (other == null)                 return false;             else                 return _name == other._name;         }              #endregion      Now, for some reason, I used to think that forwarding the calls from Equals into Equals was bad, no idea why, perhaps I read it a long time ago, anyway I'd write separate (but logically same) code for each method. Now I think forwarding Equals to Equals is okay, for obvious reasons, but for the life me I can't remember why I thought it wasn't before. Any thoughts?


title: TDD/Tests too much an overhead/maintenance burden?

text: So you've heard it many times from those who do not truly understand the values of testing. Just to start things out, I'm a follower of Agile and Testing... I recently had a discussion about performing TDD on a product re-write where the current team does not practice unit testing on any level, and probably have never heard of the dependency injection technique or test patterns/design etc (we won't even get on to clean code). Now, I am fully responsible for the rewrite of this product and I'm told that attempting it in the fashion of TDD, will merely make it a maintenance nightmare and impossible for the team maintain. Furthermore, as it's a front- end application (not web-based), adding tests is pointless, as the business drive changes (by changes they mean improvements of course), the tests will become out of date, other developers who come on to the project in the future will not maintain them and become more of a burden for them to fix etc. I can understand that TDD in a team that does not currently hold any testing experience doesn't sound good, but my argument in this case is that I can teach my practice to those around me, but further more, I know that TDD makes BETTER software. Even if I was to produce the software using TDD, and throw all the tests away on handing it over to a maintenance team, it surely would be a better approach than not using TDD at all from the start? I've been shot down as I've mentioned doing TDD on most projects for a team that have never heard of it. The thought of "interfaces" and strange looking DI constructors scares them off... Can anyone please help me in what is normally a very short conversation of trying to sell TDD and my approach to people? I usually have a very short window of argument before falling at the knees to the company/team.


title: Is throwing an error in unpredictable subclass-specific circumstances a violation of LSP?

text: Let's say I wanted to create a Java `List<String>` (see spec) implementation that uses a complex subsystem, such as a database or file system, for its store so that it acts as a persistent collection rather than an in-memory one. So here's a skeleton implementation:               class DbBackedList implements List<String> {       private DbBackedList() {}       /** Returns a list, possibly non-empty */       public static getList() { return new DbBackedList(); }       public String get(int index) {         return Db.getTable().getRow(i).asString();  // may throw DbExceptions!       }       // add(String), add(int, String), etc. ...     }      My problem lies with the fact that the underlying DB API may encounter connection errors that are not specified in the List interface that it should throw. My problem is whether this violates Liskov's Substitution Principle (LSP). In his paper on LSP, Bob Martin actually gives an example of a PersistentSet that violates LSP. The difference is that his newly-specified `Exception` there is determined by the inserted value and so is strengthening the precondition. In my case the connection/read error is unpredictable and due to external factors and so is not technically a new precondition, merely an error of circumstance, perhaps like OutOfMemoryError which can occur even when unspecified. In normal circumstances, the new Error/Exception might never be thrown. (The caller could catch if it is aware of the possibility, just as a memory- restricted Java program might specifically catch OOME.) Is this therefore a valid argument for throwing an extra error and can I still claim to be a valid `java.util.List` (or pick your SDK/language/collection in general) and not in violation of LSP? _**Edit:** This argument might be more palatable if you consider a `FileBackedList` (more reliable "connection") rather than a `DbBackedList`._ If this does indeed violate LSP and thus not practically usable, I have provided two less-palatable alternative solutions as answers that you can comment on, see below. * * * **Footnote: Use Cases** In the simplest case, the goal is to provide a familiar interface for cases when (say) a database is just being used as a persistent list, and allow regular List operations such as search, subList and iteration. Another, more adventurous, use-case is as a slot-in replacement for libraries that work with basic Lists, e.g if we have a third-party task queue that usually works with a plain List:   `new TaskWorkQueue(new ArrayList<String>()).start()` which is susceptible to losing all it's queue in event of a crash, if we just replace this with:   `new TaskWorkQueue(new DbBackedList()).start()` we get a instant persistence and the ability to share the tasks amongst more than one machine. In either case, we could either handle connection/read exceptions that are thrown, perhaps retrying the connection/read first, or allow them to throw and crash the program (e.g. if we can't change the TaskWorkQueue code).


title: Does facebook store multiple password hashes for each user?

text: I noticed that Facebook allows multiple variants of my own password :   * My password as it is.   * My password with first letter capitalized.   * My password with all letters capitalized. It is commonly known that passwords are stored as hashes. So my question is, does facebook store multiple hashes for each user? Since the hash of each variant should be completely different... Or am I missing something, here? And there may be more combinations, besides the one I observed as well. This is obviously done to provide a better user experience & they probably have a statistical explanation of people repeating these mistakes. But I could not help but wonder, is it worth to increase so many lookups (in their database) just to help the user type a wrong password? On top of this, they warn about the caps lock (even though they don't seem to care) : ![enter image description here](http://i.stack.imgur.com/KEtG4.png) * * * I found these two relevant links in this regard:   * How much security is compromised if we accept other characters as login.   * Facebook passwords are not case sensitive (update)


title: Can decoupling hurt maintainability in certain situations?

text: Can the fact that the business logic is mapped to interfaces instead of implementations actually hinder the maintenance of the application in certain situations? A naive example with the Java's Hibernate framework would be, that for example (provided I don't have the whole code-base in my head, the project structure is a mess and classes are named with arbitrary names) if I wish to see what's going on in a certain DAO, to see if it actually is doing what it's supposed to do, then instead of traversing backwards up the tree from the point where the data service is invoked (where the tree will end in an interface with no implementation details whatsoever apart from the signature) I have to for example go and look for a configuration XML file to see which class is mapped to said interface as the implementation before being able to access the actual implementation details. Are there any situations where having loose coupling can actually hurt maintainability?


title: According to software engineering which method are too long?

text: I was just working with a method of about 70 lines of code developed by others. It uses a very nice pattern structure, stuff like IOC container, but I wonder.. The method is too long? Is it a so long method still easily readable? The question could be finished, but now starts the premise from which my question has originated. * * * Before realizing its length (excessive for me) I was getting bored while trying to understand what it was doing. It's full of instruction of this kind:               if (success == null)     {         //Log response error         logger.LogProviderActionResponse(userId, "actionName", transactionRequestId,             _configuration.ResponseLogErrorTryAgainId, xmlResponse.InnerXml.ToXml(true));         return new CheckActionResult(ActionStatus.Failed);     }      What is it doing and why? It deals with logging of course, because the `success` variable is null, but what does it imply? And also there are many parameters, what is their meaning? I would need to read it carefully, to study it. The problem is that this method implements an interface and an abstract class, it has many siblings. Copy and pasted siblings which share the same structural behavior. But it's not immediate to distinguish structural information from domain specific information. In developing a new action or a new provider I should only need to copy, paste and modify **domain specific** stuff. But it's hard.. since they are deeply mixed together with structural behavior... ## Refactoring I would do to raise the readability   * ### 1st step surround all this logging with a #region that can be collapsed   * ### 2nd step could be to use Extract Method to trasnsform the previous log call to a single instruction. Something like: Log.LogWithReason(Success.IsEmpty); But the usage of return conflicts with this purpose requiring extra effort.   * ### 3rd step would be to completely separate the Logging responsability (using AOP? Implementing it in the base class? using events?). If one method has 5 / 8 calls to the log for different reasons. It's too much aware of logging. In my opinion the Single responsibility principle is violated since the methods has gained the secondary responsability of being strongly aware about logging. * * * The question remains the one specified in the title but I hope to read a very mature comparison here based on the seeds idea I've wrote! Thanks for your contribute


title: Should a code review be different for front-end web developers?

text: Web developers code in a minimum of four languages (HTML, CSS, JavaScript, and a server-side language), must produce a working result in several different browser implementations, and may work on the top of a custom software stack that they don't control.   * How should a code review take these things into account?   * Should a code review include all parts of a front-end project (HTML and CSS as well), or just focus on the logic?   * How should a code review handle workarounds for browser- or stack-specific problems?


title: Protecting your interests as a freelance web designer

text: What is the best way to protect your interests as a freelance web designer when:   1. The client is unresponsive and takes a long time to make decisions    2. The client makes constant changes   3. Feature creep


title: Getting involved in an open-source Python-Java project

text: I'm a first-year PhD student in Ireland. My background is in mathematics, though I'm going to stream my career into programming with Python, Java and C++ languages. I have some good experience with C++ what allowed me to have a presentation in Europe quite recently - I participated in an open-source cloud computing project. I used Python a little bit in this project, though mainly it was in C++. I was reading a beautiful "Thinking in Java" book this summer while looking for a PhD. I have no experience in Java. I learned some Python while writing a website based on Django. I love programming languages since my childhood - I started with Pascal and C. Since then I have not been programming all the time of course. I know some other auxiliary tools like Git, SVN, SQL, XML and javascript. I want to take my concentration in hands and remember design patterns by the way. Now... I have earned some money to have food for 2 years. I really want to find a job, but there is no interesting job on the market or my skills are not enough to get one. So I really want to learn Python and Java in parallel by reading books (have already chosen proper ones), searching google (got used to it) and most important writing code and thus I think to participate in an open-source project again. Could you please list me 2 or 3 projects in Python and/or Java which are currently active (vivid) and useful?


title: Did I understand the website "autologin" feature right?

text: I'm developing an authentication library (*) for a website and I realized that maybe I'm not completely understanding what an "autologin" feature is, and how to develop it. While gathering infos and studying other code I came across a couple of libraries which implement the option to login the user without having to sign in (these libraries are Tank Auth and Ion Auth, built for the PHP framework CodeIgniter); basically they work on creating a cookie which, in case the user is not logged (session datas are not set) but this cookie is found, it allows them to login nonetheless. Ok, so far it's clear. What I don't understand, though, is why both library _delete_ the autologin cookie when the user logs out. I mean: I log in, I check the "remember me" option (**), I do what I need to do in my admin panel, then I log out; if the autologin cookie is deleted, next time I'll have to log in again by filling the form, ignoring the option I flagged. What's its purpose then? I thought this "autologin" would be an extendend login which allowed me to _avoid_ having to fill in the sign in form again. So I went on and developed my autologin feature, but of course I bumped into the problem of not being able to logout _at all_ , as I'm not deleting it. So I log out, redirect to the home page, then go to the admin panel and the system logs me in...well, it works as expected, but I'm not sure if this is how it's meant to be...How should this be done correctly? Can someone explain to me how this actually should work? I'm getting a bit confused P.S. Don't know if this is the right place to ask it, or if SO is a better fit; I'm sorry if I posted on the wrong SE site. (*) Please don't tell me _"don't reinvent the wheel"_ or any variant of it; I'm doing this to learn and I'm planning to make it an open source project for the public amusement, so I volutarily _do_ want to reinvent the wheel, at the cost of making it oval. (**) I think I guessed the difference between the "remember me" option and the "autologin" feature; so far, I didn't consider the first one ( 1-because many browsers ask you to do that nonetheless; 2-because I don't know how to do it right, i.e. how to have the login fields automatically filled without this posing the security threat of having the password stored in clear text inside a cookie), but please tell me if I misunderstood this also..


title: How should I host our scalable worker processes?

text: We are designing a new architecture for an enterprise business. The principles we've followed so far is not to develop what you can (possible buy and) deploy, ie, don't reinvent any wheels. In this way we've decided on CQRS, RabbitMQ, Riak and a bunch of other things. We still need to write /some/ business code though and these will be in the form of worker processes, which will consume commands from a message queue and after any side-effects, produce events onto another message queue. The idea behind this is that via the competing-consumers design we will have a scalable design right out of the box. One option is of writing a management infrastructure that will know how to:   * deploy code   * instantiate processes   * kill processes   * update configuration   * etc IE provide fault tolerance and scalability. Also, this is exactly what something like GAE and Heroku does for you, but in a public setting and in our organization, public is bad. My question is, is there an out-of-the-box solution that we can use to host our consumers in? Like a private cloud or private platform-as-a-service. Private Heroku or GAE. Is there some kind of software or software product with which we can do all of these things and thereby get scalability and fault tolerance over our consumers?


title: How to adhere to the open-closed principle in practice

text: I understand the intent of the open-closed principle. It's meant to reduce the risk of breaking something that already works while modifying it, by telling you to try to extend without modifying. However, I had some trouble understanding how this principle is applied in practice. To my understanding, there are two ways to apply it. Beofore and after a possible change:   1. Before: program to abstractions and 'predict the future' as much as you can. For example, a method `drive(Car car)` will have to change if `Motorcycle`s are added to the system in the future, so it probably violates OCP. But the method `drive(MotorVehicle vehicle)` is less likely to have to change in the future, so it adheres to OCP. However, it's quite difficult to predict the future and know in advance what changes are going to be made to the system.   2. After: when a change is needed, extend a class instead of modifying it's current code. Practice #1 isn't hard to understand. However it's practice #2 that I'm having trouble understanding how to apply. For example (I took it from a video on YouTube): let's say we have a method in a class that accepts `CreditCard` objects: `makePayment(CraditCard card)`. One day `Voucher`s are added to the system. This method doesn't support them so it has to be modified. When implementing the method in the first place we failed to predict the future and program in more abstract terms (e.g. `makePayment(Payment pay)`, so now we have to change the existing code. Practice #2 says we should add the functionality by extending instead of modifying. **What does that mean? Should I subclass the existing class instead of simply changing it's existing code?** Should I make some kind of wrapper around it just to avoid rewriting code? **Or does the principle not even refer to 'how to correctly modify/add functionality', but rather refers to 'how to avoid having to make changes in the first place (i.e. program to abstractions)?**


title: PHP, Python, C# for web and desktop applications

text: I am a 10 year PHP developer. Just recently I have taken a little bit of an interests in C# after seeing that you can build native Windows desktop programs as well as build sites like Stackoverflow. It's like the best of both worlds. Now recently I started using a text editor many know of called SublimeText which is coded with C++ and has Python embedded so that the users can create almost anything in Python and use it as a plugin for this text editor, I never seen anything like that. This got me looking into Python, as I had always thought Python was just like another language similar to PHP ( a scripting language mainly for the web) but now I am seeing that you can create Desktop programs that work on any OS, make web apps like you can in PHP so it's almost like what you can do with C# but with the added benefit of being multi- platform Now this is no way a One Language vs Another Language debate, I am simply trying to find out more about how these foreign languages to me compare:   * PHP is scripting    * Python I think is scripting    * C# has to be compiled?  Python can be used to build anything C# can? Including fast desktop applicaions, can Python application be compiled into an EXE file or how does that work to use Python program on Windows? Please help me understand I have been stuck in the PHP world for a long time I have never ventured out past Javascript, PHP web stuff Also I am aware that PHP can be used to make GUIs but from what I have read, they are not that good or it is not that good for doing them, something like that.


title: Hotswap and alternatives?

text: Since the early days of my college life I have been using Java and biggest problem that we have is absolutely being less productive than other interpreted languages. All people are sure that java is one of the best compiled language. However, neither Sun nor Oracle has put enough effort in to solve this problem. One of the problem is, of course, class reloading. Latest attempts from community to solve this problem are DaVinci Hotswap project, JRebel, PlayFramework. However, at the time of this writing they were still not mature (imo) and native. Some of them are not enterprise ready, some of them are not compatible with all IDEs, some of them are immature universtiy projects. The road map and even developer ready Java is ready, but the Java community still does not have a solution for on the fly class reloading. Is it so difficult for Oracle to put effort forth to solve this problem? Why has class reloading not been implemented natively yet?


title: What are the legal requirements for verifying a user's age? (United States)

text: I'm working on a website where we expect many of our users to be under 18. Our lawyer told us that anyone under 18 will need their parents to agree to the Terms of Service, since they aren't legally able to do it themselves. So my question is, how thoroughly do we need to verify a user's age? Is it enough to just ask them?


title: What are good resources for preparing to answer web development interview questions?

text: The standard programmer interview books and websites go over simple algorithm and coding questions. But how does one prepare for high-level questions on building websites? For example, "How would you build website X? What data structures would you use? etc." Is there a good site or book to read that reviews such material?


title: variable overwriting in PHP

text: For example I have this code:               $route = 'product/category';          //variable overload     $type  = explode('/',$route);     $type  = $type[1];      My thinking behind this is that I actually don't need unique variable name for exploded variable, so why not to overwrite? Is this really bad concept? Or is there some more elegant way to write this?


title: May I make an installer bundle GPL and payware together?

text: I have an affiliate marketing client who needs to know if I can program this. Can I do one or both of the following scenarios without violating the GPL license? Scenario A: Make a software installer for a GPL licensed product which includes source, binaries, and license info. The installer also has a checkbox for installing optional software that's payware. (In this case, the payware is free crippleware, but has a registration upsell to provide more features.) The two products will not share libraries or anything else. Scenario B: Same as A, but reversed. So, the installer installs the payware, but there's a checkbox to also install the GPL software. And, again, when you install the GPL software, it comes with binaries, source, and license info.


title: Can you reference one data value by a name throughout a stylesheet?

text: For example, I'm changing color pallettes throughout a site i'm coding and would love it if i could reference that color somehow instead of replacing the hex value for every item. I know the following doesn't work but i'd like something similar.               color1 = red;     color2 = blue;     color3 = green;          h1 {     color: color1;     background-color: color2;     }          h2 {     color: color2;     background-color: color3;     }


title: Why would you create a deployment script in PowerShell when you have TFS?

text: I'm experimenting with automatic deployment / continuous integration and had a talk with my team lead. I told him I'm investigating creating build/deployment scripts in PowerShell and he said automatic deployment is very easy to set up in TFS using a GUI and I should research that instead. I have zero experience with TFS except for commiting to source control from VS. In which situations would TFS fail and would you be better off with PowerShell for automatic deployment? What other reasons and advantages are there to choose PowerShell instead of TFS? And another thing: Could I run a third party tool that, for example, minifies JS files from TFS? Some advantages of PowerShell I could think of:   * PowerShell offers maximum flexibility   * You can easily switch to another source control system such as Mercurial   * The scripts will be easier to maintain than what TFS generates   * PowerShell is light weight: you can run the script on any PC


title: Is cloud computing just a way of renting resources?

text: The company I work at recently hosted a web service in Windows Azure and announced that. Now trade online magazines say lots of meaningless stuff like "company X moves to the cloud", "company X drops desktops for the cloud", etc. Looks like there're lots of materials out there (starting with Wikipedia) that are very lengthy and talk a lot about "services" and "low entry price" and other stuff but I've read all that and don't see how they could be helpful for a layman in drawing a line between a service in a cloud and Stack Exchange that is also a service but is run on brick-and-mortar servers in a colocation. Now from my experience with Windows Azure the real difference is the following. With a cloud the service owner rents hardware, network bandwidth and right to use the middleware (Windows 2008 that is used in Azure roles for example) on demand and also there's some maintenance assistance (like if the computer where a role is running crashes another computer is automatically found and the role is redeployed). Without a cloud the service owner will have to deal with all that on his own. Will that be the right distinction?


title: How does one manage an intern effectively?

text: An intern will be starting with us soon for a couple months before going off to university. The intern is straight-out of high school and has some programming experience, but has never taken a university level computer science course or held a programming job. In addition, the intern has never used 99 percent of the technologies at our shop. As team lead/manager, I know there are a hundred different programming tasks that the team needs to get done. I don't want to overload the intern, but I still want the intern to be useful. From someone that has had a similar experience how did you manage the intern in regard to:   1. Did you micro-manage the intern or were you easygoing?   2. Did you explain parts of the code-base or leave it up to the intern to figure out?   3. Did you give the intern access to source-control or did you manually commit their changes after checking them?   4. Did you enforce coding standards/rules? Please answer the questions and mention what you thought worked best for 1-4. Did I forget anything?


title: Effective Mentoring Criteria

text: What should be the basic things that should a mentor or team lead or anyone (experienced) in the team do to groom up or mentor a newly joined developer?? -


title: Programming IDEs feature to add a forgotten open parentheses?

text: I very often find myself in situations where I should have opened a parentheses, but forgot and end up furiously tapping the left arrow key to get to the spot I should have put it, and doing the same to get back to where I was - that, or removing one hand from the keyboard to do it with the mouse. Either way, it's a stupid mistake on my part and a poor use of time going back to fix it. For example, if typing something like               var x = 100 - var1 + var2;      I might get to the end of the statement and realize I wanted to subtract the sum of var1 and var2 from 100 and not add var2 to the difference of 100 and var1. I can't really expect an IDE to prevent my mistakes, but I was thinking there could be a simple enough feature that would save time when they're made. Specifically, some kind of function that, after a closing parenthesis is added where there isn't an opening one, would start ghosting in an opening parenthesis at different statements and allow the user to switch between them. For example: Say you have the following statement:               var x = oldY * oldX + newY / newX - left - right;      If you put a closing parenthesis after `right` and pressed the shortcut, the IDE would do: `var x = oldY * oldX + newY / newX - **(** left - right);` press left, and then: `var x = oldY * oldX + newY / **(** newX - left - right);` ...then: `var x = oldY * oldX + **(** newY / newX - left - right);` Anyway... Does this feature exist? If not, should it exist? What do senior programmers do when this happens?


title: How should I add functionality to an object that already exists?

text: I have an interface that has a certain amount of well-defined functionality. Let's say:               interface BakeryInterface {       public function createCookies();       public function createIceCream();     }      This works well for most implementations of the interface, but in a few instances, I need to add some new functionality (like perhaps rolled into a new method, `createBrownies()`). The obvious/naive approach to doing this would be to extend the interface:               interface BrownieBakeryInterface extends BakeryInterface {       public function createBrownies();     }      But has a pretty big downside in that I can't add the new functionality without modifying the existing API (like changing the class to use the new interface). I was thinking about using an adapter to add the functionality after instantiation:               class BrownieAdapter {       private brownieBakery;            public function construct(BakeryInterface bakery) {         this->brownieBakery = bakery;       }            public function createBrownies() {         /* ... */       }     }      Which would net me something like:               bakery = new Bakery();     bakery = new BrownieBakery(bakery);     bakery->createBrownies();      This seems like a good solution to the problem, but I'm wondering if I'm awakening the old gods by doing it. Is the adapter the way to go? Is there a better pattern to follow? Or should I really just be biting the bullet and just extending the original interface?


As the title says, **How important is Discrete Mathematics for a Computer Scientist?** Background: I'm pursuing a Master's degree with a focus on fundamentals such as Algorithms, Complexity and Computability Theory and Programming Languages to get a good foundation for working in the field of Parallel Computing. Some more background: My university grants a lot of freedom in the choices of courses for my Master's degree. It's officially called "Software Engineering", but due to a the broad range of electives, a different focus is possible. Interestingly, none of the electives is a lecture in Math! I'm thinking about doing a course about Discrete Mathematics that would take half a semester to complete successfully, even if I can't use it for my degree. So with this question I'm trying to find out if the effort is justifiable.


title: Can I use a dual license in my commercial Website

text: I have set up a web application which is of commercial use. This application had to make use of the plugin(which is not downloaded from http://plugins.jquery.com) I downloaded this plugin from http://jquery.malsup.com/cycle2 Kindly, let me know if I could use this plugin in my commercial website. If I do, would it cause any consequences in future? Though, I could see few answers here, I would like to Insist upon itself on this as of critical importance. Licensing Terms


title: Boring but important niches that would be a best-practices-consulting gold mine

text: I am absolutely convinced that you one make a very good living as a consultant that helps customers with deep understanding of and practical knowledge in one of the following topics   * Time zones, daylight saving time and leap days/seconds in software processing any kind of events   * Character encodings  Both are small niches hard to get right if you are lacking knowledge and profound experience but come up in many projects. Hence, there would be customers who want to avoid mistakes, and those who have messed things up and need help urgently. However, those topics are unsexy and probably full of many details that most would find boring, but I know that there are people out there who thrive on solving hard problems of any kind. So my questions are:   * What are similarly bland but important and highly specific niches in the kind of software you develop?   * Do you know people that actually do consulting on one of these topics? Edit: I'm talking about a skill level that goes beyond being able to build a decent implementation on your own -- to be able to quickly bring a system towards best practices after other people have really messed it up. The latter is not something you can quickly pick up. Oh, and btw: I'm not thinking about moving into these areas, and wouldn't do it for a lot of money. That's exactly why I think that this boring kind of stuff could earn somebody a good living.


title: Should programmers be fluent users of office suites?

text: As a .NET/web developer, my daily works mainly involve with Visual Studio, FireBug, SQL Server,..., and I'm quite fluent at them. The problem is, my Office (Microsoft Office in particular, and office software in general) skills are bad. I _can_ use them, of course, but at basic level. I can write documents, create presentations, but I can just type/edit/delete in Excel, but any _advanced_ features. My question is: is it tolerance for a programmer, like me, to be bad at office software?