title: Teaching Programming to Kid / Teen

text: I know this topic has be discussed before, but I thought this might be a bit more of a detailed question... A family friend is a 12yr old boy with ADHD, and a very bright kid at that. He seems to have a solid instinct of computers, and I really think he would excel at programming. For example, today he was kicking around our place and so I opened up Visual Studio Express C#, and showed him how to create a console application (he was the one typing it all out). In about 10 - 20 minutes he was writing his own code, ReadLine()s and Writeline()s etc, and even started working on a loop. Made me think that even something like C# would definitely be within his grasp. Although Lego Mindstorms came to mind, his family isn't particularly well off and is likely not feasible. I thought about lending him one of my intro to C# books, but with the ADHD I don't know if he would have the patience to actually go through it. I also think something like Alice or Scratch would be too childish for him, and wouldn't catch his attention... I'm trying to figure out what the best way to approach this would be, and what sort of material is out there that he could teach himself how to program. Any thoughts or suggestions?? One thought I had was this book, but it may be too advanced without a basic C# background at least... Amazon C# Game Book: Thanks!


title: Difference between Web API and Web Service?

text: I have heard about Web Services and Web API's a lot, is there any difference between them or are the same?


title: Benchmark of asynchronous code

text: Asynchronous programming seems to be getting quite popular these days. One of the most quoted advantages is performance gain from removing operations that block threads. But I also saw people saying that the advantage is not that great. And that properly configured thread pool can have same effect as fully asynchronous code. My question is, are there any real benchmarks that compare blocking vs. asynchronous code? It can be any language, but I think C# and Java would be most representative. Not sure how good would this benchmark be with Node.js or similar. **Edit** : My attempt at general question combined with unclear terminology seems to have failed. By "asynchronous code" I mean what some answers described as event or callback programming. In the final result, operations that would block thread are instead delegated to some callback system so threads can be utilized better. And if I wanted to ask specific question : _Are there any benchmarks that compare throughput/latency gain of async/await server code in .NET? Or any other similar comparison?_


title: How would my custom language be categorized?

text: I'm developing my own scripting language to solve some unique challenges for a project. The language takes source code and converts the contents into tokens, and then a command factory is used to convert those tokens into something that can be executed. An example of a script might look like this.               accept: always;     reject: title has "something" or body has "something else";     reject: title length < 10;      Each line in the script ends with a `;` terminator, and each line starts with a named rule that ends with `:`. Each rule uses a command followed by arguments. The commands can be joined together using logical operators. The number of arguments a command can have is fixed. So when I find a command I can expect X number of additional tokens for the syntax to be correct. The goal is human readable code because non-programmers will be using it. An alternative way of writing the same above code using a C style structure would be.               accept(true);     reject(has(title,"something") || has(body,"something else"));     reject(length(title) < 10);      What is the term used for a parser that handles a language where `()` for structuring arguments is omitted, and there are no clear boundaries defined for arguments. I would like to read up on how these kinds of parsers are implemented. To ensure I'm not overly reinventing the wheel or running into common problems.


title: Align draggable elements in line and generate without overflow or new line

