title: Where was "async" all these days?

text: It was started with C# 5's new keyword "async". And now I see this async programming everywhere from Javascript to C++, mostly from Microsoft. And from various discussions I came to know, this is a very useful technique to avoid threading yet keep CPU working while other things are fetched form hard disk or network. My question is, why such an important topic was ignored all these days? Or it's just a hype from Microsoft?


title: Can you write an unambiguous specification in a natural language like English?

text: It seems to me that you cannot possibly write a software specification in English that is completely free of ambiguities, simply due to the informal nature of natural language - and therefore that a truly unambiguous specification must include code written in a formally specified language. Is this a known result or am I missing something?


title: Unit Test Friendly Domain Driven Design

text: Many of the readings I've done on DDD, both in books and online, seem to represent code that, often times, is difficult or impossible to unit test. For example, there are numerous samples with static factories, calls to concrete domain classes and static extension methods (in C# samples only). I find it frustrating and taxing to have to constantly re-evaluate the code to make it testable in my mind. Can anyone suggest material that demonstrates DDD code with 100% testability in mind (preferably in C#)? Also, to meander a bit: Is the fact that many of the code samples are not test-friendly a sign (smell) that DDD is becoming antiquated?


title: what is the best way to ensure accountability in code checkins?

text: Note: after writing this I realize that this question is perhaps philosophical, but I'm interested in how the industry handles this scenario regardless. I have recently been working with a code base that is not yet as testable as it should be. I've seen some junior developers check in code that breaks use cases, which is usually identified by another developer a few days after the check-in. Assuming that we can't achieve code coverage yet, are there technical solutions for holding developers accountable for bad check-ins in addition to a non-technical approach; discussing the commit and having the dev address the issue in a new commit.


title: Name for a bug that disappears when someone else looks at it

text: Does anyone know of an existing name for a bug that disappears the moment you call someone over to look at it? It's a funny phenomenon, but it has happened from time to time that I'm working on a bug that consistently appears, but as soon as I call over a colleague to look at it with me, the buggy behavior stops and doesn't reappear. This is distinct from any of the other oddball bug names I've found, such as heisenbug or mandelbug, in that it's definitely there, even when attempting to study it, until it's shown to someone else. My coworker proposed the name "Calvinbug" for this phenomenon, after Calvin & Hobbes. Thoughts? And no, I'm not crazy. :)


title: REST efficiency on count and sum methods

text: For example, if I have a Customer Transactions Table and I create a REST for it. The fields are: date, description, and total_amount. I am trying to figure out which one is much more efficient when you get the sum and the count of the transactions:   1. You create a REST for `/transactons` URI and it lists down all the transactions. Then, you `sum` all transactions using javascript and you `count` all transactions using javascript.   2. You create a REST for `/transactions/count` and `/transactions/sum` URI and lists down count and sum for all transactions. Then, get the count and sum using javascript. I'm wondering which one is a better way.


title: How is developing apps for Windows Phone 8 is different from Windows Phone 7.x?

text: What has changed with regards to the design patterns? Do both use the same development techniques? If I'm faced with the option of learning `Windows Phone 7` vs `Windows Phone 8` will learning windows phone 7 will qualify me for directly start development for windows phone 8?


title: What's the best RESTful URL structure for a recursive resource?

text: I'm creating a RESTfull service for a tree-like resource structure and was wondering what the best URL structure would be? I have three requirements:   1. be able to get a collection of root resources    2. be able to get an individual resource    3. be able to get a collection of child resources My current thought is:               /rest/documents     /rest/documents/{id}     /rest/documents/{id}/documents      I was also thinking of going the singular / plural routes to denote lists or individual elements, but I know I'm going to have a resource that is the same plural as it is singular, so decided against this. Does anybody have any thoughts on the above? or have a different / better way of structuring this? Many thanks Matt


title: When comparing a combination of String literals, is it convention to call .equals() on the literal?

text: There are benefits to each, and I understand the differences - but what is considered best / standard practice? Why? `"myString".equals(myStringVar)`   * Avoids a potential NPE and does not require a null check. (Good thing?)   * Cleaner to read since a null check is not required.   * If null is not an expected value, your program could be breaking without being any the wiser. `myStringVar.equals("myString")`   * Requires a null check if null is an expected value. (Good thing?)   * Can clutter up compound conditionals with null checks.   * Allows for NPE to let us know if something has broken.


title: Do Java, J2EE and Java Web get better with time? It still looks problematic to me after months

text: I'm a little new to Java Web Development. JSF, JSP, Servlets, Hibernate etc... I have really a good understanding of OOP and C++. I have years of PHP and MySQL web development experience. I also have experience with C# and ASP.NET and I'm a software engineering student. I don't want to continue my career with PHP, since it is getting very popular, there are many people who use it and I can't really use my engineering knowledge fully with PHP. It is more basic. I need a more enterprise environment, Java EE is exactly like this. But... For these last weeks I was re-thinking about keeping up my progress with Java EE. I have these **problems listed below** , and I'd like to get your thoughts on those especially if you are an experienced Java EE developed. The most primitive question is, **do they get better with getting used to Java with time, as a developer? Do you, if you are experienced in Java EE, still deal with those kinds of problems after years?**        * There's always a "version conflict" between jars needs to be solved.   * You always get an error because of a missing or extra jar.   * There are so many jar files... That is really overwhelming. I'm using Hibernate, JSF and CXF in Tomcat and I have 100+ jar files in WEB-INF/lib. The two problems above I listed increases with jars count.   * Tomcat or Glassfish is not really enough for development. Especially Tomcat is worse. There are many problems. Let's say, Tomcat does not update wtpwebapps dir always. I sometimes copy-paste jars manually. Eclipse 80% of the time restarts Tomcat on saving .java files, and does not update in hot-replace mode, but sometimes do. (Yes using always in debug mode)   * There are many implementations. That's fine but setting up one of them takes at least hours, or days. Like Web Services. Which implementation? I just got an error because the latest Axis2 doesn't support Dynamic Web Module 3.0.   * Setting up the development environment takes hours. If I need to work on a different computer, I check out SVN repository and set up libraries in Build Path, server, and solve new dependency bugs which takes lots of time. I still have no idea how to deal with different paths of libraries on different computers (some paths are not relative like Axis2 project folder setting).   * The logging system of Tomcat or Glassfish still look complicated to me after months. I get tired of checking Console tab of Eclipse if there's an error/exception. Even half of the exceptions don't clearly describe the problem.   * There's no stability like Apache Web Server (or php binary in that sense) in Tomcat and Glassfish. You can very well easily crash the whole Web App Server with a tiny bug. (Even the app shouldn't get crashed. Just that request should be crashed.)   * I've used PHP for years and no bugs affected my development or production. But with just 5-6 month with java I got a few bugs that slowed me down. Even Eclipse has critical bugs in its core features. (i.e. Android Emulator does not deploy my .apk file and I need to kill adb.exe everytime after I start the emulator. This is not exactly Java EE but a good example. There were other Java EE bugs I run across.)   * There's always a support problem for new releases. (i. e. latest Eclipse does not support Hiberbate Tools.)   * There are many configuration files everywhere.   * Configuration files are really different. Even using just a logging system like log4j takes hours to understand its configuration and implementation into project system. Those are just popped from my mind. There are of course other problems. Every language does but Java seems to me has more than others. **So, do they get better with time for me as a developer? 2-3 years later, if I continue with Java and J2EE, will I be get rid of most of those annoying things because of being more experienced?**


title: Should code-behind in WPF be considered part of the view?

text: I've read plenty of articles around different patterns in use with WPF and this is something I've yet to understand: **should a code-behind file be considered part of the view?** As a consequence, should code-behind files be allowed utilise knowledge of specific elements in the markup? I have a number of scenarios where the controls which are present in a view are influenced by data in the view model (eg a button for each list item). Currently, I handle these kinds of scenarios in the relevant code-behind file. To me, this feels like an implementation detail of the view and thus part of it; another view of the same view model might choose a list box of list items for example).


title: Is a pair of two tightly coupled classes any better than a single, larger class?

