Ways of integrating legacy applications

My company is one which has grown up rapidly over recent years in multiple territories. We are not a software company per se, but a technical one who have developed various bespoke applications inhouse. Some of these are now sold as SAAS. I am personally responsible for 3 of these applications: all internal web applications, one written in MySQL/Python/Django, one written in SQL Server/Python/Django and one in MySQL/PHP/Symfony. My developer resource includes expertise in all of these, as well as some Java and Adobe Flex. None of us have any significant experience in Microsoft technologies beyond SQL Server. However, all the other departments in my company that have developers all work using the Microsoft stack - all our other webapps are C#/asp.NET etc etc etc. I have been asked to evaluate integration of our depts products with others in the company at a data-sharing and presentational level. I see 3 possible routes:   1. We bite the bullet and move to the Microsoft development stack, and this becomes a company-wide policy. Pros: standardisation, ability to pool resource, integration can be done at any level. Cons: massive licensing costs we can't really afford right now, complete retraining of all developers required, having to use IIS instead of nice Ubuntu/Apache servers, and general philosophical opposition (we're mostly open-source evangelists in my dept).   2. Middleware. We've been looking at Adobe Flex in order to handle data subscriptions between services. Pros: relatively cheap solution, existing in-house experience, can use whatever underlying tech we choose. Cons: it took ages to get a quote for Adobe data services, it isn't clear to me how futureproof this route is - are we potentially buying into a tech that's going extinct?   3. DIY. We stick with open-source all the way, and custom-write web service APIs between all the apps. Pros: cheap on licensing, open-source. Cons: additional time required, more testing, core issue of techology proliferation not tackled I'd be interested to know what other approaches there might be here. Are there other Middleware ways of going about this? Am I hopelessly out of date with my views? What's a safe bet for the future? Thanks


Library version control best practices

I may be violating some StackOverflow terms by asking a question which is more likely to yield discussion than a clean answer. Here goes, however. I've developed some software for a small company that isn't a software house (so we don't already have a lot of processes in place). It is in Turbo Pascal (Delphi 2009) and my source is version controlled (CVS). I use several third party components (graphing, TCP comms, etc.) In Delphi, the default behavior is for the source for these to be stored in an include folder under the the Delphi IDE program files folder. It's now time to pass this project off to another developer. Now he'll have to install the IDE + components in order for them to appear correctly when editing forms in this application. But I'd like our production build process to be automated and I'd like a build server to be able to perform a code checkout and compile. This means I think I really need to put all the source code (or at least the DCUs where I don't have the source files) for these 3rd party addons in source control. I think they should be part of the CVS module for the software project being developed (i.e. not their own source controlled module). I think we need to be able (as a small company) to point a future developer at the repository, and say "Check out this module" and he'll have everything he needs to be able to compile from the command line without doing anything else. (i.e. portability to new dev environments is important) Is this sensible, or would it be more scalable for us to keep each library in its own version controlled state and then in the build script, pull the source code for this project, and the correct version of the source code for each library? Thanks in advance, and my apologies for the rambling nature of the question. Duncan


Do you know any studies about the percentage of boilerplate code?

Hey guys. Do you know any studies about the quantity of boiler plate code in different project types? I don't seem to find any actual numbers. I know this is subjective and relative to the language, project type and frameworks used, but there must be an actual study somewhere that covers at least a niche. Thanks!


JavaScript Architecture, Tools, Compatibility and Pitfalls

I am thinking through how I will use JavaScript for a project which is just in its beginning of coding. I am not an expert in JavaScript, but I recognize it as a very important part of the site so I have a few questions:   1. I often see projects have 1 huge javascript file which handles everything. Is that for the purpose of making things faster?   2. Is it ok to have javascript functions coded inside html pages? Or is it considered bad design?   3. Are most people still using jQuery? I have been seeing a proliferation of other .js frameworks. I know Yahoo made one and there are many others. Is jQuery still the defacto standard for most js frameworks needs? (sorry this question is subjective).   4. How should I approach/test various browser compatibilities? Should I be very concerned about that?


Convincing Upper Management the need of larger monitors for Developers

The company I work for has recently hired on several developers, and there are a limited number of monitors to go around. There are two types in the office - a standard 15" (thankfully flatscreen) and a widescreen 23". No developer has a machine capable of a dual monitor setup, and the largest monitors went to the people who got here first. Three or four new senior level developers only have a 15" monitor to work on. To make matters worse, there are perhaps a total of 25-30 DBAs/Testers/Admin types in the company who all have dual screen 23" setups. We have brought the issue to management, and they refuse to take away large monitors from people who have been here for years for the sake of new employees, even if they are senior level. We have pitched the idea of testers sacrificing a large monitor for one of our small ones, but they won't go for that either. What can I say to management to illustrate the need of monitors for developers?


What benefits can I get upgrading my ASP.NET (Webform) + DAL(EF) + Repository + BLL structure to MVC?

I'm in the process of defining an approach that may best fit our needs for a big web application development. For now, I'm thinking going with an ASP.NET Architecture with a DAL using Entity Framework, a Repository concept to not access DAL directly from BLL and a BLL that call the repository and make every manipulations necessary to prepare data to push in a presentation layer (.aspx files). I don't plan to use ASP.Net controls and prefer to keep things simple and lightweight using plain html, jQuery UI controls and do most of the server calls with jQuery Ajax. Sometimes, when needed, I plan to use handlers (.ashx) to call BLL methods that will return JSON or HTML to client for dynamic stuff. My solution also has a test project that Mock the Repository with in-memory data to not repose on database for testing BLL methods... It may be usefull to add that we will build a big application over this architecture with hundreds of tables and store procedures with a lot of reading and writing to database. My question is, having this architecture in mind, Is there any evident advantages that I can obtain by using an MVC3 project instead of the described architecture base on Webform? Do you see any problem in this architecture that may cause us problem during the next steps of development? I know the MVC pattern for using it in others projects with Django... but the Microsoft MVC implementation look so much more complex and verbose than Django MVC and it's why I'm hesitating (or waiting for a little push?) right now before jumping into it... We are in a real project with deadlines and don't want to slow the development process without any real benefits.


Best practice refactor n-tier into vertical slices architecture

What work path do there exist to identify reasonable vertical slices of a classic n-tier platform code base and infrastructure (enterprise size)? Regardles of refactor or a new solution I think there will be the same approach (more or less?) So i'm primary interested in steps and definitioning of modules, functions, then "test" them into a function-unit or if it's appproved as a vertical. To extend my thoughs..   I understand that a vertical should be a actor, a kind of business value. But is a communication system a actor, or a functional unit in a vertical slice? Probably yes And no (depends on enterprise), but how to decide? Is shipment a part of Order, or are both Order and Shipment different verticals? What should a vertical slice consist of, to be a true vertical? In terms of Levels of functions, like "an own data store, an own client configuration tool, an own business intelligence calculation" and so on. Btw: It's a requirement that the verticals should be deployed and operatable independently of each other. Maybe there is a kind of "yes/no" schema to use? "Is this X used for Y?" Yes - then it's a vertical. "Is this X used with Z?" - Yes, then it's anti-pattern for vertical. "Is X depend on the funtion YY?" If yes, then.. And so on. Links to success stories when define verticals is also of interest.


Question about programming in linux

In the next month I have to shift to work on the ubuntu system and writing c/c++ programs. I used to program in windows visual studio for some years. What should I do to prepare the shift suddenly? And how to debug in that system?


C# .NET 4.0 interactive course?

I would like to learn C# programming. I already studied it for several weeks and wrote some minor programs with VS2010, and I'm not completely newbie at programming because I worked on STALKER - Shadow of Chernobyl as scripter, but it was LUA. I want to become a real programmer. I think C# is a decent way to start with. I already learned about the most commonly used resource sites and got some nice eBooks as well, but unfortunately I don't have time to sit down in front my computer all the time, so my progress is pretty slow. I would like to ask that if someone can recommend me some decent interactive online courses to make my learning progress faster. I know about the "joe grip" course but I don't know if it's worth $39 also it's only for .NET 1.x and 2.0 while I'd like to learn 4.0 so I have no idea what should I do. **UPDATE** Thanks for the advices. I'm not sure if I will develop web or desktop applications in the future, time will tell. First I need to understand the basics of C# and .NET and get some experience. Thanks for the eBooks, I downloaded them, but anyway I've already got several eBooks, for example the Programming C# 4.0 6th Edition, what is approx. 900 pages long. I would rather need video tutorials because nowadays I don't have time to read through ten thousands of pages and it's not so exciting either. Now finally I've found some nice video tutorials where experienced people explains what they are doing. That's fine. I didn't know about that MSDN Virtual Labs, thanks for that too.


Generate commercial license key for web service

# Background I have a business question regarding web-based software licensing. A number of web sites offer software as a service for various APIs. A good example is Google's Custom Search API. The process to use web services typically resembles:   1. **Account.** User creates an account.   2. **Server.** User defines the IP address(es) of the server(s) that will make API requests.   3. **Key.** User receives a public API key for the desired API(s).   4. **Guide.** User is given documentation that shows how to use the API key to make a request.   5. **Test.** User can make test requests to verify integration functionality.   6. **Billing.** User pays to activate the account.   7. **Production.** User integrates the web service into their applications.   8. **Deactivation.** System deactivates accounts when expired, exceeds request limit, etc. These requirements are in addition to integration with the service being licensed. # Problem That is a lot of work for a small business. # Questions What off-the-shelf, open source projects address this problem? If there are no such projects, what would you do to architect a viable, low- cost solution (ideally, a percentage of each license)? That is, what software or existing commercial services would you use for a small business (having little to no income) that seeks to license web-based services? Thank you! # Related Links   * License key solution in web application, what is the best approach?   * API Management System