text:
I have this script I'm working on. What it should do is generate a new div every time I press a button and I've already done that, but those are not draggable. I think that happens because of the onLoad function but alternative do I have? The second problem is that when I click one of the blue boxes, all of them must arrange in a line like you see them when you load my jsFiddle link, and if the line is full and you click the "New Square" button, instead of overflowing or add a new line, it would close the last box instead and add a new box before all of the other boxes. I'm sorry to bother you with those questions, but I am a PHP and MySQL programmer, I just started using jQuery. jsFiddle HTML:

     <input type="button" class="button" value="New Square">      jQuery:               $('.round').draggable();          $('.button').click(         function (){     $("#container").append("

");         });          $('.round').click (              );      I had more code in jQuery, but I removed all of the useless options because I want you to easily understand what I want to do.


title: Enforcing organizational standards for software in Scrum

text: Organizations, especially organizations with a recognized brand, have various standards for software. This includes things like security, usability, code quality and readability, UI design, test automation and so forth. In our organization we have a lead for each of these areas. Each lead is a very experienced individual and is trusted by management. Each lead is responsible for the software to meet the standards in the lead's area of expertise. The Scrum Guide says: "Development teams are self-organizing. No one (not even the Scrum Master) tells the Development Team how to turn Product Backlog into Increments of potentially releasable functionality;" My question is how can an organization trust teams to produce a product that meets the various standards mentioned above, if the leads (trusted by the organization) have no ability to enforce the quality in each of the areas?


title: Is hiring a "chief intern" a good idea?

text: I'm starting an internship program for our software department and I was wondering about creating a position ("chief intern", intern supervisor, or whatever one should call it) with the following responsibilities:   * **Train** interns   * **Coach** interns   * **Manage projects and tasks** for interns   * **Supervise** intern's work in terms of **rhythm and quality**   * **Act as a liaison** between the main team's needs and interns performance/aspirations   * Evaluate and facilitate intern's progress **when they want to grab a higher-level domain-specific task** (at this point, a main dev team member can do mentoring)   * **Get freely involved in the main team's software development tasks so that he himself can grow** , and have full mentorship from the main dev team. I'm thinking that an apprentice-level engineer (below Jr., or Jr.; but being a graduate and working full-time) can handle this for a while (he will be trained by the main dev team first), until one of two things happen:   1. He/she **decides to move on to the main dev team** by recommending an appropriate replacement (or me finding another one as a new hire)   2. **Keep leading** the interns while still being able to grow to Jr. Eng., Eng., Sr. Eng I know the notion of a "chief intern" is common within the medical world, but I don't really know about that in the software world (I was a freelancer for most of my university years). A side-intention to this is also that, if this ends up being a higher rotation position (organically) because the intern supervisor wants to join the main dev team, **this could help interns that aspire this position emerge as leaders**. **My main intention for this, though, is removing distractions from the main team but without making the interns suffer the lack of attention, which could lead to boredom and little intern retention.** Is this "chief intern" idea common (or good at least)?, are there any obvious risks to it that I might not be seeing? * * * **Edit** : I have a draft plan for the kind of work the interns would be doing: Are R&D mini-projects a good activity for interns? **Edit #2** : My intention is not keeping them isolated, but having someone focus on giving attention to them when we cannot. **Edit #3** : I'm now convince it is a good idea, but I will take the organic approach to hiring someone in such position: do it myself until I cannot. This way I'll know better what to expect from a person I hire for this role in the future, as well as what works and what doesn't with interns.


title: Communicating with Vendors

text: We are a small software team (as far as programmers go) and have a team of vendors on the other side of the world that program for us. We own the product, and simply dictate to them some of the tasks to work on. I am one of the lead programmers and also the project manager of this particular project, so I am a programming and fulfilling requirements as well as outlining them. I am having difficulties communicating with the vendors exactly what is expected of them. Let me start by saying we are fairly new at this and I don't have a lot of experience leading a team of vendors, especially when it is difficult to communicate verbally in English, and they work during my night and then I come into the code they pushed while I was asleep. Problem is, I end up spending a lot of my day just checking what they did, and fixing bugs and cases they didn't think of. They're not thinkers, they do exactly what I tell them, and nothing more or less. Most of the time, I feel like it would just be easier to do it myself. My question is how do most teams like this communicate? Right now we have weekly telephone meetings and I email them nightly the progress I made, as well as what is expected of them. When I think "how to communicate with other programmers" the answer seems to be UML. That's what it is. I certainly am very familiar with UML, learned it in school, but have never really used it on the job. It's just not something we do, in fact generally the requirements for a task are in my manager's head. I can get those into a spreadsheet or a flowchart, but never an official diagram. Is UML something teams like this actually use? In all reality, I feel like I learned a lot in school that no one actually does. If so, which diagrams are the most useful/used? From my knowledge, in this project where we are revamping something that exists in the system already from the ground up, I feel like the following would be a good approach:   * Create a quick ER diagram containing any added/updated/used entities in the project.   * Create a _detailed_ use case model, clearly defining and numbering each use case.   * Create a sequence diagram for the complex use cases (as well as their alternate flows) to show exactly what is expected each step of the way. I feel like this would be a good start. We don't really do a good job of capturing requirements currently, we kind of just start coding based on something we drew up on a whiteboard. Obviously this needs to change as well, to avoid getting a week into a project and realize that we forgot something. What are your suggestions/experience? Unfortunately we're sort of flying blind and just don't have anyone experienced enough in these situations to go to. I want the project to be a success, but I can't keep having the vendors (understandably) making mistakes because I assume they know X or Y. How can I utilize them more effectively?


title: Custom HTML Tags: Are there any specifications stating a standard way to handle them?

text: It seems like for years they've just been given default styling and inline display. Is there a spec somewhere that has dictated this? I've looked over the RFC's but I'm not particularly good with RFC-ese, and I didn't notice anything anywhere. For example               <body>        Some content <mycustomtag>something else</mycustomtag> more content.     </body>      I can still style it with CSS, and the browser doesn't outright vomit... so it seems like there is some sort of expected behavior. Was that dictated by a specification?


title: Understanding UML composition better

text: The difference between Composition and Aggregation in UML (and sometimes in programming too) is that with Composition, the lifetime of the objects composing the composite (e.g. an engine and a steering wheel in a car) is dependent on the composite object. While with Aggregation, the lifetime of the objects making up the composite is independent of the composite. However I'm not sure about something related to composition in UML. Say ClassA is composed of an object of ClassB:               class ClassA{         ClassB bInstance;         public ClassA(){             bInstance = new ClassB();         }     }      This is an example of composition, because `bInstance` is dependent on the lifetime of it's enclosing object. However, regarding UML notation - **I'm not sure if I would notate the relationship between ClassA and ClassB with a filled diamond (composition) or a white diamond (aggregation).** This is because while the lifetime of _some_ `ClassB` instances is dependent of `ClassA` instances - there could be `ClassB` instances anywhere else in the program - not only within `ClassA` instances. * * * **The question is:** if **_some_** ClassB objects are composed with ClassA objects (and thus are dependent on the lifetime of the ClassA objects), but **_some are not_** \- would the relationship between the two classes in UML be an aggregation or a composition relationship??


title: Simplifying C++11 optimal parameter passing when a copy is needed

text: It seems to me that in C++11 lots of attention was made to **simplify returning values** from functions and methods, i.e.: with move semantics it's possible to simply return heavy-to-copy but cheap-to-move values (while in C++98/03 the general guideline was to use output parameters via non-const references or pointers), e.g.:               // C++11 style     vector<string> MakeAVeryBigStringList();          // C++98/03 style     void MakeAVeryBigStringList(vector<string>& result);      On the other side, it seems to me that more work should be done on input parameter passing, in particular when **a copy of an input parameter is needed** , e.g. in constructors and setters. My understanding is that the best technique in this case is to use templates and `std::forward<>`, e.g. (following the pattern of this answer on C++11 optimal parameter passing):               class Person     {         std::string m_name;          public:            template <class T,                   class = typename std::enable_if                   <                       std::is_constructible<std::string, T>::value                   >::type>         explicit Person(T&& name)              : m_name(std::forward<T>(name))          {         }              ...     };      A similar code could be written for setters. Frankly, this code seems boilerplate and complex, and doesn't scale up well when there are more parameters (e.g. if a surname attribute is added to the above class). Would it be possible to add a new feature to C++11 to _simplify_ code like this (just like lambdas simplify C++98/03 code with functors in several cases)? I was thinking of a syntax with some special character, like `@` (since introducing a `&&&` in addition to `&&` would be too much typing :) e.g.:               class Person     {         std::string m_name;          public:            /*            Simplified syntax to produce boilerplate code like this:                 template <class T,                   class = typename std::enable_if                   <                       std::is_constructible<std::string, T>::value                   >::type>         */         explicit Person(std::string@ name)              : m_name(name) // implicit std::forward as well          {         }              ...     };      This would be very convenient also for more complex cases involving more parameters, e.g.               Person(std::string@ name, std::string@ surname)         : m_name(name),           m_surname(surname)     {     }      **Would it be possible to add a simplified convenient syntax like this in C++?** What would be the downsides of such a syntax?


title: How can a Java programmer make the most of a new project in C or C++?

text: As a Java programmer, I'm looking to learn either C or C++ by writing a database manager. Obviously, Java shares many idioms with C and C++, but yet both bring vastly different program design challenges. I'm looking to for a way to make this exercise as educational as possible. **What aspects of taking on this project in C or C++ can help me make a decision about which approach will teach me the most, as a Java programmer?** One particular target of this exercise would be at least a subset of the spatial extensions in PostgreSQL. Obvious issues to consider would be goodness of fit of C vs. C++ for:   * modeling concepts of databases in general.   * modeling spatial modeling in particular Another major point would be the degree of expected difference from Java. Would a good, idiomatic design in C++ be enough different from a design in Java to teach new, different concepts, or would it mostly be the same concepts with slightly different syntax? Would a good design in C contain more concepts that were new or different than one in C++?


title: Third-party open-source projects in .NET and Ruby and NIH syndrome

text: The title might seem to be inflammatory, but it's here to catch your eye after all. I'm a professional .NET developer, but I try to follow other platforms as well. With Ruby being all hyped up (mostly due to Rails, I guess) I cannot help but compare the situation in open-source projects in Ruby and .NET. What I personally find interesting is that .NET developers are for the most part severely suffering from the NIH syndrome and are very hesitant to use someone else's code in pretty much any shape or form. Comparing it with Ruby, I see a striking difference. Folks out there have gems literally for every little piece of functionality imaginable. New projects are popping out left and right and generally are heartily welcomed. On the .NET side we have CodePlex which I personally find to be a place where abandoned projects grow old and eventually get abandoned. Now, there certainly are several well-known and maintained projects, but the number of those pales in comparison with that of Ruby. Granted, NIH on the .NET devs part comes mostly from the fact that there are very few quality .NET projects out there, let alone projects that solve their specific needs, but even if there is such a project, it's often frowned upon and is reinvented in-house. So my question is multi-fold:   * Do you find my observations anywhere near being correct?   * If so, what are your thoughts on quality and quantitiy of OSS projects in .NET?   * Again, if you do agree with my thoughts on "NIH in .NET", what do you think is causing it?   * And finally, is it Ruby's feature set & community standpoint (dynamic language, strong focus on testing) that allows for such easy integration of third-party code?


title: Removing dependencies on subclass-specific behavior

text: I have a `Message` class which can contain multiple types of payloads (or sometimes no payload), each derived from a common `Payload` class. However, this becomes problematic because the `Message` class wants to know about the `Payload` subclasses for various reasons such as:   * Checking for `Message` equality              if (message parts besides the payload are equal) {         switch(type) {             case Payload::Type::RESPONSE:                 return *static_cast<ResponsePayload*>(payload.get())                     == *static_cast<ResponsePayload*>(o.payload.get());                 break;                  case Payload::Type::SETUP:                 return *static_cast<SetupPayload*>(payload.get())                     == *static_cast<SetupPayload*>(o.payload.get());                 break;                  ...         }     }        * Deserializing (since the deserialization methods are static because the payloads are immutable)              switch(type) {         case Payload::Type::RESPONSE:             load = ResponsePayload::fromJSON(payloadValue);             break;              case Payload::Type::SETUP:             load = SetupPayload::fromJSON(payloadValue);             break;              ...              case Payload::Type::START:         case Payload::Type::STOP:         case ...:             break; // Load stays null              default:             THROW(Exception, "Error in program logic: we forgot to parse some payload");     }        * Ensuring a `Payload` is attached to a `Message` while constructing it:              switch(type) {         case Payload::Type::RESPONSE:         case Payload::Type::SETUP:         case ...:             ENFORCE(IOException, payload != nullptr, "For this message type, a payload is required.");             break;              case Payload::Type::START:         case Payload::Type::STOP:         case ...:             ENFORCE(IOException, payload == nullptr, "For this message type, the payload should be null");             break;              default:             THROW(Exception, "Error in program logic: we forgot to handle some payload");     }      Alarm bells are going are going off in my head - this violates SOLID like there's no tomorrow and obviously doesn't scale well since I have to add `case` statements every time I add a new payload. Is there a cleaner approach I could take?


title: Why isn't java used as a build language?

text: If Java is a general purpose language, and building a program is something that can be described using the Java language, why isn't this the best way to write build files and instead we use tools like Ant, Maven, and Gradle? Wouldn't that be more straightforward, and also remove the need to learn yet another programming language? (BTW - this question can also be applied to other languages, like C#)


title: How to use namespaces to separate interface from implementation, in c++?

text: As far as I can tell, you can make your interface known to others by providing your .h file. Your .cpp is the implementation. Then they can see the function names, the parameter types, the return type, maybe a description of how to use a function, and maybe what it does in the .h file. Then I read in posts here about using namespaces to separate the interface from the implementation. What does that mean? Doesn't a namespace only let you know that a name exists in that namespace? So please provide an example, I can't find any.


title: Learn HTML5 CSS3 and JavaScript

text: What is best way to learn these technologies which would enable me to understand all the 3 in a combined perspective rather than individually?


title: Which programming frameworks offer good multilingual support?

text: I'm starting a new company, and our software will be a SaaS solution offered to municipalities around the world. Their interface will be web-based. I am trying to figure our which software development frameworks and which software platforms would be able to support a fully multi-lingual system. In this I mean that I need to be able to have the same screens operate in different native languages (including right-to-left), both for display and data-entry. I want to be able to maintain a single application for all languages. I need to be able to add new languages pretty quickly (= no development) once the system is set up.   Since I am starting from scratch, I have the privilege to research and choose in advance, and not force a solution into an existing application.   Also, I have experience in leading development on Java, .NET, C++ and C, so I am open to use any technology that will meet my business needs. I would appreciate recommendations with pros and cons.


title: Question about Java nested classes design decision

text: I was shocked today to discover that this code compiles cleanly in Java:               public class A {       public static class B {          private static void x() {}       }       private static class C {          private /* So, private to what exactly? */ static void x() {}       }       public static void main(String[] args) {         B.x(); C.x();       }     }      It seems Java's private keyword indicates only top-level-class-privacy; which, given the general convention to name Java source files by class, means that Java effectively provides only file-level private visibility, not true private visibility. (The equivalent code in C++ does not compile with a visibility error.) Would anyone be able to explain why Java was designed this way? Or is this just Java's way of telling everyone not to use nested classes? (It certainly hacks in an implementation of a two-way C++ friend relationship, but we already have package-level visibility for that; this seems to make the one-way equivalent impossible. Moreover, it necessitates the compiler creating more hidden accessor methods to circumvent the visibility, and under-the-hood downgrading of nested class visibility control to make all this not error out at runtime. Really, why the trouble?)


title: Promotion or De-motivation

text: I am working as a programmer for last 3 years, recently my company has promoted me as a project manager. Now I am facing resource management issues and I am not comfortable as a manager and I want to continue my profession as a programmer. I have talked to my director to step me back as a programmer but he forced me to continue as a project manager as this is one step ahead from programming. Now suggest me what should I do?


title: Do you actively think about security when coding?

text: When you're coding, do you actively think about your code might be exploited in ways it wasn't originally meant to do and thus gain access to protected information, run commands or something else you wouldn't want your users to do?


title: can a team lead's work ever be done working remotely

text: I am currently a software developer. As a next milestone in my career I am thinking I must establish myself as team leader which leads a small development team in order to meet deliverables, deployments, etc. I've read various post in this site itself which discusses the pros and cons of working from home. But I am not sure if this aspect was quite discussed/debated. I haven't stepped into the team leading role per se, but I would like to know the responsibilities that come with the title, and if (and how) that can be managed while working from home.


title: How do you organize your local development environment?

text: > **Possible Duplicate:**   >  How do you organize your projects folders? I'm interested to learn how everyone keeps their local development projects organized in a logical manner. What do you do to keep your dev projects organized in a manner that allows you to easily find things?


title: Two related, but independent projects -- Two repositories or one?

text: I've made two "complimenting" projects. These two projects are stand alone, but are almost designed to be used together. They are both fairly small projects as well. I'm wanting to host the code on GitHub, but I'm not sure if I should use two repositories or one for this. What do you think I should do?


title: Why is this syntax convention?

text: It says in the book (APress Ganesh / Sharma) about Java 7: > You create a method named `fill()` in the Utilities class with this > declaration: >   >   >     public static <T> void fill(List<T> list, T val) >   > > You declare the generic type parameter `T` in this method. After the > qualifiers `public` and `static`, you put `<T>` and then followed it by > return type, method name, and its parameters. This declaration is different > from generic classes—you give the generic type parameters after the class > name in generic classes. But why `<T>` as in `public static <T>` ? The syntax looks odd and appears nowhere else in the Java language. What does the `<T>` mean in this case and why is it used?


title: Is a PHP array an example of a dynamic data structure?

text: I did my homework, and it says that dynamic data structures are "data structures that change in size as a program needs it to by allocating and de- allocating memory from the heap". So I was wondering, are PHP arrays examples of dynamic data structures, or are they limited to binary trees and double-linked lists? Thanks.


title: Go-like interfaces + multi-methods make sense?

text: Thinking about the design of a potential new language, I wonder how related are the concepts of built a OO similar to GO interfaces and multi-methods (I get this from http://docs.julialang.org/en/latest/manual/methods/). If I understand this right, the interfaces are simply a group of methods that must be implemented by each descendant, and multi-methods provide a nice way to specialize them without do a lot of boilerplate or casting. However, Is my intuition that both could work well together, but wonder if is correct. For example, if a interface declare:               type Animal interface {         Speak() string     }          func (d Dog) Speak() string {         return "Woof!"     }      but in julia is more like:               speak(x::Dog) = return "Woof!";      So this feel like that both do the same, but different. Will be a mess to do both? When could that make sense? Also, what make a "better" path, if only one must be used?


title: What is the applicability of CORS?

text: I have a system which needs to do cross-origin requests and having trouble understanding the relevance of CORS. At first glance it doesn't appear to provide me with any type of security I'd actually want for my service.   1. Since CORS is honoured only on the client side my server must still make zero assumptions about the request. There is no guarantee a request is coming from a browser at all, thus CORS headers cannot be used as access control.   2. The target server decides who is allowed to talk to it, and the origin server has no control. My JavaScript is also not secure on the client and subject to alteration. A malicious server could simply accept all CORS requests and thus all data could leak out of my application. I see only a narrow scope of where CORS is actually helpful. This is the Facebook like scenario. Default cross-origin restrictions prevent a malicious page from making requests to Facebook on behalf of the user. CORS simply allows certain domains to do this. However, I still don't see the value in CORS here because some simple DNS setup would allow the same behaviour. So what I am missing about CORS? In which scenarios is it relevant and advantageous to use (compared to simple DNS CNAME's)?


title: how much memory should android app use

text: We are planning to develop an android application. the application will use API and data transfer will be via SSL. I should write documentation and set functional and system requirements for the appliaction. One of the main requirements is that how much memory should the application use. Of course Android OS manages itself how much memory allocate to it at different satges of its activeness, but a great deal depends on appliaction. Is there any specific defined practice on how much memory should a typical android app use and that it is in use in advanced world of android developement, e.g. the appliaction of X type should use no more that 7 MB if they are active? How to set the requriement so that developers pay enough attention to this specific parameter?


title: MySQL left join + performance

text: SELECT                        *    #Case 1                 cp.* #Case 2                  FROM crawl_page AS cp             LEFT JOIN artist AS a                 ON cp.cpURL LIKE CONCAT('%',a.artistPageID,'/',a.artistPageURL,'%')                  WHERE cpPageType = 'SONGS'                 AND cpPageAdded < (                     SELECT cpCrawlDate                      FROM crawl_page                      WHERE cpURL = 'http://www.example.com/page-52/'                 )                      AND a.artistID IS NULL                    LIMIT 1      In this query when I use 1st case (selecting everything from both tables) time taken for query is fine about 0.468 sec. But if I do case 2 (selecting only from main table) it takes hell much time 26 second. It's not problem just to use case 1, but I can't get the idea how does it work and why? Thanks


title: Mapping values over a curve

text: I have a value between 0 and 8000 and I want this number to resolve to another number between 0 and 2000. I could just divide it by 4 but I have a special need here. For values above 4000 I want the mapped value to be biased towards the 2000. But for values lower than 4000 I want the mapped value to be biased towards 0. This is actually for a game where you are given bonus points between 0 and 2000 depending on how quickly you complete the task. So if you are very fast and do it in 7500 milliseconds you should get 1875 points (exactly 7500 / 4). If you do it in 6000 milliseconds you would get 1450 points (a little under 6000 / 4). If you are slow and do it in 1000 milliseconds you would get 50 milliseconds (well under 1000 / 4). The idea is to reward fast players more than slow players but still let slow players feel like they've achieved something. I feel an "eased-out" value mapping would achieve this. I hope this makes sense. Can you help me figure out some code that achieves this?


title: Fortran 90 - How to create a coordinate system

text: So I need to code a simple program, and I need to define 2D coordinates? Is there any coordinate system I can use in Fortran? I was told it might have to be all in arrays? And if so, can anybody push me in the right direction as to how to set up 2d arrays? Many thanks.


title: Why are reference-counting smart pointers so popular?

text: As I can see, smart pointers are used extensively in many real-world C++ projects. Though some kind of smart pointers are obviously beneficial to support RAII and ownership transfers, there is also a trend of using shared pointers _by default_ , as a way of _"garbage collection"_ , so that the programmer do not have to think about allocation that much. Why are shared pointers more popular than integrating a proper garbage collector like Boehm GC? (Or do you agree at all, that they are more popular than actual GCs?) I know about two advantages of conventional GCs over reference-counting:   * Conventional GC algorithms has no **problem with reference-cycles**.   * Reference-count is generally **slower** than a proper GC. What are the reasons for using reference-counting smart pointers?


title: Job prospects for open source project experience

text: I would like to know whether work experience in Open Source Projects will really brightens the job prospects/resume of a developer other than their day time programming job or doing certifications are more than enough for a developer?


title: Application of LGPL license on a simple algorithm

text: The "scope" of the GNU license is troubling me : I know it has been answered many times ( here, here, ... ) but shouldn't we take into consideration the complexity and originality of a code before using GPL license ? I explain : I'm working on a pet project using the DTW algorithm that I have written in C using the pseudo-code given on the wikipedia page . At one point I decided to change it for a C++ implementation ( just for hone my c++ skill ) . After doing so, I've looked for an existing implementation on the web, to compare the "cleanliness" of it, and I found this one : Vectored DTW implementation, which is part of limproved, a C++ library licensed under GPL v3 . Personnally, I don't mind the GNU license because it is a personnal project, which will never led to any kind of commercial purpose, but **I wonder if this implementation can abide a company using it to open their code** ( and other FOSS permissions ). Theoretically, I think it can ( I may be wrong :p ), but the algorithm in question is so simple (and old) that it should not.


title: Client-Side V.S. Server-Side Searching?

text: I am currently helping to design a web site and application in HTML. We would like the user to be able to search the site/app for desired content via a search bar. We would also like to include an advanced search ability to allow for different search options and more concentrated searches. We are having trouble deciding whether to program the search function on the Client-Side (with JavaScript) or on the Server-Side (with PHP). What are the pros and cons of both and what would you recommend?


title: Computational Complexity of Correlation in Time vs Multiplication in Frequency space

text: I am working with 2d correlation for image processing techniques (pattern recognition etc...). I was wondering if there is a theoretical approach on how to tell when to use multiplication in frequency space over correlation in time space. For sizes of 2x frequency space is obviously faster but how about small, prime sizes like e.g. 11?


title: When learning Android, should I focus on the latest and greatest?

text: I'm a Java developer and I'm going to start working with Android to get familiar with mobile apps. I've worked with Ajax toolkits, but haven't done any mobile development. I've seen a huge change in development on certain toolkits where the learning curve really jumps up, as in GWT 1.5 versus 2.4. I'm just wanting to jump in and get the basics (along with best practices) down for now. I don't know if Android 2 versus version 4 would do that, but version 4 might just throw in extra features that I might not need to know about for now and take away from my main focus. Is it better to go with the latest version of Android or, to make sure the fundamentals are covered, take an older version that would be easier to get in and start developing with?


title: How to Use Subversion Repository Inside Git Repository?

text: I'm developing a project in Git. IT depends on another project, that's in a Subversion repository. I'd like to be able to make changes to the Subversion project in the tree, and commit to/update from the Subversion repository from within the Git project. Is that possible?


title: What to do when request is sent to server and while waiting for response internet connectivity lost?

text: I am sending a huge amount of data to server. Now while I have sent the data and waiting for server response, suddenly my android device gets internet connection lost.   So what I used to do is, showing an alert dialog of connection lost, but at server side the data was already processed and it updated somewhere e.g. on any URL. But my android phone does not know this as it did not get response ever. How to resolve it.   Whether it could be done on server side or on android itself How?   How server would know that android phone is not going to listen the response?   It may be client-server communication optimization perspective.


title: estimation method at the "just finished definition phase"

text: We are basically using Waterfall life cycle methodology. Requirement Analysis: I get a use case created by some one else. Design (talking only about Low level design): I get some little feeling about how would I design it, may be either instantly/ or after some time. Coding+Unit Testing: In case of unit Testing I am not using any TDD, but I am trying to get full code coverage, through mocks and etc. after the coding is done. I am being asked about estimates just after the Requirement walk through. Since I have only a fair amount of idea about how the design will look like, I have no way to say about estimates. As for the coding part is considered, how can I get the total number of methods at the "just finished definition phase" (I never know how much will I be refactoring at this stage), Unit Testing with full code coverage: I haven't written a code, then How can I know how many behaviors are there to test for one method and hence time. Is there some scientific way/ or other way to know this at this stage? **Note:** I have already read this possible similar question. I can break down all my tasks to small units, but I am having problem to give an estimate for each unit. **Edit1** This is part of my problem too it all started from here. Our Organization also unit tested (or correctly saying performed integration testing) manually or through emulators etc. So whenever some enhancements come for a particular client You need to create test data again, and what about any breaking changes You have introduced. So, I introducing Automated Unit Testing, but now there is again a problem for correct estimation which is necessary to give the organization farsighted view of "time estimate of creating a test suite with code" in simple words build to validation team. Kindly help.


title: Very-Loose Coupling and Dependency Injection for Database Management

text: I'm currently setting up a MongoDB database for a web-app. I'm running node.js and using Mongoose to help manage mapping, validation ect. I'm wondering if it's a good idea to really decouple MongoDB from my code, just on the off-chance we want to switch to something like CouchDB a little later. Specifically, I'd make a `databaseManger` module that is responsible for setting up Mongoose/Mongo, defining the mongoose models, managing replica sets, and doing some extra validation. This manager would export a generic API, and handle the details of the queries internally. The manager would then be passed around via dependency injection. Does this make sense? Or am I kind-of redoing some of the mongoose functionality? Any advice is appreciated.


title: Merge two different API calls into One

text: I have two different apps in my django project. One is "comment" and an other one is "files". A comment might save some file attached to it. The current way of creating a comment with attachments is by making two API calls. First one creates an actual comment and replies with the comment ID which serves as foreign key for the Files. Then for each file, a new request is made with the comment ID. Please note that file is a generic app, that can be used with other apps too. What is the cleanest way of making this into one API call? I want to have this as a single API call because I am in a situation where I need to send user an email with all the files as attachment when a comment is made. I know Queueing is the ideal way to do it. But I don't have the liberty to add queing to our stack now. So this was the only way I could think of.


title: Workflow on Development and Production Servers for a Consistently Updating Website

text: We have three developers, one system administrator, and an artist that primarily work on a single website (forum) on our spare time to consistently develop features for the forum (but there are other projects that we work on). Because our system administrator recently joined, we dropped managed hosting for a single server and decided to rent out two unmanaged servers (one for testing and the other for production). In the old server, we simply used Git as a middleman for pushing updates from the non-unified developer team into the server without conflicting updates. Pull other developer updates. Push our own updates. Revert if something breaks. Since we have two servers now, we plan to push updates to the development server and somehow have it push updates to the production server. Developer(s) -> development server (bare) -> production server We want to keep the repositories in the development server and the work tree of the web site on the production server (web server). Is there an efficient way to do this without pushing from the dev server to production? Is there a better workflow for two servers in general? P.S. The development team consists of high school teenagers and some college kids that have never developed on teams for for-profit businesses.


title: Game to decide which team member gets the window seat in a fair way

text: During team formation, we have a conflict where 2 developers both really want the same coveted window seat with a lush view of a creek & the woods. What sort of game / activity can we place them in that will:   1. Decide who gets the seat   2. Provide a random (not skill based) chance of winning   3. Allow both team members to participate in the selection   4. Not be a single player game masquerading as a two player game (drawing straws for example - the outcome is based off of the first player's actions when there's only 2 people)


title: How should I architect a RESTful webservice to use 3rd party (i.e. Google, Facebook, Twitter) for authentication?

text: For my job we have a nice RESTful webservice we've built out that we use to drive a couple websites we have. Basically the webservice lets you create and work with support tickets, and the website is responsible for the front end. Any webservice requests use an auth header which we use to validate the user and their password for each call. This year we're looking to expand our login options so that users on the website can log in via Google, Twitter, and Facebook (possibly others). However I'm having a lot of trouble figure out how to architect this so the webservice can use the 3rd party authentication providers to ensure the users is who they say they are. Is there any best practices out there for how to do this? Currently we're thinking of having the website handle authenticating the users themselves, and then use a new setSessionId call that registers their current session with the webservice back end. Each additional request to the webservice will pass along that sessionId and will validate it. These seems okay, but I have that feeling in the back of my head that I'm not thinking this through and all my forum browsing and reading oauth and openid specs is just confusing me more. Any tips for how to tackle this?


title: Reducing Coupling in a Series of Tasks

text: I am working on some code right now that involves processing user requests. Each request requires going through an approval. When a request is made, one or more records are created on the database recording what the request entails. Then a ticket is created and placed on the approver's work queue. For a typical request, approving it involves these steps:   1. The request is processed (usually resulting in a table getting updated)   2. The changes are recorded to a history table (record auditing).   3. The request is marked as approved by the approver (approval auditing).   4. The ticket is removed from the work queue.   5. The original requester is sent an email telling them their request was approved. We have a single class that kicks off these steps sequentially within a transaction (http://martinfowler.com/eaaCatalog/transactionScript.html). For the most part, the sequence doesn't really matter and the email isn't really essential. The problem is each of these classes has at least 5+ dependencies (in reality, it's closer to 10+). I am stumped about how to reduce the number of dependencies when it comes to a workflow like this. I thought about grouping some of these items together, but there's no logical grouping. I don't see much of a point in creating an unnecessary layer like that, anyway. I also thought about doing some kind of observer pattern (.NET events). A class higher up could listen for the event, instantiate the needed classes and kick them off. However, that "higher-up class" would then be dependent on all of the classes again, so I'd be right back in the same situation. So, the only ways I've been able to think of reducing the number of dependencies is to either do artificial grouping of classes or to just make it the layer above's problem. Neither seem ideal and I wonder if I am missing something. If it helps, I am using Ninject with ASP.NET MVC. I have access to an IOC container (`DependencyResolver`). I am wondering if the solution is some sort of combination between using listeners/events and an IOC container.


title: How to become a passionate programmer?

text: I want to know how to be a `passionate programmer`? What are the things that `someone has to be focus to be a good programmer`?


title: Cloning existing software for commercial purposes - legal implications

text: I have been asked to clone some existing software for a company. Basically its an old 16 bit DOS console app, which was supplied free of charge in I believe the late 80's. Having replaced the machine that needs to run it with a box running Win7 x64 they can't get it to work. It crashes every couple of minutes under DOSbox. The company that supplied it appears to no longer exist - if they did the company asking me to do this would almost certainly know about it. Its undetermined whether they have gone entirely or are just trading under a different name. If the latter they seem to have withdrawn from the market related to this product (because again, niche area, we **should** know about everyone there). What is the status to this with regards to copyright etc.? The main concern for the company involved is they want an identical interface to what they already have so I would have to clone this entirely. Having no source code / indication of the underlying mechanisms these would be written from scratch. Is an interface covered by copyright? / Does that still hold 30 years later? What is the assumed license when none at all is provided? Under UK law would I be under any serious risk were I to take on the project? How would this pan out if I then decided to sell the software on to other companies? Thanks


title: Where does my database schema live in MVC?

text: I'm starting to check in the SQL files for creating/maintaining our database. Previously SQL files were kept totally separate from our codebase's version control. I'd like to pragmatically store my database construction/manipulation files with my other code. Do they make the most sense in a subdirectory of my Models or as a separate directory somewhere? For the most part the SQL statements _are_ the data my Models access, but some other stuff is maintenance scripts ect; stuff that doesn't pragmatically fit into my MVC folder structure.


title: Should I include dependencies for which I have the source as projects in my solution?

text: We have various projects in source control for web and desktop applications. Invariably, many of them use third-party open source projects or even common libraries within our organization as dependencies. Should we include the full projects of these dependencies in our various solutions? Or should we just include the .dll reference (or equivalent compiled binary) and maintain the source for said dependency elsewhere (say, for debugging purposes only)? I'm specifically thinking of .NET projects and solutions in Visual Studio, but feel free to replace those terms with JAR or whatever equivalent in other languages and frameworks. To further specify, I'm asking if a [fictional] Invoice Payments Web App solution tree should look like this:   * InvoicePaymentsWeb   * InvoicePaymentsDataModel   * InvoicePaymentsServices   * RickSoftUltraDataGrid   * MyCompanyCommonWebLib And you could individually compile (or change) the various dependencies since they exist entirely within your solution. As opposed to just having the first three projects, referencing the compiled DLLs of the other two, and having the source for the other two exist elsewhere on your machine (or elsewhere in source control). I'm wondering if this wouldn't potentially fracture the development and/or maintenance of the various dependencies since each solution could have its own specific changes to the source, unless the underlying source control handled sharing the projects internally. What other problems might exist? Would there be any benefit?


title: What's the worst question you were ever asked at interview?

text: It doesn't have to be programming or software development related, but just asked during an interview for an IT related job. I know some "left field" questions are meant to see how the candidate copes with unexpected and novel situations, but here I'm looking for a question that appeared to be completely unrelated to the job they were interviewing you for, or something that made you think "what useful information could they possibly get from my answer to _that_ question?".


title: Interface at the class or function level?

text: I have been falling into a pattern lately where I have been defining routines that rely on an interface defined by a function that is specified as a parameter to the routine. (The language is C#, but this can be applied to any language with first-class functions.) For example, I have an API that exposes CRUD operations against a backing store. In the case of a GET operation on a particular resource, I can generalize the routine into:   * get the resource we are looking for      * return a not found response if resource does not exist     * return the resource if found What I ended up doing is defining a routine that accepts a delegate function for finding the resource. It's this delegate that defines the interface contract. This happens to work well for my situation because the information required to locate the resource can vary. In my case, it's looking up data in a database by keys, but the type and number of keys can vary. I can capture these in a closure in the calling routine and satisfy the delegate function interface. For example:               // Locate a simple record that only has one key     public SimpleRecord GetSimpleRecord(int recordID) {        return getResource(repository => repository.SimpleRecords.Find(recordID));     }          // Locate a complex record that has many keys     public ComplexRecord GetComplexRecord(int recordID, int userID, string token) {        return getResource(repository => repository.ComplexRecords.Find(recordID, userID, token));     }      This work, but seems like is a mix of OOP and functional style programming. If I need more than one delegate passed, it starts to get a bit messy. Some routines that I need everywhere I ended up defining as abstract methods that all sub-classes need to implement. So I have a hybrid. Does this type of technique have a name or pattern that I'm missing? Should the delegates be implemented in a defined class interface that gets passed to the caller? **UPDATE** with more concrete example: I'm trying to adhere to the DRY principal. I'm talking about controllers in a C# Web API application. Each and every request has some commonality which I have implemented in a base controller class:   * Handle all exceptions by returning the correct HTTP status code, (404 for resources that are not found, 201 for created resources, etc.)   * Map database entities to-and-from data transport objects that the client deals with I want to express _what_ to do in this base class, and delegate _how_ to the concreate class. The _how_ ends up being implemented by delegate functions. I may need to get a person from the database, by first name and last name, or a purchase order, by an integer id. In both cases, if the resource is not found, a 404 must be returned. One returns a person, one a purchase order. How to look them up and how to map the data to a client object differs. The base function may look like this:               T getResource<T> (Func<IRepository, T> find) {         T data = find(getRepository());         if (data == null) {             throw new DataNotFoundException();         }         return data;     }      Now, in the person controller and purchase order controller, I don't have to repeat the logic of what do to when the resource is not found--just implement the find delegate. (This is a simple example without mapping, adding, removing or other details that differ resource to resource).               public Person Get(string first, string last) {        return getResource<Person>(repository => repository.People.Find(first, last));     }          public PurchaseOrder Get(int id) {        return getResource<PurchaseOrder>(repository => repository.POs.Find(id));     }      Note how the closures above neatly deal with varying number and types of parameters for finding things, but satisfy the interface defined by the delegate find function. Is this possible to do with standard class interfaces? (And this question is not about the repository. That is resolved with dependency injection and is implemented with Entity Framework.)


title: How can I make my PHP development environment more efficient?

text: I want to start a home-brew pet project in PHP. I've spent some time in my life developing in PHP and I've always felt it was hard to organize the development environment efficiently. In my previous PHP work, I've used a windows desktop machine and a linux server for development. This configuration had it's advantages: it's easy to configure Apache (and it's modules)/PHP/MySql on a linux box, and, at the time, this configuration was the same like on production server. However, I never successfully set up a debug connection between my Eclipse install and X-debug on server. Transferring files from my local workspace to the server was also very annoying (either ftp or Bazaar script moving files from repository to web root). For my new setup, I'm considering installing everything on my local machine. I'm afraid that it will slow down workstation performance (LAMP + Eclipse), and that compatibility problems will kick-in. What would you recommend? Should I develop using two separate machines? On one? Do you have experience using one of above configurations in your work?


title: Using default parameters for 404 error (PHP with mvc design)?

text: I have a custom made Framework (written in PHP). It all works very good, but i have some doubts about a certain thing. Right now when a user call this url for example:               http://host.com/user/edit/12      Which would resolve to:   * user = userController   * edit = editAction() in userController   * 12 = treated as a param But suppose the controller 'userController' doesn't exist. Then i could throw a 404. But on the other hand, the url could also be used as params for the indexController (which is the default controller). So in that case:   * controller = indexController   * user = could be an action in indexController, otherwise treated as a param   * edit = treated as a param   * 12 = treated as a param That is actually how it works right now in my framework. So basically, i never throw a 404. I could ofcourse say that only params can be given if the controller name is explicitly named in the URL. So if i want the above url:               http://host.com/user/edit/12      To be invoked by the indexController, in the indexAction. Then i specifically have to tell what controller and action it uses in the URL. So the URL should become:               http://host.com/index/index/user/edit/12        * index = indexController   * index (2nd one) = the action method   * user = treated as a param   * edit = treated as a param   * 12 = treated as a param That way, when a controller doesn't exist, i don't reroute everything as a param to the index controller and simply throw a 404 error. Now my question is, which one is more preffered? Should i allow both options to be configurable in a config file? Or should i always use one of them. Simply because that's the only and best way to do it?


title: What drawbacks does Java Swing GUI framework have?

text: I have used Java Swing for some desktop applications. But I haven't used other GUI frameworks that much so I can't compare them. There is definitely some things that I like with Swing and some that I don't like, but that is the situation with almost everything. What are the biggest drawbacks with the Java Swing GUI framework?


title: How to compute a signature of a matrix

text: We know some signature/checksum methods for text, like md5,sha. Now, I want to compute a checksum for a matrix, to represent the exact matrix. Say, two matrixes with different sizes, or with different values, have different checksum. And slightly different matrixes(same size) result in slightly different checksum. So, both layout and values should be considered. Although the most intuitive method is to compare two matrixes directly, however, sometimes it's inconvenient to get the two matrixes in the same environment. Maybe I should check the md5 algorithm, and adapt a similar method. Just post it here for better advices.


title: Is licensing required for public repositories?

text: I am planning to start the public repository on github. In this repository I will be sharing code which I will be posting in my blog. I have seen lot of repositories without any license. Is it required to have a license file? Can't I just say "You're free to use this code in whatever way you need"? Please advise


title: What is Object Oriented Programming ill-suited for?

text: In Martin Fowler's book Refactoring, Fowler speaks of how when developers learn something new, they don't consider when it's inappropriate for the job: > Ten years ago it was like that with objects. If someone asked me when not to > use objects, it was hard to answer. [...] It was just that I didn't know > what those limitations were, although I knew what the benefits were. Reading this, it occurred to me I don't know what the limitations or potential disadvantages of Object-Oriented Programming are. What are the limitations of Object Oriented Programming? When should one look at a project and think "OOP is not best suited for this"?


title: Does dealing with legacy code help one evolve as a programmer?

text: I'm a Java developer with a bit more than a year of experience which places me somewhere above a junior, but not among mid-level developers yet. Recently I was offered a long-term project which is about studying an existing banking application code for 4 months and then introducing changes when needed. As a not-so-experienced programmer I'm looking for ways to develop and I wonder what such a project might give. Would you consider dealing with a big and probably not-so-well written application a good practice for a beginner?


title: Embedded Linux Training

text: I have been working with an old `OS9`(not mac) operating system and I have been trying to get my organization to transition to an embedded `Linux` platform. We have money in the budget for training and I figure I would take advantage of it. A secondary impetus would be a good resume addition. What are some good vendors/bootcamps for Embedded Linux training?


title: Multiple entrance points in project

text: My question is related to C++ but it comes from Java actually. When I was programming Java I had multiple classes, which were derived from a base "Test" class. Their purpose was to test things - run tests (unit tests/not unit tests). In order to run a test, I had a `public static void main` in every class. So the matter of running such a test was to click run in _Eclipse/Netbeans_ , whatever good IDE. I know this question maybe IDE dependent, it actually boils down to a makefiles, but is it possible to maintain a similar structure in C++ IDEs? Actually my question is: **how do you deal with tests?** Do you put a huge main method with some switch/enum based statements to run the tests or make different build configurations for each test, or have different solution to this? I know this question won't get a straightforward answer, but I'm curious how to deal with it so I can choose something for myself.


title: User interfaces for C function completion

text: In method call syntax in many object-oriented languages, the receiver object goes to the left of the method name, e.g. `someObject.someMethod()`. This comes in handy when using an IDE with code completion/code assist/Intellisense; when the user types a method call expression, the receiver has already been typed, so the IDE can narrow down its method choices to apply to that receiver (at least in statically-typed languages). What I'm wondering is, what is the user interface for method/function completion like in languages where the method or function name goes _before_ its receiver and/or arguments, e.g. Lisp or C? Does the user have to trigger a hotkey, to which the IDE responds by asking for the receiver and/or arguments, and then once the value is typed in the IDE pops up a list of methods or functions that are applicable to that list?


title: Scrum - how to carry over a partially complete User Story to the next Sprint without skewing the backlog

text: We're using Scrum and occasionally find that we can't quite finish a User Story in the sprint in which it was planned. In true Scrum style, we ship the software anyway and consider including the User Story in the next sprint during the next Sprint Planning session. Given that the User Story we are carrying over is partially complete, how do we estimate for it correctly in the next Sprint Planning session? We have considered: a) Adjusting the number of Story Points down to reflect just the work which remains to complete the User Story. Unfortunately this will mess up reporting the Product Backlog. b) Close the partially-completed User Story and raise a new one to implement the remainder of that feature, which will have fewer Story Points. This will affect our ability to retrospectively see what we didn't complete in that sprint and seems a bit time consuming. c) Not bother with either a or b and continue to guess during Sprint Planning saying things like "Well that User Story may be X story points, but I know it's 95% finished so I'm sure we can fit it in."


title: Netbeans support for struts 2?

text: I have just started learning struts 2. I have purchased the book named Struts 2 in action. But I want to use an IDE for developing Struts 2 applications. I basically use netbeans. Please tell me how can i develop applications using netbeans. Also, it would be great if somebody can point out a few tutorials on the same. regards P.S. I haven't used eclipse. Is it advisable to switch to it for struts 2, (if it is better than netbeans in this case)?


title: Single statement non-braced ifs and code merges

text: I've seen code merges being used as an argument for bracing even single statement ifs. For example:               if (condition) {         do something;     }      Unfortunately I can't think of a change that would break a non-braced version during an automatic code merge. Could someone post an example?


I am tired of hearing people recommend that you should use only one thread per processor, while many programs use up to 100 per process! take for example some common programs               vb.net ide uses about 25 thread when not debugging     System uses about 100     chrome uses about 19     Avira uses more than about 50      Any time I post a thread related question, I am reminded almost every time that I should not use more that one thread per processor, and all the programs I mention above are ruining on my system with a single processor. What constitutes proper use of threads in programming? Please make general comment, but I'd prefer .NET framework thanks


title: Is the Glade GUI designer a good option for a beginner?

text: I am a student of Computer Science and I already have basic programming experience in Python 2.x, 3.x, C++, and HTML. I never made a program with a GUI. I have just programmed games, scripts/plugins, and console applications. First time developers in Ubuntu are recommended to use the GUI designer Glade, which creates GUIs for the GTK toolkit. They are also recommended to program in the Qt framework. I intend to create a cross-platform application (Linux/Windows/Android/iOS/OSX). Given my experience, is Glade a reasonable option for me to use in order to create a cross-platform application, especially in my first application that needs a GUI?


title: Static DataTable or DataSet in a class - bad idea?

text: I have several instances of a class. Each instance stores data in a common database. So, I thought "I'll make the `DataTable table` field static, that way every instance can just add/modify rows to its own `table` field, but all the data will actually be in one place!" However, apparently it's a bad idea to do use static fields, _especially_ if it's databases: Don't Use "Static" in C#? Is this a bad idea? Will I run into problems later on if I use it? This is a small project so I can accept no testing as a compromise if that is the only drawback. The benefit of using a static database is that there can be many objects of type `MyClass`, but only one table they all talk to, so a static field seems to be an implementation of exactly this, while keeping syntax concise. I don't see why I shouldn't use a static field (although I wouldn't really know) but if I had to, the best alternative I can think of is creating one `DataTable`, and passing a reference to it when creating each instance of `MyClass`, perhaps as a constructor parameter. But is this really an improvement? It seems less intuitive than a static field.


title: Use of interfaces to ease rapid development/prototypes

text: Recently I've started to put almost all of my data structures into interfaces, and many of the classes that contain pieces of logic code as well, depending on how much work they are. I find that this makes development of applications much easier because I can easily swap out parts of my code when they do not work as well as intended without changing the rest of the application and swap them back in when I have corrected them, or if I need something simpler for the time being. I was wondering if I'm developing a bad habit here. Is this a anti-pattern I'm using here, or is it okay to do this?


title: how can we have a person to allot and track tasks in agile development

text: I understand that Agile team should be self organized and self driven, but is there a provision that I can have someone who will allot tasks to developers and ensure that all user stories will be completed on time?? For example if there are two persons in an agile team who are not self motivated to take up tasks and they will work only when task is assigned to them with a deadline, how can we deal this in Agile? The problem I face is that no one is fixing the deadlines for the tasks and the team is under delivering for the last two sprints. It will be better if we can have someone who can fix deadlines. IS there a provision for this in Agile


title: Automated object creation from user input

text: I am working on a command-line application that runs simulations. It has to be heavily configurable; the user should be able to provide a very large number (100+) of parameters, some mandatory and some optional. Obviously, these parameters will be used by a variety of classes in the application. I can see two approaches I can use; which one is a better design in the long run? **Approach 1** Have the (text) input file directly control object creation in the application. For example, user would provide the following input:               root=Simulation       time=50       local_species=Sentient         strength=3.5         intelligence=7.1       invading_species=Primitive         strength=5.1         sociability=2.6      The application would then recursively create objects of the class specified on the rhs of the equal sign, passing the class' constructor the arguments provided in the relevant sub-branch of the input file, if any. I'm using Python, which supports keyword arguments and default argument values when no argument is provided, but I hope the question isn't terribly language- specific. For example line 1 would tell the app to create an object of `class Simulation`, with three constructor arguments. The first constructor argument is `time=50`. The second argument is an instance of `class Sentient`, which is created by passing `Simulation`'s constructor arguments `strength=3.5`, `intelligence=7.1`. The third argument is an instance of `class Primitive`, which is created with by passing the constructor arguments `strength=5.1`, `sociability=2.6`. The whole object creation is handled automatically, with just a few lines of (recursive) code. The highest-level object (instance of `Simulation` in this case) would be passed to the visualization layer. **Approach 2** The input file still looks the same. However, the application's classes now have full control over how they interpret user input. The lhs and rhs values may or may not correspond to keyword parameters and classes. For example, the above input may result in the application creating an instance of `class InvasionSimulation` with arguments `strength_local=3.5`, `intelligence_local=7.1`, `strength_invading=5.1`, `sociability_invading=2.6`, and then calling its method `set_runtime(time=50)`, before passing the object to the visualization layer. * * * One obvious advantage of approach 2 is that the user's input can remain stable even as the application is completely redesigned internally. But I think there's nothing wrong with designating a subset of classes as "public API", and therefore ensuring that it doesn't change in the future, is there? On the other hand, if the application internally follows something quite similar to approach 1 anyway, it feels that approach 2 requires adding a lot of redundant code: instead of automatically interpreting user input, we now need to do it "by hand" for each class. Any additional considerations would be much appreciated. Are there any names for these approaches that I can search for?


title: What to do when a project is too difficult to continue developing?

text: As a developer, can you tell your project manager that an application is _unworkable_? Or, if you're a project manager, how would you need this presented to you in order to be compelled? This isn't about "how to work on a poor project", it's assuming you cannot. I can provide an example of the situation if anyone thinks it's important, but I'm trying to avoid proposed solutions to "plodding through".


title: Is there any point in writing a random tester for code that deals with inductive data structures?

text: Let's say we're writing a simple JSON parser and we've fully covered the code with unit tests:   * it can parse primitives `"0", "123", "-456", '""', '"asd"', true, false`   * it can parse arrays `"[]", "[1, 2, 3]"`   * it can parse nested arrays `"[[]]"`   * it can parse objects `"{}", '{ "a": 1, "b": 2 }'`   * it can parse nested objects `'{ "a": {} }'` Every possible JSON can be either a primitive or an array/object holding other primitives/arrays/objects - this is what I mean by inductive data structure (is 'recursive' a better term?). It seems to me that any JSON parsing can be reduced to these few cases and if the parser passes these tests then it is fully correct (unless it was explicitly hard-wired to break when you try to parse special numbers). Is there still any point in creating a random tester that generates random stringified JSON in hope that one of them will break this parser? Would this random tester find anything interesting? P.S. I chose JSON just as an example of an inductive data structure; I'm not interested in writing a JSON parser.


title: Can I be forced to continue project which is outside my job duties?

text: I am a DBA / Report Writer in client support for a software company. Starting in my spare time, I wrote a reporting web application with live reports. The ca 2001 IE only site was horrific. My application eventually became a huge success with clients and was subsequently swallowed by dev. I think it was assumed that I would fail and I was told it would never be part of dev; it will always be a support project. Naturally, after such success, they wanted it. They assumed control, demanded I stop working on improvements, and started giving me tasks to "stabilize" it. I went from architect / designer / sole developer to code monkey. I have zero input anymore. It was fun to do, but that fun has left the building. I want to continue working on it, but my way. My way is why they have it in the first place, so it must work. Now I'm stuck in an AGILE loop. I don't see them giving back control so I want to stop. I'm not a developer or even work in that department. Can they force me to continue?


title: Domino Solitaire Algorithm

text: **Problem Statement -** ![Problem Statement](http://i.stack.imgur.com/F6HJC.png) Given a 2xN grid of numbers, the task is to find the most profitable tiling combination (each tile covers 2x1 cells; vertically or horizontally) covering all tiles. I thought of approaching it in the greedy way, enqueuing the max possible for any cell, but it has a fallback that a low-profit choice at i, could yield a greater profit at i+n tiles. So what should be the approach? EDIT - Test Data Range - N<=105 Source - INOI 2008 Q Paper **UPDATE** \- Working out the plausibility of a Dynamic programming Approach. **UPDATE 2** \- Worked out an answer using DP.


title: C++ Design: Functional Programming vs OOP

text: **Design Question** Recently, I've been doing more and more FP in C++, mostly in the form of function templates and lambdas, and heavy overloading of a single function name. I really like FP for some well-defined operations, but I've also noticed that as with OOP, one could easily fall into anti-patterns of spaghetti-code if one isn't careful (eg circular dependencies, which is a bigger issue for state-based code). _My question is, when thinking about adding new functionality, how do you decide between using a FP-paradigm or a OOP-paradigm?_ I'm sensing it may have to do with identifying the **invariants** in the problem or in the design, but I'm not sure. For example, without an OOP model/simplification of the real world, it may not be immediately obvious what a Dog or a Cat class is (what are its states? what are its methods?). Otoh, from a FP POV, a Eat() function simply allows an Animal to turn Food into Poop and Energy. It's harder to imagine Eat() being anything else (for me, at least). I'm looking more for C++ answers, but this question could apply to any sub- module in any language that can handle multiple paradigms.


title: Cumulative charts within Webdesign

text: A rather simple question here, With regards to web design and the paperwork behind it (Which I am sure many people/companies don't actually do). Would there be any reason for using a Cumulative Chart? Specifically a Cumulative Resource chart, although I am unsure what the resources could even be! More to the point, there are a few ideas I have been thinking of, unsure of whether they are valid or not I have come to the guys behind programming a website! tl;dr : If it is possible, what can I make a cumulative resource chart for in relation to a website?


title: In what situations do mutually dependent modules have an advantage?

text: Earlier today I created two mutually dependent, implicitly linked DLLs just to see if this was possible: http://i.imgur.com/GMACpnC.jpg I am just curious; in general, what advantages might this kind of mutual dependency have?


title: Is this interview question real or a communication skills test?

text: I've been to about 50 interviews in my life. Many of them I've done just to get experience, and keep doing. The question I keep hearing again and again is > Are you more a front-end or a back-end developer? I program mostly for the web, but 2-3 years ago I was database developer, and even wrote a desktop app. And if I remember correctly, I heard this question at interviews that had nothing to do with the web. I can't remember exactly what I was answering. IIRC, usually I would say: it's hard to tell and that I had programmed an application X, Y and Z, and W. Last time I started answering and then said _"Wait, how do **you** define backend?"_ Now, does this question, whether I'm better at frontend or backend programming, really make sense nowadays?   * a website has a front end, true. But it's backend is usually the admin website. There's little difference between them.   * if I write a DB driver for a Django-driven website, is it really a front end thing? I remember at some interview I asked what are front and back ends, and got an answer that front end is for clients and used or visited a lot, and back end is something for internal use. Well, it makes no big difference. Things must work and work efficiently on both sides. I also led a dozen of interviews myself, and have never made this question, because it makes no sense and doesn't come to my mind. Is this just a test whether I jump into the hoop and start speaking or if I try to clarify the question?


title: Is Ant still in the "mainstream" for Java builds?

text: We have been slowly replacing batch command files (windows .bat) which were simply jarring up the classes compiled in the developers IDE, with more comprehensive Ant builds (i.e. get from CVS, clean compile, jar, archive, email, etc.) I've spent a lot of time learning (and debugging issues) with Ant, so I'm most comfortable using it for these tasks. But I wonder if Ant is still in as wide usage as it was when I first started learning, or whether "the world has moved on" to something newer (and maybe slicker). (I've started to see more Maven build stuff distributed, which I've never used, for example.) The practical import of this question, is **whether I push new developers to learn Ant** , or whether they should be learning something else for builds? I'm never too on top of the trends, so it would be great to hear from other Java developers what they think is the best build tool, and what they think new developers should be learning.


title: Include all php files in one file and include that file in every page if we're using hiphop?

text: I understand that in normal php if we're including a file we're merging the source of it in the script and it would take longer for that page to be parsed/processed but if we're using HipHop shouldn't it be ok to just create one single php file and include every file in it (that contains some class) and every page which needs those classes (in separate file each) can just include one single php file? Would this be ok in presence of HipHop?


title: Is it a good idea to write an OS in a scripting language?

text: Is it a good idea to create an OS that's written in a scripting language? For example, how about creating an OS using Python?


title: Help me construct a list of best approaches for new C and C++ developers

text: Not specific code writing practices. Please also include reasoning. My start:   * use `GCC` or `Clang`     * gcc because it is unchallenged in the amount of static checking it can do (both against standards and general errors)     * clang cause it has such pretty and meaningful error messages   * when compiling C code using GCC use `-Wall -Wextra -Wwrite-strings -Werror`     * in 99,99% the warning is a valid error   * when compiling C++ code using GCC use `-Wall -Wextra -Weffc++ -Werror`     * you could skip `-Weffc++` (cause it can be confusing)   * always code against a standard C (C89, C99), C++ (C++98, C++0x)      * while compilers change, standards don't, coding against a standard gives at least some level of assurance that the code will also compile in the next version of the compiler or even a different compiler/platform   * make sure that the compiler checks your code against standard (`-std=c99 -pedantic` for C99, `-std=ansi -pedantic` for C++98 in GCC)      * cause automatic checking always good   * use `valgrind` or a similar tool to check for runtime errors (memory, threads, ...)      * free bug catching   * never duplicate functionality of the standard libraries (if there is a bug in your compiler, make a temporary patch, wrapper, ...)      * there is no chance that your code will be better then the code maintained by hundreds of people and tested by tenths of thousands   * make sure that you actually fix all bugs that are reported by automatic tools (GCC, valgrind)      * the errors might not cause your program to crash now, but they will   * never follow recommendations that include "never use feature X"      * such recommendations are usually outdated, exaggerated or oversimplified


title: How should I restart a career in software development after a 7 year gap?

text: I am a graduate in electronics, and I worked in the analog electronics field for around 4 years, but now I have a gap of about 7 years in my career. What are my options to restart my career? Can anyone suggest some refresher courses to enter the software field?


title: What should be on your "Going Live Day" checklist?

text: Aside from the technical specifics, what should be on your checklist for when you go live with a program? **Are there last minute things you can do to make a piece of software go into production smoothly?** (assuming you used sound principles in development and tested the average amount) More testing? Discussion with the client? Last minute optimizations?


title: Is it feasible and useful to auto-generate some code of unit tests?

text: Earlier today I have come up with an idea, based upon a particular real use case, which I would want to have checked for feasability and usefulness. This question will feature a fair chunk of Java code, but can be applied to all languages running inside a VM, and maybe even outside. While there is real code, it uses nothing language-specific, so please read it mostly as pseudo code. **The idea**   Make unit testing less cumbersome by adding in some ways to autogenerate code based on **human** interaction with the codebase. I understand this goes against the principle of TDD, but I don't think anyone ever proved that doing TDD is better over first creating code and then immediatly therafter the tests. This may even be adapted to be fit into TDD, but that is not my current goal. To show how it is intended to be used, I'll copy one of my classes here, for which I need to make unit tests.               public class PutMonsterOnFieldAction implements PlayerAction {         private final int handCardIndex;         private final int fieldMonsterIndex;              public PutMonsterOnFieldAction(final int handCardIndex, final int fieldMonsterIndex) {             this.handCardIndex = Arguments.requirePositiveOrZero(handCardIndex, "handCardIndex");             this.fieldMonsterIndex = Arguments.requirePositiveOrZero(fieldMonsterIndex, "fieldCardIndex");         }              @Override         public boolean isActionAllowed(final Player player) {             Objects.requireNonNull(player, "player");             Hand hand = player.getHand();             Field field = player.getField();             if (handCardIndex >= hand.getCapacity()) {                 return false;             }             if (fieldMonsterIndex >= field.getMonsterCapacity()) {                 return false;             }             if (field.hasMonster(fieldMonsterIndex)) {                 return false;             }             if (!(hand.get(handCardIndex) instanceof MonsterCard)) {                 return false;             }             return true;         }              @Override         public void performAction(final Player player) {             Objects.requireNonNull(player);             if (!isActionAllowed(player)) {                 throw new PlayerActionNotAllowedException();             }             Hand hand = player.getHand();             Field field = player.getField();             field.setMonster(fieldMonsterIndex, (MonsterCard)hand.play(handCardIndex));         }     }      We can observe the need for the following tests:   * Constructor test with valid input   * Constructor test with invalid inputs   * `isActionAllowed` test with valid input   * `isActionAllowed` test with invalid inputs   * `performAction` test with valid input   * `performAction` test with invalid inputs My idea mainly focuses on the `isActionAllowed` test with invalid inputs. Writing these tests is not fun, you need to ensure a number of conditions and you check whether it really returns `false`, this can be extended to `performAction`, where an exception needs to be thrown in that case. **The goal of my idea** is to generate those tests, by indicating (through GUI of IDE hopefully) that you want to generate tests based on a specific branch. **The implementation by example**   1. User clicks on "Generate code for branch `if (handCardIndex >= hand.getCapacity())`".   2. Now the tool needs to find a case where that holds. (I haven't added the relevant code as that may clutter the post ultimately)   3. To invalidate the branch, the tool needs to find a `handCardIndex` and `hand.getCapacity()` such that the condition `>=` holds.   4. It needs to construct a `Player` with a `Hand` that has a capacity of at least 1.   5. It notices that the `capacity` _private int_ of `Hand` needs to be at least 1.   6. It searches for ways to set it to 1. Fortunately it finds a constructor that takes the `capacity` as an argument. It uses 1 for this.   7. Some more work needs to be done to succesfully construct a `Player` instance, involving the creation of objects that have constraints that can be seen by inspecting the source code.   8. It has found the `hand` with the least capacity possible and is able to construct it.   9. Now to invalidate the test it will need to set `handCardIndex = 1`.   10. It constructs the test and asserts it to be false (the returned value of the branch) **What does the tool need to work?**   In order to function properly, it will need the ability to scan through all source code (including JDK code) to figure out all constraints. Optionally this could be done through the javadoc, but that is not always used to indicate all constraints. It could also do _some_ trial and error, but it pretty much stops if you cannot attach source code to compiled classes. Then it needs some basic knowledge of what the _primitive_ types are, including arrays. And it needs to be able to construct some form of "modification trees". The tool knows that it needs to change a certain variable to a different value in order to get the correct testcase. Hence it will need to list all possible ways to change it, without using reflection obviously. What this tool will not replace is the need to create tailored unit tests that tests all kinds of conditions when a certain method actually works. It is purely to be used to test methods when they invalidate constraints. **My questions** :   * Is creating such a tool _feasible_? Would it ever work, or are there some obvious problems?   * Would such a tool be _useful_? Is it even useful to automatically generate these testcases at all? Could it be extended to do even more useful things?   * Does, by chance, such a project already exist and would I be reinventing the wheel? If not proven useful, but still possible to make such thing, I will still consider it for fun. If it's considered useful, then I _might_ make an open source project for it depending on the time. For people searching more background information about the used `Player` and `Hand` classes in my example, please refer to this repository. At the time of writing the `PutMonsterOnFieldAction` has not been uploaded to the repo yet, but this will be done once I'm done with the unit tests.


title: What are the steps to grouping related classes into packages

text: What are the steps needed to be taken to group related classes into packages in Java? In my case, I have about a number of .java files that I'd like to group into 3 packages according to the MVC pattern. One package for Model classes, one package for View classes and one package for Controller classes. I've identified which belong in what package, but not sure of the next step. I want to know how to seperate them into packages, do I make 3 folders and place the .java files in the folder that represents the package they belong in?


title: How to unit test models in MVC / MVR app?

text: I'm building a node.js web app and am trying to do so for the first time in a test driven fashion. I'm using nodeunit for testing, which I find allows me to write tests quickly and painlessly. In this particular app, the heavy lifting primarily involves translating SQL data into complex Javascript object and serving them to the front-end via json. Likewise, the app also spends a great deal of code validating and translating complex, multidimensional Javascript objects it receives from the front-end into SQL rows. Hence I have used a fat model design for the app -- most of the real code resides in the models, where the data translation happens. What's the best approach to test such models with unit tests? I mean in particular the methods that have create javascript objects from the SQL rows and serve them to the front-end. Right now what I'm doing is making particular requests of my models with the unit tests and checking the returned data for all of the fields that should be there. However I have a suspicion that this is not the most robust kind of testing I could be doing. My current testing design also means I have to package my app code with some dummy data so that my tests can anticipate the kind of data that the app _should_ be returning when tests run. ## UPDATED QUESTION: Specific question: ### Does it make sense to inject a testing layer between my model and my database? Or would it be better to let the models work on a real database with pre-defined test data inserted into it? The second option I imagine will probably result in more accurate testing, but the first model seems more versatile in terms of granularity and makes the testing and development more portable (no db required)


title: Why must essential mutable derived data have an inverse function?

text: I was reading the paper Out of the Tar Pit authored by Ben Moseley and Peter Marks when I came across the following section on page 25 regarding essential mutable derived data: > ### Essential Derived Data — Mutable > > As with immutable essential derived data, this can be excluded (and the data > re-derived on demand) and hence corresponds to _accidental state_. > > Mutability of derived data makes sense only where the function (logic) used > to derive the data has an inverse (otherwise — given its mutability — the > data cannot be considered _derived_ on an ongoing basis, and it is > effectively _input_ ). An inverse often exists where the derived data > represents simple restructurings of the input data. In this situation > modifications to the data can simply be treated identically to the > corresponding modifications to the existing _essential state_. I don't understand why essential mutable derived data must have an inverse function. For example consider the following JavaScript code:               inputbox.onchange = function () {         outputbox.value = md5(inputbox.value);     };      Here `inputbox.value` is _input_ to the system and `outputbox.value` is the essential mutable derived data. It is derived from `inputbox.value` using the `md5` function. However the `md5` function doesn't have an inverse. Nevertheless `inputbox.value` is still essential, mutable and derived. So what do the authors actually mean when they say that "mutability of derived data makes sense only where the function (logic) used to derive the data has an inverse (otherwise — given its mutability — the data cannot be considered _derived_ on an ongoing basis, and it is effectively _input_ )"? Do you have any examples to elucidate their point?


title: How do I learn Python from zero to web development?

text: I am looking into learning Python for web development. Assuming I already have some basic web development experience with Java (JSP/Servlets), I'm already familiar with web design (HTML, CSS, JS), basic programming concepts and that I am completely new to Python, how do I go about learning Python in a structured manner that will eventually lead me to web development with Python and Django? I'm not in a hurry to make web applications in Python so I really want to learn it thoroughly so as not to leave any gaps in my knowledge of the technologies involving web development in Python. Are there any books, resource or techniques to help me in my endeavor? In what order should I do/read them? **UPDATE:** When I say learning in a structured manner, I mean starting out from the basics then learning the advanced stuff without leaving some of the important details/features that Python has to offer. I want to know how to apply the things that I already know in programming to Python.


title: What goes within the Architecture Overview of a Design Specification?

text: I have designed an management system for a medical practice and I am writing the design specification and I am kind of stumped by what to write for a section. It asks for me to write about the components of a system but I am perplexed. What exactly are components within a system? Is this generally considered as the features that a system has or does it mean something else altogether?


title: What does 'opinionated software' really mean?

text: I've seen a lot of other framework/library developers throw the phrase 'we write opinionated software' around, but in practical terms, what does that really mean? Does it mean that the author of the 'Opinionated Framework X' says that because they write code a certain way, you should be writing the same type of code that they write? Isn't that a bit pretentious?


These days is it required to test a desktop website for IE6 and IE7? Or is IE8 and IE9 enough? I heard that IE8 has replaced IE7.


title: Escaping strings in database layer

text: Can escaping functions (e.g. mysql_real_esacpe_string ) be moved down to the database layer where we would loop through all parameters passed for all queries and escape all strings. Would that be a good design?


title: In what area is LISP's macro better than Ruby's "ability" to create DSL

text: One of things that makes Ruby shine is the ability to create Domain Specific Languages better, like   * Sinatra   * Rspec   * Rake   * Ruby on Rails' ActiveRecord Though one can duplicate these libraries in LISP through macro, I think Ruby's implementation is more elegant. Nonetheless, I think there are cases that LISP's macro can be better than Ruby's, though I could not think of one. So, in what area is LISP's macro better than Ruby's "ability" to create DSL, if any? **update** I've asked this because modern programming languages are approaching the LISP singularity, like   * C got macro expansion preprocessor, though very primitive and prone to error   * C# has attributes, though this is a read-only, exposed through reflection   * Python added decorator, that can modify the behavior of the function (and class for v 3.0), though feels quite limited.   * Ruby TMTOWTDI that makes elegant DSL, if care is applied, but in Ruby way.  I was wondering if LISP's macro is only applicable to special cases and that the other programming language features are powerful enough to raise the abstraction to meet the challenges today in software development.