To which layer does this code belong?

When I say "Revisional Data Model", I mean a data model where information is never lost: Deletes never destroy any rows, and updates always cause an insert somewhere else to preserve a row's previous state before the update. There are a few I've read about, and heard from colleagues:   1. Triggers in the database. The main reason why I don't like this approach is because if you depend on triggers to enforce revision integrity, the application becomes tied to the database server. If using an ORM with different providers (Oracle, MySQL, T-SQL, etc), you may need to alter some SQL to switch between them.   2. Human-readable trace logs. Last year I played Business Analyst for a project with a new developer because one of our sister departments was slammed with important deadlines. She insisted that, despite the requirements I gathered and the schemas I modeled, she would insert a stored procedure to be executed with each create/update/delete statement. This sproc would just write out the old data as a formatted string, and save it to a ERRORS_LOG table in the database. Her goal was to help her with debugging the application in case anything went wrong: she wanted a trace.   3. Creating sister tables. This approach is like having 2 databases living in the same context. For the table Person there would be a PersonHistory table, for Product there would be ProductHistory, and so on. The schemas would be identical, and each time a change happened in the entity table, the previous state would be inserted into ProductHistory. If you have an application where you want to allow users to "undelete" or "restore previous version" of an entity, only #3 seems like a workable solution. However, since each pair (entity and its history) have the same model/schema, they can in fact be combined. By adding bool/bit properties like IsCurrentVersion and IsDeleted, you can slice a single entity set into different states within the WHERE clause. Consider this example #4. One disadvantage of #4 is that the database tables become hard to read when you select all rows. Mining data from a db server ide would require pretty extensive use of views, which causes the same problem as in option #1. Looking at all of the different states together in the same table makes it much more difficult to read. With approach #3, you need to look in a different table to find previous versions & deletes. We've been using approach #4 with success. We have a RevisableEntity supertype with properties that indicate when data was changed, who changed it, whether it was deleted, archived, or modified. Updates occur on rows just as they would under normal circumstances. However as part of the same action, a corresponding insert is made into the same table / entity set. The insert contains the same values as the update before it was updated. The updated row, in addition to whatever changes were made by the user, also updates the when and who properties. Now for my question: Where does this code belong? In the domain, or in the repository implementation? There are certain aspects of this that are storage dependent, which hint at putting the code where your ORM coupling is. However there are other aspects that the domain / application layers should be able to trust. Maybe the domain entities should manage their own revisional integrity, or maybe there should be a factory to coordinate?


Should a Presenter or a View sort data in an MVP application?

A typical MVP application might have a View method such as:               void setDisplayItems(List<DisplayItem> items);      Should the Presenter sort the list of items or is that a task for the view? I feel this might be a task for the View, for two reasons:   1. If it were a task for the Presenter, then methods such as:              void addDisplayItem(DisplayItem item);      won't work, as the Presenter can't insert the item at the correct place.   2. The View can offer different sorting options, based on user selections. However, I also can't shake the feeling that this is too much "thinking" for the View to be doing. Can anyone comment on the correct choice for MVP? I should note that I typically produce Swing-based Java applications (in case that allows for more specific answers).


Python file layout for web development package hacking

I come from a PHP background so I'm used to everything being in one place. I want to install a python program (Zine)so that I can hack on it. The instructions I've found install it to the system in multiple folders. I do not want to edit files that are installed in Linux system directories. What is the python way to layout the directory on the filesystem for a web program that under active development? would it be:               /web/htdocs/python/modules/app.py      or               /web/python/modules/app.py     /web/htdocs/      or               /web/python/modules/app.py     /web/python/htdocs/


Small projects using the cathedral model: does open-source lower security?

