title: Is there a recommended way to communicate scientific/engineering programming to C developers?

text: I have a lot of MATLAB code that needs to get ported to C (execution speed is critical for this work) as part of a back-end process for a web application. When I attempt to outsource this code to a C developer, I assume (correct me if I'm wrong) few C developers also understand MATLAB code (things like indexing and memory management are different, etc.). I wonder if there are any C developers out there that can recommend a procedure for me to follow to best communicate what the code does? For example, should I provide the MATLAB code and explain what it's doing line by line? Or, should I just provide the math/algorithm, explain it in plain English, and let the C developer implement it with this understanding in his/her own way (e.g. can I assume the developer understands how to work with complex math (i.e. imaginary numbers), how to generate histograms, perform an FFT, etc.)? Or, is there a better method? I expect I'm not the first to need to do this, so I wonder if any C developers out there ran into this situation and can share any conventional wisdom how they'd like this task to be transferred? Thanks in advance for any comments.


title: What should I keep in mind when writing custom software quotes?

text: I've been asked to give a quote to extend a piece of software i'm currently giving away for free for use by a company. They tell me they are using it in- house at the moment in conjunction with some "post processing" steps, which they would like to incorporate into the application proper. What should I keep in mind when writing quotes for custom or bespoke software requests? How can I ensure all my bases are covered? What aspects of a custom software quote are things that are often overlooked?


title: How to release a mobile app successfully?

text: This includes everything that contributes to the success of the app and is non-programming. Some points to consider:   * How do you make people notice your app when there are hundreds released every week? How to get an article published in a mobile app blog about your app? Should you buy ads? What about a press release?   * How to shoot a promotional video? What material is good? Should you go for animation or real life footage?   * How to make a project website for the app? Should it be simple in design? What about feedback forum? Should you use standard forum like, uservoice.com?   * To which marketplace should you release the app? Should you stick to one or as many as you can?   * Should you wait with releasing until you have all these handled or should you do it immediately? Is there a good time to release your app?


title: Database design good practices

text: I recently joined a new position as SW developer and during the interview process everyone stressed the importance and the pride of the quality standards of the firm in each and every process they have. (This was one of the aspects that made me decide to accept the offer) When I started inspecting the database I realised that it was far from being perfect, far from being good and far from being not bad. Also I realised that all my team mates do think that the database is complex because the business is complex. What is wrong with this database then?   * inconsistent naming   * de normalised table (with conflicting data)   * plenty of stored procedures and tvf with if/switch/case based on values in the tables themselves   * tvf that depend on tvf that depend on tvf making the code unreadeable and unmaintainable   * no FK constraints and in some cases PKs   * no distinction between data abstraction and business logic (too many encapsulated TVFs) I decided to bring the matter up during my next review because I believe my manager (non technical) does not have a clue of what is going on. I need help to come with a list of aspects to consider to asses the quality of a database design and then assess the score of our database against this list. This will help at least my manager to take steps in the right direction (I hope). Which points should I consider to asses whether a database is well designed? Well designed means:   * does it job   * it does not break (or do so in a sensible manner)   * it follows a structure that make it easy to maintain and expand


title: About technical Certifications

text: I am a Java/J2EE/Oracle PL-SQL developer for the past 5 years and have written the SCJP and SCWCD certification exams. But that was long ago. I now plan to get certified, but not sure which track to choose. There is SCBCD, SCEA etc., but I don't find them much useful. Which are the reputed and useful certifications that will help me learn as well as will give my resume a boost (I stress on the former one a bit more than the latter one). I don't mind venturing into new technologies. Thanks for your help.


title: Why is an operating System denoted as 32 bit or 64 bit

text: Why are some operating systems labeled 32-bit and others 64-bit? If the processor is the one doing the actual execution, why does the operating system care about how many bits are used?


title: Is a finite state machine an appropriate solution for this situation?

text: I was writing some test code as an example where I had a washing machine class. It has a door state that should be open or closed, and also a running state, either on or off. I want to prevent the running state from changing from 'off' to 'on' when the door is 'open', and also prevent the door from being set to 'open' while the machine is 'on'. I have this functionality rigged up with a bunch of if statements. It feels inelegant and it could quickly turn into spaghetti code if I want to add another state that puts additional conditions on the changes of other states. I wonder, is a finite state machine a solution for this situation? Would it simplify adding states and defining valid transitions?


title: Why use JSP instead of servlets?

text: _(Rewritten for reopening:)_ What are relative advantages of Servlets over JSP, or vice versa? Might JSP be preferred because it is easy to put code inside JSP, or Servlets because with them code can be separated from view? Are there other considerations? Any information regarding this will be immensely helpful.


title: Multiple roles in Ruby On Rails

text: I've been asked to put together an application in RoR which has multiple roles for users. The idea is that a user will have a role, Admin, Moderator, User ect... and they will also have a department as well, HR, IT, Customer Care ect.... The app will have designated sections for each department to manage data and other basic CRUD based tasks. What the app needs to allow is so a user can only access departments they are assigned to, a user can have multiple departments, a user can be a Admin of one department but may be only a user of another department. Whats the best way of putting something like this together?


title: Why languages that compile to C/C++ generate unreadable, cryptic code?

text: I'm willing to compile certain language to C or C++ for some speedups. My idea was, though, to generate readable code and use structures such `std::vector` and similar wherever I can, expecting CLANG to do the trick of optimizing it as much as it can. I notice that some languages that compile to C or C++ are nothing like that, though. Looking on the code generated by Chicken Scheme, for example, is scary. This, for example, is a snippet generated from `(fn (a b) (sqrt (* a a) (* b b)))`:               float f_(float a,float b){         float b_=a*a;         float c_=b*b;         float d_=b_+c_;         float e_=sqrt(d_);         return e_;     };      Is there a particular reason for those languages to do that? Is my approach wrong in some aspect? EDIT: to make it clear, this is an example of "readable" code generated from my language. Look at code generated from Chicken Scheme and it looks like an UFO building manual wrote in an alien language.


title: Ruby Sinatra best practices for project structure

text: Many people praise Sinatra's ability to create simple projects in a single file. This is great and all but what if I want to use Sinatra for slightly larger project? I'm fairly new to Ruby as a whole but have already found a couple ways to create a Sinatra application with separate models files, partitioning different groups or URLs into individual files, etc... But is there any best practice for this?


title: Which specific practices could be called "software craftsmanship" rather than "software engineering"?

text: Although not a new idea there seems to have been a big increase in the interest in software craftsmanship over the last couple of years (notably the often recommended book Clean Code's full title is Clean Code: A Handbook of Agile _Software Craftsmanship_). Personally I see software craftsmanship as good software engineering with an added interest in ensuring that the end result is a joy to work with (both as an end user and as someone maintaining that software) - and also that its focus is more at the coding level of things than the higher level process things. To draw an analogy - there were lots of buildings constructed in the 50s and 60s in a very modern style which took very little account of the people who would be living in them or how those buildings would age over time. Many of those buildings rapidly developed into slums or have been demolished long before their expected lifespans. I'm sure most developers with a few years under their belts will have experienced similar codebases. What are the specific things that a software craftsman might do that a software engineer (possibly a bad one) might not?


title: Which things instantly ring alarm bells when looking at code?

text: I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further discussion. This sort of thing always worries me as there's that truism that everyone thinks they're an above average driver. Although I think I can recognize bad code I'd love to learn more about what other people consider to be code smells as it's rarely discussed in detail on people's blogs and only in a handful of books. In particular I think it'd be interesting to hear about anything that's a code smell in one language but not another. I'll start off with an easy one: > **Code in source control that has a high proportion of commented out code** > \- why is it there? was it meant to be deleted? is it a half finished piece > of work? maybe it shouldn't have been commented out and was only done when > someone was testing something out? Personally I find this sort of thing > really annoying even if it's just the odd line here and there, but when you > see large blocks interspersed with the rest of the code it's totally > unacceptable. It's also usually an indication that the rest of the code is > likely to be of dubious quality as well.


title: Is "Analysis Patterns: Reusable Object Models" Still A Good Book To Use For Its Subject Matter Today?

text: Is "Analysis Patterns: Reusable Object Models" by Martin Fowler (published 1996) still a good book to use for the content it covers? Are there other good books that cover the same content? Are there more up-to- date books? **Update:** Are there any more answers on this question, as well as any answers on the second part about alternative books?


title: How does NUnit for C# compare with Unit Test facility integrated with Visual Studio

text: I need to work in a team to develop a mid scale Desktop application developed using C# .NET. Prior to this, I have not applied Unit Testing and Test Driven Development. I am aware that there exists many tools and framework for Unit Testing C# applications. As of now, I am aware of Nunit and the Unit Testing facility integrated with Visual Studio. I would like to know, how do the two compare?


title: How can I hide my signature in a program?

text: We have a university programming course and fellow students are asking some programming questions in our Facebook group. I'm a little hesitant to share all of my programs, especially if it's something cool for one of the assignments, since these are looked at by the TAs and they might notice if somebody has the same program and start asking questions on where it came from. Still, sometimes I'd like to share my code to help others, but I don't wanting people just grabbing my work. _(Clarification: We are allowed to collaborate with the tasks)_ This is of course a thin line. While I want to help some people, I'm concerned that they may not have the academic honesty to rewrite the code on their own. Most of my fellow students are not very advanced in their skills, so I'd get away with say hiding my name in Base-64 encoded string crafted into a discrete place. Still, it may be too obvious for a random string to be sitting around. **What options exist to hide my name in a program without it looking suspicious?** I've seen over at CodeGolf that they have made ascii art turn into other things when evaluated. Are there similar strategies I could utilize? The ideal solution would be something that looks like something that fits in discreetly but in reality has a function to prove that I coded it from the beginning. Clarification: _(Sorry, should have said this earlier)_ We're allowed to collaborate but have to explain our programs to the TAs to get the points. It's just for satisfaction to hide some Easter Eggs in other's code if it leaks out, especially since it may be tempting to exchange programs to check that the answers to problems they generate are equivalent etc or to see how others solve the problem.


title: Mongo Licensing (AGPLv3)

text: I'm going to include MongoDb(AGPLv3) in my product. My product is SaaS, I don't install this to client directly. My software is ASP.NET MVC website. But MongoDb's drivers for .Net is under Apache My questions are: 1) Should I license my software under AGPLv3 license if I use Mongo? I use them across drivers which written on Apache, but somewhere I've heard that if use GPL component in your software you must license whole your product under GPL 2) If I license my website under AGPLv3 should I provide code for all customers? Thank you for answers?


title: efficient caching with complex user rights

text: I am currently learning about memcached/redis, and I am trying to figure out how could I use this kind of technology at work. Now I understand that you should mostly cache data which is common to many user and which does not get modified every second. In our architecture, we have a very relational data model data model combined with a fairly complex rights management system. To keep it simple, some objects are nested under some other objets with different types. An object can have several "parent". A given user can be given access to subset of the data with declaration such as `user can read all objects which have parents a & b of types A and B`. Things can get more complex with groups. This makes very hard to predict which object can be seen by a given user. I also fail to see how can I come up with a good cache invalidation rule, because a lot of events may affect what a user is seeing (access rules modification, a parent is modified in the hierarchy, user added/removed from group etc). So I feel that I will need to create a per user cache with low expected duration, which does not look very useful. In this context, is there still hope to find a decent caching strategy? Am I making incorrect assumptions?


title: How common is meta-programming?

text: How often do you or have you seen meta-programming be used in projects? In uni I've never seen this be applied, but I've seen this on my previous job (when I saw it I was blown away of how effective it was). But how common is it? Is it used all the time, or just occasionally?


title: Herding your users to your bugtracker

text: I have a fully configured mantis bug tracker for tracking issues in apps that I create. When an user is disciplined and goes straight to mantis to write a issue report, he/she will have fastest response and everything regarding the issue will be very easy to track. However, not everyone is keen to do so. They report their problems via phone, e-mail, don't report them at all. What would be the best way to nudge them towards the using a bugtracker system? Clearly, they HAVE to see some immediate benefits so they can return and look for more benefits. EDIT: I am talking about support for the products that I sell as an ISV.


title: How do I deal with a difficult programmmer joining an open source project?

text: I have an open source script for a specific site (I'm trying not to call anything by name here) that I and a few other developers recently moved to GitHub. We've gotten several new developers since we moved to the new system, including one very active one in particular. However, this active one has started changing a lot of the project. First of all, he deleted our versioning system (not like Git, but like that -- we called it versions `v4.1.16`) and said it would be better to simply push the code to the site when we think it's ready. Now there's no centralized place to put release notes, which has gotten annoying. The thing that has gotten me just about ready to pack my bags and go was the push script. Another developer on the project wrote a simple Python-based push script. Since we keep multiple versions of the script online in various places, I began coding a larger Java program with a graphical interface that will replace the Python script. I went on IRC to notify everyone about it, and I got a very annoying response from the programmer saying that the old Python- based script can do everything mine can do and is so much more lightweight (he also commented about the fact that he thought Python was better than Java and so on). I looked over the code for the old push script and saw that none of the features he said existed were there. So now I want to know what to do. I've spent a lot of my time on this project, so I don't want to just get up and leave, but I'm finding it hard to work with this new developer. On the flip side, he is now the #1 committer on the project, with even more commits than the lead developer. I'm not really sure what to do about this. Has anybody else experienced this problem? If so, what did you do? **UPDATE 1** : I have disabled everyone's commit access and I am requesting people go through pull requests. I also proposed several measures to fix the other issues. Everyone else hasn't shown any support for it. The troublesome dev has simply said that people who don't follow the "commit action" closely can think that the project is disorganized when it really isn't. I obviously don't agree with this, so I am seriously contemplating resigning from the project. **UPDATE 2** : The lead developer began ranting about the fact that one of my commits supposedly deleted three newlines in the code (the revert commit showed up just after I posted the discussion, and doesn't even reference my "commit"), and then the two of them began discussing whether to revoke my commit access. So, I have done the logical thing and left the project. Thanks for your help with this everyone!


title: Can I use a @font-face of "Courier New"?

text: I currently have my font stack:               font-family: "Courier New", Courier, monospace;      In all browsers that I test in I see the font displayed in the `Courier New` font except for my android devices - my nexus and my kindle. And although they have a monospace fallback I would rather have my site displayed the same across these devices. Do I violate any licenses when I add the font using `@font-face`? If so, how do I resolve this?               @font-face {       font-family: "Courier New";       src: url(/fonts/cour.ttf) format('truetype');     }


title: Is storing software in the cloud with reputable vendors secure?

text: I have a team member who refuses to use any form of private source code repository on Github or Bitbucket due to "security concerns". As a result, we have a hard time sharing code with him. He appears to be concerned about source code theft by some party. To me, using cloud based source code repos is fairly standard industry practice. But does this individual have a point? Vendors do steal from customers in other industries. Should a multimillion dollar idea not be stored on a third party cloud service like AWS, Github, Bitbucket, App Engine, etc?


title: Mapping between 4+1 architectural view model & UML

text: I'm a bit confused about how the 4+1 architectural view model maps to UML. Wikipedia gives the following mapping:   * **Logical view:** Class diagram, Communication diagram, Sequence diagram.   * **Development view:** Component diagram, Package diagram   * **Process view:** Activity diagram   * **Physical view:** Deployment diagram   * **Scenarios:** Use-case diagram The paper Role of UML Sequence Diagram Constructs in Object Lifecycle Concept gives the following mapping:   * **Logical view** (class diagram (CD), object diagram (OD), sequence diagram (SD), collaboration diagram (COD), state chart diagram (SCD), activity diagram (AD))   * **Development view** (package diagram, component diagram),    * **Process view** (use case diagram, CD, OD, SD, COD, SCD, AD),    * **Physical view** (deployment diagram), and    * **Use case view** (use case diagram, OD, SD, COD, SCD, AD) which combines the four mentioned above. The web page UML 4+1 View Materials presents the following mapping: ![UML 4+1 View Materials](http://i.stack.imgur.com/5zzFg.gif) Finally, the white paper Applying 4+1 View Architecture with UML 2 gives yet another mapping:   * **Logical view** class diagrams, object diagrams, state charts, and composite structures   * **Process view** sequence diagrams, communication diagrams, activity diagrams, timing diagrams, interaction overview diagrams   * **Development view** component diagrams   * **Physical view** deployment diagram   * **Use case view** use case diagram, activity diagrams I'm sure further search will reveal other mappings as well. While various people usually have different perspectives, I don't see why this is the case here. Specially, each UML diagram describes the system from a particular aspect. So, for instance, why the "sequence diagram" is considered as describing the "logical view" of the system by one author, while another author considers it as describing the "process view"? Could you please help me clarify the confusion?


title: Copyright assignment on open source projects

text: Some time ago I wrote a BlackBerry application. I find that I now want to release it under an open source license. I am strongly considering the GPL v3 license. All the code is mine; there are no third-party libraries (with the exception, of course, of the all the standard BlackBerry/Java libraries that I am "linked" to). This is the first open source project that I will be maintaining or starting. I find myself a bit lost about how to handle contributions. It seems to be more-or-less standard to expect some kind of copyright assignment from contributors so that the project has a unified copyright. I could either assign all copyrights to the FSF or assign all copyrights to myself. How should I handle this? The most important features of whatever implementation I use are:   * Protects me from being sued for any unintentional violations of the GPL in my own code   * Protects others' contributions from being misused by me if I become evil   * Encourage others' contributions to the project (or at least does not discourage such contributions) For assigning all copyrights to myself, the most promising strategy for copyright assignment seems to be one based on Oracle's contributor agreement, located here: http://openjdk.java.net/legal/oca.pdf. However, I feel like expecting any contributors to sign a legal document, providing me with fairly personal information is asking for a lot, especially given that my project is very small. Should I proceed with requiring contributors to sign a document similar to Oracle's agreement? Should I just accept contributions and cross my fingers that I won't have any trouble down the road? Is there another strategy that I should employ?


title: How can you estimate time for tasks which primarily consist of figuring out a problem?

text: While it is relatively possible for an experienced developer to estimate how long it will take to implement code when the pattern and problem the code is solving is well understood, how can you make a good estimate when, while the end goal is well understood, the implementation is 95% theoretical/problem solving and has very small amounts of implementation? My work often consists of tasks to accomplish well defined goals, however I have to find the way to reach that goal and until I understand the solution, it i6sn't clear what additional barriers there may be. More specifically, I'm often working on code generation or automated code manipulation tools. Once the solution is fully solved and the tool perfected, it will directly do 95% of the actual changes very quickly. I don't, however, have any way to estimate how many additional issues may have to be resolved to make the generation or analysis tool deal with unforeseeable edge cases. For planning purposes, my company wants a better idea of how long it will take, but since I don't know how many additional problems may come up while working through solving each step of the solution. I'm not sure how I can approach giving a better estimate.


title: Patterns for propagating changes up an object model..?

text: Here's a common scenario that's always frustrating for me to deal with. I have an object model with a parent object. The parent contains some child objects. Something like this.               public class Zoo     {         public List<Animal> Animals { get; set; }         public bool IsDirty { get; set; }     }      Each child object has various data and methods               public class Animal     {         public string Name { get; set; }         public int Age { get; set; }              public void MakeMess()         {             ...         }     }      When the child changes, in this case when the MakeMess method is called, some value in the parent needs to be updated. Let's say when a certain threshold of Animal's have made a mess, then the Zoo's IsDirty flag needs to be set. There are a few ways to handle this scenario (that I know of). **1)** Each Animal can have a parent Zoo reference in order to communicate changes.               public class Animal     {         public Zoo Parent { get; set; }         ...              public void MakeMess()         {             Parent.OnAnimalMadeMess();         }     }      This feels like the worst option since it couples Animal to its parent object. What if I want an animal who lives in a house? **2)** Another option, if you're using a language that supports events (like C#) is to have the parent subscribe to change events.               public class Animal     {         public event OnMakeMessDelegate OnMakeMess;              public void MakeMess()         {             OnMakeMess();         }     }          public class Zoo     {         ...              public void SubscribeToChanges()         {             foreach (var animal in Animals)             {                 animal.OnMakeMess += new OnMakeMessDelegate(OnMakeMessHandler);             }         }              public void OnMakeMessHandler(object sender, EventArgs e)         {             ...         }     }      This seems to work but from experience gets hard to maintain. If Animals ever change Zoo's you have to unsubscribe events at the old Zoo and resubscribe at the new Zoo. This only gets worse as the composition tree gets deeper. **3)** The other option is to move the logic up to the parent.               public class Zoo     {         public void AnimalMakesMess(Animal animal)         {             ...         }     }      This seems very unnatural and causes duplication of logic. For example, if I had a House object that doesn't share any common inheritance parent with Zoo..               public class House     {         // Now I have to duplicate this logic         public void AnimalMakesMess(Animal animal)         {             ...         }     }      I have not yet found a good strategy for dealing with these situations. What else is available? How can this be made simpler?


title: What's the "Memento" class for in the Memento design pattern?

text: In the Gang of Four's "Memento" design pattern, the `Memento` class looks like a useless wrapper that doesn't actually provide any value to me. What is it for? Is there any reason you can't just pass around the `String` object (in the Wikipedia example)?


title: Good practice to seperate Git Repo from published Repo?

text: We have a central Git repo from which developers fetch and push changes. They make changes on the default master branch. Our Continuous Integration (CI) tool builds artifacts off this default master branch and is the entity responsible for promoting something we want to be tested to a "UAT" branch (this is in reality done by a build-master person clicking a button on the CI tools web page that will do the promotion). The CI tool is also responsible for promoting code from UAT to the "Production" branch. The purpose of the UAT and Production branches is to capture what was promoted to UAT and to Production. No development occurs on the UAT branch and Production will only contain "development" in the form of infrequent "hot-fixes" as our development/release iterations are very fast (1 week iterations). If we can do it easily, we'd like to put in a control that will prevent someone mistakenly making development changes to UAT and Production branches directly. One thought is to have a hook on the central server that makes sure that only the CI tool user can make changes to UAT and Production. We also thought we could have a central repo that developers use that only contains the master branch and have a second repo that contains the UAT and Production branches. The CI tool will communicate with both repos-- it will look at the development to repo to see when there are changes and use the second repo to do its promotion to the UAT and Production branches. Is this what folks typically do (separate repos for purposes of development versus promotion?) Would it be better than the server hook approach?


title: Criteria for prioritizing product backlog

text: My list of the most important criteria is below. What do you think?   1. The value to the user - naturally features that are more important to the user must come first   2. Implementation time - the faster it is to implement a feature, the higher it should be on the list   3. Dependency between features - obviously you can't make a "roof" feature without developing the "walls" feature first.   4. Risk reduction - If a certain feature is very important for the project but we are not sure if we can actually develop it (because of either technological limitations or because we don't know how users will react to it), it climbs up on the list.


title: Is the result of strcmp the same on all machines and compilers?

text: Code:               #include <stdio.h>     #include <stdlib.h>     #include <string.h>          int main()     {            int n = strcmp("hello","help");         printf("%d\n", n ) ;         return 0;     }      Result:               -1      Does the value for this program have to be the same on all machines or different compilers? In other words can this return value take on different values for the same program when run on different compilers or different machines?


title: Career progression from Systems Architect?

text: What are the usual career paths from a Systems Architecture role? Do people ever move from architecture roles into management and work towards CIO/CTO or do they generally just head towards Enterprise Architecture? What would you suggest to learn/do to aid in positioning to move into management and eventually CIO/CTO roles? Experiences?


title: Database designs, parallel tables, or extra fields?

text: I run a database for a sequencing centre. There are other developers getting data out of this and running automated and semi automated processes from the database. We are discussing a change to the database. At the moment we have a library that has a one-to-one relationship with a multiplex_index, which can be used to identify the library. We now want to add an optional GBS_index to each library (another optional one-to-one relationship). So each library will have a multiplex_index and optionally a GBS_index. The columns stored on the new GBS_index will be the same as for the multiplex_index. So we have 2 options for storing the GBS_index data. 1) Store the GBS_index data in the original multiplex_index table, and identifying it by its "type" field. 2) We can add a parallel table for the GBS_index, which mirrors the multiplex_index table. I favour the second parallel table option, as I see it as less likely to break existing code (scripts query the database for a list of multiplex_indexes, these would need to exclude the GBL_indexes in this case). Conceptually the two types of indexes are both "multiplex indexes", but used in a slightly different manner. Are there any strong arguments for or against either option? * * * Ok, a quick explanation of DNA sequencing may help. DNA sequencing involves taking DNA from cells and splitting them up into "reads" of approx 200 base pairs (each base pair is like a DNA char A,T,G or C). We load libraries (DNA from a prepared biological sample) on to a machine and sequence them. The two types indexes I talked about are a another piece of DNA with a known sequence, that is attached to the start of the library DNA before it is sequenced. That way, we can read the first bit of sequence we can identify what library each read (~200 chars) came from. (We are generally interested in the numbers of reads matching a position on a reference genome). Now we can have one (multiplex) or two (multiplex + GBS) indexes at the start of the library DNA (one comes after the other), which form a unique combination to identify the library. Initially two libraries with the same multiplex_index should not be loaded together, as you couldn't identify them from the multiplex_index sequence. Now the combination of the two indexes should be unique.