text: I'm rewriting somebody else's code at the minute, and I came across two classes which reference each other directly and call methods on each other. Like so (example in C#):               class A {       B otherClass;       public A() {         this.otherClass = new B(this);       }       // Other methods here call methods on B     }          class B {       A otherClass;       public B(A otherClass) {         this.otherClass = otherClass;       }       // Other methods here call methods on A     }      Reading through his code and trying to understand it, I'm having to move between the two classes as they call each other. These classes are not independently reusable without using the other. I'm aware it's considered best practice to avoid circular references (and it's straight up not allowed between C# projects in Visual Studio), but is this, or could this be, in your experience any better than having a single - larger - class?


title: How does the maintenance of OpenJDK work in practice?

text: Specifically, I would like to understand the difference between Oracle's JDK and OpenJDK in terms of bug fixes and other patches. Which branch gets fixes first and is Oracle in a habit of making patches that never make it to OpenJDK?


title: Am I too young to burn out?

text: I feel like I have burned out, even though I am only out of college for 5 years. For the first 3 years of my career, things were going awesome. I was never anything special in school, but I felt special at my company. Looking back, I could tell that I made all the right moves:   * I actively tried to improve myself daily.   * I made a point of helping anyone I could.   * I made a point (and read books about) being a good team member.   * I had fun. After 3 years in a row as being rated as a top employee, I converted that political capital into choosing to work on an interesting, glamorous project with only 2 developers: me and a highly respected senior technical leader. I worked HARD on that project, and it came out a huge success. High in quality, low in bugs, no delays, etc. The senior tech lead got a major promotion and a GIGANTIC bonus. I got nothing. I was so disappointed that I just stopped caring. Over the last year, I have just kind of floated. During my first 4 years I felt energized after a 10 hour day. Now I can barely be bothered to work 6 hours a day. Any advice? I don't even know what I'm asking. I am just hoping smart people see this and drop me a few pieces of wisdom.


title: Database ERD design: 2 types user in one table

text: I have read this (Database design: 3 types of users, separate or one table?) I decided to put admin and normal user in one table since the attributes are similar:               fullname,     address,     phone,     email,     gender     ...      Then I want to draw ERD, suddenly my mind pop out a question. How to draw? Customer make appointment and admin approve appointment. now only two tables, and admin, customer in same table. Help.


title: Handling multiple login methods

text: Currently, I'm using Parse to handle my backend, and I have multiple ways to login -> via regular email/password and via linkedin. Parse has a specific method of logging in requiring username/password. If a user registers through linkedin, I hash a combination of his information as his password, and login through parse. (i.e. username: user's linkedin account / password: hashed version of user information). If a user registers through email, the user sets his own password, logs in through parse (i.e. username: user's email / password: user's predefined password). There's no way to retrieve a plain text version of the password, so what would be a good way to handle login through linkedin when the user has registered regularly (set his own password), and vice versa?


title: Do you experiment with unconventional ways to use design patterns?

text: We stick to standard usages and best practices because they work and communicate intent well, but without trying new things we can't really grow. Have you ever tried something that seemed absurd but worked out really well? When it works, how do you avoid confusing other developers with non-standard usages? And what do you do when things go horribly wrong - refactor, start over, or just go with it?


title: Creating a line of business application with Visual Studio Isolated Shell

text: I ask this to the pros out there - Is it feasible to build a new LOB(Line Of Business) application with VS Shell as an stand alone application. There are some points that I thought needs to changed, but I'm unaware how, like - There will be no document. Instead there will be windows with controls where people enter data. There will be no file menu(new,edit). Instead there will be a login box when the application opens(something like the SQL Server Management Studio). There should be floating windows which hosts the control and some kind of window management where these windows can be minimized(obviously inside the shell) These are some of the points which I thought of. Obviously there are many other points which needs to be changed and I ask you to populate the list. Also please point me out how to start with it, best practices and possibly any other tips which you think should be mentioned.


title: What is the best technology for a TRULY portable REST client

text: I develop a suite of productivity tools, for Mac, iOS and Windows. They all communicate with a sync server via a RESTful interface (using Protocol Buffers), but as we add new platforms, we realize the pain it is to recreate different versions of the same code just to communicate with the client, so we have thought of using a modular design:   * The backend client module would be the same for all clients, so that changes to the protocol can be easily ported to all clients   * Clients we need to support: Windows, Mac, iOS, Android, Web, possibly Windows Mobile The only way I can think of is via a JavaScript module that's shared across all clients and handles communications with the server, but perhaps that's even more work because of the integration required with the JavaScript interpreter. Maybe we might be better off writing a couple of backend modules instead of just one.


title: How to lead a development project without technical expertise

text: I have been a hands-on developer for my entire career and love working with code. I have always resented the team lead who has little or no expertise regarding a particular technology and yet insists on a certain implementation. Now I find myself on the other side of the looking glass. I am the lead developer of a fat client to be implemented in C#, however my expertise is in building Java web applications. While I know that I can leverage design patterns and OO paradigms in any language, I am lost when it comes to coding standards, project life cycle tools and release/distribution procedures. I have no doubt that I can pick up the basics within a month or two, but there are certain experiences one can only gather with time. What should I do, and how do I avoid becoming the project lead that I hated when I was developing?


title: Which language is the most flexible for scraping websites?

text: I'm new to programming. I know a little python and a little objective c, and I've been going through tutorials for each. Then it occurred to me, I need to know which language is more flexible (python, obj c, something else) for screen scraping a website for content. What do I mean by "flexible"? Well, ideally, I need something that will be easy to refactor and tweak for similar projects. I'm trying to avoid doing a lot of re-writing (well, re- coding) if I wanted to switch some of the variables in the program (i.e., the website to be scraped, the content to fetch, etc). Anyways, if you could please give me your opinion, that would be great. Oh, and if you know any existing frameworks for the language you recommend, please share. (I know a little about Selenium and BeautifulSoup for python already).


title: Local and cloud editions?

text: I have a .NET web server application I'm building that I plan to host at a .NET cloud hosting platform, like AppHarbor with SQL server. It will be used by multiple small groups of people to record and processes votes at an election (the current system is called TallyJ). I also need my users to be able to set up a self-contained edition on a single PC, or as a server on a PC with an ad hoc LAN that is **not** connected to the internet when it is being used. My current plan would be to use IIS Express and SQL CE for a local setup. With that, the local and hosted versions of code and SQL would be the same. Does this sound viable, or am I missing something? Do you have any suggestions for a better set of tools (but limited to C# and a relational database on the server/cloud)?


title: How permissive should a language be about identifiers?

text: > This is a sister question to: Is it bad to use Unicode characters in > variable names? As is my wont, I'm working on a language project. The thought came to me that allowing multi-token identifiers might improve both readability and writability:               primary controller = new Data Interaction Controller();          # vs.          primary_controller = new DataInteractionController();      And whether or not you think that's a good idea*, it got me musing about how permissive a language ought to be about identifiers, and how much value there is in being so. It's obvious that allowing characters outside the usual `[0-9A-Za-z_]` has some advantages in terms of writability, readability, and proximity to the domain, but also that it can create maintenance nightmares. There seems to be a consensus (or at least a trend) that English is the language of programming. Does a Chinese programmer really need to be writing `电子邮件地址` when `email_address` is the international preference? I hate to be Anglocentric when it comes to Unicode, or a stickler when it comes to other identifier restrictions, but is it really worth it to allow crazy variable names? **tl;dr: Is the cost of laxity higher than the potential benefit?** Why or why not? What experiences and evidence can you share in favour of or opposed to relaxed restrictions? Where do you think is the ideal on the continuum? * My argument in favour of allowing multi-token identifiers is that it introduces more sane points to break long lines of code, while still allowing names to be descriptive, _and_ avoiding `ExcessiveCamelCase` and `a_whole_lot_of_underscores`, both of which are detrimental to readability.


title: Why does Java allow to implement different interfaces, each containing a method with the same signature?

text: I recently found out that I can have two interfaces, one containing a method with the same signature as a method in the other interface. And I can have an interface or class that implements both of afore-mentioned interfaces. So the descendant class/interface implicitly implements two different methods as one method. Why is this allowed in Java? I can see numerous problems arising from this. Eclipse, for example, can only find out about implementations for one interface method, but for the second one it doesn't show any implementations at all. Also, I believe that there would be problems with automatic refactoring, like when you want to change the signature of the method in one of the interfaces and the IDE will be unable to correctly change that signature in all implementations (since they implement two different interfaces, and the IDE cannot tell which interface method the implementation is referring to.) Why don't just make a compiler error like 'interfaces method names clashes' or something like that?


title: Representing complex object dependencies

text: I have several classes with a reasonably complex (but acyclic) dependency graph. All the dependencies are of the form: `class X` instance contains an attribute of `class Y`. All such attributes are set during initialization and never changed again. Each class' constructor has just a couple parameters, and each object knows the proper parameters to pass to the constructors of the objects it contains. `class Outer` is at the top of the dependency hierarchy, i.e., no class depends on it. Currently, the UI layer only creates an `Outer` instance; the parameters for `Outer` constructor are derived from the user input. Of course, `Outer` in the process of initialization, creates the objects it needs, which in turn create the objects they need, and so on. The new development is that the a user who knows the dependency graph may want to reach deep into it, and set the values of some of the arguments passed to constructors of the inner classes (essentially overriding the values used currently). How should I change the design to support this? I could keep the current approach where all the inner classes are created by the classes that need them. In this case, the information about "user overrides" would need to be passed to `Outer` class' constructor in some complex `user_overrides` structure. Perhaps `user_overrides` could be the full logical representation of the dependency graph, with the overrides attached to the appropriate edges. `Outer` class would pass `user_overrides` to every object it creates, and they would do the same. Each object, before initializing lower level objects, will find its location in that graph and check if the user requested an override to any of the constructor arguments. Alternatively, I could rewrite all the objects' constructors to take as parameters the full objects they require. Thus, the creation of all the inner objects would be moved outside the whole hierarchy, into a new controller layer that lies between `Outer` and UI layer. The controller layer would essentially traverse the dependency graph from the bottom, creating all the objects as it goes. The controller layer would have to ask the higher-level objects for parameter values for the lower-level objects whenever the relevant parameter isn't provided by the user. Neither approach looks terribly simple. Is there any other approach? Has this problem come up enough in the past to have a pattern that I can read about? I'm using Python, but I don't think it matters much at the design level.


