title: Testing in procedural programming code

text: I have designed and implemented, for my final year in college, an autonomous robot with Arduino board microcontroller. The robot wanders around an area, avoids obstacles and tries to detect intruders. I have to do some testing for this project . Could anyone help me by telling what test procedures I can perform in procedural code? Observation of the behavior of robot could be one of them?               Servo servoLeft;          // Define left servo     Servo servoRight;         // Define right servo     const int trigPin = 5;     const int echoPin = 2;     int buzzerPin = 6;               // choose the pin for the LED //buzzer     int inputPin = 9;              // choose the input pin (for PIR sensor)          int val = 0;       Timer t;     boolean pirSense = false;     long xronos=0;          void setup() {      Serial.begin(9600);      servoLeft.attach(4);      // Set left servo to digital pin 10      servoRight.attach(3);     // Set right servo to digital pin 9           pinMode(buzzerPin, OUTPUT);      // declare LED as output      pinMode(inputPin, INPUT);     // declare sensor as input           pinMode(trigPin, OUTPUT);      pinMode(echoPin, INPUT);      t.every(30000,monitoring);       }             void loop() {         long duration, distance;       digitalWrite(trigPin, LOW);       delayMicroseconds(2);       digitalWrite(trigPin, HIGH);       delayMicroseconds(10);       digitalWrite(trigPin, LOW);       pinMode(echoPin, INPUT);       duration = pulseIn(echoPin, HIGH);       distance = microsecondsToCentimeters(duration);        delay(100);        Serial.println(distance);        if (distance >= 40){            moveForward();          }           else {              stopMove();         int x = random(0,2);           if(x == 0 ){          turnRight();              delay(500);        }        else{          turnLeft();                delay(500);        }       }      t.update();      }                void monitoring(){       xronos = now();      while( xronos+5 >now() ){       stopMove();      delay(1000);      pirSensor();      }          }                 // Motion routines for forward, reverse, turns, and stop       void reverse() {       servoLeft.write(0);      servoRight.write(180);       }           void moveForward() {      servoLeft.write(180);      servoRight.write(0);      }            void turnRight() {      servoLeft.write(180);      servoRight.write(180);       }      void turnLeft() {       servoLeft.write(0);       servoRight.write(0);       }           void stopMove() {      servoLeft.write(90);      servoRight.write(90);       }           long microsecondsToCentimeters(long microseconds)      {      // The speed of sound is 340 m/s or 29 microseconds per centimeter.      // The ping travels out and back, so to find the distance of the      // object we take half of the distance travelled.      return microseconds / 29 / 2;      }


title: Why do we need to write a header file?

text: Before you whip out your snarky comments, I know -- this is a nooby question. This is my first time using a C based language. I'm an undergrad student learning Objective C for a computer science course on mobile development. I know that, in an academic setting, a lot of real-world considerations aren't necessary since you're building smaller projects, work in smaller teams, etc. But our professor demands -- and XCode supports -- .h header files for every .m implementation file. To me, it kind of seems like busy work. I have to make sure I copy every method signature and instance variable over to the other file. If I change one file, I have to make sure it's consistent with the other file. It seems like just a bunch of small annoyances like that. But I know there has to be _some_ real-world use for header files. A great answer would address both:   1. What is a header file useful for that an implementation file isn't suited for? What is its purpose?   2. Why do we as programmers have to manually write our header files? It seems like they could easily be generated automatically. Thanks in advance!


title: How to test a localized WPF application in visual studio 2012

text: I am trying to create a localized application in C# / WPF in Visual Studio 2012. For that I created two resource files and changed one string in a (XAML) window to use the resource files (instead of a hardcoded string). I see the English text from the resource file, which is correct. However, I want to check if the other resource file (fr-FR) also works but I cannot find a setting or procedure how to change my 'project' to run in French. Thanks in advance.


title: Command Line Tool to generate a method usage report

text: Is there a command line tool (preferred) that'll generate a report of Java methods within a class and where they are used within a few project folders. Kind of how Netbeans does a "Find Usage" on open projects but as an automated approach. I have a utility class that contains lots of static methods, but I have no idea which ones are dead code [ignoring test case usages]


title: Integration of routes that are not resources in an MVC REST style application

text: I would like to keep my application relatively REST-pure for the sake of consistency, but I'm struggling philosophically with the relatively few views (maybe just one) that I'll need to build that don't relate to resources directly, and therefore do not fit into a REST style. As an example, take the home page. Ruby on rails seems to bail on their otherwise RESTful approach for this very basic need of all web sites. The home page appears special:   * You can get it, but a get at the resource level is supposed to give you a collection of elements. I can imagine this being the list of routes maybe, but that seems a stretch, and doesn't address anything else.   * Getting the home page by id doesn't seem to make a whole lot of sense - what's the element of a home collection? Again, maybe routes, but a get on a route would do what? Redirect? This feels odd.   * You can't delete it (arguably you could allow this for administrators)   * Adding a second one doesn't make sense except possibly if the elements were routes   * Updating it might make sense for administrators, but AFAIK REST doesn't describe updates on the resource directly, only elements of the resource (this article explicitly says "UNUSED" for PUTS on the resource) Is the "right" thing to do just to special case these types of things? At the end of the day, I can wrap my head around most of applications being gathered around resources...I can't think of another good example other than a home page, but since that's the start of an application, I think it warrants some thought.


What principles does your software engineering or development organization follow? I am very interested in seeing a list of principles from someone who works at a company where these principles are discussed, published, followed, etc. The closest I have seen to a principles-based engineering organization are companies which are agile and follow the agile principles. Here is a list of Marick's values/challenges: http://www.agilejourneyman.com/2010/02/4-challenges-and-5-guiding-values- of.html I am looking for pointers to more stuff like this. Ideally, I'd like to hear from people who have actually implemented a principles-based approach in their organization.


title: Using scoped enums for bit flags in C++

text: An `enum X : int` (C#) or `enum class X : int` (C++11) is a type that has a hidden inner field of `int` that can hold any value. In addition, a number of predefined constants of `X` are defined on the enum. It is possible to cast the enum to its integer value and vice versa. This is all true in both C# and C++11. In C# enums are not only used to hold individual values, but also to hold bitwise combinations of flags, as per Microsoft's recommendation. Such enums are (usually, but not necessarily) decorated with the `[Flags]` attribute. To make the lives of developers easier, the bitwise operators (OR, AND, etc...) are overloaded so that you can easily do something like this (C#):               void M(NumericType flags);          M(NumericType.Sign | NumericType.ZeroPadding);      I am an experienced C# developer, but have been programming C++ only for a couple of days now, and I am not known with the C++ conventions. I intend to use a C++11 enum in the exact same way as I was used to do in C#. In C++11 the bitwise operators on scoped enums are not overloaded, so I wanted to overload them. This solicited a debate, and opinions seem to vary between three options:   1. A variable of the enum type is used to hold the bit field, similar to C#:              void M(NumericType flags);          // With operator overloading:     M(NumericType::Sign | NumericType::ZeroPadding);          // Without operator overloading:     M(static_cast<NumericType>(static_cast<int>(NumericType::Sign) | static_cast<int>(NumericType::ZeroPadding)));      But this would counter the strongly typed enum philosophy of C++11's scoped enums.   2. Use a plain integer if you want to store a bitwise combination of enums:              void M(int flags);          M(static_cast<int>(NumericType::Sign) | static_cast<int>(NumericType::ZeroPadding));      But this would reduce everything to an `int`, leaving you with no clue as to which type you're supposed to put in the method.   3. Write a separate class that will overload operators and hold the bitwise flags in a hidden integer field:              class NumericTypeFlags {         unsigned flags_;     public:         NumericTypeFlags () : flags_(0) {}         NumericTypeFlags (NumericType t) : flags_(static_cast<unsigned>(t)) {}         //...define BITWISE test/set operations     };          void M(NumericTypeFlags flags);          M(NumericType::Sign | NumericType::ZeroPadding);      (full code by user315052) But then you have no IntelliSense or whatever support to hint you at the possible values. I know this is a subjective question, but: **What approach should I use? What approach, if any, is the most widely recognized in C++? What approach do you use when dealing with bit fields and _why_?** Of course since all three approaches work, I'm looking for factual and technical reasons, generally accepted conventions, and not simply personal preference. For example, because of my C# background I tend to go with approach 1 in C++. This has the added benefit that my development environment can hint me on the possible values, and with overloaded enum operators this is easy to write and understand, and quite clean. And the method signature shows clearly what kind of value it expects. But most people here disagree with me, probably for good reason.


title: Understanding the meaning of "multiple lifecycles application development"?

text: Some Agile job posts have a requirement "strong understanding of multiple lifecycles application development", what does it means ? So my question would be: what's that field for, and what would I need to learn, knowing that I got Java EE experience and Agile more than 2 years. Sorry if my question isn't constructed well, nor I putted some time searching the meaning :) my self, but all my research yielded job posts :D.


title: C# Multithreading Interview questions for a senior developer/designer position