title: Using jTransforms for a commercial (non-free) android application?

text: I am developing an application which is using JTransforms to compute FFT and InverseFFT. I am planning to sell that application on Play Store. The JTransforms Library is covered under MPL/LGPL/GPL tri-license. Does that mean I have to disclose my application's source code to the community ? Does that mean I cannot use an open-source library to sell non- free application ? I found the following link in which the ScissDSP library is using JTransforms under LGPL license : https://github.com/Sciss/ScissDSP/blob/master/licenses/JTransforms-License.txt Does that mean MPL/LGPL/GPL is sort-of Pick 'n' Choose type of License ?


title: Naming boolean variables: negated or not

text: A few years ago, I was in a software engineering class and the teacher explained how messages, options, variables, etc. should not be negated to avoid confusion. He gave the example (something like): > Are you sure you do not wish to delete this file? Yes, No, Cancel explaining that, for a `DELETE` action, the user would require more time to figure out if `Yes` will delete or not the file, and may lead to frustration if the user chooses `No`. I'd like to know if a similar quick-response phenomenon exists with source code. I browse Node.js modules and I often see options like: `disableTimeout = false`, `noAutoDetect = true`, etc. Which, to me, would be better written as `timeoutEnabled = true` and `autoDetect = false`, etc.? This may seem like a matter of opinion, but I believe this is a matter of engineering and leading others to a correct understanding of a variable's purpose. I believe there are academic studies backing this principle, and would prefer answers backed by external references.