We know of Linus' law: > With enough eyeballs all bugs are shallow In general, people seem to say that open-source software is more secure because of that very thing, **but**... There are many small OSS projects with just 1 or 2 developers (the cathedral model, as described by ESR). For these projects, does releasing the source- code actually lower the security? For projects like the Linux kernel there are thousands of developers and security vulnerabilities are quite likely going to be found, but when just some few people look through the source code, while allowing crackers (black hat hackers) to see the source as well, is the security lowered instead of increased? I know that the security advantage closed-source software has over OSS is security through obscurity, which isn't good (at all), but it could help to some degree, at least by giving those few devs some more time (security through obscurity doesn't help with the if but with the when). **EDIT:** The question isn't whether OSS is more secure than non-OSS software but if the advantages for crackers are greater than the advantages for the developers who want to prevent security vulnerabilities from being exploited.


"How to code better" training

We frequently recruit fresh talent into our company straight from the Universities. While a lot of training goes on for these developers, I think there should be a training program that simply teaches them good coding skills (note, I am not talking about knowledge of .net framework). What I am looking for is a software which allows me to automate some of this training. The part that should be automated is   * Create coding assignments   * Automatic submission of assignment   * Automatic evaulation of the submitted assignment on code quality Have you guys ever seen something like this in the wild?


What are the pros and cons of a language using whitespace vs. {}'s to indicate scope?

There seems to be a conflict over whether its better to use whitespace or tokens like brackets to indicate scope. I've seen many praise python's solution to the inconsistent indentation problem, but many disagree: > Any language that has whitespace as tokens needs to die. posted later on the same answer: > I was sortof anti-whitespace-as-tokens, until I actually tried it. It > probably helped that my personal white-space layout pretty much matches what > everyone in python-land uses. Perhaps it's that I am a bit minimalist, but > if you're going to indent anyways, why bother with the {}s? I can see some clear arguments for each side: using whitespace:   * helps reduce inconsistent indentation in code   * clears the screen by replace visible tokens with whitespace to serve the same purpose using tokens:   * much easier to cut and paste code to different levels (you don't have to fix the indentation)   * more consistent. Some text editors display whitespace differently.   * more popular currently. Are there any points I missed? Which do you prefer? Any words of wisdom after having worked with one or the other for a long time? * * * PS. I hate it when languages don't use the same token for each control structure. VB is really annoying with its `End If` and `End While` statements, most other languages just use {}'s for everything. But maybe that's a topic for a different question...


Coding with laptop and external screen - neck, back, comfort

Guess I'm not the only one here coding on laptop + external keyboard + external screen. I can't really decide. **Figure 1** : Putting screen directly in front of (upright) my eyes and move laptop to the side. That feels like more comfortable but I can't really see so good to 15" laptop which is now quite away. Feels unused. **Figure 2:** Putting laptop in front of me and move external monitor on side. Feels like more efficient space usage, but I am afraid that my neck/back might start hurting since I need to turn my head often. What do you prefer? Some good advice? Sacrificing health is definitely no option here so that's why I'm worried and asking this silly question. Thanks


Generating CSRF tokens without using sessions & cookies

I'm writing a library to generate and check CSRF tokens. I would like to do it without having to use sessions and/or cookies. What I've come up with is this:   1. A token generated from the current time and a unique token id (unix-timestamp.unique-token-id).    2. The token would then be hashed using the HMAC method. The returned value would be: hmac-hash.unix-timestamp.unique-token-id. This could then be hidden in a form.   3. The library would then test the returned token by extracting the HAMC hash, time and unique token id from it and then compare the returned HAMC hash to one generated using the returned time and unique token id. As long as the HMAC secret on the server stays secret it should be secure or did I missed something?


My software is hosted on a "bad" website. Can I do anything about it?

**Edit:** Thanks for all of the answers, guys! I think I'm just going to include some kind of text on my webpage telling users to only download from the links provided. The thing is that there have been some legitimate and illegitimate websites that have picked up on my software, so it would be safer just to tell users to avoid any website that I don't link to. Thanks a lot for all the help! **Original:** The software I've created is hosted on what you could call a "bad" website. It's hard to explain, so I'll just provide an example. I've made a free password generator. This, along with most of my other FREE software, is available on this website. This is their description of my software:               Platform: 7/7 x64/Windows 2K/XP/2003/Vista     Size: 61.6 Mb     License: Trial     File Type: .7z     Last Updated: June 4th, 2011, 15:38 UTC     Avarage Download Speed: 6226 Kb/s     Last Week Downloads: 476     Toatal Downloads: 24908      Not only is the size completely skewed, it is not trial software, it's free software. The thing is that it's not the description I'm worried about--it's the download links. The website is a scam website. They apparently link to "cracks" and "keygens", but not only is that in itself illegal, they actually link to fake download websites that give you viruses and charge your credit card. Just to list things that are wrong with this website: they claim all software is paid software then offer downloads for keygens and cracks; they fake all details about the program and any program reviews and ratings; they and the downloads site they link to are probably run by the same person, so they make money off of these lies. I'm only a teenager with no means to pursue legal action. This means that, unfortunately, I can't do anything that will actually get results. I'd like my software to only be downloaded off my personal website. I have links to four legitimate locations to download my software and that's it. Essentially, is there anything I can do about this? As I said above, I can't pursue legal action, but is there some way I can discourage traffic to that website by blacklisting it or something? Can I make a claim on MY website to only download my software from the links I provide? Or should I just pay no mind? Because, honestly, it's a bit of a ways back in Google results. Thank you ahead of time.


Is there any benefit to obsession with making code "look pretty"?

Sometimes I spend ridiculous amounts of time (hours) agonizing over making code "look pretty". I mean making things look symmetrical. I will actually rapidly scroll through an entire class to see if anything jumps out as not looking "pretty" or "clean". Am I wasting my time? Is there any value in this kind of behavior? Sometimes the functionality or design of the code won't even change, I'll just re- structure it so it looks nicer. Am I just being totally OCD or is there some benefit hidden in this?


Testing strategy for production environment

In an ideal world, dev/ops are working together as one team to release something onto production. However, there are organizations with limitations so that release engineers/teams are kept completely away from development/project teams. This not only added the communication pain for releases but also making the production environment almost "invisible" to project team. To some extent, there is "trust crisis" between project and deployment team. Even we have good and reliable Acceptance/Functional tests in UAT environment but we just not sure if the deployment process has been done properly and if everything works on production exactly as UAT. So the only way we can verify this is through some tests on production environment. Some simple smoke tests could be helpful to identify connectivity problems. So my question is : What's your opinion on applying all tests we had on UAT to production (with configuration to disable the bits that we don't want to happen on production such as removing data etc.) If you have done something similar, how do you play data on production environment without having audit trails tainted (one obvious thing would be account based, but let's assume there isn't segregation by account). EDIT: I didn't mean to test prod environment all the time, but only right after deployment. Also we will not stop trying solving the problem from the root - dev/op relationship. But at the same time would like to explore other possibilities.


General programming techniques to speed up coding time

I am preparing for a programming contest where we have to code in C++ and it is all about producing working code in a short time. An example would be to use a macro to get the minimum of two ints or using memsets to initialize arrays (but I was told that you shouldn't use either here). This leads to the question, what kind of coding techniques exist to use at a real job?


Non-blocking ORM issues

I asked a question on SO, and found that there are no non-blocking ORMs for my favorite web framework. By non-blocking I mean an ORM with callback support for asynchronous retrieval. The ORM would be supplied with a callback or some such to execute when data has been received. I want to create one, but I have some questions that blocking me from starting development:   * What issues might be encountered when developing ORM?   * Does supporting non-blocking retrieval dramatically increase the complexity of an ORM?    * Why are there so few non-blocking ORMs around? **Update:** It looks like I have to improve my question. We have solutions that already allow us to receive data in non-blocking way, and I believe that most companies that use such solutions use raw SQL. We want to create a more generic solution that we can reuse in future projects. What difficulties might we encounter? **Update 2:** Preferred language is python, but I'm interested in principles. This question is actually for me, as I will look at platforms which already have non-blocking ORM.


How should I build the data structure for a dynamic, unlimited-size "maze"?

I'm not actually sure that "maze" is the correct term. Basically users start in a single `Room` that has 4 doors (N, S, E, and W). They can go in any direction, and each subsequent room is contains another room with anywhere from 1 to 4 doorways that go to other rooms. The "maze" is supposed to be unlimited in size, and to grow as you move rooms. There is a limited number of `Rooms` available, however the available number is dynamic and can change. My problem is, I'm not sure of the best data structure for this type of pattern I first thought about just using a [X][X] array of `Room` objects, but I'd really rather avoid that since the thing is supposed to grow in any direction, and only rooms that are "visited" should be built. The other thought was to have each `Room` class contain 4 linked `Room` properties for N, S, E, and W, and just link to the previous `Room`, but the problem with that I don't know how to identify if a user goes into a room that has an adjacent room already "built" For example,               ---    ---            ----------     |        |            |        |        Start        5          4     |        |            |        |     ---    ---            ---    ---     ---    --- ---------- ---    ---     |        | |        | |        |     |    1          2          3     |        | |        | |        |     ---    --- ---    --- ----------           If the user moves from Start > 1 > 2 > 3 > 4 > 5, then `Room` #5 needs to know that W contains the starting room, S is room #2 and in this case should not be available, and N can be either a new `Room` or a wall (nothing). Perhaps I need a mix of the array and the linked rooms, or maybe I'm just looking at this the wrong way. Is there a better way of building the data structure for this type of "maze"? Or am I on the right track with my current thought process, and am just missing a few pieces of information? (In case you're interested, the project is a game very similar to Munchkin Quest)


source code check in / validation best practices

I am looking for best practices that big organizations follow for code check- in and validations. Currently we follow these steps, \- Developer writes code \- Developer do some initial tests \- Code is awaiting validation now \- Technical lead reviews the code (possible bugs, see if coding convention is followed etc) \- Once approved by technical lead, the code goes in QA state \- Once QA approves the code is checked in into the trunk. We are now moving to a new project and I was looking for some best practices that would ease the process. We have custom made software that maintains the code status. Thanks, Ali


Microsoft UI stack

I am a C#, WPF developer and would like to know and understand the Microsoft UI Stack. I could not find much on the internet. I guess that this would be a huge topic, and might not be feasible to explain here, but any suggest online reading would be greatly appreciated.


SPRING.net Framework and its popularity

I was reading through the documentation on http://www.springframework.net/. I was extremely impressed with this framework despite the amount of xml configuration it requires. I was wondering why this framework is not in the "buzz" . Any shortcomings? They are even up to speed with CLR 4.


Role Difference between StakeHolder and ProductOwner

What is actually the role difference between ProductOwner and StakeHolder ?


ClickOnce analog

I am looking for a ClickOnce analog on Windows platform. I have to deploy (publish) a .NET WinForms application (thick client) for N-tier system via web.


Concerning JavaScript prototype and the initial constructor function

I am going through a tutorial on OOP in JavaScript (javascriptissexy.com using OOP in JS: What you Need to know). The instructor is explaining the Constructor/Prototype pattern of object creation. I understand what is going on, but I have a burning question that he doesn't answer! We begin like this:               function User(name, email) {         this.name = name,         this.email = email,         this.scores = [],         this.etc = etc     }      I get it, and now every var xxx = new User("name", "email") will have an xxx.name, xxx.email, xxx.scores, etc. But now, we overwrite the prototype:               User.prototype = {         constructor: User;         saveScore: function(...){...},         changeEmail: function(...){...},         showNameAndScore: function(...){...}     }      Now every var xxx = new User(...) will inherit saveScore, changeEmail, and showNameAndScore methods. I am brand new, but from what I understand, I could have included these functions in the begining:               function User(...) {         this.name = name,         this.saveScore = function(...) {...},         ...     }      Instead of editing the prototype right away. I am waiting for the author to tell me that we include these functions in the prototype because they will be exact carbon copies which the user can't edit, and therefore only need to define them once (in the prototype) rather than on every instance of a User. Or is he just trying to demonstrate the different flavors of inheritance? Thank you ahead of time!


How do you keep yourself motivated?

Sometimes self -learning a particular language from books can make u feel bored and even you feel discouraged to learn more. What as a source of encouragement or motivation did you use while trying to learn programming?


Laws about Software Development

I'm wondering if there are any laws related to software development... Like, what if you're writing code for a digital pacemaker, or you're designing some other system that might have a profound effect on someone's life, or well- being... Are there specific laws for that kind of thing?


Software Agent construction guidelines

I'm currently studying a Master in Computer Science and I am interested in working with Software Agents and C#. I have found so much information regarding theoretical aspects but just a few articles focused on practical programming aspects such as architecture, design or implementation. Could anybody suggest any good source that I could explore? I wouldn't like to "reinvent the wheel" but to contribute with something better to the current state of the art.


Web-based Screening Interviews

I came across seemikecode.com and it got me thinking how this could be used for live coding sessions when screening applicants for a job. For example:   * Email telling the interviewee what to expect   * Problems attributes of coding problems that are suited for this setup   * How to responded to the code presented   * Recording the session What are your thoughts on this? Are tools like this helpful or do they get in the way of evaluating a candidate?


Updating and organizing class diagrams in a growing C++ project

I am working on a C++ project that is getting bigger and bigger. I do a lot of UML so it was not really hard to explain my work to co-workers until now. Lately I implemented a lot of new features and I gave up updating by hand my Dia UML diagrams. My code is documented with Doxygen but the generated doc is not really visual. I would just like my co-workers to quickly understand updates in my class design. Doxygen seems to handle UML diagrams using Graphviz but I would like to know if other possibilities are available and what you guys do to be as clear as possible when showing your code to co-workers (not clients).


What are some good JAIN SLEE related books?

Could you recommend some good reading materials related to JAIN SLEE? Or Java in Telecommunications in general.


What is the best advice to give someone in this industry who resists change?

I'm having a discussion with someone quite older than me, so I have no place in telling him what is wise. He is in the computer field but resists change, and we're discussing how his co-workers are enjoying learning a new technology and he's just avoiding it like the plague. I'm looking for maybe some good reading or testimony to support following trends and learning new technologies, rather than falling behind and sticking with what you know even as it's outdated. The kind of stuff which you might have someone who's in love with BASIC or PASCAL or mainframes read, because they won't listen to you directly. Internet articles or convincing, well-written blog posts preferred, but any good books are welcome too.


Programming Language, Turing Completeness and Turing Machine

A programming language is said to be Turing Completeness if it can successfully simulate a universal TM. Let's take functional programming language for example. In functional programming, function has highest priority over anything. You can pass functions around like any primitives or objects. This is called first class function. In functional programming, your function does not produce side effect i.e. output strings onto screen, change the state of variables outside of its scope. Each function has a copy of its own objects if the objects are passed from the outside, and the copied objects are returned once the function finishes its job. Each function written purely in functional style is completely independent to anything outside of it. Thus, the complexity of the overall system is reduced. This is referred as referential transparency. In functional programming, each function can have its local variables kept its values even after the function exits. This is done by the garbage collector. The value can be reused the next time the function is called again. This is called memoization. A function usually should solve only one thing. It should model only one algorithm to answer a problem. **Do you think that a function in a functional language with the above properties simulates a Turing Machine?**   * Functions (= algorithms = Turing Machines) are able to be passed around as input and returned as output. TM also accepts and simulate other TMs   * Memoization models the set of states of a Turing Machine. The memorized variables can be used to determine states of a TM (i.e. which lines to execute, what behavior should it take in a give state ...). Also, you can use memoization to simulate your internal tape storage. In language like C/C++, when a function exits, you lose all of its internal data (unless you store it elsewhere outside of its scope).   * The set of symbols are the set of all strings in a programming language, which is the higher level and human-readable version of machine code (opcode)    * Start state is the beginning of the function. However, with memoization, start state can be determined by memoization or if you want, switch/if-else statement in imperative programming language. But then, you can't    * Final accepting state when the function returns a value, or rejects if an exception happens. Thus, the function (= algorithm = TM) is decidable. Otherwise, it's undecidable. I'm not sure about this. What do you think?  Is my thinking true on all of this? The reason I bring function in functional programming because I think it's closer to the idea of TM. What experience with other programming languages do you have which make you feel the idea of TM and the ideas of Computer Science in general? Can you specify how you think?


What is the name of this code-get-together...hackathon, codecamp, codejazz or?

Recently there's risen this small subculture in Denmark with geeks meeting up and hacking along on their sparetime projects together. The base is that there is no session, there is no keynote or anything, it's pretty much just meeting up and getting some prime time put into your project. You can choose to fiddle with anything you like, and you are free to sit and help people all day...pretty much just an open day. I have a bit hard time identifying if it matches any of the names in the topic, as I see it codecamp does have a topic, hackathon seems like devs doing a big solution together...and well codejazz is not really defined anywhere but another danish usergroup used that term.


What is the reporting function?

When dealing with an enterprise application, I often heard the requirement of "reporting function" "run reports", "generate reports", etc. What is it referring to?


How do I verify that a user really works for the company they signed up as?

I am building a website that will allow companies to sign up and post information and have an internal network, but what is the best way to verify that the person that is filling in the sign up form really belongs to the company they say they do, as I don't want Joe Bloggs signing up saying he works for company XYZ when really he doesn't. Is there a logical way of doing this or is it an impossible task?


Best way to structure a Git repository for Maven

I need some advice on how to structure our projects in Git. We use Java and Maven is our build tool. Maven kinda assumes all of your projects have a common ancestor eventually. Maven can also be a real drama queen when things aren't setup _exactly_ the way the Apache foundation sets up their projects (anyone using the release plugin probably knows what I'm talking about). We want a top level parent pom that controls plugin versions and build configuration (repo config, what artifacts to build, naming conventions, plugin versions, etc). Maven would want all of our IT projects to be in subfolders of that main project. This implies one massive Git repo for the organization. This will make for a very noisy environment. If there are two teams working on unrelated projects, they will constantly have to pull in merges from the other team. Ideally I'd like to have one repo per project. But that sort of clashes with the extremely hierarchal model of Maven, which _demands_ sub-projects be sub-folders. I need some advice on how people have reconciled these two models... thank you!


Would it make more sense to use a framework to build an commerce site, or build it from the ground up?

Keep in mind, I know PHP as I learned it for this specific project. Also, I thought about just using magento, but as I went through it, I realized I would have to learn their framework. I am very opposed to putting more time into learning a framework rather than continue expanding my PHP knowledge. I took a computer science course in which rather than make us use already made objects and functions, we had to create those as to learn how they actually worked. That was an amazing learning experience. I know that their is a lot of work involved in doing this, due mainly to the fact that others have done similar things, but my main two reasons for this are:   1. I would only build what I need, no extra features I do not.   2. I would have specific needs, stuff that I would need to code anyways. The only thing I would need would be simple e-commerce features like user authentication, products pages(user, admin), and shopping cart, and obviously a database. Everything else I need would be tailored to the specific needs of the site and the way I will be implementing it. If this helps in giving a picture of where I am at, what would the best recommendation be from professionals. Thank you.


How do you validate need for documentation?

I once was on a project where a non-tech manager had the team spending half of every hour documenting what they just did so that someone with zero understanding of the tech would be able to understand the tech. Personally, I thought this was a huge waste, but there was no way to validate this was or was not waste. Is there a light-weight means of validating need for documentation before committing to produce the documentation? **Example 1:** Say the team is using an off-the-self software without customization. The test might be posting a job description on a monthly basis to access the likelihood that an expert in the software might be found at an acceptable cost level. **Example 2:** Automatically pull variables, functions, etc from the code, and two weeks after the code is written, generating questions that automatically assess the developers own knowledge of their own code without access to the code. If the developer is unable to answer the questions, then they must explain the code to another developer, and that developer decides if documentation must be produced. **Example 3:** Another way would be to take the likelihood that the code is used based on runtime analysis and cross reference it both with the volatility of input/output and historical likelihood of bugs/error being reported from that section of code and/or customer based requests to update the code. Honestly, don't believe those are great examples, but are more of an attempt to give the general gist of what I'm after, and that the goal is the most generally useful bare-bones method for doing this.


Performance related doubt in Java with Hibernate

Suppose in some ORM based project (say Hibernate) I am trying to fetch only few columns rather then the whole Object with may be more than 20 attributes. I am writing HQL like `"select attr1, attr2 from Entity "`. I know I am not taking advantage of using Hibernate because I will get the result in Object form only and then I have to do explicit casting for it. But whether it will be a right approach to achieve optimization from database prospective or because I am performing some explicit casting the cost will still be same?


Important Questions to ask Client at Briefing (Web Development)

I am just moving into freelancing (my primary sector will be web design / web development). I've got a few projects for friends as well as one or two 'professional' projects in the pipeline. I would like to know what are some of the most important things you need to hear from your client before you start the process of developing their website: Some examples I can think of are:   1. Wishlist of website functionality (contact forms / specific pages etc)   2. Whether they have an existing Google Analytics account   3. Any other tracking stuff   4. Legacy code that needs to be integrated   5. Desired aesthetics of the website   6. SEO discussion So yes, I'd really like to know what you think are the most important things to discuss and ascertain from a client before you begin development.


Is rotating developers on a project a good or bad idea?

I'm working on a small team that will begin working on a large new project with another small team. The other team is currently working on a legacy system that they have been working on for years. The manager has decided that the developers from my team will be rotating every few months to replace developers working on the legacy system. That way the other team will have a chance to work on the new project and have a better understanding of the new system. **I want to know the benefits and drawbacks (if any) of rotating the developers from the project every 2-3 months.** I know that this is a similar question to "Is rotating the lead developer a good or bad idea?", but that question focuses on a lead developer. This question is about rotating the entire team on and off the project (tech. lead for the new project may or may not be rotated -- I don't know yet).