text: I wonder what sort of interview questions were asked to a senior developer or technical consultant on multithreading. Kindly provide me some of the interview questions which were asked in the interview on multithreading if possible kindly put the scenario based questions with some theoretical questions. As I came to know after disscusion with some of the people that some time interviewer might give you a scenario and ask you to implement it? @ Kindly add the specific questions which you have ever faced or asked to the other person in the interview other than only mentioning the concepts because people go through the concepts and still find it difficult to handle the interview questions.so any effort to add the specific question could actually help person to get a head start for the d-day


title: Is unit testing procedural code effective?

text: On a current project, the powers that be want to have unit testing incorporated into our development cycle to avoid the constant amount of bugs that seem to seep into our code. The problem is that the spaghetti code is 95% percent procedural, which I've never done unit testing with (all my experience with unit testing has been with OOP code) So my question in a nutshell is would it be wise to proceed with unit testing with our current codebase, or suggest that it be postponed until the application has been migrated to a proper OOP framework? PS: While I tried to style this question as language agnostic, I feel that stating the application in question uses PHP and javascript will help provide more specific answers that could answer this question since from experience this occurrence occurs most with such applications.


title: Should I continue stressing development standards?

text: I've been with my software team for about three years now, and just recently I brought up the concept of variable naming conventions (across all languages, but C#/VB.Net specifically). We really don't have any solid naming conventions. I was met with serious resistance - so what?, does it really matter?, blank stares, etc. I was able to get the others to agree to at least be consistent on a given code file (not ideal, but with this group, any standards that is based around anything other than SQL is a step forward). My question is this - I've always received resistance to developing standards.   * Should I just stop pushing standards and accept the fact that everyone seems to be doing their own thing when they code?


title: Large Scale Application Development in Android

text: Since, I am fairly new to large scale app development in Android and Java, I though I would ask for your advice guys. My team was faced with developing a prototype of a fairly complex medical software. Although it is only a prototype, I think it might be a good opportunity to learn new platform and get into some good habits. Our design requirements are fairly simple: a set of common files: themes, styles, objects, static methods for database etc. and then a set of smaller "apps" like a: digital tests, games etc. Each one is fairly unique. Our initial thought was to create a set of smaller applications that will be lunched from "the main screen". Each application would be a separate project in Eclipse and then we would modify the build path to include the "common files". This way: each developer could work on their own projects without bothering others. The problems that I find with this approach:   1. Deploying the application (having a bunch of applications instead of one big one)   2. Testing the application    3. Use of strings to lunch another application i.e. worrying whether the application has been installed   4. Silly human errors e.g. modifying common files and forgetting to commit changes Another solution would be to create one big application/project with each developer working on a separate package which would represent each app. However, this introduces common resources (e.g. unique string names) etc. What's your advice? How to tackle this problem? Which one is better in the long run? Are there any other approaches that are more sensible?


title: How do developers deal with "where to start" problem in a context of overwhelming difficulties caused by too much heterogeneous information?

text: A friend of mine, a beginner PHP programmer, needs to link the product his company develops with a third-party product (a set of web services). He received the "relevant" documentation (a few hundred of pages of unreadable stuff) from this third-party, have read the PHP documentation related to SOAP client, have read about SOAP and WSDL, but **doesn't have a slightest idea where to start**. Instead of a step-by-step tutorial, he has lots of overly verbose documentation. I suggested him to use prototyping:   1. Imagine the most basic scenario where the third-party web services can be used,   2. Select the relevant documentation,   3. Build (from scratch) the simplest PHP script which will play this scenario,   4. Once the prototype works, integrate the functionality into the existing product,   5. Refactor,   6. Expand the existing product with additional features. While this may help pushing this person to the right direction, I feel that my suggestion is only partially helpful. I imagine myself six years ago knowing nothing about WSDL and SOAP and having to search inside hundreds of pages of documentation: I would be already discouraged at steps 2 and 3. Experienced developers have a bunch of patterns, practices and processes which help solving basic problems frequently encountered in software development:   * The technical aspects of a feature are uncertain? Use prototyping.   * The application "feels unresponsive"? Use profiling to find bottlenecks.   * The requirements are subject to frequent change? Use Agile.   * Programmers need to be sure their code doesn't contain omissions? Use code reviews.   * The successive versions of a product are not deployed fast enough? Use DevOps. While those patterns and practices help developers solving purely technical/organizational issues (such as "I know how to implement Web Sockets in Java, Python and Node.js, but now I need to do it in Haskell."), the same patterns and practices are not helpful for less experienced programmers who need to solve more substantial and less technical problems (such as "I believe Web Sockets are a sort of HTTP but it happens the other way, something like that; now lead developer asked me to implement that in my app, but I'm not sure why do we need it.") Inviting the programmer to spend three years in college or twelve months reading programming-related books is not always an option: some people need to work to pay their bills, need to finish the project for the next deadline, and are not paid to read books. So what are other options?


title: Is there a better way to update NoSQL records in bulk?

text: When we started our application we had the choice of going with the traditional MS-SQL normalized database or with a NoSQL database (RavenDB is what we tried out). Here is a simplified version of our schema:               <Order OrderNumber="1000" OrderVersion="1" ...>       <Products>         <Product Code="X58" Price="$5.50" Quantity="3" ... />         <Product Code="X70" Price="$9.99" Quantity="1" ... />       </Products>       <Contacts>         <Contact ... />         <Contact ... />       </Contacts>     </Order>      While we could have went with a MS-SQL database, we didn't because we wanted all of our data for an order to be kept historically; we did not want to FK the contact even if they had the same name and address because while it might change, the order should have the contact info at the **time of purchase**. Also, yes, we could have FK our Products instead of using the **Code** to reference the product, but Products never get deleted, and again... if they are updated we want to capture their information at the **time of purchase**. Basically, every Order seems to be a self-contained document that should never rely on FKs. OrderVersion is just to keep track of our process version when the order was created, we could easily just have used OrderDate to track versioning. * * * Anyways, so our decision was to go with RavenDB. We built out our application and website, and internally we are testing it out. The one scenario we are running into problems is: _"How do you do a bulk update on records as good as SQL does it?"_ For example, if we had just pushed our code to production during offline maintenance and somehow all records from MA with ZipCodes that have a leading zero (0) had the zero trimmed off (i.e. the zip code now read 1234 instead of 01234)? Normally, we would patch things immediately on one fail-over server at a time, and updating records would be easy:               UPDATE c     SET c.ZipCode = ...     FROM Contact c         INNER JOIN Order o ON c.OrderId = o.OrderId     WHERE o.Version = 1       AND ...      But, it seems that the best solution we could come up with if we use RavenDB is to get all documents, then programmatically update the records through a custom C# console app. It seems that TSQL is much easier/faster. I'm not sure if there is a better way that we are unaware of, or is this a common shortcoming of using RavenDB (or any NoSQL document store)? My biggest worry is, while our console app seemed to run just fine enough with a sample of 100K orders, what happens if we get to the point of 50M+ orders!? Or, is that also an issue with T-SQL that we would eventually run into with the example I gave?


title: Scheduling Thousands of *Recurring* Jobs

text: I'm looking for general approaches and ideally libraries/tools for scheduling many thousands of recurring jobs. A simple example is a feed aggregator, where I'd want to repeatedly poll thousands of feeds. I would never want to poll a website more than once an hour (overuses everyone's resources), but I could deal with polling websites less than once an hour if there isn't time to finish everything in an hour (and worry later about sharding the process or whatever to make it faster, if this keeps happening). So I'd basically want a framework where I can say "run this task as often as possible, but no more than once an hour". An additionally nice feature would be for such a framework to exponentially decay unsuccessful tasks, i.e. if a feed URL was broken, it would be scheduled for 2 hours, then 4 hours, etc. I've heard of an approach involving a binary tree which acts as a kind of giant cronjob-like data structure. The system would constantly trawl through this tree to see if any tasks are overdue. I don't have much more information than this. I've looked at tools like Resque, but they don't really seem to cover this use case.


title: Non-trivial functions that operate on any monad

text: I'm looking for examples of interesting methods that take an arbitrary monad and do something useful with it. Monads are extremely general, so methods that operate on monads are widely applicable. On the other hand, methods I know of that can apply to any monad tend to be... really, really trivial. Barely worth extracting into a function. Here's a really boring example: `joinTwice`. It just flattens an `m m m t` into an `m t`:               join n = n >>= id     joinTwice n = (join . join) n          main = print (joinTwice [[[1],[2, 3]], [[4]]])     -- prints [1,2,3,4]      The only non-trivial method for monads that I know of is `bindFold` (see my answer below). Are there more?


title: How to overcome network latency when using data as a service like Cloudant?

text: I just can't understand, no matter how good and scalable of Cloudant (data as a service), how one can overcome network latency issue? Even the data center is located within the same country, 100ms is way too slow compare to a local network. Any thoughts?


title: How can I create a software patcher for OS X?

text: I'm building some software for OS X that isn't distributed through the Mac App Store. My software allows users to download different modules uploaded by various people too. How can I create a software patcher to patch my software, as well as update modules that users might be uploading when necessary? I've looked a bit into diff and patch, which come with OS X but they seem to be largely for plaintext. Any ideas? I've been googling but I'm a bit stumped which is surprising since software patching seems to be in most applications.


title: CI tests to enforce specific development rules - good practice?

text: The following is all purely hypothetical and any particular portion of it may or may not accurately describe real persons or situations, whether living, dead or just pretending. Let's say I'm a senior dev or architect in charge of a dev team working on a project. This project includes a security library for user authentication/authorization of the application under development. The library must be available for developers to edit; however, I wish to "trust but verify" that coders are not doing things that could compromise the security of the finished system, and because this isn't my only responsibility I want it to be done in an automated way. As one example, let's say I have an interface that represents a user which has been authenticated by the system's security library. The interface exposes basic user info and a list of things the user is authorized to do (so that the client app doesn't have to keep asking the server "can I do this?"), all in an immutable fashion of course. There is only one implementation of this interface in production code, and for the purposes of this post we can say that all appropriate measures have been taken to ensure that this implementation can only be used by the one part of our code that needs to be able to create concretions of the interface. The coders have been instructed that this interface and its implementation are sacrosanct and any changes must go through me. However, those are just words; the security library's source is open for editing by necessity. Any of my devs could decide that this secured, private, hash-checked implementation needs to be public so that they could do X, or alternately they could create their own implementation of this public interface in a different library, exposing the hashing algorithm that provides the secure checksum, in order to do Y. I may not be made aware of these changes so that I can beat the developer over the head for it. An attacker could then find these little nuggets in an unobfuscated library of the compiled product, and exploit it to provide fake users and/or falsely-elevated administrative permissions, bypassing the entire security system. This possibility keeps me awake for a couple of nights, and then I create an automated test that reflectively checks the codebase for types deriving from the interface, and fails if it finds any that are not exactly what and where I expect them to be. I compile this test into a project under a separate folder of the VCS that only I have rights to commit to, have CI compile it as an external library of the main project, and set it up to run as part of the CI test suite for user commits. Now, I have an automated test under my complete control that will tell me (and everyone else) if the number of implementations increases without my involvement, or an implementation that I did know about has anything new added or has its modifiers or those of its members changed. I can then investigate further, and regain the opportunity to beat developers over the head as necessary. Is this considered "reasonable" to want to do in situations like this? Am I going to be seen in a negative light for going behind my devs' backs to ensure they aren't doing something they shouldn't?


