How do you go about checking your open source libraries for keystroke loggers?

A random person on the internet told me that a technology was secure(1), safe to use and didn't contain keyloggers because it is open source. While I can trivially detect the key stroke logger in this open source application, what can _developers_ (2) do to protect themselves against rouge committers to open source projects? Doing a back of the envelope threat analysis, if I were a rogue developer, I'd fork a branch on git and promote it's download since it would have twitter support (and a secret key stroke logger). If it was an SVN repo, I'd create just create a new project. Even better would be to put the malicious code in the automatic update routines. (1) I won't mention which because I can only deal with one kind of zealot at a time. (2) Ordinary users are at the mercy of their virus and malware detection software-- it's absurd to expect grandma to read the source of code of their open source word processor's source code to find the keystroke logger.


Understanding how variable assignment works

When I started learning C programming a few years ago, my tutor taught me similar to most of the tutors around the world. She said me the very basic things like any int datatype is of 2 bytes memory. If the following is my code,               #include"stdio.h"     #include"conio.h"     void main()     {         clrscr();         int i,n;         n = 0;         for(i=0;i<3;i++)             n = n + i;         printf("%d",n); //obviously it prints 3         getch();     }      she will explain like what I have written below. Here my teacher starts off her class yet again. . . > Listen students. Here we have two integer values. So let us draw two boxes > each of 2 bytes memory.The first box be the memory space of **i** and the > second box be that of **n**. At `n = 0;` 0 gets stored into the box n. As > the control gets into the loop, 0 gets stored into the box i intially. > > `0` `0` > > Now the condition is checked. i < 3\. Condition gets true. So now the value > of n changes from 0 to n+i i.e., 0+0=0. The first iteration then ends after > the increment statement. Now i gets incremented to 1. So our picture becomes > like this. > > `1` `0` > > And now i < 3 again. Condtion gets true. n changes from 0 to n + i i.e., > 0+1=1. Don't forget the increment my dears. Only then our iteration gets > completed. i++ makes our i to 2 now. And the picture will now look like > > `2` `1` She will go on similarly step by step and will complete when both the boxes get 3, 3 values. > So thats it kids. After we get our boxes like this > > `3` `3` > > the value of n gets printed on the screen. > > **3** By that time, I was merely like a kid nodding its head when a teacher claims earth as a circular mass. I never asked her any questions. I felt logically she was perfect. But now I am plentiful of queries. If there is a statement like `n = n + i;`, won't there be a conflict as both the destination space and the operation space is the same n box? Will the operations be done with the help of any default temporary space for calculations? What will happen if I use a recursive code like the following snippet.               int factorial(int n)     {         if(n < 2)         {             return n;         }         else         {             n = n * factorial(n - 1);             return n;         }     }      How could it be possible to use a single n box as my tutor taught? Won't a new n box be created whenever `factorial(n - 1)` is called? If I am right, how could the computer know which n box value to be returned? Somebody help me please. I am pulling of hairs from ma head!


Where does the term 'serialization' come from?

In order to convert e.g. a python object to json you would use a serializer. As far as I understand it, serialization leaves the possibility to change the converted object back to the original. Where does the term `serialization` come from/why is the process called `serialization`?


Using configuration to determine whether to handle exception or bubble it up

On a side project I'm working on I came up with a way of handling exceptions that's adjustable by configuration. So a try/catch block might look like this:               try     {         fileHelper.MoveFile(file, destFolder);     }     catch (IOException ex)     {         if (exceptionHandler.HandleException(ex))         {             return ResultCode.Fail;         }         throw;     }      The granularity of exception handling is controlled through an `enum` that's set in the app.config file:               public enum SystemFailureMode     {         AlwaysThrow = -1,         Aggressive = 0,         Standard = 1,         Lenient = 2     }      This determines whether an exception is "handled" and returned as an error, or if it bubbles up and crashes the system. At first I thought I'd uncovered a new design pattern but now it seems like it's probably an anti-pattern. What do you guys think? * * * After reviewing the comments and thinking about it myself, I've decided this is definitely an anti-pattern. The fact that this has the potential to turn writing unit tests into a nightmare is enough to turn me off of it.


Is there a way to find out what API's to use for developing a third party app

My company uses an application called TotalHRWorks for time keeping and what not. They have an Android and iOS application; however, there is no Windows Phone application. Since there is an Android and iOS app, I figure that I should be able to create a Windows Phone app; but I don't know where to start with trying to discover maybe their web service or whatever APIs that I could use to make it. I don't know whether this can be done or if it's "legal" to do such things - but it would be really handy to have.


Is Test Driven Development in Javascript helpful for front-end developers?

