How can I leverage or 'selling' small-scope skills in a large-scope-heavy environment?

I've been working for 15 years at a mid-size company (300-400 engineers) doing a mix of embedded software / signal processing / controls engineering / circuit design. And an event has occurred recently that puts my current role in jeopardy. I'm having trouble deciding how to either find a good fit at my current employer, or deciding where to go next. **What I'm wondering is if anyone here relates to the following situation and can recommend a way to leverage or "sell" my strengths to my current (or future) employer:** Most of the projects at my company need what I see as strong "large-scope" synthesis skills: project X needs a software engineer to take responsibility for area Y in that project, and quickly finish the design, debug, test, and documentation needed to make that area a success, overlapping enough with coworkers so the project as a whole is a success. (or replace "software engineer" with "circuit designer" or "controls engineer", it doesn't matter) That's not my forte, and no matter how hard I try, it always seems to end up in frustration for me. What I'm very good at, is a mix of the following:   * problem solving   * learning   * mathematical analysis   * use of a wide skillset (ee/math/signal processing)   * meticulousness (many projects in our company have been delayed because someone "finished" a task quickly but sloppily, so it had to be redone properly later at a much greater risk/cost)   * identifying design process bottlenecks that cause delays/risk/etc., and writing software tools to help overcome those bottlenecks. (for example: we had a case recently where our build process for a C++ software project was missing some dependencies on autogenerated .h files, so sometimes when we did incremental builds instead of fresh builds, one of the .cpp files wouldn't be recompiled and would refer to an incorrect structure definition. I already had a software tool that could read debug data in the executable file, so I improved it to detect and report multiple conflicting structure definitions present in the executable. Works like a charm: we now use it as a step in our automated build process, and it quickly helps us identify missing build dependencies should a new one occur.)    * focusing on synthesis (design/debug/test/documentation) projects of very limited scope   * acting in a supporting role to take on small issues that have other engineers stuck, freeing them up to continue their work What I'm bad at is synthesis on moderate to large projects. I'm not a programmer workhorse. I cannot seem to manage the complexity no matter what kind of organizational tools I try to use, and it feels like I'm running into a case of neural stack overflow: if I take on new tasks, some of the old ones slip away from my brain, I forget about important details which take me a long time to re-acquaint, and I just feel overwhelmed. And on top of that, I have RSI in my wrists and one shoulder, which get aggravated with stress. **How can I state my strengths and weaknesses effectively and briefly with my current employer (or prospective employers), so that I can find a good fit where my skills benefit them and I can find a role that I'm satisfied with?**


Need pointers on my first Windows program

I'm a Unix programmer and I need to write a (hopefully simple) program for Windows that does the following: (1) Installs from a USB drive (2) Somehow integrates with the OS at a low- level in such a way that it can filter/shape all network traffic in/out of the machine (a la IPSec) I can write in C, asm, Python, Java, but I have no idea about Windows' methods for doing this sort of thing, nor where to start learning. (I could easily do the above with Linux using a kernel module.)


Best starting point for writing small desktop programs for Windows?

I know how to program for Unix, Mac, and iOS, but I have no clue when it comes to Windows. Now I have a specific project that requires building a Windows version of a Mac OS X desktop app. But I have no idea where to start learning. What languages can I build the app in and how do I package it for download and distribution? What tools can I use? Can I use Vim and something resembling the Unix command line? I can program well in Ruby and Objective C, but I'm guessing I won't be able to use either of these to make a Windows desktop app. Any tips?


Unit testing of "workflow" methods

We are currently developing a public API for our app. The methods on this public API are mostly putting together functionality in different corners of the system. An example would be: (names have been changed to protect the innocent)               public String createAppUser(String app, String name, String email, byte[] pwd) {           Application appl = applicationModule.retrieve(app);          User user = userModule.createUser(name,email);          Digest digest = cryptoModule.createDigest(pwd);          authenticationModule.authorize(user,appl,digest);          accountingModule.createAccount(user,appl);          return user.getId();     }      When unit testing such a thing, the unit test is just a copy of the same workflow, with some additional noise to setup mocks, objects and validate interactions. Although I find unit-test of algorithmic parts of the application essential, in this 'workflow' part, I find unit-test a repetition of the workflow in question form. Following the DRY principle, it feels like a waste of time. What are the best practices in these cases? Given that these methods are part of a public API, I would find more valuable to test them through a client and validate that the system effects have taken place. This is more 'system test' or 'integration test' and beyond the scope of unit test. What would be the best test approach in this context?


open source flash environments

I have been looking for a really good open source flash development environment with no success. The best I could find would help in the development of pretty much everything, but I still needed to have Adobe Flash Professional in order to compile my work. Is there a way I can develop Flash applications and not need to purchase Flash Pro?


Is nesting types considered bad practice?

As noted by the title, is nesting types (e.g. enumerated types or structures in a class) considered bad practice or not? When you run Code Analysis in Visual Studio it returns the following message which implies it is: > Warning 34 CA1034 : Microsoft.Design : Do not nest type > 'ClassName.StructueName'. Alternatively, change its accessibility so that it > is not externally visible. However, when I follow the recommendation of the Code Analysis I find that there tend to be a lot of structures and enumerated types floating around in the application that might only apply to a single class or would only be used with that class. As such, would it be appropriate to nest the type sin that case, or is there a better way of doing it?


Why are more programmers not freelance these days?

Leaving the whole _pie_ to only a few of them, amplifying the huge differences between the two status. Pay is a (huge) one, not having to do overtime is another. I leave the question open to hopefully get many great answers on all the different subjects that affects that feeling and decision not to go. **EDIT** : While this question is really global, I'll be interested in any studies, facts, articles, opinions regarding local markets such as US, India and even Australia in which I'm in love with. **EDIT2** : Bounty of 500 points for anyone that will come with recent studies on the subject. If multiple answers, will pick the one with the most upvotes.


Best Practices or Project Standards

As a software development contractor I've worked on many projects with differing standards and conventions. Quite often these conventions go against the software best practices we know and 'love'. The question is, when you're working on an established project with specific ways of doing things that you know aren't the best ways, do you break the conventions of the project because you know its a better way of doing something, or do you stick to convention meaning that your work will blend into the existing code base? After all, you need to keep in mind someone else is going to stumble across your work one day and if its not consistent with the rest of the project they will have to take the time to work out what you've done differently. So, project convention consistency or best practices?


Inheritance gone wrong

I have some code where a good inheritance model has gone downhill and I am trying to understand why and how to fix it. Basically, imagine you have a Zoo hierarchy with:               class Animal       class Parrot : Animal      class Elephant : Animal      class Cow : Animal      etc. You have your eat(), run(), etc methods and all is good. Then one day someone comes along and says - our CageBuilder class works great and uses the animal.weight() and animal.height(), except for the new African Bison which is too strong and can shatter the wall, so I am gonna add one more property to the Animal class -- isAfricanBizon() and use that when choosing the material and only override it for the AfricanBizon class. Next person comes and does something similar and next thing you know you have all these properties specific for some subset of the hierarchy into the base class. What's a good way to improve/refactor such code? One alternative here would be to just use dynamic_casts to check for the types but that clutters the callers and adds a bunch of if-then-else all over the place. You can have more specific interfaces here but if all you have is the base class reference that doesnt help much either. Any other suggestions? Examples? Thanks!


How can I benchmark concurrent key-value stores?

I have some concurrent key-value store implementations that are implemented with hash tables and search trees that I would like to compare. I would like to benchmark them with a real world application where several threads stresses the key-value stores. I already have some micro-benchmark that stresses the key-value stores by executing random operations on the key-value stores in parallel. What I'm interesting in now is applications that do some work that could be useful in the "real world" and where one or several key-value stores are important for scalability and speed. I would like to have a benchmark that is easy to set up and that could be run on many different system. I would prefer if it does not involve network communication etc. An example of the kind of applications I'm looking for is the parallel PageRank algorithm. It is used as a benchmark of different key-value stores in the paper "Concurrent Tries with Efficient Non-Blocking Snapshots (PPoPP'12)". The reasons why I'm not satisfied with "artificial" benchmarks that do X% inserts, Y% deletes and Z% lookups are:   1. It can be more convincing with a benchmark that also solves a real world problem. The risk with an "artificial" benchmarks is that they might not correspond to any real world situation.   2. Some usage scenarios that happen frequently in real world applications might not be covered by the artificial benchmark.


What could an algorithm look like that iterates through all combinations of two variables to aim at a certain number of entries?

For background information, see "Some background" further down. I have a list that looks like this:               Start-Time-In-Seconds;End-Time-In-Seconds     1;2     4;6     12;15     ...      This works together with a wave file by acting as a cutlist. So the desired parts are 1->2, 4->6, 12->15, ... If the distance between End-Time-In-Seconds of the previous element and Start- Time-In-Seconds of the current element is below a threshold of seconds(I call it _Pausendauer_ ) I merge those two, ie if the threshold is 3 seconds then the list will be               Start-Time-In-Seconds;End-Time-In-Seconds     1;6     12;15     ...      If the distance between Start-Time-In-Seconds and End-Time-In-Seconds is below a threshold of seconds(I call it _Minimallänge_ ) I discard this sample, ie if the threshold is 4 seconds then the list will be               Start-Time-In-Seconds;End-Time-In-Seconds     1;6     ...      What could an algorithm look like that iterates (intelligently) through all combinations of _Minimallänge_ and _Pausendauer_ to aim at a certain number of entries? Example: The number of entries should be 3. Given the number 3 the algorithm should iterate (intelligently) through all combinations of _Minimallänge_ and _Pausendauer_ to output something like this:               Start-Time-In-Seconds;End-Time-In-Seconds     1;12     18;20     50;100      And that should be all. You notice I did not add "..." to it as the final list is to only consist of three entries. _Some background_ : The wave file contains several interviews being recorded continuously with pauses in between. A VAD gave me areas where it presumes voice to be. As I know the number of total conversations(f.i. 3, usually more which is why this makes sense) my goal is to determine them automatically. The cutlist is the raw output of my VAD which I want to turn into a usable cutlist for ffmpeg. _PS_ : If you can, share an algorithm in c#.


Is blocking an entire web-client due to compatibility a reasonable request?

A little bit of background, we've made an electronic POS system for registered vendors of items of a well known brand. The vendors are required to login to use the system. Recently, IE has been giving us lots of painful maintenance problems than before. Our boss is getting worried about running into further maintenance problems, so he has asked me to find out a way to automatically install & launch chrome if they try to login with any other browsers (For the record, nearly all of the issues are related to some feature working fine on FF/Chrome/Opera/Safari but doesn't on IE). Let us put aside the ridiculousness of running an external .exe from Javascript, which is practically impossible (And rightfully, I told him so. But he insisted it was possible, so whatever). So my questions are:   * Is this request technically viable? Is there a guaranteed way to block requests from all browsers except for allowed ones?   * Is this request reasonable? IMO, From the standpoint of users, limiting accessibility does more harm than good, but maintenance issue is definitely a valid business concern.   * Has there ever been a case like this where other websites explicitly blocked certain browsers? Edit: Thanks for the answers. We're supporting IE 7+ at the moment and indeed, 7/8 were the ones that caused most of the grief. Just dropping those two will make maintenance significantly easier but my boss thinks the problem has to do with IE itself, not necessarily the versions. I'm going to try to see if I can convince him, but I have a strong feeling he's going to stick by what he thinks.