title: As a tooling/automation developer, can I be making better use of OOP?

text: My time as a developer (~8 yrs) has been spent creating tooling/automation of one sort or another. The tools I develop usually interface with one or more API's. These API's could be win32, WMI, VMWare, a help-desk application, LDAP, you get the picture. The apps I develop could be just to pull back data and store/report. It could be to provision groups of VM's to create live like mock environments, update a trouble ticket etc. I've been developing in .Net and I'm currently reading into design patterns and trying to think about how I can improve my skills to make better use of and increase my understanding of OOP. For example, I've never used an interface of my own making in anger (which is probably not a good thing), because I honestly cannot identify where using one would benefit later on when modifying my code. My classes are usually very specific and I don't create similar classes with similar properties/methods which could use a common interface (like perhaps a car dealership or shop application might). I generally use an n-tier approach to my apps, having a presentation layer, a business logic/manager layer which interfaces with layer(s) that make calls to the API's I'm working with. My business entities are always just method-less container objects, which I populate with data and pass back and forth between my API interfacing layer using static methods to proxy/validate between the front and the back end. My code by nature of my work, has few common components, at least from what I can see. So I'm struggling to see how I can better make use of OOP design and perhaps reusable patterns. Am I right to be concerned that I could be being smarter about how I work, or is what I'm doing now right for my line of work? Or, am I missing something fundamental in OOP? **EDIT:** Here is some basic code to show how my mgr and api facing layers work. I use static classes as they do not persist any data, only facilitate moving it between layers.               public static class MgrClass     {         public static bool PowerOnVM(string VMName)         {             // Perform logic to validate or apply biz logic             // call APIClass to do the work             return APIClass.PowerOnVM(VMName);         }     }          public static class APIClass     {         public static bool PowerOnVM(string VMName)         {             // Calls to 3rd party API to power on a virtual machine             // returns true or false if was successful for example         }     }


title: Variable names: underscores, no underscores, or camel case?

text: Variable names can be written in many ways, but the most common that I'm familiar with are:   * thisisavariable,   * this_is_a_variable, and   * thisIsAVariable. Which of these are preferred, and why?


title: C# dynamics and Expando object

text: Under which application development scenarios C# dynamics and ExpandoObject can be used or when to consider using c# dynamics and ExpandoObject


title: CMS updates into subversion -> review process

text: We manage a range of client sites built in Wordpress and Joomla and these require regular updates to the core CMS and extensions. We keep these sites in subversion and place updates in subversion. We try to use a single revision for this. We face some difficulties in making this process efficient, over time we would like to automate it, so we can offer the process on a fixed price basis The process is currently as follows   1. make copy of whole folder   2. svn status |grep '^!' |sed 's/^!\s*/svn delete "/g' |sed 's/$/"/g' |sh   3. svn update   4. svn status |grep '^?' |sed 's/^?\s*/svn add "/g' |sed 's/$/"/g' |sh   5. svn ci -m "Commit message"   6. svn remove -m"temporarily remove" http://subversion.repository.com/svn/automatem/projects/client/trunk/project/foldername Steps 5-6 are usually repeated multiple times. What I'm looking for help with   * we are using subversion version 1.6 and 1.7, because there are no .svn folders in 1.7 in subdirectories, I wonder if the process is much easier on 1.7?   * we've added step 3 because it reduces the number of repeats in steps 5-6. However this was just trial and error and I can't quite get my head around why this is   * As I understand it, the issue in step 5-6 is that when the an extension is updated, it may delete a whole folder and then re-insert that folder with changed files. In subversion 1.6, this would remove the .svn folder, which causes a 405 Access denied error (the folder gets added, but already exists in svn). What I would need is something that inserts all .svn folders back into my working copy if the folder already exists in svn. Is there a way to accomplish this?   * Any other improvements of course appreciated.


title: What is the most cross-browser/system compatible option for 3d graphics on a web page?

text: I would like to develop a bit of functionality for a web site that involves a bit of 3D - the user can move around objects, rotate them and texture them. So far I've looked into:   * WebGL (in particular three.js) and it looks great, but it's not supported in IE nor IOS.   * IOS supports the `<canvas>` tag, but only 2d. It looks like three.js has an unsupported hack to make a 3d thing use the 2d canvas instead without textures, but this looks like a hack.   * I also considered resorting to Flash which works on most browsers, but that won't work on IOS.  What's my best option for doing 3d web graphics on the vast array of browsers and interfaces? At the moment I'm thinking WebGL for web (and ask people to use chrome or firefox, and take the hit on IE) and then maybe write a native app for IOS, but I am not sure if there are better alternatives available that I don't know of.


title: How does if/else work internally in all programming languages?