What is the difference between "recursion" and "self-reference"?

The wikipedia articles are too advanced for me to understand, could someone give me a simple explanation please?


What do you do to make the client understand that requirements not mentioned in contract should be charged separately?

I've done a very small project for a specified amount of payment. The project was some client-side validation code. However, now client asks for code improvement (general code improvement including server-side, not mine which was purely jQuery and client-side) and says that these requirements are obvious duties of developers. What should I do? He doesn't pay till I do something for performance tuning, while we agreed on client-side validation only. Should I forget about my money? Or maybe I should do the second requirement without expecting any return?


How to get a reference to a central AssetLoader in every Widget?

I'm working on a simple UI system for a game. The building blocks are `Widget` objects, which can contain each other. There are several sub classes of `Widget`, e.g. `LabelWidget`, `ImageWidget`and `ButtonWidget`. Since nesting is possible, a `ButtonWidget`is really nothing but a container for a `LabelWidget` and an `ImageWidget`. I'm pretty happy with that. The problem is: I now need to use an `AssetLoader` to load images, I cannot get them directly from the disk. There are multiple `AssetLoader` implementations, one for each platform the game runs on, and there is only one instance which is created early on. And it has state. So now I need to pass an `AssetLoader` object into `ImageWidget`. And into `ButtonWidget`, since it contains an `ImageWidget`. And so on. I've updated the code and now I need to pass an asset loader into almost every widget, and I really don't like what I see. I've investigated some code bases of UI frameworks I like, and noticed that Android has something similar: There is a `Context` object which is passed into every view, which can be used to load resources. But since views there are usually instantiated magically from XML, it's not as annoying to use as what I have. I can think of only one way out: Make a singleton that does nothing but offer a reference to the asset loader, e.g. `AssetLoaderHolder`. But I'm not convinced that this isn't actually worse than what I have. Can you think of any remotely elegant solution for this? Note that using a dependency injection framework is not an option for me.


Designing my password class(es). How to split it up?

I've inherited a custom made authentication system that needs some refactoring. I'm not quite sure what the best way to split it up the password section and could use some help. **The password class(es) need the following functionality:**   * **Check to see if a password conforms to restrictions.** It needs to be able to provide feedback on why it is incorrect.   * **Generate three kinds of hashes.** We have several file-systems with incompatible hashes, so unfortunately I have to maintain three hashes.   * **Give a different hash for a certain user type.** If a user is web-only we do not keep a password for them as they cannot use the system. Their passwords are always `*`.   * **Be able to verify a password for a given user.** Fortunately I only have to authenticate against one of the three hashes I have to maintain.   * **Be able to generate a random password, unencrypted.**   * **Submit new password to the database.** * * * I'm thinking about using four classes, `Validator`, `Hasher`, `Generator`, and `Changer`.   * Validator      * `isCurrentPassword(int userid, string password): bool`     * `getViolations(string password): array`   * Generator      * `generate(int length):string` Creates a password.   * Hasher      * `hash_*(string password): string` where `*` is the hash type. I'll have four hashing functions.   * Changer      * `change(int userid, string password):void; throws database exceptions` * * * **What would you recommend and why?**


I have a stacktrace and limit of 250 characters for a bug report

I'm developing an xbox indie game and as a last-resort I have a `try...catch` encompassing everything. At this point if an exception is raised I can get the user to send me a message through the xbox however the limit is 250 characters. **How can I get the most value out of my 250 characters?** I don't want to do any encoding / compressing at least initially.   Any solution to this problem could be compressed if needed as a second step anyway. I'm thinking of doing things like turning this: > at EasyStorage.SaveDevice.VerifyIsReady()   >  at EasyStorage.SaveDevice.Save(String containerName, String fileName) into this (drop the repeated namespace/class and method parameter names): > at EasyStorage.SaveDevice.VerifyIsReady()   >  at ..Save(String, String) Or maybe even just including the inner-most method, then only line numbers up the stack etc. * * * **TL;DR: Given an exception with a stacktrace how would you get the most useful debugging infromation out of 250 characters?** (It will be a .net exception/stacktrace)


How to use designs skills as an advantage when looking for a programmer job?

Most programmers are not designers; at least that is what I hear a lot. I consider my design skills to be on par with my programming skills, although I prefer programming if I had to choose one. I feel like that could be a great advantage, but I don't know how to use it to my advantage when searching for a job. It seems either people are looking for a designer or they are looking for a programmer. Its hard to find someone who is looking for someone who is _both_. This may be because someone who is both is either too rare, or not actually desired. If it is indeed a desirable combination, then how do I use it to market myself?


How far can I push refactoring without changing external behavior?

According to Martin Fowler, code refactoring is (emphasis mine): > Refactoring is a disciplined technique for restructuring an existing body of > code, altering its internal structure **without changing its external > behavior**. Its heart is a series of small behavior preserving > transformations. Each transformation (called a 'refactoring') does little, > but a sequence of transformations can produce a significant restructuring. > Since each refactoring is small, it's less likely to go wrong. The system is > also kept fully working after each small refactoring, reducing the chances > that a system can get seriously broken during the restructuring. What is "external behaviour" in this context? For example, if I apply move method refactoring and move some method to other class, it looks like I change external behaviour, doesn't it? So, I'm interested in figuring out at what point does a change stop being a refactor and becomes something more. The term "refactoring" may be misused for larger changes: is there a different word for it? **Update.** A lot of interesting answers about interface, but wouldn't move method refactoring change the interface?


Best way to get programmers to ask for help when they get stuck

What is the best way to ensure that programmers ask for help when they get stuck on a problem, rather than spending too much time trying to figure something out when they've hit a wall? I'm especially interested in how to optimize this with a distributed team. Some ideas that come to mind:   * pair programming   * co-locating the team   * timeboxes (after expiration, must ask for help) Things (goals) to think about:   * avoid developing dependence on others   * maximize learning & knowledge transfer   * cost of developer A's time to help vs. developer B's time to figure it out him/herself There is also the concern that even if a developer comes up with a solution, it may be of lower quality than if they had asked for help. I believe code reviews are a good way to address this. This question: When do you not give help to less experienced programmers? is good background reading for this one.


How to join the World of Programming?

Name's Vlad and I am currently on my third year of Community College, studying Computer Science with emphasis on Programming in C++ and Networking. I have completed a few programming courses with general ease, but have not gained advanced understanding of programming through school. None of my friends are serious programmers working in the industry. Being an active lurker on many programming websites, and in general tech oriented sites I have noticed how little I know about the industry, the lingo and terminology. (I have no clue how Git hub works, but I generally understand what its for). So I am looking for help as to where I should look for information on the programming world and the industry in which I a very interested. By that I mean, what sites I should utilize to gain information on programming practices, introduction to advanced C++ and resources that simply introduce a 20some programming noob. I like programming, but I haven't dug my hands deep into it yet, I want to start to do so before I transfer to a University. All in all, where do I find information on becoming an actual programmer (Information that lays out a path).


What should my "code sample" look like?

I've just had quite a good phone interview (for a CakePHP-related position, not that it's especially important to the question). The interviewer seemed to be impressed with my resume and personality. At the end, though, he asked me to email him a code sample from my existing work project, "to check you're not secretly a terrible programmer, ha ha!" I'm not _too_ worried that my code can't stand on its own two feet, but I'm very much an intermediate programmer rather than an expert. What obvious pitfalls should I make sure my code sample **doesn't** fall into, in case they rule me out on the spot? Secondly, and this is probably the harder part of the question to answer, what features in a code sample would be so impressive that they would instantly make you **much more favourably inclined** towards the programmer? All ideas or suggestions welcomed!


Should a senior developer refuse to take paper exams during an interview?

I found that many senior developers refuse to do paper exams in interviews. They regard the exam as a kind of humiliation, because they think that "They don't trust my programming ability even if I have five years working experience... only junior staff need take a paper exam...". However, Joel insists: > **11\. Do new candidates write code during their interview?** > > Would you hire a magician without asking them to show you some magic tricks? > Of course not. Is it justifiable if a senior developer refuses to take a paper exam in an interview?


MVC Controller - keeping methods small

I'm reading uncle Bob's Clean Code and it completely revolutionizes my programming style. In this book author claims that best methods are small methods. What about controller's action methods in modern frameworks? Do you try to follow the "20 lines per method" rule, or you delegate some tasks to private methods? I don't ask about things that you can move to services and external classes, sometimes there are situations that you cannot avoid bigger code in action. Another question and another look at this problem - do you tract controller class as (some sort of) special class with only action methods, or just another regular class with private methods and own fields along with action methods?


Which is better design: Determining if a function should execute from outside of it, or inside of it?