Is this "anti-pattern" and should I stop using it or is this clever design?

I've basically stared to do the following when creating a REST service:   1. HTML is requested   2. service returns the desired web page but without the requested "resource", eg. data   3. web page contains JavaScript that issues AJAX request to the same service (different content-type)   4. service then returns the actual data (JSON) and the page displays it On one side it seems inefficient (2 requests) but then were I used this, "performance is of no concern", meaning low traffic internal app and the web sites are simple and load fast. The reason I ended up with this is that the web page can then be almost pure Html + JavaScript and almost no server-side stuff is required, especially no loops, to create tables and stuff like that (which I think is very ugly compared to things like slickgrid), e.g. separation of data and view. Now before I get to using this, is this a good idea or should I just stop doing it?


Why is semantic markup given more weight for search engines?

This question follows directly from the part of an answer of this question - Why would one bother marking up properly and semantically? . I would like to understand why SEO techniques gives more weight to semantically correct mark up?


DbFirst vs Code First? what should I use if I rely on Stored procedures

This question is asked many times, and I always prefer code-first as I like to keep the logic in code. But now I have a challenge to load screen under 5 seconds and very little time to do things. I have large set of records, and I'm possibly going to retrieve them asynchronously. There are a few doubts in my mind.   * Does using db-first approach have any benefits in performance over code-first?    * Should I write the logic in stored procedures or in code (Linq)?   * Which has less latency: Linq or stored procedures?


Application protocols and state machines: designing a complicated server

I'm designing and prototyping a server that has the following characteristics:   * during the daemon's initialization it spawns nine "manager" servers, each of which solves one part of the overall problem.   * after initialization, the daemon accepts connections from clients, forking a "slave" server for each which connects to the managers and then accepts requests from the client, farms them out to the managers, assembles the results, and sends them back to the client, ad infinitum.   * the daemon, the managers, and the slaves all should have the ability to concurrently accept "control" connections from a terminal, and receive and process commands (e.g. queries for performance stats).   * the concurrency of each process's socket I/O is being managed by select(). The problem I'm having is the complexity of the coding. For one thing, each program has at least two phases - initialization and main loop - in which it is variously establishing a connection to its parent, or accepting a connections from its children, or sending and asynchronously awaiting data from its children, and so on. At various points I don't want, say, to accept a client connection while I'm initializing, or I do want to accept control sessions even in the midst of regular processing. Not to mention managing the protocol of each such connection. Given enough time, I could probably massage all of this into a reasonably well-factored set of subroutine calls. But I remember having heard of an entirely different approach to this sort of problem, involving libevent, callbacks, and finite state machines. What I'm hoping is that someone reading this might say "Why, yes! That's a perfect example of where event callbacks and FSMs are far superior to looping on select()s - and a great introductory article about this is ..." or "here's what it's all about in a nutshell." (Or, possibly, "that's not what libevent is intended for, at all.")


Stacking keywords on top of each other - poor style?

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:               lock (serviceLock)     using (var client = new ServiceClient())     try     {         // Do something         client.DoSomething();     }          catch (System.ServiceModel.FaultException ex)     {         // Handle error         addLog(ex.ToString());     }      This usage has always seemed somewhat questionable to me. However, the alternative is not very practical either (3+ levels deep of indentation for a service call). Apart from pure aesthetics, is there any practical reason to add or not to add the extra brackets in this case?


Better way to familiarize myself with Haskell

I'm a Haskell beginner. I started learning Haskell around 20-25 days back. With a programming day job I am doing this in my spare time because I wanted to learn about functional programming. **Background** I have been going around stackoverflow to see how I should proceed. I have read the first 6 chpaters of learn you a haskell and around 2 chapters of Real World Haskell and done a bit of Haskell programming. I have no prior experience in functional programming. But I have used Python, which has **_some_** functional programming concepts used. Now I am really confused about how to proceed. I am used to learning to program by writing programs on the go but here in Haskell I am not sure what kind of programming problems to do. I am having trouble thinking the solutions to problems that I already solved in Python or C. I have tried some of the 99 Haskell Problems but their solutions use library functions which I don't know about. Haskell emphasizes recursion but without any kind of looping I don't know how to solve many of the problems. I tried going over the advices that I got when I was learning Python. But this time learning Haskell those are not helping because I am stuck at an even lower level. This time I have lesser time to practice and it is just so different. Is there a way to familiarize myself with Haskell better than the above mentioned method? Does it just take some time coming from imperative background?


Real-world examples of apps written with TDD and good test coverage?

Are there any open source applications that are developed using test driven development that serve as models of how good unit testing should work? I'd prefer to see examples in C# and .NET. (Note that I mentioned applications, not just libraries.) I'm a mid-tier programmer who really wants to believe in and practice TDD. The app I work on in my day job is pretty complicated--about 1 million lines of code--and I would love to introduce more unit testing. We have some unit tests in place, but my efforts at TDD and with working on code that's already under test have not been encouraging. In my admittedly limited experience, TDD seems to encourage a lot of complexity in the name of decoupling. The bits of the app that are hard to test--and which coincidentally tend to be critical--get pushed out to the periphery, into the realm of integration tests that may or may not ever get written. (I'm thinking of the usual suspects here, file system access, hydrating objects from a database, asynchronous web calls, etc.) The code that's under test tends to involve lots of collaboration among objects, and maybe some simple flow logic, all of which happens in memory and which could arguably be written in a simpler, more understandable way if everything didn't have to be totally decoupled for testing. I understand the techniques for mocking dependencies and such, but in my experience heavy use of mocking leads to very brittle tests. If my first instinct upon seeing a bunch of tests go red is, "Great, now I have to fix all the mocks," then my tests have become a drag rather than a safety net. I'm trying to get past this mental barrier, and as part of that I'm reading Michael Feathers' book, _Working Effectively with Legacy Code_. I it hope will show me some of what I'm missing. I'd also like to study some nontrivial .NET applications with good code coverage, maybe a content management system, or a CRUD app. The FitNesse testing framework that Uncle Bob talks about is something I'll probably look at, but it would be nice to see something written in the language I'm most familiar with. Any suggestions or words of wisdom would be appreciated.


Passing around impl-specific tokens in generic algorithms in a static/strong type system

I was interested in solving several unrelated problems using generic graph search techniques, so after some fiddling around I came up with the following design: have each problem implement a generic "Problem" interface which has an initial state, and several methods that take in states and moves, and return new states and moves. For example, I can `getMoves(state)`, `applyMove(state, move)`, or check `isGoal(state)`. All of the problem specific details are then in one place, and the generic algorithms can pass around states and moves as generic "tokens" that they don't really care about, using the Problem instance to evaluate their properties. The Problems are also consequently stateless (or what state they have is immutable), which makes their behaviour very easy to reason about. This was all fine and good in a dynamic/duck type system (JavaScript), but in migrating the idea to a static/strict type system (Java), I've run into some issues. The most immediate problem was that these "tokens" could really be anything. Arrays, objects, maps, strings, whatever. Javascript didn't care, because the algorithms just passed them around as black-boxes, and the Problems assumed they were being given their own tokens. In Java this is not the case. The first most natural solution is to have all the "tokens" implement some empty `State` or `Move` interface. This already has some problems, as if my state is just some data structure, then I need to extend or wrap the structure, but that's _basically_ fine. The next problem is that the tokens are implementation specific, so every time they're given to the Problem, they need to be cast into what they actually are. Lots of casting strikes me as a red flag, so this seems like a bad (certainly unpleasant) approach. To avoid all the casting, I briefly considered something involving tons of templates (State<ChessProblem>, Move<ChessProblem>), but that seemed like a headache which might not even fix the problem. Is there some "proper"/standard way to accomplish this in stricter type systems? Is this just a bad pattern to use in them (or a bad pattern overall)? Any insights would be appreciated. Also, while I _am_ using Java, if other static/strict languages have novel tools for this sort of thing, I'd love to hear about them.