I really need your advice. I'm reading a few articles about TDD in JavaScript but I'm really struggling to understand how to use it in my daily work. For instance I'm currently working on a page that has an accordion and each item of the accordion has dynamic contents populated through a JSON object. The JSON object is provided by a third party. I'm using jQuery. My way of testing so far is called console.log :)   * What kind of tests should I write?    * Does TDD make sense for this kind of application of is meant for something else?  Sorry for the noob question but I'd really appreciate your opinion


Web application to a multiplatform phone app

I'm really lost here so I hope some can help me. I have to develop a phone application on every platform so i tough of using phonegap. Seems pretty nice. I have a web application coded in classic Asp and it's this webApplication that i need to strip down to be a phone app. At first at thought it will be simple, my classic Asp render some html so phonegap is able to put it as an app. But it's not that simple, because in my asp I have some code that is rendered server side, I've talked to some who tell me that some html could call the asp pages and this html could be used in phonegap. Don't think it's possible ... Well if someone could help me here, maybe i've said wrong thing in my little text dont hesitate to correct me :) My solution (i think) : code some webServices in asp.net that will use the same database as my asp classic web application. And some html and jquery will call the webservices and those html and jquery will go trough phoneGap Well thanks for the help and saying what you think about it ! :) **Simple question : What is the best way to transfer an asp classic web app to a multiplatform phone app ?**


maintaining a growing, diverse codebase with continuous integration

I am in need of some help with philosophy and design of a continuous integration setup. Our current CI setup uses buildbot. When I started out designing it, I inherited (well, not strictly, as I was involved in its design a year earlier) a bespoke CI builder that was tailored to run the entire build at once, overnight. After a while, we decided that this was insufficient, and started exploring different CI frameworks, eventually choosing buildbot. One of my goals in transitioning to buildbot (besides getting to enjoy all the whiz-bang extras) was to overcome some of the inadequacies of our bespoke nightly builder. Humor me for a moment, and let me explain what I have inherited. The codebase for my company is almost 150 unique c++ Windows applications, each of which has dependencies on one or more of a dozen internal libraries (and many on 3rd party libraries as well). Some of these libraries are interdependent, and have depending applications that (while they have nothing to do with each other) have to be built with the same build of that library. Half of these applications and libraries are considered "legacy" and unportable, and must be built with several distinct configurations of the IBM compiler (for which I have written unique subclasses of `Compile`), and the other half are built with visual studio. The code for each compiler is stored in two separate Visual SourceSafe repositories (which I am simply handling using a bunch of `ShellCommand`s, as there is no support for VSS). Our original nightly builder simply took down the source for everything, and built stuff in a certain order. There was no way to build only a single application, or pick a revision, or to group things. It would launched virtual machines to build a number of the applications. It wasn't very robust, it wasn't distributable. It wasn't terribly extensible. I wanted to be able to overcame all of these limitations in buildbot. The way I did this originally was to create entries for each of the applications we wanted to build (all 150ish of them), then create triggered schedulers that could build various applications as groups, and then subsume those groups under an overall nightly build scheduler. These could run on dedicated slaves (no more virtual machine chicanery), and if I wanted I could simply add new slaves. Now, if we want to do a full build out of schedule, it's one click, but we can also build just one application should we so desire. There are four weaknesses of this approach, however. One is our source tree's complex web of dependencies. In order to simplify config maintenace, all builders are generated from a large dictionary. The dependencies are retrieved and built in a not-terribly robust fashion (namely, keying off of certain things in my build-target dictionary). The second is that each build has between 15 and 21 build steps, which is hard to browse and look at in the web interface, and since there are around 150 columns, takes forever to load (think from 30 seconds to multiple minutes). Thirdly, we no longer have autodiscovery of build targets (although, as much as one of my coworkers harps on me about this, I don't see what it got us in the first place). Finally, aformentioned coworker likes to constantly bring up the fact that we can no longer perform a full build on our local machine (though I never saw what that got us, either, considering that it took three times as long as the distributed build; I think he is just paranoically phobic of ever breaking the build). Now, moving to new development, we are starting to use g++ and subversion (not porting the old repository, mind you - just for the new stuff). Also, we are starting to do more unit testing ("more" might give the wrong picture... it's more like **any** ), and integration testing (using python). I'm having a hard time figuring out how to fit these into my existing configuration. So, where have I gone wrong philosophically here? How can I best proceed forward (with buildbot - it's the only piece of the puzzle I have license to work on) so that my configuration is actually maintainable? How do I address some of my design's weaknesses? What really works in terms of CI strategies for large, (possibly over-)complex codebases? **EDIT:** I thought I explained my problem, but obviously I wasn't clear enough. I am _not_ looking for suggestions for changing CI platforms. It is **not** going to happen, and answers suggesting that will not get accepted. What I _want_ to know is how other people manage complicated codebases using CI. I have a **dozen squared** different products, and I have dependencies scattered to the wind, and they're all different. THIS is what I want to know how to deal with.


Which tool to use for creating application releases?

I'm wondering what others use as a tool for creating the final package to hand over to the customer. For now, these are the tasks it should perform for our company:   * build a set of VS projects (C#,C++); which set depends on configuration on commandline of preferrably in a file   * copy some of the outputs (dll,exe) and header files; should again be configurable: not all customers get the same functionality)   * make a zip file for each configuration Additional features that are not yet needed now, but might be in the future:   * upload it to a website of some kind (we're still not sure what we're going to use.. might be ftp or vesrionsing system). Well, actually, it would be awesome if the tool could create an entry on a Confluence page.   * instead of zip files we might switch to installers, though that shouldn't change too much I guess Right now I have the first steps covered in a batch file that takes some arguments, and a master batch file that calls it for each configuration. It works, but I can't get used to the batch syntax and I'm now building by invoking devenv.exe which seems slow and is error-prone as it takes the .suo file into account. I was thinking about doing everything again in msbuild, but first I'd like to hear more opinions on this. I'd also want to know what kind of tools big companies use for large products.


Books on custom iPhone interface development?

I have been looking around for a book on designing and developing custom interfaces for iOS but I don't seem to be able to find any books on this topic and I was wondering if anyone here knew of any books on the design and development of custom iOS interfaces and applications. Also, I am not aware of any other questions asked on this site, so if there is, please do let me know and I'll vote to delete :) Thanks in advance!


Where to keep track of batch editing scripts?

It is sometime useful to write a script to perform a batch editing on several files in a source tree. Such a script is usually very specific and used only once. Such scripts can be used to rework some identifiers in code, modify file header comments, edit the path of a resource or the like. I want to stress that I am concerned by the case where the script addresses an exceptional problem, so that it does not fit in the usual workflow of the project. I think it is important to keep record of these scripts and reference the usage of the script in the RCS logbook. Where is the appropriate place to keep this record? Should they be added to the commit description in the RCS logbook? Should they be added to the ticket description of the item being processed when they are used? Should they be saved as regular files in the project and added to the RCS, despite the fact their usage is deemed to be unique? Is there another way?


Regarding interpreters

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.


Where should I define constants in scripts?

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.


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

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.


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

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.


Classless tables possible with Datamapper?

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.


Empty virtual method on base class VS abstract methods

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?


Can a system be 100% Data Driven?

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?


Language that embraces mutable state?

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.?


How can Scrum be adapted to a Volunteer setting?

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?


Should I redo an abandoned Dynamic Data project with Lightswitch?

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.


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

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?


Most efficient way to rebuild a tree structure from data

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.


Tips for / pitfalls of working on an outsourced project

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?


Common Lisp Implementations - threading and multiplatform?

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 :)_


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

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 :-)


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

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...)


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

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.


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

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 ?


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

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?