I'm often presented with these two options. From a design point of view, which of these is subjectively better, and why? Option A               class foo {       private boolean bar() {         //Stuff       }            private void A() {          if(bar())            B();       }            private void B() {           // more stuff       }     }      Option B               class foo {       private boolean bar() {         //Stuff       }            private void A() {           B();       }            private void B() {          if(!bar())             return;               // more stuff       }     }      Let's assume that code duplication isn't an issue here, and the division is only to separate, logically, the code for better readability/understanding (A, B, and bar have meaningful names in context). Is it more readable to have the reader know that B might not do anything when looking at just A? Or is the encapsulation of state better put into B? Obviously, this can be refactored to separate B and bar() into a separate class entirely, which separates concerns even more, but assuming mostly shared state, which is better?


Why Aren't Rule Engines Written In Prolog?

From what I've seen of Prolog, it seems as if it would be ideal for crafting a rule engine for an app. Yet, I don't believe I've ever seen a rule engine written in Prolog. Is there some inherent limitation in Prolog (e. g. poor garbage collection algorithm) that would prevent it from being used to build a rule engine?


JS design pattern/algorithm for avoiding duplicate redraws in a fairly coupled system

Given:   * some sort of widget based web app   * lots of JS functionality   * high coupling (communication/callbacks between widgets)   * widgets draw themselves   * certain widgets need to do a complete and fairly expensive redraw every time one of their dependencies is changed. Problem: there can be complicated dependency chains and it becomes difficult to make sure redraws only happen once per user action. For example:   * `A` needs to be redrawn if `B` or `C` change   * `B` is dependent on `C`'s state   * So if `C` changes, so does `B` and _both_ may end up causing `A` to redraw. If this only happens a few times, it's easy to solve. But when it happens all over, it becomes a nightmare to engineer and makes maintenance even worse. I assume this is a somewhat common problem, so there must be some method of dealing with. That or my designs are flawed in some way. Any suggestions? Either some design pattern or an algorithm to deal with limiting redraws would be very much appreciated. **Edit** Alright, based on Randall's suggestions, here's what I'm thinking:   * Semaphore like global variable but without any multi-threading stuff so basically just a global count. Let's name this `S`. I would have one per widget that requires expensive redraws.   * `S` has a signal and a wait function. Signal increments `S` and wait decrements it.   * `S` is initialized with a callback function to the draw of the widget.   * Every time something is triggered (user event, ajax return, etc) `S.signal()` is called.   * Once the event is finished changing things within an object (after callbacks are made), `S.wait()` is called.   * `S.wait()`, after decrementing `S` check if count is 0. If it is, it redraws. So if `C` changes:   * `C` runs `S.signal()` (`S==1`)   * `C` makes its changes, callback to `B`   * `B` runs `S.signal()` (`S==2`)   * `B` makes its changes   * `B` runs `S.wait()` (`S==1`, no redraw)   * `B` finishes, C starts again.   * `C` runs `S.wait()` (`S==0`, redraw) Like the dirty flag but more of a dirty-count and I think this is easier to implement. It can be extended for additional functionality fairly easy. If, for some reason, I want to optimize it so not everything is redrawn in certain cases, I can add some flags that represent things to be redrawn and reset them every draw. Also, it could be replaced with a stack and do basically the same thing but with some better extension capabilities. **Edit 2** Izkata's solution turned out to be trivial to implement and only slightly less flexible. Only 2 changes are needed:   * Add a timerID property to the widget that needs redrawn.   * Wrap redraw function in a timer: JS code:               A.draw = function(){         var that = this;          clearTimeout(this.drawTimer);         this.drawTimer = setTimeout(function(){that._draw();},0);     }     A._draw = function(){         //old draw code goes here         //could be made "private" or nested in A.draw     }        * No other changes are needed so your interface stays the same and it works unless you need it to work with Async code like ajax calls.


Showing a grammar is ambiguous

I have the following question taken from a compilers course exam:               Show that the following grammar is ambiguous.          S = XcY     X = a     Y = b | Z     Z = bW     W = d | ϵ      I drew the following tree: ![grammar diagram](http://i.stack.imgur.com/17J52.png) Am I correct in thinking it is ambiguous because **acY** can end up at **acb** (one of which is followed by an epslion) following different paths?


How do you convince development teams to move to a new version of middleware?

I'm working on a project to update our (out of support) middleware stack to a stable but supported version. There are several teams with applications running on the version we currently have in production and understandably nobody wants to carry the risk of being the first to run on the newer version. What strategies have you used or found most compelling to move to a new release like this in the past? There are some performance and functional benefits offered by the newer version but there isn't really any major technical incentive for the teams to move that's a must-have right now. This is mainly being driven by the cost of extended support for the old version and also a desire by the infrastructure teams to be running on a supported version with the improved management offered by the newer version. It's more of a people question than a technology question.


What do Java developers think of Scala?

I've noted that IDE support is nowhere near as good, but the language itself supports functional programming idioms much more cleanly.


Should Controller know about View & Model? or vice versa?

I'm conceptually trying to understand if I should be doing this:               item = Model()     screen = View()     brain = Controller(item, screen)      or this..               brain = Controller()     item = Model(brain)     screen = View(brain)      or this..               class Controller():         def __init__(self):             item = Model(self)             screen = View(self)      or something else entirely?


Should I create interfaces for data transfer objects?

Is it a good idea or a bad idea to create an interface for data transfer objects? Presuming that the object is usually mutable. Though my example is in Java, it should be applicable to any other language that has similar concepts.               interface DataTransferObject  {         String getName();         void setName(String name);     }          class RealDataTransferObject  implements DataTransferObject {              String name;         String getName() {             return name;         }          void setName(String name) {             this.name = name;         }     }      Of course, this is a simplified example, in real life there may be more fields.


Can desktop applications be written using javascript?

Is it currently possible to write desktop applications using javascript, html, css?   Possible solutions:   Use Adobe AIR runtime and program in js. But no, if I'm using AIR, the AS3 suites it the most. So not a good option.   GWT: No because it uses Java and then convert it to js or what ever.   Pyjamas: Interesting. But I'm currently focusing on JavaScript. So I don't want to use python and cross-compile to js. Run a local server and use the browser in full screen mode. Sort of okay, but still its the same browser thing. And difficult to distribute.   So what is the best option? I'm excited about node.js which is the main reason for looking into JavaScript. Otherwise I would have choose python.


Cloud service and IM protocol advice, for a backend to group chat mobile app

**Overview**   I’m going to develop an app on Android and iOS. It will allow users to set up group ‘chat rooms’ and talk on chat rooms set up by other users. The service needs to be highly scalable, such that it could accommodate a massive increase in users overnight (we can only dream).    **Background info**   Previously I've used mainly Java and Python, but the most appropriate languages for this task should be used. I don’t mind learning a lot of new skills. **Chat requirements**   The chat protocol should be flexible: it should allow for determining who can view/post on ‘chat rooms’ based on factors determined by the first poster/creator of the particular ‘chat room’. It should also allow for users to simply install the app and begin using the service, after only providing a simple nickname (which could be changed later).    **Chat protocol plans**   Having looked around I think the XMPP protocol is the best candidate. In particular the Multi-user chat extension looks like what I’ll need. Would this be most suited to my requirements, or do you know another potential solution? _Update:_ I've since researched the Protocol for SYnchronous Conferencing and it seems to fit perfectly with my needs. However I am unsure how well documented it is or how I would actually implement it.    **Cloud service**   I have been deciding between Amazon Web Services, Google App Engine and Windows Azure. I’m coming to the conclusion that Azure will be best, as it is easier to manage than AWS (ease of scalability will be a key factor in the design), I think it may be less restricted than GAE, plus Azure will soon have toolkits to allow easy interfacing with both Android and iOS phones. _Update:_ Looking into it further it seems that AWS would be cheaper, and that they do have provisions, such as Elastic Load Balancing and Auto Scaling, that makes the extra work needed to maintain scalability fairly negligible. Is this the decision you would have made, or would you recommend/look into other cloud services?    **General Requirements**   Any components should be well documented, proven reliable and preferably high- level where possible. For example I would prefer to use a plugin to implement the chat protocol rather than write it myself - thus leaving it to more experienced people.    **Thank you**   Thanks for reading, and any advice you have about any aspect would be greatly appreciated :-)


what info do wcf/.net developers need when joining a new project?