Which is better for increasing accuracy/visibility of project timelines: a developer and a manager or two developers?

I'm currently a one person development team. My employer is looking at hiring a manager. They do this because, for the more complicated projects, I tend to take a "this is how much I've got done - this is how much there is to go" approach rather than "this is when it will be done" and they think it's going to magically change if a manager comes on board. Would I be correct that second developer is more efficient? Could I maybe cite the advent of pair programming as evidence, or is that really a specialized thing?


Setters or constructor for many variables?

> **Possible Duplicate:**   >  Are there guidelines on how many parameters a function should accept? I have got class with 30 variables (it is application form), so I wonder what is the best practice to organize class creation. Should I use huge constructor:               MyClass mc = new MyClass(a, b, c, d)      Or setters:               MyClass mc = new MyClass();     mc.setA(a);     mc.setB(b);     mc.setC(c);     mc.setD(d);      What is the best practice in OOP for such situation? I saw similar question, but now I don't need immutability.


Data structures in functional programming

I'm currently playing with LISP (particularly Scheme and Clojure) and I'm wondering how typical data structures are dealt with in functional programming languages. For example, let's say I would like to solve a problem using a graph pathfinding algorithm. How would one typically go about representing that graph in a functional programming language (primarily interested in pure functional style that can be applied to LISP)? Would I just forget about graphs altogether and solve the problem some other way?


What is a correct/polite way to inherit from an abandoned open-source project for a new open-source project?

My team just tried to contact some guys from an old open source project hosted on code.google.com. We told them that we'd like to join their project and commit to it -- at least to some branch of it -- but no one responded to us. We tried everyone, owners and committers; no one was in any way active, and no one replied. But we have some code to commit and we really would love to continue work on that project. So we need to create a new project. We came up with a name for it which is close to but not a duplicate of the name of the project we want to inherit from. How should we do our first commit, and what should the commit message be? Should we just copy their code to our repository with a comment like "we inherited this code, we found it here under such and such a license ... now we're upgrading it to this more/less strict license ..."? Or should we just use their code as our first commit, with updates saying "we inherited from ... we made such and such changes ..."?


Why is implicit parallelism/concurrency not more widespread?

Implicit parallelism^ can take a big burden away from many programmers, placing it on the computer. So... why is it is not more widespread at present? * * * ^ Implicit parallelism is to make a computer be able to figure out itself how to do more than one thing at a time, instead of a programmer needing to do this job using threads and the like


What's the difference between the code inside a finally clause and the code located after catch clause?