title: fill containers with blocks of different sizes to have containers of "similar" sizes

text: I have a sorted list of blocks `L` that I want to put in 4 containers `C`, the containers have a size limit `S`. I want to have similar containers height, by similar I mean the size variance should be as small as possible. eg:               S = 4     L = [1, 1, 3, 1, 2, 1, 2]      should result in:               C = [[1, 1], [3], [1, 2], [1, 2]]      note: it is always possible to put every blocks inside the 4 containers and I can't change blocks order is there a way to do this efficiently? I couldn't find algorithm names about this but I didn't really know how to search for that


title: Reduce number of if statements through design pattern

text: I had a loop through object `Process`, each `process` instance can be of a different type, derived from `Process` base class (e.g.: `Process1`, `Process2`,...). Each derived type of `Process` has different properties. For instance: some `Process`es are indexable, this is notified by `IsIndexable` flag. When a `Process` is indexable has some additional properties (for instance: `AccessDate`) that non-indexable process doesn't have. Now I have to cycle on each Process in `request.Process` (remember indexable `Process`es are different from others)               foreach (Process process in request.Processes)     {          if(process.getType().Name.Equals("Process1")) // indexable process          {              ((Process1)process).Name = "aName";              ((Process1)process).AccessDate = DateTime.Now;          }          else if(process.getType().Name.Equals("Process2")) // non indexable process          {              ((Process2)process).Name = "anotherNane";              //compile error - AccessDate don't exist for type Process2              //((Process2)process).AccessDate = DateTime.Now;                    }     }      Since I hate that cascading if I have rewritten using interface:               IProcessable processableImpl = // some Unity stuff based on request type     foreach (Process process in request.Processes)     {          processableImpl.fillTheRightProperties(process);     }      `processableImpl` is injected in a different manner based on the `request.Type`. At this point `fillTherRightProperties` method will do the work for me on the current `process`.               public interface IProcessable     {         void fillTheRightProperties(Process process);     }          public class IndexableProcess : IProcessable      {         void fillTheRightProperties(Process process){             Process1 process1 = process as Process1;                  if(process1==null) throw MyException("Process1 expected");                  process1.Name = "aName";             process1.AccessDate = DateTime.Now;         }     }          public class NonIndexableProcess : IProcessable      {         void fillTheRightProperties(Process process){             Process2 process2 = process as Process2;                  if(process2==null) throw MyException("Process2 expected");                  process2.Name = "aName";         }     }      This is more beautiful than a cascading `if` but I feel still not as beautiful as it could be. I feel a violation of responsability, since the concrete class edit `process` property elsewhere, and I'm afraid to read this code a week after.