I'm a technical writer tasked to document a rather complex WPF/WCF .net application for a governmental agency. I'm not sure where to start and would like some suggestions from .net developers about what information I ought to capture. If you were a .net/WCF developer and you were brought into a massive custom .net application using WCF, what information would you need to be able to figure out how to use and customize or extend the system? The application, when finished, will consist of:   * a client app which is available on each machine of an AD authenticated user   * a variety of web services which are run on a machine IIS   * one big SQL database which contains the data for the records created by the system   * calls to third party applications available elsewhere which will be called by the main application. This is a multimillion dollar custom application with lots of hands touching it and lots of developer hours. It also involves a lot of stakeholders and financial transactions. The purpose of my documentation is to document the application system for future developers who are new to the project or support personnel who have to figure out what's not working. We already have a technical writer who is documenting user behavior and typical user behavior, so I don't need to cover that. The developer lead explained a little about the system itself and how the dll's on client and server app talk to one another. He also said that the dll's themselves are compiled code that by themselves they aren't interesting. He also explained that there is a data abstraction layer (called "entities framework"??) which the developers will reference in Visual Studio (instead of incorporating SQL queries in their code). Because of this data abstraction layer, the lead developer seems to feel that documenting the DB tables is not useful (which makes sense). Instead I need to document the service components at a fairly high level. Now my question: what sort of information should I be capturing? What sort of information would help experienced .net developers learn how to develop for a new application? What sort of questions should I be asking the developers to get this information? I am not a developer (and certainly not a .net developer), but I've worked with several programming languages and documented several Windows apps. The manager who assigned this task to me must feel that the app is not well-documented (even though I've found a lot of UML diagrams and diagrams by business analysts which document business processes. My main audience for whatever I produce will NOT be system administrators or users but other developers. So do you have any ideas or tips for me? Thanks.


Whats the best book to master OO language, say C#?

I have quite some experience in software development.   In the initial stages I worked on a really large project, with dozens of projects involved in it, hundreds of large files each with 10s of thousands of lines which has been under development from 2 decades. It was so complex that rather than understanding all the architecture, OO implementation, I just followed my line managers orders. (My first big mistake) And then a year back I joined a rather small company where I have major chunk of development responsibility where I have to do the design and development.   Thru my experience, I am in a position to write code to accomplish any business logic. But I cant make use of all goodies of Object Orientation. Is there a book that is practical oriented with real world examples which helps me understand why and where to use interfaces, polymorphism, inheritance or one that gives good examples on SOLID? Or, since I know how to cut code, is it the design patterns I should be looking for?


Text message (SMS) paid by receiver

I am building a system where the staff have to sent confirmation text messages to our mobile phone. Is there an easy way so that our company immediately pays for the text message? Sort of a collect-sms instead of collect-call.


Why can't there be an "universal" programming language that serves all purposes?

why not combine the best features of the all existent programming languages and fit it in a universal programming language?


Incremental self-education

What is the best way to **incrementally educating yourself**? I mean I have a team, we work in scrum with 14 days long sprint and I would like to reserve each sprint some time for self-education including theory/practice all together (that whole team will study the same area, for example 4 hours each). For example to learn design paterns, is there any site (paid or not it doesn't matter) which provides self-education in following form:   * clear explanation of one topic (which could be studied in question of hours)   * provides some primitive self-evaluate test which finds out whether he understood (could be implementation of one example where correct result is also provided) I think this "school style" would be very efficient and it would be incremental and continuous education. Books usually doesn't provide that self testing part (they are mostly theoretical), and 1 week trainings are different topic (they are expensive and usually 50% forgotten by trainee) I also very like **"Pecha Kucha"** presentation format, but it dosn't bring a new "know how" to the team. I would appreciate any sites or books providing self-education in this format


What are some possible interactions between multiple bugs?

I was thinking about how two bugs could interact with one another. The only relationship I can think of is one bug being the cause of another. What other interactions between multiple defects are common in everyday coding? What kinds of behaviors could result?


How to sell/distribute my software?

I'm working on a personal project (Windows desktop application) and started thinking about trying to make some money from the application (not the source). I'm not expecting to make a billion dollars but who knows right? The easiest way I see is give it out for free and allow people to donate but I'm not sure how well that works or what payment system is the easiest/best (Paypal)? If I were to sell it how would go about that? 3rd party distribution? Sell it from my own website with Paypal and verify reciepts? Build my own "store" for the application? Essentially: What method did you use to make money from a personal project (donation, selling, other?) and how did you go about it? Tips? Thanks for your response.


what's the name of the position in an one man project (do everything from talking to the client to typing code)

I worked on a project where I did everything from   * talking about how the software should be and how they are doing the stuff at the moment with the client (end users) ...   * choosing technology to be used   * typing code   * installing the application on the web server previously I was writing in my cv that I worked as a **software developer** what should I write now ? * * * it's a 16 people Non-profit organization sponsored by USAID, I did a country- wide system for managing and paying subventions to farmers


Is it an acceptable practice to Get a property, that involve parsing binary, that might throw an exception?

I have a property that is loaded lazily, any time after the ctor is called. It is possible that the binary that my property relies on is invalid. If invalid I might have to throw an exception. Should I   1. Make the property a method, and be done with it.   2. Leave things as is.   3. Leave the property as-is, but add a method to validate the object, which will invoke the lazy parse, that might throw an exception.


How to keep track of links pointing to existing web applications in an Intranet?

At my new place of employment we have a Intranet solution containing multiple web applications hosted in IIS. Outside of the development department other departments either source or create other applications / reports that deep link into these web applications. Unfortunately, I have no direct control over these potential applications and some get created without our knowledge. This causes a problem if we need to do some re-structuring or re-factoring. I was wondering if anyone had an approach where all inbound links regardless of origin had to be registered - i.e like a link registry or some other approach on how to deal with this. This could then be used so that the impact of any re-organisation of the structure of the web application could be understood. Any help much appreciated


Even distribution through a chain of resources

I'm working on an algorithm which routes tasks through a chain of distributed resources based on a hash (or random number). For example, say you have 10 gateways into a service which distribute tasks to 1000 handlers through 100 queues. 10,000 connected clients are expected to be connected to gateways at any given time (numbers are very general to keep it simple). Thats   * 10,000 clients    * 10 gateways (producers)   * 100 queues    * 1000 workers/handlers (consumers) The flow of each task is client->gateway->queue->worker Each client will have it's own hash/number which is used to route each task from the client to the same worker each time, with each task going through the same gateway and queue each time. Yet the algorithm handles distribution evenly, meaning each gateway, queue, and worker will have an even workload. My question is what exactly would this be called? Does such a thing already exist? This started off as a DHT, but I realized that DHTs can't do exactly what I need, so I started from scratch.


Implementing a claims-based security model to secure a WCF service

Currently, all of our web applications (and the WCF services they interact with) are run internally. Nothing is exposed to the web. We want to open up our web applications to the Internet and will need to secure access to the services. We have several existing "RESTful" WCF services. We want to secure these services using Windows Azure Access Control Service (ACS) and several possible Identity Providers (Google and one or more Active Directory Federation Services). I want to use JWT as the token format (I know it's in beta in Azure). I'm hoping someone could offer some advice or point me in the direction of good tutorials...everything I read is using ASP.NET WebAPI...and we don't want to use that. We want to be able to support any client that can parse JSON. Currently, our web apps are just HTML/jquery. Some guidance would be great. Thanks!


Finding minimum path with return?

I'm having trouble understanding a past quiz question I got: Bobby works at Starbucks in San Mateo (V). He is doing quality assurance testing and needs to visit stores in Palo Alto (B), Tenderloin (C), and San Jose (S) - and then return to San Mateo for a meeting. The distances between the stores are: V→B = 2   V→C = 3   V→S = 6   B→C = 1   B→S = 5   C→S = 4 Which is the first store he visits in the optimal solution to this problem? How would you approach solving this problem? It reminds me a bit of Djistra's algorithm but I suspect there's an easier way other than trying every combination as the time limit is short. My interpretation:                 B__1__C       |     |     2 |     | 4       |__6__|       V     S      For Bobby to visit all 4 stores and return to V, he simply starts at V and travels the edges of the above box. But the question is asking which is the first store? Either direction will give a total of 13, so how is there a right answer?


Need an optimization algorithm

I need this algorithm for one of my projects. I will paraphrase the problem. There are 'n' ropes that have different colored rings on them. (The colors might repeat on the same rope or across different ropes). My job is to pick a few of these ropes and join them such that all the colors in the n ropes are included in that joined rope. I should get the smallest rope size possible. I am allowed to cut each rope once and discard the end part if needed. There is one pre-defined end for each rope which should be used as the starting point incase that rope is included in the solution. It will be nice to have exact solution for this.(This gives us something like a goal that our project is aiming to achieve). Can someone tell me how I might approach this? The n is about 10^5 for my work. The total number of colors is also of the order of 10^5. The number of distinct colored rings on each rope ranges from 0 to about 10^3 at most.


Convert an interpreter to a compiler?

First off, I know this is a question asked by MANY other programmers before me. But I couldn't find any useable resource that could help me. Well, I'm creating an programming language called "Light" the syntax is comparable to python but it has an strict object-orientated concept. I have made an interpreter ( in C++ ) for this language yet, my problem is how to turn this into an executeable. ( Or simply: how do I make an compiler ? ) Thanks for your attention P.S.: I've found some links to a very old tutorial but it is in Pascal... EDIT: Well, well. Now I have found a suitable tutorial for C++. About the project: There have been some changes. Now the language is called "Q." ( kju Dot ).


How to measure that a team is doing Test Driven Development

My team is considering a department goal of doing Test Driven Development next (fiscal) year. TDD sounds good and my manager is on board. The only problem is measurement. Our company rules require that department goals be measurable. Is there any (sane) way to measure if a team is doing TDD? **Note:** We had a goal for writing unit tests already, **so a code coverage goal will not work.** We write the unit tests but we do it after the fact, not before. Is there a way to measure that TDD is being done? (NOTE: We use Visual Studio 2013 and TFS in case it matters)


How do I get a project owner to participate in acceptance testing?

I have started using Pivotal tracker for a project I'm working on. Conceptually, this seems really cool and I'm interested in using the agile model. However, I have one problem with everything talked about in the video. At 4:19 in the linked video they talk about story acceptance and how it should be done by the project owner. This concept sounds great on paper but I'm not sure I can actually get the project owner to sit down and try out even half of the new features I create, let alone all of them. My question is: how do you approach a product owner about the work that this flavor of the Agile Model asks of them? What do you do if they refuse to participate in acceptance testing?


Does scrum have any merit in defense contracting?

Overheard at the watercooler yesterday: "Scrum has no place in defense contracting." I tend to disagree in the sense that I believe Scrum can be tailored to work in many scenarios and I can see defense being one of them. This sparked a huge debate amongst my colleagues (many of us work in defense contracting) with a fairly even split for/against. To make this a proper question: Has anyone successfully used (or has experience working with) scrum in a defense contracting situation? What worked well, what didn't work well and what (if any) modifications to vanilla scrum did you do?


Is there a term used when internal variables are declared public and accessible?

If someone writes code so that an internal variable $_fields is accessible without using getter/setter methods, is there a proper term used to describe that? Something polite enough to use with management :)


Ideal Programmer for Client-Side HTML5 Game Development

Our next game will be built on Javascript/HTML5 Canvas rather than ActionScript/Flash. Clearly there are not enough experienced HTML5 Developers in the market (yet), so we'll need to be creative in our hiring efforts. So the question is what the profile looks like for that model developer who can learn the necessary skills on-the-job as efficiently as possible. Here are the options we have considered--really just the two obvious and opposing models. **1\. Hire Flash developers**   * _disadvantage:_ they will have to learn not just a new language but also a new development environment, because of the idiosyncratic nature of Flash Builder every component of an HTML 5 Dev environment is likely to seem new and unfamiliar   * _advantage_ : already fluent in client-side development--the tasks remain the same only the language has changed.   **2\. Hire the most talented developers available**   * _disadvantage_ : latency--most or all of their time for (8-12?) weeks should be spent in a pure learning mode with no other demands on their time.   * _advantage_ : they will learn quickly and they'll continue to learn; outstanding programmers will become outstanding Javascript programmers; it will just take some time.       The best answer to this Question might offer a third recruiting model, or it might present a more refined analysis of the two presented below. In other words, i did not intend the prior discussion to constrain the responses in any way.


idquantique .vs. rdrand

We are currently looking at using the idquantique random number generator device to provide random numbers. There are some issues though. We would only be using one device and we have at least 5 servers that would need to use it and this number will probably increase in the future. This implies that blocks of random numbers would have to be sent to the servers in some way. All the servers are running Linux. All of our servers are Intel based and have the RDRand random number instruction available. It would be easier to use RDRand since no networking calls would need to be made and RDRand also appears to be significantly faster. But, the question I would like answered is - is there a difference between the quality of the random numbers generated by RDRand and those generated by idquantique? Has anyone ever measured or tried to measure how well these two random number devices perform against each other?


Domain Services as facades

I read .NET Domain-Driven Design with C#: Problem - Design - Solution and I noticed that the author created a domain service for each aggregate root. However, the domain services were only facades to the corresponding repository. For example this is a code sample from the application from his book               public static class CompanyService     {         private static ICompanyRepository repository;         private static IUnitOfWork unitOfWork;              static CompanyService()         {             CompanyService.unitOfWork = new UnitOfWork();             CompanyService.repository =                  RepositoryFactory.GetRepository<ICompanyRepository,                  Company>(CompanyService.unitOfWork);         }              public static IList<Company> GetOwners()         {             return CompanyService.GetAllCompanies();         }              public static IList<Company> GetAllCompanies()         {             return CompanyService.repository.FindAll();         }              public static void SaveCompany(Company company)         {             CompanyService.repository[company.Key] = company;             CompanyService.unitOfWork.Commit();         }              public static Company GetCompany(object companyKey)         {             return CompanyService.repository.FindBy(companyKey);         }     }      As you see almost all calls to the services are wrappers to repository calls. Is this a good pattern when building domain services? Should we always wrap our repositories in domain services? Is there a better approach?


What's the role of a Project Manager in Scrum? I have heard that it is not advisable for the PM to be a SCRUM Master which I can see as making sense as the PM oversees the project whereas the SCRUM Master is more concerned with managing the work packages. To my mind it would seem that having a PM as SCRUM Master goes against managin by exception, one of the principles of PRINCE2. The PM should be more concerned with:   * establishing the scope of the project, ensuring the business case for the project remains valid   * planning the number of iterations   * maintaining the overall project plan including software release dates   * acquiring external resources needed by the Scrum team e.g. users for User Acceptance Testing   * managing risks and issues which are escalated by the Scrum team   * communicating with the executive including reporting progress Could any PM's (or SCRUM Masters) experienced in managing agile projects using SCRUM give their experience/opinion on whether the two roles could/should be combined?


How to prevent hardcoding addresses in a web project?

In a fairly complicated web application, there are almost hundreds of redirecting to another page, or linking to another page, etc. Imagine that you have a page called `/services/users/register-new-user` and in many places you want to redirect users to this page, or you want to provide links to this page. However, if for any reason in future, you change this address to something like `/users/register`, you should update all links, otherwise they won't resolve. I'm finding myself always encountering this problem, since wherever I want to redirect or link to `/services/users/register-new-user` I hard-code the entire relative address. How can I improve this pattern?


Freelancers: How Do You Go About Gathering Requirements?

As a freelance programmer:   1. What is your process for gathering requirements from a client?   2. How much time does the requirement gathering process take you? I know this is not fixed, and there are variables such as how prompt the client is in responding and such. In general, accounting for the delay in responses and such, how long does it take to get to the final requirement?   3. Which communication channel (email, phone, instant messenger, other) do you use to gather these requirements?   4. Do you charge for the time spent in requirements gathering?   5. Are there any deliverables in your requirements gathering process? If so what are they?


What problems should I be aware of when franchising my code?

I provide a web service using a site and recently I got a proposal for franchising that service to another company. The problems come when they want all my code to run in their servers. I understand their reasons, but I want to take measures that the core of my PHP code remains hidden and unchanged. I want to take measures that they don't resell my code to another bidder, or use my IP. After some research I came up with a few solutions like PHP encryption, obfuscation or data fingerprinting. What I'm asking is manly:   * What should I be aware of when giving my code?   * What can I do to prevent them from understanding and selling my code to another person?


I've had 7 jobs in 16 years. Is that OK?

I've had 7 jobs in 16 years. This is what happens at every job:   * Year 1: New people! New place! New tech!   * Year 2: Productive.   * Year 3: Disinterested. Can I get another job, doing the same thing, but make more money? Now I'm in year 5 of my current job and I'm still disinterested. But, I'm making 99k as a "consultant" and won't be able to make any more money anywhere else, for just programming. Also, I never make friends at my jobs. I don't write code in my spare time. I chose MIS because I knew it would get me a good paying job and I wouldn't have to rely on anyone else for money. I'm surrounded by people who have a passion for developing, which makes it even worse. I have to take anti-depressants and I have a post-it note saying "Gratitude" that I have to look at everyday to remind myself that I have it great. Does anyone else go thru this? Is it normal for programmers?


What do you do about content when someone asks you to build a website

I am an experienced asp.net developer and asp.net mvc and I have my own CMS that I have written but starting to think there should be another approach. When someone asks you to develop them a website how do you develop it so that they can add pictures,slideshows, content, news items, diary events. On a side note do you give them a design for the home page and inner page and thats it. I'm just thinking if they turn around and say 6 months down the line I want a jquery slideshow on the right hand side of this page how do you or CMS's handle it?


How to write stories for internal projects

I'm working on a project which runs as a process, on a regular basis. The results of the projects daily run are used by other projects. This brings me to question how our team writes stories. The normal format, `As a [role] I want [goal/desire] so that [reason`] does not seem to apply, but at the same time I'm doubting that. This is what we do now: _The system shall execute after process ABC has finished successfully._ Should we be using the other projects (that utilize the data from our process) as the _role_ portion of the stories? What we do now just seems too much like requirements..


would like help understanding javascript throttle function

A user on Stack Overflow posted a question related to overriding a native JS function. The question is here and this is the code:               function throttle(fn, time) {       var handle;            var execute = function() {         handle = null;         fn.apply(this, arguments);       };            var throttled = function() {         if(!handle) {           handle = setTimeout(execute.bind(this), time);         }       };            throttled.toString = function() {         return fn.toString() + "\n// throttled to " + time + "ms";       };            return throttled;     }          var makeAjax = throttle(function(callback) {       $.getJSON("/path", callback);     }, 500);      I have a pretty good handle (I think) on JavaScript, but there are some areas that remain very grey to me. I would like to know what is happening in this code? I don't really understand what `bind` and `apply` are doing, or what the end result of this all would be. I've looked up `bind` and `apply` on Mozilla's JS documentation, but the "official" definition has done little to help me understand what they are doing in this context. I appreciate your help!


project layout using webapi

I have the following project structure I would like to implement. I would like to know if there are any pitfalls to structuring my code this way. It is going to be using Microsoft's WebAPI, an MVC 4 project, and Plain Old C# Objects (POCO). The explanation follows. First off there is going to be a class library project that contains only interfaces and objects like so:               public interface IBookService {        IEnumerable<Book> GetBooks();     }          public class Book {        public int Id { get; set; }        public string Name { get; set; }     }      This interface and class will be shared by the other projects. The first being the implementation project which contains:               public class BookService : IBookService {       // implementation that pulls books from somewhere     }      The third project is going to be a WebAPI project that exposes `IBookService` as a uri, such as _http://mysite/books_. **UPDATE:** This WebAPI site will be sitting on a different machine than the MVC site. Now here is where I'm concerned about my implementation choice. The fourth and final project is an MVC 4 application. It will reference only the interfaces and the web api (via `HttpContent` and friends). I would like to implement the `IBookService` interface in this project as well. Except in this implementation it would call the WebAPI like so.               public class MvcBookService : IBookService {        public IEnumerable<Book> GetBooks() {           var client = new HttpClient();            client.BaseAddress = new Uri("http://mySite"); // would be pulled from config           client.DefaultRequestHeaders.Accept.Add(              new MediaTypeWithQualityHeaderValue("application/json"));                HttpResponseMessage response = client.GetAsync("books").Result; // blocking call           if (response.IsSuccessStatusCode) {               // blocking call               return response.Content.ReadAsAsync<IEnumerable<Book>>().Result;           } else {              // handle response code              return null;           }        }     }      I plan on enforcing this project structure for all WebAPI interaction within the company. I don't for see any maintenance problems with this project layout. However many eyes always helps.


Multi-platform design with Delphi, Java, MySQL and CouchDB

What are the most obvious drawbacks to this idea for an enterprise(ish) model using the following technologies.   1. Browser based and native developed GUI using Delphi to connect to    2. Datasnap server (Delphi, obviously) via Rest which stores documents in      1. A CouchDB Server  But gets the structure for those documents from a centralized tree of   3. JBoss servers connecting to      1. MySQL databases which have information about all kinds of domain specific things   4. Which connects to another JBoss server, all the way up to a centralized hosted repository to maintain some sort of control over licensing and structure of the program.  I know that's kind of vague, but bear with me. I'm really asking:   1. Whether it's sensible to use a mixture of NoSQL and SQL DB's and    2. Whether it's easier to mix them if they're not connected to the same backend service.   3. If this is just crazy.  I thought of it on the drive to work and it seems to solve all the problems that we have. I'm not sure that datasnap is robust enough, but we could use node.js or another jboss server instead. I just wanted to go with Delphi since we've got it and know it. I think this is a fairly normal model, the difference being the web server (or datasnap server) being the thing that has a database attached to it as well as the data server. I think it's better that way, and it would probably make sense if I said this is for medical records primarily and it's better that documents stay separated from things that need to be updated, but it's meant as a general purpose solution for storing info in a structured way.


implicit vs explicit interfaces

I think I understand the actual limitations of compile-time polymorphism and run-time polymorphism. But **what are the conceptual differences between explicit interfaces (run-time polymorphism. ie virtual functions and pointers/references) and implicit interfaces (compile-time polymorphism. ie. templates).** My thoughts are that two objects that offer the same explicit interface must be the same type of object (or have a common ancestor), while two objects that offer the same implicit interface need not be the same type of object, and, excluding the implicit interface that they both offer, can have quite different functionality. Any thoughts on this? And if two objects offer the same implicit interface, what reasons (beside the technical benefit of not needing dynamic dispatch w/ a virtual function lookup table,etc) are there for not having these objects inherit from a base object that declares that interface, thus making it an _explicit_ interface? Another way of saying it: can you give me a case where two objects that offer the same implicit interface (and therefore can be used as types to the sample template class) should not inherit from a base class that makes that interface explicit? Some related posts:   http://stackoverflow.com/a/7264550/635125   http://stackoverflow.com/a/7264689/635125   http://stackoverflow.com/a/8009872/635125 * * * Here's an example to make this question more concrete: Implicit Interface:               class Class1     {     public:       void interfaceFunc();       void otherFunc1();     };          class Class2     {     public:       void interfaceFunc();       void otherFunc2();     };          template      class UseClass     {     public:       void run(T & obj)       {         obj.interfaceFunc();       }     }      Explicit Interface:   `                           class InterfaceClass     {     public:       virtual void interfaceFunc() = 0;     };                              }                              class Class1 : public InterfaceClass     {     public:       virtual void interfaceFunc();       void otherFunc1();     };                              class Class2 : public InterfaceClass     {     public:       virtual void interfaceFunc();       void otherFunc2();     };                              class UseClass     {     public:       void run(InterfaceClass & obj)       {         obj.interfaceFunc();       }     }      * * * An even more in-depth, concrete example: Some C++ problems can be solved with either:   1. a templated class whose template type provides an implicit interface   2. a non-templated class that takes a base-class pointer which provides an explicit interface  Code that doesn't change:               class CoolClass     {     public:       virtual void doSomethingCool() = 0;       virtual void worthless() = 0;     };          class CoolA : public CoolClass     {     public:       virtual void doSomethingCool()       { /* Do cool stuff that an A would do */ }            virtual void worthless()       { /* Worthless, but must be implemented */ }     };          class CoolB : public CoolClass     {     public:       virtual void doSomethingCool()       { /* Do cool stuff that a B would do */ }            virtual void worthless()       { /* Worthless, but must be implemented */ }     };      Case 1: A non-templated class that takes a base-class pointer which provides an explicit interface:               class CoolClassUser     {     public:         void useCoolClass(CoolClass * coolClass)       { coolClass.doSomethingCool(); }     };          int main()     {       CoolA * c1 = new CoolClass;       CoolB * c2 = new CoolClass;       </br>       CoolClassUser user;       user.useCoolClass(c1);       user.useCoolClass(c2);       </br>       return 0;     }      Case 2: A templated class whose template type provides an implicit interface:               template <typename T>     class CoolClassUser     {     public:         void useCoolClass(T * coolClass)       { coolClass->doSomethingCool(); }     };          int main()     {       CoolA * c1 = new CoolClass;       CoolB * c2 = new CoolClass;       </br>       CoolClassUser<CoolClass> user;       user.useCoolClass(c1);       user.useCoolClass(c2);       </br>       return 0;     }      Case 3: A templated class whose template type provides an implicit interface (this time, not deriving from _CoolClass_ :               class RandomClass     {     public:       void doSomethingCool()       { /* Do cool stuff that a RandomClass would do */ }            // I don't have to implement worthless()! Na na na na na!     }               template <typename T>     class CoolClassUser     {     public:         void useCoolClass(T * coolClass)       { coolClass->doSomethingCool(); }     };          int main()     {       RandomClass * c1 = new RandomClass;       RandomClass * c2 = new RandomClass;       </br>       CoolClassUser<RandomClass> user;       user.useCoolClass(c1);       user.useCoolClass(c2);       </br>       return 0;     }      Case 1 requires that the object being passed in to _useCoolClass()_ be a child of CoolClass (and implement _worthless()_ ). Cases 2 and 3, on the other hand, will take _any_ class that has a _doSomethingCool()_ function. If users of the code were always fine subclassing _CoolClass_ , then Case 1 makes intuitive sense, since the _CoolClassUser_ would always be expecting an implementation of a _CoolClass_. But assume this code will be part of an API framework, so I cannot predict if users will want to subclass _CoolClass_ or roll their own class that has a _doSomethingCool()_ function.


Feedback on this back-end stack

I'm planning to setup an scalable architecture capable of providing web services on a REST interface where JSON will be sent as a result. The web services will be quite simple for a CRUD web 2.0 app. ![Architecture](http://i.stack.imgur.com/Omfqb.png) I think javascript (nodejs + mongodb) is a good choice for the following reasons:   * Easy to find javascript developers   * Good performance   * Easy to scale   * Shared logic/language or possible reuse of code between database query language, back-end and web-client.   * There are testing and logging frameworks for node   * By the examples I've seen node seems light in terms of the lines of code needed to implement web services. **Questions:**   1. I think of scaling a node app which supplies a web service as having a central node which will be routing/balancing charge to each of the node instances. Which will also help doing seamless updates, is there any piece of software already implemented which can fit that task?   2. Please point all the disadavantages or other advantages you find in this back-end stack   3. Any other good persistence choices other than MongoDB? Mainly this choice comes from the javascript query language and JSON schemas.


Should special (simpler) cases have separate code paths?

I have a rather complex method which can get called in two possible "scenarios". One is a special case of the other in which all the nested `foreach` loops are only executed once and several `if` statements are false such that essentially only two lines of code nested deeply inside the method are actually executed. Now the question is: Should I provide a separate (simpler) code path for the special case even though the complex code handles that case just as well? I suppose the code would be more readable/understandable that way but I don't want to give the impression that the two cases are handled differently. Performance is not an issue here so the fact that a simpler code path might also execute faster is negligible. Example code:               foreach(...)     {         foreach(...)         {         ...             if(...)             {                 ...             }                  Something();         }     }      as compared to               if(SpecialCase)     {         Something();     }     else     {         foreach(...)         {             foreach(...)             {             ...                 if(...)                 {                     ...                 }                      Something();             }         }     }


what is the difference between callbacks and listeners?

In blackberry we can override keyChar() method and capture the keypress event or we can register onKeyPressListener. i know, onKeyListener is observer pattern. In android also there is a KeyEvent.callback and onKeyListener Both are events why we no need to register for keyChar event. what is the difference between both pattern?


Where should I put functions that are not related to a class?

I am working on a C++ project where I have a bunch of math functions that I initially wrote to use as part of a class. As I've been writing more code, though, I've realized I need these math functions everywhere. Where is the best place to put them? Let's say I have this:               class A{         public:             int math_function1(int);             ...     }      And when I write another class, I can't (or at leat I don't know how to) use that `math_function1` in that other class. Plus, I've realized some of this functions are not truly related to class A. They seemed to be at the beginning, but now I can see how they're just math functions. What is good practice in this situation? Right now I've been copy-pasting them into the new classes, which I'm sure is the worst practice.


AngularJS directive architecture: Where to put parameters?

I'm using a charts-Plugin (Morris.js) in my AngularJS application. I'm building a directive for each type of chart. The plugin is called like this:               new Morris.Line({       // ID of the element in which to draw the chart.       element: 'myfirstchart',       // Chart data records -- each entry in this array corresponds to a point on       // the chart.       data: [         { year: '2008', value: 20 },         { year: '2009', value: 10 },         { year: '2010', value: 5 },         { year: '2011', value: 5 },         { year: '2012', value: 20 }       ],       // The name of the data record attribute that contains x-values.       xkey: 'year',       // A list of names of data record attributes that contain y-values.       ykeys: ['value'],       // Labels for the ykeys -- will be displayed when you hover over the       // chart.       labels: ['Value']     });      The first step is just to include this code into my `link`-function:               angular.module('app')       .directive('donutchart', function () {         return {           link: function (scope, element, attrs) {             new Morris.Bar({              element: element[0].id,              data: [               { Age: '20', value: 20 },               { Age: '25', value: 10 },               { Age: '30', value: 5 },               { Age: '40', value: 5 },               { Age: '50', value: 20 }             ],             xkey: 'Age',             ykeys: ['Amount'],             labels: ['views']           });         }       };     });      But I don't like it to manipulate the directive when i want to change the data. So I save every attribute inside the scope inside the controller. But, is this the 'right' way to do it? Or should I use a config variable to store very attribute? Like:               var CONFIG = { bar_labels: ['views'] }      and then inside the controller:               $scope.bar_labels = bar_labels


Does it make sense to use interfaces if you don't have polymorphism?

Suppose I have distinct classes that have the same behavior, which can be represented like this:               public interface Behavior {         void operationA();     }          public class ImplementerA implements Behavior {         public void operationA() {              }     }          public class ImplementerB implements Behavior {         public void operationA() {              }     }      But `ImplementerA` and `ImplementerB` are used by distinct clients; `ClientA` only uses `ImplementerA` and `ClientB` only use `ImplementerB`; other than these, there are no other clients for `ImplementerA` and `ImplementerB`. In this scenario, does the interface `Behavior` have any purpose? Should it be created because maybe future requirements changes...


Need explanation of hexagonal architecture

I am reading about Alistair Cockburn's Hexagonal Architecture http://alistair.cockburn.us/Hexagonal+architecture with interest. One claim he makes is: "Finally, the automated function regression tests detect any violation of the promise to keep business logic out of the presentation layer. The organization can detect, and then correct, the logic leak." I do not understand this point. Is he saying that because the test is headless, then calls to a ui layer will throw exceptions? That doesn't seem to be a very sound test!


When, how and why should one upgrade (Java) frameworks?

Short summary as introduction: We are a small Java web development team, creating applications using various frameworks and libraries like JSF, Hibernate, Seam, all together deployed in JBoss AS. Initially, the app was put together and some features added to form a showcase to show to potential customers. Some polishing took place, the app got released, it was accepted and working and as time went by, additional features were added, bugs got fixed, new bugs occurred, as it always is. Due to high bus factors and startup racing, development got a bit out of hand - more and more features were added, not having fully understood the core architecture of the system. It's still working, but there are always pitfalls because the system evolved from where it originated to something else and in the beginning, various shortcuts were taken to speed up development - now all this comes back and development slows down, because workarounds are used and it's fairly hard to introduce new developers into the project. Now, I'm in the progress of cleaning up and organizing things - installing a bug tracking system, build up a testing/quality culture, thinking of how to do automated testing, code reviews (all that fancy professional stuff we were lacking in the beginning) and doing general refactoring like organizing class hierarchies and functions to make it easier to use stuff. That makes everything a bit better, but there is still a lot to do. As I'm not the person who initially build the system (former lead programmer left) and not that experienced (developing for 2.5 years now, but that's my only 'open world' experience so far), I'm not always sure what to do. Here's my problem: Refactoring is always something good and I'm constantly doing it to make things easier, but what puzzles me is when, how and why I should upgrade the basic architecture (that means, libraries the system relies on, application server, database etc.) Examples:   * We are currently using JBoss 4.2.2 - I read somewhere of JBoss 7.1 already out, should I go for that? How can one evaluate this?   * We use Seam 2.2 what seems to be a big blocker (does not work on higher JBoss versions, doesn't support JSF2). In addition, I see sources telling me to use JEE features instead of Seam. Basically, I'm interested in any generic approach for this problems, not only the ones I mentioned in the examples above - as I may stumble over this problems for another library on another system in another time (or someone else may face similar problems). So, what's the point? Shall I be up to date and use only cutting edge libraries or should i stay with what i have? How do I recognize, the technology I am using is literally a dead horse and jump off? How often should such technology upgrades appear? And, another question beside the general 'how to do upgrades'-stuff. How do I recognize my piece of software could be called one 'crafted by professionals'?. Is there a Joel test for well-done software besides common programmers sense?


Multithreading synchronization interview question: Find n words given m threads

I came across this question: > You are given a paragraph , which contain n number of words, you are given m > threads. What you need to do is , each thread should print one word and give > the control to next thread, this way each thread will keep on printing one > word , in case last thread come, it should invoke the first thread. Printing > will repeat until all the words are printed in paragraph. Finally all > threads should exit gracefully. What kind of synchronization will use? I strongly feel we cannot take any advantage of threads here but interviewer is trying to understand my synchronization skills? No need of code, just put some thoughts. I will implement by myself.


Selecting a software license for a blog posting in CodeProject.com

I am planning to post an article on codeproject.com where I will be sharing some code I feel worthy of the effort - so I went and read the posting guidelines. It appears that I will have to select a software license for my submission. I really do not care about my material and what people will do with the code that I will give. If they profit from it that is all fine with me and I am happy to have shared my ideas. My concern really is more about my own personal protection that if the code I give for some remotest of reasons inflict damage to them or to their system that I should not be liable for anything. Or something to that effect. My material is about patterns for ASP.NET CRUD operations. I use this pattern every single project that I have. It is absolutely harmless, but you never know really how other people will use it. I just want to have some safety net. What license is suitable for me in this situation?


Hiring programmers for small companies?

I've been running a company for nearly 10 years, and all this time it's been just myself, another programmer (who's a great friend and cofounder), and a salesman (who's also a friend). Together, we've managed to do decent business and we've all managed to make a living, but we've been trying to expand for a long time now. Unfortunately, there are a few problems:   * The technology we use is not obsolete, but it's also not as popular compared to other web development options like PHP   * We work in a competitive market, competing against multi-million dollar companies   * We can't afford to pay new programmers or salesmen very well. We make enough money for ourselves, but unless we got a significant number of new customers we wouldn't be able to pay much.   * Because of the fact we can't pay much, we use a slightly more rare technology, and we compete against large companies, we find it difficult to find new programmers or salesman. We desperately need to expand, but when we try to get more customers, we can't support them with so few people (or their demands grow outside of our range of expertise) and when we try to hire new programmers and salesman, we usually don't get a high quality and they usually don't provide a major benefit for our company. Does anyone have some suggestions or tips on how we could expand?


Is it better idea to call an external command-line application or to internalize that application's logic?

I have a "pipeline" sort of process that is essentially just linking together a bunch of existing tools to automate a workflow. For one of the steps, there is an existing command-line tool that already does the meat of what that step needs to do. The external CLI tool is java-based, and so is my pipeline, so it would be possible to integrate the tool directly into the pipeline step, but the tool is very complex and is currently closely tied to having command-line input (something like 37 config flag options). The question is: Is it a better idea to simply call out and invoke the external process, or would it be better to integrate the external code within my application? What are the pros / cons of integrating vs. calling the external process?


What are some good End-User Programming solutions you have seen?

End-User Programming is where regular end users, i.e. non-programmers, are able to customize a program, or create a new one, with minimal training or instruction. App Inventor for Android is one recent example, but perhaps the most popular example of end-user programming is the spreadsheet. What examples of end-user programming have you seen used, or believe to be useful? What's the philosophy of the system? What challenges remain?


what is a basic block called if it contains a branch instruction? How about a block that does not contain a branch instruction? Thanks,


My architecture has a problem with views that required information from different objects. How can I solve this?

I am building an architecture like this: These are my SW layers                ______________     |              |     |    Views     |     |______________|           ______________     |              |     |Business Logic|     |______________|           ______________     |              |     |  Repository  |     |______________|      My views are going to generate my HTML to be sent to the user Business logic is where all the business logics are Repository is a layer to access the DB My idea is that the repository uses entities (that are basically the representation of the tables, in order to perform DB queries. The layers communicate between themselves using Business Objects, that are objects that represent the real-world-object itself. They can contain business rules and methods. The views build/use DTOs, they are basically objects that have the information required to be shown on the screen. They expect also this kind of object on actions and, before calling the business logic, they create BO. First question: **what is your overall feeling about this architecture?** I've used similar architecture for some projects and I always got this problem: If my view has this list to show :               Student1, age, course, Date Enrolled, Already paid?      It has information from different BO. How do you think one should build the structure? These were the alternatives I could think of:   * **The view layer could call the methods to get the student, then the course it studies, then the payment information**. This would cause a lot of DB accesses and my view would have the knowledge about how to act to generate this information. This just seems wrong for me.   * **I could have an "adapter object", that has the required information (a class that would have a properties Student, Course and Payment).** But I would required one adapter object for each similar case, this may get very bad for big projects. I still don't like them. **Would you have ideas? How would you change the architecture to avoid this kind of problems?** @Rory: I read the CQRS and I don't think this suits my needs. As taken from a link references in your link > Before describing the details of CQRS we need to understand the two main > driving forces behind it: collaboration and staleness That means: many different actors using the same object (collaboration) and once data has been shown to a user, that same data may have been changed by another actor – it is stale (staleness). My problem is that I want to show to the user information from different BO, so I would need to receive them from the service layer. How can my service layer assemble and deliver this information? Edit to @AndrewM: Yes, you understood it correctly, the original idea was to have the view layer to build the BOs, but you have a very nice point about the creation of the BO inside the business layers. Assuming I follow your advice and move the creation logic inside the business layer, my business layer interface would contain the DTOs, for instance               public void foo(MyDTO object)      But as far as I understand, the DTO is tightly coupled to each view, so it would not be reusable by a second view. In order to use it, the second view would need to build a specific DTO from a specific view or I would have to duplicate the code in the business layer. Is this correct or am I missing something?


When to write tests for a new class using BDD?

I've been practicing behaviour driven development (BDD). I understand that you have to write tests that test the behaviour of the code, and this will allow the design of your code to evolve and take shape. When doing BDD and I find I need to refactor my code into a better design, and that refactor happens to involve extracting some code into a new class, when do I start writing tests for that new class? Or are tests not needed for that class at all since it's a implementation detail and the behaviour of it should already be tested with the existing test coverage?


Chrome's multiple process per each tabs

I am wondering what is the purpose of Chrome using multiple processes for each tabs? I asked this to C++ chat room and one responded it is a product of laziness. I personally believe this is an example of "Distributed processing" like in Erlang programming language. What exactly is it?


Do you use Mathematica during the software development process?

I'm curious whether Mathematica could help me in software development or not. Do you use it for that, and for what? For instance, do you use it to analyze algorithms, or to do something else? I will probably buy myself a (student) license, but I'm not completely sure (if it isn't good for software development, I might still use of it for math, of course).


Why do some programmers hate the UI part of the development?

Lots of programmers that I've met always says that "He is not a UI guy." The fact is that development nowadays, whether web, Windows, Linux, OSX, or any other type of development now comprises software with a good-looking UI. Why do so many developers seem to not like UI work?


How do I reduce the number of WCF config files in a SOA?

After embracing the whole SOA thing, I've found that I'm gradually drowning in a sea of web.config and app.config files. As an example, one system has 2 services that it interacts with. Each service has 3 config files - one for dev, one for staging and one for production. That's 6 config files. Then each application (3 different ones) that use these services needs three config files again, that's another 9. So that's 15 config files just for a relatively simple system. How can I go about simplifying my configuration? Is there a better way of doing this? Should I try to make my config files environment agnostic? Should I investigate the whole WCF Discovery? Should I use the web.config transformation syntax?


Why is it bad to write something in language X as if you're writing a program in language Y in terms of using a shared coding paradigm

A while ago, I asked a question on SO about something written in C++, but instead of getting an answer to the problem at hand, the comments went all crazy on my coding style, even when I indicated that it was a WIP piece of code and that I meant to clean it up later when I had the base case running. (I got so many down votes that I decided to pull the question, as my rep on SO already is near-abysmal) It made me wonder why people adopt such a hard line "you're a noob, go fuck yourself" attitude. I was being accused of writing C++ as if it was Java. Something that I cannot understand, and that still baffles me. I've been programming in quite a few OOP languages for a number of years now, albeit in intervals. I choose the language to use in terms of its available libraries and optimal execution environments for the job at hand. I adopt design patterns in OOP code and I'm quite confident that my use of patterns is sound and that OO wise, I can hold my own. I understand the OOP toolbox, but choose to use the tools only when I think it's really required, not to just use a neat trick to show my coding wits. (Which I know are not top notch, but I think aren't at n00b level either). I design my code before I write a single line. To define tests, I list the goals of a certain class, and the test criteria that it has to adhere to. Because it is easier to me to create sequence diagrams and then write code, I chose to write my tests after the interface has become obvious. I must admit that in the piece of code I posted in the question, I was still using pointers, instead of using smart pointers. I use RAII whenever I can. I know proper RAII means safeguarding against nullpointers, but I work incrementally. It was a work in progress and I meant to clean it up later. This way of working was condemned strongly. In my view, I should have a working example first so I can see if the base case is a viable way of thought. I also happen to think that cleaning up the code is something that is typical of the refactoring phase of agile, after the base case has been proven. I must admit that although I'm slowly getting the Cxx standard, I prefer to use what I understand, instead of taking the risk of using concepts that I have yet to master in production code. I do try new stuff once in a while, but usually in play projects that I have on the side, just for that purpose. [edit] I'd like to clarify that gnat's suggestion [1] did not show up in the search I did before I started to ask my question. However although his suggestion does cover one aspect of the question, the question he linked to does not answer the heart of my question, just part of it. My question is more about the response I got to my coding style and the professional aspects of handling different coding styles and (apparent) levels of skill. With my previous question on SO and it's response as a case in point. [/edit] The question then is: why scoff someone that doesn't use your coding style? The matters/subdivisions at hand for me are:   * Why would it be a bad programming practice to use more error prone code in prototype situations, if refactoring makes it more robust afterward?   * How would can program written in C++ be like it was written in Java? What makes it a bad program, (considering that I indicated the intent of the current style and the planned work to improve?)   * How would I be a bad professional if I chose to use a construct that is used in a certain programming paradigm (e.g. OOP/DP)? [1] Develop fast and buggy, then correct errors or be slow, careful for each line of code?


How do I improve my logic in general and programming in particular?

I'm good with understanding technology and implementing it. At least that is what I feel. But it seems that when I come across experienced programmers they point out that my logic is weak. I feel that I would need some time with real programming to improve it. But nobody is ready to give that time to me. I'm just about starting my carer and it often feels disheartening to hear this. I want know how can I improve my logic and also does this sort of thing happens to others too?


Is the "One Description Table to rule them all" approch good?

Long ago, I worked (as a client) with a software which use a centralized table for it's codified element. Here, as far as I remember, how the table look like :               Table_Name (PK)     Field_Name (PK)     Code (PK)     Sort_Order     Description      So, instead of creating a table every time they need a codified field, they where just adding row in this table with the new Table_Name and Field_Name. I'm sometime tempted to use this pattern in some database I design, but I have resisted to this as from now, I think there's something wrong with this, but I cannot put the finger on it. It is just because you land with some of the structure logic within the Data or something else?


Do modular PHP frameworks really improve applications?

One of the goals of modular frameworks like Kohana or Alloy is to make it easy to add and remove components (i.e. "plugins" or "modules"). However, in all the larger projects I have ever worked - the system often becomes dependent on the modules it is built on. After all, that is why they are there - to build with them. **So, I'm wondering if the concept of building distinct separate sections of a web application as independent modules is even a good idea to begin with?** For example, we may build a general user, forum, and blog module - but each project is different and usually involves building many layers of abstractions to add new features - or editing the files directly to customize them. I can't re-use the same module on multiple projects. In other words, they are no longer just a _plug-in-play_ add-on to the site. _Now I'm not confusing this with proper class design to ensure un-coupled MVC and library logic_. But I'm wondering if "MMVC" was a superfluous effort to apply proper class design concepts to application design as well. After all, many migration systems or database libraries like Doctrine require all the relations spelled out in the models from day one, thereby linking the entities. Is it one of those things that sounds like a good idea when the project starts, but eventually is shown to be a useless feature? Do modules have their place in systems like wordpress - but not in frameworks where you are obviously building something custom?


How to show confidence during an interview?

I got into an interview which I knew what I am trying to explain or have some idea on the question of the interviewer. What's the best way to explain it and show my confidence?


C# Interview Preparation - References?

This is a specific question relating to C#. However, it can be extrapolated to other languages too. While one is preparing for an interview of a C# Developer (ASP.NET or WinForms or ), what would be the typical reference material that one should look at? Are there any good books/interview question collections that one should look at so that they can be better prepared? This is just to know the different scenarios. For example, I might be writing SQL Stored Procedures and Queries, but I might stumble when asked suddenly Given an Employee Table with the following column(s). EmployeeId, EmployeeName, ManagerId Write a SQL Query which will get me the Name of Employee and Manager Name? NOTE: I am not asking for a Question Bank so that I can learn by rote what the questions are and reproduce them (which, obviously will NOT work!)