text: if(true/false){          //if condition is true      }else {          // if condition is false     }      Everyone knows about the structure of `if-else`. But what is `if` actually? Is it a class method, static method or keyword? I'm little confused about this.


title: Any good resource on running a service software company?

text: A service software company is like an outsource company. You give us the requirements, we band the result for you. This is a unique situation where each project is short lived and vastly different from one to another. I'm interested to learn if anybody is successful in running this kind of company and any good resource of setups like this. Thank you!


title: WHat are the benefits of placing the concatenation character at the end or beginning of a line

text: Considering multiple lines of say SQL query strings:               $sql = "select * from table ".     "where a=5";      What do you think are the benefits and downsides of putting the concatenation character at the end or beginning of the line? This is to revise a coding guidelines document, we have 2 people here that "feel" it should be either way


title: What makes a good developer / system documentation?

text: Much time is wasted to get new developers started with existing software systems, because there is no good documenation. But what makes a system documentation good? One thing is a good API documentation like the Java API doc, but how to transfer the "bigger picture" and other things that cannot be placed in the API doc? One constraint is that it should not be to hard and time consuming to write the docs, because that is one reason why it is omitted so often. So, what makes documentation good?


title: Debugging: understanding details on why certain fixes worked?

text: When debugging, I sometimes find that I make some changes and I am not 100% sure why those changes correct some bug in the program. Is it essential to understand every single detail about why some bugs were occurring and why certain changes eliminated those bugs? Or is it common among developers to sometimes get the program working without really knowing the details about why the fix worked?


title: Why would it take hours to decode transmissions from Curiosity rover via MRO?

text: This video clip by NASA says that data from Curiosity relayed by the Mars Reconnaissance Orbiter (MRO) would be stored for a few hours, then transmitted to Earth (apparently taking about 14 minutes), after which it would take _hours_ for engineers to decode the data. From what I've read, it seems that the MRO can be used as a backup communication device for Curiosity if needed. In the case of Curiosity's landing, I figure the MRO would have store the data until it orbited around the red planet and had a direct line of sight with Earth before transmitting it (then again, I'm only speculating here), which I can understand. But then why would it take NASA engineers hours to decode the signal relayed by MRO after it is received here on Earth? ( _Bonus point: Does it normally take hours to decode MRO signals?_ )


title: Guiding Non-Programmers in Hiring of a Programmer

text: A friend of mine has a developer (possibly the "mad genius" type) that has built a substantial system on which their small business is critically dependent. They'd like to get away from their current guy and replace him with someone more reliable, but the question comes up of how to know that the person they replace him with is a competent developer himself. As a developer, I know what questions _I_ would ask and how to interpret the responses, but how would you advise a company void of development background to go about identifying the ones who know their stuff?


title: can a regex search engine for the web be done and if so, how?

text: I think it would be a great idea if we had a regular expression search engine, but can it be done? It seems impossible since there's no feasible way of indexing such a huge amount of data properly and displaying results in the order of relevance from what I can think of. I'm curious what the answer to this one would be.


title: Confusion with Factory pattern regarding Liskov's Substitution Principle, code maintainability and Unit Testing?

text: I have a confusion regarding Factory Pattern there are basically two ways You can implement that. Approach 1:               public interface IProductFactory     {         IProduct GetProductA();         IProduct GetProductB();         IProduct GetProductC();     }          public class ProductFactory : IProductFactory     {         public IProduct GetProductA()         {             //some implementation goes here         }         public IProduct GetProductB()         {             //some implementation goes here         }         public IProduct GetProductC()         {             //some implementation goes here         }     }      Approach 2:               public enum ProductType     {         ProductA = 1,         ProductB = 2,         ProductC = 3     }          public interface IProductFactory     {         IProduct GetProduct(ProductType productType);     }          public class ProductFactory : IProductFactory     {         public IProduct GetProduct(ProductType productType)         {             switch (productType)             {                 case ProductType.ProductA:                     //return IProduct with specific implementation                     break;                 case ProductType.ProductB:                     //return IProduct with specific implementation                     break;                 case ProductType.ProductC:                     //return IProduct with specific implementation                     break;                 default:                 //return null             }         }     }      **Pros of both approaches** Approach 1:   1. benefit of compile time checks that the implementation class will be forced to provide the corresponding methods. Approach 2:   1. Implementation will have a benefit of shorter no. of lines of code.   2. Interface does not become fragile, it won't change as the new products keep on adding. **Cons of both approaches** Approach 1:   1. Lines of code becomes large.   2. As more number of Products are implemented, the interface changes and hence it is hard to follow Liskov's Substitution Principle. Approach 2:   1. Since it is hiding internal details of GetProduct, it is hard to tell what the Factory will return when a specific type of enum is passed.    2. You might get into run time exceptions **I am still struggling to decide on which approach to use?** * * * **Note:** I am only aware of these two approaches, there might be different approaches also.


title: Cogent arguments for 'semantic css' over 'object oriented css'

text: [Context - I'm a Java developer, having a discussion with a designer who works in the html/css space] I was having a discussion with a co-worker today about the merits of 'semantic css'. His response was, "Oh we're not interested in semantic css, we use object oriented css" I understand what he means, ie that they're using the 'inheritance' properties of css and SASS mixins to describe styles. But I feel like he has not tried to understand 'semantic css'. I'm trying to construct a cogent argument about why 'object oriented css over semantic css' is flawed. This is my reasoning so far:   * “css isn’t object oriented” http://stackoverflow.com/a/7431746/15441   * Write html code with semantic components http://css.dzone.com/articles/object-oriented-css-crap-long   * Examples of layout out your page with semantic components http://woork.blogspot.com.au/2008/11/css-coding-semantic-approach-in-naming.html   * Examples of non-semantic naming http://css-tricks.com/semantic-class-names/ My question is "what are some cogent arguments explain semantic css to someone who thinks that 'inheritance', 'classes' and 'mixins' make something object oriented and that he doesn't need to worry about good naming?"


title: In a declarative language, specifically in the context of modelling, can we make a clear distinction between code and data?

text: For declarative languages, specifically (but not limited to) in the field of modelling, it's not obvious to me whether code can be considered to be separate from data. This line of reasoning may only apply to non-turing complete languages such as NeuroML. Say for instance I had a very domain specific declarative language which I used to described the positions of planets and their velocities, and I described a system of three orbiting bodies:               satellite planet_earth,moon,sun {          planet_earth.position = [6,0,0]          planet_earth.velocity = [0,23,-32]          planet_earth.mass = 1e3          moon.position = [6,0,0.0001]          moon.velocity = [0,0,3]          moon.mass = 1e2          sun.position = [0,0,0]          sun.velocity = [0,0,0]          sun.mass = 1e12 }      This language could be passed to a simulator which then simulated the motion of the planets. From one perspective this is code - It is describing initial conditions and consequently within the constraints of the language a sequence of steps for a computer to run. From another perspective it is 'data' - it is a description of a physical system. Is this concept (is something code or data) something which has been studied much? I've looked into it


title: What determines when an application requires mvvm?

text: I'm developing mobile applications for Windows Phone 7. This application calls some web services and occasionally sends responses out via web services. I recently started looking into MVVM and noticed that, although it is suggested when developing applications in WP7, alot of developers say only to use it if its necessary. Along with that they said that if the application is "small" enough or "simple" enough then it probably isn't worth the time. Hence my question. When should we use MVVM? Is it possible to build larger scale applications without it?


title: Distributed system command and control

text: I have an application that consists of a set of Java and C++ of processes running on one or more systems and need to ability to monitor and control the components as if they were one complete system. My requirements:   1. runtime statistics (messages per second etc..)   2. log of events   3. control: "service X set rate to 1000 mps" or "all services stop"   4. ambient configuration so all services can start up and discover the working mode (etc..) Since data plane messaging is 0MQ based, I am currently doing this with 0MQ based messaging and a message distributor to fan out the control messages. However, I am interested in how others have tackled the problem. Thanks.


title: Priority queue for Kruskal's algorithm with running time O(E lg V)

text: I'm reviewing my notes on Kruskal's algorithm and have a question about getting the runtime down to O(E lg V). By using a PQ with _edges_ and a boolean array of which vertices we have added to our tree _T_ , the running time is O(E lg E), but in my notes there is also a variant with running time O(E lg V), by using a PQ with vertices instead of edges. However, this requires the PQ to support updating weights (important part highlighted): > Maintain a PQ of vertices connected by an edge to T, togethether with the > edge that connects it to T. The priority of this tuple is the weight of the > min-weight edge connecting it to T. When adding a new vertex to the tree, we > add all vertices adjacent to this new vertex to the PQ unless it's already > in the PQ. **If it is in the PQ and the new edge connecting it to T is of > lower weight, we update its weight and the edge associated with it** , if > not, we do nothing. When thinking about how to actually implement this, I realized that all priority queues I have seen have O(n) updates, since the ordering is too weak for us to be able to find an element faster. I tried searching a bit but couldn't find any PQs that support updating in O(lg n) time, except some references to fibonacci heaps that can do it in O(1) time, but looks like a much more complex data structure. Is there a simple way to get O(lg n) updates of a priority queue? I could insert keys and references to elements in a hash table and use that to quickly find and update elements, is this a viable solution? (I realize that this will require O(n) extra space.)


title: FreeType font patent issue and Apple platform

text: As I know, FreeType restrict some features by patented font technology from Apple. So, if I develop a program for Apple platform _only_ , can I enable and use the features?


title: Who should be responsible to write test cases?

text: Should tests in some project be written by the actual person that does the coding (usually senior in our team) or it can be done by junior coders with less experience?


title: What programming skills have provided you the best return on investment?

text: What are the things that took you only a little time to learn, but had a big payoff? And how long did it take to learn enough before the they began to pay off? For instance, I’m not a master of regular expressions, but it probably took a couple of hours to understand the basics enough for to start using them and they come in handy on a regular basis.


title: Distributed transactions and queues, ruby, erlang

text: I have a problem that involves several machines, message queues, and transactions. So for example a user clicks on a web page, the click sends a message to another machine which adds a payment to the user's account. There may be many thousands of clicks per second. All aspects of the transaction should be fault tolerant. I've never had to deal with anything like this before, but a bit of reading suggests this is a well known problem. So to my questions. Am I correct in assuming that secure way of doing this is with a two phase commit, but the protocol is blocking and so I won't get the required performance? It appears that DBs like redis and message queuing system like Rescue, RabbitMQ etc don't really help me a lot - even if I implement some sort of two phase commit, the data will be lost if redis crashes because it is essentially memory-only. All of this has led me to look at erlang - but before I wade in and start learning a new language, I would really like to understand better if this is worth the effort. Specifically, am I right in thinking that because of its parallel processing capabilities, erlang is a better choice for implementing a blocking protocol like two phase commit, or am I confused?


title: Correct echoing of html in js?

text: A colleague and I were discussing how to echo HTML inside of javascript code. Specifically, in a situation similar to this:               new Element('div', {         html: '{long string of HTML goes here!}'     }.inject($('content'));      Short snippets seem to work well in this situation, but what if we were echoing a large set of data? The line would then become very long, and hard to debug (because who horizontally scrolls?!) A problem also lies in the fact that besides its length, all quotes used need to be escaped, especially if the javascript code is being echo'd from the server side, in which case one of the quote marks would be "used up", per se. One solution would be to break up the long line of HTML code:               new Element('div', {         html:   '{long string of HTML goes here!}' +                 '{some more HTML goes here}' +                 '{and even more...}'     }.inject($('content'));      Another solution provided involved including an addslashes()'d server-side include, which involves a second file. Although I suppose it is also possible to define all of the to-be-included HTML in a php variable, and echo it when it is needed:               <?php         $html = addslashes('{html content}');     ?>          new Element('div', {         html: '<?=$html?>'     }.inject($('content'));      Which method is best in terms of code readability, efficiency, and security?


title: Keep it simple now, or program with the future in mind?

text: I'm currently coding a new application for my company that is rather involved. To meet the deadline, the functionality has been toned down quite a bit so that we can have something ready to go for launch. I've been given the task of getting version 1 up and running by the end of the month. I'm about halfway through development and I've come to the point now that there is an end in sight. Yesterday, I spent some time coming up with a very nice easy solution for one of the requirements and am quite proud of how it turned out. This morning the version 2 document was sent out, and there is a requirement in there that will require the code I wrote yesterday to be either gutted, or severely changed. It would require a lot of work in the future if I leave it the way it is. I can take an extra day now to make my current solution more robust so that the v2 feature will be able to be added with a lot less effort, but that will put me a bit behind for the extra coding it would require. I don't know if I'll be doing v2. It might be me or it might be a co-worker, or even an intern. If you were in my shoes, would you spend the time now to make it easier in the future, or would you leave your solution and deal with it when the time comes?


title: In PHP, how do you code with scalability in mind?

text: I know this may be a general question, but what exactly goes into scaling for all the users you will encounter, even if not in the next few months? I did some research and most of what is done is server side, with caches and other similar stuff. Any points in the right direction would be helpful.


title: What programming languages should every computer science student be taught?

text: What languages (or classes (as in paradigms) of programming languages, plus a recommended language of that class) should every computer science student be taught in college according to you? Motivate your answers; why that language? What use will one have from it? What concepts does it teach (better than language X does)? **Note/clarification** : This question is about computer science with heavy focus on software engineering, not pure computer science. It is still computer science education and not software engineering education which is the focus.


title: How we call an RPC that not only calls external functions but also updates data structures?

text: I have a simple C++ RPC that lets you have remote class instances that support live members (data structures) update as well as method calls. For example I had a class declared like this (pseudocode):               class Sum{     public:         RPC_FIELD(int lastSum);         RPC_METHOD(int summ(int a, int b))         {          lastSum = a + b;          return lastSum;         }     };      On machine `A` I had its instance. On machines `B` and `C` I had created its instances and connected them to machine `A`. So now they actually do all processing on machine `A` but machines `B`, `C` get `lastSum` class field updates automatically (and can subscribe to update event). How to call (`Nice Name`) such a functionality when we have binding over network done automatically by RPC library? How RPC library creator can announce such feature?


title: What can a company do to restrict offsite contract developers from redistributing GPLv2-licensed code modifications?

text: My company uses a mix of onsite and increasingly offsite contractors for development of websites and online applications. Our platform uses a mix of open source software and libraries that we've made a number of modifications to over the years. Some of the modified software is licensed GPLv2 without the linking exception. For various reasons, we do not want the source to be made public. The concern is that if we supply the binaries to our platform for our offsite developers, we are obligated to supply the source code upon request. Additionally, there will be times when we need to distribute the source of our modified libraries. From there, nothing would seem to preclude the contractor from redistributing the work. The GPL FAQ states: > . . . when the organization transfers copies to other organizations or > individuals, that is distribution. In particular, providing copies to > contractors for use off-site is distribution. Furthermore, the GPL states: > You may not impose any further restrictions on the recipients' exercise of > the rights granted herein. The question is: **what can be done to restrict offsite contractors from redistributing our modified code?** A note, that I think the GPLv3 addresses this concern with the following clause. So my question is specifically about GPLv2-licensed modified code: > You may convey covered works to others for the sole purpose of having them > make modifications exclusively for you, or provide you with facilities for > running those works, provided that you comply with the terms of this License > in conveying all material for which you do not control copyright.


title: Abstraction: The War between solving the problem and a general solution

text: As a programmer, I find myself in the dilemma where I want make my program as abstract and as general as possible. Doing so usually would allow me to reuse my code and have a more general solution for a problem that might (or might not) come up again. Then this voice in my head says, just solve the problem dummy its that easy! Why spend more time than you have to? We all have indeed faced this question where Abstraction is on your right shoulder and Solve-it-stupid sits on the left. Which to listen to and how often? What is your strategy for this? Should you abstract everything?


title: Difference between class clusters and abstract factory in cocoa

text: I have read that Obj-C class clusters are an implementation of the abstract factory. Can anyone explain if there are any differences between the 2 as design patterns. I read somewhere that there are certain restrictions on class clusters that don't apply to traditional abstract factory but it did not give more details.


title: What is the role of an Information Architect?

text: I've heard this term bandied about, especially in reference to web development, but I'm having trouble getting a clear understanding of what an Information Architect actually does. Any ideas what their role or deliverables would be?


title: Using an Apt Repository for Paid Software Updates

text: I'm trying to determine a way to distribute software updates for a hosted/on- site web application that may have weekly and/or monthly updates. I don't want the customers who use the on-site product to have to worry about updating it manually I just want it to download and install automatically ala Google Chrome. I'm planning on providing an OVF file with Ubuntu and the software installed and configured. My first thought on how to distributed software is to create six Apt repositories/channels (not sure which would be better at this point) that will be accessed through SSH using keys so if a customer doesn't renew their subscription we can disable their account:   1. Beta - Used internally on test data to check the package for major defects.   2. Internal - Used internally on live data to check the package for defects (dog fooding stage).   3. External 1 - Deployed to 1% of our user base (randomly selected) to check for defects.   4. External 9 - Deployed to 9% of our user base (randomly selected) to check for defects.   5. External 90 - Deployed to the remaining 90% of users.   6. Hosted - Deployed to the hosted environment. It will take a sign off at each stage to move into the next repository in case problems are reported. My questions to the community are:   1. Has anyone tried something like this before?   2. Can anyone see a downside to this type of a procedure?   3. Is there a better way?


title: Risks of maintaining codebase C++ Builder 6?

text: My company has a large software application written in C++ Builder 6. I am a junior developer only one year out of college. My question is:   1. How much technical debt are they in? What are the hazards of working in such an IDE that is no longer supported?


title: software design interview questions

text: I am preparing for an interview at google, and it will involve programming questions as well as design questions. I have done interviews with facebook and amazon, and I didn't do well in the design part of the interview for both companies. I was asked to design a restaurant reservation system, an array of caches, and the facebook friends list. The questions vary in very different ways. Can anyone give me suggestions on how to prepare for this kind of interviews and how to get better at this in general? I wonder if there are places like careercup.com which is very helpful preparing for algorithm interviews, it has some design problems as well, but not nearly enough.


title: Efficient solution for dictionary updates

text: Let's start with the problem: There is a large dictionary X that contains {key, value} pairs, i.e.:               X = [{100, 10}, {101, 0}, {103, 0}, {106, 2}, {110, 1}]      Every t seconds, X has to be updated with values from sub dictionary U and 0 set to each value for a key that is not present in new updated U, but was in the previous update. The most important requirements is, that an update has to be performed in such a way, that the minimum number of update operations of each {key, value} pair in dictionary X have been performed, ie. X updated by U where               U = [{100, 10}, {102, 5}, {103, 0}, {105, 1}, {110, 0}]      would become:               X = [{100, 10}, {101, 0}, {102, 5}, {103, 0}, {105, 1}, {106, 2}, {110, 0}]       but only following pairs have been updated/added in X:               {102, 5}     {105, 1}     {110, 0}      To make things a bit more interesting, there are few constraints:   * it is very costly to iterate over dictionary X. Assume X is very large.   * it is very costly to make an update to {key, value} pair so the task is to minimize this cost. So that was the problem stated. Here is my solution: First idea I had was to save the dictionary U after updating X. On the next update I take each key from Uprev and set it to 0 in X.               foreach (var pair in Uprev)     {         X[pair.Key] = 0;     }      After this has been done, I would do a loop to set new values for keys present in new dictionary U:               foreach (var pair in U)     {         if (X.ContainsKey(pair.Key))            X[pair.Key] = pair.Value;         else            X.Add(pair.Key, pair.Value);     }      So ... the question: is there a better solution for the problem I described above? Is it possible to better manage the updates? Any ideas are welcome, so feel free to post anything that comes to mind. Thank you for contribution


title: Is Java Bytecode interpreted?

text: The definition of interpretation (correct me if I'm wrong) is parsing code like so: **1-** Translate currently parsed line to some intermediate language. **2-** Run the translated line. **3-** Move to the next line. **4-** Translate it. **5-** Run it. And so on. If so, why do people say that the JVM **interprets** the Java Bytecode? What it does is **execute** it. The Bytecode is already translated Java source code, so there's no need to translate further. Than why is the term **interpretation** involved? If this term is used because the JVM **executes** the Bytecode **line by line** , well I'd say that any execution does that. Executes the runnable code from top to bottom. Than why use the term **interpretation**? _**Interpretation** as opposed to what?_


title: How to apply OOP, SOLID principles and Design Patterns in a library which does parallel processing without the caller's knowledge?

text: I want to explore the contentions between the two hot topics: Clean code vs. Good performance. (In progress ... please post comments to help me flush out the details of this question. Thanks.) Examples which may help me define the question:   * Windows GDI+ is known to perform work on separate threads, which would have happened in parallel to user's code if run on a multi-processor machine.   * Component Object Model (COM) is a framework which gives class developers the choice to provide parallelizable implementations of interfaces, however bugs which arise from that is not unheard of.   * One way of providing parallelized safety is to ensure that the parallelized work only happen within a single call to the object's method at the outermost API level; the method shouldn't return to the caller until the parallelized work is finished. (Objects and methods which aren't visible to the outside can be parallelized.) Does this make it necessary to build an entire set of flyweight objects just to separate the "Public Objects" from the "Private Objects"?   * SOLID principles encourage extensibility by allowing library users to provide their own implementations of interfaces (through Dependency Injection). How does the library ensure that the user's implementation satisfies the thread-safety requirements?      * Component Object Model uses "thread models" which was an attempt on this issue, however most of the time it only results in deadlocks or failed function calls for the reason that "you are calling from the wrong thread apartment".


title: how often do we need to do appraisal for a developer?

text: I have this question since my friend told me that if we have frequent appraisal such as 4 months or 6 months once, people will be turned to a money minded. But I am thinking this in another aspect like, people will be getting feedback and boost quickly than one year appraisal. We do not need to increase the salary much. But the token advancement would help them to get some refreshment.


title: UML sequence diagrams - include

text: I'm currently doing my OCPJEA assignment. I have to draw several sequence diagrams for the use cases presented in the documentation. One of the use cases (A) state that after some interaction, the system executes another use case (B). I've already drawn the diagram for B, is there any way in UML2 to show inclusion, or do I have to duplicate all those interactions into A?


title: Anyone code at a treadmill desk?

text: have been thinking about getting a treadmill desk for awhile now but I just don't know if it is possible to code at one. I can see doing a normal computer job while walking very slow but I just don't know if you can write code do it. Like a lot of people I could stand to lose weight and I am just not in shape anymore. I sit at my computer for at least 12 hours a day and then I am on my laptop for a few more hours. I need to do something to help my health. I also have been seeing a lot of reports about the long term health issues related to desk jobs. Like this. Before I drop a few hundred dollars on a new desk I am wondering if anyone has tried a treadmill desk and if so which one?


title: Project Management Software / 1 maybe 2 developers

text: I am looking for software that I can use to "manage" multiple projects (5 - 10). Here are the features I would like but any recommendation is welcome.   1. Bug/Feature tracking on a per project basis.   2. Some way to keep all documents, diagrams, specs, requirements, in one place with the project. Better yet a tool where all these things or most of them could be authored.   3. Task management during the development phase with milestones and estimates/actuals.   4. Git integration I have been doing contract work and i have been doing really well for myself as far as getting projects but its becoming VERY hard to manage everything in an efficient manner. I am trying to learn about best practices when it comes to software programming methodologies and the more I read the more i realize that I am just managing these projects poorly. I am getting things done but the more I take on the less "solid" everything is. I am afraid if I don't get some good solid tools/practices in place I am going to do my customers and myself a disservice. The problem is that there are SO many options that its hard to weed through them all. I was at a point today where I had decided that I would just code my own (there is some irony here)! Obviously everyone has their likes dislikes I would love to hear from some of you lone programmers and how you manage everything since our needs aren't exactly the same thing that a large team might need. I also want a solution that can scale to 2 maybe 3 developers if I end up hiring some people to help with my work load. Thanks again for your usual insights!


title: When developing a MVC web application should views or models be created first?

text: I have to build a new application from scratch, so I want to implement it using MVC3 and try to follow general best practices as closely as possible. However, I'm developing it as a one man army. Does it make more to create the views first so I have some "Mockup screens" then build the Models and controllers? or the other way around?


title: Is job hopping the best way to keep moving and learning at work?

text: Leaving aside anything you could do outside of work like OSS or self study, do you think job hopping is a good way of continuously learning new skills. In this context, my definition of job hopping is every 2-3 years, move companies, possibly even domains. By changing to the right jobs you could in theory learn a new language/framework and get exposure to other domains of knowledge. A quick update: This is not my current situation, nor is it an approach I have followed. The thought just struck me and I thought it was a good question.


title: How do I decide to which class a method should belong

text: I have `TopicBusiness.class` and `PostBusiness.class`. I have no problem with deciding into which class methods such as `addPostToDatabase()` or `getAllPostsFromDatabase()` should go. But what about `getAllPostsFromTopic(TopicEntity topic)` or `getNumberOfPostsInTopic(TopicEntity topic)`? Should the parameter be the deciding factor? So when the method takes TopicEntity as parameter it should belong to `TopicBusiness.class`? I am quite puzzled by this. EDIT: Some more info as requested. `TopicBusiness.class` and `PostBusiness.class` are classes holding all the business logic of the application concerning topics and posts respectively - that is fetching the data from database and/or performing some operations on them. `TopicEntity` is data (in this case representing single topic) fetched from database. `getAllPostFromTopic(TopicEntity topic)` gets all posts from database that belong to particular topic, while `getNumberOfPostsInTopic(TopicEntity topic)` performs database query and returns the number of posts that topic passed as parameter consists of.


title: Would a model like this translate well to a document or graph database?

text: I'm trying to understand what types of models that I have traditionally persisted relationally would translate well to some kind of NoSQL database. Suppose I have a model with the following relationships:               Product  1-----0..N  Order     Customer 1-----0..N  Order      And suppose I need to frequently query things like All Orders, All Products, All Customers, All Orders for Given Customer, All Orders for Given Product. My feeling is that this kind of model would not denormalize cleanly - If I had `Product` and `Customer` documents with embedded `Orders`, both documents would have duplicate orders. So I think I'd need separate documents for all three entities. Does a characteristic like this typically indicate that a document database is not well suited for a given model? Generally speaking, would a document database perform as well as a relational database in this kind of situation? I know very little about graph databases, but I understand that a graph database handles relationships more performantly than a document database - would a graph database be suited for this kind of model?


title: Ruby - when to use instance variables vs parameters between methods?

text: I'm writing several methods that call other methods. To pass the information I have a couple of choices:   1. Pass the information as parameters   2. Set instance variables so that other methods can access them When should I choose one option over the other? It seems that the first option is good as it is very specific about what is being passed. the downside seems to be that a lot of values are being passed around. The second method doesn't require passing all the values around but seems to lead to a lot of magic where methods set instance variables 'somewhere' Should I always be very explicit about gets passed to other methods in the class? Are there exceptions so this?


title: Strategies for browser compatibility on web applications in a corporate environment

text: With the new CSS 3 and HTML 5 technology, web applications have gained a lot of new tools for a better UI (user interface) interaction, beautiful templates and even responsive layout to fit into tablets and smartphones. Within a corporate environment, those new technologies are required so the company can "follow" the IT evolution and their concurrent, but they also want that those new web applications supports old browsers. How should I deal with this situation? By one side we are asked to follow the the evolution of technology, create responsive layouts and use a lot of cool jQuery plugins. On the other hand, we are asked to support old browsers that do not support those new responsive features, plugins or components.   * I would like advice and strategies on how to create "modern" web applications that are also supported on old browsers.   * How does your company deal with this situation?   * Is it possible to have the same web application run well and beautifully on old browsers, and be responsive and interactive on newer browsers?


title: Subset whose sum gets closest to saturating some bound

text: I have a problem that boils to down having a set of integers and wanting the subset of those integers whose sum is closest to some target without going over. What's a good algorithm for doing this? Maybe it's even a well known problem whose name I don't know?


title: I feel sleepy and tired when I encounter problems during a working day, is that normal?

text: I think it is kinda strange but I just noticed that I have this odd habit of feeling tired, sleepy and dizzy when I encounter a (programming) problem that I can't solve after a while of trying. It generally shows up when I'm dealing with svn, reading someone else's code or resolving regression issues (old bug reappearing again). To my understanding, this has nothing to do with being exhausted or tired because I just felt brilliant like 30 minutes ago and now, after 30 minutes of wrestling with a problem that I can't (apparently) solve, I suddenly feel an urge to go to sleep. And I really can go to sleep when I feel like that. If I shift my focus to something else or just leave it, then after like 10 minutes or so I feel normal again and am ready to continue. I finally managed to talk about it to a colleague who sits just next to me and he sometimes feels the same way in some extreme cases of constant failures and he also finds it strange and new but there is another person who sits a little farther but he isn't feeling anything like this when he encounters difficulty :-? Ideas? EIDT: I realized the fear of failing the whole project seems to play an important role. Since I'm the agile manager in the team, when I face a problem I can't immediately solve, subconsciously I start to tell myself : this is gonna make the whole thing fail. Specially when regressions happen.


title: BDD to replace the test teams work - how best to do it?

text: The system we are developing, using .NET, is extremely large, complex, and some modules are poorly written. We have a large user acceptance test team that is aiming for 100% business scenario coverage, which takes about 6 weeks. Can we use behavior driven development to replace some of the manual tests being done by the test team? How would that information be readable to the test teams so they can be sure it's working? Does BDD replace our integration tests?


title: What qualifications are most important for an outsourcing manager?

text: I am considering hiring someone exclusively to manage outsourcing of relatively small projects on Guru.com or VWorker.com. The person should be located close to me so I can have face-to-face communication and also that he/she gets domain knowledge. The projects will be in a wide variety of technologies and ranging from mission-critical to completely experimental projects. Sometimes deadlines will also be extremely tight. My question is what kind of candidates would be the best at undertaking such a job? Are recently graduates the best? Expert technicians who can recognize and communicate with other experts? Experienced project leaders? An aspect of this is that I want the best cost/benefit ratio, given that experienced project leaders are likely to be much more expensive than recently graduates. I also believe that one aspect of this is that this is quite an unusual organizational structure, so I am not sure that people who are used to the bureaucracy project management in big companies would be able to adapt to such a working environment.


title: Triggering Data Changes in N-Tier

text: I've been studying n-tier architectures as of late, particularly in VB.NET with Entity Framework and/or LINQ to SQL. I understand the basic concepts, but have been wondering about best practices in regard to triggering CRUD-type operations from user input/action. So, the arcitecture looks something like the following: [presentation layer] -> [business layer] -> [data layer] -> (database) Getting information from the database into the presentation layer is simple and abstracted. It's just a matter of instantiating a new object from the business layer, which in turn uses the data layer to get at the correct information. However, saving (updating and inserting), and deleting seem to require particular APIs on the relevant business objects. I have to assume this is standard practice, unless a business object will save itself on various operations (which seems inefficient), or on disposal (which seems like it just wouldn't work, or may be unwieldy and unreliable). Should my "savable" business objects all implement a particular "ISavable" or "IDatabaseObject" interface? Is this a recognized (anti-)pattern? Are there other, better patterns I should be using that I'm just unaware of? The TLDR question, I suppose, is **How does the presentation layer trigger database changes?**


title: Starting software projects

text: Always, when I try to start new project, with what I think new ideas, first of all I search the web to try to find some thing same, most of the time (if not all) I find that my ideas of new project have been implemented hundred of times. I think everyone in software industry feel this every day. The question is:   * when should I approve an idea and start building it, although it's implemented hundred of times around the world?    * how I can make my way in trying of build something new?


title: How do Tortoise svn handle concurrent file updation

text: I don't know much about Tortoise SVN, but have been using it for a while. I understand that it is capable of managing concurrent users on same file, but how does it do that? I am working on a file that another user is using concurrently and he committed couple of times before me, Now my files doesn't have the changes he made. Every time i end up in such a situation I gets a conflict and I am stuck. So is there something else I should do instead of just `committing` and causing `conflict`? Is it safe to do a `update` first and then `commit` ? Will I lose my local changes in this case? Please don't beat me up if this is something basic, a link to some tutorial will be useful in that case :)


title: When is C a better choice than C++?

text: I can't imagine that there's any reason not to use the OOP features of C++. It's is just as fast as C, and - what's more important to me - it's transparent, just as C. (I mean "transparent" that I know, what is my source is compiled to. Or, I think, I know.) Is there any reason not to use the power of OOP in C programming? I accept only embedded systems or other restricted platforms as exceptions, where no such memory management is available, which is required by C++. I also accept operating system development. Or programs started writing before C++. Okay, that's all. **UPDATE:** the question is just about C vs C++, not C/C++ vs other languages. I'm using C/C++ just in "final case".


title: What should a proper Ready for Sprint definition contain?

text: Teams in our company deal with Product Owners who are in such a position that they cannot spend as much time with us, as we would like, to do proper Backlog Grooming. Thus in order to alleviate some of the time constraints we have begun implementing the art of getting stories "Ready for Sprint" or in other words getting them into a state where we know/understand enough to take them into a sprint. Unfortunately we are still new to what would be a proper definition of 'Ready For Sprint' and so the question of what would be good to keep in mind when getting a story in the backlog Ready for Sprint? [EDIT] In response to answers and comments by Ryathal and Donal Fellows i would like to try explain that we do not intend to actually build the stories. We would like to apply the practice of getting existing stories "Ready for Sprint" as explained by this Blog Post. Product owners should probably be adding to this but as mentioned we are not in a prime position with our product owners (as yet). We have read that you can make definitions such as a story is in Ready state if its effort points are 5 or less, or the story must have Minimum Acceptance Criteria defined, or it must have a Balsamiq Mockup etc. My question is geared towards finding what others have used in their definitions and what has worked for them. :)


title: How common is pair programming in the workplace?

text: I've always been intrigued by pair programming, but in 12 years development I've never worked in a place they have employed this practice, so I have always been sceptical as to how people see it. I wonder whether this is because of money/time (Pointy haired boss spotting two people at one computer working on the same code!!!! how dare they!) or for other reasons?


title: Why is JavaScript not used for classical application development (compiled software)?

text: During my years of web development with JavaScript, I come to the conclusion that it's an incredible powerful language, and you can do amazing things with it. It offers a rich set of features, like:   * Dynamic typing   * First-class functions   * Nested functions   * Closures   * Functions as methods   * Functions as Object constructors   * Prototype-based   * Objects-based (almost everything is an object)   * Regex   * Array and Object literals It seems to me that almost everything can be achieved with this kind of language, you can also emulate OO programming, since it provides great freedom and many different coding styles. With more software-oriented custom functionalities (I/O, FileSystem, Input devices, etc.) I think it will be great to develop applications with. Though, as far as I know, it's only used in web development or in existing softwares as a scripting language only. Only recently, maybe thanks to the V8 Engine, it's been used more for other kind of tasks (see node.js for example). Why until now it's only be relegated only to web development? What is keeping it away from software development?


title: How do you manage frequent software releases to multiple clients?

text: we have a cross-platform middleware product which we typically end up customizing/bug fixing on a per client basis. In some cases, providing updates as often as once/twice per week. We have a lot of trouble efficiently managing and releasing the updates to our clients. I've done some digging, but I can't find anything to specifically address this problem. Can anyone share their experiences - how do you deal with this scenario, or do you know of a good software delivery cms?


title: What's the *ISTQB* and are they trustable?

text: I heard that my co-worker want to get ISTQB certification. But I heard it first time. So it's hard to trust it. In fact I can't understanding the concept of qualification for testing software.   1. What is the organization. What's the value of the certification?   2. How do you think about it? Is it trustable publicly?   3. How many company recognize the certification?


title: Lead developer unable to do INNER JOIN

text: I had worked in the past for a small company developing web applications. Back then the ~~current~~ lead developer, who is also one of the bosses, told me that he is incapable of making a `JOIN` inside a `SQL` query. I was amazed how a person who has developed and maintain big ecommerce site is incapable of doing that. Are database normalization and functional dependencies a waste of time? Are they only necessary in big demanding projects?


title: Is checking count/size/length less than 0 necessary in modern languages?

text: Is checking count/size/length less than 0 necessary in modern languages anymore? For instance, in C# I quote often will check if a collection's count is less than or equal to 0. I assume that this was done in older languages, like C, where you could potentially have a size of less than 0. Is there ever a case where you can have the size/length/count of an object or primitive type be less than 0?


title: Best way to hide API key in source code

text: I need some ideas on how to protect a private API key in an application, specifically in a c# .NET application. Firstly, I understand that it is theoretically impossible to hide anything in the source code, so I came up with another idea, but I'm not sure how plausible it is. Anyway, would it be possible to somehow communicate with a web server to verify the private key and then talk back to the application to confirm that it is a legitimate handshake? I'm have two keys to work with: a public key (as the name suggests, it doesn't have to be treated with the same care as the private), and a private key, which needs to be kept secure from others. Any ideas on how I could do this would be greatly appreciated.


title: Does SRP with ORM provoke SOA?

text: Sorry about the many abbreviations in the title... My observation is that applications built with an object-relational mapping like Hibernate tend to follow a service-oriented architecture instead of an object-oriented one. Some people (e.g. here) say the Single Responsibility Principle suggests that dealing with reading/writing attributes of persisted objects as well as creating and finding these objects is enough responsibility for one class. Any business logic using such an object should go to separate classes. That leads us to a design with two separate types of classes: state-full but dumb record keeping ones, and logic bearing but state-less ones. Here's why I don't like this kind of design: (1) To me, this separation of data and code is not a goal of object-oriented but is the design of service-oriented architecture. OOD says that operations should go to the classes where the attributes it uses are defined at. (2) Also, it's a bogus solution: whenever the structure of one of the state- full classes changes, I'll have to change all the service classes that use it, too. If I had the logic inside those classes, the change would stay in one class. (3) I'm using an ORM framework which pretty much generates all the code necessary for accessing the persisted data for me into a class. If I wasn't adding the business logic to it, the class would stay rather "empty", i.e. it would contain the generated code only. I know that many programmers follow the service-oriented design, especially when using frameworks that suggest this, like Spring. If I were using such a framework, I'd go with the separation of code and data, too. I don't want to provoke a discussion whether SOA is good or not. I'm interested in the question whether it's good OOD (as per SRP) to separate business logic from classes representing entities.


title: SQL scripts in TFS without putting them into solutions?

text: I am working on adding existing SQL scripts to version control. I have Team Foundation Server 2012 set up with Visual Studio 2008 and SQL Server Management Studio 2008 R2 with the MSSCCI. I am fairly new to TFS so I do not know if I am missing an easier way of doing things. Managing SSIS projects and even SSRS projects makes perfect sense with TFS, as a project is needed to use or modify it in Visual Studio/BIDS. You add the project to source control then check in much like saving a solution/project normally on your local machine. SQL scripts seem a little more cumbersome to use with TFS. It seems like I have to create SQL Server solutions to add any sort of sql script to my source control from SQL Server Management Studio (the add to source control functionality). While I can create new solutions in SSMS and add them to source control quite easily, it is a little annoying to have to add all of my existing scripts, which are simply .sql files, to new solutions. Ideally I would like some way to just add the scripts to source control, be able to modify them in SSMS, then check them back in somewhat easily. If this were subversion, I could just commit and check in the single file in Windows Explorer and be done with it, managing and modifying the file however I want. Is there an equivalent in TFS to this?


title: What makes JVM so much versatile to support so many JVM languages?

text: JVM supports so many languages other than Java like `Groovy,Clojure,Scala` etc which are functional languages unlike Java(I am referring to _Java before Version 8_ where `Lambda's` are not supported) that doesn't support functional capabilities.On a high level what makes the JVM so versatile that it can support both Object Oriented as well as Functional languages?


title: How bad would it be to obtain a lock on every object?

text: Imagine a hypothetical programming environment that is largely like Java or .NET, i.e. object-oriented, garbage-collected, etc., but with one small change: Every time you call a method on an object, a lock is obtained so that no two threads can execute methods on the same object at the same time. The lock is relinquished when the method returns. The lock is also temporarily relinquished when you call Thread.Join (this is just to prevent certain kinds of deadlock situations). How severe would the performance impact of that really be? How badly would this interfere with concurrency? Are there any algorithms/programs that it would be impossible to parallelise in this kind of environment? In my previously posted question, a link was given to this page about the GIL in CPython which claims severe performance and concurrency problems with this. However, it also states that this environment uses reference counting and the increment/decrement of that reference count is an operation that obtains such a lock. Let's not assume that; .NET's GC is mark-and-sweep, not reference- counted.


title: How to estimate tasks in scrum?

text: Let's say we have a backlog of User Stories, each with an estimated number of Story Points, and now we're doing the Sprint Planning. Now, the Stories should be broken down into tasks and many Scrum resources suggest that each task should be estimated in person-hours. Since all questions have been discussed by the team at this point, estimating a task should not take longer than a minute. However, since a task should not be longer than a day, assuming a three week sprint with 8 developers means 120 tasks, and taking two hours only for estimations seems to be a bit much to me. I know that experienced teams can skip or short-cut task estimations, but let's say we're not at that stage yet. In your experience, how many tasks are there in a sprint and how long should it take to estimate all of them? (Estimating only half of them doesn't make much sense, does it?) Clarifications: I know the answer depends on sprint length and team size, so let's assume 8 developers and three weeks. The numbers mentioned might be rules of thumb, but even if they are off (eg, more tasks, less time needed to estimate each) we will end up with about 2 hours for the estimation. So maybe the question should be "What percentage of the planning meeting should be reserved for pure task estimation, and don't we have better things to do?"


title: Is there a formal enumeration of the ways that components can be coupled / depend on eachother?

text: Say you have               class A {     }          class B {     }      One type dependency is "method parameter":               class A {     }          class B {       public void M(A a) {       }     }      Another is "method returns":               class A {     }          class B {       public A M() {       }     }      Then C, an adapter from A to B, could be identified by a class that exhibits both of the above dependency characteristics:               class C {       public B M(A a) {       }     }      I just seems like something that could be approached with some formal methods and I'd be interested to read about them if they are out there?


title: Is Neo4j graph database sufficient to itself for all query types?

text: Neo4j eases relationship traversals => especially useful for a social network for instance. But are there any scenarios when it's advised to associate an additional relational database (or other NoSQL database that isn't specifically oriented graph) for specific query types. In short, can Neo4j be sufficient to itself for all query tasks?


title: Learning high level languages

text: I've been actively programming with assembly but now I'm losing motivation. My productivity is simply ridiculously low compared to what others seem to have with high level languages. I know I should start using high level languages but I always return to assembly for some reason. How could I get used to higher level languages and finally become productive? I'd really want to master at least one.


title: How to make a good bug report for a bug that does not appear on every user?

text: I found a bug on my XFCE and some other can't repeat the bug, namely http://askubuntu.com/questions/495947/a-logo-disappear-in-xubuntu . How should I report it to the developers if those can't repeat is as well?


title: Getting A Logo And Graphics For An Open Source Project

text: I have been working on an open source project for about 2 years. I would like to create a web site, but I am on essentially a zero budget. I also need a logo. My question: How should an open source developer go about improving the project's "visual appeal" without spending a lot of money? Are there graphic designers willing to donate time? How does one find them (if they exist). With a project you spend so much time on - you want to give it a nice looking web site so that it will grab people's eye. On the other hand, you don't want to spend money on something you are giving away for free. Has anyone had any personal experiences they can share?


title: Pros and cons for choosing between different return types

text: This is in context of a client-server architecture, although I don't think the architectural setting is needed to put up the problem. I have a function whose output can be classified into different categories:               function makeCar() { /* make a car */ }      Now, in order to decide the structure for the return value of `makeCar`, I have several options: ## Option 1 Return integer values and have a data structure that maps the integer values to different types of cars. Example:                   codeToCar = {                      "1": {                            "model": "Jaguar XJS",                             "color": "Black",                             "year": "1975"                           },                       "2": {                            "model": "Chevrolet Camaro",                             "color": "Blue",                             "year": "1966"                           }                       ...                     }      In this case, the function `makeCar` would return the keys of `codeToCar`. ## Option 2 Return the car object itself and do away with the integer codes. ## Option 3 Return a hybrid structure with some integer codes and some specific values. Example:                   codeToColor = {                        "1": "Black",                         "2": "Blue",                         ...                       }               codeToMaker = {                        "1": "Jaguar",                         "2": "Chevrolet",                         ...                       }       In this case, the function `makeCar` could return                  {         "color": 2,          "maker": 1,          "model": "Camaro"         }      What are the pros and cons of using the different options? ## Edit: I guess I should have elaborated the context more. So basically the function `makeCar` executes on a client browser and the return value of the function is passed to the server in an HTTP request. Any representation for the return type of `makeCar` on the client side would ultimately be translated to a full object representation ( **option 2** ) on the server. The two parameters I chose for comparing between the different options are:   1. Number of bytes transferred over HTTP   2. Extensibility in case new properties are added to cars or new values are added to an existing car property. I, however, would also be interested to know what other parameters could be used ( _in the current context_ ) to compare the options available, alongwith choosing between the different options based on the chosen parameters.


title: How should I keep track of an elements' state within a window/view?

text: I am trying to implement a view that contains many elements, whose state change depending on the actions you perform on it. I guess this is something that people often run into so I would like to know what approach works best for you. What I usually do is define several states for my view: {Loaded,Initialized,...} and then set the state of each element for that state. The thing is even the most trivial event,a click on a button for example, makes the state change, so I need a lot of different states, with many of them containing duplicate information since they are very similar to each other. This seems very repetitive and unefficient but has worked for me up until now, when I need a better way of doing this kind of stuff. This issue must have been around for quite a while, so it would be nice to know people's tricks & tips, best-practices, and documents of reference.


title: Could an internal rep, voting and badges encourage good programming practices?

text: Just thinking out aloud - we programmers love all this voting/badges/rep stuff so could a scheme like this be introduced into a companies code review process to encourage better coding. Something like   * You (or others on your behalf) can post a review (could be snippet, single commit or series of) for a code review   * Others can comment on it (would be similar to answers in SE)   * Badges can be given/suggested (some would be good, some would be bad like "Comment Desert" or some such)   * You can vote up/down on the code itself and the comments and badges (e.g. if someone suggested a badge and you did/didn't agree) The aim of a scheme like this would be   * Introduce a bit of fun to encourage the use of code reviews   * Improve quality (in this scheme both code reviewee and reviewers are likely to learn)   * Reduce the chance of code reviews sparking 'ego wars'   * Give some metrics to _help_ measure individual performance Could this work? Thoughts?


title: Have there been studies on the effectiveness of OOP in managing software complexity?

text: OOP is often regarded as an effective strategy of managing complexity in software, as opposed to non-OOP procedural programming. Have there been any studies testing this notion? Is it proven that OOP often helps manage complexity in large projects?


title: Which programming languages doesn't use operator precedence besides Lisp like languages?

text: And what do you think about operator precedences? Would be harder programming in language where the operations are executed in sequential order? Ex.: 2 + 3 * 4 == 20 2 + (3 * 4) == 24 Ok, Lisp family has not precedences by definition. Let's gonna talk about procedural and object oriented languages using this "feature".


title: Costs of Switching to Java

text: I'm a C# dev and I have plans of starting to develop apps targeting Android, which of course means Java. I have heard good things about Mono for Android and the idea of reusing my skill set is appealing, however the licensing cost (for now) is a bit prohibitive to me. On the other hand, from what I can see, Java is very similar to C#, so I'm predicting that shifting my skills to it will be more or less easy (easier than shifting to Obj-C I guess). Am I wrong in assuming that? Are there any hidden costs I'm blind to?