title: Should a Biotech company invest in developing its own software?

text: Working in a Biotech company, there are many opportunities for automating the processing of information. There are also many software solutions e.g. LIM systems, ELN's etc. to fit those specific needs. What I have found and am continuously learning about is that these systems, despite doing their specific jobs very well, are isolated from one another. Typically, for one piece of information to get related to another piece of information in another system, some coordination between the users needs to occur via e-mail, word- of-mouth, etc. # The Problem Coordination and delivery of the information usually takes days or in some cases, a week or more to accomplish with what seems to me a high-potential to misinform and make non-tracked mistakes. # Possible Solution The role I have at this company is an experimental one to play around with the proposed solution of having a resource to develop software solutions to connect these isolated systems. We can use open-source libraries, external services, build it from scratch, etc. # The Question Since the Biotech company is not a software company, should such a company make such an invest in developing its own software solutions especially when there is nothing available on the market that fits their processes exactly? Are there systems out there that fit this kind of work? What experiences validate your answers? Thanks, in advance!


title: Get subset of associative array. Which of these is more readable? Is there another reason to use one over the other (or a different method)

text: If I have an array that has more info than I need and I want to pull out a subset of its name value pairs I have come up with 2 methods. Both rely on this:                 $detailkeys=array(title,summary,subtitle,url,imgsrc,description);      The method I came up with on my own:                 foreach ($detailkeys as $keyname) {         $details[$keyname]=$data[$keyname];       }      The method I found online:                 // get just the desired parts of $data and put them in $details.       $details=array_intersect_key($data, array_flip($detailkeys));       The second method, with a decent comment, is what I chose, but wanted to see what anyone else had to say about it.


title: How to explain your non-programmer boss you need to refactor a whole site?

text: First of all, is not a programming matter, is a programmer afair. I'm the new web programmer in my company.   I'm here just for 2 weeks. And they want me to teach Wordpress, configure & install it, and things like that. But they have a intranet too to make all the compatibility stuff, tracking clients, ordering event, auto-emailing. Well, the intranet is very nice, and they spent 1 or 2 years with a programmer to do that. But the problem is: The intranet is great for the user (a bad UI experience but works well).   They have it from 4 or 5 years now. But if you go to the code, it is annoying. Seriously, it's really really really heavy, code duplicated, insecure. All works ok, but all is wrong in code view. Some points:   * The site keeps 4GB of disk space (without DB!)   * There where thousands of files, folders, with no order   * A lot of files are duplicated   * There were, at least, 20-40 files you have to configure to change the database source   * Some config files are in .ini, so i can download from anywhere   * The sites was coded for 4.0 or 3.x, miraculously it works on 5.x with some warnings.   * The site was coded without any kind of scalability, they just copy and paste files and keep working, no includes, nothing. For example: I see, at least 40 files called check_in.php in different folders. Functions called: paste() paste_2()... What points you will use to convince your boss to take care of that and refactor all the whole site? It's a pain in the ass. I know refactor all gonna be hard, but I think it's the better way to continue my work.   Because they want me to make modifications on that and I have to spent 3 hours just to understand from where comes that **** function called paste() and what exactly do. Ah, one more good point. There's no documentation at all.


title: How do I make my ASP.NET application take an action based on time?

text: I have an ASP.NET MVC4 application. Suppose that I wanted to execute some code (such as emailing a user) 2 days after a user has signed up. One way is to have code executed on every request which scans the database for users and their sign-up time and execute code based on that. This seems messy and it depends on people visiting the application frequently. Another way is to write a separate application that runs on the server 24/7 and performs the checking itself, perhaps scanning the database at 12:00am every day and performing its own code. What's the good way to go about this?


title: Starting small custom development company, type of niches to target?

text: This is kind of a new years thing for me as I want to be more entrepreneurial going forward with programming and this is kind of a general question for anyone who may share the same ambitions as me. I have experience with web programming and, although I work full time for a company doing programming, I have some freelance programmers that I work with / employ for small projects. I want to see about taking things to the next level as far as building a small company doing custom development. I'm just not sure how to figure out what niches to target as far as what type of apps to build as demos, etc. I was thinking mobile (maybe Android or iPhone) but am just curious if anyone has any advice / resources. A lot of "web development" seems to end up being just using a CMS like Joomla or Wordpress, for smaller sites, so I want to figure a way to steer clear of this crowd and find some opportunity with companies / entrepreneurs who actually need real programming development done to build apps. Thanks for any advice


title: On merging database records, constraint violation in the intermediate table of M2M

text: If you are merging two or more database records from table X, that have a many-to-many relationship with table Y, how should you solve the problem of records in intermediate table Z that would violate one or more constraints as a result of the merge? Do you simply discard them or break off the transaction?


title: What counts as reinventing the wheel?

text: Do the following scenarios count as "reinventing the wheel" in your book?   * A solution exists, but not in the language you want to use, and existing solutions can't be interfaced with the language you want to use in a clean, idiomatic way.   * In principle you could get an existing library to do what you wanted with heavy modification, but you think it would probably be easier to just start from scratch.   * What you're writing has the same one-line description as stuff that's already been done, but you're targeting a different niche. For example, maybe your problem has been solved a zillion times before, but in a way that's inefficient for large datasets and your code works well for large datasets.


title: Text comparison algorithm using java-diff-utils

text: One of the features in our project is to implement a comparison algorithm between two versions of text and provide a % change between the two versions. While I was researching, I came across google java-diff-utils project. Has anyone used this for comparing text using java-diff-utils ? Using this utility, I can get a list of "delta" which I assume I can use it for the % of difference between two versions of the text? Is this a correct way of doing this? If you have done any text comparison algorithm using Java, could you give me some pointers?


title: Dapper and object validation/business rules enforcement

text: This isn't really Dapper-specific, actually, as it relates to any XML- serializeable object.. but it came up when I was storing an object using Dapper. Anyways, say I have a user class. Normally, I'd do something like this:               class User     {         public string SIN {get; private set;}         public string DisplayName {get;set;}              public User(string sin)         {             if (string.IsNullOrWhiteSpace(sin))                 throw new ArgumentException("SIN must be specified");             this.SIN = sin;         }     }      Since a SIN is required, I'd just create a constructor with a sin parameter, and make it read-only. However, with a Dapper (and probably any other ORM), I need to provide a parameterless constructor, and make all properties writeable. So now I have this:               class User: IValidatableObject      {         public int Id { get; set; }         public string SIN { get; set; }         public string DisplayName { get; set; }              public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)         {           // implementation         }     }      This seems.. can't really pick the word, a bad smell?   A) I'm allowing to change properties that should not be changed ever after an object has been created (SIN, userid) B) Now I have to implement IValidatableObject or something like that to test those properties before updating them to db. So how do you go about it ?


title: Does having a funny or silly name hurt a project?

text: This question has been bothering me for a while. Let's take some of my projects as an example. In my projects I tend to prefix them with "quack". This means that you'll have project names like (disclosure: These are my actual projects) Quackbot, an IRC bot, and Quackedcube, which was a Rubik's Cube solver. At least when repeating to others, the name does sound strange and unprofessional. The only other example I can think of is the Bouncy Castle library for Java which handles all sorts of encryption related things. The name, though, sounds a little silly, and I've seen several comments to Stack Overflow answers that recommend it saying something like "Would anyone really trust their commercial app to something called Bouncy Castle?" In these two examples, would you say that the name will or has prevented adoption by people seriously looking for libraries for their commercial application? Is the success of Bouncy Castle an example of the rule or the exception? Would you use libraries or programs with silly, funny, or immature names?


title: Using Backbone.js with ASP.Net MVC

text: I'm currently looking into the advantages of using Backbone.js, but I'll be using ASP.Net MVC as the main bulk of the site. My question is, is it worth blending the 2 together or am I making a rod for my own back? Should I just use an ASP.Net Web Forms site instead?


title: Best practice to query data from MS SQL Server in C Sharp?

text: What is the best way to query data from a MS SQL Server in C Sharp? I know that it is not good practice to have an SQL query in the code. Is the best way to create a stored procedure and call it from C Sharp with parameters?               using (var conn = new SqlConnection(connStr))     using (var command = new SqlCommand("StoredProc", conn) {                                 CommandType = CommandType.StoredProcedure }) {        conn.Open();        command.ExecuteNonQuery();        conn.Close();     }


title: conciseness to speed ratio

text: In general, the more concise & flexible a language is the slower is the execution of programs written in this language. on the other side, the fast languages are mostly overly verbose, requiring you to write several lines just to output "hello world", which means harder development time and is more error prone. so the question is, is there any measurement of the conciseness to speed ratio?. if yes, how is it called and where can I find some information about it. thanks. **note:** one can create a language of single letter tokens, `p h` printing hello world, that's terseness. conciseness means -for our purpose- as defined here : > Giving a lot of information clearly and in a few words; brief but > comprehensive


title: Does it makes sense to implement an event dispatching system that allows event bubbling for non GUI related objects?

