Representing domain objects

This is related to my recent question regarding naming awkward domain objects. A number of answers indicated I was using the wrong representation for the domain objects. To summarize, I chose to use an enum to represent some domain objects used as keys in lookups. For this question, I want to review my decision to use an enum and identify alternatives. Jump to the bottom of my question for the TL;DR. **Domain Description**   My application is responsible for performing some calculations involving chemical compounds. Some basic equations are:   * calculating the number of moles of a compound    * calculating the specific gravity or density of a compound at various concentrations These equations could be handled as methods within a `Chemical` class like:   `Chemical.GetMolesFromMass(double mass_grams)` or   `Chemical.GetDensity(double concentration)`   or they could be implemented as methods off of a generic chemical properties class like:   `Chemical.GetMolesFromMass(Compound cmpd, double mass_grams)` or   `Chemical.GetDensity(Compound cmpd, double concentration)` I think from an object responsibility point of view, the first option of methods off of the `Chemical` class would be a better representation. Some advanced equations involve:   * calculating quantities of a compound consumed by a business process   * calculating storage requirements of compounds    * optimizing deliveries based upon standard container sizes  In these equations, the chemical compound is an input to the method.   `StorageTankCluster.Generate(Compound cmpd, double requiredVolume)` The `StorageTankCluster` needs to know about the chemical because the dimensions and spacing of the tanks within the cluster will change based upon the chemical and required volume. The chemical being stored can affect tank material selection as well as impacting safety clearances between tanks. At the moment, I'm considering those parameters (spacing, material, ...) as lookup items instead of elements that the compound is responsible for knowing about. Likewise, the delivery optimization as affected by the chemical compound but it's arguable on whether or not those aspects are the compound's responsiblity. Both the `StorageTankCluster` and the delivery optimization components are intended to be reused by other non-chemical aspects of the application. As this question is already getting complicated, we can just call those other elements `Foo` and `Bar`. Both `Foo` and `Bar` could utilize the delivery optimization, but only `Foo` can be used with the `StorageTankCluster`. It's not in the application now, but all of the various properties discussed so far will need to be stored within a database / persistence layer. I realize that shouldn't affect a good design, but I thought it was worth mentioning. I'll admit that some of my decisions have been biased because I'm porting this application from another source that forces everything to be done in a structured manner. Writing out this question has highlighted a few areas where I should have better examined what object had responsibility for that functionality. My design so far has been oriented around lookup tables and I'm using the enum values as the keys to those tables. It is their use as keys that causes me to treat them as named objects within the program instead of treating them as objects the system would operate upon. This has pretty much relegated the chemical compounds to 2nd-tier class status, and I'm wondering if that was the right decision. On the other hand, I'm concerned about the chemical compound class becoming bloated beyond usefulness. **TL;DR**   My implementation is / must be in C#. So was using an enum the right choice, or what should I have done and why?


Continuing to code on large projects

I am a hobbyist programmer, and I've started many medium - sized projects to work on just by myself. These include games, a raytracer, physics simulations etc. By the time these projects get to a certain size (around 5000 lines), I begin to slow down in adding features to the program. This is not because of a lack of ideas of what to implement in a program, but rather a struggle in how to go about it. In particular, I'm afraid of breaking what I already have working in order to implement a new feature. I've tried using version control like Git and Subversion, but these seem unnecessary when you are a one man team. I simply have a folder of "versions" of my program, one for each major change I make. How do I keep coding past this 5000 line mark? What about the 50000 line mark?


Is there such a thing as truly random?

I saw a video about random numbers and how the programmer in that video was talking about computers generating pseudo random numbers and that they are not really random. I knew about this. Then he showed the decay of a radioactive material to generate random numbers where he claimed to be truly random. Is there really such a thing? I mean the process of the radioactive material shooting electrons might seem random but is it? Isn't it just a mysterious black box to us simply because we don't know how it really works? Or does randomness just depend on the current level of scientific knowledge? If so, then how come quantum computers are often quoted to be capable of generating truly random numbers? Can they really do this?


Is there a desktop tool to auto-combine & minify JS on save?

I've been using Less.app lately to automatically minify CSS and compile it from LESS to CSS immediately when I save a LESS source file. It seems like an obvious thing, but I can't find a tool that does the same thing for JavaScript. Does such a tool exist? Desired features:   * I'm on OSX, but a cross-platform solution (e.g. using Adobe AIR) would also be acceptable.   * Leave it running minimized/hidden, automatically watches specified folder for changes (no button clicking necessary)   * Installing NodeJS/python/php/etc is a non-starter. Must be totally self-contained.   * Especially interested if it will automatically combine all of the files from the same directory.      * Either sorting based on filename so that I can name them "1.library.js", "2.framework.js", "3.app.js", etc, or...     * Allow setup of manual sorting


Charging for a project where you retain the IP for the end product

I have read up on quite a few of these questions asked on here regarding "how much should I charge for..." such as: How should I charge for programming things which take two minutes to fix? How much should I charge for a web app How much can I charge for this a little job? and these are fine for freelance projects dealing with specific clients for a specific product. My situation has a bit of a curve-ball to it, and this is: how much should I charge a company to develop a product where I retain the 'Intellectual Property' of the final product. I am working with a company to create a web application that will help with some administrative processes. The idea for this project had originated between me and an employee of the company outside of business hours. Thus the product idea was then presented to the company and they are very interested in me developing this idea for them. The CFO of the company wants to pay me for my time to develop this product, yet I would also like to own the IP of this product and resell it to other companies when it is completed. When we do meet to discuss fair wages, what would be the best way to position myself? Presumably in the future with a completed product this would be a 'fee for service' software platform, wherein a company would purchase seats (monthly or annually). But I am unsure of how I should treat this development 'partner'. Their contributions would include helping me tailor the product to fit their needs specifically, along with debugging and testing.. So should I charge an hourly rate? A lump sum? Or start out right away with a monthly subscription type? This project is done on the side, I still have a day-job.. But will be investing a lot of time into this project since it has a lot of potential. (if that factors into any of it)


How do I partially add PHP namespacing to a library without breaking existing code?

My company has created a modular PHP framework over the years, beginning long before PHP 5.3 added namespaces. Recently, we decided to start using namespaces in our library's new code, and we intend to namespace old code eventually. However, we have a few issues we are trying to work out to determine if adding namespaces to a pre-v5.3 codebase is just not a good idea:   1. Can I namespace a class but also import (use) the global namespace so all global classes do not need a `\` prefix?   2. If we namespace an existing class in our library, how can we prevent all existing projects from breaking as soon as the framework upgrades? For example, can the library change the name of class `ThemeEngine` to `\module\theme\ThemeEngine`, but the existing websites call `ThemeEngine` without **any** code modification? If so, what would that code look like?


How do I determine what project ideas will work as a resumé builder?

I have been programming almost exclusively in C/C++ for the almost 3 years now (not including college) and feel stagnated (not to mention working on proprietary code for the most part). So I decided to change my career path and jump into web devlopment by learning Rails. The problem is not the learning but getting a Rails/web dev job. Since I don't have any real work experience in RoR, the one way to get noticed is through side projects. There's a lot of basic advice about building up a resumé in a new technology: creating a project on GitHub, for example. But being new to the whole web development world I don't know what constitutes as a good project that shows that I am good programmer and not just an eager enthusiast: things like my testing methodology, coding standards, design patterns, programming practices, and so on. How do I come up with a project that'll demonstrate these things?


Should an API be aware of client versions?

Should an API be aware of a client version? The idea of that really goes against the grain for me, but it seems like it is being pushed for in my current project. Am I wrong? Can I get some reasons for or against this that I can present or understand why it might be good. The API is a RESTful API.


Finding my path for masters (CS or HCI or some other trail)?

I am student pursuing Bachelor of Technology in Electronics and Communication at my university. While pursuing my course, I started to work on some projects related to CS. Computers being my favourite from the very foundation, I kept on working on towards my passion for these three years winning some awards, writing a paper, doing projects etc. I am currently in fourth year now and I am thinking to totally switch my branch to CS for masters. I always work to build innovative solutions to problems like software for disabled, something for education, or be it software for environment etc. There is no certain subject for solutions but innovation and novelty is certainly what I yearn for while scheming inventive solutions. The problem is that I am not able to find the correct path to go for the masters i.e. the diversification of courses is taking a toll. Mostly, there are HCI courses in universities which focus to build these innovative solutions but, I was trying to parallel MS in CS & MS in HCI. There looks like more of a focus on drawing/arts type if thing in HCI which I don’t want to go ahead with but what I do want is building up creative solutions with technical ingenuity. A person in HCI also has all the same technical skills as that of a CS student, then where does the difference arise? Let’s say as a very odd example, can a HCI student apply for SDET positions for example at a big firm, instead of User Experience Design etc. since he is having the same skill set? Or, in terms of monetarist paybacks, is there a difference between salaries of CS graduates and HCI graduates? I do not want to remain as an interaction designed submitting just on-paper designs of things. I do want to surface with more imaginative ideas. At the current stage, what’s stopping me is that I am a little lesser than the technical knowhow as compared to a full time CS student since I put in the effort for all the CS prep myself (being a non-core CS student). I presently need to learn more about CS at a reputed place while pursuing these projects. So, is it really HCI that I should be going for or is there is some other contour that I haven’t given a thought to? Please help me out. Thanks