How to fix the copy/paste-pattern?

Where i work, people (consultants) feel pressed to release features as fast as possible. So instead of spending too much time on thinking about how to do things the right way or because they don't want to break anything, code gets copied from different modules and modified. It's not easy to prevent this, since the code base is open to the whole company. Lots of people work on this. Now that the mess is there already, what is the best way to remove those redundancies without breaking too much?


Best way to contact Microsoft about accessibility in their developer tools?

I'm a totally blind programmer who would like to learn .net. It appears that the Visual Studio express additions are not accessible since the scripts that come with Jaws for Widnows, the screen reading software I use requires the VS object model to make Visual Studio accessible. This is not available in the express additions, so the scripts may partially work or not work at all. None of the options mentioned in this question apply to me and I don't want to spend $500 or more to buy Visual Studio professional when I may never use it for a job. If I take the time to try out the express versions and run into issues is there any way to contact Microsoft without my questions/feedback being lost in a black hole?


Multiple style sheets best practice

I currently am working on a project which has one large style sheet for about 20 pages. The style sheet contains some styles which are specific for certain pages. I'd like to break the style sheet up so there is one style sheet for each page with one master style sheet that handles everything generic. The reason I want to do this is so people can work on multiple pages without having to worry about who has that large style sheet checked out (I'm using TFS). Is this good practice?


Compilable modern alternatives to C/C++

I am considering writing a new software product. Performance will be critical, so I am wary of using an interpreted or language or one that uses a emulation layer (read java). Which leads me to thinking of using C (or C++) however these are both rather long in the tooth. I haven't used either for a long time. I figure in the last 20 years someone should have created something which is reasonably popular and is nice to code in and is complied. What more modern alternatives are there to C for writing high performance code compiled code? _edit in response to comments_ If C++ is a different beast than it was 15 years ago, I would consider it, I guess I had an assumption that it had some inherent problems. Parallelisation would be important, but probably not across multiple machines. _edit after giving tick_ given the tick to zxcdw but thanks for all the c++11 is worth a look answers.


