title: Domain Driven Design with an EAV database model

text: How can one apply DDD to a EAV database model? Consider this EAV database model: ![enter image description here](http://i.stack.imgur.com/yVT7q.png) How am I supposed to build a domain model if all my entities and their attributes will be stored in the database? **UPDATE** To help clarify the question I'll give an example. If I'm building a **Store** that is going to sell some **Products** then I'll have 2 entities in my domain model corresponding to them. Now my `Product` entity will normally have a fixed number of attributes (ex: `Product_name`, `sku`, `weight`, etc...). However, in a EAV model entities have a variable number of attributes. How should I write a model for `Product` if each concrete instance of it will have a different number of attributes?


title: Does C# experience translate well to C++?

text: My programming classes in school were C++, but I ended up working a job doing C# for the last few years. If there was a position that required say 1 or 2 years experience in C++, would my experience in C# be worthy of consideration? How effective could I be in such a position? So do I need to start out as an entry-level C++ programmer to gain the necessary experience?


title: Which style is better to check and log the error?

text: I have read some code and here are two ways to check and log the error in cpp code that repeats in my project many times. Which way is better? 1.               bool AClass::myMethod()     {          if (!SomeCondition())          {              Warning("AClass::myMethod: your description");              return false;          }         doSomthing();         return true;     }      2.               bool AClass::myMethod()     {         if (SomeCondition())         {             doSomething();         }         else         {             Warning("AClass::myMethod： your description");             return false;         }         return true;     }


title: Real world usage of DelayQueue

text: What would be a real world usage of DelayQueue, what common problem it was designed to solve?


title: Antonym to "cross-functional team"

text: What is a widespread antonym to "cross-functional team"?


title: Why would I need a Git Repository?

text: I'm a beginning developer setting up a project in Xcode 4.3 and I'm wondering under what circumstances I would need to check the "Create local git repository for this project" box. Thank you!


title: What Use Cases are Appropriate for JScript.NET?

text: In this Stack Overflow question: http://stackoverflow.com/questions/9471332 I learned that Jscript is not dead after all. Yay! But what is JScript.NET good for? According to this article, you can use it to provide C# with an Eval function. That's neat, but it seems like kind of an edge case. If you were after first-class scripting capability, doesn't PowerShell fit the bill?


title: Scrum: Handling lack of motivation

text: According to this, "Scrum highly relies on a highly motivated, closely collaborating, cross-functional and self-organized teams." So how do you handle co-workers who may not be as motivated to take ownership of the code? How do you get someone interested in taking ownership?


title: Are there any practical uses of allowing recursive inclusion of a file?

text: I am currently implementing NASM-like preprocessor for my assembler, and I am wondering what is the correct way of handling recursively included files. From what I see, there are two ways to deal with it without hanging the preprocessor or even the OS:   1. Set maximum include depth.   2. Disallow including a file recursively (not to be confused with disallowing including a file _twice_ ). Also, as far as I can see, the second approach does essentially the same job, but produces nicer error messages. Compare output of Clang, when compiling file containing `#include "main.cpp"` only:               In file included from main.cpp:1:     [ repeated many times ]     In file included from main.cpp:1:     main.cpp:1:10: error: #include nested too deeply     #include "main.cpp"      with this (current way of handling this in my preprocessor; input is similar to above, does `%include "1.mov.asm"` at line 6):               In file /home/griwes/projects/reaverasm/tests/1.mov.asm in line 6:     Error: file `/home/griwes/projects/reaverasm/tests/1.mov.asm` included recursively.      The approach disallowing recursive inclusion produces - IMHO - more readable output. The question is: **is there any preprocessor technique that would be killed by disallowing recursive inclusion?** This question is language-agnostic, so feel free to give examples from any languages.


title: Exclude the zero in the given data in Haskell

text: I have a list of integers. Also, I have a function which returns True when the element is non-zero, and returns False when the element is zero (let's call it FUNCTION1). So, how to define another function (using FUNCTION1), which will give us a new list and only include the non-empty elements? For example, we have [1,2,3,0,6,0], and we want [1,2,3,6]


title: Good ways to jump to a particular state in a yielding stateful function?

text: I'm working on some embedded code using C. Various pieces of functionality need non-blocking stateful functions, which are mostly implemented using a switch on various states. For example, a modem connection manager (pseudo- code):               void manage_connection(void) {         static states state = IDLE;         switch (state) {             case IDLE:                 if (connection_requested()) state = BACKOFF;                 break;             case BACKOFF:                 if (random_delay_timeout()) {                     do_connect();                     state = CONNECTED;                 }                 break;             case CONNECTED:                 result = send_data();                 if (result == DATA_SENT) {                     state = IDLE;                 } else if (result == ERROR) {                     // Go straight to backoff state and connect ASAP                     state = BACKOFF;                 }                 break;         }     }      State machines are nasty at the best of times, so I've started to move to a different paradigm using coroutine-style functions, using a "yield" statement. Of course, C doesn't provide a "yield" statement, but I'm using protothreads to achieve this. Protothreads is great, and gives me exactly what I want to implement the above non-blocking state machine in a structured-programming style. The above function roughly translates to (pseudo-code):               void manage_connection(void) {         WAIT_UNTIL(connection_requested()); // or, while(!condition) yield;         WAIT_UNTIL(random_delay_timeout());         do_connect();         WAIT_UNTIL((result = send_data()));              if (result == DATA_SENT) {             // RESTART starts from top. It is part of the protothreads API.             RESTART();         } else if (result == ERROR) {             // This is the part which doesn't translate so well.             // Could use an ugly goto:             goto backoff;             // Or similar alternatives, none of which scale well:             // - Set a flag to skip the states I don't want, and RESTART();             // - Use while loops or other control logic to branch appropriately.         }     }      As you can see, the protothreads version is, on the whole, much clearer & simpler in terms of the flow of logic (once you learn how protothreads work, and look past some very minor boilerplate which I haven't included in the example). But jumping to a particular state in a state machine is a common pattern that I'm come across, which the state machine version handles elegantly, but the procedural version does not. Of course, that's why the procedural version is less bug-prone and clearer -- because you _can't_ jump all over the place on a whim (except for goto, which I'd like to avoid for the usual reasons). However, when you have a good reason to want to jump, it adds significant bug- prone lack of clarity to what is otherwise a very straightforward function. Obviously there are plenty ways to achieve the necessary functionality, but none of them scale well to more than a few states. Bear in mind this is the simplest possible example -- my real-world functions fill half a screen. What are some ways to solve this problem in a way that doesn't muddy the otherwise-lucid flow of logic?


title: Is there any scenario where it's useful to keep mutable properties cached in domain objects for anything else than informational purposes?

text: Usually in a domain model, you'll have objects, and those objects will have properties that are mutable and properties that are immutable - for instance, a instance id/name will be immutable, while some other properties (specially properties that depend on relationships with other objects) can vary in the lifetime of an object So, in the usual scenario where multiple clients are accessing the same data store, your ORM tool will usually model columns as properties and relationships as lists, in the mutual understanding that any mutable property might be outdated in the client - that is, they only represent caches of the values of the properties. However, in many circumstances, one wants to do an operation that might require the actual state of the mutable properties, otherwise the operation might fail or produce data corruption, so in those cases you'll attempt a lock in the row in question, and if the row has already changed then you cancel or abort. In any case, the operation is done off the client application. At some point I have to ask a question (oddly enough, its turning out to be surprising hard!), so I guess the question would be: **is there any scenario where it's useful to keep mutable properties cached in domain objects for anything else than informational purposes?** After all, if there are relationships that we care for, say we want to traverse the neighbours of some object, we'll want to do that with their real (not cached) states, which would involve a database transaction, or some other means to do the process atomically (maybe map reduce?).


title: To reorganize code, what to choose between library and service?

text: I want to reorganize a large application with lot of code duplication into multiple components. Plus, some code is also duplicated over other applications. The common set of functionality that can be taken out of main application is clearly defined. Now, do I write a library or do I write a service for this functionality; so that all such applications continue to work and there is only one code-base (of common functionality) to maintain ?


title: Looking for good testing in multithreaded C or C++ open source projects

text: I have read a lot about the importance of unit testing, and testing in general. In particular I have read about TDD which, in theory, seems like a good way to ensure effective test coverage for a project. However, when I look at open source projects, or code that is available as open source, I am having difficulty finding good examples of testing in real projects that I can learn from. In particular I haven't seen much in the way of unit testing (at least not that I can understand). For example I just downloaded the source code for the Java HotSpot JVM. I thought it would be very useful for me to look at and learn from because a JVM (written in C or C++) will have to deal with many complex issues associated with multithreading and low-level system interaction. Which are the very same things that I'm having difficulty in figuring out how to develop unit tests for. But unfortunately it seems like the amount of code written specifically for testing is quite limited. There is a `test` directory but it looks like it contains examples of code that can be used to test various different bugs, rather than any formal regression tests or unit tests. So my question is are there examples of open source projects that use unit testing that I could look at to learn from? Something like a JVM is perfect for me because it is more complex than the project that I am working on, but would face many of the same issues associated with thread interaction and memory management.


title: Apple's new compiler

text: I heard that Apple is going to replace the GNU compiler built into Xcode with a new compiler. What is the new compiler and what type of changes can we expect to see?


title: Is there a way to use gcc as a library?

text: Anyone knows a solution that works something like this:               #include <stdio.h>     #include <gcc.h> /* This .h is what I'm looking for. */          int main (void) {         /* variables declaration (...) */              /* The following line is supposed to be equivalent to:          *     $ gcc main.c -o main */         results = gcc_compile_and_link("main.c", "main");              /* Now I want to use the warnings and errors to do something.          * For instance, I'll print them to the console: */         printf("warnings:\n");         for (i=0; i<results.warns_len; i++)             printf("%s\n", results.warings[i].msg);         printf("errors\n");         for (i=0; i<results.errs_len; i++)             printf("%s\n", results.errors[i].msg);              /* free memory and finalize (...) */         return 0;     }      I know I can run the command "gcc main.c -o main" in a fork and parse the output... but I was looking for something more ' _reliable_ ' like the example above.


title: Update strategy for a software framework once it has been deployed

text: I need to update a software framework once it has been deployed. The framework we are creating is made up of .NET 4.0 libraries (in Visual Studio). This common set of code libraries will be available for 2 .NET Windows services, a standalone .NET application, and a .NET MVC 4 website. (The services will run on a single server, and the standalone application will be used by a select few individuals.) We are in the early stages of the project, and the big questions that have come up are:   * What happens when we have to make a change to 1 or more of the framework files?    * How do we deploy patches and/or updates to each part that relies on the framework?   * What considerations can we make early on to make the update/patching process easier later on? This is the first time our small team has tackled a problem like this and we're not sure what the best practices are. **edit** We have 4 software pieces that rely on the framework: 2 services, 1 app, 1 website. Once this all hits production, there are already upgrades and updates planned. The updates will require changes to the framework files and the programs. My question was intended to refer to that later process of redeploying the upgrades. Once we're in production, and we've coded the updates/upgrades to the framework files, the applications, and the website, deploying those updates will need to happen as quickly as possible. What do we need to do to streamline that process?


title: How secure is this way of authenticating an ASP .NET Web API - creating your own tokens?

text: http://www.codeproject.com/Articles/630986/Cross-Platform-Authentication-With- ASP-NET-Web-API#_rating The above link shows exactly how I want to go about authenticating against an ASP .NET Web API. It looks very easy but how safe is it in practice? It involves creating your own encrypted token by stringing together the user's user ID and the IP address of the client being authenticated. Then authenticating that string variable using some kind of encrypting technology. Then upon each subsequent request that is sent to the API by the same user, the API will check if the token is valid (it comes from the same client that authenticated, it has not timed out, etc.). The token will be checked by decrypting the token and checking that the client ID that comes out of the decryption is the same as that of the requester's IP.


title: How do you follow the single responsibility principle in classes responsible for behaviour?

text: I have many classes in my application responsible for behaviour- views, controllers, models, network- often the state of one class or system depends on another and I'm finding that classes that are primarily responsible for the behaviour for one system inevitably become dependees or dependers of other systems or classes. I've tried passing in interfaces of dependencies from the constructor of the system all the way to the class the depends on it and registering for events on it but this gets extremely complex and crazy and definitely violates OCP and SRP at least. I'm considering making an event system that all event dispatching and listening classes would be coupled to, providing a layer of indirection for classes that require interaction with classes from other systems however in the worst case behavioural classes could be responsible for the behaviour of a class, handling events, and dispatching events- so that definitely also violates the SRP even though I'm pretty sure it would follow the OCP. Is there a better solution out there? Am I applying these principles correctly? I'm very hesitant to use an event system as it will require most classes to be extremely tightly coupled with it.


title: Does an in-code enumeration provide a stronger domain model than a static table?

text: Does an in-code enumeration provide a stronger domain model than a static database table? As an example, say I have an `Marble` entity, with a `Color` attribute. The color attribute has a finite set of possible values--say red, green, blue. Say the database team recommends having a static `S_ValidColors` table, to the effect of:               -----------------------     | ColorId | ColorName |     -----------------------     |    0    |    Red    |     -----------------------     |    1    |   Green   |     -----------------------     |    2    |    Blue   |     -----------------------      Whereas I'm thinking more along the lines of (this is just a sketch for the general concept):               public class Color {         public static const Color Red = Color(0);         public static const Color Green = Color(1);         public static const Color Blue = Color(2);              private Color(uint typeCode) {             ...         }         ...     }      Aside from the question of which is better (which probably depends on any number of other factors not represented here), is this a question that touches how strong the domain model is? Is one way more anemic than the other?


title: Interacting with clients using project management systems

text: I work in web development, that involves a lot of smaller custom projects rather than one large product. Requirements and specifications are always coming from outside the company. We've setup a ticket tracking system (Active Collab, which is rubbish compared to redmine btw) and given access to clients so they can submit issues. The idea being that less time is taken up with long phone conversations and emails. I think it can work really well if done right. However I'm not so sure it's always a good thing. Feature requests have gone up a lot on some projects. The system also needs to be friendly to non- developers while having the many features that developers use. Developers' tickets do not always map 1-to-1 with the tickets clients will create. So the requirements and broader tickets need to be separated from the more specific developer (specification) related tickets. Perhaps we could use two systems, one for clients to submit their requirements or describe a bug, and one for developers to create tickets like `implement method x in class y`. Maybe this can be achieved by structuring tickets into more appropriate categories or creating sub-tickets under a feature request ticket. I've briefly looked into Pivotal Tracker and it has a fundamentally different workflow. **tl;dr** How do you keep technical tickets (developer jargon) separate from client tickets (layperson language).


title: PHP to SharePoint roadmap

text: I'm a PHP developer with familiarity with Rails and a focus on MVC development. My company is moving more and more to SharePoint and I feel I need to learn to build application within the SharePoint system. I have some brief introduction to C# but that's about it. I've used some SharePoint Designer and the web interface but not that heavily (most of my "development" so far for SharePoint has been html/css/javascript page manipulation in SPDesigner). What, and in what order should I be learning to eventually develop applications for SharePoint? Also, any good resources for each step?


title: Scaling up Git to Team Usage

text: For the last 3 years I have used git on an almost daily basis for all my pet projects and at work for small projects that were not in the global SVN repository. My workflow is quite similar to the famous git branching model from http://nvie.com/posts/a-successful-git-branching-model to sum it up:   * I work in branches, one branch for one feature (I.e. not mixing up the bugfix with the new feature, etc.)   * I commit really really often, often just 2-5 lines, biggest commits are usually new functions etc. I heavily use the interactive committing tool to semantically organize my commits (i.e. while fixing an import declaration and something in a function, I tend to split that up in two commits when the changes are not related).   * Finally I tended to use `git merge` with the `--no-ff` option, because I kind of like the visual branch-history graph in gitk.   * Never really used rebasing (except for fixups) _Of course this workflow never had to face merge conflicts as serious as teams working on the same codebase face._ Now I have read here and there, that some projects are very concerned about keeping a "fast-forward" history. **Why is this important? What is your choice in that respect?** I can imagine that a 'linear' history is easier to handle when looking at histories, but: It is also valuable to have the true history in my opinion. The linear history without fast-forwards is more similar to SVN histories maybe, but my git commits are usually a lot smaller than the average SVN commit, these are - I think - more comparable to a branch-merge in git (at least my usage). Working without `-no-ff` would kind of "clutter" the history in master (This is my concern about fast forward merges).


title: Bringing code to an interview?

text: Is bringing printed code or code on a USB to an interview a good idea? If so, what kind of code should I bring. Should I avoid big projects and just show small snippets which show off my skills?


title: Suggest a good programming language to learn that is not OOP and definitely not in C style syntax

text: My first programming language in school was C. Then I learnt C++ and Java and got stuck with Java for 2 yrs. I was so addicted to java and OOP at first. I started making Java applications and became fully thorough in OOP. Now I would like to learn different languages. My mind is full of C style syntax. Sometimes in my dreams, I see camelCase words and paranthesis and braces and dots. Even JavaScript uses C like syntax. I want to get adapt to different languages so that I won't find difficulty when I get a job that requires me to program in different syntax and different paradigm.. I do not know what functional, logical, hybrid paradigms mean. So I am asking here. Suggest me a different language (and some good book on it if possible) to learn..


title: Past If statements Arrays, loops... Now what?

text: I gave up on programming a little over a year ago when I kept hitting this wall. I am revisiting the subject because I want to create basic Android application. But I feel that my limited knowledge will not suffice. Here is my problem. I have read a few books and watched video tutorials on C#/Java, followed examples, then finished the book. In the end they always seem to leave me dumbfounded as to what to do next. What a mean is they teach you from your basic "hello world" application all the way up to if's and arrays then seemingly expect you to know how to go out into the world of coding and create anything. Am I missing something here? I know these are the building blocks of all programs but books that I read never really show me what to do next. The easy answer I suppose would be to 'start coding', but where? I read "Head First Java" for example; up to the part were they tell you take everything you have learned and create a dog racing game.... "try not to cheat and look at the source code provided, you should be able to do this by now" _ that's not an exact quote but basically that's what I was told....... Half an hour ago they were just explaining how to do arrays, then without any theory I am meant to create a working game? The reason I ask this is because I fear that this is all I am supposed to know to at least start coding, yet it feels like I have been given a small toolbox and been told to build a skyscraper. Thank you for any advice


title: How should I implement the repository pattern for complex object models?

text: Our data model has almost 200 classes that can be separated out into about a dozen functional areas. It would have been nice to use domains, but the separation isn't that clean and we can't change it. We're redesigning our DAL to use Entity Framework and most of the recommendations that I've seen suggest using a Repository pattern. However, none of the samples really deal with complex object models. Some implementations that I've found suggest the use of a repository-per-entity. This seems ridiculous and un-maintainable for large, complex models. Is it really necessary to create a UnitOfWork for each operation, and a Repository for each entity? I could end up with thousands of classes. I know this is unreasonable, but I've found very little guidance implementing Repository, Unit Of Work, and Entity Framework over complex models and realistic business applications.


title: What is the benefit of Continuous Integration over make?

text: We are evaluating and setting up Continuous Integration for our PHP project. Each of the Continuous Integration tools has their own proprietary "build language" which will run many commands and check the return status of these commands. Here is an example of a `.travis.yml` configuration:               language: php          php:       - "5.3"       - "5.4"       - "5.5"          script: phpunit test          notifications:       email:         - sourcespeak@phor.net      A Jenkins configuration will be in XML and is too long to paste here. Here is an example of a `circle.yml` configuration:               dependencies:       override:         - bundle install:             timeout: 240             environment:               foo: bar               foo2: bar2             pwd:               test_dir      **My question is: what is the benefit of using all these popular, proprietary configurations languages for CI instead of using a Makefile to set up your test environment and have whatever CI server just run`make test`?**


title: Are there metrics, like in other professions, that can be used to measure whether a programmer is considered experienced?

text: Driving instructors (at leas in Germany) often mention 100.000 km driven as a reference point where a driver is considered experienced. Is there a similar number for programmers? For example, how many lines of code does the average junior/senior developer have written when starting their job? Also: after how many lines in a specific language does one usually become an expert of that language? Of course, there are many other factors, that make up who is a good programmer and who is not, however I feel like the number of lines of code could be a pretty good indicator of hands on experience. ## Update: Originally, I asked for a number of lines of code. Of course I am aware, that it makes a big difference, what quality of code was written, in what fields etc. I would not consider any person, that has driven over 100.000km, a good driver either. And I am still convinced, that everybody needs a certain time of experience, to become a great programmer. Though hours was not the measure I was looking for, the number of hours in the answer of suhit was essentially what I wanted. A more clear version of my original question might be: After how many lines of code has a dedicated programmer, who constantly challenges himself, likely acquired enough knowledge and skill to be considered experienced?


title: Is it good approach to open a keyboard at Actvity start where only one EditTextbox is present

text: I am working with _Forgot password_ , where I have single EditTextBox and a single submit button. So whenever I am opening this _Forgot password_ page, my keyboard is opened at the start of this page. In my mind there is a question that it is not a smart choice to open a keyboard at the start of the _Forgot password_ Activity.


title: Complex string matching with fuzzywuzzy

text: I'm attempting to write a process that matches obscure strings to a single 'master string' for further processing. I have a lot of data that looks something like this:               Basketball     Basket Ball     Football     BasketBallR     BBall     BBall - r     FootB      ...and so on. These need to be mapped to a master record like so:               Basketball       = Basket Ball, BBall     Basketball - R   = BasketBallR, BBall - r      I also have instances of data resembling this format:               Football -r     FootBall - r-g/H,Q,HH      These situations need to be separated into different categories before being mapped. For example `FootBall - r-g/H,Q,HH` should be:               Football - r     Football - g     Football - H     Football - Q     Football - HH      At this point, it still needs to be mapped to a master record... I've tried several different combinations of fuzzywuzzy matching methods, Levenshtein Distance measurements, regex, etc. and can't seem to find a reliable method to logically associate different naming styles of a single item with a master name. I'm throwing my hands up in desperation. Are there any existing python resources than can help sort out my problem? Are there other options? Can anybody point out an obvious option that I might have overlooked? Basically, any suggestion, solution, resource or alternative method is greatly appreciated.


title: High performance computing and interconnects

text: High performance computing means different things to different people. From a pure programming perspective what I gather is that these are loads of individual machines connected by extremely fast interconnect not necessarily based on usual TCP/IP. My question is on the interconnect side of things: How do you make interconnects faster without changing your socket based code much?


title: Do you apply a code of conduct on accepting jobs, projects or requirements?

text: **When writing software for yourself, your company or third parties, do you always consider certain principles, values, standards, or rules of behavior that guide the decisions, procedures and systems in a way that contributes to the welfare of its key stakeholders, and respects the rights of all constituents affected by its operations?** And can this code of conduct sometimes be overruled by business requirements, lack of technical skills or other friction during the development process? Some random examples in order of severity. (yes that is controversial) :   * Do you accept known bugs as a risk for the end-user?   * When writing applications, do you always give the end user the chance for a complete de-install?   * Do you always secure and encrypt private data delivered end-users in your web application?   * Do you alwask ask the end-user before submitting his entered data to the server?   * Did you ever wrote an application that sends unwanted e-mails?   * Did you ever work on harvesting or scraping projects only for the benefit of the business?   * Did you ever write software that is legal but moraly controversial, like for weapons industry.   * Did you ever wrote software that ( can intentionally) or is be used for criminal activities It would be nice if you can get a good case with explanation on your moral and ethical decisions. note: _Since ethics and law are quite local and cultural dependent, it would be interesting if you add the location of the "crime scene" with it_.


title: How have you found, refined and maintained your coding style?

text: Recently, I've been switching between several projects and development environments. The expectations for coding style in each is different. Now, my question is three part, the first, just of curiosity:   1. How did you define and find your coding style?   2. How do you keep augmenting and improving it?   3. How do you maintain it? (From mental notes, keeping a document, using a tool like StyleCop etc.)


title: "All software has an expiration date by which time it must be rewritten from scratch."

text: I stumbled upon a discussion between senior engineers and people from non- technical backgrounds and this seems to be a strongly held belief in some places. I'm of the opinion that such a situation is purely down to incompetence on the side of the developers and project managers, those involved in creating the original system and those struggling to modify it now. Especial those who intersect both these groups. Am I wrong? If so why? If not, how can I convince developers twice my age that they need to change their approach to software development to overcome this problem and that rewriting the system from scratch every 2-3 years is not just an unavoidable fact of life. Are there books or influential programmers I can quote on this issue?


title: What does Bucket mean?

text: I found in legacy code a class which name is BucketService. Because english is not my native language I was trying to translate that, but it doesn't make sense. I found few termins like bucket sorting and so on, but I still don't get it. Actually this word is used quite frequently in programming I would be helpfull for some simple explanation of that word


title: Is there any risk of web browsers spying away localhost applications on an Internet-connected PC?

text: Despite what it _might_ look like this is a serious question. After that story with Android OS and Chrome browser submitting to Google the details of the WiFi access points they see in the neighborhood which has nothing even remotely to do with their main function I'm inclined to expect everything. But the specific question I have today concerns the following matter. The situation. I'm developing a web application running on a locally installed web server. Naturally I'm testing and debugging it on the same development machine in various browsers such as Internet Explorer, Firefox, Opera, Safari and Chrome. The development machine has a permanent connection to the Internet. Now. Is there any situation or circumstance when any of those browsers would take it upon itself to send the opened web pages from `http://localhost:port/*` to its company or any other third party? For now I seriously suspect if there is a browser crash or an OS crash the browser would submit a report perhaps with the content of my HTML, CSS and JavaScript. What if a browser would submit pages used actively and opened over a prolonged period of time just out of the company's curiosity - what is this nasty programmer working on? Can you confirm that hypothesis? Are you aware of any other situations when a browser would sent out a local resource details? How safe is it to develop on a machine with a permanent Internet connection?


title: What are some ways to maintain codebases written in two languages that implement the same logic?

text: I have a logic intensive algorithm that I need to code in two languages (actually I finished it in one language satisfactorily and am about to start coding in the other language). By logic intensive I mean the algorithm is non trivial, needs careful understanding and, importantly, could be having bugs (due to complexity and carelessness, you know) that would have to be patched in the future. Also, I want to make sure that when this code changes hands, eventually, it must not overwhelm the new programmers. Given this scenario, what are some ways that would help maintain the codebases and keep they in sync? By ways I mean software tools, best practices etc. FYI the two languages are C++ and Java. C++ for Windows/Linux and Java for "everything else" including Android.


title: Data structures VS Classes and what happens if they merge?

text: Alright so I've learned this: **Classes** have public methods that perform operations on the class's data and they hide away their implementations. **Data structures** on the other hand, completely expose their implementation through properties (getters and setters) and don't usually have methods. So my question is, let's say that I have customer data structure that looks like this:               public class Customer     {        public string FirstName { get ; set; }        public string LastName { get ; set; }        public List<Offer> Offers { get ; set; }     }      I would assume this to be a **data structure**. but what if later during the project, I realize that I need to add some business logic to my customer data structure? Like a method to add new offers because there's more logic in doing so than just adding it to the list? It seems to me that this logic would belong inside of the data structure. What happens then? Does the data structure turn in to a class? Or into some kind of third object type that I'm unaware of? Is this **bad design**?


title: Does Serialization preclude the use of Dependency Injection?

text: Simple question: I understand that Serialization in C# requires default constructors. This would eliminate the possibility of using Constructor injected DI (which is generally the favored style of DI, in my reading[citation needed]). So is it really an either-or situation, or am I missing something? (Side question): Do IoC containers side-step this tradeoff somehow?


title: Have you ever hated a framework/programming language/platform but you eventually became curious in learning?

text: Little background: I've always been kind of a Microsoft hater. A while ago just the fact of learning a something like C# scared me. I was only interested in opensource project and programming languages. Wasn't impressed with vista(actually I hated vista), so I went back to XP Pro. I had to use Windows because some software I use/used wasn't available for linux. Then came windows 7 and before even trying/using it I already judge it to be a 'insert insult here'. I kept hearing really good stuff about it so I removed XP and install windows 7. After using it just for maybe 2, 3 days I started to really like it. Now I like it a lot actually. It even has these small features that may feel irrelevant to someone (like being able to arrange the windows' in the taskbar) which are very useful to me (I used to open programs in a specific order, even close some and reopen just to rearrange them). Actual question: Now I think more and more about learning .NET and C#. I also seen PowerShell which looks tempting. Call me an idiot but I kind of feel weird about this. It almost feels like I'm betraying someone. Have you ever been in a similar situation?


title: Does Dropbox use a cronjob to sync up?

text: I was looking into lipsync on a Dropbox clone. I was looking at the diagram on how it works here. It shows that a cronjob is used to keep files in sync between client and server. Does that mean that every sec/min/hour, a cronjob runs and checks to see if there is a difference between client and server? Is that how Dropbox does it? If it does use a cronjob, what happens when you are in the middle of syncing and another cronjob runs? Does rsync (or additional libs) know how to handle this?


title: why are all the functional programming tutorials so mathy?

text: I've been trying to learn functional programming and most tutorials I have found use math as examples for the more complicated constructs (even the simple ones in some cases). Why is this? I would imagine something easier could be used. Its making it difficult to learn. Background Info: I have been writing software for 12 years. I understand some of the concepts such as closures, functions as first class citizens, and generics. I may be having problems with higher-order functions at some advanced level, but I would like to believe I have a basic grasp. Monads are biting me in the butt, and at this point I haven't gotten past that (I'm sure I will eventually, because I'm persistent).


title: What's the best way to manage list item sort order with Drag & Drop UI?

text: I have a list of Students that I should display to user on a web page in tabular format.   The items are stored in DB along with SortOrder information. On the web page, user can rearrange the list order by dragging and dropping the items to their desired sort order, similar to this post. Below is a screenshot of my test page.   ![enter image description here](http://i.stack.imgur.com/iPuhT.jpg) In the above example, each row has sort order info attached to it. When I drop John Doe (Student Id 10) above the Student Id 1 row, the list order should now be: 2, 10, 1, 8, 11. What's the optimistic (less resource hungry) way to store and update Sort Order information? My only idea for now is, for every change in the list's sort order, every object's SortOrder value should be updated, which in my opinion is very resource hungry. Just FYI: I might have at most 25 rows in my table.


title: Aggregate root & Repository dilemma

text: I am in a big dilemma here. I have a League, Team and Player entities. I have created a repo for the league only as a Team cannot exists without a League. At first I had bounded the players only with the team but then I realised I would have a problem with free agents so I also bounded the players to the league. Then I was wondering if a player could exists without a League or a Team and I am totally confused to that question. So would you make a player repository or include them in the league repo? Thanks


title: What is the need for 'discoverability' in a REST API when the clients are not advanced enough to make use of it anyway?

text: The various talks I have watched and tutorials I scanned on REST seem to stress something called 'discoverability'. To my limited understanding, the term seems to mean that a client should be able to go to `http://URL` \- and automatically get a list of things it can do. What I am having trouble understanding - is that 'software clients' are not human beings. They are just programs that do not have the intuitive knowledge to understand what exactly to do with the links provided. Only people can go to a website and make sense of the text and links presented and act on it. So what is the point of discoverability, when the client code that accesses such discoverable URLs cannot actually do anything with it, unless the human developer of the client actually experiments with the resources presented? This looks like the exact same thing as defining the set of available functions in a Documentation manual, just from a different direction and actually involving more work for the developer. Why is this second approach of pre-defining what can be done in a document external to the actual REST resources, considered inferior?


title: Why error codes are negated?

text: Very often I see in C code negation of returned error codes, e.g. `return -EINVAL` instead of `return EINVAL`. Why used negation?


title: Do simple accessors and mutators benefit from commented block headers?

text: **Short Question**   Is it necessary to add the function header comments for **simple** accessors and mutators? **Example**               u8   OBJ_get_state_x(void) {return obj.state_x;}       void OBJ_set_state_x(u8 x) {obj.state_x = x;}      **Addition Thoughts**   The object (OBJ) overall contains very minimal logic (if any). Its sole purpose is to maintain the state of a system. Additional modules (such as IO, COMM, DISPLAY, etc...) all know _what_ the object is and contain all of the business logic required to drive the states in OBJ. I would _like_ to keep all of the accessors / mutators on a single line to make the file a bit more readable and just put a generic block header above all of them. I just don't know if this is a common (or good) practice. Note that all of the ranges are the bound by their type. If there is a special state that has a range of 0 to 3, I create an typedef'ed enum to use as the type (thus forcing the range and making the code more readable IMO).


title: Is having trouble with data structures common for beginners?

text: I'm taking my second course on Java. We are getting into data structures. I have done an assignment on a linked list, and now a stack. I had a hard time with the linked list. The stack gave me a little trouble, but was much easier. Should I be worried about having a hard time with these algorithms and data structures? I just feel like I didn't really grasp it.


title: What is the correlation between programming language and experience/skills of their users?

text: I'm sure there is such a correlation, because   * experience and skill leads good programmers to picking languages that are better for them, in which they're more productive, and   * working in a language forms how programmers think and influences their methods and skills. Is there any research or some statistical data of this phenomenon? Perhaps this is not a purely academic question. For example, if someone is starting a new project, it could be worth considering a language (among other criteria of course) for which there is a higher chance of finding or attracting experienced programmers. **Update:** Please don't fixate on the last paragraph. It's not my intention to choose a language based on this criterion, and I know there are other far more important ones. My interested is mostly academic. It comes from the (subjective) observation and I wonder if someone has researched it a bit. Also, I'm talking about a _correlation_ , not about a rule. Sure there are both great and terrible programmers in every language. Just that in general it seems to me there is a correlation.


title: Web application / Domain model integration using JSON capable DTOs

text: I'm a bit confused about architectural choices for the web- applications/java/python world. For c/c++ world the available (open source) choices to implement web applications is pretty limited to zero, involving java or python the choices explode to a,- hard to sort out -, mess of available _'frameworks'_ and application approaches. I want to sort out a clean MVC model, where the **M** stands for a fully blown (POCO, POJO driven) domain model (according M.Fowler's EAA pattern) using a mature OO language (Java,C++) for implementation. The background is: I have a system with certain hardware components (that introduce system immanent active behavior) and a configuration database for system meta and HW-components configuration data (these are even usually self contained, since the HW-components are capable to persist their configuration data anyway).   For realization of the configuration/status data exchange protocol with the HW-components we have chosen the Google Protobuf format, which works well for the directly wired communication with these components.   This protocol is already used successfully with a Java based GUI application via TCP/IP connection to the main system controlling HW-component. This application has some drawbacks and design flaws for historical reasons. Now we want to develop an abstract model (domain model) for configuration and monitoring those HW-components, that represents a more use case oriented view to the overall system behavior. I have the feeling that a plain Java class model would fit best for this (c++ implementation seems to have too much implementation/integration overhead with viable language-bridge interfaces). Google Protobuf message definitions could still serve well to describe DTO objects used to interact with a domain model API. But integrating Google Protobuf messages client side for e.g. data binding in the current view doesn't seem to be a good choice. I'm thinking about some extra serialization features, e.g. for JSON based data exchange with the views/controllers.   Most lightweight solutions seem to involve a python based presentation layer using WSGI or JSON based data transfer (I'm at least not sure to be fully informed about this). Can someone give good advice about best practices or easy to integrate frameworks for such case? **UPDATE:**   According to my recent research and comments of colleagues I've noticed that using Java (and some JVM) might not be the preferable choice for integration with python on a limited linux system as we have (running on ARM9 with hard to discuss memory and MCU costs), but C/C++ modules would do well for this (since this forms the native interface to python extensions, doesn't it?).   E.g. a pyramid based solution seems to provide a lightweight framework, that allows to integrate a domain model using an appropriate python facade. Protobuf also provides python class generation support, does someone have experience with integrating protobuf messages as DTO's with python? I can imagine to provide a domain model from an appropriate C/C++ API (though I still think it's more efforts and higher skill requirements for the involved developers to do with these languages). Still I'm searching for a good approach that supports such architecture. I'll appreciate any pointers!


title: In Java, should private helpers go above or below public methods?

text: I've noticed that a coworker and I have opposite practices regarding the ordering of methods in our Java classes. One of us begins a class with its major public methods, and then put all of the private helpers afterwards. The other one of us makes sure that public methods are at the very end. Clearly, this is just a style issue and there is no right answer. However, before we decide that this matter is just another Yooks vs Zooks fight and just pick one or the other arbitrarily, I was wondering if perhaps there was a standard Java style guide recommendation or some practical reason why one approach is better than the other.


title: I am not a good programmer (in logic), how should I fix it?

text: Ok, so here is my problem: I work for a big company, some how landed a job (frankly because the interview was easy). It's not that I don't know my stuff, I am pretty good at understanding java, it's libraries etc. But, when ever I try to solve some logic problem, I find it really hard to come up with a solution. For example, `conversion of decimal to roman`, when I saw the solution, I find that it's a simple problem. _But I was not able to implement it after 1-2hrs of trying out!_ I feel I am dumb and not worth being a software engineer. Puzzle solving abilities should come natively to a great programer. But when I try to solve some puzzles, I am not able to find a solution and I just google it up!....and I hate that! When given a problem (like implement xyz feature) at work, I am fairly pretty quick at it and am respect at my work place for that, but I am not at all proud about it. Because when I try to solve any mathematically or logic wise challenging problem, I fumble. I still feel I love what I am doing (as an engineer) but feel really sad that I am not able to solve some tough logic problems which I friends come up with. I feel demoralized :( > TL;DR: I understand stuff from a practical viewpoint (implementing features > in our product) but when trying to work on problem from say ProjectEuler, I > SUCK badly! And I need to _Sharpen_ my brain! So, my questions are:   1. How should I go about fixing it? Should I start with solving (and forcing my self to) project euler problems? _Even if it takes hours for me to solve some basic problems_?    2. Or should I go back to basics and study some basic math?   3. I don't really find puzzle solving fun. But I want to make it fun for my self! And I think if I understand them in a better manner, I will like it! PS: I was never educated in CS (my undergrad was electrial). But that's not an excuse to be a sucky developer. Thanks!


title: Is it a good idea to collect anonymous usage statistics in a free program?

text: I'm the main author of a multiplatform free software/open source GUI program. Although the program gets thousands of direct downloads per month, I have no idea of the number of people regularly using it. It is also included in some Unix distributions and download sites making the counting harder. It would be interesting for me to know   * How many people use it? Should I bother continuing development?   * Which features of the program (dialogs, import filters, etc) do people most use? This would focus development. I'm considering some form of anonymous feedback (with the user opting-in), where the program sends monthly reports of the time since installation (whole months), the number of times each dialog is used, number of files opened, the version number and platform. The user would be asked the first time this is sent and there would be an option to disable it. I think I would only do this after the first week of usage, to exclude one-off users. Is doing this a good and ethical idea? I'm in the EU, so it's possible that data protection laws may apply.


title: What if I forgot to include someone elses copyright info in old commit?

text: Assume I have a public source code repository. Am I violating copyright laws if there's any old commit where I have not yet added all copyright info for _other_ people's open source code? Details: Consider this theoretical scenario:   1. I copy-paste _someone else's_ open source code files into a repository.   2. I commit.   3. I prefix copyright and licensing info at the top of the above-mentioned files.   4. I commit.   5. Many months passes, many people fork various versions of the master branch. Now, many months later, I realize that there are files in commit no. 1 with no copyright info. Do I have to squash the two above-mentioned commits, and rebase the whole repository? (Although it's been published! Everyone would be annoyed?) Or does it suffice that the current repo version provides all needed copyright info? Rephrased, for Git: If the HEAD of all Git branches, and all "published" Git tags, contain all required copyright and licensing info, do you think that suffice? And it'd be other people's responsibilities if they check out other commits and redistribute? Or am I the culprit, and will be thrown in prison?


title: Skeptic in a Scrum Team

text: My company has recently switched to an Agile way of working and as a part of it we've started using SCRUM. While I'm very comfortable with it and feel that this way is superior to a traditional one, some of my teammates don't share the same opinion. In fact they are very skeptical about "all that agile stuff", and don't take it seriously. As an example, one of the teammates is always late on the meetings, and doesn't really care about it. The management IMO tries not to notice this (maybe because it's new, and it takes time for the people to get used to it). My question is, how to address this issue while not raising a conflict inside the team?


title: DDD and filtering

text: I am developing an app in ddd maner. So I have a complex domain model. Suppose I have a Fare object and Airline. Each Airline should contain several or much more Fares. My UI should represent Model (only small part of complex model) as a list of Airline, when the user select the Airline, I must show the list of Fares. User can filtering the Fares (by travel time, cost, etc.). What is the appropriate place for filtering Fares and Airlines? I am assuming that I should do it in ViewModel. Like: My domain model has wrapped with Service Layer -> UI works with ViewModel -> ViewModel obtain data from Service Layer filtering it and create DTO objects for UI. Or I'm wrong?


title: How does a competition like Rails Rumble Work?

text: I am not sure weather it is a proper question to ask out here but it is really bothering for a while. As the official website writes: > The Rails Rumble is a distributed programming competition where teams of one > to four people, from all over the world, have 48 hours to build an > innovative web application, with Ruby on Rails or another Rack-based Ruby > web framework. After the 48 hours are up, a panel of expert judges will pick > the top ten winners. One thing I don't get is how judges make sure that the app was made in the given time constraint. The quality of apps is so magnificent that I am really skeptical that such elegant apps could be made within 48hrs, even if you have planned it straight out on paper.


title: Closest to “Mathematica Graphics[]" drawing environment for Python

text: Being only familiar with Mathematica and its Graphics, I have now to learn to draw Graphics using Python for a server. Mostly conditional combination of simple shape. **What would be a package for Python that make drawing Graphics as close as possible as the Mathematica Graphics environment ?** For Example, I would need to do such thing as in : http://mathematica.stackexchange.com/questions/1010/2d-gaussian-distribution- of-squares-coordinates#comment2475_1010


title: How can I provide a limited warranty for a software product?

text: Software, unlike most physical products you can buy, is sold with as few warranties as the vendor can get away with. As a developer, this seems very reasonable considering the quality of almost all software I've ever used - Think anything from unintuitive idioms, via undocumented features, irreproducibility, missing handling of concurrency, double escaping of user input, and floating point numbers where decimals would avoid long-term build- up of errors, to plain crashing bugs where the production database is corrupted and the equivalent of several hirings in the affected company are wasted on recovery and reactionary implementation of safety measures. It's a bit like building skyscrapers out of straw and nitroglycerin, hoping it will survive until the time when it's someone else's problem or it's replaced entirely. In such a situation, I hypothesize that a company which trusts their software enough to provide even minor warranties for damages incurred would (if their software was up to the task) gain an enormous advantage in _user trust_ , and could put Google, Microsoft and Apple to shame for quality software and hoarding of money and talent. I'm not familiar with the current status of software verification and requirements gathering research, so I don't know whether this possibility is just around the corner or whether we are hacking at the mountain with toothpicks. Certainly the existence of any serious company or organization at all providing such warranties or even working on guidelines for warranties would be extremely interesting to follow, as both a developer and user. Therefore: Are there any **international guidelines** for providing software warranties? Examples:   * If all the tests succeed, as long as the system stays in a defined state, the warranty covers the cost of recovery in case of data loss.   * As long as [some widely recognized set of security guidelines] are followed, the data handled by the system will not be readable by third parties. The warranty could cover anything from the price of the software to the legal costs of handling privacy-related lawsuits or more.


title: OCR - starting point

text: I really am a starter with OCR, and would like to implement an OCR system. Any pointers on where I can find the introductory material, with the programming kept in mind, like what algorithms or data representation models do I need to master? I found Tesseract, on Google Code, an open-source project, but before I dive in to the code, I'd like to have the concepts under my belt. thanks in advance, Yati


title: Randomness of wrapped RNG

text: _There are plenty of questions around regarding random number generation, but I couldn't find anything that exactly matched my question. Apologies if I missed one._ Most random number generators in software tend to have flat distribution - in the given range, any number is as likely to come next as any other (more or less). This is obviously the intention, because anything other than a flat distribution isn't entirely random because some numbers are more likely than others. However, there are times when a flat distribution is not desirable. For example, when building a game, it is often necessary to model real-world scenarios, many of which have a normal (bell-curve) distribution. If a "good" PRNG (such as an existing RNG from a popular programming language's main library) is fed into a simple equation, such as the equation for a bell curve, or a sine wave, or some other distribution, how far can we assume that the resulting PRNG is also "good"? Most of the tests for PRNGs test whether the system is purely random, so they won't work on this system. Is it just a matter of counting outputs over a long time and seeing how well they fit the desired distribution, or is there a simpler (eg. analytical or algebraic) way to check this? Any help would be appreciated.


title: What's the difference between implementing an Interface explicitly or implicitly?

text: In Visual Studio I can right-click on an interface and choose to Implement Interface, or Implement Interface Explicitly. ![Visual Studio Screenshot](http://i.stack.imgur.com/x4Rx6.png)               public class Test : ITest     {         public string Id // Generated by Implement Interface         {             get { throw new NotImplementedException(); }         }              string ITest.Id // Generated by Implement Interface Explicitly         {             get { throw new NotImplementedException(); }         }     }      The only difference I see between the two is that the Interface name is added to the interface properties and methods when they're created if you choose to Implement Interface Explicitly. I find it makes the code a bit more readable since I can see where that method/property comes from, however does this make any difference in how the class is used or compiled? And does it really matter if I implement my interfaces implicitly or explicitly?


title: Is coupling with strings "looser" than with class methods?

text: I'm starting a school group project in Java, using Swing. It's a straightforward GUI on Database desktop app. The professor gave us the code from last year's project so we could see how he does things. My initial impression is that the code is far more complicated than it ought to be, but I imagine programmers often think this when looking at code they didn't just write. I'm hoping to find reasons why his system is good or bad. (I asked the professor and he said I'd see later on why it's better, which doesn't satisfy me.) Basically, to avoid any coupling between his persistable objects, models (business logic), and views, everything is done with strings. The persistable objects that get stored in the database are hashtables of strings, and the models and views "subscribe" to each other, providing string keys for the "events" they subscribe to. When an event is triggered, the view or model sends a string to all of its subscribers who decide what to do for that event. For instance, in one of the views action listener methods (I believe this just sets the bicycleMakeField on the persistable object):                   else if(evt.getSource() == bicycleMakeField)         {             myRegistry.updateSubscribers("BicycleMake", bicycleMakeField.getText());         }      That call eventually gets to this method in the Vehicle model:               public void stateChangeRequest(String key, Object value) {                      ... bunch of else ifs ...              else         if (key.equals("BicycleMake") == true)         {                     ... do stuff ...      The professor says that this way of doing stuff is more extensible and maintainable than having the view simply call a method on a business logic object. He says there is no coupling between the views and models because they don't know of each others' existence. I think this is a worse kind of coupling, because the view and model have to use the same strings in order to work. If you remove a view or model, or make a typo in a string, you get no compile errors. It also makes the code a whole lot longer than I think it needs to be. I want to discuss this with him, but he uses his industry experience to counter any argument that I, the inexperienced student, might make. Is there some advantage to his approach that I'm missing? * * * To clarify, I want to compare the above approach, with having the view be obviously coupled to the model. For instance, you could pass the vehicle model object to the view, and then to change the "make" of the vehicle, do this:               vehicle.make = bicycleMakeField.getText();      This would reduce 15 lines of code that are currently ONLY used to set the make of the vehicle in one place, to a single readable line of code. (And since this kind of operation is done hundreds of times throughout the app, I think it would be a big win for readability as well as safety.) * * * **Update** My team leader and I restructured the framework the way we wanted to do it using static typing, informed the professor, and ended up giving him a demo. He's generous enough to let us use our framework as long as we don't ask him for help, and if we can keep the rest of our team up to speed -- which seems fair to us.


title: Study a project to be able to maintain it in future

text: I've joined as a fresher (trainee) a software company developing for Windows Store. I don't know much about C#. My company has started Windows Store development recently. They didn't do .Net development before, that's why my company got an Senior .Net employee to complete the project. Whenever he completes the project he will leave the company. I will have to maintain the project after him. So I need to study the project flow and analyze the project to be able to maintain errors in future. Can you suggest how to start to analyze the project and what to pay attention on?


title: What are some good ways for an employer to support developer education?

text: My current employer pays for certification fees and college classes (provided that you earn an 'A'), but I'm looking for other things to suggest to them. Very few of us have time to take advantage of the college classes, and the material covered in certification exams isn't always the most practical information. (Code Access Security, anyone?) Maybe a book allowance? Some incentive to work on an open source project? In what kinds of creative ways does your employer provide for your continuing developer education? ### See Also > How to Keep Your Developer Team Educated


title: Should I be paid for time spent learning a framework?

text: To give light to the situation: I am currently one of two programmers working in a small startup software company. Part of my job requires me to learn a Web development framework that I am not currently familiar with. I get paid by the hour. So the question is: Is it wholly ethical to spend multiple hours of the day reading through documentation and tutorials and be paid for this time where I am not actively developing for our product? Or should the bulk of this learning be done at home, or otherwise off hours, to allow for more full-on development of our application during the work day?


title: Moving from TFS to Distributed SCM

text: I am currently playing with the idea of pitching DSCM to management in my company. We currently use the full vertical TFS stack (SCM, Bug Tracking, Project Management etc.) - however I want to specifically target the source control (as I don't think retraining QA with something like Redmine would be achievable). Probably the biggest issue here is re-training a very large amount of developers to use the new SCM (and this includes the distributed train of thought) - which is probably not feasible at all. There needs to be some form of skills migration with the new system: this is where GIT fails horribly, as that would take months to catch on (and we are not a little startup shop - this is a very large company with real commitments). The next issue is the fact that we currently require check-ins to be associated with a real bug or task (work item) - I doubt management would bite if we couldn't control this. Ideally the developer machines should be zero- configuration, i.e. it should prevent 'illegal' pushes even if you just have the bare-bones SCM client installed. Being able to update TFS work items would also be a big plus - even if I had to write custom code, but once again this should be controlled by the central repository and not on developer machines. I know that in the long run DSCM alleviates many of the problems that we are facing day-to-day, but we can't afford the time of developers having merge issues or such. For example, my first GIT merge took me a good 2 days to figure out, because I was so used to the TFS mindset. This isn't acceptable when real deadlines are taken into consideration. Tooling is a big concern: it's incredibly easy to push in a merge marked-up file directly back into source control; which would result in a build failure - TFS doesn't allow you to do anything silly like this. Finally, having 'nice things' to show would probably help the pitch. We have a review process, showing off GitHub FI Commit Comments would be a strong example of why this stuff could be better - however, as stated, GIT is probably really the wrong route to go. **TLDR;** I have found most DSCMs to be tools and not frameworks (e.g. GIT is designed to be this); allowing you to easily shoot yourself in the foot - TFS is a framework and that is something valuable in the company. Has anyone ever tackled these types of issues when migrating to DSCM? What DSCM platforms did you use? What challenges did you face? Do you have any ideas on how this process could be streamlined and almost made painless?


title: General checklist before releasing software

text: I'm currently building a tool that my company intends to sell. I'm the sole developer on the project and it is being developed outside our normal code base and to a certain extent outside our normal process. I'm trying to put together a checklist of items to check before I deem the software ready to release for testing. These are the items that I've come up with so far:   * Is code commented appropriately?   * Does the code adhere to the defined Company Standards?   * Is there error handling in place?   * Is there appropriate security?   * Is there appropriate logging?   * Is localisation required?   * Have release notes and any accompanying documentation been produced?   * Has all testing and debugging code been removed?   * Has sensitive data been such as passwords and licence keys been removed?   * Has performance been checked? Any memory leaks? Can anybody suggest items that could be added to this list and explain why you would think it would be useful? My goal is to have a template checklist that I can then customise on a project by project basis.


title: Fast compression in C++ and decompression in C#

text: ### Overview I am working on a client-server application. The client is written in C++ (working on Windows, planning to support Linux) and the server is a .NET RESTful service. I need to HTTP POST some data to the server. The data is a unicode `string` that I need to compress using any fast compression algorithm (needs to be light on CPU). On the server I need to decompress raw bytes and get a string. ### Problem I cannot decompress raw bytes and I end up with decompressor's output buffers stay intact. ### I tried I have tried using Google Snappy, there is only a C/C++ version and any .NET ports don't appear to be finished. I also checked LZ4, where compression/decompression works in a _single_ language, but when I try to use _both_ \- I cannot decompress data correctly (the decompressed bytes are set to 0s). ### Question Has anyone tried using a fast C/C++ compression and C# decompression? Any recommendations? Client application shall not use more than 5% of CPU - that's a vague requirement I have. I plan to try gzip and maybe deflate, but I am not sure if I can configure compression levels there or whether it will work in both C/C++ and C#. Client collects some near real time data into a small buffer, when that buffer gets full it shall be compressed and POSTed. The whole OS process shall take less than 5% of the machine's CPU. A buffer is roughly posted 2 times a second which creates a traffic of about 2Kb/sec.


title: Why does Scala use the '_' operator for package import instead of '*' as in Java?

text: In my opinion, one of the greatest things about Scala is its interoperability with Java and its similar syntax. One thing that I found strange is the use of the `_` operator for package wilcard imports instead of the `*` operator that is used in Java. Is there a technical reason for using `_` instead of `*`? If not, then why was this change done?


title: How the Compatibility View in IE works behind the scenes

text: When I remote connect to my work PC, in IE10, the juniper remote client service which is basically a plugin executed in the browser does not run. I need to turn on compatibility view to see it. My question is what exactly is happening behind the scenes in compatibility view such that such a large number of compatibility problems can be fixed with it? What did they do...make a list of deprecated APIs that was running ok in ie8 but deprecated in ie10 and then on clicking compatibility view, those APIs are supported again?


title: Unit test and Code Coverage of Ant build scripts

text: In our development environment We have more and more build scripts for ant to perform the build tasks for several different build jobs. These build scripts sometimes become large and do a lot of things and basically is source code in and of itself. So in a "TDD-world" we should have unit tests and coverage reports for the source code. I found AntUnit and BuildFileTest.java for doing unit tests. But it would also be interesting to know the code coverage of those unit tests. I have been searching google, but have not found anything. Does anyone know of a code coverage tool for Ant build scripts?


title: Java class to enforce an implementation of super classes' public methods

text: I have the following :               public Class A {              public void methodA() {             ....         }              public void methodB() {             ....         }          }      I don't have control over Class A. I would like to create subclasses of Class A with a restriction that it must override methodA() (super.methodA() call must run the implementation of Class A). is it possible? is so, how?


title: MATLAB: Best fitness vs mean fitness, initial range

text: 1. Based on the example of Rastrigin's function. At the plot function, if I chose 'best fitness', on the same graph 'mean fitness' will also be plotted. I understand well about 'best fitness' whereby it plots the best function value in each generation versus iteration number. It will reach value zero after some times. I don't understand about 'mean fitness'in the graph plotted. What do those 'mean fitness' values mean? How does the 'mean fitness' graph help to understand Rastrigin's function?   2. What are the meaning of the term initial population, initial score and initial range? I wish to have a better understanding of these terms.   3. The default value for initial range is `[0,1]`. Does it mean that `0` is the lower bound (`lb`) and `1` is the upper bound (`ub`)? Do these values interfere with the `lb` and `ub` values I set in the constraints?   4. I try to better understand about `lb` and `ub`. If my `lb` is `0` and `ub` is `5`, does it mean that my final point values will be within 0 and 5?   5. If I know the `lb` and `ub` for my problem is between `0` and `5`, do I just set the initial range as `[0,5]` at all times and may I assume that this is the best option for initial range, and I need not try it with any other values?


title: Will C# merge with native C++ compiler?

text: According to this post : http://channel9.msdn.com/Forums/Coffeehouse/MS-working-on-a-same-compiler-for- C-AND-C--Not-in-incubation-but-for-production- How much truth is in this post? Should it be taken seriously by hardcore C++ programmers (game devs etc)?? Edit : There's another purpose to this question... Will C# be backward compatible with C++?


title: Should I make up my own HTTP status codes? (a la Twitter 420: Enhance Your Calm)

text: I'm currently implementing an HTTP API, my first ever. I've been spending a lot of time looking at the Wikipedia page for HTTP status codes, because I'm determined to implement the right codes for the right situations. Listed on that page is a code with number 420, which is a custom code that Twitter used to use for rate limiting. There is already a code for rate limiting, though. It's 429. This led me to wonder why they would set a custom one, when there is already a use case. Is that just being cute? And if so, then which circumstances would make it acceptable to return a different status code, and what, if any problems may clients have with it? I read somewhere that Mozilla doesn't implement the joke `418: I’m a teapot` response, which makes me think that clients choose which status codes they implement. If that's true, then I can imagine Twitter's funny little enhance your calm code being problematic. Unless I'm mistaken, and we can appropriate any code number to mean whatever we like, and that only convention dictates that 404 means not found, and 429 means take it easy.


title: Automation Testers vs Developers

text: What are the differences between automation testers and developers?


title: Do threads delete themselves?

text: Let's say I was working on a Swing application. Most of it is run on the EDT using `SwingUtilities.invokeLater()` inside the `main` method, because I heard (please correct me if I'm wrong) that that's what you need to do with Swing. However, some parts of it shouldn't run on the EDT. These parts are parts that take long to complete (I assume that this is because long tasks on the EDT will interfere with GUI stuff the EDT should be doing, and thus these kinds of tasks should be run on parallel, on a different thread. Is this assumption correct?) To do this, when I need to perform a task that takes long to complete and thus can't be run on the EDT like the rest of the program, I create a new thread and run that task inside it. **My question is:** When the `run()` method of that new thread finishes, aka the thread finished it's job. Does it delete itself? Or does it keep existing in the memory?


Is curl something that's not expected to be installed on servers? I'm working for a small development shop and 99% of the problems that I'm having is regarding curl. Most of the projects that I'm working on involves calling a web API. Most web API's suggests using curl by default since you have to pass in a POST data in the request. Every time I complain to my senior that the server that I'm working on doesn't have curl installed the excuse that I'm always getting is that curl is not needed you can always use `file_get_contents`. So the question: is curl something that's not expected to be installed on servers that runs PHP, should I always develop using `file_get_contents` and not curl? Are there any advantages of using `file_get_contents` over curl or vise versa? If it helps, the context here is wordpress plugins, shopify apps, drupal modules and other bits of code that a lot of people can install.


title: Design and relationship of a cursor and its referred object

text: I need to implement a Cursor class to perform operations on a Document object, which is implemented internally as a simple list of rows. The Cursor class must have methods such as moving around the Document, add lines, remove lines, insert text in a given position etc. The problem I have is relative to the details of the design. To me, it seems that the cursor _must_ know the implementation details of the referred class. In C++, these classes must be friend classes, but I don't like it for obvious reasons (encapsulation etc.). I can't envision an interface for the Document class to keep its implementation private that also doesn't defeat the purpose of a Cursor class, that is, I end up having the interface of the Cursor on the Document class itself. Is leaking Document implementation details mandatory when implementing a Cursor? If not, what should the Document interface be?


title: Is documentation a User Story?

text: We need to do some user documentation for a product we have been working on for the past few sprints. We are now starting a new project in the next sprint and the PO is making the documentation for the product produced previously a User story for this sprint. I am just wondering your opinion on this approach. Personally, I don't agree that documentation is a User Story within Scrum because it doesn't produce any code. EDIT: Thanks for your opinions guys. I had it in the back of my head that a sprint was to implement an increment of working software, but your views have changed my outlook. Thank you for all your answers.


title: How do you estimate the time required for a "research phase" in agile development?

text: In the context of agile development, what is the appropriate amount of learning that an engineer should engage in before implementing a solution to a problem? If an engineer knows she is too ignorant of a given topic (say, compression) to start implementing, she goes and learns what she thinks she _needs_ to know, and then implements a solution. Clearly a deeper understanding of said topic _could_ result in a better implementation, but at the cost of agility. On the flip side if an engineer learns too little about a topic, there is a danger she will implement a significantly insufficient / broken implementation that negatively affects customers in the immediate or near future. Towards which end of this scale, if any, do guiding principles of agile lead an engineer? Or does agile leave this as a sliding scale, where the answer may be different in any given situation? ### Update: To be clear, I'm asking specifically what agile has to say, not what you think the right amount of learning should be. The former has a specific answer, the latter is subjective and not appropriate for Programmers ### Update 2: I rephrased the question title as a question, but my question remains the same (note the lack of change anywhere but this section and the title). Most of the answers, while insightful, did not answer the question (But they were appreciated! :) I'm looking to understand not when/how inside agile development research happens, but moreover how to estimate a "good" amount of time to spend learning a topic in the research phase before moving on to implementing a solution. I understand that in some cases, not a lot of research is required, and in some cases developers are faced with a topic even the senior-most developer knows little to nothing about, so the answer to this question includes an element of scalability to meet both situations.


title: Use the latest technology or use a mature technology as a developer?

text: I would like to develop an application for a group of people to use. I have decided to develop using python, but I am thinking of using python 2.X or python 3.X. If I use python 2.X, I need to upgrade it for the future... But it is more mature, and has many tools and libraries. If I develop using 3.X, I don't need to think of future integration, but currenttly it doesn't have many libraries, even a python to executable is not ready for all platforms. Also, one of the considerations is that it is a brand new application, so I don't have the history burden to maintain the old libraries. Any recommendation on this dilemma? More information about this application:   * Native application    * Time for maintenance: 5 years+    * Library/Tools must need: don't have idea, yet.   * Must need feature that in 2.X: Convert to an executable for both Windows and Mac OS X


title: Is it ok for services to reference one another?

text: I have a service that needs information implemented by another service in the same layer. Is it good practice for one service to take a dependency on another service in the same layer?


title: What negative consequences can arise from this language design rule?

text: _Clarification: the rule is meant to prevent accessing variables that are not declared yet._ _Clarification 2: the rule mandates that the compiler follows calls to functions which are defined in the same scope as the call and happen before the actual definition (forward referencing) - making the compiler much alike an interpreter._ I'm thinking about a fictional programming language that behaves similar to JavaScript when declaring functions: that is, when using the `function` keyword to create named functions, they get "hoisted" to the top of the scope and can be used anywhere where their name is visible. For example, the following is legal:               f();     function f() { console.log("f called") };      However, there is a potential problem: what if the function `f` uses a variable `x`, that is defined _after_ the call, like here:               f();     var x = 1;     function f() { console.log(x); }      In case of JavaScript, this is also legal, because variables are hoisted as well - the program gets essentially transformed into something like this:               var x;     function f() { console.log(x); }          f();     x = 1;      And therefore just prints `undefined`. **In my fictional language, variables wouldn't get hoisted** , which means that the example before would produce an error. The rule concerns how this error is generated: > Functions are visible for the entire block in which they are defined, but it > is illegal to call a function that accesses a variable declared after the > call. **This means that each time the compiler for this language would encounter a function call, it would have to check if the function is defined in the current scope, and if it is, check if it accesses variables in the current scope that are declared after the call.** The reason for this rule is that it makes no sense to access variables before they are declared. Hoisting the variables to the top of their scopes like JavaScript does is a hack that only leaves room for error! This is why I believe it must not be done, but such situations should be detected and treated as errors (because they are, you're referencing something that doesn't chronologically exist yet). **_I'm looking for reasons why this is a bad rule, i.e. results in complications or inconsistencies._** The reason I suspect that the rule is a bad one is that it does not exist in the Scala language. Scala solved this problem with a much more general rule: > The scope of a name introduced by a declaration or definition is the whole > statement sequence containing the binding. However, there is a restriction > on forward references in blocks: In a statement sequence `s[1]...s[n]` > making up a block, if a simple name in `s[i]` refers to an entity defined by > `s[j]` where `j >= i`, then for all `s[k]` between and including `s[i]` and > `s[j]`, > >   * `s[k]` cannot be a variable definition. >   * If `s[k]` is a value definition, it must be `lazy`. > **UPDATE:** For the time being I have adopted Scala's approach. This approach is a more general version of my rule: it will catch all illegal accesses, but also some that are not - this is a tradeoff that I'm willing to make since I think that my rule may be too complicated or even impossible to implement. Here's the rephrased/explained rule from Scala: Variables cannot be forward-referenced, but lazy values, functions defined with def (which are just syntax sugar for lambdas assigned to (lazy) values, might even remove them as Doval suggested), classes, and modules can. The restriction is that between the reference and the declaration (inclusive), there must be no variable definitions, because they might be altered by the entity being referenced before they are introduced to the program.


title: Convert to Object Oriented Programming

text: I am currently working on a project that is fairly small for the time being. There was a recent change to implement 3-tier architecture, such that the code is now split up appropriately to data access, business logic and user interface tiers. However, there is no use of objects outside of creating them to ultimately call a data access method. At a very basic level, pretty much everything we do is:                   Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load             Dim dt As New DataTable             dt = objBl.GetSomething             'Assign to Grid             'Format Grid         End Sub      I want to implement something more like:               Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load         Dim lstSomeObject As New List(Of SomeObject)         'Populate list of objects by calls to business layer         DataGridView1.DataSource = lstSomeObject         'Format Grid     End Sub      Ultimately, not much different. But instead of us having to pass thirty variables through to get a resultant data table that is used once, we could create an object (and lists of objects) and pass these around instead. I have a couple years experience working in such an environment, but zero experience in converting to such an environment. Frankly, I am at a loss as to how to do this. Do I create a separate entities project for this, and then does everything reference this? Or do I force our current objects to store both the properites and methods for each object type (this way feels counter-intuitive to me)? Or something else entirely? I have searched around most of the weekend and have not found anything overly helpful.


title: Exceptions: Why throw early, why catch late?

text: There are many well-known best practices about exception handling in isolation. I also know the do and don'ts very well, but I search for a best practices or patterns in larger environments, especially when to rethrow and when to catch exceptions. Moreover I'm always confused if I read: "throw early, catch late". Why should I throw early and catch late, if at a low-level-Layer a NPE is thrown? And why should I catch it at a higher layer? It doesn't make sense for me to catch a low-level exception at a higher level, like business layer. It violates concerns of each layer. Imagine the following situation: I have a service which calculates a figure. To calculate the figure the service accesses a repository to get raw data and some other services to prepare calculation. If something went wrong at the data retrieval layer, why should I throw a DataRetrievalException to higher level? In contrast I would prefer to wrap the exception into a meaningful exception. ### Why throw early, why catch late?


title: What exactly is Virtual Machine Bytecode?

text: I want to work on a very simple compiler for a very simple language. The compiler will compile the code to some basic bytecode. Later, a virtual machine program will run the bytecode, and execute the program. I have several questions about what bytecode actually is:   * Does bytecode have to be of binary form, aka composed of only 1 and 0 sequences? Or can it include more kinds of numbers, and even words?   * **How exactly, most commonly, is the bytecode of a program composed?** One idea I had for what the bytecode will contain and how it will be composed, using my compiler, is: The compiler will scan the developer's code, and convert each command to some bytecode equivalent. For example, the command `print` will be converted to `1` in the bytecode. Later, when the VM runs the bytecode, each element in the bytecode will be converted to some execution in the program. For example, if the VM scans the bytecode and comes acorss `1`, it will print something. Is this approach common? Is it valid? What is the most common approach to how and what the bytecode composes?


title: CQRS and cache invalidation (while load balancing)

text: I'm slowly trying to migrate our web application to use CQRS principals. In particular, I have separated "write" and "read" interfaces into commands and queries. I have implemented a "reader" class that can read some data from the DB. I have also implemented a decorator for this reader that caches the data to avoid any unnecessary roundtrips to the DB. At the moment this decorator is caching per-request. I'd like to cache this data for a longer duration - eg for a sliding 5 minute window. However, the problem is that a command that updates the data should invalidate the cache once the write occurs, and I'd like to capture that notion explicitly in our domain model. Specifically, here is the "read" interface (c#):               public interface IRoleLister     {         IList<DomainRole> Fetch(OtuIdentity otuIdentity);         IList<DomainRole> FetchForAuthenticatedId(int userId);     }      And here is the write interface:               public interface ICanChangeDomainRoles     {         void AddRoleToUser(int userId, DomainRole domainRole);         void RemoveRoleFromUser(int userId, DomainRole domainRole);     }      I realize that some variant of the observer pattern would probably be applicable, but I'm not sure how to capture that in the domain model. I also have identified another problem - namely cache key naming. In the IRoleLister I want to cache IList<DomainRole> by user (eg typeof(IList<DomainRole>) + ":userid" as the key) but in ICanChangeDomainRoles I don't know the key name. My thoughts are that the Observer should in someway be responsible for this. (Or perhaps some other interface? How do I capture that concept in my domain). Finally, I realize that some form of distributed cache would help, but that seems like an implementation detail - I want to capture the invalidation/notification/observer concept in my domain model. Any pointers would be appreciated


title: what is message passing in OO?

text: I've been studying OO programming, primarily in C++, C# and Java. I thought I had a good grasp on it with my understanding of encapsulation, inheritance and polymorphism (as well as reading a lot of questions on this site). One thing that seems to popup up here and there is the concept of "message passing". Apparently, this is something that is not used whilst OO programming in today's mainstream languages, but is supported by Smalltalk. My questions are:   * What is message passing? (Can someone give a practical example?)   * Is there any support for this "message passing" in C++, C# or Java?


title: Visualizing a CUP grammar

text: I am implementing a grammar in CUP, and it would often be helpful to see everything at a glance. This could also be useful in finding errors quickly. Are there any programs out there that will visualize grammar in the CUP syntax? Or can you think of a very easy way of doing it (for instance, convert the grammar to another format that program X can read).


title: Shared Cache - Invalidation Best Practice

text: I'd like to know what would be a better approach to invalidate/update cache objects. **Prerequisites**     * Having remote memcached server (serving as cache for multiple applications)   * All servers are hosted by azure (affinity regions, same data centers)   * Cache object size ranges from 200 bytes up to a 50 kilobytes     **Approach 1 (store in cache asap)**     1. Object A is created -> store in database and store in cache   2. Object A requested by client -> check cache for existence, otherwise fetch from database and store in cache   3. Object A gets updated -> store in database, store in cache Approach 1 seems to be more straightforward. If something is created, put in the cache asap. Regardless of someone will need it.    **Approach 2 (lazy cache store)**     1. Object A is created -> store in database   2. Object A requested by client -> check cache for existence, otherwise fetch from database and store in cache   3. Object A gets updated -> store in database, delete key in cache Approach 2 seems to be more memory-aware. In this approach only requested items go to cache.    **Question 1:** In mind of performance, what would be a better approach? Memory nor CPU do not count yet.      **Question 2:** Are my thoughts a kind of premature optimization?      **Question 3:** Any other thoughts? Other approaches?


title: Ordered enumeration: IEnumerable or Array (in C#)?

text: Typical context: I make an extension method for a collection which considers that the elements are ordered. The function starts at the beginning, at index 0, and the order has significance. Examples: Grouping by sequence or Indexes of an item. However, I'm always stumped as to what to extend: `IEnumerable<T>` or `T[]`. My rationale was clarity of purpose: An array has a notion of ordering, whereas an IEnumerable is implemented by many generic collections, not all of which have a notion of order:   * Dictionary - unordered   * HashSet - unordered   * LinkedList - ordered   * List - ordered   * Queue - ordered   * SortedDictionary - sorted (not original order)   * SortedList - sorted (not original order)   * SortedSet - sorted (not original order)   * Stack - reversed As well as any other implementation which might or might not be ordered. Also, I'm not certain if the enumerator is reset if an enumeration is not completed, so if that's a worry, then who knows at what point the enumeration would start? Enumerating an array would always start at the beginning. So to me, it makes more sense to extend a `T[]`. But am I correct in thinking that? Am I worrying too much? What's the proper approach for ensuring "ordered" enumeration?


title: Algorithm for the shrinking of pixel art

text: This is something I've been wondering about for a while - are there any algorithms out there to scale pixel art down? I'm sure we all know about the upscale versions on the Wikipedia page on Image Scaling. I would have thought something like nearest neighbour resampling to get the colour pattern right, and then redrawing the outline, or high-contrast areas, over the top. Is there anything out there or am I going to have to learn how to do this myself? Thanks!


title: Getting started with build tools

text: I am on my final year on CS, working on my first significant project, so I thought its about time to learn and use build tools. I have read about Maven mainly and heard about Ant. I would like to know your opinion about which I should learn to use for a project that will be developed only by one person, keeping in mind the learning curve, and the functionality that will be useful in this case.