Tutoring students who are struggling with the basics in C++

I am tutoring a few students who are having significant trouble learning the basics of their first programming language: C++. I have known many excellent and bright students who have failed or dropped their first CS course. Everyone I am tutoring gives a similar account of his or her experience in class: the instructor moves along too quickly, nothing in the lectures make any sense, et al. Prior to this CS class, most of these struggling students had not expressed any interest in computers as anything more than word processors, web browsers, or some other form of entertainment. The computer is a blackbox that works, so why mess with it? My best guess is that they are having trouble connecting the abstractions of computer science with familiar concepts. That is to say, these student might know how to learn math, biology, or physics, but those techniques are not working when it come to programming. Does anyone have any suggestions or advice? The students I am helping do not deserve to fail this class. It is clear that the instructor is not taking into account the learning style of these students. That is to say, the instructor is failing not his students.


Why almost no webpages hash passwords in the client before submitting (and hashing them again on the server), as to "protect" against password reuse?

Relevant XKCD There are many sites on the Internet that require login information, and the only way to protect against password reusing is the "promise" that the passwords are hashed on the server, which is not always true. So I wonder, how hard is to make a webpage that hashes passwords in the client computer (with Javascript), before sending them to the server, where they would be re-hashed? In theory this doesn't give any extra security, but in practice this can be used to protect against "rogue sites" that don't hash your password in the server.


How to share common methods if objects have different roles?

If 2 classes have the following in common:   * part of how their state is represented (both have a linear container)   * multiple identical methods (identical code, not just signature) But are not substitutable, ie: they play different roles.   Then how do I avoid repeating those methods? The obvious solution would be inheritance, but I have read: "inheritance is not for code reuse". (Does this apply here?, Is this really a case of just code reuse?) I am deliberately not telling you which language, because I am hoping for a language agnostic answer. The methods are couple lines long, all of them modify the container, one of them transforms/extracts a sort of "final result" from the container. By roles I mean: substituting one for the other would be valid runnable code (in the places where only the common methods are used), but would result in logic/semantic error. By inheritance I meant that introducing a 3rd class as base/super with the common methods, but that would be virtual. So by substitution I meant substituting a "sibling" type and not a subtype.


Introducing polymorphism to new programmers

I've been teaching Java to a group of four people for about four months now. Prior to this, they've all had very limited or no other experience programming. We've gotten through basic control structures and their use and have been able to solve some of the simpler Project Eulers. Things similar to:               int count = 0;          for(int index = 0; index < 1000; index++)     {             if(index % 3 == 0 || index % 5 == 0)             {                     count += index;             }     }               System.out.println(count);      We've also gone over basic object-oriented things such as classes and their uses. However, we have not covered inheritance or polymorphism yet. I'd like to introduce inheritance and polymorphism together, but I'm not sure how to properly explain polymorphism to someone who's never seen nor heard of it before. To sum up my question in a few words, I am looking for an effective way to introduce polymorphism to new programmers.


When to separate a project in multiple subprojects