Why don't languages use explicit fall-through on switch statements?

I was reading Why do we have to use `break` in `switch`?, and it led me to wonder why implicit fall-through is allowed in some languages (such as PHP and JavaScript), while there is no support (AFAIK) for explicit fall-through. It's not like a new keyword would need to be created, as `continue` would be perfectly appropriate, and would solve any issues of ambiguity for whether the author meant for a case to fall through. The currently supported form is:               switch (s) {         case 1:             ...             break;         case 2:             ... //ambiguous, was break forgotten?         case 3:             ...             break;         default:             ...             break;     }      Whereas it would make sense for it to be written as:               switch (s) {         case 1:             ...             break;         case 2:             ...             continue; //unambiguous, the author was explicit         case 3:             ...             break;         default:             ...             break;     }      For purposes of this question lets ignore the issue of whether or not fall- throughs are a good coding style. ### Are there any languages that exist that allow fall-through and have made it explicit? ### Are there any historical reasons that `switch` allows for implicit fall- through instead of explicit?


Why do books say, "the compiler allocates space for variables in memory"?

Why do books say, "the compiler allocates space for variables in memory". Isn't it the executable which does that? I mean, for example, if I write the following program,               #include <iostream>     using namespace std;          int main()     {        int foo;        return 0;     }      and compile it, and get an executable (let it be program.exe), now, if I run program.exe, this executable file will itself command to allocate some space for the variable foo. Won't it ? Please explain why books keep on saying, "the compiler will do this...do that".


How 20q. works?

How does the web app http://20q.net work? Can I write a similar program, in a smaller scale, and if yes how?


What do you do when a user asks for a feature you will not implement?

What do you do when a user asks for a complex feature that you could implement, but you aren't going to do it because 1) it adds unnecessary complexity to other users 2) you are not going to do it as an option either because you don't want your settings panel to be complicated. I wrote an iOS app and there are a few users that asked me for some complex features that I can't do because of the reasons above. Most of the time I just answered them that "We will take that into consideration." Explaining them that they are in the minority that wants this feature is not going to help either. So, what do you do in the case like this?


How do you test software that is time sensitive?

By time sensitive I mean for example a script that only runs once a month or a script that runs continuously but gives a certain output only once a month. Obviously you can unit test for a lot of cases but there are exceptions ( in my understanding). A recent example I ran into was setting up a cron job to run on the second to last day of every month. This required using a shell script with cron tab to get the correct day of the month for cron, something like: `1 0 [shell command] * * [my script]` I was unfamiliar with the script and unfamiliar with shell scripts in general and so had no good way to test it other than waiting for the end of the month to come and seeing if the script executed correctly (actually my solution was to find a co-worker who knew a lot more about cron and shell scripting that I did). So I am curious if there are any useful work arounds for testing time sensitive scripts.


AngularJS dealing with large data sets (Strategy)

I am working on developing a personal temperature logging viewer based on my rasppi curl'ing data into my web server's api. Temperatures are taken every 2 seconds and I can have several temperature sensors posting data. Needless to say I will have a lot of data to handle even within the scope of an hour. I have implemented a very simple paging api from the server so the server doesn't timeout and is currently only returning data in 1000 units per call, then paging through the data. I had the idea to intially show say the last 20 minutes of data from a sensor (or all sensors depending on user choices), then allowing the user to select other timeframes from which to show data. The issue comes in when you want to view all sensors or an extended time period (say 24 hours). Is there a best practice of handling this large amount of data? Would it be useful to load those first 20 minutes into the live view and then cache into local storage something like the last 24 hours? I haven't been able to find a decent idea of this in use yet even though there are a lot of ways to take this problem. I am just looking for some suggestions as to what might provide a good balance between good performance and not caching the entire data set on the client side (as beyond a week of data this might not be feasible).


How much time do you invest in exploring new technology?

Sometimes, I see potential in a new technology eg. AIR (not new but I haven't tried it much), and I play around with it. After sometime, I feel inspired to try a new personal project out of it. It was during this project that I sometimes find another "tech" eg. Silverlight more suitable. Maybe its easier to get something done in that platform. But there are many alternatives to such things, and after a while, i feel that i have wasted my time just trying the "new toy", spending time learning it to get started etc. only to decide that I made the wrong decision. How long do you take to explore new technology? Or do you stick to what you already know?


Finding Bugs in Tasks

A colleague and I have run a Kanban board at 2 places of work now, introducing a kind of scrum-ban agile/lean process into the team. Helping us move towards more flow orientated work and continuous releases. I just wanted to ask your advice, that when a task is peer tested or tested by the test team further down the board, what should happen to the tickets where a fault is found? We've tried 2 methods:   * Create a new ticket for the problem and chase this through the board until it catches up with the original faulted ticket. Then progress them both together through the board.   * Move the original ticket back to 'development to-do' or 'development work in progress'. Does anyone have any suggestions on best practices in this situation?


Path of Replication

I'm currently developing a replication system to keep data in-synch between an arbitrary number of servers. Some of these servers exist in one cluster on one LAN. Others exist somewhere else in the world. I'm wondering what are the pros/cons of different paths that we choose to flow replicated data on between servers? In other words, what are the different strategies to load balance the replication process ?


Using CC Music in my project

Well, I am not sure about is this is the right StackExchange site to ask this, but since can accept question about Software law, i think it's almost on topic here. If I use creative commons music for non commercial usage in my project, it's fine if my final product is freeware. But, what if it becomes ad-supported? It's considered commercial usage? And, if I do a paid ad-free version, this is commercial usage, i think. Example: using this music as bgm in a game


Cross-platform frameworks and high profile applications

I was curious about what cross-platform framework does the developers of high profiles applications such as Photoshop, Guitar Pro, etc; use. They all integrate seamlessly with the OS to the point where you can sometimes assume that the application was developed exclusively for that OS. I have been programming with Qt for about a year and as far as I know given my knowledge and ability with Qt it's not possible to fully integrate your application with MAC OS. (e.g. see my unsolved issue with Qt and the MAC OS Dock icon ) Do they all use proprietary in-house frameworks? I'm I just lacking the necessary 'know-how'to achieve this with Qt? Are there better cross-platform alternatives?


Application use on website

Is there a good way to run a C# application on clientside in lieu of JavaScript? I have done some front end work with JavaScript and backend C# for web developing at an old job, but I am interested in hosting a website myself soon. I have a C# application I would like to be open source, but before people care to download I'd like them to be able to use it. At its basic level it's a simple text editor, but there's much more to it in the nitty gritty. I could write it in JavaScript, but it would require me to keep documentation and up to date changes on JavaScript and C# in that case. I was thinking of creating an AJAX panel and somehow loading my winform application into a frame, but I don't know how or what words to google because I've never done it before except AJAX.


Key phrases showing benefits performing certified software testing for "your" company?

I am wondering what phrases that would have the most impact when approaching a business, to inform them why they should test their software. Obviously you have easy ones; reduce costs/risk, improves stability/reliability/usability. But these are just words, how would you wrap them into something concrete that even people living in their own world, could see the potential benefit of software testing. I'm looking for shared experience. And how would you as a developer like to be approached by a software tester? PS: Help! I'm not sure how to ask this question properly!


How to ensure data integrity (when an external system is involved)

Say you have this task in an application that consists of two parts: 1) Delivery of a file to an external system (not in your control)   2) A database transaction in our system, with information about said delivery (what was sent, when and by whom) If any of these two parts fail, our system's state will be inconsistent. If a file has been sent and the db has no information about it, it's an error. Likewise, if the file transfer failed, but the information in the database suggests otherwise, that is also an error. How would you approach this task to ensure that the database is left in a consistent state after each time the task is attempted? I'm inexperienced in dealing with problems like this in a _proper_ manner - I could always use the naïve approach and pretend writing to the database will never fail. :-) I wish to do better than that, though. The two basic variations I see here both leave something to be desired (pseudocode): A:               try:         commitTransaction()         deliverFile()     catch TransactionError:         // No problem, delivery was never attempted.     catch DeliveryError:         // The system will now say that it was delivered,          // even though it wasn't.      B:               try:         deliverFile()         commitTransaction()     catch TransactionError:         // The system will now say nothing was delivered,         // even though it was.     catch DeliveryError:         // Easy enough to handle:         rollbackTransaction()      I'm sure there is an acceptable solution to this, and that I just can't spot it?


Is programming a SubCulture?

I was going through this article: http://en.wikipedia.org/wiki/Subculture Which got mee thinking is programming a subculture? After the a while I started thinking it really hard, and if you go really in depth this is a very complex and interesting question to ask. YOu can even ask yourself if (heavy) internet (social) users are an subculture and programmers a culture within. I think it might be an interesting discussion, hope you like it! NOTE: I linked the wiki article because it might be a good baseline, maybe you can base you answer on Ken Gelder´s proposal to distinguish subcultures. But it should be based on a little bit more that intuition. Thanks in advance! Trufa


How long should you wait before interviewing at the same company a second time?