title: Do you have any “Family Feud” style questions and answers for a game for high school students?

text: I am gathering questions and responses in math, science, and technology for a "Family Feud" style game for high school students. I am having trouble finding and thinking of questions, especially in the technology realm. Technology (programming or general tech) questions are preferred. If you have never seen the game show, "Family Feud" involves two teams trying to guess the most popular responses to questions asked to a group of 100 respondents. The team must guess all the popular responses to get the points for the question. For example, if the question is, "What are the major tags in HTML 4.0?", the responses might be:   1. P (64 votes)   2. DIV (16 votes)   3. TABLE (8 votes)   4. BLINK (4 votes)


title: Is diversifying my programming knowledge good?

text: I have skills in so many programming languages, such as Java, C++, C, Obj-C, Scala, Haskell, and Matlab. However I don't know/like web programming at all. I also get bored very quickly. Thus I haven't work with any Java projects that's bigger than say 20-30 java files. I'm finishing off my degree and I want to work as a developer, particularly in mobile area. Do I have enough skills to be recruited by good companies?


title: Help me to understand following points about the strategy pattern, how it relates to open/closed principle

text: I am learning design patterns. I read this article. Point no. 3 is not clear to me. The writer said that **strategy lets you change the guts of an object**. But this is a violation of the **open-close** principle. Am I wrong? If I am wrong, then help me to understand what writer wanted to describe.   1. Strategy is like Template Method except in its granularity.   2. State is like Strategy except in its intent.   3. Strategy lets you change the guts of an object. Decorator lets you change the skin.   4. State, Strategy, Bridge (and to some degree Adapter) have similar solution structures.    5. They all share elements of the ‘handle/body’ idiom. They differ in intent - that is, they solve different problems.   6. Strategy has 2 different implementations, the first is similar to State. The difference is in binding times (Strategy is a bind-once pattern, whereas State is more dynamic). Strategy objects often make good Flyweights.


title: Design Structure/Data Structure thoughts needed

text: I am reading a Binary file, it has several blocks, each block has different names/data. Some of this data is string value, date, datetime, time but most of them are integer value. Previously I code a struct for each Block and create public member to hold each property of that block, and then I make a Wrapper class this wrapper class has Object of each Block Class and we assign values within this wrapper class to keep complete file in one object. Now, I am looking for more efficient way of doing it as our previous code was not very efficient and I have to rewrite all Block classes, but just thought if there is easy and more efficient way of doing it. Maybe I should use List or Dictionary object instead ? What you think is best of doing it. Btw my files are 100MB + and hence it is lot of data as file is binary when it is 100MB :).


title: Should I be worried about overengineering programming assignments given during interview process?