text: Following up on this question of mine, where I wanted to know the general principles of implementing an event dispatching system that allows for events to bubble (and capturing I've come to learn); does such an implementation make any sense for non-GUI related objects? I'm asking, because I want to try and build a general purpose event dispatching framework in PHP (be it just for practice or for real use), but can't figure out whether event bubbling (or capturing) is in anyway useful in such an environment (not talking about PHP-GTK or similar environments here).


title: Robust way to keep records of software releases?

text: We release a number of small plug-ins that go along with our software. Each plug-in allows our software to talk to a single manufactuer's hardware. I would like to devise a system for keeping track of plug-in releases. ## Example info that should be stored:   * Hardware manufacturer name   * 32-bit? 64-bit? both?   * What modes of operation does the hardware support?   * What versions of the manufacturer's driver have been tested with the plugin? ## Desirable properties of the system:   * Able to synchronize with version control software   * Stores data in human-readable text file (also good for differ tool)   * Free visual, spreadsheet-like editor available   * Able to do simple analysis like "What is the oldest plug-in?" I've got to imagine that someone else has tackled this problem already. Right now my best guess is XML/JSON with a visual editor, but I have been disappointed in the editors I've tried so far. I'd like to get input from some more experienced developers. Thanks!


title: How is fundamental mathematics efficiently evaluated by programming languages?

text: As I get more and more involved with the theory behind programming, I find myself fascinated and dumbfounded by seemingly simple things.. I realize that my understanding of the majority of fundamental processes is justified through circular logic _**Q_** : How does this work? _**A_** : _Because it does!_ I hate this realization! I love knowledge, and on top of that I love learning, which leads me to my question (albeit it's a broad one). ## Question: > How are fundamental mathematical operators assessed with programming > languages? > > How have current methods been improved? # Example               var = 5 * 5;       My interpretation:               $num1 = 5; $num2 = 5; $num3 = 0;     while ($num2 > 0) {         $num3 = $num3 + $num1;         $num2 = $num2 - 1;     }     echo $num3;      This seems to be highly inefficient. With Higher factors, this method is very slow while the standard built in method is instantanious. How would you simulate multiplication without iterating addition?               var = 5 / 5;      How is this even done? I can't think of a way to literally split it 5 into 5 equal parts.               var = 5 ^ 5;       Iterations of iterations of addition? My interpretation:               $base = 5;     $mod = 5;     $num1 = $base;     while ($mod > 1) {              $num2 = 5; $num3 = 0;         while ($num2 > 0) {             $num3 = $num3 + $num1;             $num2 = $num2 - 1;         }         $num1 = $num3;         $mod -=1;     }     echo $num3;      Again, this is EXTREMELY inefficient, yet I can't think of another way to do this. This same question extends to all mathematical related functions that are handled automagically.


title: Why doesn't Java String have static string manipulation methods?

text: Why didn't **Java designers** create static versions of string manipulation methods in the `java.lang.String` class? The following methods are what I refer to, but the question can be extended to other non-static methods in the class as well.               concat(String)                        substring(int, int)     replace(char, char)                   toLowerCase()     replace(CharSequence, CharSequence)   toLowerCase(Locale)     replaceAll(String, String)            toString()     replaceFirst(String, String)          toUpperCase()     split(String)                         toUpperCase(Locale)     split(String, int)                    trim()     substring(int)      Having only non-static versions of these methods forces **explicit** null- checking anywhere such a method has to be called. For example, simply calling `example = example.trim()` would lead to _NullPointerException_ if `String example = null`. So the programmer has to do the following boilerplate null check:               if (example != null)         example = example.trim();     // OR:     example = (example==null) ? null : example.trim();     example = (example==null) ? null : example.substring(5);      I would imagine it would have been a lot more convenient if `String` had static versions of these methods (perhaps even _exclusively_ ), which would take the input string as the first argument:               example = String.trim(example);     example = String.replace(example, 'a', 'b');     example = String.substring(example, 5);      This would have led to cleaner code written by programmers which would have automatically taken care of null cases by simply returning null, rather than forcing programmers to explicitly handle null cases. The _returning of null_ makes sense to me since manipulating a _null_ string should result in a _null_ string, not an error. **Why didn't** Java designers think of this when they designed the `String` class in Java 1 or Java 2, or even add such a functionality in a later Java version?


title: Why does iPhone and iPad apps have a Free version and a full version, instead of "unlocking" it through in-app purchase?

text: Many apps have a Free version and a Full version. How is it compared to, installing a single version, and use an in-app purchase of $0.99 or $1.99 to unlock to the program to make it a full version? It does have the advantage that the user doesn't have to go to the App Store and install the program one more time and thus making it easier for the users to purchase.


title: What constitutes competency in XML in the .NET world?

text: I see a lot of .NET job postings that list XML as a required skill. What should one be able to do in/with XML to have confidence that this requirement is satisfied? Modeling? Work with XPATH? Familiarity with serialization? What is specific to .NET?


title: organising classes / folder structure for TDD-based development

text: Due to test-driven development, one ends up with many classes doing just one thing. It is quite a headache just to see **where** such classes would be placed inside the folder structure. First of all, is it considered a bad-pattern, to put related classes in the same file? Any suggestion on what one uses in actual-production environments?


title: Why aren't there Dimension and Point interfaces?

text: I mean something along the lines of:               public interface Dimensioned {         int getWidth();         int getHeight();     }      and               public interface Positioned {         int getX();         int getY();     }      There are a **lot** of standard java classes that have exactly those methods-- notably `Component` and all of its subclasses as well as `Dimension` and `Point`. `Image` could implement `Dimensioned`.   Despite the widespread use of these methods, there's no uniform way of referring to them. Is this a conscious decision on the part of the language designers? In writing this question, I've noticed that it _is_ rather difficult to come up with good descriptive names for the interfaces. Even so, it feels like it would be useful to have them. I can't seem to find much information on the topic.


title: Textarea validation

text: I'm interested to hear what characters people permit in the various common fields of input forms (barring e-mail...) For example: **Textarea/Messages** : do you allow completely free text, or restrict to alphanumeric and punctuation? I've tried to go the second route, but you always find someone out there that likes using tilde's... **Full name** : do you allow anything, or do you use a regex? **Telephone numbers** : numbers only **Addresses** : alphanumeric, whitespace, hyphens **City/Town names** : alphabet, hyphens, whitespace [NB: edited as requested]


title: Global variable vs. local-static variable for storing state

text: I am writing an application for my graduation coursework, in C, using GTK+ UI library. Sometimes I ask for user input, which I need to save for later use. The doubt comes on how to store this data. I didn't want to create global variables because I was told countless times not to use them. However, I need to interchange data between functions which don't call each other directly (because of slot-signal pattern, I don't have a function that's always accessible after the event loop starts), thus needing some independent storage. For this purpose I designed a getter-like function which reads similar to this:               char *store_data(char *data, int clear) {         static char *stored_data = NULL;              if(data == NULL) {             if(clear) {                 stored_data = NULL;             } else {                 return stored_data;             }         } else {             stored_data = data;         }              return NULL;     }      Is such a construct OK or should I simply use a global variable instead?


title: Should I test inherited methods?

text: Suppose I have a class **Manager** derived from a base class **Employee** , and that Employee has a method **getEmail()** that is inherited by **Manager**. Should I test that the behaviour of a manager's **getEmail()** method is in fact the same as an employee's? At the time these tests are written the behaviour will be the same, but of course at some point in the future someone might override this method, change its behaviour, and therefore break my application. However it seems a bit strange to essentially test for the _absence_ of meddling code. (Note that testing **Manager::getEmail()** method does not improve code coverage (or indeed any other code quality metrics (?)) until **Manager::getEmail()** is created/overridden.) (If the answer is "Yes", some information about how to go about managing tests that are shared between base and derived classes would be useful.) An equivalent formulation of the question: If a derived class inherits a method from a base class, how do you express (test) whether you're expecting the inherited method to:   1. Behave in exactly the same way as the base does right now (if the behaviour of the base changes, the behaviour of the derived method doesn't);    2. Behave exactly the same way as the base for all time (if the behaviour of the base class changes, the behaviour of the derived class changes as well); or   3. Behave however it wants to (you don't care about the behaviour of this method because you never call it).


title: Reasons for moving from pure JavaScript to a JavaScript library

text: Being aware of the direct benefits of libraries having things wrapped in a package, making daily work easier, my question is leaning more towards the fact that many features not implemented in HTML/DOM/CSS, has become available using these libraries. There is everything, from visual effects (13 a dozen) to more functional oriented, to choose from. As I see it today, 2014, with HTML5 and CSS3, more and more of these libraries seems to have played there role, as a kind of a bridge covering the gap between older browsers non capabilites and the new ones ability to handle it built in. Whats more, is that these libraries also seems to drop older browser support little by little. This gives me as a developer a hard decision, if to upgrade to next version with more functionality and lose old browser support, or stay on an older version with less functionality but with old browser support and the need of custom development to achieve new functionality. So my question is, is there anything else I might have missed, which could affect whether to implement a library as a base or use pure JavaScript and add a library when it is really needed?


title: Strategy for restoring state via URL in web apps

text: This is a question about modern web apps, where a single page is loaded, and all subsequent navigation is done by XHR calls and modifying the DOM. We can use libraries that manipulate the hash string, which let us navigate by URL and support the back/forward buttons. But to use those libraries, we need to be able to move the UI from any one state to any other. **Is there a good strategy for moving between UI states, that also allows them to be restored from scratch when you load a new URL?** In a complex app, you might have a lot of different states. You don't want to reload the entire UI each time you change states. But you also don't want to require separate methods for moving from every state to every every state. Typically we need to:   * Restore a state from scratch, when you enter a new URL or hit Reload.   * Move from one state to another, when you use the Back/Forward buttons.   * Move from one state to another, when you perform an action within your app (like clicking a link).   * Move to certain states that shouldn't be added to the history, like ones that appear after form submissions.   * Move to some states that are built on the previous state, like a drill-down list. When you perform actions within your app, there's the additional question of which comes first:   * Do you change the URL, listen for the URL change, and change your state in response to it?   * Or do you change your state, then change the URL, but don't do anything in response? Does anyone have some experience to share on this topic?


title: How can I clone an svn repository that changed layouts with git maintaining full history?

text: # Problem I want to clone an svn repo with git-svn. The problem is the subversion repository changed layouts at `r1235`. # Specifics From revision 1 to 1234, `foo` used the standard svn folder layout with:   * /trunk/src   * /tags/`version`/src At revision 1235, the author added `bar` to the repo. To do so they restructured the master repository making the folder layout look like this:   * /trunk/foo/src   * /trunk/bar/src   * /tags/`version`/foo/src   * /tags/`version`/bar/src # Goal I want a new git repository that has the history of `foo` as if it was never rearranged to include `bar`. # Relevant Documentation Working with non standard layouts is discussed in git-svn's documentation. If the entire history in unnecessary (or if I just want `bar`), I can get what I want from r1235 on:   * `git svn init --stdlayout http://path.to/repo`   * edit `repo/.git/config` adding `/foo` to relevant paths (or `/bar`) `               [svn-remote "svn"]        url = http://path.to/repo        fetch = trunk/foo:refs/remotes/trunk        branches = branches/*/foo:refs/remotes/*        tags = tags/*/foo:refs/remotes/tags/*      `   * `git svn fetch -r 1235:HEAD` # My attempts   * `git svn clone -r 1:1234 --stdlayout http://path.to/repo`   * edit `repo/.git/config` as above   * `git svn fetch -r 1235:HEAD` # Result The last command seems to succeed because `r1235` \- `HEAD` get downloaded. However, `git log` only shows commits up to `1234`. The working directory also seems to be the old revision.


title: ASP.NET and windows applications

text: Currently I'm still learning ASP.NET. My goal is to build dynamic websites. However, I also want to be able to build some windows applications as well. So, is it easy to learn Windows forms or WPF after ASP.NET? or is the reverse easier? meaning to start with WPF then move to ASP.NET?


title: Enterprise Integration: File Exchange vs Web Services

text: _TL;DR_ Sort of brainstorming: why integrating systems by means of exchanging loosely- structured files (as opposed to XML web services integration) is a bad idea? _TL Part_ We're offering an online solution for enterprise customers (big ones) and in implementing this we often need to integrate with their internal systems (HR databases, CRM and ERP systems, you know the drill). One of the most common integration point is that we need to have information about their employees in our internal databases. To that end, we're advocating information exchange via XML Web Services with either us calling their WS Endpoint on a regular basis and asking for changes since `timestamp` or them invoking _our_ WS and supplying all the information required. Enterprisey and buzzwordy enough, sure. Now, what we're offered is: every week we'll manually export our HR data into an Excel workbook, email it to you and expect this data to be where it belongs. Slightly better option: automatically exported Excel file is shared on a network drive accessible over VPN. Naturally, this is error-prone and doesn't scale, but that's the only cost- effective option for our customers. We need somehow to persuade them to switch over to Web Services, but since the final decision on whether our system will be implemented or not is made by someone without technical background we need to either present non-techincal arguments or present them in a way that's understandable by a mere mortal.


I have a set of questions that bothering me, hopefully someone will be able to answer them here:   * What should be an optimal team (in terms of roles) to write a big enterprise nice-quality framework?   * What big frameworks could act as a good references in terms of documentation, architecture, quality of implementation etc?    * What is your assumptions about size of teams that developed this frameworks? Looking forward for answers. Thanks!


title: Request - Reply vs Publish-subscribe

text: We are working on a integration between two large systems. **System A** is a database with employee data, and **System B** is an external system that is used for the daily contact with the customers (i.e meetings, locationdata,work order,work status, and so on). We will deploy a ESB in the middle. There are 3 instances of System A, and 1 instance of System B. This is due to legal restrictions and we cannot have all System A data in the same database. In System B we have 20-30 active contacts each day, where some of the data from System A is used continously. We need to update meeting, location, and work status in System B throughout the day. And have two proposed solutions for integrating these systems. **Solution A:** Publish-Subscribe - System A sends out update messages (This is based on HL7 ADT Standards) and the instance of System B picks up the data that is for them. This is done as broadcast and will generate 1000-10000 messages pr day. It will send information from System A on all employees, thus generating a message for every employee in System A (1,2,3). There is only a subset of employees from System A that is "active" and interesting for updates in System B. But messages will flow on ALL employees since data is updated by other systems aswell. **Soltion B:** System B ask for updated information through a request-reply solution. Will generate empty calls, but will only ask for the employees "active" in System B on given day. Comments on solutions? Pros - Cons? What is the most infrastructure "heavy" solution between these two? Hope there is someone out there who could give me som pointers :)


title: Design pattern for maintaining different state(s) across browser tabs in a single session

text: I have an MVC 4 based web app. Where I provide 2 login types, 1. Employee and 2. Customer. With Customer login, I present a dashboard and other stuff, about his orders, etc. With Employee login, I allow the employee to search for his customers and provide the ability to carry out certain customer specific tasks. It is possible that, an employee after login can seach for a number of customers and fetch each of their details in multiple browser tab(s). I am having difficulty in maintaining state for each tab, if I put the unique identifier of the customer in session, as the next subsequent request will overwrite the session! To solve this, I have relied on a (dirty) viewbag based solution, where I set the customer number in viewbag in every view. Is there an elegant solution to solve this? a known design pattern?


title: Evaluation order of the expressions

text: The C Programming Language by K & R states that C, like most languages, does not specify the order in which operands of an operator are evaluated. (The exceptions are &&,||,?: and ','). According to the book, the result of the statement :               printf("%d %d\n",++x,power(2,x));      depends on the compiler. But it itself says in the previous line,that I have quoted that it does not predict the order of evaluation,except ',' and others. So don't you think book is contradicting itself?


title: How to securely implement auto-login

text: I've read many, many, _many_ posts on how "you're probably storing passwords wrong". They are always referring to storing passwords on a server into which a user is logging; they basically rehash (pun intended) ubiquitous advice like make sure to salt the passwords, etc. etc. However, I've never seen an article on best practises for storing passwords on a _client_ so that the client doesn't have to log in manually every time they want to log in; the "remember me" feature. Many pieces of software have this feature, from browsers to programs like Dropbox. I did read an old article recently about how Dropbox was storing an ID on your computer that you could just copy/paste to another computer and start Dropbox and be logged in as the device you got the ID from; no login, no nothing, and full access to the Dropbox account. This seems like a really stupid design, but I can't think of any better way to do it. I'm not even sure how to avoid storing something like a cookie in plain-text. If you encrypt it, where do you store the key to decrypt it? The only way I see to not introduce security vulnerabilities is to remove the autologin feature and make the user type their password every time they want to use a service, but that's a usability struggle and users are spoiled to expect not to have to do that. What can I read about locally storing credentials safely to implement the automatic login feature? If the principles are too simple for an entire article, what are they? The software in question should not depend on features not present on all platforms (like the "keychain" some linux distributions have).


title: Do you sign contracts digitally or still on paper? And what do clients think?

text: We are all getting used to checking a box and putting our name in a text field to create a contract with an airline, a hosting company, or a software download. However, for some reason I am still asking clients to sign our contracts for website development on paper, and send me a scan. Few complain about this procedure, but I am personally thinking: what am I doing, doing this the old fashion way?! Signing contracts digitally would be faster, more convenient for clients and for me, and easier to store. So to me it appears to be time to start creating some contract agreement online that clients can read, then print their name, and mark a box "I AGREE WITH THIS CONTRACT AND BY PRINTING MY NAME I AGREE TO SIGNING THIS", or something like that. I would record their IP, browser data, and time of signing. If I really want to ensure their identity, I could link this to OpenID and require them to log in with their e-mail so that I can ensure that they are logged in on an existing e-mail account. Sounds OK to me. My question is: is this practice becoming a standard practice in professional IT services? Are you (as a professional) doing this? If you are, how do clients react? Any drawbacks doing this? EDIT: This question is _not_ about the legal aspects. It is about common practices among programmers and web-development companies, and what clients think of this.


title: In order traversal of M way Trees

text: If we have a 4 way tree such as the one shown below, and we do an in order traversal, what would the output of the in-order traversal be for an M-way tree? In which order would the nodes be visited? When would the value in the node be processed (upon first visit or upon second visit)? (As a concrete example, what would the step by step procedure for the in order traversal be for the example tree shown below?) ![screenshot](http://i.stack.imgur.com/Fpyk5.jpg)


title: Why does ARM processors dominate Mobile platforms while x86 dominates Desktop/Server platforms

text: Almost all of the mobile phones, except the ones being produced by Intel, use ARM based processors while desktop/server industry is dominated x86 processors. What features does one provide over the other with regards to the domination they have in their respective sectors?


title: Ensuring submitted hiscores are not fake

text: I have a small game that I would like to keep track og global hiscores for. The basic is simple: username and score is submitted to a server for storage and later polling. However how do I ensure that these scores aren't faked? Obviously, just accepting a submitted user+score blindly will allow people to telnet in their desired score. To combat this, I've thought up two approaches:   * Checksumming - In addition to the score and the username, the application sends a checksum of the two using an obscure algorithm and salt. If the same checksum doesn't add up, the server will reject it. However, how easy is it to reverse engineer the checksumming used, considering that this is an android application?   * Submitting the entire game - In addition to user+score, the steps taken to reach the score is also sent. The server then emulates the game to see if the steps result in the same score, and if not, rejects it. I consider this to be the safest, but for some types of games this can be very hard to do, as the factors are far too many. Is there a middle road? Are there any other methods worth considering? It's not like this is vital to national security or anything, but I would prefer if the users aren't left with _"HackedYourGame: 999999999 points"_ on top of the list.


title: database schema with unlimited hierarchical data that is modified a lot

text: I am trying to set up some sort of collaboration app/forum with unlimited threading; no difference between posts, threads, or forums. Any post can be answered an unlimited amount of time, and the same post can have several children, themselves having several children, and so on. Each post can also have several parents. The final result would look more like a mind-map than a forum, although usage as a regular forum would also be possible. How I see people using it: say a team discusses the making of a project website. After a few threads, the conversation splits in parallel conversations about coding & design. Then after a while, the two end nodes get linked. The conversation continues for a while...A third, unrelated conversation about bauhaus-style websites gets linked too, for reference...etc. I am trying right now to build a proof of concept, and I am at loss at what database design to choose. As I understand it, there is two possible patterns: adjacency list model, and nested set model. And as I understand it, the nested set is usually preferred. I have built an app based the on nested set model, and I know why it is more useful, in most cases. Something bothers me here though: since I intend to have a lot of users adding a lot of leafs on a lot of different nodes, and since the N.S.M. needs to move left or right a whole bunch of leaves each time a sibling is added, what would be my best database schema? I do not intend to release a fully optimized application yet, but I would still like to start on the right foot. Here are a few of my thoughts, I would like opinions on them:   * Leave a lot of space between nodes, so parents nodes would be numbered 0, 10000, 20000, etc. This is not an elegant solution, but might work   * Go back to the adjacency list model, and use a node_node table to link nodes. Less efficient in tree retrieval, but more efficient in adding/deleting nodes   * Ditch databases completely, and go back to file-based, with a mix of directories/xml to store data. I have never worked with filesystems to retrieve and search large amounts of data, I don't know how that would work out   * Is there any DB schema more adapted to my case that you know of? Thanks in advance


title: Is a compiled language preferred for web development or an interpreted one?

text: As you already know there are compiled and interpreted languages. From a performance point of view which is better when visiting a website? Will a website that was developed with a compiled langauge will load faster and performs actions faster as will? I want to reach to a point where I can unnderstand the steps required in both compiled/ interpreted site in order to bring them on stage! (in this case to the user browser).


title: Java Vs .NET Vs Oracle(DBMS), Which technology is for Long Term Career?

text: I want to know about Which language is best for long term career and How? Which language should I choose among Java and .NET Platform or Should I choose Oracle like DBMS Language (SQL/PLSQL)? I am confused? Detailed answer would be appreciated.


title: What does Private Cloud mean?

text: I read through a few discussions in SE about Cloud Computing . From them, I understand cloud as "computing / data-storage facility that is owned by a different entity; using hardware & software architecture that make it easily scalable on-demand, therefore support rentable-scalability models." Also, "the owning entity has a big-size data center, where virtualisation concepts are put to use to cater to multiple different customers from same hardware". Plus "redundancy, security etc are assumed to be taken care by the provider. " I read a discussion in SE about explaining Cloud Computing to grandmother. The 'garden vs supermarket', 'own-house vs hotel' examples suit perfectly. With this understanding, I am unable to visualise 'private cloud'. Frankly, 'private cloud' sounds like an oxymoron to me. (relate with 'private supermarket' , 'owned hotel' etc). Pardon my ignorance. So, what is 'private cloud' ?


title: Is it reasonable to expect knowing the whole stack bottom up?

text: I am an Sr. developer/architect/Product Manager for embedded systems. The systems that I have had experience with have typically been small to medium size codebases - typically close to 25-30K LOC in C, using 8-16 and 32 bit low end microcontrollers. The systems have been entirely bootstrapped by our team - meaning right from the start-up code to the end application code has either been written by the team, or at the very least, is thoroughly understood and maintained by us. Now, if we were to start developing more complex systems with complex peripherals, such as USB OTG et al. (think, low end cell phones), there are libraries and stacks available commercially and from chip vendors that reduce the task to just calling the right APIs and being able to use those peripherals. Now, from a habit point of view, this does not give me and the team a comfortable feeling, not being able to comprehend the entire code tree, with virtual black boxes at the lower layers. Is it reasonable to devote, and reserve, time getting into the details of how the APIs are implemented, assuming that the same would also entail getting into details of relevant standards (again, for USB as an example)? Or, alternatively, should a thorough understanding of the top level usage of the APIs be sufficient? This of course assumes that the source codes to all libraries are available, which they are, in almost all cases. Edit: In partial response to @Abhi Beckert, the documentation is refreshingly very comprehensive and meticulously maintained, AFAIK and been able to judge. I have not had a long experience with the same. Edit2: Excellent advice, everyone! Let me add that the evaluation phase is being conducted by only 2 devs, including myself. Also, shims may be potentially expensive in a resource constrained embedded environment, but I will have a look.


title: How to measure external quality of software

text: For my thesis, I am doing research into the characteristics of Behavior Driven Development (BDD). One of the BDD claims is that by specifying the requirements in a ubiquitous language together with the customer, the software will score better on the external quality. Another claim of BDD is that it produces clean code with a high code coverage. In my experiment, I will perform a software project both in BDD and traditional style, so that in the end I have two end products. The second claim of BDD is easy verifiable, by checking the code against some quality metrics, like Lines of Code, Cyclomatic Complexity and Code Coverage. However, I cannot think of a good measurement for the first claim. Is there anybody out here who has done this already? Or maybe can propose an alternative experiment that can validate this claim?


title: As a software engineer, who should I be following on Twitter?

text: Who in the software engineering and software development fields uses Twitter to tweet about relevant happenings in the field?


title: Hourly or per project billing?

text: How do you bill your programming projects? Do you do it per hour? Per job? Please include what kind of project you are doing in the answer. (Mobile, Web, Desktop, etc... You can be more specific if you want.) BONUS: If you'd like to give specific amounts in your answer, you may. ;-)


title: Scalable Job Handler

text: We have a job table that triggers a notification when a new job gets inserted. Clients that can handle such jobs may subscribe to those notifications. When a client receives a notification, he can "lock" the job, so no other client will try to process it. We have also take care of errors and if a job takes to long to process. **Problem:** A client can only handle X jobs at the same time. On heavy load, all clients are busy handling their jobs. And new jobs may not get handled right away. If the client is no longer busy, he may query the table to find jobs that have not been processed yet. But if all clients stay busy for a long time (they finish jobs but new jobs arrive at the same time), those old jobs will never be processed. **Idea:** After a client has processed Y jobs, he ignores all new jobs, and queries the table for the old ones. But I am not really comfortable with that idea. Any ideas by you? If you need more information don't hesitate to ask for them.


title: Structuring a storage system for a game

text: I am working on a **multiplayer** game, where a player has many storages to store items in. **Storage** Storage is the system that allows the user to deposit items, and take them back. Example of storage types:   * **Inventory** : Same as WoW inventory, you can add items, drop items, move items from slot to slot.   * **Bank** : Bank is what you can call, a super-inventory, which has around 300 items limit **per tab** Bank can have maximum of 10 tabs which will store items. total items allowed in the bank is 3000 _(10 tabs multiplied by 300 items per tab)_. How ever, in the bank, all items are stackable.   * **Equipment** : Equipment is the same as Inventory, just with sorted slots, i.e Helm, Body, Legs and there are total of 8 slots.   * **Chests and other** : Same as Bank just without tabs. **An item in-game** Each item has it's own item id. **Only certain** items can be stackable, unless the storage type is Bank or chest. I have created a system which will make it easier for me to manage storages, and there's the abstract class, that each storage type class will extend it:               public abstract class PlayerItemStorage {              private int size;              /**          * The items          */         private PlayerItem[] items;              /**          * Sometimes, by default, the storage items are id + 1, due to          * the client's interfaces. No exact explanation on it, but the only          * feature that doesn't do that is equipment and possible BoB          */         private boolean increasedItem = true;              public PlayerItemStorage(int storageSize) {             this.items = new PlayerItem[storageSize];             this.size = storageSize;         }              public PlayerItemStorage(PlayerItem[] items) {             this.items  = items;             this.size = items.length;         }              /**          * Resets the storage          */         public void resetStorage() {             this.items = new PlayerItem[this.size];         }              /**          * Gets the item list          * @return PlayerItem list          */         public PlayerItem[] getItems() {             return this.items;         }              /**          * Counts how many items there are with the same id.          * @param id Item id          * @return count          */         public int count(int id) {             int count = 0;             for (PlayerItem item : this.items) {                 if (this.getId(item) == id) {                     count++;                 }             }             return count;         }              /**          * Counts how many items there are in the inventory          * not including amount, just the item objects themself.          * @return amount          */         public int countItems() {             int count = 0;             for (PlayerItem item : this.items) {                 if (this.getId(item) > 0 && item.getAmount() > 0) {                     count++;                 }             }             return count;                }              /**          * Gets the length of the storage          * @return          */         public int getLength() {             return this.items.length;         }              /**          * Checks how many free slots the storage has          * @return          */         public int freeSlots() {             int slots = 0;             for (PlayerItem item : this.items) {                 if (this.getId(item) <= 0) {                     slots++;                 }             }                    return slots;         }              /**          * Finds an item id in the earliest slot.          * @param id Item ID          * @return Slot id          */         public int find(int id) {             for (int i = 0; i < this.items.length; i++) {                 PlayerItem item = this.items[i];                 if ( this.getId(item) == id && item.getAmount() > 0) {                     return i;                 }             }             return -1;               }              /**          * Gets the earliest free slot          * @return slot id          */         public int getFreeSlot() {             for (int i = 0; i < this.items.length; i++) {                 if (this.getId(i) <= 0) {                     return i;                 }             }             return -1;         }              /**          * Checks if item is existing in the given slot, with the given amount and           * item id.          * @param id Item ID          * @param amount Item Amount          * @param slot Slot id          * @return boolean          */         public boolean containsInSlot(int id, int amount, int slot) {             int found = 0;             if (this.items[slot].getAlpha() == id) {                 for (int i = 0; i < this.items.length; i++) {                     PlayerItem item = this.items[i];                     if (this.getId(item) == id) {                         if (item.getAmount() >= amount) {                             return true;                         } else {                             found++;                         }                     }                 }                 if (found >= amount) {                     return true;                 }                 return false;             }             return false;         }              /**          * Checks if item exists in the storage          */         public boolean contains(int id) {             for (PlayerItem item : this.items) {                 if (this.getId(item) == id) {                     return true;                 }             }             return false;         }              /**          * {@link #increasedItem}          * @param i Index          * @return real item id          */         private int getId(int i) {             if (this.increasedItem) {                 return this.items[i].getAlpha();             }             return this.items[i].getId();         }              /**          * {@link #increasedItem}          * @param item PlayerItem object          * @return real item id          */         private int getId(PlayerItem item) {             if (this.increasedItem) {                 return item.getAlpha();             }             return item.getId();             }              public abstract boolean add(int id, int amount);         public abstract boolean remove(int id, int amount, int fromSlot);     }      I also have a container class which is in charge to control all storages:               /**      * Container class for all storages of a player      * @author Ben      */     public class PlayerStorageContainer {              /**          * Player object (Client extends Player extends Entity)          */         public Player player;              /**          * boolCatach: If enabled, when removing/adding item to ALL of the storages,          * it will check if the action returned false, if yes it will stop right away and          * return false.          */         private boolean boolCatch;              /**          * All of the storages the player will contain          */         private Map<String, PlayerItemStorage> storages =                  new HashMap<String, PlayerItemStorage>();              public PlayerStorageContainer(Player p) {             this.player = p;             this.initializePlayerStorages();         }              /**          * Initializes the existing storage for player.          */         private void initializePlayerStorages() {             this.storages.put("inventory", new Inventory(this.player));         }              /**          * Gets the required PlayerItemStorage implementation          * @param name Name of the implementing object          * @return The object that extends PlayerItemStorage          */         public PlayerItemStorage getStorage(String name) {             return this.storages.get(name);         }              /**          * Removes an item from ALL storages          * @param id        The Item ID          * @param amount    The amount of the item          * @return Returns a boolean if action was successful without any falses in the          * middle of the execution, will return always true if {!boolCatch}          */         public boolean remove(int id, int amount) {             for (PlayerItemStorage storage : this.storages.values()) {                 if (!storage.remove(id, amount) && this.boolCatch) {                     return false;                 }             }             return true;         }              /**          * Adds an item to ALL storages          * @param id        The Item ID          * @param amount    The amount of the item          * @return Returns a boolean if action was successful without any falses in the          * middle of the execution, will return always true if {!boolCatch}          */         public boolean add(int id, int amount) {             for (PlayerItemStorage storage : this.storages.values()) {                 if (!storage.add(id, amount) && this.boolCatch) {                     return false;                 }             }             return true;         }              /**          * Resets all storages          */         public void reset() {             for (PlayerItemStorage storage : this.storages.values()) {                 storage.resetStorage();             }         }              /**          * Toogles {@link PlayerItemContainer#boolCatch} for errors          * @param b          */         public void setErrorCatch(boolean b) {             this.boolCatch = b;         }     }      # The problem This system works fine for inventory, and equipment - however, this will be a problem and cause some big algorithm code duplicating for the bank type. Since bank type storage can have multiple tabs up to 10, we will either need to create class named Tab and make it implement PlayerItemStorage, and put the same algorithm over the two classes (Bank and Tab) or have one method in Bank, and then have a variable named "focusedTab" which will hold the selected tab id, and make the add method accept 3 arguements _(itemId, amount, tabId)_. But making it accept 3 arguments will make a problem, I'll have to either ignore the abstract method add, and make own method for it, or create 2 abstract adds method, one with 2 parameters, one with 3 which I find too messy. Did I design this whole thing incorrectly that I am having these problems? How can I design a proper structure for this whole storage feature so it works with all kind of storages I can think of? If you cannot understand the problem, you might find my code review thread helpful **Background about how the server handles items** When the client clicks on any item, in any game interface that supports item storage, it sends the slot id the player clicked on, due to security reasons. The server uses the slot id as the index of the PlayerItem[] array to get the information about the item.


title: What are the drawbacks to the ActiveRecord pattern?

text: I'm curious what are the drawbacks to using the ActiveRecord pattern for data access/business objects. The only one I can think of off the top of my head is that it violates the Single Responsibility Principle, but the AR pattern is common enough that this reason alone doesn't seem "good enough" to justify not using it (of course my view may be skewed since often none of the code I work with follows _any_ of the SOLID principles). Personally I am **not** a fan of ActiveRecord (with the exception of writing a Ruby on Rails application, where AR feels "natural") because it feels like the class is doing too much, and data access shouldn't be up to the class itself to handle. I prefer to use Repositories that return business objects. Most of the code I work with tends to use a variation of ActiveRecord, in the form of (I do not know why the method is a boolean):               public class Foo     {         // properties...              public Foo(int fooID)         {             this.fooID = fooID;         }              public bool Load()         {             // DB stuff here...             // map DataReader to properties...                  bool returnCode = false;             if (dr.HasRows)                 returnCode = true;                  return returnCode;         }     }      or sometimes the more "traditional" way of having a `public static Foo FindFooByID(int fooID)` method for the finders and something along the lines of `public void Save()` for saving/updating. I get that ActiveRecord is typically much simpler to implement and use, but it seems a little _too_ simple for complex applications and you could have a more robust architecture by encapsulating your data access logic in a Repository (not to mention having it easier to swap out data access strategies e.g. maybe you use Stored Procs + DataSets and want to switch to LINQ or something) So what are other drawbacks to this pattern that should be considered when deciding if ActiveRecord is the best candidate for the job?


title: Building software frontend for hardware that does not yet exist

text: Our task is to build a software frontend to control a hardware device that does not yet exist. We should start development about half a year before the first prototype is available, the project is timeboxed to one year. It is yet unclear what the hardware and the embedded software will be capable of. There're no specified interfaces yet. This will have an impact on the design of the client software. There're only few things we really can build as long as the interfaces aren't specified in detail. Sure, you'll probably just say: _Write a mock_. But this isn't an easy task and a whole mock could turn out to be a whole project by itself. I'm thinking of writing an adapter layer in which I can plug in any device later on, as long as it has the promised capabilities. But I'd like to hear advice from you, on how to tackle such projects and avoid possible pitfalls. To what things should we pay special attention? How should we advance on such a project? **Additional information:** We're creating the software project SCRUM-like, but not traditional. We'll make a good deal of upfront design to establish a clear vision, in order to hit the desired targets and minimize the number of iterations. Also, we have a clear vision on what the hardware/embedded software is supposed to deliver, we just don't know how they're gonna go about it yet and if they can implement the functional requirements at all. We've started a document to collect the interfaces we'd like to have for the client software (because whoever specifies first, wins, _g_ ). We also have a rather clear vision of how the client should look like to deliver the best business value, but it is yet unclear if the hardware can support our concepts and it will probably take some time into the project before we know for sure. Yet, we should start development asap.


title: How can I find own replacement when the company wants someone far less experienced?

text: I told the company I work for that I want to phase myself out, but that I would stick around for a couple months before applying anywhere to help in the recruitment of my replacement. I offered this because I am the sole web developer and I didn't want to leave them helpless. The problem is, they want to hire someone very under qualified to avoid having to pay a high salary. As far as I'm concerned, it's their company and they can run it how they want. However, when it comes to me helping find and train someone before I go, I'm in a position where I don't know what to do. To give a little perspective, I built them a medium sized e-commerce system using an MVC framework; there's more to it, but I'll leave it at that. The candidates they are finding me to review are people who have never worked as a programmer, have made a couple really crappy static websites using a WYSIWYG program and are calling themselves web designers. I know these people have no chance at success. I have tried to explain it to the company, but they don't want to hear it; they think one of these people can be trained and be up and running at my level in about a year. The reality is, I don't think their site will last a year if they go this route. I think maybe they think I am just trying to make myself look good and the new candidates look bad for some reason, which is not the case at all. I would like to leave what I have worked hard on in capable hands. So what is the ethical and professional thing to do here? Just keep telling them that these candidates are no good until they actually find a decent one, up until its time for me to leave, at which point I leave them with no one? Or just accept that they are going to destroy themselves and do the best I can to pick the best out of the candidates and teach him/her what I can before I go? I really just want to do the right thing here, so I can leave on good terms. And if a year down the road they fail, I can have a clean conscience.


title: My potential customer has a very bad written English. Is that a red flag?

text: I am trying to start a freelancing career on oDesk. One of the potential employers offered me somewhat of a dream job: it's game development for an established company. The pay seems to be right (although it's too early for precise estimates). The company's website seems rather cool, and the game I would be working on appears to live and prosper. I also made a point to ask and was told that they are using an incomplete, custom-made VCS; that sounds both awesome and horrifying to me. My main objection is that I am a little bothered by the employer's writing style. Their vocabulary seems to be fine, but in some cases their grammar is poor, and typos are abundant. This _appears_ to be carelessness rather than a lack of linguistic ability. Don't get me wrong: when the job is right, I would communicate in l33t sp34k if that was the only way to get information across. I'm not a native English speaker myself, and when speaking casually, I don't really care about others' linguistic ability. What I am worried about is if I should take this as a red flag that things will go wrong in other areas of our relationship as well. On the other hand - they're game developers, and they are probably making a great game. A large part of me wants to go there - fast, so I'm inclined to ignore my objections and accept the job. What do you think?


title: How could an expert system get some meaning from a sentence?

text: How could an expert system tell following scenarios apart? How could we include some meaning of a sentence, if at all?               A machine needs 1 day to produce x units, and,           we know that two machines like the first would need 1/2 day for x units.       However, if:               a truck transports a container from a to b in 1 day,            but two trucks won't transport the same container in half the time.      But how to establish a logical rule to exclude attaching a truth value to the second sentence? Hoe to process sentences that depict a process that can not be divided in pieces (that means, include the meaning of 'divisible'/'non- divisible'), and therefore, an expert system can't assign automatically a time value to a process that has to be performed. The enhanced expert system would then be able to avoid scheduling failures.


title: Continuous integration policy problems

text: Currently our model, with respect to SVN and automated build, looks like ![enter image description here](http://i.stack.imgur.com/aiEY1.png) Which, as far as I know, wasn't the way SVN was meant to be used. But the process works okay from a technical standpoint. The goal is to be able to run these chains in parallel, with different people working on **new features** , others **fixing new bugs and regressions** , and somehow **responding to client feedback**. The difficulty comes in _explaining_ it, even to people who have been around for a while, and usually after someone messes it up and changes one of these steps to something that makes more sense to them ( _ie_ using the latest release build for internal testing and sending _archived_ releases to client QA). I didn't set the policy but I understand what it is, so I'm one of the people who has to explain/maintain it. Having done so many times over the last year, it seems like it doesn't meet the principle of least astonishment. How could we make this process more obvious/boring?


title: Test code that will be changed soon

text: My question is whether I should test code that I know will be changed in a short time. I'm doing TDD in ruby, and I often meet with this question. I'm interested about best practices about this, pro and contra. Thanks. **Update** Clarification: My question is basically how do you compare the 'cost of writing a test' VS 'the fact that the code will change soon' and make decision.


title: Graphic card for parallel programming vs traditional methods

text: With a simple search in amazon one can see that the modern approach for parallel programming is to use your graphic card. However I am still a little bit skeptical about it. My last computer has an 8 core CPU which I need is enough for basic all my parallel needs, if I need more I will probably use MPI through a network using my old machines. All in all, Why and/or when should I use CUDA or another method which uses my graphic card instead of traditional methods like pthreads, java threads, boost threads or the new C++ 11 threads? What about using processes?


title: When to reintegrate feature branch?

text: From SVN 1.5, it supports reintegrate feature. I wonder when I should reintegrate. Should it be done before release or after release? If I do it **Before release**   * Pro: It is not forgettable to merge with trunk.   * Con: Merged version can be different from QAed version. **After release**   * Pro: Releasing version is same with QAed version.   * Con: Some feature from trunk can be missed. So, when do you reintegrate?


title: Can I use GPL code as textual data in my app?

text: In essence, I'm wondering how licenses affect the legality of using source code **as data**. By that I mean _literally_ storing code in a database as strings and using it e.g. for some syntax highlighting experiments, or other such pursuits. I can think of a couple of scenarios:   * My project is closed-source, and I want to use open-source code as data. If I store code that is under GPL, does the GPL license apply to my project? What about other licenses?   * My project is open-source, but licensed under e.g. MIT. Again, if I store GPL code, does that affect my project? I was thinking about GPL specifically because of its viral nature, but if other licenses would have applicable effects, I'd be interested in hearing about them as well.


title: In what URL segment do you have language? /en/admin/dashboard or /admin/en/dashboard?

text: maybe you are thinking that this is another dump question about language in URL, but I hope it is not! I've red many articles on this, but non of them was dealing with "sections of site" (described bellow). I am programming a new application platform in laravel/php and I am still not 100% convinced where to put language slug. There are many places where you can put it - some of them are better some are worse:   * example.com/en/article   * en.example.com/article   * example.com/article?lang=en My personal choice is to put language after the domain - so the first option in above list. _**But what if you are in some special secion like admin or api?_** where do you put language then?   * example.com/ **en/admin** /dashboard   * example.com/ **en/api/v1** /user/login or   * example.com/ **admin/en** /dashboard   * example.com/ **api/v1/en** /user/login (in frontend it is left the same: example.com/en/some-article) what do you preffer? what are cons and pros? One thing is using language in first segments is far more easier to programm than when it have some variants... **EDIT:** I am also using **two lists of avalible languages** to determine what languages are avalible for app/ **backend** and for **frontend** (if the app is something like CMS). Eg. web can be only in english but app (cms) can be in czech, english, italian... P.S. whould you recoment using only en, cs or do it in full power with cz-CZ, en-US ? thanks for any thoughts! J.


title: Is there a name for when a sales team irresponsibly promises non-existent features?

text: It's a common issue to see a company's sales team promise new features in order to close a sale. Many times these new features are still in development or are still being designed. Sometimes features are sold before the development team even knows about them. If the customer understands the features are not yet implemented this can help guide the product's design. However, if the sales team promises these features with an uninformed time frame it can put significant amounts of stress on the developers who are charged by management to meet the deadlines. Additionally, sometimes non-existent features are sold to customers as being either completed or near completion when development may not even be aware of the requirements yet (legal/ethical issues notwithstanding). **Is there a word or phrase that can be used to describe the uninformed/irresponsible/unethical applications of this practice?** It's similar to feature creep, but occurs before development or design.


title: Programming jobs for a science based degree

text: I am currently in my last year of a Masters in Physics at Uni and I am looking to go into a job that is mainly programming based. As part of my course we have learnt C++, Matlab and as a hobby I taught myself HTML, CSS, JAVA and a bit of JavaScript. After getting to this stage in my degree I've realised that its actually the programming side of Physics that I enjoy most. I've been working on a few Android apps & websites in my spare time but only things that utilize what I know in JAVA, HTML etc. Using Physics in programming is good fun but I don't want to limit myself just to Physics based jobs. I just want to know a few things:   * What kind of jobs can I apply for that would require the kind of skills I already posses/can work towards possessing in a year   * Can I compete with graduates who have had a lot more programming in their course for example Computer Science?   * Are there any specific extra things I need on my CV before I start applying for these jobs?


Does the single responsibility principal promote flexibility? If not what are the other methods to make your classes more flexible? By flexibility I mean, a class is able to function correctly at any time with little (or even with no) hassle.


title: use of Enum with flags in practice?

text: I just have read some stuff on enum today. Use of flags with enum was something interesting and new for me. But often practice and theoretical uses are different. I go through many articles they examples they quoted were good to get the concept but am still wondering in what situations one can use Enums with flag to store multiple values? Will highly appreciate if you please can share your practical experience of using enum with flags.