Suppose you've had a recruiter contact you about a position at a medium-large to large company, and went for an interview and such, and seriously considered the position but ultimately you decided against joining, or they decided against hiring you for that particular position because they had someone more qualified show up. But time elapses, your circumstances change, and you realize that working there might be a better idea now (or they have other positions available)... How long should you wait before interviewing at the same company again?


Is it good practice to declare and set properties in abstract classes?

I am using PHP and designing some abstract classes. I can declare properties with constant values within my abstract class and access/overwrite them from any class which extends this without re declaring them within any of the extending classes. A benefit to this is less repetitive typing but the downside that overtime the original structure/layout of these abstract properties is forgotten and could be left at there default static values or even forgotten(not used) completely. How is this handled in professional environments? I assume this has been thought out before and is either favored or isn't? I am trying to adhere to good OOP principles/rules such as SOLID, DRY and KISS but I haven't seen this specific issue talked about in these. (perhaps I missed it when researching?)


Example of Terms of Services for Agile contracting?

In my experience as a freelance developper, I've had some difficulties with clients, whom insist on getting an estimate over flimsy requirements. They then expect me to deal with requirements changes, sometimes late in the project, and stick to that estimate. Since I've never come up myself with some T.O.S. tailored for this situation, I ended up bound by a contract of a more general nature, which inevitably became unsasatisfactory... Legal lingo not being my forte, I've been lookin for some publicly released T.O.S. to try to remedy this situation. Ideally these would be from an agile shop, under a licensing scheme allowing derivatives. This would help me lay out the contractual groundwork for a sane customer relationship, especially when dealing with changes.


As the team leader/manager,  what kind of role should I seek when we switch to Scrum?

My company wants to start using Scrum, and in real scrum there is no place for a real team leader (manager). What is the next step for the dev team leader? Should I be a (chief) system architect/tech leader or search for another job in management? I like the management part and the technical part and the target is VP R&D/CTO.


Are enforced Professional Development Plans useful?

Many companies, especially larger ones have mandatory professional development plans for their employees. Employees and managers set out a personalized professional development plan and follow up on the progress every so often. As a developer, do you find such PDPs useful, do you follow through with your commitments? As a manager, do you think such PDPs bring value to the company and improve the overall quality of the employees? It seems that good developers will continue to educate themselves and strive to be better regardless of companies' procedures while bad ones won't. Are there benefits of having PDPs or is it just something managers feel they need to do?


Copyleft Licenses - Need to attribute?

I'm currently evaluating which license to use for my next OS project, and things are getting more and more interesting after I decided that I really want to _understand_ what the licenses mean. Up until now, I just licensed everything under MIT because I like the MIT and their license is nice and short. And probably because it didn't really matter as only a hand full of people actually used my products. But now, I'm at the brink of releasing something that will surely be used by many people and also be subject to major modifications, so I want to choose the right license to go with. From what I understand, there are two groups of licenses; Copyright and Copyleft. Now, I read (and think to understand) MIT and BSD-2/3-Clause, but I'm really having trouble to get the gist of (L)GPL and alike. My main problem is; I want to always be named in derivative works of my project. I don't really care if it's used proprietary or free, I just want to make sure that anyone who reads the code sees "ah, that's the original author" (referring to me). Is there a clause in the copyleft licenses that assures this attribution? Or can this only be done using permissive copyright ones?


Notation used in 'Pearls of Functional Algorithm Design'

I just purchased the book 'Pearls of Functional Algorithm Design' by Richard Bird. Unfortunately, the book doesn't have any section that describes the notation that is used. You can view the contents of the book by going to Amazon's page, and clicking on the book cover to get a sneak peak inside. http://www.amazon.com/Pearls-Functional-Algorithm-Design-Richard/dp/0521513383 If someone could give me a name, and/or reference to understand the notation used. That way I could actually read and understand the algorithms.


Real-world scenarios for protected methods

Today I noticed that I basically never use `protected` methods in C++ code, because I rarely feel the need to call non-public methods of a parent. I do use protected in Java in the template method pattern, but since you can override private methods in C++, I don't need `protected` there, either. So what are some real-world scenarios where I would want to use `protected` methods in C++ code? (Note that I'm not too fond of implementation inheritance in general, that might explain a lot...)


What are approaches for analyzing the cost-benefits of a development methodology?

There are many development **practices** (TDD, continuous integration, cowboy- coding), **principles** (SOLID, layers of abstraction, KISS), and **processes** (RUP, Scrum, XP, Waterfall). I have learned you can't follow any of these blindly, but have to consider context and ROI (return on investment). My question is: How do you know whether you are getting a good ROI by following a particular methodology? Metrics, guesstimation, experience? Do analytical methods exist? Or is this just the million-dollar question in software engineering that has no answer? For clarification when I say ROI I mean overall business value. This does not necessary exclude developer happiness--if all the developers quit (or worse: become apathetic) after a 6-month death march you lose all the technical experience in the organization. If customers are unhappy you will need more customer support staff or lose business.


Log design approach

Logging was always a nightmare for me! Now I have to implement it again for a proxy system. In this proxy application, some systems ask proxy system to call some other services. What I have to log is   * Request Time   * Requester IP   * Request Parameters as XML   * Requested Service Name   * Requested Service Method   * Response Time   * Response data as XML   * Response Message (If any exception occurs it will logged as Message) I considered to append two lines to my methods:               // Log Request     Task.Factory.StartNew(() => Logger.Log(RequestParameters.ToXML(),Assembly.GetCallingAssembly().FullName, MethodBase.GetCurrentMethod().Name, DateTime.Now));          // Invoke requested service and get response          // Log Response     Task.Factory.StartNew(() => Logger.Log(Response.ToXML(), DateTime.Now));      I also want to log nested transactions. Assume a transaction contains a request and a response. A transaction may contains many other internal transactions. When I receive a request, I should register a transaction, and insert a request for it, later, when response received, I should update the transaction response. Please note that I'm trying to store request and response relationship for better tracking. How can I safely add this logging procedure to methods? I want to restrict developers to implement this logging systems in all methods, some thing like interface or inheritance for method body is required. Can I do this by attributes? Then how?


Conducting a requirements analysis interview

Why do requirements interviews never pan out as they are planned - and how do I prepare for that? I'm looking for the following kind of help regarding how to prepare for these interviews and what I can pay attention to in order to make the most of them. My information project, centered around management reporting within a firm, is currently in it's definition stage. All my stakeholders are managers of greater or lesser scope. I had my previous two interviews planned out quite extensively, but on both occasions my interviewees both went off in completely different tangents, delivering quite interesting results. I completely ignored the question flow I had prepared, and tried to go along with the interviewees. But instead of going towards a common concept that can be developed on, I feel that I get in- depth pictures of each individual's local information requirements. How can I conduct an interview that helps me get the participants on board and thinking towards a common solution, but doesn't inhibit their own thoughts which deliver me interesting material on data sources, formatting and communication paths?


Looking for a non-cryptographic hash function that returns a single character