My java code is just like below:               public void check()throws  MissingParamException{         ......     }     public static void main(){         PrintWriter out = response.getWriter();         try {             check();         } catch (MissingParamException e) {             // TODO Auto-generated catch block             out.println("message:"+e.getMessage());             e.printStackTrace();             out.close();         }finally{             out.close();         }         //out.close();     }      Then, my confusion is: what the difference if I put `out.close()` in a finally code block or if I just remove finally code block and put `out.close()` behind catch clause (which has been commented in the code). I know that in both ways, the `out.close()` will be executed because I know that whether the exception happened, the code behind the catch clause will always be executed.


Class or Dictionary

I want to create a immutable `Scale` class in C#.               public sealed class Scale     {         string _Name;         string _Description;         SomeOrderedCollection _ScaleValueDefinitions;         Unit _Unit              // properties         ....         // methods         ContainsValue(double value)         ....              // constructors         // all parameters except scalevaluedefinitions are optional         // for a Scale to be useful atleast 1 ScaleValueDefinition should exist         public Scale(string name, string description, SomeOrderedCollection scaleValueDefinitions, unit)         { /* initialize */}     }      so first a `ScaleValueDefinition` should be represented by to values:   * Value (double)   * Definition (string) these values are known before the Scale class is created and should be unique. so what is the best approach.   1. create a immutable class ScaleValueDefinition with value and definition as properties and use it in a list.   2. use a dictionary.   3. use another way i didn't think of... and how to implement it. for option 1. i can use `params ScaleValueDefinition[] ValueDefinitions` in the constructor, but how to do it for the other options? and as last at what amount of value's (properties) should i choose one option over the other?


Is it bad that you don't program on your spare time while at uni?

There has been some questions about not programming on your spare time, but they all concern when you're at work. What about when you're studying? Do you also need to learn on your spare time when you're already learning during the daytime (at uni)?


Code Samples and Interviews?

I've seen a number of questions since I've been here where, in the answer, someone has asserted that they would never use portfolios or code samples coded outside of the interview process to judge a candidate, because there is a possibility of that code having been written by someone else. I find myself surprised by this. The way I see it, if I ask someone to come in and solve a simple problem on the spot, there is very little I can learn from it. I don't work for a company like Google where jobs are sought after and I can demand a day of someone's time. But a substantial piece of hobby-written code can tell me a lot. Yes, there is the possibility of plagiarism, but they're going to have to be very well coached to get through an hour long discussion about that code. And should that be the case, they'll have to be very quick learners to get through their 3-month probation (during which I can get rid of them with no reason and with no notice). If they become good programmers that quickly, fair enough, I've been duped, but I still have a good programmer. In the end, the cost to our company and the benefit to the candidate of plagiarism is very minimal. This got me to thinking about other industries. Artists, photographers, designers all use portfolios and nobody worries too much about plagiarism there. An author will get funded for a book based on chapters he has written in his own time. You wouldn't ask an architect to come in and draw design specs for a house at the interview. So what makes us different? Why is it so important to put someone in front of a computer and make them code up a data merge or a factorial calculator, sometimes without access to the very tools we use day-to-day, like the internet? What is wrong with the idea of a code portfolio? I'm genuinely interested to know, in case I am potentially making a huge mistake which just hasn't burned me yet.


Need a transition from my workflow, or make it better / fix it

This is how I roll with git:   1. I clone/fork something locally   2. I create a new branch `devel`. This is supposed to be a quickfix branch. It is also supposed to be parent to all branches.   3. I create a topic branch (say make a new theme `lex`) I actually create a few more child-topic-branches (say `lex.th2`) to test/see different things. But so now, I have to quickfix (in `devel`) a core functionality (say re- correct database credentials in `wp-config`).   I then have to switch to `lex` and `merge devel`. And then to `lex.th2` and `merge lex`. (So that changes from `devel` could goto `lex` and to `lex.th2`) Doing all this severely messes up my history-graphs ![C:\\Program Files \(x86\)\\Git\\bin\\wish.exe](http://i.stack.imgur.com/8Hy0H.png) I'll admit that the "official" workflow was too much for me and I just took the parts that I liked from it... probably badly. So any suggestions how to make it "tidy" while still not complicating or deviating too much?


Provide both RESTful interfaces and Java ones?

I am writing a RESTful service in Java, of course it's typical HTTP based interface. I am wondering should the service provide Java interface which has same semantic to the RESTful interface? I think Java interface will ease other Java code to call the service. (Client Java code doesn't need to use HTTP client to trigger HTTP requests to invoke RESTful) The problem is it's difficult to write same semantic Java interface to a RESTful one, I mean same semantic. Any advice for the design? Thanks!


Why can't we use IP address instead of cookies in identifying the client in servlets?

I know we have some extra advantages in using the cookies over IP address, but my question is Why can't the container just remember the IP address of the client in identifying the client when he visit his site again? Is it possible for the container to remember the client with the help of IP address?


Release management software

We've got a reasonably good release management process. However large parts of it are manual tasks, i.e. Promoting builds to QA, deploying builds to internal groups, tracking releases, etc. The builds and tests are all automated with CruiseControl. Can anyone recommend some good release management / continuous deployment tools that I can use to automate the rest of our process?


What is "condition testing" (as defined by the ISTQB Syllabus) actually good for?

I am currently checking through the syllabus for the ISTQB "Technical Test Analyst" certification. This syllabus (henceforth called "TTA syllabus") contains a chapter dedicated to _"condition testing"_ (apparently this is also called _"condition coverage"_ or _"condition coverage testing_ ".) _Condition testing_ as defined in the TTA syllabus strikes me as an exceedingly strange and possibly anachronistic thing that has more to do with Grandma's Ham Story than with software testing. Let me explain... **What is "condition testing" according to the TTA syllabus?** Referring to the "Advanced Level Syllabus - Technical Test Analyst, Version 2012" of the ISTQB, available here, "condition testing" is defined as follows on page 12: > Compared to decision (branch) testing, which considers the entire decision > as a whole and evaluates the TRUE and FALSE outcomes in separate test cases, > condition testing considers how a decision is made. Each decision predicate > is made up of one or more simple “atomic” conditions, each of which > evaluates to a discrete Boolean value. These are logically combined to > determine the final outcome of the decision. _Each atomic condition must be > evaluated both ways by the test cases to achieve this level of coverage._ > > _Applicability_ > > Condition testing is probably interesting only in the abstract because of > the difficulties noted below. Understanding it, however, is necessary to > achieving greater levels of coverage that build upon it. **So let's clarify the words** Suppose we have some software-under-test on which we want to do _whitebox testing_ (i.e. we have the source code). The code naturally contains many of those _decision predicates_ that we all know and love and that show up after strings like `if`, `while`, `until` etc. An example of the decision predicate might be: > `((x>y+z) AND (y<-3)) OR ((z²+x²<4) AND (z≤y))` ![An example of a decision predicate](http://i.stack.imgur.com/HlZtV.png) This decision predicate accepts a triple _(x,y,z)_ of integer values (say) and outputs a boolean, _b_out_. The first-level functions which map _(x,y,z)_ to {TRUE,FALSE} are called _conditions_ (also _atomic conditions_ ) in the TTA syllabus. **Condition testing coverage** One attains _"condition testing coverage"_ by running test cases until all the _conditions_ found in the _decision_ yielded at least once _true_ and at least once _false_. One can thus achieve condition testing coverage by running the following five test cases (for example): ![Truth table achieving condition testing coverage](http://i.stack.imgur.com/nO80z.png) Each of the the _b0_ , _b1_ , _b2_ , _b3_ shows up at least once with _true_ and at least once with _false_. In some test cases, we do not care about a given value as it has no influence on the condition whose output we want to get right. **Addendum: Decision coverage** Incidentally, the truth table shows also that _"decision coverage"_ has been attained for this decision, as _b_out_ shows up at least once with _true_ and at least once with _false_ , so both branches of any code would be covered. **And now the question** What is "condition testing" as defined above actually good for? It won't help you ascertain the correctness of the decision predicate at all. _That_ is best done by a code inspection, letting a second team write the same expression and comparing outputs or running test cases at "boundary values" (e.g. here, for y = -4, -3, -2). Checking the individual conditions strikes me to be more about testing the CPU's ALU or maybe testing the compiler output. It is certainly suitable for checking manually written assembler code or verifying manually assembled logic. And this makes me think that "condition testing" could well be a leftover from the days where conditions were actually wired up on panels (for example in the ENIAC) and might thus be subject to wiring bugs. These days, the condition is written in high-level code and is _exactly_ the one you conceptually want. While review might be useful, a testing of the condition is just a waste of time. Or am I missing something? **Addendum: Literature Search** A search of the IEEE Xplore library for "condition testing" yields only two papers relevant to software (all the others seem relevant to hardware only), both by K.C. Tai of the Department of Computer Science of North Carolina State University. Checking one of those, Condition-based software testing strategies reveals that the author uses the term _condition_ in the sense of _decision_ above, i.e. in this paper "condition testing" is actually "decision testing". The _condition_ as used in the TTA syllabus is called _simple condition_. It seems the TTA syllabus definitions are not widely used. From the abstract: > A computer program consist of statements, such as IF and WHILE statements, > that contain conditions, which are combinations of Boolean and relational > expressions. A testing approach, referred to as _condition testing_ , is to > test a program by focusing on testing the conditions in this program. A > number of condition testing strategies have been developed, but they are not > effective for detecting errors in complicated conditions. In this paper, we > define two condition testing strategies, based on the detection of Boolean > and relational expression [i.e. expression of the form E1 _op_ E2, where E1 > and E2 are arithmetic expressions and _op_ is one of six possible relational > operators: < <=, =, !=, >, >=] errors in a condition. For these two > condition testing strategies, we show some theoretical properties and > explain why they are practical and effective for testing programs containing > complicated conditions.


MVC Pattern - How to get errors from the model to the controller?

Say I have a typical MVC setup. The controller passes on some input to the model, and asks it to do something with it. But the validation of the data fails, or there is some other problem. What's the best way of getting these errors passed back to the controller, which will then pass them to the view to be displayed to the user? At the moment, I just have an `errors` array in my model. When any errors occur, I simply add the error messages to this array, and `return false` to the controller, so it knows that errors occurred. And in the controller, I do this:               boolean result = model.process( input );          if (! result)     {        view.displayErrors( model.getErrors() );        return;     }     else        view.displaySuccess();      Is there a better way of handling this?


Is Open Market Code Review a Good Idea?

I have a huge program that I have been developing for almost 2 years. It will probably go commercial in about 6-9 months, but seeing as it is just me developing it, I'd had almost zero feedback about the code (efficiency, maintainability, proper use of best practices, etc.). I would really like to have someone or several people review it for feedback. So:   1. Are there places that I can get this service. Are sites like oDesk the way to go?   2. Is it safe? Would an NDA be sufficient to protect IP or are there other ways of going about protecting IP?   3. Are there particular qualities I should look at in a reviewer, other than they know the language and maybe some of the issues? In fact, I don't even know if the 3 questions above are the right ones to ask and I should be asking different ones first. Any advice on this subject?


addIfNotExist alternative

Is there are any standards or conventions on naming methods which add something if it not exist into another something. For example: **Store.instance().addItemIfNotExist(item)** IfNotExist is really ugly part. What workaround may be?


How to set up a one-man research in the difference between BDD and Waterfall?

Earlier, I asked a question about how to measure the quality of a project. The outcome of that question was that the quality of the project can be divided into two parts:   * Internal quality (code quality, measurable by code quality metrics)    * External quality (Acceptance test, how well the software meets the requirements) So based on that, I want to set up some research and validate the outcome of the project. The problem is, I will conduct this research on my own, so it's not possible to run the project once in BDD style and the other one in waterfall by myself. It's also not possible to compare BDD and waterfall projects on a larger scale, due to the fact that there are not enough BDD projects that can be measured because of the age of BDD. So, my question is: did anybody face this problem? How could I execute my experiment in such a way that it is of scientific value?


Abstract base classes and copy construction, rules of thumb

Often times it's a good idea to have an abstract base class to isolate the interface of the object. The problem is that copy construction, IMHO, is pretty much broken by default in C++, with copy constructors being generated by default. So, what are the gotchas when you have an abstract base class and raw pointers in derived classes?               class IAbstract     {         ~IAbstract() = 0;     }          class Derived : public IAbstract     {         char *theProblem;         ...     }          IAbstract *a1 = new Derived();     IAbstract a2 = *a1;//???      And now do you cleanly disable copy construction for the whole hierarchy? Declare copy construction as private in `IAbstract`? Are there any rules of three with abstract base classes?


Reasons for Pair Programming

I've worked in a few shops where management has passed the idea of pair programming either to me or another manager/developer, and I can't get behind it at all. From a developer stand-point I can't find a reason why moving to this coding style would be beneficial, nor as a manager of a small team have I seen any benefit. I understand that it helps on basic syntax errors and can be helpful if you need to hash something out, but managers that are out of the programming loop seem to keep seeing it as a way of keeping their designers from going to Facebook or Reddit than as a design tool. As someone close to the development floor that apparently can't quite understand from a book tossed my way or a wiki page on the subject... from a high level management position, what are the benefits of Pair Programming when dealing with Scrum or Agile environments?


Can I use MSBuild to build old VS6 C++ projects?

I have a build computer where Visual Studio not installed, only MSbuild which can build VS2008 projcets without having any Visual Studio installed. I wonder whether it is possible to use MSbuild with VC++ 6.0 project files, although I am thinking this could not be possible. In the past I have used it with a VS2008 solution file for C++, but not for building C++ 6.0 dsw file. For Vb6 we have an extension package for Msbuild (MSBuild.ExtensionPack.VisualStudio.VB6). Is anything similar available for C++ 6.0 projects? An alternative could be if there are lightweight build tools that can built VC6++ .dsw files without having to install Visual Studio 6.0 ?


How is the "evented-io" in node.js any different from the windows event model

I'm wondering how the "evented-io" in node.js any different from the windows async IO model? Is the callback from node.js executed on a thread, if not, where is it run? I don't mean to question the productivity or awesomeness of node, but specifically to understand if the architectural design differs from what is commonly done in the windows space, say with WCF or ASP.Net.


Best way to expose a data-oriented service

I'm currently tasked with writing a wcf service that, for now, will only used inside the company network, the problem is that I'm not sure how I should handle the operations it exposes. The software that will use this service will have to modify similar tables in different ways. For example a table, that has columns a,b,c and d. Program X only updates columns a and b, while program Y updates b,c and d. I feel that a generic Update method that accepts the whole record is easier to write and makes the service less bloated. But it does feel less secure, and would probably make it harder to understand for new developers. How do I best handle these situations on a service level? edit: Yes the tasks are in a sense unique, but the problem is that it's difficult to figure out how unique the service should be. Do I make a general service to allow access to the data, and let the details of those tasks be handled client-side? Security concerns are not that high. The biggest concern is maintainability and ease of understanding. At this moment we have 20+ databases where some of them have 100+ tables.


Why would you want to look at IL code?

I was reading a blog post over at Channel 9 about the release of an open source .NET/CLR decompiler. I was wondering as to why would you want to decompile a .NET/CLR application and look at its IL code? I'm just curious. **[Edit]** And are there any use for decompilers during the development phase? **[Edit]** I'm a little perverse; I want to know when was the last time you used a decompiler for a software development project, and why?


Are closures with side-effects considered "functional style"?

Many modern programming languages support some concept of **closure** , i.e. of a piece of code (a block or a function) that   1. Can be treated as a value, and therefore stored in a variable, passed around to different parts of the code, be defined in one part of a program and invoked in a totally different part of the same program.   2. Can capture variables from the context in which it is defined, and access them when it is later invoked (possibly in a totally different context). Here is an example of a closure written in Scala:               def filterList(xs: List[Int], lowerBound: Int): List[Int] =       xs.filter(x => x >= lowerBound)      The function literal `x => x >= lowerBound` contains the free variable `lowerBound`, which is closed (bound) by the argument of the function `filterList` that has the same name. The closure is passed to the library method `filter`, which can invoke it repeatedly as a normal function. I have been reading a lot of questions and answers on this site and, as far as I understand, the term **closure** is often automatically associated with **functional programming** and functional programming style. The definition of function programming on wikipedia reads: > In computer science, functional programming is a programming paradigm that > treats computation as the evaluation of mathematical functions and avoids > state and mutable data. It emphasizes the application of functions, in > contrast to the imperative programming style, which emphasizes changes in > state. and further on > [...] in functional code, the output value of a function depends only on the > arguments that are input to the function [...]. Eliminating side effects can > make it much easier to understand and predict the behavior of a program, > which is one of the key motivations for the development of functional > programming. On the other hand, many closure constructs provided by programming languages allow a closure to capture non-local variables and change them when the closure is invoked, thus producing a side effect on the environment in which they were defined. In this case, closures implement the first idea of functional programming (functions are first-class entities that can be moved around like other values) but neglect the second idea (avoiding side-effects). Is this use of **closures with side effects** considered functional style or are closures considered a more general construct that can be used both for a functional and a non-functional programming style? Is there any literature on this topic? **IMPORTANT NOTE** I am not questioning the usefulness of side-effects or of having closures with side effects. Also, I am not interested in a discussion about the advantages / disadvantages of closures with or without side effects. I am only interested to know if using such closures is still considered functional style by the proponent of functional programming or if, on the contrary, their use is discouraged when using a functional style.


Good strategy to implement a listener processing tasks provided by the database

Let's assume this conceptual scenario: The database is constantly populated with "a ton" of tasks named `PleaseSendAnEmail`. A scheduler/listener in background is aimed to handle those tasks.   Of course, rules are that a specific mail shouldn't be sent more than once and that the handling should be the fastest possible.   Possible status for the task are: `New`, `InProgress`(facultative regarding the strategies below), `Complete` and `Fail`. Various strategies for the listener (I present one process iteration for each): **Single threaded solution:**   * Querying one task whose status is "New".   * Sending the task to the worker `EmailSender`.    * When the worker did the job, passing the status to `Complete` Pros of this solution: Safety !   Cons: Slow, very slow.. **Multi-threaded solution:**   * Querying several tasks at once whose status is "New".   * Multiple `EmailSender` workers are instantiated: Dispatching all the tasks to them   * As soon as a worker has handled one occurrence, its corresponding status is set to `Complete`.   * Meanwhile the workers are processing, a new query is processed, then tasks dispatched to the worker queues etc.. the whole being asynchronous. Pros: Wow! Fast!   Cons: Potential race conditions, since a same task being currently processed could be retrieve again by the next query since the current worker processing it might not completed yet => More than one mail occurrence could be sent! Bad! **Multi-threaded solution involving the`InProgress` status:**   * Querying several tasks at once whose status is "New".   * Updating immediately those tasks with the status `InProgress`.    * Multiple `EmailSender` workers are instantiated: Dispatching all the tasks to them   * As soon as a worker has handled one occurrence, its corresponding status is set to `Complete`.   * Meanwhile the workers are processing, a new query is processed, then tasks dispatched to the worker queues etc.. the whole being asynchronous. Pros: multi-threaded and safety! No more mails than expected!   Cons: Increasing access to database...to mark status as `InProgress`..possible contention on database with a huge number of events. **Multi-threaded solution avoiding queries while at least one worker is still processing:**   * Querying several tasks at once whose status is "New".   * Multiple `EmailSender` workers are instantiated: Dispatching all the tasks to them   * As soon as a worker has achieve one task, its corresponding status is set to `Complete`.   * Meanwhile the workers are processing, a new query is processed, then tasks dispatched to the worker queues etc.. the whole being asynchronous. Pros: Multi-threaded, safety! No need to involve a locking status as `InProgress`!   Cons: If for any reasons, one mail takes 8 seconds to be sent, it will delay the next query! Many jobs could be seen as idle, awaiting for the next query... Which solution should I use? Is there any other efficient solution?


Cascading "Deleted" records that aren't really deleted

Just trying to get some ideas on what people do for this scenario. We have a system database(SQL Server 2008 R2) that has tables and every table has a field we can call "Deleted". It's basically a bit field if its a 1 the record is deleted, if it is a 0 it is not deleted. The field is not nullable and its default is of course 0. We cannot allow real deletions to the database, so to get around this we set a bit field (Deleted) to true. In our application we end up with queries that look like this: `SELECT blah FROM MyTable WHERE .. AND Deleted=0` Basically we filter for records so we only get non deleted rows. Our issue is related records that need to cascade. What do people prefer, should we be doing this in the server side code so that when you delete a record it delete's (Sets the deleted bit field to true) for all related records? Or should this be a trigger that has to check this field and sets the bit field for all related records to 1? Or are we completely on the wrong path?


Avoid code repetition in CRUD operations

I'm developing a PHP application and I find myself doing basically the same code for, say, creating an object based on a form filled by the user. The objects are of different classes, but the process is mostly the same: take the data from the form, apply validation, save/return error. Is there a way to automatize this process? I ask also because I intend to write a public API and use the same code to do those operations, instead of just copy/pasting. I thought of making a kind of Factory Method pattern that receives the type and the data from the form (or any array), create an instance and set the data, testing the validation afterwards (each object knows how to validate their own fields). And that for each of the other CRUD operations as well. Is that feasible/good practice? Should I just repeat the similar code? There are any other way to do it? For the record, I'm using ORM already (Doctrine). Still, I think that a lot of `create` functions with pretty much the same code (a bunch of `set*`) is something too repetitive.


How to create an algorithm for determining Boolean Tautologies

So i am right now exploring some topics in a proof course and it occurred to me to try to create a boolean tautology solver. I would like an algorithm that is more efficient than brute force. Problem Statement: given a string of '(', ')', '[and]', '[or]', ! and pieces of text that denote variable names (which by definition cannot include parenthetical marks brace marks or ! marks) which must be surrounded by a pair of parenthesis The words 'TRUE' and 'FALSE' are also reserved determine if the boolean string is well-formed and if so, is it a tautology ex: `(alpha)[and](beta)` is well formed and not a tautology because if: alpha = false and beta = true is a counter example ex: `(alpha)[or]!(alpha)` is well formed and a tautology because `((X)[or]!(X))` is by definition a tautology ex: `((alpha)[or]((beta)[or]!(beta)))` is well formed since `(beta)[or]!(beta)` is true and `((alpha)[or](TRUE))` is always true ex: `((alpha[and](beta))` is not well formed Some ideas I had for this was to begin by forming a parenthetical tree. Since every statement will be encapsulated by parenthesis before it can be applied to a [or], [and], or [!] operator what I can do is partition the string into its separate highest level blocks enclosed by parenthesis (clause1)(clause2) to generate 2 nodes of a tree pointing to the high level node Each node contains information about whether it has a ! attached to it's front, and if it has nodes below, what operator is used to unify those two nodes This tree could be quickly generated to reduce the statement to individual literals and easily verify if the statement is well-formed (are there an equal number of ( as ) and does every [or] and [and] have two statements surrounding and a pair of encapsulating parenthesis around these two statements. Now my plan was to systematically crawl up to nodes that do have a (!) value and distribute the not via DeMorgan's laws. If I am ever forced to do something along the lines (x and !x) I have immediately found a contradiction and can abort. I'm still not perfectly clear what must happen at this stage however


Why to keep wrapping closure in each js-file if it can be added after concatenating?

At the moment every javasrcipt file in our project includes closure wrapper. Before deploying all files are concatenated and minimized. And i'm asking myself, do we really need all that closures OR one closure added after concatenation will do the job. I can see only one reason not to do that - the variable we are sharing between files will get in the global namespace. But there is no conflict so is don't see any problem. The real question is what other cons may be? Or more generally what approach is better - one closure or many?


Ruby Shoes for non-trivial apps

I've been taking a look at Ruby Shoes for GUI development with Ruby. So far, it's been a pretty good experience for making simple apps. However, I am quite worried about being able to write large scale applications with it. For example, how would I go about using MVP pattern with this framework? For now, I have not been able to not make presentation concerns leak into the view because of the lack of some kind of "data binding". I have code that looks like this :               Shoes.app do         @view = SampleView.new         @presenter = SamplePresenter.new @view              @label = para @view.sample_property              button "Update sample_property" do             @presenter.update_sample_property         end     end      Here, the call to `@presenter.update_sample_property` updates `@view.sample_property` but the label is not updated accordingly. For this to work, I would have to make `@presenter.update_sample_property` to return a string, and then call `@label.text = return_value`, but I think that would violate the MVP principle of not having presentation logic in the view. I'm used to work in .Net with the MVP pattern so I don't know if the pattern applies correctly to Shoes like I tried to do. Are there any resources out there for making non-trivial apps with Shoes? Especially using the MVP pattern or something similar? EDIT : I took a look at the shoebox to see what other people have achieved with the framework. Though I did not look through it extensively, at first sight it seems like they are all simple projects with no real purposes. UPDATE : I've finally been able to come up with something that satisfies me. Oh, and by the way, I moved to green_shoes because it is all written in ruby and I can run it from the command line rather than from the Shoes application. Packaging is not an issue for me quite yet.


Is Ruby on Rails' Active Record an example of Aspect-Oriented Programming?

From Clean Code, about Cross-Cutting Concerns: > Note that _concerns_ like persistence tend to cut across the natural object > boundaries of a domain. You want to persist all your objects using generally > the same strategy, for example, using a particular DBMS... Is Active Record an example of aspect-oriented programming? > In AOP, modular constructs called _aspects_ specify which points in the > system should have their behavior modified in some consistent way to support > a particular concern. This specification is done using a succinct > declarative or programmatic mechanism. If Active Record is an example of AOP, what is the "aspect"? Is it the class declaration that inherits from Active Record?               class Foo < ActiveRecord::Base


Python for a desktop app

I currently have a .NET app that I want to convert to being cross platform, as a growing number of my users want a Mac version. Since this forum doesn't seem to like questions that are "what languages are suitable for these requirements", I'll focus this question on Python as the language of choice. Will Python be a good fit for the requirements below? Drawbacks?   * Desktop app - many of my users do not have an Internet connection where they use the software, so a web app will not do   * Object oriented   * Store data in a relational database as well as configuration files   * Reporting engine, preferably using templates   * Network connectivity - Some users setup multiple workstations sharing a single data file   * Support RS-232 serial port communications, read and write   * Support video capture   * Play WAV and other sound files   * Simple app installation - too many of my users are not very computer savvy, so the easier the install the better   * Be able to implement a demo or time-limited licensing model I considered Java, but am hesitant being at the mercy of Oracle and many people have had security concerns about the JVM. I also considered the Mono project to keep the app in .NET, but their MoMA utility shows thousands of unsupported items. I really prefer to have just one code base to maintain, instead of one for Windows and one for Mac. Python seems to be what I keep coming back to. For some background on myself, most of my experience has been with VB, VB.NET, C#, and Java with some dabbling in PHP/Javascript/HTML. All of my desktop experience has been with Windows.


Music Notation Editor - Refactoring view creation logic elsewhere

_Let me preface by saying that knowing some elementary music theory and music notation may be helpful in grasping the problem at hand._ I'm currently building a Music Notation and Tablature Editor (in Javascript). But I've come to a point where the core parts of the program are more or less there. All functionality I plan to add at this point will really build off the foundation that I've created. As a result, I want to refactor to really solidify my code. I'm using an API called VexFlow to render notation. Basically I pass the parts of the editor's state to VexFlow to build the graphical representation of the score. _(EDIT: The following diagram is outdated as I began to rework the structure, please see the update at the bottom of the post for the new diagram)_ Here is a rough and stripped down UML diagram showing you the outline of my program: In essence, a `Part` has many `Measure`s which has many `Note`s which has many `NoteItem`s (yes, this is semantically weird, as a chord is represented as a `Note` with multiple `NoteItem`s, individual pitches or fret positions). All of the relationships are bi-directional. There are a few problems with my design because my `Measure` class contains the majority of the entire application view logic.   1. The class holds the data about all VexFlow objects (the graphical representation of the score). It contains the graphical Staff object and the graphical notes. (Shouldn't these be placed somewhere else in the program?)   2. While `VexFlowFactory` deals with actual creation (and some processing) of most of the VexFlow objects, `Measure` still "directs" the creation of all the objects and what order they are supposed to be created in for both the VexFlowStaff and VexFlowNotes. I'm not looking for a specific answer as you'd need a much deeper understanding of my code. Just a general direction to go in. Here's a thought I had, create an `MeasureView`/`NoteView`/`PartView` classes that contains the basic VexFlow objects for each class in addition to any extraneous logic for it's creation? but where would these views be contained? Do I create a `ScoreView` that is a parallel graphical representation of everything? So that `ScoreView.render()` would cascade down `PartView` and call `render` for each `PartView` and casade down into each `MeasureView`, etc. Again, I just have no idea what direction to go in. The more I think about it, the more ways to go seem to pop into my head. I tried to be as concise and simplistic as possible while still getting my problem across. Please feel free to ask me any questions if anything is unclear. It's quite a struggle trying to dumb down a complicated problem to its core parts. **UPDATE:--------------------------------------------------------------------------** So I went ahead and started refactoring with my idea from above. Here is an updated Diagram @JW01 I understand why bi-directional relationships are potentially bad (difficult to maintain, increased complexity), however, I do believe the increased flexibility is worthwhile and I have implemented it in a maintainable way. Each notation "container" (`Score`, `Part`, `Measure`, `Note` \- all contain children of some sort) inherits from `Container` (this relationship isn't shown in the diagram because the program I use is shitty and it looks super messy). The `Container.addItem(item)` method mixes in the `Traversable` class methods and `parent` property to the item added. To me this seemed pretty clever and easy to understand. Basically, any item that gets put in a container gets extended functionality. As a mentioned in a previous comment, I may want to pull out a nice music data API out of this, which would allow for "plug-ins" to be easily created. Traversing in both directions would be particularly helpful for functionality like that. Plus these classes are small and maintainable, and unlikely to change. However, I understand that the less things that depend on these relationships the better. So it's definitely best if I isolate this traversing functionality for use with the `Selection` module. I'm noticing that my `View` classes are doing a lot now. Building, rendering, formatting and handling click. It would probably be wise to factor out a an abstract View module composed of a ViewBuilder, ViewFormatter, ViewRenderer, ClickBehavior?


What is the difference between btree and rtree indexing?

I've noticed on MySQLWorkbench that you can choose how to store your indexes before forward engineering your design. The storage types are:   1. BTREE   2. RTREE   3. HASH Researching this, I found some information that was pretty much over my head, so I'm looking for practical information on what the difference is between these and/or why you should choose one over another. Also, I have never chosen a storage type before, so I assume MySQL is choosing a default storage type (BTREE?)


How do document-oriented databases implement references?

In relational world we have Foreign Keys to reference other entities. But how do document-oriented databases like MongoDb, CouchDb, RavenDb implement references among entities? **Update.** StackExchange related example. We have Question entity and its tags. Each tag, is a separate entity so it has its properties (for example, description). How can I reference tags for some Question?


Solution Checker Algorithm for a Game

For the moment I'm strictly speaking in Pseudocode. I'd only like to see if i'm on the right track. The game I'm talking about is similar to a application called FLOW.   In this game, you're given a nxn board(Always a square) and need to fill out each slot in the board. Similarly, when a board game is initialized, it will have objects like the set up below...               Board - 1 2 3 1             0 0 0 0             0 2 3 0             0 0 0 0      In this example - the objects are 1 2 and 3. A solution would be as follows...               Board - 1 2 3 1             1 2 3 1             1 2 3 1              1 1 1 1      The whole purpose is to fill out the board game by connecting the starting object to the end object. What I have in mind is the following...               CheckSolution(1d representation of the boards state, int totalcolors) {            // I would loop through the colors, a 0 is not a color - empty.        // If the board has a 0 in the array, I would automatically return a false solution.        // Then, I would call DepthFirstSearch on the color.             // -- I would set a counter on this to count the # of colors, if this isn't equal to the total # of that particular color, I would return false.          // Else, the solution is valid.     }      Does this sound reasonable? Or is the better way to implement a solution checker.


What is the point where multitreaded programming becomes slower than the problem?

I currently try to design an engine at the core level. However, I cannot decide if input thread should be mixed with a rendering thread or any other thread. Would making it an extra thread with all the locks it will require be slower? If it's same or faster, would at least be marginally faster? [Consider the above only an example to the concept.]


What is this pattern called? Is this a variant of the Module pattern? I remember there's disadvantage to this pattern and it's related to memory usage.               var module = function() {              this.Alert = function() {                 alert("I'm a public");         }              function iamPrivate() {              alert("not callable because I'm private");            }     }          var inst = new module();     inst.Alert();


Is there a term for this coding practice?

One of the incidental complexities of introducing features to an existing system is that the programmer often has to touch several areas of code that are not immediately adjacent. Over the long haul it can be unclear when looking at a bit of code that it pertains to another bit found elsewhere. It's both ugly design and a maintenance hazard. One of the properties of superior code, in my book, is its ability to keep a concept localized in one place. Sometimes this is built in to an architecture up front making it easy to plug new features into a system. In scripting languages where all classes remain open to extension at runtime, it can be easy to think of the language as its own platform and not go the route of formalizing how things plug in. An app written in a scripting language could accept a module whereby the module reaches out to the various system components and changes them -- adding aspects to functions, wiring into events, and so on. Essentially, because the architecture wasn't properly designed for extension, we utilize a poor-man's plug-in system and oftentimes this suffices. In effect, we eliminate the need to modify several spots directly and instead tweak the system perhaps in similar spots but in an automated fashion. That's what I'm focusing on. We still need to modify things that are spread across our system, but we do so in a way that keeps the entirety of the change localized to a single file (module). In there a design pattern/term for the practice of simply localizing all the code (even if it has tentacles) to a single physical location (its own file)? I'm not sure it's the plug-in pattern or the extensibility pattern because in many cases a scripted system may not have been designed with extensibility in mind; however, it is still possible to localize change. Would this simply be called modularity? I'm really just looking for a shared term that I can use to rightly convey the concept without all the explanation.


Name for sanitizing at the right time?

Recently we had an issue on our site where someone attempted SQL injection via a cookie (we'll call it `lastID`). NOC was in a frenzy and angry about how the cookie as an attack vector could be ignored. They had a developer create a class for managing cookies that will sanitize `lastID` (and eventually other cookies) to check that it is numeric. However, I think that this is wrong. The problem wasn't that `lastID` wasn't numeric, it was that the query that uses it was vulnerable to injection. I'm in charge of the review of the code changes, and I want to bring up the fact that forcing `lastID` to be numeric is not particularly useful and perhaps even undesirable. Is there a term or concept that describes sanitizing at the right time (i.e. sanitizing at query time rather than at cookie retrieval time), or "over- sanitizing" (e.g. forcing `lastID` to be numeric) that I can use to describe what's happening/should happen in my review? The second part of Postel's Law seems to apply here in my mind: > Be ... liberal in what you accept


Most readable way to format long if conditions?

Long winding `if` conditions should be avoided if at all possible, yet sometimes we all end up writing them. Even if it's a very simple condition, the involved statements are sometimes simply very wordy, so the whole condition ends up being very lengthy. What's the most readable way to format those?               if (FoobarBaz::quxQuux(corge, grault) || !garply(waldo) || fred(plugh) !== xyzzy) {         thud();     }      or               if (         FoobarBaz::quxQuux(corge, grault)      || !garply(waldo)      || fred(plugh) !== xyzzy     ) {         thud();     }      or               if (FoobarBaz::quxQuux(corge, grault)         || !garply(waldo)         || fred(plugh) !== xyzzy) {         thud();     }      or               thudable = FoobarBaz::quxQuux(corge, grault);     thudable ||= !garply(waldo);     thudable ||= fred(plugh) !== xyzzy;          if (thudable) {         thud();     }      or any other preferences?


Multiple handlers of an exception, and handling exceptions in the UI

Related to: Is onError handler better than exceptions? **Premise** I am writing a piece of library code that performs certain tasks, to separate concerns, we decided it should not write to a log or write to the display directly, but instead provide an event registration mechanism that allows interested client code to listen to events of its life-cycle. So far so good. We have an event handler for log, and and event handler for display, they are informed when an event occurs and they write to the log / display independently. So we have so far (pseudo code)               class MyLib(List<MYLibEventHandler> listeners)           class Display implements MYLibEventHandler          class Log implements MYLibEventHandler      **Question** The question that was raised was - how to inform the clients of exceptions? One way of looking at it is that an exception can be looked as just another event. It is something external that happens, and the clients are interested in knowing when it occurs. So we can simply add another event for exceptions that receives the exception object. (we can re-throw the exception to allow any other try / catch constructs to handle it, but the log / display are not really _handling_ the exception, they are just being notified it happened so they can do whatever they want with it. They can't really recover from it) On the other hand, it smells wrong. An exception is not a normal event, it's a break in the flow, so we can say that our "main" will catch any exceptions and pass it to the `Display` and `Log` instances explicitly, outside of the event dispatch mechanism. This smells also, because we already have a list of listeners, yet we explicitly call the log and the display to handle the exception. (Perhaps I should not be alarmed that the code is doing something "exceptional" when handing an "exception". but it still smells that I need to keep track of clients twice) So I'm stuck with a code smell no matter what I choose. Is there a design pattern to handle multiple listeners / handlers for the same exception? try catch is very "single listener" / "hierarchical" structure, it doesn't seem the right tool for a wide "dispatch" like scenario. Perhaps some sort of an AOP pattern? My attempt to answer this is that if I have a remote server, with multiple clients, and the server needs to communicate that a server exception occurred, there would be no question since the client can't really "try / catch" the exception. It will be more likely be sent as an event (e.g. in Akka as a Try object). Even in RMI, the exception is sent more as an "event" and only then triggers a `RemoteException` locally. Is there a known design pattern to handle multiple, independent, read-only listeners for an exception (e.g. listeners that can't and won't recover from the exception, they just need to know it happened) Perhaps in this case, sending the exception as an event (and then rethrowing it) is the right way to go?


Is it true: use Agile methodology results less planning?

I am kind of new in agile environment since I always participated in projects before which was only said to be agile while it wasn't. Now I am really in an agile project and I see a setback - if it is setback - of agile methodology, the lack of pre-planning. I see that our BA talks to key users, collects data, which are pretty much just a sketch what they really want. Then we first need to refactor many of things because the real needs are a little bit different. Then there is a second phase when we realize they need a bigger system we expected, following that we need to make bigger refactor and generalize everything afterwards. My questions are: **Is this the way it should be? Given by the information are we doing it in the good way? And if the answer yes, then does the low planning costs match with the higher refactoring and rewriting costs? So to say: profitable?**


Should I devise a FileHandler interface to deal with different Files?

My background has largely been manual testing and I started learning core java to be able to work with Selenium. I am wanting to write couple of reusable method, like reading/writing data from csv, excel, word etc. I created a class named - FileHandler and created method for this. Hence this class deals with all sorts of files - csv, excel etc. But going by the OOPs concepts (and if I have understood them right) I should be creating an Interface and implementations for this Interface, and instead of directly dealing with specific implementation I should be working with reference of type interface. i.e.               public interface FileHandler {     }          public class ExcelHandler implements FileHandler {     }          public class WordHandler implements FileHandler  {     }      My question - is this right approach in my scenario should I just create one class to handle all file input/output operations? Though I am yet to figure out what goes in interface as methods like -               getExcelData(String filePath, String workSheet, String row, String column)      would be specific to only reference of type - ExcelHandler and does not make much sense keeping them in interface.


How to avoid huge functions with made up of enums and if-else or switch case when dealing with server response in iOS?

in my application, I have a request type associated with variety of API calls I make to the REST server. when the response from server comes in the same delegate method for web engine's response, I have to check the API type in the request object passed as a parameter to the delegate method and then take the corresponding action. The problem is there are around 10-12 different API request types. So the switch case that checks the different enums associated with API Types, takes action based on it. How to get rid of this switch 'tower' ?


How to work in an environment with a 'character assasin'

This is hard to explain, so I will start with my background. I have been in development for about 8 years (6 commercial), have a MSc in OO Info Systems, have a true passion for development and up until a year ago would spend most of my time learning new things and creating helpful applications for the team. I work at a large investment banking company and this new developer who used to work for one of the larger investment banks joins the team, lots more experience than me, more professional etc... etc... Initially I helped him out when he started (ALOT), my attitude up until recently is a team effort everyone helping each other out, but I think he saw this as a weakness. I was the big cheese up until he arrived, and in hindsight and in present time he now is. We clashed because I take the object-oriented route and focus on good design / documentation etc... whereas he prefers not to do documentation and sort of hates OO prinicples, he would rather create a nice interface than good code, next to no comments, doesn't like unit tests, doesn't like interfaces/abstract/inheritance etc. The problem is what he is good at is pleasing management and I have to give credit where credit is due. Now after 6 months he tried to always surpass me, take my code ideas and call them himself, snipe behind my back etc.. and eventually won favour with the developers and increasingly began criticsing me. I'm now at the point where I am very stressed out because everyone has become hyper-critical of my code but when he or someone else makes a mistake or an error its quickly forgotten. Ergo the pressure is very much with me. I'm not used to this situation and wondered if someone out there has come across this and has advice on how to tackle this situation? Or can share a similar experience that might be useful


Is it better to have one method that takes a bool as a parameter or two methods with different names?

I'm writing a factory class for a Selenium Web Driver and I came across a choice that I couldn't figure out which is cleaner. Having two methods with the same parameter.               GetWebDriver(string browser)     GetRemoteWebDriver(string browser)      or adding a boolean parameter               GetWebDriver(string browser, bool isRemote)      I would think in this case the first option might be better because there is very likely no reason I need to extend it to more than a boolean of choices and hence two methods. On the other hand, I can see the second one to better for when there is more than two choices or likely many extensions in the second parameter in the future. Which would you choose for Cleaner Code and why?


Best approach for near real time message passing from server to client across router?

I am developing an application which must run on up to thousands of client systems that I control (Linux) which are connected behind common NAT devices to public Internet. Each of these client devices must receive infrequent messages from a cloud service (1 or 2 per day) and on average, must receive these messages in less than a 500ms. I have full control of both server and client systems to install any operating system, programming languages or applications. However I will not have control of the router and network in between. Otherwise, I could just call a web service running on the "client" devices in order to send the messages. I have considered running Node.js on the cloud service, with javascript sockets on the client kept open 24x7. From what I am told Node can handle tens of thousands of open connections, making it an ideal server for this. NAT devices will time out open connections, so dummy keep alive data could be sent. And if the connection is dropped, the client just renews the socket. Other options include Erlang or even a simple c socket with long polling. However I am having a difficult time researching this problem for other approaches. What would be the best approach? Given no restrictions on language or programming.


Working in a multi-disciplinary team; with a specific skill set - time management?

I thought I'd post this here for the anonymity of someone I was speaking too recently at a social event for developers. Amongst the trading of _"war stories"_ , he presented the following dilemma.. (Specific questions below) > At the moment I'm working at a start-up - with a handful of developers. I > only really come in to contact with a front-end developer, my manager. This > is perfect when I'm doing front-end specific development - but I'm generally > more suited to back-end work, thus I get called upon to do back-end > development at times. > > I recently undertook a project where the requirements weren't made very > clear, there was no management as per se as my usual manager was on leave > during the development phase - and certain stumbling blocks appeared. > (Technical ones; file parsing and formats etc) There was an intention for > the front-end dev to be completed by my manager upon his return. > > Despite the stumbling blocks, the project was completed. A few bugs were > found, but these were largely ironed out before a handover late on a Friday > evening. My manager came back with several suggestions, some of which he had > made, and requested they be done for 11am on the Monday. The work required > for these changes include: > >   * Database Restructuring (To accomodate new data) >   * Code refactoring (To accomodate the above + a more complex file parser ) > > > To include testing, I'd estimate this was a good 12 hours or so of work. > Brainstorming, development, assorted fixes (was a list of 7 or so points) > and then testing. Now I had commitments over the weekend, so I'm stuck on a > Sunday night working in to the early hours to get this done. > > There are plans to bring on a project manager, but this is just one example > where I've taken my work home (often voluntarily, I will admit.) - and it's > actually eating in to my personal development, and also sucking some of the > satisfaction out of what I do. In my opinion too, it leads to spaghetti code > and bugs - which I've witnessed before.   * **Realistically speaking, how is a work/life balance meant to thrive in a set of circumstances such as the above?**   * **Is the lack of satisfaction possibly a productivity issue in the end?**   * **What can you do when you've been given an unrealistic task, but the situation is such that it's 'do or die'?** (Perhaps when the task was assigned by someone without a complete technical understanding?) I'd really like to hear other peoples views on this, as I'm going to guess it can be quite a interesting (and common) problem. One which involves a fair amount of diplomacy. (Will post my response as an answer, **I will not accept it however** )


Agile bug fixing - what's the preferred process for testing?

When a bug is fixed, the dev set its status to "resolved" and the bug is reassigned back to the person that created it. In our case this is usually the product owner - we don't have dedicated testers. But what's a good process for controlling how/when the PO tests the software? Should he be given the latest build after each bug is resolved/checked-in? Or what about every morning? Or should he only receive a build at (or close to) the end of the iteration, to include all of that iteration's new functionality and bug fixes? We are using TFS by the way.


How to loosely couple modules in service oriented architecture

We're developing a total solution, and we've chosen service-oriented architecture to loosen subsystems. However, now we have a problem. When customer orders something, **Order Subsystem** is responsible to get that order, and register it. However, there are some other modules which are responsible too, in order registration process, and each module should do something on it:   1. Customer Accounting module should check customer's balance, and prevent order registration if there is not enough money in customer's account.   2. Asset Management module should increase/decrease customer's assets   3. Rule Engine should apply some business rules dynamically on it (like preventing a specific customer, or notifying an operator, etc.)   4. CRM should view customer's history, and give good customers some discount   5. ... Right now, we're doing it this way:               public void RegisterOrder(Order order)      {         RuleEngineService.ApplyBusinessRules(order);         // some code here         CrmService.GiveDiscountIfApplicable(order);         // some code here         CustomerAccountingService.CheckBalance(order);         // some code here         AssetManagementService.ChangeAssetCount(order);         // some code here     }      This means that if we add another subsystem (module) that needs to do something on order, we have to **recompile** the code of our OMS (Order Management System) to support it. Also we're coupled to some extent to other subsystems here, and if one of them fail, this registration process fails. One way of making this piece of code dynamic and loosely coupled is to use **interfaces** or **contracts** , like:               public void RegisterOrder(Order order)     {        // Finding a list of all IOrderProcessors.        // Looping over each, calling orderProcessor.Process(order);     }      However, it has two problems:   1. We can't use interfaces over SOAP and HTTP (we don't have access to other subsystems' DLL files)   2. Those need to run in a specified order (rule engine the first one) What should we do here? What are the known patterns and practices?


Selecting an appropriate design for Month/Date Selection

I have a requirement what seemingly looks very simple (and perhaps strange) but some minor details are giving me troubles. Perhaps I'm overthinking this. I'm building a scheduler application (on WPF) for an embedded device that runs everyday. The scheduler controls when the device can be turned on and off. For example, the embedded device can be scheduled to shut off every weekends and on any holidays, such as July 4th. So I went ahead and designed my datastructure to hold a datetime collection for holidays. Firstly, I don't need to store the time but apparently in C#, there's no other appropriate class that holds just dates. Second, I also don't need to store years but then I have no way of knowing whether it is a leap year or not. (For example, I can schedule the device to be shut off on every February 29th, but that date may not be available on a particular year.) I also need a way for the users to select a month/date. As far as I know, there's no appropriate UI control available to handle my problem. I think I need to look for something like this (Below is photoshopped from a standard calendar control): ![enter image description here](http://i.stack.imgur.com/XHyeW.jpg) What datastructure/design would you use to handle problems like this? What's a good UI design to have users intuitively select a month/date?


In Objective C, what English words can I conceptually associate to the symbols?

I'm learning Objective C (from a C# background) and am having difficulty understanding the unusual method signatures and am looking for a shortcut to make the learning curve less steep.   * When reading Objective C code, what English words or phrases can I associate with the symbols? For example, calling a method looks like this:                 @implementation Calculator            -(int) add:(int)a and:(int)b {       }       @end      I would write this code:               Calculator *calculator = [[Calculator alloc] init]];     int sum = [calculator add:10 and:20];      So far in my learning cheat sheet I wrote: `"[" means "do"` I don't know what curves or bumps I'll run into as I proceed, but I am looking for a conceptual reference handy for a Objective C newbie.


What is the typical career path for a Software Development Manager?

What does the career path of a Software Development Manager typically look like, in terms of years of experience, education, professional background, and so on?


Migrating from python 2 to 3

It is easy to find questions asking if one should start with python 2 or python 3, and it is a consensus that python 2 is the way to go as it is has more libraries and thus better supported. Python 3 was launched back on 2008 and this question already addressed a migration. As it was too soon, the solution was to wait. 5 years have passed now and a good bunch of libraries already support python 3. At the time I write this question, according to this page 244 packages on pypi support python 3 while 156 does not. On the top 30 most downloaded packages, 24 support python 3 Following this I feel safe enough to start migrating from python 2 to 3 and also avoiding telling people to start on python 2 My reasons explained, the question is: **What concerns should I have when migrating from python 2 to 3?** Not just code syntax and replacements, as its easy to find a conversion tool to do the 80% of the job, but general concerns, like:   * Do virtual environments mechanism changes?   * Building, packaging and distribution differences   * Will I have only cPython? (Looks like Jython has a long way to go to reach python 3)   * Multi threading/processing programming. Always a delicate subject   * Testing. Any changes?   * What common things that I can still do like in python 2 but I should stop and start doing in an other way? I feel that a code replacement tool will change the code to make it just "runnable", but it will not use the correct or better option if the option itself involves big changes ps: This question was asked on stack overflow, but was closed as too broad. Anyway, I felt that the correct place is here


How to ensure a single coding standard in .NET with tool support

Probably, the basic situation is familiar to everyone. You have agreed on certain coding standards in your team and now it is time to make sure that everybody follows them. Some do it via heavy paired programming, others maintain a list of coding standards and do a manual review. Others even use the static code analysis tool from Visual Studio to make sure that coding standards are enforced. What are your best practices to ensure coding standards? Which tools do you use - are there some essential tools every dev should know? How do you integrate the standardisation of your code in your development tools? Thank you! Stefan


Are there open-source JavaScript libraries addressing multiple browser tabs and client state for newer browsers?

There are a few new HTML5 features that have made it into recent browsers that allow sharing state among tabs, browser windows, same domain windows, etc. So it's probably gotten a little easier to write a web application that keeps a lot of state on the client and also manages state intelligently between tabs and/or windows. There are currently libraries like Backbone.js that can help manage state in a single tab or a single window. Is there anything out there yet that helps with multiple tabs (or windows) managing global state, tab specific state, and cross-tab eventing without relying on the server to sync them all up?


data maintenance/migrations in image based sytems

Web applications usually have a database. The code and the database work hand in hand together. Therefore Frameworks like Ruby on Rails and Django create migration files Sure there are also servers written in Self or Smalltalk or other image-based systems that face the same problem: Code is not written on the server but in a separate image of the programmer. How do these systems deal with a changing schema, changing classes/prototypes. Which way do the migrations go? Example: What is the process of a new attribute going from programmer's idea to the server code and all objects? I found the Gemstone/S manual chapter 8 but it does not really talk about the process of shipping code to the server.


When should I *not* use Unicode?

Unicode seems that its becoming more and more ubiquitous these days if it's not already, but I have to wonder if there are any domains were Unicode isn't the best implementation choice. Are there any languages or scripts that Unicode will not work well or won't work at all? Are there any technical reasons to use a different system entirely (other than working with legacy systems)? Naturally, I would assume that the answer is to always use Unicode. Am I wrong?


When is it beneficial to not use utf-8?

When is it beneficial to use encodings other than UTF-8? Aside from dealing with pre-unicode documents, that is. And more importantly, why isn't UTF-8 the default in most languages? That is, why do I often need to explicitly set it?