I'd like to know if it makes sense to divide the project I'm working on in two repositories instead of one. From what I can say:   * Frontend will be written in html+js   * Backend in .net   * The backend doesn't depend on frontend and the frontend doesn't depend on the backend   * The frontend will use a restful api implemented in the backend.   * The frontend could be hosted on any static http server. As of now, the repository has this structure: root:   * frontend/*   * backend/* I think it's a mistake to keep both project in the same repository. Since both project do not have dependencies between each others, they should belong in individual repositories and if needed a parent repository that has submodules. I've been told that it's pointless and that we won't get any benefit from doing that. Here are some of my arguments:   * We have two modules that don't depend between each others.    * Having source history of both projects in the long term may complicate things (try searching in the history for something in the frontend while you have half of the commits that are completely unrelated to the bug you're looking for)   * Conflict and merging (This shouldn't happen but having someone pushing to the backend will force other developer to pull backend changes to push frontend changes.)   * One developer might work only on the backend but will always have to pull the backend or the other way around.    * In the long run, when it will be time to deploy. In some way, the frontend could be deployed to multiple static server while having one backend server. In every case, people will be forced to either clone the whole backend with it or to make custom script to push to all servers the frontend only or to remove the backend. Easier to just push/pull only the frontend or backend than both if only one is needed.   * Counter argument (One person might work on both projects), Create a third repo with submodule and develop with it. History is kept seperated in individual modules and you can always create tags where version of backend/frontend do really work together in sync. Having both frontend/backend together in one repo doesn't mean that they will work together. It's just merging both history into one big repo.   * Having frontend/backend as submodules will make things easier if you want to add a freelancer to the project. In some case, you don't really want to give full access to the codebase. Having one big module will make things harder if you want to restrict what the "outsiders" can see/edit.   * Bug introduction and fixing bug, I inserted a new bug in the frontend. Then someone fix a bug in the backend. With one repository, rolling back before the new bug will also rollback the backend which could make it difficult to fix. I'd have to clone the backend in a different folder to have the backend working while fixing the bug in the frontend... then trying to remerge things up... Having two repository will be painless because moving the HEAD of one repo won't change the other. And testing against different version of backend will be painless.  Can someone give me more arguments to convince them or at least tell me why it is pointless (more complicated) to divide the project in two submodules. The project is new and the codebase is a couple of days old so it's not too soon to fix.


RESTful URI's, Creating a new noun/uri or add a queryparameter

I have a Person class with a one to many relationship to Employment. A Person in the CRM can have multiple Employments (historic data). My current REST URI for this class looks like this:               http://domain/persons GET [collection]     http://domain/persons/{id} GET [resource]     http://domain/persons/{id}/employments GET [collection]      To get the CURRENT active employment (so the employment where the endDate is NULL) should I create a URI or should this be done using a QueryParam? Basically should I do this:               http://domain/persons/{id}/employments/current GET [resource]      or               http://domain/persons/{id}/employments?current GET [collection with query param filter]      I'm thinking the second one (with the queryparam) because as far as I understand REST a resource should be identified with a non changable URI. Since the current employment position can change it should be done with a QueryParam. What are your suggestions?


C quiz, puzzles obfuscated C

I believe that I am a good C programmer. I can solve beginner level Question in google's code jam. I did solve all of the programming examples in KN kings: C programming. Given a problem I can express a solution to it in C(probably not good, but still works with brute force most of the time). A couple of days ago I had registered for a C quiz. And took the quiz today. From the beginning till the end I was confused, feeling rejected and unhappy most of the time. I could not figure out what most of the question did. It was cryptic to me. For example I have used for loop almost 1000 times, but the for loops in that quiz were just cryptic and confusing. Most of the question looked like it had illegal syntax. After the test I felt dejected and posted this question. I wanna know that does solving cryptic code make you a good or a great programmer?. A simple solution to a straight forward question is better than a cryptic confusion right?. If I had done really well in the test what does it indicate? If I have performed average or bad what does that indicate?. Oh yes, I will get the paper of quiz on monday and i will update that monday evening around 7:30. (GMT +5:30). Thanks for your concern. By the way to hell with you people who have down voted for this post. You people cant wait for edits or dont have patience to at least listen to someone. I still think there is nothing wrong in this question and i wont delete it.


Distributing GPL licensed software that optionally links to non-GPL licensed libraries

I can find lots of information regarding the restrictions imposed on linking GPL licensed libraries from non-GPL licensed software. However, I'd like to do the opposite - I'd like to distribute some software under a GPLv3 license that has the option to dynamically link to a proprietary shared library. The proprietary library would not constitute an essential component of the functioning software, since there are other open source (BSD licensed) libraries that could be linked at runtime instead (specifically, I'm thinking about linking MKL BLAS versus ATLAS, OpenBLAS etc.). I found this relevant section in the GPL FAQ.   * Does this mean that I would need to explicitly grant an exception for every possible non-GPL licensed shared library the user might choose to link to at run-time?   * Would I need to write exceptions for libraries that are open source, but not GPL licensed (e.g. BSD)?   * If the library that is being linked to is not covered by an exception (i.e. if it is GPL or LGPL), what would be my obligation to distribute the source code for that library?


How do I resolve a Title Dispute? Head Programmer/Developer and Consultant

I am working on a project (software) for an organization. Someone else from that organization asked If I could build something for the organization. I did so, for free in fact because I wanted to support this organization. Now heres the problem. This other person, has come back and asked me to polish up the titles/credits give to us in the about screen. But he want's to be called the lead Developer and call me lead Programmer. The thing is that, he has not contributed any code towards this application. Thing is, I feel that I developed/programmed/designed the entire thing. I did 100% of the actual product including design. His input was, can we have it have a specific color background (for design) or how soon "we" can incorporate another feature. Maybe I'm being one sided, but technical stuff wise, the other person has no "developmental" use. I'm still happy to have him, because he is my contact within the organization and he has brought some interest into the product but I don't know if the title is fitting. What do you think the best title/solution is here? Am I being narcissistic/worrying about things that don't matter? Let me be clearer 1. Dude asks me if I can make something 2. I say yes. I want to help the organization that he works for (the product is not for profit) 3. I build the thing with design and stuff 4. Initial launch. 5. He suggests some design changes, maybe a feature. 6. I change + add features 7. Pretty successful, generates interest in growing larger 8. And then, the tittle issue Would Lead Consultant be a nice way out of this?


Avoiding problems when copying code

From time to time, I find myself copying a bit of code and modifying the copied version. I know very well that having two copies of the same code is a very bad idea, but those pieces of code are small and have significant differences. The problem is, when modifying the copy, I sometimes forget some piece of the original, that shouldn't be there. So for example I first write (C# code, but that's not important here):               if (DateFrom != null)         query = query.Where(x => x.Date >= DateFrom.Value);      then I copy-paste it and modify into the following:               if (DateTo != null)         query = query.Where(x => x.Date < DateFrom.Value);      which isn't correct, because there should be `DateTo` on the second line instead of `DateFrom`. What would you suggest to help avoiding this kind of bug?


HTML 5 Double-Helix/DNA

What would be the most cross browser friendly (IE9, Chrome, FF, Safari, Opera) way to code an animated, interactive double-helix? HTML 5/JavaScript is fine. Flash or Java is not. I am unsure if canvas or svg or pure css should be considered as graphics aren't typically my thing. In fact, I really don't know where to start here, so I probably just need a nudge in the right direction. Any advice is appreciated!


Do coding puzzles make good interview questions

I am interviewing candidates for Java programmer positions. My colleague insists in filling more than half of the interview with java coding puzzles.His view is that, if candidates are able to navigate through the loops, then they must be good. One such example of coding puzzle is                       i=0;             for( i=1 ; i< 10 ;i++)             {                     if(i%3 ==0) i++; break;                     if(i%2 ==0) i++;                   }               print(i);      Follow up: what happens if break is removed ?


How to stop dwelling on problems rather than tasks?

I can't say I am a good programmer but I've been earning money for programming last decades. I've thought I was born for programming and people said I was very good at it - at some point. But after 10 years of programming, I feel my programming efficiency is not as good as others. Of course, CS education is way better now and many young programmers are smarter than me. But one of my problem is that when I am executing a task, I tend to dwell on specific problems I am facing with the task rather than focusing on completion of the task. I understand to keep thinking about it does not solve the problem. But I habitually do that and easily become exhausted. I hope I am not the only one feeling in this way. Did you feel the same feeling? If so, how did you get rid of this terrible habit?


My department is planning on working on our next several releases (spanning a year) simultaneously. The powers that be are advocating we support this by refactoring all affected code into classes like AbstractGizmo, R1Gizmo, R2Gizmo, etc and use configuration (via Spring and/or ANT) to control which classes are used in a particular release. Ostensibly this is to save us the work of merging changes into multiple branches, especially when the changes are in the common code. However, I see this as a clear cases for branching and merging in version control (TFS, in our case). However, I have very little experience on projects that have active streams of development like this. I'm sure others have (like Microsoft, with Windows XP, Vista, and 7). What's the best way to handle multiple simultaneous "streams" of development in version control? Do you branch and merge changes in version control, try to develop everything in one branch and use configuration or build scripts to assemble the different version, or something else? P.S. We use TFS right now, but our version control strategy may not be constrained by it. A coworker of mine is pushing to switch to Git or Mercurial, and it seems like he's getting a bit of traction.


What are the similarities between Perl and Java?

I have my mind set that I'm learning Java as my second language (I am a Perl developer). But just from reading a little of the online tutorials, I really can't find any similarities between the two. What will I have an easy time understanding when learning Java?


FOSS Development: Who develops the OS-specific packages?

I have a couple of FOSS projects. They can be a bit of a pain to get running unless you've got dependencies in place already, which I figure is par for the course for FOSS projects. We know that each free operating system out there has its own package management systems. A few of them, such as homebrew on Mac OS or AUR on Arch linux are very friendly to community contributions. What I am wondering is, who exactly is expected to contribute packages? Primarily I am concerned with the case of small or developing projects, since it's pretty standard for the big projects to be put in there by the OS maintainers. From my perspective, it is something of a chicken-egg problem, because your software will not make its way into a package system if it does not have users, and it is less likely to gain users if it is not easy to install and use. For the sake of discussion, let's assume that the software in question is actually legitimately useful. I can see where people could create crapware or spam and that should obviously be kept out of any package system. So, in summary, whose job is this? Is it spammy for a FOSS software dev to put his own work into various OS package repositories?


Exposing warnings\errors from data objects (that are also list returned)

I'm exposing Data objects via service oriented assembly (which on future usages might become a WCF service). The data object is tree designed, as well as formed from allot of properties.Moreover, some services return one objects, others retrieve a list of them (thus disables throwing exceptions). I now want to expose data flow warnings and wondering what's the best way to do it having to things to consider: (1) separation (2) ease of access. On the one hand, I want the UI team to be able to access a fields warnings (or errors) without having them mapping the field names to an external source but on the other hand, I don't want the warnings "hanged" on the object itself (as I don't see it a correct design). I thought of creating a new type of wrapper for each field, that will expose events and they'll have to register the one's they care about (but totally not sure) I'll be happy to hear your thoughts. Could you please direct me to a respectful design pattern? what pattern will do best here?


How to go about "taking over" an open-source project?

There's an open-source project that I'm interested in and use regularly. It's licensed under the Apache License 2.0 and it has basically no activity any more. It's hosted on Google Code and I'm interested in continuing it's development. I'm new to the open-source process and I'm trying to figure out the appropriate way to go about this. Can I just check it out and push it to github so I can continue it's development in the open there? Should I contact the project "owner" first? Also, do I leave all the author information at the top of the classes, etc even though I'm going to be making changes..(I'm assuming the answer is yes)? Also, how do I practically adhere to the license requirement of "all modifications are clearly marked as being the work of the modifier"? Do I place a comment by every change I make? Any guidance on what's the normal course/standard here would be greatly appreciated?


Should a class validate argument using external method/service with unit testing?

I have a class that runs as a service and returns html code of a website when supplied with a URL. The code:               public interface IHtmlDownloader     {         IWebProxy Proxy { get; set; }         string UserAgent { get; set; }              string GetHtml(string url)     }          public class HtmlDownloader : IHtmlDownloader     {         WebClient _client;              public IWebProxy Proxy         {             get { return _client.Proxy; }             set { _client.Proxy = value; }         }              public string UserAgent         {             get             { return _client.Headers[HttpRequestHeader.UserAgent].ToString(); }             set             { _client.Headers[HttpRequestHeader.UserAgent] = value; }         }              public HtmlDownloder()         {             _client = new WebClient();         }              public string GetHtml(string url)         {             this.CheckValidity(url);                  var htmlOfWebsite = _client.DownloadString(url);                  return htmlOfWebsite;         }     }      Now I am not sure how exactly I should validate the URL. I know that it should not be null or whitespace or anything else, but should I validate that it is indeed a properly built URL? Doing so would result in a method which would perform the validation. I could simply create a public static method inside `HtmlDownloader` so that the caller can validate the URL, or maybe even not a static one (`GetUrl(string url)` is after all called after the object has been instantiated), but it would be wrong for at least two reasons:   1. It would be a validator applicable in so many places, and it should be available to other classes.   2. I can't contract a static method with an interface. Furthermore, it shouldn't be made static, but rather a service, so I could unit test `HtmlDownloader` (service would be injected through the constructor). All of those ideas are quite dreadful and I am starting to think, that I shouldn't validate anything, but simply create a `try/catch` block that would catch the proper exception and then throw a UrlNotFoundException with the original exception supplied through InnerException. Still, it would be nice to check for the validity of the URL. But to whom and how? Should the caller be injected with the proper service? But then, what if the URL is generated higher than the caller and the caller simply passes it on to the HtmlDownloader? Where should I validate the URL? Or is the simple fact that the URL have to passed through a few levels a code smell?


Which numeral systems are useful in computer science?

I am wondering which numeral system different programmers are using, or would use if their language has support for them. As an example, in C++ we can use:   * Octal by prefixing with 0 (e.g. `0377`)   * Decimal by default (e.g. `255`)   * Hexadecimal by prefixing with 0x (e.g. `0xff`) When working with bitmask, I am using hexadecimal but would sometimes want to be able to express binary numbers directly. I know some programming language support it with 0b syntax (e.g. `0b11111111`). Is there any other numeric system useful in some computer science domain (e.g. cryptography, codecs, 3D graphics, etc)?


Python Compare Values from 2 Columns from two separate CSV files

I am using Python. I have two columns(in separate CSVs) that contain an ID tag. Ideally, I would like to add on columns of information from one CSV to the other whenever the ID tag matches. For the most part, the tags are hand and hand, however, there might be times where one ID tag is missing, and if that happens, I would like it to just continue through. Here is an example of the data: From 1: ID   1   2   3   4   5 From 2: ID VariableX Variable Y missing......................................                     2     X1          Y1      missing........................................ 4 x4 y4                     5     x5          y5      I would like to take the values from variable x and y and add those columns onto the first file (with only the ids) whenever the IDs match from each file. Another thing to note, these IDs will show up from time to time again periodically (maybe every 3-400 times). If anybody could help with this topic, I would really appreciate it! Thank you!


implementing dynamic query handler on historical data

**EDIT :** _Refined question to focus on the core issue_ Context: I have historical data about property (house) sales collected from various sources in a centralized/cloud data source (assume info collection is handled by a third party) Planning to develop an application to query and retrieve data from this centralized data source Example Queries: **Simple** : for given XYZ post code, what is average house price for 3 bed room house? **Complex** : What is estimated price for an house at "DD,Some Street,XYZ Post Code" (worked out from average values of historic data filtered by various characteristics of the house: house post code, no of bed rooms, total area, and other deeper insights like house building type, year of built, features)? In addition to average price, the application should support other property info ** maximum, or minimum price..etc and trend (graph) on a selected property attribute over a period of time**. Hence, the queries should not enforce the search based on a primary key or few fixed fields In other words, queries can be What is the change in 3 Bed Room house price (irrespective of location) over last 30 days? What kind of properties we can get for X price (irrespective of location or house type) The challenge I have is identifying the domain (BI/ Data Analytical or DB Design or DB Query Interface or DW related or something else) this problem (dynamic query on historic data) belong to, so that I can do further exploration **My findings so far** I could be wrong on the following, so please correct me if you think so I briefly read about BI/Data Analytics - I think it is heavy weight solution for my problem and has scalability issues. DB Design - As I understand RDBMS works well if you know Data model at design time. I am expecting attributes about property or other entity (user) that am going to bring in, would evolve quickly. hence maintenance would be an issue. As I am going to have multiple users executing query at same time, performance would be a bottleneck Other options like Graph DB (http://www.tinkerpop.com/) seems to be bit complex (they are good. but using those tools meant for generic purpose, make me think like assembly programming to solve my problem ) BigData related solution are to analyse data from multiple unrelated domains So, Any suggestion on the space this problem fit in ? (Especially if you have design/implementation experience of back-end for property listing or similar portals)


Loop invariant vs Assertions

I have an exam on Programming Concepts this Saturday and I am struggling to find some information to understand some concepts better. What is the difference between loop invariant and assertion? To me they look the same. Also, what exactly is `while` loop invariance theorem? Not sure whether it is me or it is ridiculously hard to find any specific information about algorithms and pseudocode online.


I've read here on P.SE more questions in which beginner programmers are advised to pick Python as their first programming language. Don't get me wrong, I like Python. I like it a lot! But its philosophy revolves around "We are all consenting adults here". From an experience/knowledge point of view, a beginner programmer is not an adult. Which then kinda means it is easier to shoot yourself in the foot and pick up some bad habits even if you survive the wound. I'm thinking that in a "more static" language it would be harder to shoot yourself in the foot as it will be more restrictive. Back to my question. Why is Python recommended as an entry level programming language? What are the points that make it good for teaching a programming language. Or... is it personal preference of the adviser?


In hindsight, is basing XAML on XML a mistake or a good approach?

XAML is essentially a subset of XML. One of the main benefits of basing XAML on XML is said to be that it can be parsed with existing tools. And it can, to a large degree, although the (syntactically non-trivial) attribute values will stay in text form and require further parsing. There are two major alternatives to describing a GUI in an XML-derived language. One is to do what WinForms did, and describe it in real code. There are numerous problems with this, though it’s not completely advantage-free (a question to compare XAML to this approach). The other major alternative is to design a completely _new_ syntax specifically tailored for the task at hand. This is generally known as a domain-specific language. So, in hindsight, and as a lesson for the future generations, was it a good idea to base XAML on XML, or would it have been better as a custom-designed domain-specific language? **If we were designing an even better UI framework, should we pick XML or a custom DSL?** Since it’s much easier to think positively about the status quo, especially one that is quite liked by the community, I’ll give some example reasons for why building on top of XML _might_ be considered a mistake. Basing a language off XML has one thing going for it: it’s much easier to parse (the core parser is already available), requires much, _much_ less design work, and alternative parsers are also much easier to write for 3rd party developers. But the resulting language can be unsatisfying in various ways. It is rather verbose. If you change the type of something, you need to change it in the closing tag. It has very poor support for comments; it’s impossible to comment out an attribute. There are limitations placed on the content of attributes by XML. The markup extensions have to be built "on top" of the XML syntax, not integrated deeply and nicely into it. And, my personal favourite, if you set something via an attribute, you use _completely different syntax_ than if you set the _exact same thing_ as a content property. It’s also said that since everyone knows XML, XAML requires less learning. Strictly speaking this is true, but learning the _syntax_ is a tiny fraction of the time spent learning a new UI framework; it’s the framework’s concepts that make the curve steep. Besides, the idiosyncracies of an XML-based language might actually add to the "needs learning" basket. Are these disadvantages outweighted by the ease of parsing? Should the next cool framework continue the tradition, or invest the time to design an awesome DSL that can’t be parsed by existing tools and whose syntax needs to be learned by everyone? P.S. Not everyone confuses **XAML** and **WPF** , but some do. XAML is the XML-like thing. WPF is the framework with support for bindings, theming, hardware acceleration and a whole lot of other cool stuff.


What are the downsides of RoR?

I'm currently trying to decide what server-side language to learn and use for web development, and while it's relatively easy to get information on why x, y, or z is a good thing, it's harder to figure out the downsides to each of them. In particular, I'm curious about what drawbacks there are to learning and/or using Ruby on Rails as opposed to any other given language/framework.


Good Programming Competitions for Highschool Students

What are good programming competitions (or web design competitions) available for highschool students in the Northeast (I am looking for a pretty long/comprehensive list)- of the USA? The competitions must either allow you to chose what language to use or must be in PHP or C. They can either be single coder or group coding competitions. Thanks you to anyone who can help me out.


Are tree structures inherently bad for mark-and-sweep garbage collector performance?

I'm implementing a bounding volume hierarchy in F#. Since it would be for a game, I want the garbage collector to be as quick and infrequent as possible. It seems though that I may have to pull some whacky tricks, probably pre- allocating everything. That means that I can't have many things immutable, and that I have to know up front how large my tree will be -- a major annoyance. I'll probably end up biting the bullet and doing just that (or maybe just go back to C++), but for the record, are trees inherently bad for GC performance? They would seem to be, considering the mark stage would have to traverse a lot of nodes.


How to master C++?

I am a grade 11 student and have Computer Science... I just love the subject.. We are doing C++ ... I have loadsss of interest in this subject ... I am kind of able to do the programs but would like to master C++ before college itself... It would be kind enough if someone can tell me some sites where there are source codes of some good programs (specially library systems)...Also, can anyone recommend any books! Moreover, to have a profession as a C++ programmer, what is required? I mean what type of courses in college should I apply to? Do I need to do Computer Engineering for this?


BIG O - Algorithm Case Analysis

Why is big O most commonly associated with worst and average case complexties of a function


What equipment do you use to avoid wrist pain?

I've recently been trying to improve the ergonomics of my workspace, and as a part of that I'm looking into how I can improve the hardware I use. Do you use a standard keyboard, a shaped one, or a split one? Mouse or trackball? Are there any other accessories you can't live without?


Is the 'C' in MVC really necessary?

I understand the role of the model and view in the Model-View-Controller pattern, but I have a hard time understanding why a controller is necessary. Let's assume we're creating a chess program using an MVC approach; the game state should be the model, and the GUI should be the view. What exactly is the controller in this case? Is it just a separate class that has all the functions that will be called when you, say, click on a tile? Why not just perform all the logic on the model in the view itself?


Is the agile approach compatible with having contractors on staff?

On the one hand, the agile approach stresses a tight-knit team that holds each other accountable and accepts collective ownership of the project. On the other hand, companies use contract programmers so that they can manage the peaks and valleys of funding without laying off actual employees. If there is a shortfall in funding, the contractors are the first to go, even if they are fully integrated members of the team (and there are employees are not). Companies also only like to keep contractors around for a limited amount of time. This is somewhat mitigated by the possibility that some contractors could be brought on as regular employees. Thus my question of whether there is a fundamental contradiction of having an agile team with a mix of employees and contractors, and the vastly different statuses that entails? * * * EDIT: The answers are indicating that I may not have expressed the tension I'm facing well, so let me take another shot. I'm a permanent employee. The agile approach (at least as implemented here) encourages me to see all team members, both permanent employees and contractors, as equal members of a cohesive team. The corporate approach to contractors encourages me to see them as expendable resources to whom we shouldn't become overly attached. I'm curious how others have resolved this tension.


VB6 to .Net 4.0 Conversion 3rd party tools

Since Visual Studio 2010 does not come with a VB6 conversion tool, the boss wants to use a 3rd party tool (i.e VBUC) that Microsoft is suggesting. Has anyone used one of these 3rd party tools/services? If so, have you found them to be worth the money?


How to interest my 8 yo child about programming?

I tried to make him interested, but he got bored very quickly and got back to his iPad games. I want to try again. Any idea how to approach this?


What is the historical reason why Python uses the double underscore for Class Private members

In python a module private function or variable is named `_foo`. If it is private to a class it is names `__foo`, The mechanics behind how these work are different, however that is of little relevance to the question. Why, during the design of the Python language was the double underscore characters chosen for class private members? Why not single underscore, like for module private? Why not some other character that is more visible? (Differentiating between _ and __ is hard). I'm sure there is some history here, but I'm having trouble finding it, because all I find are tutorials telling me what it means, rather than why it is that way.


Where should you be at with 5 years experience?

**Backround:** I am currently a Junior in college working towards a degree in MIS. I've been interning with a compnay for a 3 summers and a winter break in there. With only 11 months to go before I start marketing myself to potential employers I've decided to teach myself as much as possible about languages and platforms that are currently in high demand. My school offers job placement, but I've heard stories where it doesn't work out so well for applicants. Its this reason I've started doing searches for jobs online - Dice, Monster, CareerBuilder, etc. It seems that the only jobs I can find reequire at least up to 5 years experience. I also know not every requirement needs to be exact. **Situation:** Although I've not been in the field for 5 years, I would like to assure employers that I'd be able to keep up with someone who was. Experience is critical to self-development but I need somewhere to gain that experience. If you were an employer looking for someone with 5+ years experience, what would you expect them to know? How can you tell a 2 year from a 5 year besides a resume? I know this question is very general and it could apply to many different levels. I'm mainly concerned with programming languages such as C#, Java, etc. I won't be an expert on either but I want to know what I can at least set as a goal? **EDIT** : I found this website that explains the progression of skills that I though gave me an idea of where I stand. I know it doesn't specify years like I asked but it was helpful nonetheless.


Implementing a basic interpreter - should I learn regular expressions?

For fun and for practice, I'm thinking of maybe implementing a very basic programming language to run on a simple interpreter written in Java. My question is this: **Is it a 'must' to know regular expressions when designing an interpreter, for parsing the text?** Should I learn this topic before starting to implement the interpreter? Or is it enough to just run through the text, break down into strings, etc, i.e. do 'basic parsing' without regular expressions?


What is the differences between committing and patching?

I am quite new to source control and would like to know the differences between committing and patching? Also, how/when a patch is use and can it be used on a web application?


Has anyone ever claimed a warranty on an SSL certificate?

SSL certificates often advertise varying amounts of warranties or guarantees, for example $500,000 or $1m. My question is, in the history of SSL, has anyone ever actually successfully claimed one of these warranties? Has there ever been a case? If not, is it fair to assume they are just marketing gimmicks?


Why is it said that V-model introduces QA?

In several articles and books I learnt that "V-model introduced QA into SW development". I would like to understand the point of such statement, as from my understanding, V model activities (verification and validation) cannot be considered as QA as both deal directly with product control, no matter if it's static (verification) or dynamic (validation). I would agree that testing (say V&V) is a tool used by QA to measure the quality, but how does it assure it? Examples in Google Books:   _"Real-Time Systems Design and Analysis: Tools for the Practitioner"._ " **..these QA activities form the heart of the V model...** "   or   _Iterative Software Engineering for Multiagent Systems: The MASSIVE..:_ **the V-Model adds explicit quality assurance mechanisms to the Waterfall model: verification is concerned...**


Graph traversal and filtering in indoor navigation and path finding

Which of the following options take less processing time/is less expensive in a graph traversal algorithm for a (indoor)navigation system? a) To produce all possible paths between start and destination points (nodes on the graph) then applying a filtering mechanism to match the navigation user's capabilities and preferences (such as finding all the paths on the graph and then exclude stairways for wheelchair users), or b) As soon as the user's profile is available to the system, filter the graph and exclude the paths which are non-traversable for this user and then run a shortest path algorithm?


If the bug is 5+ years old, then is it a feature?

Allow me to add details: I work at an institutional place with many coders, testers, QA analysts, product owners, etc. and here is something that bugs me: We have been able to sell crappy (albeit pretty functional) software for over a decade. It has many features and the product is competitive, but there are a some serious bugs out there, as well as thousands of "paper cuts" - little annoyances that clients need to get used to. It pains me to look at some of the things because I firmly believe that if computers do not help to make our lives easier, then we should not use them. I have confidence in my colleagues - they are smart, able, and can improve things when the focus is on doing that. But, it can be difficult to file bugs against some old functionality without seeing them closed or forgotten. "It worked like that for eons" is a typical answer. Also, when QA does regression, they tend to look for anything that is different as much as anything that does not seem right. So, a fix to an old problem can be written up as a bug, because "it has been like that before even my time". The young coder in me thinks: rewrite this freaking thing! As someone who had the opportunity to be close to sales, clients, I want to give a benefit of a doubt to this approach. I am interested in your opinion/experience as well. Please try to consider risk, cost-to-benefit, and other non-technical factors.


How to obtain GPS Coordinates for local businesses?

Is anybody aware of a database that consists of businesses, addresses and GPS location information, preferably searchable by city at a minimum? I have an application in mind that I'd like to develop and would like to know if someone is doing this for free or cheap in possibly a web service or similar open format.


Is there a viable alternative to the agile development methodology?

The two predominant software-development methodologies are waterfall and agile. When discussing these two, there is often much focus on the particular practices that distinguish them (pair programming, TDD, etc. vs. functional spec, big up-front design, etc.) But the real differences are far deeper, in that these practices come from a philosophy. Waterfall says: _Change is costly, so it should be minimized._   Agile says: _Change is inevitable, so make change cheap._ My question is, regardless of what you think of TDD or functional specs, is the waterfall development methodology really viable? Does anyone really think that minimizing change in software is a viable option for those that desire to deliver valuable software? Or is the question really about what sort of practices work best in our situations to manage the inevitable change?


Which mobile development platform is easiest to develop?

From your experience in developing mobile apps, which mobile development platform is easiest to develop? iOS, Android or WinPhone 7? And why would do you think it is the easiest? If you can order it from easiest to most difficult it is even better.


how do I form a team which is remote?

I've got a bit of a challenge. While I'm not "in charge" I'm certainly lead developer on a project and my team will be scattered to high heaven. I've got someone who works on Fridays only, and probably 2 people who will be 3-4 hours away in another state. (One of the lovely side effects of partnering with multiple universities). Anyway, how can I get them all on the same "team"?? I've read a bunch of Joel Spolsky's stuff, but I can't create the same kind of environment that he uses. This is also the first project I'll be lead on, so it's kindof make-or-break. Specifically I'm looking for managing styles (personality), process models, project management (scrum?), video conferencing tools, and the like. I just don't have any resources for this kind of thing, and I'm afraid I'm going to be stuck doing too much work. Thanks,


Reasons for looking to change a job - What do you give

What reasons do you usually give when you are looking for a change to your prospective employer/recruitment consultants?   1. I need a change, which is basically this question but here, I am asking it more specifically as a response to the recruitment consultants.    2. I am interested in working in .NET 4.0 but my current organization is still stuck on VB6.0   3. I am working in the Telecom sector and I want to move to the Financial Sector.   4. ... The above are more or less responses that either some of my friends (including me) have given or we have heard. What would you classify as a **definite NO NO** reason? More importantly, what would you classify as an acceptable reason?


Why is the finalize method included in Java?

According to this post, we should never rely on the finalize method to be called. So why did Java include it in the programming language at all? It seems like a terrible decision to include in any programming language a function that _might_ get called.


How to execute batch jobs via webservices or rest api

I have an AppHarbor site where I need to do weekly updates to some of the data. I don't want to go the route of deploying an exe and adding an additional "webworker" to my site because those cost money. My thought is to add a web service/REST api service to the site so I can just call it, it will execute the "batch job stuff", then when it's complete, return a custom status code, like success or failure. Behind the scenes, it would update a "BatchLog" table or something like that, then I could create a page/view where I could access the log details and see which batch processes did or did not run. So, that's how I'm thinking I want to implement, but I'm a little skeptical of the security around this. First of all, obviously I don't want ANYONE to be able to kick off these batch jobs just by going to my web service/rest api. To fix that, I'm thinking there are 2 different ways to do this, or a combination of both. 1) Require some credentials and maybe an additional secret code in order to get them to actually kick off. 2) Configure in a table when each batch job can actually run, and the frequency. That way, if a hacker does call my service/rest api. It will only be able to execute 1 time per hour/day/week/month/etc. So they could hammer the service, but each successive call would just return a failure, or something like that. One thing to note, I read someplace a couple months ago that there are cloud services out there that will "schedule" batch jobs like this for you. And the free one that I read about will do 1 service. Any more than 1 and you have to start paying for it. So for my example, I'd just create one service, and have it called multiple times per day/week, and let my BatchJob configuration table determine whether it actually needs to process or not. So, how horrible of an idea is this? What are some other approaches to accomplishing batch jobs in a cloud environment where they don't offer batch services.


Issue Management

I know this isn't about `programming` but i should learn "`Issue Management`" What is `Issue Management`? I read Wikipedi page but i don't understand very well. Can you tell me `Issue Management` and if there is some product for this subject?


Is Akka a good solution for a concurrent pipeline/workflow problem?

**Disclaimer:** I am brand new to Akka and the concept of Actors/Event-Driven Architectures in general. I have to implement a fairly complex problem where users can configure a "concurrent pipeline":               Pipeline: consists of 1+ Stages; all Stages execute sequentially         Stage: consists of 1+ Tasks; all Tasks execute in parallel             Task: essentially a Java Runnable      As you can see above, a `Task` is a `Runnable` that does some unit of work. Tasks are organized into `Stages`, which execute their `Tasks` in parallel. `Stages` are organized into the `Pipeline`, which executes its `Stages` _sequentially_. Hence if a user specifies the following Pipeline:               CrossTheRoadSafelyPipeline         Stage 1: Look Left             Task 1: Turn your head to the left and look for cars             Task 2: Listen for cars         Stage 2: Look right             Task 1: Turn your head to the right and look for cars             Task 2: Listen for cars      Then, Stage 1 will execute, and _then_ Stage 2 will execute. However, while each Stage is executing, it's individual `Tasks` are executing in parallel/at the same time. In reality Pipelines will become very complicated, and with hundreds of Stages, dozens of Tasks per Stage (again, executing at the same time). To implement this Pipeline I can only think of several solutions:   1. **ESB/Apache Camel**   2. **Guava Event Bus**   3. **Java 5 Concurrency**   4. **Actors/Akka** Camel doesn't seem right because its core competency is _integration_ not synchrony and orchestration across worker threads. Guava is great, but this doesn't really _feel_ like a subscriber/publisher-type of problem. And Java 5 Concurrency (`ExecutorService`, etc.) just feels too low-level and painful. So I ask: is Akka a strong candidate for this type of problem? If so, how? If not, then why, and what is a good candidate?


Naming convention: Final fields (not static)

Today I had a discussion with a co-worker about the naming of `final` fields in Java classes. In his opionion `final` fields should also be considered constants since their values won't change after the creation of the instance. This would lead to the following naming convention for `final` fields:               public class Foo {         private static final String BLA_BLA = "bla";              private final String BAR_BATZ;              ...     }      In my opinion only `static final` fields should be considered constants while fields which are only `final` should follow the usual camelCase naming convention.               public class Foo {         private static final String BLA = "bla";              private final String barBatz;              ...     }      Now I'm a bit uncertain since he is a far more experienced programmer than I am and I usually agree with his opinions and consider him a very good developer. Any input on this?


Best practices when dealing with lots of empty table columns?

I have a schema that allows for multiple post types in my Django project (kinda like Tumblr). Users can make Posts of different types. One of those types is a photo, which I'll want the EXIF data for. If I have a super generalized table, does it make sense to create additional columns for the exif data? This would result in a ton of empty columns for every post type that isn't Photo. Alternatively, would it make sense to create a separate model for photos completely and create a foreign key to the Posts model instead?


TDD, new tests while old ones not implemented yet

I am experimenting with test-driven development, and I found that I often come to a following situation:   1. I write tests for some functionality X. Those tests fail.   2. While trying to implement X, I see that I need to implement some feature Y in a lower layer of my code. So...   3. I write tests for Y. Now both tests for X and Y fail. Once I had 4 features in different layers of code being worked on at the same time, and I was losing my focus on what I am actually doing (too many tests failing at the same time). I think I could solve this by putting more effort into planning my tasks even before I start writing tests. But in some cases I didn't know that I will need to go deeper, because e.g. I didn't know the API of lower layer very well. What should I do in such cases? Does TDD have any recommendations?


F# open source project hosting using SVN

I'm looking to choose open source project hosting site for an F# project using SVN. CodePlex is where the .NET community in general and most F# projects are hosted, but I'm worried TFS + SvnBridge is going to give me headaches. So I'm looking elsewhere and seeking advice here. Or if you think CodePlex is still the best choice in my scenario, I'd like to hear that too. So far, Google Code is looking appealing to me. They have a clean interface and true SVN hosting. But there are close to no F# projects currently hosted (it's not even in their search by programming language list), so I'm wondering if there are any notable downsides besides the lack of community I might encounter. If there is yet another option, I'd like to hear that too. Thanks!


What are the advantages and disadvantages of cryptographically signing commits and tags in Git?

So someone peer reviewed my work, and he told me that I should always sign my commits and tags cryptographically. When asked why, he didn't know to explain it to me, and said "It's just a good thing to do". Trying to avoid an obvious chimpanzee scenario, why should I really? Are there really so many distinct advantages and no disadvantages? **What are the practical reasons which would make me want to sign every commit and tag I make?**


Database GUI Programming - .Net vs MS Access

MS Access gets pooped on a lot because A) many newbies use it B) people use it as a database backend which is not a good idea. I'd like to see some reasonable discussion on why you might choose VB.Net over MS Access or vice versa for programming a Database GUI (forms and reports) to be used with MS SQL Server.


Is there a cheaper non-express non-student, non-msdn version of Visual Studio 2010 that supports plugins in the US than the $710 Professional Edition?

I've never actually purchased a copy of Visual Studio myself. SharpDevelop and Express edition have always been good enough for my personal use, and my employers always furnished me with the IDEs I needed to serve them. However, I'm thinking of actually paying for a copy for my personal laptop. I need this mainly so I can open solutions that contain web projects. So my question is: Is there an edition cheaper than the $710 Pro edition on Amazon that will do what I need: http://www.amazon.com/Microsoft-C5E-00521-Visual-Studio- Professional/dp/B0038KTO8S/ref=sr_1_2?ie=UTF8&qid=1287456230&sr=8-2 ? What I need is defined as:   1. Open up a solution with C#, Web App, VB.NET, and Web Projects.   2. Install addins like resharper, testdriven.net, etc, SCM plugins, etc.   3. Some level of db project support. At least to be able to open a dbproj. I only need that for SCM hooks. SSMS and SQLCMD are good enough for actually editing databases.   4. Ability to install F#, IronPython, IronRuby etc. Now naturally I'm a fairly intelligent resourceful person so I realize I can get Visual Studio in a questionable manner. Thats not what I'm looking to do. I want a legal copy, I don't want a student copy, or an MSDN copy. I want a real copy, I just want to make sure I get the cheapest edition that serves my needs.


Best arguments for/against introducing ORM technology into a companies dev process

I have started using ORM technology in the last few years. My first exposure was NHibernate. I then moved onto Linq 2 Sql, and Entity Framework. The issue I have however is, there are some organisations where I have found strong opposition to introducing ORM tools. They usually have a number of reasons:   * they have a lot of built up SQL skills in the team, and are worried about the underlying SQL that ORM's generate.   * they have DBA's who like to be able to see the SQL an app uses in order that can review it for best practice.   * they are worried about performance (some people have "heard" the ORM's aren't as performant but have no real proof themselves - there may well be some truth in this! :). So, I'm looking for the best or most convincing arguments that you have put forward FOR the use of ORM tools. Equally, I would be interested in the against arguments too. Note: this is NOT a discussion over which ORM I should use.


Should I go with PHP.NET and Resharper or PHPStorm

I am a fairly adept .NET and PHP programmer. These days my pattern of choice for complex web apps is an SOA approach where I use PHP as the front end, and WCF web services as the middle tier. My ajax calls are usually to JSON webHttpBinding WCF endpoints. On the .NET side of things I am absolutely in love with the Visual Studio plugin ReSharper. So my question is as follows, I want to rethink my tool chain on the PHP side of things. On one side JetBrains, the makers of Resharper, have a PHP IDE called PHPStorm. On the other side, I can use VS.PHP and ReSharper. Does anyone use the later combination fo VS.PGP and Resharper? Can you recommend it?


Algorithm to infer tag hierarchy

I'm looking for an algorithm to infer a hierarchy from a set of tagged items. E.g. if the following items have the tags:               1 a     2 a,b     3 a,c     4 a,c,e     5 a,b     6 a,c     7 d     8 d,f      Then I can construct an undirected graph (or graphs) by tallying the node weights and edge weights:                node weights  edge weights           a 6           a-b 2      b 2           a-c 3      c 3           c-e 1      d 2           a-e 1  <-- this edge is parallel to a-c and c-e and not wanted      e 1           d-f 1      f 1      The first problem is how to drop any redundant edges to get to the simplified graph? Note that it's only appropriate to remove that redundant a-e edge in this case because something is tagged as a-c-e, if that wasn't the case and the tag was a-e, that edge would have to remain. I suspect that means the removal of edges can only happen during the construction of the graph, not after everything has been tallied up. What I'd then like to do is identify the direction of the edges to create a directed graph (or graphs) and pick out root nodes to hopefully create a tree (or trees):                trees                       a        d        // \\      |       b     c     f              \                    e           It seems like it could be a string algorithm - longest common subsequences/prefixes - or a tree/graph algorithm, but I am a little stuck since I don't know the correct terminology to search for it.


Best Practices PHP mvc routing

I have a custom MVC framework that is in a constant state of evolution. There's a long standing debate with a co-worker how the routing should work. Considering the following directory structure:               /core/Router.php     /mvc/Controllers/{Public controllers}     /mvc/Controllers/Private/{Controllers requiring valid user}     /mvc/Controllers/CMS/{Controllers requiring valid user and specific roles}      The question is: "Where should the current User's authentication be established: in the Router, when choosing which controller/directory to load, or in each Controller?" My argument is that when authenticating in the Router, an Error Controller is created instead of the requested Controller, informing you of your mishap; And the directory structure clearly indicates the authentication required. His argument is that a router should do routing and only routing. Leave it to the Controller to handle it on a case by case basis. This is more modular and allows more flexibility should changes need to be made by the router. PHP MVC - Custom Routing Mechanism alluded to it, but the topic was of a different nature. Alternative suggestions would be welcomed as well.


Tips for developing with a remote team?

My company has corporate offices around the country and I have been hired under contract to work in one office while the rest of my team works in another. We are in the same time zone, but definitely remote. I have not met the team yet, but will be flying up there soon. What is your best advice for integrating and developing with this team? What are the most important priorities? Standard versioning control, e-mail, phone, conference call and IM are all available resources, however Google apps, Skype and the like are not for security reasons.


Testing gap between unit and integration: Integration in the Small, Component, Unit Integration Tests

Over the past few weeks I've been mulling and researching how to fill a gap in our testing methodology. In simplified terms unit tests are too small and traditional integration tests are too big. A frequent scenario comes up where `A` and `B` both use component `C`. However `A` and `B` have slightly different requirements for, and make slightly different assumptions about `C`. If I'm the developer of `A` how and where do I test my assumptions about `C`? Obviously unit testing `A` with mocked assumptions about `C` is fine for testing `A` in isolation, but it doesn't test the assumptions themselves. Another possibility is to add unit tests for `C`. However this isn't ideal because, while `A` is in development, altering the tests for `C` with evolving assumptions from `A` will excessively be clumsy. Indeed `A`s developer might not even have adequate access to the unit tests of `C` (e.g an external library). To frame this with a more concrete example: Assume that this is a node application. `A`, and `B` depend on `C` to read a file (among other things) and store the file contents in object passed to `C`. At first all files that `C` handles are small and can be read synchronously without significant blocking. However the developer of `B` realizes that his files are getting huge and needs to switch `C` to a async read. This results in a sporadic synchronization bug in `A`, which is still assuming `C` is reading files synchronously. This is the type of bug that is notoriously difficult to track down from full integration tests, and may not be caught in integration tests at all. It is also not caught by `A`s unit tests because the `A`s assumptions are mocked. However it could easily be caught by a "mini" integration test that exercises just `A` and `C`. I've only found a few references to this type of testing. Integration in the Small, Component Integration Testing, Unit Integration Testing. It also relates somewhat to BDD testing direction rather than formal TDD unit testing. How do I fill this testing gap? Specifically -- where do I put such tests? How do I mock the inputs of `A` and `C` for "mini" integration tests? And how much effort should be put into separating testing concerns between these tests and unit tests? Or is there a better way to fill the testing gap?


Storing object-graphs with class-evolution in Java with transformation (long time archiving)

## Abstract A common problem is to store objects (with graph), and to load them back. This is easy as long the stored object representation matches the executing code. But as time goes by, requirements change and stored objects do not match any longer the code. The stored objects should not loose their data, and the code in the clients should work with the latest object-models. So a transformation has to occur somehow between loading the data and returning a object to the client. I know that there exist some libraries such as XStream, gson, protobuf and avro. They could load older objects, but afaik just ignore data that does not match any longer the fields in the class (maybe I missed something).   (When I'm talking about storing and serialization I do not mean Java's built in serialization mechanism.) ## Question So what is the question? I'm now researching for some time, and there seems no library that adresses this issue (class evolution) without data-loss. I hope to find another working solution or idea how to implement it by myself here. I have some requirements:   * File-based - I want to be able to store the serialized object on disk   * Appendable - I want to append multiple objects to one file without loading the whole file in memory again and again   * Support for multiple versions in one file - A file could contain objects with different version (only of the same type)   * Transformation - Data should be accessible by using the same type, even when changed in between.   * Generic - The mechanism itself has to be generic, so I could use it for different objects (different objects do not get mixed in one file, only different versions of one type). It would be nice if the storing format is human-readable. Already stored objects are not updateable (at least not without huge effort). Think of an long-term archive. ## Example I could give an example for better illustration. Let's suppose we have two Pojos that we want to serialize.               public class MyPojo {         String text;         Long number;         Integer[] values;         SubPojo pojo;     }          public class SubPojo {         List<String> items;     }      In the next version we might have renamed a field (text->content), changed a type (Integer[]->List), and have transformed a field to List (SubPojo->List) where the previous field now is the first element of the new list (not loosing data, just transforming to new representation).               public class MyPojo {         String content;         Long number;         List<Integer> values;         List<SubPojo> pojo;     }          public class SubPojo {         List<String> items;     }      Some pseudocode how the client might take use of this:               // Write     Serializer ser = new Serializer();     MyPojo pojo = new MyPojo();     pojo.xxx = ...; // set fields     ser.store(pojo, file, append);          // Read (a version later)     Serializer ser = new Serializer();     ser.registerTransformer(new TransformerV1ToV2());     List<MyPojo> pojos = ser.load(file);      This approach has some drawbacks:   * The transformer have to work on some kind of intermediate format (could be the backed stored format such as json or xml)   * You don't know how the class format was at some point in time, since you're only transforming relative to the previous version and mapping to the final class, making search for errors hard   * Performance (depending on how the transformation happens)


DDD Proper aggregates division and getting rid of too many references

I am designing an application, which will aid designing electric installations. I went for Domain Driven Design, as the topic is complex and the application will be growing with gained knowledge. However, I am newbie to this concept. For now, I have a problem to properly model the domain, especially to divide entities into aggregates. I have defined wiring - **Installation** as a set of **ConnectionPoints** and **Cables** , which connect them. One **ConnectionPoint** has one or more **Cables**. Each **Cable** has a set of wires. I consider end of a wire as a **Terminal** , which we can connect to another **Terminal** creating a **Junction**. **Terminals** differ one from another, as wires have different colours and purpose. **Junctions** are made of two or more **Terminals** and can be done only inside a **ConnectionPoint**. I have illustrated it for a better understanding: ![Illustrated ConnectionPoint](http://i.stack.imgur.com/mU78k.png) Besides **Cables** there are also **Devices** , which also have **Terminals**. They are also connected in a **ConnectionPoint** and their **Terminals** are treated the same way as **Cable** 's **Terminals**. For each **Device** I must be able to track, where the **Terminal** is connected to (it might be a list of end points). The problem, with the design, is the need of having references to **Terminals** outside of a **Cable** and **Device** entities to create **Junctions** and track connections. I could consider a **Cable** and a **Device** as aggregates of **Terminals** , as **Terminals** cannot exist without them and as a knowledge of **Terminal** 's parent is important. However, each **Terminal** has also an identity outside of a **Cable** / **Device** and I have no idea how later in code and database I could keep knowledge of the connections made. Do you have any ideas how could I model it? What questions should I ask myself to define a correct model and avoid keeping references everywhere?


Modeling an extensible Domain Driven Design project

Say that we are developing an application with modules (Sales, Accounting, Purchasing, etc). An example case here is : Sales module is the basic / primary module available, and Accounting module is a complementary module.               SalesModule     -. Product      And               AccountingModule     -. Account     -. Journal      If we were to say that : > If the Accounting Module were installed, then it will provide a direct > integration with the Product class from the Sales Module, such as : a > Product now has a List of Account which if a transaction is applied to the > Product, a Journal will be posted according to the Account. In my mind, I would picture that `Product` would have a property of `List<Account>`, but that would be impossible without adding that property directly in the `Product` class, making `Product` now dependent on Accounting Module when SalesModule should be able to run without it. Another solution came up to mind is to add `SalesIntegrations` classes (ProductAccount, etc) to complement the previously described `Product`, making it independent. But this solution doesn't sound as 'natural' as saying that `a Product has a list of Accounts`. From what I understand, doing DDD means to know beforehand the whole concept of business rules. What if a requirement come along to add a new project to complement the previous DDD project with only having it's DLL (no access to source code)?


Storing revisions of a document

This is a follow up question to my original question. I'm thinking of going with generating diffs and storing those diffs in the database 'History' table. I'm using diff-match-patch library to generate what is called a 'patch'. On every save, I compare previous and new version and generate this patch. The patch could be used to generate a document at specific point in time. My dilemma is how to store this data. Should I: a Insert a new database record for every patch? b. Store these patches in javascript array and store that array in history table. So there is only one db History record for document with an array of all the patches. Concerns with: a. Too many db records generated. Will be slow and CPU intensive to query. b. Only one record. If record is somehow corrupted/deleted. Entire revision history is gone. I'm looking for suggestions, concerns with either approach.


How is Sencha Touch performing on Android in practice?

I'm just about to start a project using Sencha Touch, and just done some minor testing on my HTC desire device. All tutorial videos at Vimeo seems to be using an iPhone emulator running on a Mac. Im not sure how fast this emulator is compared to a real iPhone device or even an real Android device, but from what i have experienced, it seems that my HTC desire is not performing that nicly as this emulator. All animations (sliding, fading, etc) seems abit laggy. You can easily notice that the FPS is much less than on the Vimeo videos. HTC desire is a relativly new and modern Android 2.2 phone, running with decent hardware, so im wondering if Sencha Touch is "ready" for the Android platform. Anybody with practical experience with Android and Sencha Touch ?


What is the best way to handle nuances for different platforms?

I'm working on a normal Java/SWT desktop application I'm planning on distributing to the three primary PC platforms (Windows, OSX, Linux). Obviously, there are slight differences between them, mainly having to do with files. What's the best way to keep those differences separate? I'm thinking three different SVN branches (win, osx, linux), and trunk for development, but then how do I update the branches without overwriting the differences? Do I need to define a platform constant instead at compile time? And then, of course, there are different versions of libraries (i.e. SWT in my case). How should those be handled? Where should I keep the compiled byte-code ".jars" files?


Why are SW engineering interviews disproportionately difficult (vs. research interviews)?

First, some background on me. I have a PhD in CS and have had jobs both as a software engineer and as an R&D research scientist, both at Very Large Corporations You Know Very Well. I recently changed jobs and interviewed for both types of positions (as I have done in the past). My observation: SW engineer job interviews are way, way disproportionately more difficult than CS researcher job interviews, but the researcher job is higher paying, more competitive, more rewarding, more interesting, and has a higher upside. Here's a typical interview loop for researcher:   * Phone interview to see if my research is in alignment with the lab's research   * In-person: give presentation on my recent research for one hour (which represents maybe 9 month's worth of work) and answer questions from the audience   * In-person one-on-one interviews with about 5 researchers, where they ask me very reasonable questions on my work/publications/patents, including: technical questions, where my work fits into related work, and how I can extend my work to new areas Here's a typical interview loop for SW engineer:   * Phone interview where I'm asked algorithm questions and maybe do some coding. Pretty standard.   * In-person interviews at the whiteboard where they drill the F*** out of you on esoteric C++ minutia (e.g. how does a polymorphic virtual function call work), algorithms (make all-pairs-shortest-path algorithm work for 1B vertices), system design (design a database load balancer), etc. This goes on for six or seven interviews. Ridiculous.  Why would anyone be willing to put up with this? What is the point of asking about C++ trivia or writing code to prove yourself? Why not make the SE interview more like the researcher interview where you give a talk about what you've done? How are technical job interviews for other fields, like physics, chemistry, civil engineering, mechanical engineering?


Seeking Delphi (Pascal) code beautifier

Preferably a tool which will run from inside of the Delphi IDE (I use Delphi 7), but I can accept a standalone program. Should have the ability to define rules (X space indent, no tabs, one statement per line, etc, etc (perhaps capitalization rules too?)) Nice if it can handle an entire directory or project at one touch, rather than just a single file. Anyone?


Do setters and getters always break the Single-Responsibility Principle?

As we know, The SRP states that every class should have single responsibility and that responsibility must be entirely encapsulated by the class. But setters and getters do serve another responsibility - they do abstract class property(data) access. if _Setters and getters_ do abstract class property access, then **they do serve another responsibility**. So if I have something like this,               class Config     {              private location;                   public function write(array $data)         {             ....         }              public function read($key)         {             ...         }              public function exists($key)         {             ...         }              public function delete($key)         {             ...         }              // Below comes property abstraction              // Here I doubt - I CANNOT USE this class without them         // but they seem to break the SRP at the same time!?              public function setFileLocation($location)         {             $this->location = $location;         }                   public function getFileLocation()         {             return $this->location;         }                   public function setConfigArray(...)         {             ...         }              public function getConfigArray()         {             ...         }     }      I do break the SRP. The problem is that, that's the only way class may exists. So the question is, In my situation, it's almost impossible to avoid `setFileLocation()` and `getFileLocation()` methods with CRUD ones. So if by combining CRUD methods with Data Access abstraction I do break the SRP, Is there any way I can adhere the SRP and keep the common concept of the Config class (CRUD operations) at the same time?


When should an IT consultant use full disc encryption?

In what circumstances should an IT Consultant encrypt their hard drive to protect their code/data of their clients? I am thinking that if it does not add much to your work load you might as well use full disc encryption with a 'weak' password to at least prevent someone from accessing your email files and other documents if your laptop is stolen, even if they will not get access to any database files or other very sensitive data.


How do you decide what to work on in your own time?

I've got an itch and it needs to be scratched. I've got nothing to program these days. Normally I'd just pick my flavour of the month technology and fiddle with it, but I want to make something and take a break from serious research/experimentation for a while and just write something for fun (ie. not necessarily purely educational/professional development). Problem is,   * I can't think of software that I need that I don't already have.   * Sifting through the open-source projects on various sites to help out on is excruciating (5 hrs down the tubes so far - not worth the trouble) I'm not looking for a specific suggestion for what to work on because that would be a terribly hard task. I don't think that here knows nearly enough about eachother to effectively give good suggestions. So I ask, is there any mental exercise that you use to decide what to make when you're not "fiddlin'"?


Problem sets or challenges and solutions for beginners to practice MVC, OOP, MVT etc. type problems

Coding bat, project euler, python challenge for example are all amazing brain teasers that usually provide you with some learning material, ways to compact your code, and enhance your problem solving skills. At the end of the day, when you go through a few of those exercises, you learn something new, or you better understood a concept. Are there similar exercises for OOP, MVC, MVVM, MVT, and so on type situations? In class it is usually taught to think of an object as a cat, part of an animal class. and you have mammals and so on. However, in real life, objects are more abstract, and harder to imagine and implement. The same could be said about MVC, MVVM, and MVT, where applying a small system is usually simple, but when the problem is scaled, it suddenly becomes a bit more daunting.


By the definition of a Tree(ADT), is it "wrong" for a node to add a sibling?

The title pretty much says it all. I'm just having a little computer science exercise and am building a Tree. I want a node to be able to add a sibling which requires one to first get a reference to the parent, obviously. I was wondering what is the "correct" way, by definition of what a Tree is, to do such a thing?


MVC: Does the Controller break the Single Responsibility Principle?

The Single Responsibility Principle states that "a class should have one reason the change". In the MVC pattern, the Controller's job is to mediate between the View and the Model. It offers an interface for the View to report actions made by the user on the GUI (e.g. allowing the View to call `controller.specificButtonPressed()`), and is able to call the appropriate methods on the Model in order to manipulate it's data or invoke it's operations (e.g. `model.doSomething()`). This means that:   * The Controller needs to know about the GUI, in order to offer the View a suitable interface to report user actions.   * It also needs to know about the logic in the Model, in order to be able to invoke the appropriate methods on the Model. That means that is has **two reasons to change** : a change in the GUI, and a change in the buisness logic. If the GUI changes, e.g. a new button is added, the Controller might need to add a new method to allow the View to report a user press on this button. And if the business logic in the Model changes, the Controller might have to change in order to invoke the correct methods on the Model. Therefore, the Controller has **two possible reasons to change**. Does it break SRP?


How to unit-test for PHP implicit conversion errors?

Is there a way to find errors caused by crafted input in php, such as naming POST-fields like `variable[]` instead of `variable`, causing PHP to implicitly convert it into an array, by using some form of automated testing?


What is a Ph.D. good for in the software industry?

I'm a self-taught programmer and have just started a computer science degree to supplement my knowledge and fill in the gaps. However, I'm already debating the direction of my education. I want a 4 year bachelor's degree for sure, but after that, I'm not sure: Is it worth it to get an M.Sc? What about a Ph.D.? What opportunities do these degrees open up? Currently my goal is to be a software developer, but there are a number of fascinating fields in the software industry and I'm certainly interested in investigating many of them. It is in this respect that I think a higher degree may be worth it -- even if it wouldn't necessarily help a career of software development. So will it be worth it? Will grad school open doors?


Is there any technology similar to LINQPad for compiling C# that runs in a browser?

Think JSFiddle. LINQPad is pretty sweet for fast C# with similar options. Is there anything like LINQPad that runs in a browser?


What level do I mock when I have function A calling function B which calls the database?

I have created a scenario in which I have two functions, A and B, both are tested, but despite the tests I still injected a rather stupid bug and some data is not getting into the database. Note that there is no ORM present. I've written my CRUD operations directly, and I'm paying the price therefor. In this scenario, I have (perl) something like this:               sub A {       ... do a bunch of work ...       my $res = B( %data );       ... do a bunch more work ...     }          sub B {       my ( %data ) = @_;       ... record data to the database and return a result ...     }      What happened, though, is that in my higher-level application and in A itself, I changed the name of one of the fields that goes into %data, but forgot to change it in B. I have a test for A which stubs/mocks out a _lot_ of the things A does (A needs to meet with a goodly refactoring), including B. The stub for B verifies that all of the correct parameters, including the correct field names get passed in, and so the test passes. _BUT_ the test for B verifies the old field names, the real B actually uses the old field names, and that test passes as well. And, thus, I put into production some code that, because of this oversight, is putting NULLs into the database where I don't want NULLs.   * A is clearly too big. To isolate it, I mock out six different functions, each of which could cause a system state change.   * A, and thus the test for A is theoretically unconcerned as to the strategy by which B will store data in the database or even what kind of database B will store data to, so I think the test for A probably should not query the database directly.   * But, I changed the format of %data, and I think that the test for A should have detected that I basically changed the API without propagating the change down. What is a better way to set up a test to catch this case beforehand?   * Continue with the isolation strategy for A and B, but also write an integration that tests A --all the way to-> the database? This would lead to a proliferation of possible test cases, and I'm already having trouble justifying the existing test case proliferation to management (though I know the coverage to be woefully inadequate).   * Just write the test for A to query the database, possibly through an abstraction?   * Is there something different that would help here? * * * Ultimately, I took Karl Bielefeldt's suggestion. I added the data validation code into function B. I also added the integration test that tests from A all the way to DB. As far as I can tell, I need to have as many integration tests as I possibly can, verifying that the overall state of the system resources change predictably. At the same time, I expect I'll still need to mock network resources if I cannot actually get a test network environment.


Is there a reason to prefer lambda syntax even if there is only one parameter?

List.ForEach(Console.WriteLine);          List.ForEach(s => Console.WriteLine(s));      To me, the difference is purely cosmetic, but are there any subtle reasons why one might be preferred over the other?


Synchronous sockets with Node.js

I want to port an existing app from Java to Node.js - would like to seek your advise. The java app is a multithreaded socket server where arbitrary number of clients can connect. The app runs on java executors. Each client is given a socket to connect to the app. The client will connect to the socket server and there will be handshake. After handshake, the data will be transmitted between the client and server. The data transferred is in sequential order because the client sends the data over as such. And I.m able to control the thread that the client is connected on. Now, Node.js does not have threads so I am confused on how to port the multithreaded Java socket server over. Any ideas?