Suppose I have a dictionary of ASCII words stored in uppercase. I also want to save those words into separate files so that the total word count of each file is approximately the same. By simply looking at the word I need to know which file it should be in (if it's there at all). Duplicate words should go into the same file and overwrite the last one. My first attempt at solving this problem is to use .NET's `object.GetHashCode()` function and `.Trim()` to get one of the "random" characters that pop up. I asked a similar question here If I only use one character of `object.GetHashCode()` I would get a hash code character of A..Z or 0..9. However saving the result of GetHashCode to disk is a no-no so I need a substitute. **Question:** What algorithm (or subset of an algorithm) is appropriate for pigeonholing `strings` into a single character or range of characters (Like hex 0..F offers 16 chars)? **Real world usage:** I'll use this answer to modify the Partition key used in Azure Table storage as described here


Deferring questions about salary expectations until the second interview

I usually find that interviewers ask about expected salary on a first interview, but I usually feel uncomfortable discussing such details at an early stage. I feel that low-balling a figure might result in under-selling myself, whereas going too high might lose me the chance of a second interview. I also like time to reflect on my interview experience before vocalising my expectations. I recently realised that in one interview I prefixed my salary figure with a justification, which made me come across as a little desperate and unsure of myself. Is there a good way to defer such questions until a second interview (assuming I get one, of course) without hurting my chances or weakening my position?


Advice on reconciling discordant data

Let me support my question with a quick scenario. We're writing an app for family meal planning. We'll produce daily plans with a target calorie goal and meals to achieve it for our nuclear family. Our calorie goal will be calculated for each person from their attributes (gender, age, weight, activity level). The weight attribute is the simplest example here. When Dad (the fascist nerd who is inflicting this on his family) first uses the application he throws approximate values into it for Daughter. He thinks she is 5'2" (157 cm) and 125 lbs (56kg). The next day Mom sits down to generate the menu and looks back over what the bumbling Dad did, quietly fumes that he can never recall anything about the family, and says the value is really 118 lbs! This is the first introduction of the discord. It seems, in this scenario, Mom is _probably_ more correct that Dad. Though both are only an approximation of the actual value. The next day the dear Daughter decides to use the program and sees her weight listed. With the vanity only a teenager could muster she changes the weight to 110 lbs. Later that day the Mom returns home from a doctor's visit the Daughter needed and decides that it would be a good idea to update her Daughter's weight in the program. Hooray, another value, this time 117 lbs. Now how do you reconcile these data points? Measurement error, confidence in parties, bias, and more all confound the data. In some idealized world we'd have a weight authority of some nature providing the one and only truth. How about in our world though? And the icing on the cake is that this single data point changes over time. How have you guys solved or managed this conflict?


There are two types of color mixing: Additive and Subtractive. How about XOR-ive color?

There are two types of color mixing: Additive and Subtractive. http://en.wikipedia.org/wiki/Color_mixing Is is possible that color mixing model be done in XOR?


Did I branch or not? How to merge 2 branches

I'm HMS confused I today created a branch to work on implementation of a new feature. I thought this branching was successful as these appeared. ![branches](http://i.stack.imgur.com/0K0rz.png) However I'd like to merge the new feature branch (NGUI interface test) back into the default main branch **but I don't have the option to if I right click on the most recent commit.** Plus, I've seen on other posts that the graph should be showing a branch of different colours from where the branching occurred, like in this eg. ![eg](http://i.stack.imgur.com/qgGPy.png) All advice appreciated, just discovered DVCS and think it is so elegant. T


What are approaches to learning multiple technologies at the same time?

I want to learn multiple technologies. Currently I have knowledge of core Java, C, and PHP. I want to know the approach which should be followed to learn multiple things. I know if you know the core concepts of the behavior of programming language, any programming language can be learned. I want to make command on such language in a way that I can talk with them. I am doing lots of coding and surfing but I think there is an approach by which we can communicate or talk with programming language.


How do you handle deployment configuration of your thick browser (html/javascript/css) clients?

# Question For those of you working with html/javascript/css "thick clients", specifically those that work against some client-independent server API, how do you manage your deployment environment configuration? Do you manage the configuration at build time with per-environment release builds (e.g. QA, STAGE, etc) or do you build a general release and rely on some server-side configuration? What's worked best in your experience? # Background My company has several different thick browser clients. All clients share some common attributes.   * They operate against a common api server which is unaware of client-specific concerns   * They are completely static at deployment and delivered via apache with no server-side processing. This means that each environment requires it's own release build (QA, STAGE, UAT, PROD). We are looking at refactoring our clients to have general release builds and relying on server side processing to support the necessary client-specific configuration. This seems like the obvious choice, but I'd like to see how other people in same situation have handled it.


Fire domain events after transaction completes

I am trying to implement a domain event system that only fires its events when the associated unit-of-work commits successfully. The main reason why I want to do this is because I have other sub-systems that read the database that expect those changes to be in place when handling the event. I also don't want event handlers to do their work (send out emails, etc.) if the commit fails. The system is multiple ASP.NET applications (WebForms, MVC, and WebAPI).               public class Order     {         private Payment _payment;              public int ID { get; private set; }              public decimal Amount { get; private set; }              public void PayUsing(IPaymentProcessor processor)         {             if (_payment != null)             {                 throw new InvalidOperationException(                     "You can't pay for an order twice");             }                  // the Process method may also raise domain events             _payment = processor.Process(Amount);                  // Raise saves the event into a static Queue<T>             DomainEvents.Raise(new OrderPaidEvent(this));         }     }          public class OrderFulfillmentService     {         private readonly IUnitOfWorkFactory _unitOfWorkFactory;         private readonly IPaymentProcessor _paymentProcessor;              public OrderFulfillmentService(             IUnitOfWorkFactory unitOfWorkFactory,              IPaymentProcessor paymentProcessor)         {             _unitOfWorkFactory = unitOfWorkFactory;             _paymentProcessor = paymentProcessor;         }              public void Fulfill(int orderId)         {             using (var unitOfWork = _unitOfWorkFactory.Create())             {                 var order = unitOfWork.OrdersRepository.GetById(orderId);                      order.PayUsing(_paymentProcessor);                      unitOfWork.Commit();                      // I only want the events to be raised if the Commit succeeds                            }         }     }      With the current implementation, it's problematic because right now the domain raising must put it into a queue as it must not fire immediately. The queue is static which causes problems for multi-user systems. I do not want to accidentally fire events for another users, which is a definite problem as all users access the same queue. This is the list of solutions I have investigated, and why they won't work in my scenario   1. Have a non-static `DomainRaiser` class that gets passed into the `PayUsing` method.     * Passing a `DomainRaiser` is very difficult to do from the domain objects, sometimes events can be raised by changing properties and passing this object around is cumbersome.   2. Have all entities contain an `Events` enumeration that is read by the `UnitOfWork.Commit` call as discussed on http://lostechies.com/jimmybogard/2014/05/13/a-better-domain-events-pattern/     * Tracking every single entity that has possibly changed is very difficult, I am off-loading this change tracking to the ORM. This also clutters up the domain objects.   3. Using `HttpContext.Current.Items` to store user-specific events     * This is currently the best suggestion, however, it's not possible to unit-test, and it locks my domain to using asp.net, which I have plans in the future to release a desktop app. My question is, how do I queue and dispatch these events up in a multi-user environment reliably while taking into consideration that I only want to fire events if the overall unit-of-work succeeds?


Alternative patterns for web development? (non-MVC)

Recently I've been reading some blog posts regarding MVC and how it doesn't fit the web. I've learned about alternative patterns like the RMR Architecture. I'm curious what other patterns people are using on the web besides MVC? Also, if there is a framework that implements the pattern, please post a link to it.


Javascript: Machine Constants Applicable?

I write numerical routines for students of science and engineering (although they are freely available for use by anybody else as well) and am wondering how to properly use machine constants in a JavaScript program, or if they are even applicable. For example, say I am writing a program in C++ that numerically computes the roots of the following equation: exp(-0.7x) + sin(3x) - 1.2x + 0.3546 = 0 A root-finding routine should be able to compute roots to within the machine epsilon. In C++, this value is specified by the language: DBL_EPSILON. C++ also specifies the smallest and largest values that can be held by a float or double variable. However, how does this convert to JavaScript? Since a Javascript program runs in a web browser, and I don't know what kind of computer will run the program, and JavaScript does not have corresponding predefined values for these quantities, how can I implement my own version of these constants so that my programs compute results to as much accuracy as allowed on the computer running the web browser? My first draft is to simply copy over the literal constants from C++: FLT_MIN: 1.17549435082229e-038   FLT_MAX: 3.40282346638529e+038   DBL_EPSILON: 2.2204460492503131e-16 I am also willing to write small code blocks that could compute these values for each machine on which the program is run. That way, a supercomputer might compute results to a higher accuracy than an old, low-level, PC. BUT, I don't know if such a routine would actually reach the computer, in which case, I would be wasting my time. Anybody here know how to compute and use (in Javascript) values that correspond to machine constants in a compiled language? Is it worth my time to write small programs in Javascript that compute DBL_EPSILON, FLT_MIN, FLT_MIN, etc. for use in numerical routines? Or am I better off simply assigning literal constants that come straight from C++ on a standard Windows PC?


Do hiring managers have a hard time accepting developers who have a "business look alike" personal app but are NOT entrepreneurs?

Directly post graduation from University, I decided to build my own web app (Ease My Day) while waiting to get a job as a software Engineer. The reasons to build this app:   * Gain solid hands on software experience before hitting the job scene   * Providing a solution to a common problem   * **Not sitting doing nothing** while searching for jobs The app is **Not** an entrepreneurial tryout nor a business to be sold. Still throughout interviews I noticed that at the rate of 4 of each 5 interviews I pass through the app is being confused with a **business** and I am asked the same questions: > Why did you build the business? Why do you want to **stop** the app? Do you > want to sell the app? Knowing that I didn't build a business nor make any income from this application. Do candidates who take initiatives and like to craft their own apps on the side cause a **red flag** on the hiring manager's radar? # UPDATE requested by @Kate Gregory This is how I describe it on my resume: > Personal Project: Developer of "Ease My Day" SaaS application, Montreal, Qc.   >  Link: http://www.easemyday.com   >  Facebook: http://www.facebook.com/EaseMyDay > > "Ease My Day" BETA's main purpose is helping with daily nutrition/health > monitoring. > > _A list of more than 6000 foods with their nutrition facts is available. > Users can add their personal foods and grow the food database.   >  It allows users to specify their goal: lose weight, gain weight, no goal > just staying healthy.   >  It allows users to calculate their daily needs (calories, protein, > carbohydrates, fat etc..) using the app's built in calculator. Users can > manually input those values if they already know their needs.   >  Users can monitor their food intakes by: meals, days and/or weeks.   >  It is deployed on Amazon AWS ( EC2 instance with RDS )_   > > > "Ease My Day" solved a daunting task; it is a speed efficient platform that > turns daily health monitoring - a notably time consuming task in the past - > to an enjoyable activity that can be finalized in just few seconds. It is > currently used in several countries around the world. > > Languages/technology: **_.... HERE I explain the > languages/technologies/Software Engineering approaches used ...._**


what is the meaning of following definition?

I am new to javascript and start learning from w3schools website. I'm not able to understand what the following line means. Can anyone please explain this with example? > You can only use document.write in the HTML output. If you use it after the > document has loaded (e.g. in a function), the whole document will be > overwritten.


Automatic Appointment Conflict Resolution

I'm trying to figure out an algorithm for resolving appointment times. I currently have a naive algorithm that pushes down conflicting appointments repeatedly, until there are no more appointments.               # The appointment list is always sorted on start time     appointment_list = [        <Appointment: 10:00 -> 12:00>,        <Appointment: 11:00 -> 12:30>,        <Appointment: 13:00 -> 14:00>,        <Appointment: 13:30 -> 14:30>,     ]      Constraints are that appointments:   * cannot be after 15:00   * cannot be before 9:00 This is the naive algorithm               for i, app in enumerate(appointment_list):         for possible_conflict in appointment_list[i+1:]:             if possible_conflict.start < app.end:                difference = app.end - possible_conflict.start                possible_conflict.end   += difference                possible_conflict.start += difference             else:                break      This results in the following resolution, which obviously breaks those constraints, and the last appointment will have to be pushed to the following day.               appointment_list = [        <Appointment: 10:00 -> 12:00>,        <Appointment: 12:00 -> 13:30>,        <Appointment: 13:30 -> 14:30>,        <Appointment: 14:30 -> 15:30>,     ]      Obviously this is sub-optimal, It performs 3 appointment moves when the confict could have been resolved with one: if we were able to push the first appointment backwards, we could avoid moving all the subsequent appointments down. I'm thinking that there should be a sort of edit-distance approach that would calculate the **least number of appointments that should be moved in order to resolve the scheduling conflict** , but I can't get the a handle on the methodology. Should it be breadth-first or depth first solution search. When do I know if the solution is "good enough"?


What is the difference between E-Science Infrastructures and Distributed Computing Infrastructures

What is the difference between eScience infrastructures and grid computing or distributed computing infrastructures? And what are some of their examples. I can not distinguish them clearly. Is it how a grid is used make it an e-science platform?


Changing behaviour of abstract class without modifying subclasses

I am facing a problem with changing behaviour of a library (thus cannot or don't want to change its internals because of future updates, etc.). In this library there is an abstract class which shares few methods with all its subclasses. Now I need to change few methods in this abstract super class without changing the subclasses. I was wondering what pattern I should apply to this without rewriting the whole thing. I use PHP, so I could use a trait to override these methods in my own sub- subclasses which I will then use in my client code. This would result in creating the sub-subclasses and adding a trait (which is a one-liner). But I need to run PHP 5.3 which doesn't support traits. Is there a pattern that solves this problem? EDIT 2: the point is I don't want to change the library code, I can extend the subclasses and use them in client code but I don't want to change the code in the library itself (so I can update the library easily). EDIT: see simplified code below               abstract class SuperClass {         protected function doMagic() {              ... I need to change this ...         }              abstract public function execute();     }          class SubClass1 extends SuperClass {         protected public execute() {             $this->doMagic();             ... some other code ...         }     }          class SubClass2 extends SuperClass {         protected public execute() {             $this->doMagic();             ... some different code ...         }     }


Is the use of "utf8=✓" preferable to "utf8=true"?

I have recently seen a few URIs containing the query parameter "utf8=✓". My first impression (after thinking "mmm, looks cool") was that this could be used to detect a broken character encoding. So, is this a better way to resolve potential problems with character encoding, or is it just a developer having fun with a hack?


Javascript, functional programming and parallel processing

When I use jquery library I notice that the code will continue execution regardless the previous line complete the execution. More precisely while using jquery ajax, it will continue execution without waiting for the ajax result. Is this because javascript takes advantage of parallel processing? Or to which category this can be referred to. Also can we call javascript as a functional programming language.? It will be greatly appreciated if someone could explain this briefly. Thanks in advance.


What are the practical ways to implement the SRP?

Simply what are the practical techniques people use to check if a class violates the single responsibility principle? I know that a class should have only one reason to change, but that sentence is somewhat lacking a practical way to really implement that. The only way I found is to use the sentence **_"The ......... should ......... itself."_** where the first space is the class name and the later is the method (responsibility) name. However, sometimes it's hard to figure out if a responsibility really violates the SRP. Are there more ways to check for the SRP? **Note:** The question is not about what the SRP means, but rather a practical methodology or a series of steps to check and implement the SRP. **UPDATE** ![Report class](http://i.stack.imgur.com/D8u6h.png) I have added a sample class that clearly violates the SRP. It would be great if people could use it as an example to explain how they approach the single responsibility principle. The example is from here.


Recommended methodology for working with shared libraries and Mercurial

I work in a small team of developers who all collaborate on several Zend PHP projects. We are using Mercurial with a collection of upstream repositories, as well as Jenkins for centralized testing and health reports. We want to implement a shared library of common classes, but are struggling with finding a workflow that works well with our current environment. Currently, each project contains a structure like this:               - application        (project specific code)     - build              (temporary files generated by each build)     - library            (code used by multiple projects)         - OurLibrary     (our company’s shared codebase)         - Zend           (external libraries)     - tests              (test code specific to this project)      The library folder is excluded from testing, and so we have created a project specifically for running unit tests against the shared library. This decision was made primarily to avoid deploying the test classes by accident, something which can largely be mitigated by a modification to the automated build process, but also because we felt that it was preferable to keep the library lightweight. We are including the library in each project as a Mercurial sub-repo. This means that changes pushed into the library from a developer working on ProjectA wil not automatically propagate to ProjectB (good) but will also not propagate to the library testing project (bad), and Jenkins will therefore not automatically warn us of potentially breaking code in the library (very bad). An ideal situation would be that developers can commit changes to the library from any project, and that our automated tools would then run the latest library tests against the latest library code. Furthermore, this should not result in a version conflict when a developer pulls a new version of the library tests. Is there an established methodology for this kind of workflow, or should we look into structuring our working practises a little differently before we fully commit ourselves to sub-repos?


Capturing correct level of detail in a user story

I have written various user stories that describe functionality at a pretty high-level. For example:               As an analyst, I want to view the current share price, so that I have quick access to an up-to-date valuation of stock across the Euronext, London and New York stock exchanges.      This requirement is based on existing functionality that is being re-developed in a new version of some software. I can see from the existing implementation that the actual information displayed includes a lot of extra data such as different classes or shares, different timescales of graphs etc. I think it is impractical to capture all the functionality in the current implementation. So I have two questions:   1. How do I decide an appropriate level of detail for the requirement that is basically 'do what the current piece of functionality does'.   2. Is there some structured approach of accompanying the user story with more information? At the moment, I feel this would be the job of wireframes.


PHP PSR-0 + several namespaces in one file and autoload

I've been thinking for a while about defining several namespaces in one php file and so, having several classes inside this file. Suppose, I want to implement something like `Doctrine\ORM\Query\Expr`:               Expr.php     Expr     |-- Andx.php     |-- Base.php     |-- Comparison.php     |-- Composite.php     |-- From.php     |-- Func.php     |-- GroupBy.php     |-- Join.php     |-- Literal.php     |-- Math.php     |-- OrderBy.php     |-- Orx.php     `-- Select.php      It would be nice if I had all of this in one file - `Expr.php`:               namespace Doctrine\ORM\Query;     class Expr {         // code     }          namespace Doctrine\ORM\Query\Expr;          class Func {         // code     }          // etc...      What I'm thinking of is directories naming convention and, unlike `PSR-0` having several classes and namespaces in one file. It's best explained by the code:               ls Doctrine/orm/query     Expr.php      that's it - only `Expr.php` Since `Expr.php` is somewhat I call a "meta-namespace" for `Expr\Func`, it make sense to place all the classes inside Expr.php (as shown above). So, the vendor name is still starts with an uppercased letter (`Doctrine`) and the other parts of namespace start with lowercased letter. We can write an autoload so it would respect this notion:               function load_class($class) {         if (class_exists($class)) {             return true;         }         $tokenized_path = explode(array("_", "\\"), DIRECTORY_SEPARATOR, $class);         // array('Doctrine', 'orm', 'query', 'Expr', 'Func');         //                                    ^^^^         // first, we are looking for first uppercased namespace part         // and if it's not last (not the class name), we use it as a filename          // and wiping away the rest to compose a path to a file we need to include         if (FALSE !== ($meta_class_index = find_meta_class($tokenized_path))) {             $new_tokenized_path = array_slice($tokenized_path, 0, $meta_class_index);             $path_to_class = implode(DIRECTORY_SEPARATOR, $new_tokenized_path);         }         else { // no meta class found             $path_to_class = implode(DIRECTORY_SEPARATOR, $tokenized_path);         }         if (file_exists($path_to_class.'.php')) {             require_once $path_to_class.'.php';         }         return false;     }      Another reason to do so is to reduce a number of php files scattered among directories. Usually you check file existence before you require a file to fail gracefully:               file_exists($path_to_class.'.php');      If you take a look at actual `Doctrine\ORM\Query\Expr` code, you'll see they use all of the "inner-classes", so you actually do:               file_exists("/path/to/Doctrine/ORM/Query/Expr.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/AndX.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Base.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Comparison.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Composite.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/From.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Func.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/GroupBy.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Join.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Literal.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Math.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/OrderBy.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Orx.php");     file_exists("/path/to/Doctrine/ORM/Query/Expr/Select.php");      in your autoload which causes quite a few I/O reads. Isn't it too much to check on each user's hit? I'm just putting this on a discussion. I want to hear from another PHP programmers what do they think of it. And, of course, if you have a silver bullet addressing this problems I've designated here, please share. I also have been thinking if my vogue question fits here and according to `the FAQ` it seems like this question addresses "software architecture" problem _slash_ proposal. I'm sorry if my scribble may seem a bit clunky :) Thanks.


Analogy for Thread Pools

I am working on an application which spawns a new thread per request. Sometimes the number of threads active on the machine at one time is in the high hundreds. It's suspected that this is causing all sorts of problems. I would like to experiment with using thread pool instead to see if this improves work throughput. But first, I have to convince the powers that be to allow me the time. As part of my argument, I think a good analogy that compares the brute-force "launch x threads" method to the technique of thread pools would help. Is there a text-book analogy for this?


Changing frontend cache

Our architecture consists of a front-end cache that most read only users obtain their data from directly. The front-end cache sits in front of a farm of webservers that serve pages written in PHP. We need to be able to detect certain conditions at the front-end cache level and pass those values through to the back-end via HTTP headers. For example we would like to manually tag the carrier network based on the IP address. So, for incoming traffic if the user is say coming from an IP address in the range of "41.202.192.0"/19 we would tag them as being a Orange Cameroon user by setting the appropriate HTTP request header, e.g., X-Carrier = "Orange Cameroon". Based on the setting of this header we would like to vary the cache and serve a different banner to the end user. How would you go about doing this? Keep in mind that we don't want to pollute the cache and we also don't want to create too many small cache segments. Assumptions: You can assume that the X-Carrier has already been detected in our cache. So, for the purposes of your test you can just set this value manually in your example script.


What is the difference between user stories and features?

Playing with icescrum, I realised that I do not understand the difference between user stories and user features. Can someone explain the difference?


Effective way to estimate dead code removal?

I've been working in an application with about 100k LOCs and basically We have been reworking features to comply with a new architecture based on a new technology stack. This work is almost finished but we had to keep the old code because we had to guarantee a stable environment in case of critical bugs in the new . This has lead to a situation where we have a lot of dead code that mixes with a lot of working code thus making difficult to estimate how much time it would take to remove this dead code. This codebase in particular is very troublesome as it does not have unit/integration testing other than the one generated in the process of reworking the features we migrated to the new architecture and also I think that a great deal of the new code is interwoven with the dead code (by static calls, using the previously thrown exceptions). What would be a good start point to estimate how long would it take to safely remove the code?


How is the Trial Period for Softwares generally implemented?

I was always under the assumption that trial softwares write a registry value of the installation date and then the software makes a comparison of the current date of the system with the remaining days + installation date to verify whether the trial period is still valid or not. If this assumption is to be true, winding your system clock further up ahead than the remaining days should end the trial period of the software (or keep winding the clock backwards to use the trial software as long as you wanted to). From experience, This was the case for some softwares, not so for others. For the latter case, I noticed that the trial period expires only after the days have passed in real time. I confirmed that the software wasn't connecting to the outer network for validation mechanism, so it is definitely something being done locally on the computer. **How does the trial period validation work in this case?**


Complexity of a web application

I am currently writing my Master's Thesis on maintainability of a web application. I found some methods like the "Maintainability Index" by Coleman et.al. or the "Software Maintainability Index" by Muthanna et.al. For both of them one needs to calculate the cyclomatic complexity. So my question is: Is it possible to measure the cyclomatic complexity of a web application? In my opinion there are three parts to a web application:   1. Server code (PHP, C#, Python, Perl, etc.)   2. Client code (JavaScript)   3. HTML (links and forms as operators, GET-parameters and form fields as operands!?) What do you think? Is there another point of view on the complexity of web application? Did I miss something?


what will EcmaScript 6 bring to the table for us

Our company ported moderate chunks of business logic to JavaScript. We compile the code with a minifier, which further improves performance. Since the language is dynamically typed, it lends itself well to obfuscation, which occurs as a byproduct of minification. We went to great efforts to ensure it positively screams, performance-wise. We can now do what we did before, faster, better, with less code, on more platforms. **In summary, we are very satisfied with the current state of the language.** I personally love the language especially for its cross-platform nature. So naturally, I read up a lot about the state of JavaScript compilers, performance and compatibility across as many browsers and platforms as I have time to research. The one theme which has been growing louder and louder these days, is the news about ECMAScript 6. So far, what I have been able to gather is that ES6 promises a better development experience; firstly by enabling new ways to do things, secondly by reporting errors early. This sounds great for those who are still waiting for the language to meet their needs before jumping on board. But we have already jumped on board in a big way. Sure, I expect that we will have to do ongoing maintenance and feature revisions on our code through the years, and that we would obviously make use of best practices at the time. But I don't see us refactoring major portions of it to take advantage of language features that are mostly intended to boost developer productivity. I keep wondering, what impact will the language advances ultimately have on our **existing,** well-written, well-performing code base? Is there something I am missing? Is there something we ought to look out for? Does anyone have tips or guidance on how we should approach the ecmascript.next finalization? Should we care?


How should an API use http basic authentication

When an API requires that a client authenticates to it, i've seen two different scenarios used and I am wondering which case I should use for my situation. Example 1. An API is offered by a company to allow third parties to authenticate with a token and secret using HTTP Basic. Example 2. An API accepts a username and password via HTTP Basic to authenticate an end user. Generally they get a token back for future requests. My Setup: I will have an JSON API that I use as my backend for a mobile and web app. It seems like good practice for both the mobile and web app to send along a token and secret so only these two apps can access the API blocking any other third party. But the mobile and web app allow users to login and submit posts, view their data, etc. So I would want them to login via HTTP Basic as well on each request. Do I somehow use a combination of both these methods or only send the end user credentials (username and token) on each request? If I only send the end user credentials, do I store them in a cookie on the client?


How do you take into account usability and user requirements for your application?

Our team supports BackOffice application: a mix of WinForm and WPF windows. (about 80 including dialogs). Really a kind of a Swiss Army Knife. It is used by developers, tech writers, security developers, testers. The requirements for new features come quite often and sometimes we play Wizard of Oz to decide which GUI our users like the most. And it usually happens (I admit it can be just my subjective interpretation of the reality) that one tiny detail giving the flavor of good usability to our app requires a lot of time. This time is being spent on 'fighting' with GUI framework making it act like we need. And it very difficult to make estimations for this type of tasks (at least for me and most members of our team). Scrum poker is not a help either. Management often considers this usability perfectionism to be a waste of time. On the other hand an accumulated affect of features where each has some little usability flaw frustrates users. But the same users want frequent releases and instant bug fixes. Hence, no way to get the positive feedback: there is always somebody who is snuffy. I constantly feel myself as competing with ourselves: more features -> more bugs/tasks/architecture. We are trying to outrun the cart we are pushing. New technologies arrive and some of them can potentially help to improve the design or decrease task implementation time but these technologies require learning, prototyping and so on. Well, that was a story. And now is the question:   * How do you balance between time pressure, product quality, users and management satisfaction?   * When and how do you decide to leave the problem with not a perfect but to some extent acceptable solution, how often do you make these decisions?   * How do you do with your own satisfaction? What are your priorities? P.S. Please keep in mind, we are a BackOffice team, we have neither dedicated technical writer nor GUI designer. The tester have joined us recently. We've much work to do and much freedom concerning 'how'. I like it because it fosters creativity but I don't want to become too nerdy perfectionist.


Should I implement BackBone.js into my ASP.NET WebForms applications?

# Background I'm trying to improve my group's current web app development pattern. Our current pattern is something we came up with while trying to rich web apps on top of ASP.NET WebForms (none of us knew ASP.NET MVC). This is the current pattern: ![diagram of our pattern](http://i.stack.imgur.com/GjKmw.png)!   * Our application is using the WinForms Framework.     * Our ASPX pages are essentially just HTML, we use almost no WebControls.    * We use JavaScript/jQuery to perform all of our UI events and AJAX calls.      * For a single ASPX page, we have a single .js file.     * All of our AJAX calls are POSTs (not RESTful at all)   * Our AJAX calls contact WebMethods which we have defined in a series of ASMX files.      * One ASMX file per business object. # Why Change? I want to revise our pattern a bit for a couple of reasons:   1. We're starting to find that our JavaScript files are getting a bit unwieldy.   2. We're using a hodgepodge of methods for keeping our local data and DOM updates in sync. We seem to spend too much time writing code to keep things in sync, and it can get tricky to debug. I've been reading Developing Backbone.js Applications and I like a lot of what Backbone has to offer in terms of code organization and separation of concerns. However, I've gotten to the chapter on RESTful app, I started to feel some hesitation about using Backbone. # The Problem The problem is our WebMethods do not really fit into the RESTful pattern, which seems to be the way Backbone wants to consume them. For now, I'd only like to address our issue of disorganized client side code. I'd like to avoid major rewrites to our WebMethods. # My Questions Is it possible to use Backbone (or a similar library) to clean up our client code, while not majorly impacting our data access WebMethods? Or would trying to use Backbone in this manner be a bastardization of it's intended use? Anyone have any suggestions for improving our pattern in the area of code organization and spending less time writing DOM and data sync code?