Clarify the Open/Close Principle

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.


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

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?


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

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!


Steps to solve or approach towards a solution

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.


Am I getting Scheme wrong?

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?


How much freeware is downloaded by an average user?

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.


Are unit tests really used as documentation?

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?


Help with complex MVVM (multiple views)

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)


Are web application usability issues equal to website usability issues?

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.


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

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?


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

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


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

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 ?


When to go Fluent in C#?

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.


Signing redistributed files

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.


Coding to SOA, External Dependency

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?


articles in variable names and hard-coding strings

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.


Rpc transferring data or Replication

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).


Documenting and enforcing programming standards and guidelines for shared library

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.


Best way to handle class relationship

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?


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

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?


Dijkstra's example of an ambiguous program

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?


What responses disqualify a candidate from hiring during the interview?

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?


Writing Unit Tests for a Class That Starts External EXE

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?


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

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?


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

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?


Status "Open" and "Reopened"

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


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

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.


problem in building my portfolio

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 :)


Google Datastore and deep records

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.


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

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


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

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


How do programmers quit a job?

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.


More code = more bugs

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?


Ruby on Rails and DRY

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?


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

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?


TDD/Tests too much an overhead/maintenance burden?

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.


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

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).


Does facebook store multiple password hashes for each user?

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)


Can decoupling hurt maintainability in certain situations?

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?


According to software engineering which method are too long?

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


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

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?


Protecting your interests as a freelance web designer

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


Getting involved in an open-source Python-Java project

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?


Did I understand the website "autologin" feature right?

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..


How should I host our scalable worker processes?

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?


How to adhere to the open-closed principle in practice

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)?**


PHP, Python, C# for web and desktop applications

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.