text: I recently had a phone interview with a company. After that phone interview, I was told to complete a short programming assignment (a small program; shouldn't take more than three hours). I'm only directly instructed to complete the assignment and turn in the code. I was given complete freedom to use any language I wished and was not told exactly how to turn in the code. Immediately I planned on throwing it on Github, writing a test suite for it, using Travis-CI (free continuous integration for public Github repositories) to run the test suites, and using CMake to build the Linux makefiles for Travis-CI. That way, not only can I demonstrate that I understand how to use Git, CMake, Travis-CI, and how to write tests, but I can also simply link to the Travis-CI page so they can see the output of the tests. I figured that'd make it a tiny bit more convenient for the interviewer. Since I know those technologies well, it would add essentially no time to the assignment. However, I'm a bit worried that doing all this for a relatively simple task would look bad. Although it wouldn't add much more time at all for me, I don't want them thinking I spend too much time on things that should be simple.


title: Stuff a lead developer for an Objective-C team should know

text: Advice on being a lead developer is welcome. Advice on being a lead developer of an Objective-C team more so. Unfortunately, I don't have experience in Objective-C (I suppose the first thing to do is to learn it). Also, I've never been a lead developer before. I do have about 6 years experience in developing applications in Java, Flex and C#.


title: Reducing repetitive DI code

text: I have a method which constructs dependencies using Unity. Currently, all of the calls do pretty much the same thing: Registers 2 repository object and 2 'App Part' objects. My issue is, there's a lot of them and the method has become massive. I've generalised the calls but here's an example:               container.RegisterType<IRepositoryOneDataAccess, RepositoryOneDataAccess>();     container.RegisterType<IRepositoryTwoDataAccess, RepositoryTwoDataAccess>();     container.RegisterType<IAppPart, FirstAppPart>("FirstAppPart.TestName");     container.RegisterType<IAppPart, SecondAppPart>("SecondAppPart.TestName");      I though that this could be split out to reduce the code in the method which registers the types with the container. Firstly I moved the bottom 2 calls to another method since they both register to the same interface, I came up with this method:               private void RegisterParts<TPartOne, TPartTwo>(string firstAppPartName, string secondAppPartName) where TPartOne : IAppPart where TPartTwo : IAppPart     {         container.RegisterType<IAppPart, TPartOne>(firstAppPartName);         container.RegisterType<IAppPart, TPartTwo>(secondAppPartName);     }      This seems to work but I'm not sure this is the best way to do it. I would also like to move the other calls out into another method preferably the same as this one I've created but I'm not sure how to do it or even if it's possible. Is there a better way of refactoring this?


title: Subversion server hierarchy, need advice

text: I have a subversion server setup that I need to look after several projects, grouped by language, then client (company) and then by project e.g.               repos/          flex3          \com1               \project1               \project2          \com2               \project1               \project2               \project3          flex4          \com1              \projectx          \com2              \projecty          java         \projectz      repos is my repository root and then I have the 3 repositories inside (create with svnadmin create) flex3, flex4 and java, then flex3 should have two folders com1 and com2 for different clients, each will contain different "project" repos. I have a feeling I have done this wrong, should I simply create the top level structure as normal folders and then make the com1 and com2 etc into repos with "svnadmin create" so that different projects can be added directly below them. Is this correct? Thanks


title: What to say to your boss if they want you to use a global variable

text: I am currently 4 months into an internship, and when reviewing my code, my boss didn't like that I had kept a specific object local to a number of methods across a few separate classes within one assembly. He didn't like that I was created a new object each time, and instead told me to create a single object that can be accessed from anywhere. I have therefore had to create it as a static object within a static class, and simply reference it from here I want to use it! How would you deal with this, as I have only been programming professionally for 4 months!


title: Equity derivatives programming

text: I've been considering applying for some programming jobs that require experience in Equity derivatives and whilst I know what equity derivatives are, I have no idea what sort of things a programmer working with equity derivatives would do. So I was wondering if there were any developers on here that had experience in development roles working with equity derivatives and could shed some light on what sort of tasks an equity derivatives programmer might be expected to do.


title: Trying to break elements which are lists in a list?

text: I am trying to write a program which make the following:               ?- g([2,3, [22,[3],9] ,4,[5],99],X).          X= [2,3,22,[3],9 ,4,5,99]      so it searches for lists in the given list and replace it by their elements without brackets []. so I wrote this program: The first block just searches for the first element in the list which is list   If there is no such element it returns `[there_is_no_list]`.               first_list_in_the_list([],[there_is_no_list]):-!.       first_list_in_the_list([H|_],X):-is_list(H),X=H,!.       first_list_in_the_list([_|T],X):-first_list_in_the_list(T,X).      The first block works in prolog perfectly. The second block just search in the list for an element X and then split the list into a two lists one is the list of all elements before X and the second is the elements after X.               splite_when_find_element([H|T],H,[],T):-!.       splite_when_find_element([H|T],X,F,G):-         splite_when_find_element(T,X,F1,G),append([H],F1,F).      it also works fine in Prolog. and the third block is append, and it joins two list together in a new list.               append([],L,L).       append([H|T],L,[H|U1]):- append(T,L,U1).      and the last part is:               gg(L,L):-first_list_in_the_list(L,[there_is_no_list]),!.         gg(L,U):-first_list_in_the_list(L,X),              splite_when_find_element(L,X,F,G),gg(G,R),append(F,X,E),              append(E,R,U).      when I give a `query [2,[3],5]` I get also `[2,[3],5]` and I really don't understand why it does this.


title: Keeping track of projects

text: In my job I deal with several projects at the same time (and who doesn't?). Sometimes I have to make changes to a project which I dealt with half a year ago or even longer. And it's hard to recollect the details about the project. I usually look for the modification dates of the files, then I start digging into my email to find the relevant conversations. If the project is really small then it's not even in company's VCS. Sometimes it takes much longer to recollect the details of the project than to make the required change. I started using Onenote to keep track of relevant information about projects but I didn't succeed much in this, probably because I don't have a clear picture of how this knowledge base should look like. It would be nice if I can use some automated tool which can connect relevant emails, source codes, bugs information and feature requests and time periods of different activities related to a particular project. With advanced search capabilities. How do you keep track of this information?


title: Why didn't the C++ Standard adopt expression templates?

text: It's my understanding that expression templates as a technique were discovered significantly prior to the original C++ Standard in 1998. Why weren't they used to improve the performance of several standard classes like `std::string` and streams?


title: Are unit tests really that useful?

text: I just graduated with a degree in CS and I currently have a job as a Junior .NET Developer (C#, ASP.NET, and web forms). Back when I was still in university, the subject of unit testing did get covered but I never really saw the benefits of it. I understand what it's supposed to do, namely, determine whether or not a block of code is fit for use. However, i've never actually had to write a unit test before, nor did I ever feel the need to. As I already mentioned, I'm usually developing with ASP.NET web forms, and recently I've been thinking of writing some unit tests. But I've got a few questions about this. I've read that unit testing often happens through writing "mocks". While I understand this concept, I can't seem to figure out how I'm supposed to write mocks for websites that are completely dynamic, and where almost everything depends on data that comes from a database. For example: I use lot's of repeaters who have ItemDataBound events etc. (again depending on data that is "unknown"). So question number 1: Is writing unit tests for ASP.NET web forms something that is done often, and if it is: how do I resolve the "dynamic environment" issue? When I'm developing I go through a lot of trial-and-error. That doesn't mean I don't know what I'm doing, but I mean that I usually write some code, hit `Ctrl F5` and see what happens. While this approach does the job most of the time, sometimes I get the feeling that I'm being a little clueless (because of my little experience). I sometimes waste a lot of time like this as well. So, question number 2: Would you guys advise me to start writing unit tests? I think it might help me in the actual implementation, but then again I feel like it might slow me down.


title: Is there a name for a randomized heap?

text: I've made a container which functions like a Binary Heap in terms of insertions and popping the root element. The key difference is that the comparison steps are all replaced with a random call for deciding when to go left/right. (The underlying data structure is a Vector, written as an expandable array, so you don't need to know how many elements the heap will contain in advance.) The idea is, you can insert items, and when you pop them, you'll get any element at random. You can also iterate through the whole collection, after which the heap is reshuffled (by simply popping and reinserting N times). Insertion and Removal are both O(log N), reshuffling is O(N log N). Its main use is for games, think a deck of cards or a Bingo-tumbler. It isn't really a true Heap in that there's no guarantee that elements will be less than or greater than their children. But insertion and removal are both done Heap- style, just at random. (Also, unlike a regular Heap, the items do not need to be comparable to eachother.) Is there a standard name for this sort of thing? Or maybe a better way of achieving the same results? I'm calling it a "GrabBag" for now, since that seems to describe it pretty well, but I was just wondering if there was a more widely-recognized name for it. I looked around for possible standard names for this, but couldn't find anything. All I could find was either Randomized Meldable Heaps, which are a different thing, or people complaining about random heap corruption, which isn't even related.


title: How to Structure a Trinary state in DB and Application

text: How should I structure, in the DB especially, but also in the application, a trinary state? For instance, I have user feedback records which need to be reviewed before they are presented to the general public. This means a feedback reviewer must see the unreviewed feedback, then approve or reject them. I can think of a couple ways to represent this:   1. Two boolean flags: Seen/Unseen and Approved/Rejected. This is the simplest and probably the smallest database solution (presumably boolean fields are simple bits). The downside is that there are really only three states I care about (unseen/approved/rejected) and this creates four states, including one I don't care about (a record which is seen but not approved or rejected is essentially unseen).   2. String column in the DB with constants/enum in application. Using Rating::APPROVED_STATE within the application and letting it equal whatever it wants in the DB. This is a larger column in the db and I'm concerned about doing string comparisons whenever I need these records. Perhaps mitigatable with an index?   3. Single boolean column, but allow nulls. A `true` is approved, a `false` is rejected. A `null` is unseen. Not sure the pros/cons of this solution. What are the rules I should use to guide my choice? I'm already thinking in terms of DB size and the cost of finding records based on state, as well as the readability of code the ends up using this structure.


title: Stability vs Reliability

text: Is there a difference between _stability_ and _reliability_ (at least in software engineering context) or can they be used interchangeably? If not, what would be some examples of reliable but not necessarily stable systems, and vice versa?


title: Reason to treat internal class variables and functions inside a class as "separate" entities

text: Note: there is a similar question that addresses my subject: Better style for member variables? ... but that question does not address "dealing with large legacy code base and comprehension of functions that grew too large". I am looking for confirmation or rejection of whether my situation warrants it to be a is a good enough reason to adopt a practice of writing internal-to-the-class functions as if they were separate entities, with their appropriate parameters and return values. **My question** Variables internal to a class are considered to be scoped as "globals" within contains of that class. As such, these variables do not need to be included explicitly as parameters to the class' internal functions. Further, if internal functions return values that may belong to existing inside-class variables, those also do not need to be returned explicitly. You can just refer to them via using `this` object. But, is doing so a good practice? My question comes from the context of refactoring a huge legacy codebase. As such, when I see a function inside a class that goes like `$this->IamACute3000LineFunctionDoingInsanelyCuteStuffInASpaghettiCodeLikeWay()`, I have little clue as to which in-class "global" variables it needs to do its job, and what exactly it returns. This makes it hard and time consuming to deal with that code when any work is to be done on the class. Thus, even though it may not make sense inside the class itself, I do see some merit in writing code like below, treating variables and parameters as if the function was written to be used outside of the class itself:               class HelloClass     {        $private $name;        $private $greeting;             public function __construct($name)        {            $this->name = $name;                 //line of interest            $this->greeting = $this->prepGreeting($this-name);        }             //function of interest        private function prepGreeting($name)        {           return "Hello, $name";        }             public function getGreeting()        {            return $this->greeting;        }     }          $sayHello = new HelloClass("Dennis");     print $sayHello->getGreeting();      Here, `prepGreeting` is the function in question. Surely, it looks a bit ridiculous... as it barely takes advantage of built-in class mechanisms, if at all. It can be rewritten as such instead (with appropriate other constructor changes as well, which are not shown):                  private function prepGreeting()        {           $this->greeting = "Hello, " . $this->name;        }      But then you have to actually read the function's body to understand what it does, what it touches and what it returns. **My question is this** : in my example, where I am dealing with large code where understanding a function takes time, I think there is a good reason to write internal class functions as if they were separate, not belonging to the class, as it will be superior for understanding what goes on inside the function, and what it returns. This function will be self-contained and as such, it will help a lot with refactoring. I could pluck that function out, bend the way I need it to bend, move it to another class, if I have to, thus making it easier to work with the class itself. But, in general, would you recommend such function- writing practice when writing/designing classes? Or would you recommend instead to use built-in `this` object, treating internal to the class variables as "class globals", even though doing so may impact readability/understanding/comprehension of the function if its size does grow, as it often does in real life projects? Finally, am I missing any greater points while focusing on this specific function-writing-style issue? **Add-on** I do see merit in perhaps using some middle-ground, where function parameters are not passed to the function (function uses `this` object to get to those), but the function still returns values, instead of updating `this` object directly, and it is up to the caller to update `this` variable. i.e. this will change my "line of interest" to this code: `$this->greeting = $this->prepGreeting();` and at least I will know what the function is supposed to return, at a glance.


title: How redundant should my tests be?

text: This is something I often struggle with in testing, yet can never find a canonical or reasonable answer to. * * * **Simple scenario** A function, `f()`, takes a file, processes it, and returns the processed file. `f()` has unit tests to check that it performs as expected. A command-line interface application (CLI) takes a file path as input and uses `f()` to process the corresponding file. * * * How should I test the CLI? Passing it a path and ensuring that it handles that path — whether or not the file exists — is logical, but then passing that file to `f()` and checking the output is exactly what I'm doing in the unit tests for `f()`. It is redundant and twice as much work. Further, maintaining the tests when the function changes is twice as much work again. Note: `f()` can be anywhere — in a library that someone else has written, for example, or part of the whole program itself. I'm trying to understand best practices in (not) redundantly testing functionality, not just in this small example.


title: What process/guidelines should be followed, when I am about to deprecate a few methods from my service classes in Java?

text: My team plans to deprecate a few methods from a specific library. I do not want to simply remove them, but dont want to return results either from the mehtods that are to be deprecated. What are the guidelines/process I should ideally follow?


title: Rails: get data about a model collection, with new model or method?

text: have a model `Product` with attributes `sales`, `views` and I need to get sales/views count of all products, in this case is more correct to implement this things as method and have a call like `Product.all.sales` or create a new model `Stats` and implement as `Stat.products.sales`?


title: Is structural typing in a hierarchical model necessary?

text: > This is part of a series of questions which focuses on a project called the > Abstraction Project, which aims to abstract the concepts used in language > design in the form of a framework. > > Another page associated to it related to ease of use can be viewed here. The > meta-topic associated to an inquiry about the framework and the proper place > to post can be found here. I'm writing a framework which describes the concepts within static high-level languages (like C#, VB.NET, et cetera). As a part of that, it involves synthesis of the structures that describe those concepts. One question I had was about what's called Structural Typing, which I aim to implement through type-parameters (constructors with parameters would be a definite addition.) It's a concept that neither C# nor VB.NET implement. The question I have today is: is structural typing in a hierarchical model necessary? One small example that I can think of is models developed that rely on patterns, but don't necessarily have an interface to specify this pattern. This is useful in instances where you want to use the code for multiple base types without a common ancestor, but with similar structure. If you wanted to display a list of items to the Console via their name, you'd need to write one method for the lowest common ancestor that defines that name property. Person, Control, and Type would all use different methods, as an example. If implemented, the resulted code would look something like:               public static void DisplayNames<T>(IEnumerable<T> namedItems)         where T has         {             ///<summary>Returns the item's name</summary>             string Name { get; }         }     {         foreach (var namedItem in namedItems)             Console.WriteLine(namedItem.Name);     }      The '[' and ']' are used for disambiguation reasons (it'd be difficult to try to discern the body of a type-parameter's structure from an interface's structure otherwise.) Suggestions welcome.


title: Multiple visual studio projects/solutions on the go

text: I am working on a large asp.net app as a single developer. I will often work on a number of change requests concurrently. For example, a change required to the Finance component and a change required to the sales component. I sometimes create a separate project to hold the changes and then reference the main application (file reference to the assembly). Is this a common approach or are there any tool/techniques that make this easier? For example, I make a change to the sales component, I will create a new project (SalesChange.sln) and if I make a change to the Finance component then I will create a new project called FinanceChange.sln. FinanceChange.sln and SalesChange.sln reference MainProject.sln and will eventually be migrated to MainProject.sln.


title: Asking back technical questions during the interview (as the interviewee)

text: I would like to know if people have already asked back some technical questions to your interviewer. Saying something like "Well, you asked me a bunch of technical questions, and now, do you mind if I ask you some? If I am going to join your company, we will work closely together and I want to make sure my I respect the skills of my coworkers like they respect mine...". Doesn't it sound arrogant? I am curious to have your opinion or experience (as the interviewee or the interviewer, of course). P.S: throwaway account as I dont want that people who know me know I am preparing interviews.


title: How can I motivate management to allow freelance work?

text: I'm a developer at a small company. Sometimes I'm offered extra cash for freelance work from previous employers or on odd jobs that I could do after hours without encroaching on my full time job in any way. Unfortunately my manager has explicitly forbidden me from working on any side projects. The reason he says is that if I have any free time at all in my life, even on weekends, they should be spent working for his company. My argument is that my weekends are my time, so I should be able to do what I want. Secondly, I'd broaden my skills with a variety of different problems I wouldn't otherwise see, rather than just staring at the same project all year long. It would actually make me a more experienced programmer and help my full time job. Everyone else seems to be doing freelance work on the side and making extra cash, but I don't want to rat them out. What other motivation could I use to help my boss see that it's not such a bad thing?


title: Why can Perforce be a better version control system?

text: I've seen some people love and some loathe Perforce. As users or administrators with experience with other version control systems (free cookie to the ones with DVCS experience [git, Mercurial]), what is the main reason/feature that makes you love Perforce over other version control systems? **Edit** : No, I don't sell Perforce... this is just part of my ongoing research to pitch DVCS at my company (see my question history)


title: Interview question: How would you implement Google Search?

text: Supposed you were asked in an interview "How would you implement Google Search?" How would you answer such a question? There might be resources out there that explain how some pieces in Google are implemented (BigTable, MapReduce, PageRank, ...), but that doesn't exactly fit in an interview. What overall architecture would you use, and how would you explain this in a 15-30 minute time span? I would start with explaining how to build a search engine that handles ~ 100k documents, then expand this via sharding to around 50M docs, then perhaps another architectural/technical leap. This is the 20,000 feet view. What I'd like is the details - how you would actually answer that in an interview. Which data structures would you use. What services/machines is your architecture composed of. What would a typical query latency be? What about failover / split brain issues? Etc...


title: Deleting Content from Service

text: I'm not quite sure what the real practice is in the programming community. But when a user deletes content from your service (ie. deleting a status update, a photo of theirs, a comment they made). Should I actually delete them from my server or just hide it? The reason why I am asking this is because we live in a age where the services we build are data hungry. The data is the most valuable aspect of the service you build and keeping everything that comes in is vital. What is the general practice for these type of situations? What are your recommendations?


title: SOLID Application Structure and Design

text: A one possible structure for an application is to have it broken down into modules such as Data Access, Core, Services, UI. Now depending on what type of ORM you are using Data Access layer will have a set of entities that represent the tables in the database. The core layer will have a set of entities that represent the business logic. The service layer will have a set of DTO entities that it will communicate with to the UI. And finally the UI will have a set of View Models that it will use inside the views. Now when we access or store information in the database we have to transform objects from one type to another. When the service calls the core it needs to transform objects from one type to another and finally the UI needs to transform the DTO's to View Models. In a lot of the cases the transformation is a simple act of copying the properties from one object to another. It is a very repetitive and time consuming task that generates large amounts of code. My question is am I doing something wrong here. Should I only have one entity type? If so don't you think that it would have too much information in one object for data access, business logic etc... Is there a quick way to copy the properties between objects? Reflection is an option but gets complicated fast when dealing with object graphs? I know there is no silver bullet to fix this problem but there must be a number of good approaches over copying the properties by hand between the entities?


title: New job gitters?

text: I accepted a new job offer recently as a programmer. I get there on the first day and people are non engaging and didn't really smile. By the end of the first week they reviewed my code and tore it apart, and one of the devs said that they are going to try to mentor me to code better. The description for the position was recent experience in current frameworks but nothing on there about what I would be doing half of the time which would be supporting an older system one minute and bleeding edge the next. I can tell that there is going to be a high probability that I may butt heads with at least one person, since they tend to think that performance is the only thing for code and that should be obvious to everyone. If the code is not acceptable to this person, it doesn't go out( at least that's the impression that I got when I saw their code reviews). One dev told me that the project she was working on was complicated to change and that she wouldn't have done it that way. I come from a background of develop it fast, Refactor to the language standard when its practical to the timeline, but most importantly get it out the door without it breaking. Here its about coding in the fewest lines possible, most efficient code in addition to just getting it done(taking the hill). What do you folks think about this? 1.) Have any of you encountered/worked in a position like this before? 2.)Are there diminishing returns to having to be a jack of all trades, supporting old and developing the bleeding edge?


title: Python multithreading and utilizing modern processors - what is the downside?

text: > CPython implementation detail: In CPython, due to the Global Interpreter > Lock, only one thread can execute Python code at once (even though certain > performance-oriented libraries might overcome this limitation). If you want > your application to make better use of the computational resources of multi- > core machines, you are advised to use multiprocessing. However, threading is > still an appropriate model if you want to run multiple I/O-bound tasks > simultaneously.   >  -> threading > > multiprocessing is a package that supports spawning processes using an API > similar to the threading module.   >  -> multiprocessing All modern PC processors are multicore. What are the downsides to spawning new processes, instead of threads? If they are not significant enough, why does the threading module even exist?


title: Fastest C++ XML parsing library

text: I have thousands of .xml files from size 1MB-45MB (no DTDs). I need to parse and further manipulate these XML files before generating separate .xml files with the results of my regex. What the fastest open-source XML parsing library for C++? Aside from the parsing library, what other approaches can I use to speed up XML parsing?


title: Python Multiprocessing with Queue vs ZeroMQ IPC

text: I am busy writing a Python application using ZeroMQ and implementing a variation of the Majordomo pattern as described in the ZGuide. I have a broker as an intermediary between a set of workers and clients. I want to do some extensive logging for every request that comes in, but I do not want the broker to waste time doing that. The broker should pass that logging request to something else. I have thought of two ways :-   1. Create workers that are only for logging and use the ZeroMQ IPC transport   2. Use Multiprocessing with a Queue I am not sure which one is better or faster for that matter. The first option does allow me to use the current worker base classes that I already use for normal workers, but the second option seems quicker to implement. I would like some advice or comments on the above or possibly a different solution.


title: Merge sign up with Twitter and Facebook

text: I want to have sign up/login functionality on my site with a "Login with Facebook" and "Login with Twitter" button. Considering the following scenario:   * User A logs in with Twitter.    * Account gets created.   * User A logs out.   * User A comes back next week and can't remember what they signed up with (or just feels like) using Facebook login this time. How can you combine these accounts? So far there's 2 options I can think of:-   * Cookie (Not reliable)   * Have a 'login' and 'signup' action. So if they 'login' with Facebook it will say "You never signed up for this site with Facebook. Did you maybe use Twitter?" (But maybe they will 'signup' with Facebook then and then I still have no connection with the previous twitter account)


title: Open Source Project all dressed up but nowhere to go

text: Over the past 2 years myself and a colleague have built an online statistical analysis application using a mixture of silverlight, wcf and R. I (a c# programmer) wrote all the silverlight and wcf stuff whilst my colleague (a statistician) came up with the stats algorithms and wrote the R code. Now we think that this app is fairly unique - a rich gui online statistics application that is much more intuitive than all the other online stat apps that I've seen. But despite this we don't really know where to go with the project, mainly for the following reasons: 1) Its fairly complicated stuff - without the mix of programming and stats skills it would be difficult for anyone to "get into" the project and contribute. 2) We are stalled by a lack of a proper place to host the site. Currently it sits on the family windows 7 media centre, not exactly the best place to host it as it could interfere with the missus trying to watch Corrie/Friends/Oprah etc. Soo, anyone got any ideas on how to move forward with this? I guess that my strength is programming not marketing so despite working hard at this for the past couple of years I feel that I've reached a dead end! Also, does anyone know of any free windows hosting for open source projects? If I could find a proper place to put the app I might feel re-energised about the whole thing. The source code is on codeplex at: http://silverstats.codeplex.com, whilst the app is currently hosted at http://silverstats.co.uk Edit: to answer some of the points raised: I don't have any documentation so that is a valid point and something that I need to look at. However, I do believe that it is easy to use - try it yourself! It is drag and drop based and fairly intuitive (as long you have some stats knowledge). One point though: Its not aimed at statistians! Its aimed at people who need to do stats to do their job (which is why it is easy to use). Personally on an ease of use basis it beats the like of Rcmdr hands down! You are quite right that the R and stats geeks will continue to tap away at R and SAS and produce their scripts. So, to answer another question: Is it scriptable - of course not because that would defeat the ease of use concept, you might as well fire up R and tap away... Does it produce graphics: yep - output is nice and clean in html with some expalantory text for the people scared by stats. Is it validated, yes and no...the project is a spin off from our closed source (but free!) stats package called InVivoStat (google it) which was built with the same aim: to make statistics easy for non-statisticians, in this case scientists working in the life sciences. The R scripts that InVivoStat uses are fully GxP validated with evidence hosted on the InVivoStat website. This project (SilveR) uses the same scripts, so you could argue that a bit of revalidation is required as the interface has changed, but I am fully confident that the R scripts are correct.


title: Behaviour driven development IRL

text: Did any of you use behavior driven development in your projects? The concept and tools for it sound great. But was it easy to introduce and then stick to it? Did it lead to significant and visible positive results?


title: best way to "introduce" OOP/OOD to team of experienced C++ engineers

text: I am looking for an efficient way, that also doesn't come off as an insult, to introduce OOP concepts to existing team members? My teammates are not new to OO languages. We've been doing C++/C# for a long time so technology itself is familiar. However, I look around and without major infusion of effort (mostly in the form of code reviews), it seems what we are producing is C code that happens to be inside classes. There's almost no use of single responsibility principle, abstractions or attempts to minimize coupling, just to name a few. I've seen classes that don't have a constructor but get memset to 0 every time they are instantiated. But every time I bring up OOP, everyone always nods and makes it seem like they know exactly what I'm talking about. Knowing the concepts is good, but we (some more than others) seem to have very hard time applying them when it comes to delivering actual work. Code reviews have been very helpful but the problem with code reviews is that they only occur after the fact so to some it seems we end up rewriting (it's mostly refactoring, but still takes lots of time) code that was just written. Also code reviews only give feedback to an individual engineer, not the entire team. I am toying with the idea of doing a presentation (or a series) and try to bring up OOP again along with some examples of existing code that could've been written better and could be refactored. I could use some really old projects that no one owns anymore so at least that part shouldn't be a sensitive issue. However, will this work? As I said most people have done C++ for a long time so my guess is that a) they'll sit there thinking why I'm telling them stuff they already know or b) they might actually take it as an insult because I'm telling them they don't know how to do the job they've been doing for years if not decades. Is there another approach which would reach broader audience than a code review would, but at the same time wouldn't feel like a punishment lecture? I'm not a fresh kid out of college who has utopian ideals of perfectly designed code and I don't expect that from anyone. The reason I'm writing this is because I just did a review of a person who actually had decent high-level design on paper. However if you picture classes: A -> B -> C -> D, in the code B, C and D all implement almost the same public interface and B/C have one liner functions so that top-most class A is doing absolutely all the work (down to memory management, string parsing, setup negotiations...) primarily in 4 mongo methods and, for all intents and purposes, calls almost directly into D. **Update:** I'm a tech lead(6 months in this role) and do have full support of the group manager. We are working on a very mature product and maintenance costs are definitely letting themselves be known.


title: Is that possible to learn Python by building meaningful applications and skip reading heavy books?

text: I'm planning to learn **Python**. I know html, javascript, vb .net, ado .net, ms sql, and a little c#. So I have a good working knowledge of programming and capable to write various desktop and web applications. Previously I learn those languages by reading books from page 1 to the end. Then build meaningful applications. Typically I will use Wrox beginning or Sam Unleashed books. And each of those books will exceed 900++ pages. I feel this way of learning a programming language is slow and tiresome. So, this time for learning python language, my intent is to do it another way. I plan not to read book from cover to cover, but just using a few online introduction to Python tutorials. I want to build meaningful applications straight away from minimal knowledge of python and struggle all the ways to the application completion. Of course, I will consult SO and other sites to solve my python problems. Is that way of learning python viable or I should stick with reading books from cover to cover before building any meaningful application? Meaningful applications here mean real world applications like ecommerce site, blog, image converter (desktop app), password manager (desktop app), Invoicing system (desktop app), and media player (desktop app). For your information, I have created those meaningful applications in vb .net.


title: How do you approach class design in OOPs?

text: When I try to design an OO solution ,I generally use the CRC modelling wherein I list the class names (nouns), what they do(verbs) and how they collaborate with other classes. This blog has the below thing to say about this noun-verb approach                  ...This approach, which I will call “noun and verb,” is so limited         I’ll dare to call it brain damaged....      My question is, does a better modelling technique exist to use OO approach?


title: Choose code design effort or laziness in Bank world

text: I've worked for two years in a great Investment Bank. I made some technical projects with the desire of creating code the most optimized, respecting the adapted good design patterns, SOLID principle, law of demeter and avoiding all sorts of duplicate codes ... When delivery in production => zero bugs, all has happened as expected. But, a majority of developers came to me in order to precise that all my code is too complex for reading comprehension. I listened for instance : "make some if and instanceof, forget polymorphism so that it will be very easily to correct emergency production bugs". I didn't prefer to answer ...... Knowing these developers are not curious at all, refusing efforts to understand a good design (for instance, 90% of developers don't know what is a Strategy Pattern and make procedural code and never oo-design because they want, they said, simplicity), my project managers told me that I am really in the wrong way and too idealist for the Bank world. What would you advise me ? Should I keep desire of really good code or adapt me to majority of developers who are, I repeat it, really not interesting by design code that is according to me, all the beauty of our developer job. Or in the contrary, should they learn basic OO principles and best-practices to adapt themselves to my code ?


title: Is issue (bug and feature) count a good measure of a project?

text: One of the projects I work on is measured by number of issues. Management has given arbitrary (as far as I can tell) measurements that we need to have no more than X number of bugs and Y number of features in our issue tracking system. This seems like a misguided approach, but I can't seem to find any writings on the subject.


title: Can a team that uses Scrum achieve Co-Dev and domain expertise if it handles many SW domains?

text: I've worked in a team that developed and gave support for SW practices tools. Those tools were written (and will be written) in many programming languages. According to Scrum, a given story, **can be implemented by several team members** (according to what I know). When organized in a team that is oriented to a specific SW domain/framework (.NET for example), this seems possible and even reasonable. But if your team needs to write in _Python, C#, Java etc._ for several tools, some with different orientation (DB/UI), is this possible? How does the "division of labor" should be made in this case? Thanks.


title: Choosing a restrictive license to be in compliance, but not enforcing it

text: I'm very curious about this: Lets say that you have to use the GPL in your library because some dependency uses it or (if your library is fork) the upstream library uses GPL. Now GPL doesn't play well with a couple of important open source licenses which means that some users simply can't use your librar because of licensing issues, which doesn't help anybody An option that I've been toying with is still using GPL to maintain dependency compatibility but telling users that I will not enforce it against open source software or (if that's way too broad) software that uses open source but not completable licenses like Apache, MPL, CC, etc. Would there be any legal ramifications of doing this? Would this put my users at legal risk?


title: How do I architect 2 plugins that share a common component?

text: I have an object that takes in data and spits out a transformed output, called `IBaseItem`. I also have two parsers, `IParserA` and `IParserB`. These parsers transform external data (in format dataA and dataB respectively) to a format usable by my `IBaseItem` (baseData). I want to create 2 systems, one that works with dataA and one that works with dataB. They will allow the user to enter data and match it to the right plugins/implementations and transform the data to outData. I want to write these traffic cops myself, but have other people provide the parsers and baseitem logic, and and as such am implementing these items as plugins (hence the use of interfaces). Other programmers can choose to implement 1 or both parsers. **Q:** How should I structure the way base items and parsers are associated, stored, and loaded into each of my programs? _Class Relations:_ ![enter image description here](http://i.stack.imgur.com/w9adn.png) **What I've Tried:** Initially I though there should be a different dll for each of my 2 traffic cops, that each have a parser and baseitem in them. However, the duplication of baseitem logic doesn't seem right (especially if the base item logic changes). I then thought the base items could all have their own dll, and then somehow associate parsers and baseitems (guids?), but I don't know if implementing the overhead id/association is adding too much complexion.


Hello   What's a good methodology for a small 2-person project? Ranges from 20-40hr.   It's mostly small websites. I want to approach it as a developer, but Agile and other methodologies seems too large scale for what I'm after.   Thanks


title: unit tests for a csv parser

text: What tests should I use to unit test a csv parser? I have a simple csv parser in C#, and I want to be sure I have good unit test coverage of all the common (and uncommon) edge cases. What tests should I use to identify potential problems and boundary cases?


title: New "delay" keyword for JavaScript

text: I had a great idea for a new javascript keyword "delay", but I don't know what I can do to bring it to the new specification. Also I want to know what you guys think about it and if it's even realistic. ## What does the `delay` keyword ? The `delay` keyword does nothing more than stop the execution of the current stack and immediately continues to the next "job" in the queue. But that's not all! Instead of discarding the stack, it adds it to the end of the queue. After all "jobs" before it are done, the stack continues to execute. ## What is it good for? `delay` could help make blocking code non-blocking while it still looks like synchronous code. A short example:               setTimeout(function(){         console.log("two");     },0);     console.log("one");     delay; //since there is currently another task in the queue, do this task first before continuing     console.log("three");          //Outputs: one, two, three      This simple keyword would allow us to create a synchronous-looking code wich is asynchronous behind the scenes. Using node.js modules, for example, would no longer be impossible to use in the browser without trickery. There would be so many possibilites with such a keyword! Is this pattern useful? What can I do to bring this into the new ECMAscript specification? Note: I asked this previously on Stack Overflow, where it was closed.


title: Requirements/issue tracker similar to online spreadsheet

text: Is there a requirements/issue tracker software which is similar to Google spreadsheet? We have Fogbugz but I find it more heavyweight and slow than a simple spreadsheet. Is there a Fogbugz alternative which is - fast - can show issues/requirements as a spreadsheet (at) and allows in-place editing - supports tree structures (where issue can have child issues)? It is required for a small project. There will be 2 developers and 1-2 other users. I guess that only one user will be actively maintaining it. UPDATE I do not say that a spreadsheet is better than Fogbugz or similar tools. In fact I am looking for a tool which is similar to Fogbugz and could replace a spreadsheet, but faster than Fogbugz and has an additional feature (table-like mode). I'd like to find a tool which can operate in a mode which looks like a table (one row per issue) but has a rich set features (similar to Fogbugs and JIRA). I find Fogbugz (and similar tools) inconvenient because I must enter the web form in order to edit anything. In-place editing (when issues are shown as a table) would be much faster.


title: Adding unit tests to a legacy, plain C project

text: The title says it all. My company is reusing a legacy firmware project for a microcontroller device, written completely in plain C. There are parts which are obviously wrong and need changing, and coming from a C#/TDD background I don't like the idea of randomly refactoring stuff with no tests to assure us that functionality remains unchanged. Also, I've seen that hard to find bugs were introduced in many occasions through slightest changes (which is something which I believe would be fixed if regression testing was used). A lot of care needs to be taken to avoid these mistakes: it's hard to track a bunch of globals around the code. To summarize:   * How do you add unit tests to existing tightly coupled code before refactoring?   * What tools do you recommend? (less important, but still nice to know) I am not directly involved in writing this code (my responsibility is an app which will interact with the device in various ways), but it would be bad if good programming principles were left behind if there was a chance they could be used.


title: Facebook App EULA & Restrictions: What can't they do that my web app can?

text: I have written a nifty little web app (in Java/GWT/JS) and have been experimenting with the idea of making it available through Facebook as a Facebook App as well. After spending some time reading Facebook's developer docs, it seems like I can just create a Facebook App to point at any URL I want and use that as the app/canvas. It accomplishes this via `iframe`s. **So, my tentative plan is to just point it towards my (existing) web app so that I don't have to totally re-write it.** But then that got me thinking: Facebook **must** regulate what sorts of things _can_ be done through a Facebook App, vs. what an app _can't_ do. For instance, I can't imagine I can point a Facebook App to point at a URL for a web app that accepts e-commerce payments (that would by-pass Facebook altogether and not allow them to take a cut from the ecom transaction!). Also, I can't imagine that Facebook allows developers to point their Facebook Apps to _just any old URL_ without some sort of a scan, otherwise that would open Facebook up to the horrors of every security threat knownst to humanity. I know for a fact that when you write an iOS native app and put it up on the Apple App Store, that Apple actually scans your source code for violations of their EULA. So my question: **does Facebook do the same?** If so, what are their terms & conditions for what a Facebook app can/can't do? Suprisingly, I can't find this anywhere!! Thanks in advance!


title: How to make this design closer to proper DDD?

text: I've read about DDD for days now and need help with this sample design. All the rules of DDD make me very confused to how I'm supposed to build anything at all when domain objects are not allowed to show methods to the application layer; where else to orchestrate behaviour? Repositories are not allowed to be injected into entities and entities themselves must thus work on state. Then an entity needs to know something else from the domain, but other entity objects are not allowed to be injected either? Some of these things makes sense to me but some don't. I've yet to find good examples of how to build a whole feature as every example is about Orders and Products, repeating the other examples over and over. I learn best by reading examples and have tried to build a feature using the information I've gained about DDD this far. I need your help to point out what I do wrong and how to fix it, most preferably with code as "I would not recomment doing X and Y" is very hard to understand in a context where everything is just vaguely defined already. If I can't inject an entity into another it would be easier to see how to do it properly. In my example there are users and moderators. A moderator can ban users, but with a business rule: only 3 per day. I did an attempt at setting up a class diagram to show the relationships (code below): ![enter image description here](http://i.stack.imgur.com/lVonP.png)               interface iUser     {         public function getUserId();         public function getUsername();     }          class User implements iUser     {         protected $_id;         protected $_username;              public function __construct(UserId $user_id, Username $username)         {             $this->_id          = $user_id;             $this->_username    = $username;         }              public function getUserId()         {             return $this->_id;         }              public function getUsername()         {             return $this->_username;         }     }          class Moderator extends User     {         protected $_ban_count;         protected $_last_ban_date;              public function __construct(UserBanCount $ban_count, SimpleDate $last_ban_date)         {             $this->_ban_count       = $ban_count;             $this->_last_ban_date   = $last_ban_date;         }              public function banUser(iUser &$user, iBannedUser &$banned_user)         {             if (! $this->_isAllowedToBan()) {                 throw new DomainException('You are not allowed to ban more users today.');             }                  if (date('d.m.Y') != $this->_last_ban_date->getValue()) {                 $this->_ban_count = 0;             }                  $this->_ban_count++;                  $date_banned        = date('d.m.Y');             $expiration_date    = date('d.m.Y', strtotime('+1 week'));                  $banned_user->add($user->getUserId(), new SimpleDate($date_banned), new SimpleDate($expiration_date));         }              protected function _isAllowedToBan()         {             if ($this->_ban_count >= 3 AND date('d.m.Y') == $this->_last_ban_date->getValue()) {                 return false;             }                  return true;         }     }          interface iBannedUser     {         public function add(UserId $user_id, SimpleDate $date_banned, SimpleDate $expiration_date);         public function remove();     }          class BannedUser implements iBannedUser     {         protected $_user_id;         protected $_date_banned;         protected $_expiration_date;              public function __construct(UserId $user_id, SimpleDate $date_banned, SimpleDate $expiration_date)         {             $this->_user_id         = $user_id;             $this->_date_banned     = $date_banned;             $this->_expiration_date = $expiration_date;         }              public function add(UserId $user_id, SimpleDate $date_banned, SimpleDate $expiration_date)         {             $this->_user_id         = $user_id;             $this->_date_banned     = $date_banned;             $this->_expiration_date = $expiration_date;         }              public function remove()         {             $this->_user_id         = '';             $this->_date_banned     = '';             $this->_expiration_date = '';         }     }          // Gathers objects     $user_repo = new UserRepository();     $evil_user = $user_repo->findById(123);          $moderator_repo = new ModeratorRepository();     $moderator = $moderator_repo->findById(1337);          $banned_user_factory = new BannedUserFactory();     $banned_user = $banned_user_factory->build();          // Performs ban     $moderator->banUser($evil_user, $banned_user);          // Saves objects to database     $user_repo->store($evil_user);     $moderator_repo->store($moderator);          $banned_user_repo = new BannedUserRepository();     $banned_user_repo->store($banned_user);      Should the User entitity have a `'is_banned'` field which can be checked with `$user->isBanned();`? How to remove a ban? I have no idea.


title: Why is bitbucket popular in eastern europe?

text: I was looking at google trends for bitbucket and github, and it seems bitbucket leads github in Romania, Bulgaria, and Latvia. Why is this so? Are there any historical reasons for this?