Should client ideas about the UI turn into User Stories?

I'm trying to learn about Agile methodologies through the Head First Software Development book and after reading about it, I've tried to apply the concept of User Stories to a recent mini-project (set of new features added to an existing application). Besides the fact that I have a hard time not thinking in terms of "tasks", I've also had trouble with the fact the client has asked things in a way that, to me, include implementation. For example, instead of asking "we want Limited Users to have an Address now, just like Regular Users" and leaving the rest to us, they would say "we want Limited Users to appear in the same list as Regular Users and we want them to have an Address too, and it should be editable in the same Address Editing screen as Regular Users". It seems to me that User Stories are meant to express a business need, but not its technical implementation, nor its UI implementation. That said, does it make sense that a client would impose its vision of the UI and have that be their business need? How would I turn the client's request into one or more User Stories? Should I say "woah there! Tell me your ultimate goals and we'll see how we can get the UI to accomodate them later"? Should I make multiple stories, one for the main business need (Limited Users have an Address) and additional ones for the UI requests? Should I just make the business need a single story and have other concerns as details / acceptance tests? Admittedly I'm quite wet behind the ears when it comes to Agile and User Stories and I have trouble defining how much goes into them and where the rest would go too.


MVC: Controller often simply delegates to Model when notified by View of GUI events. Is this reasonable?

Since I learnt about MVC, I used it for every app I made (which is arguably not the best idea, but that's not the topic of this question). All of them small, 1000 LoC apps. I am using Java and Swing for the GUI. What usually happens is this: The view (the GUI class) reports to the controller about any GUI event (most commonly a button click) made. For example when a button is pressed, the view simply calls `controller.someButtonPressed()` or `controller.someOtherButtonPressed()`. It's only reaction to user input is reporting to the controller, nothing else. This, I think, is fine and is proper MVC View implementation. The part I'm having doubts about is the following: In the controller's `someButtonPressed()` methods, it very often simply delegates to the model. For example:               public void someButtonPressed(){         model.doTheAppropriateThing();     }      Nothing more. No 'decision making' or actual 'interpretation' of what the view reported. Very often, only simple delegation to the model. **Is it considered reasonable when implementing MVC structures and specifically controllers, to have the controller often simply delegate directly to the model in reaction to GUI events?** Or does this signal that maybe I'm doing something wrong?


Summary of differences between Java versions?

What are the major differences in between Java version in terms of software development? Where can one find a summary of the most important changes related to programming? The Release Notes such as http://www.oracle.com/technetwork/java/javase/releasenotes-136954.html can be hard to read. For example there is new code structure "for each" in Java 1.5.


Why didn't == operator string value comparison make it to Java?

Every competent Java programmer knows that you need to use String.equals() to compare a string, rather than == because == checks for reference equality. When I'm dealing with strings, most of the time I'm checking for value equality rather than reference equality. It seems to me that it would be more intuitive if the language allowed string values to be compared by just using ==. As a comparison, C#'s == operator checks for value equality for strings. And if you really needed to check for reference equality, you can use String.ReferenceEquals. Another important point is that Strings are immutable, so there is no harm to be done by allowing this feature. Is there any particular reason why this isn't implemented in Java?


Should Cross browser testing be explicitly mentioned in the scope of a project?

I do freelance web development and front end dev is not my strongest point. This question came to me in my recent fixed bid project. Nowadays we use Jquery and Bootstrap and these take care of lots of cross browser stuff. Still, there are lots of errors in different browsers. It requires testing tools and a whole lot of other things to worry about. Should it be explicitly mentioned that the resulting site should be tested for cross browser compatibility in a contract? Or Does it come by default in the scope of the project? How can we estimate hours spent in cross browser compatibility? Edit: Some great answers here. But how should a scenario be handled when no browser discussions happened at all at the time of signing contract?


What is the best way to go about testing that we handle failures appropriately?

we're working on error handling in an application. We try to have fairly good automated test coverage. One big problem though is that we don't really know of a way to test some of our error handling. For instance, we need to test that whenever there is an uncaught exception, a message is sent to our server with exception information. The big problem with this is that we strive to never have an uncaught exception(and instead have descriptive error messages). So, how do we test something what we never want to actually happen?


Is MVVM in WPF outdated?

I'm currently trying to get my head round MVVM for WPF - I don't mean get my head round the concept, but around the actual nuts and bolts of doing anything that is further off the beaten track than dumb CRUD. What I've noticed is that lots of the frameworks, and most/all blog posts are from 'ages' ago. Is this because it is now old hat and the bloggers have moved onto the Next Big Thing, or just because they've said everything there is to say? In other words, is there something I'm missing here?


Should I patent my software?

I go to a university where students are allowed to make their semester schedule based on the information about the subjects they are going to take, that is, the hours that the courses are available, the professors, and the remaining room for other people. Making these schedules by hand was a very difficult/boring task. I wrote a pretty nifty Python program that automates this process. You pick the codes for the subject you're going to take and filter out the professors you don't want. Then the program outputs all the possibilities there are if there aren't time conflicts. This program helped a lot of students. The time to make a schedule reduced from 2 days to less than 30 seconds! Now here begin the problems. My family and all the people that used the program tell me to patent the program before someone steals the idea (that could happen in my country). But I question that myself. Is it necessary to patent a web scraper mixed with a backtracking engine? It was difficult to make the program because I didn't know a lot of things, but now that I have finished, I feel that it would be very stupid/immature to patent such a thing. But on the other hand, I don't want someone else to get the credit for it. What do you think?


Are Concurrency Abstractions Emulating UNIX Processes?

OK, I was pondering this today, and I've come to ask for _completely subjective and bias_ opinions on it. Paradoxically, despite this, I don't think it's flame-war fodder either. I think there is room for perfectly civilized conversation -- It's hardly Vim vs Emacs. I've used a lot of concurrency abstractions, specifically those built on top of threads. There's a big trend among them, whether it be message-passing, immutable-by-default, or thread-local-by-default or other ones. The trend is that they're all reversing the idea of threads by making data sharing explicit rather than implicit. That is, all data is not shared unless otherwise specified, which is the opposite of traditional threading found in languages like Java. (I know Java supports its own higher-level concurrency abstractions though.) For example, you explicitly pass messages. You explicitly state which variables are thread-local. You explicitly state which variables are mutable. These are just a few examples found in some languages. I thought this easy style of concurrency was a modern concept. I was mistaken. I started playing around with UNIX toys like fork() and pipe() recently, and I was shocked to discover that effortless, explicit concurrency mechanisms have been around since the start of UNIX. There's something a little strange about realizing that C + UNIX from the '70s makes concurrency _far_ easier than many modern trendy threading mechanisms. So, here's what I'm wondering... are these modern thread abstractions simply trying to emulate UNIX-style processes on top of threads, with all of their explicitness and not-shared-by-default traits? I know that some mechanisms like STM offer things like DB-style transactions which is genuinely a modern and innovative solution for concurrency, but most just seem like new ways of doing what UNIX coders were doing a long while back. Just to say, I'm not a UNIX fanboy, not by any stretch of imagination. I'm aware that processes are far slower than threads to initialize on many platforms, but I'm talking about this from a conceptual basis.


How to model and query spatial responsibilites of company local branches

what are best practices, to model and query spatial responsibilities of company local branches? My company has many local branches which are all in general responsible for 1 city. This is the easiest case. However, there are some exceptional cases. Here's a list of all possible cases:   * branch a is responsible for city a (general case)   * branch a is responsible for city a, b and c   * branch a is responsible for disctricts 1 and 2 of city a, whereas branch b is responsible for districts 3, 4 and 5 of city a   * branch a is responsible for city a and for Foostreet of district 2, whereas branch b is responsible for district 2 of city a   * branch a is responsible for city a and for odd housenumbers of Foostreet of district 2, whereas branch b is responsible for district 2 of city a   * branch a is responsible for city a for all customers whose surname begin with letters A-F, whereas branch b has G-K, and branch c has ....   * branch a is responsible for city a in case of handling Foos, whereas branch b is responsible for city a in case of handling Bars These are the possible responsibility cases, which could of course also be mixed. The planned system should provide the answer to the question: "Which branch is responsible for city a (or b or c ...)?". If there are exceptional cases, then the question has to be more specific. Is it possible to provide hints like: "City a has more than one branch, please chose a district!" or "For which case are you asking? Responsible branch for handling Foos, Bars, ....?" The question which would most likely to be asked is: "Which branch is responsible for Foostreet 345 in 12345 Foocity?" My requirements are Java Enterprise and a mySQL Database. It may be possible to use MongoDB or Neo4j if it really makes more sense. I already have database with every city, district, zipcode and street, with which the data could be "connected". I hope this question doesn't sound like: "Please do my job for me.", but my experience in spatial domain modelling is almost zero.


upgrading to newer version of compiler

I had legacy code that was originally build for some quite old version of compiler. We are talking about native code, not managed. Now it is ported to almost newest version of the compiler. Every compile error was fixed and now the product is properly compiling and running. But:   * although it compiles and even runs... how can I be sure is is working as expected?    * can I be sure that underlying runtime does not change in a way that it introduces new and unexpected runtime bugs?   * what are best practices when upgrading to newer version of the compiler?


What format is the data going to Windows print drivers?

I have been tasked with writing a print driver. I have no experience with this and have been researching it for a few days. The goal of this is to essentially write the data coming to the driver to a file and then do some additional processing of it. If I understand it correctly, I can start other processes to do most of the work, but I'll need the driver itself to generate the initial file/data. I am confused about what state the data is in when it comes to the driver from an application. Is this something that is determined by the application, or is there a standard of some kind?


Is lucene.net/solrnet a good solution for searching a list of names with fuzzy matching?

At the moment, we're using sql server full text search, but it's too inflexible. The main thing we do is look up names of people from a database based on a search query. The searches need to be fast, and they need to be fuzzy. SQL Full Text Search doesn't really support fuzzy matching especially when combined with the thesaurus option. Therefore I need a better solution. My research suggests that lucene and solr are widely used enterprise solutions, but my searching suggests these are more designed for indexing things like documents and webpages, or what it refers to as 'unstructured data'. Our data is very well structured, and therefore I'm unsure if it's suitable for this type of work or if I should be investigating another product. According to the book I have Solr 1.4 Enterprise Search Server it supports all of the above except for prefix matching out of the box, however it states there are performance issues with substring searches. Do you think that solr/lucene is a good technology to investigate for solving my problem? If not, do you have an alternative? Any advice is welcome. I am a .NET developer, hence solrnet rather than solr.


How to structure multiple overlapping solutions / projects in .Net?

I recently started out working for a new client with an _old legacy_ codebase in which there are multiple .net solutions, each typically hosts some projects unique to that solution but then "borrows" / "links in" (add existing project) some other projects which technically belongs to other solutions (at least if you go by the folder structure in TFS) I have never seen a setup this intertwined, there is no clear build order, sometimes a project in solution A just reference dlls directly from the output directory of a project hosted in solution B, sometimes the project has just been included directly even if it resides FAR away in the folder structure. It looks like everything has been optimized for developer laziness. When I confronted them with why they didn't have a CI server they responded that it is hard to set up with the code organized like it is. (I'm setting it up now and cursing this code-organization) The solutions are organized around deployment artifacts (stuff that needs to be deployed together are in the same solution) which I _think_ is a wise decision, but the contents of those solutions (the projects) are all over the place. Is there a consensus of a best practice to use when reusing common class libraries across multiple solutions / deployment artifacts,   * How to structure code in the VCS   * How to facilitate sharing of business logic between separate deployment artifacts


Difference between statechart and sequence diagram

I realise these two diagrams are very similar, with the obvious difference one models the sequence of a certain function, whilst the other models the state throughout a function being carried out. The differences that I have identified are as follows - probably incorrect:   1. State chart is more of a logical view of any functionality, showing a wider array of deviating paths - however, saying that, sequence diagrams also have the ability to provide alternate (alt) paths, conditions, loops etc.   2. A sequence diagram is aimed at one specific function, e.g. withdrawing money from your bank account, whereas a state chart can model a whole system. State chart example & Sequence diagram example


How do you manage cross-class dependencies on destruction/design (more of a C++ question)

So if I understand correctly, from SOLID design principles, every class should keep a single responsibility. So there should be one class that creates and manages a resources, a second class that does resource processing/update, the third class that connects the resource to some other resource and so on. The question is, how do you cleanly express that in code? Because, in C++, the class destruction order plays an important role. So you basically come to a situation where you get               ResourceClassInstanceManager cf;//does the ResourceClass creation, accounting and destruction?     ResourceClass &rcInstance = cf.GetResourceClass();//creates the instance of resource     ResourceClassUpdater rcu(&rcInstance);//updater that works on the class instance     ResourceConnector rcc(&rcInstance, &instanceOfAnotherClass);      The problem here is that if cf leaves the scope first, or rcInstance is deleted before rcu or rcc. The other classes will still reference the nonexisting instance of ResourceClass. This seems somewhat messy, as the whole creation/destruction chain has to be followed very carefully, and becomes really troubling as soon as you have pointers to objects and deeper nesting levels. Is there a clean solution for this design problem?


How do you tell if advice from a senior developer is bad?

Recently, I started my first job as a junior developer and I have a more senior developer in charge of mentoring me in this small company. However, there are several times when he would give me advice on things that I just couldn't agree with (it goes against what I learned in several good books on the topic written by the experts, questions I asked on some Q&A sites also agree with me) and given our busy schedule, we probably have no time for long debates. So far, I have been trying to avoid the issue by listening to him, raising a counterpoint based on what I've learned as current good practices. He raises his original point again (most of the time he will say best practice, more maintainable but just didn't go further), I take a note (since he didn't raise a new point to counter my counterpoint), think about it and research at home, but don't make any changes (I'm still not convinced). But recently, he approached me yet again, saw my code and asked me why haven't I changed it to his suggestion. This is the 3rd time in 2--3 weeks. As a junior developer, I know that I should respect him, but at the same time I just can't agree with some of his advice. Yet I'm being pressured to make changes that I think will make the project worse. Of course as an inexperienced developer, I could be wrong and his way might be better, it may be 1 of those exception cases. My question is: what can I do to better judge if a senior developer's advice is good, bad or maybe it's good, but outdated in today context? And if it is bad/outdated, what tactics can I use to not implement it his way despite his 'pressures' while maintaining the fact that I respect him as a senior?


Encapsulate external JavaScript library

I am about to develop a ASP.NET MVC 4 project that will make use of maps. Our company has it's own map API which is very basic at the moment, but is intended to be further developed in future to match some specific customer needs. The project will have a mobile/tablet interface in addition to it's web interface and needs to be developed now. So we have planned to start use the Google Maps v3 API. I would like to encapsulate the API, so our applications don't have Google API specific calls. The same approach as if I would like to use som external API i C# and wanted to encapsulate it in order to be able to switch API in future without having to re-code the entire application. But I haven't been able to find similar examples, so the following questions arise:   1. Is it a good and reasonable approach? Let me hear your pros and cons.   2. How would it be done in practice?


How to simulate a REST API?

I am working on a new project which will query data from a 3rd party REST API. This is for a real time sports data feed, so the feed only works when a game is actually taking place. Although the 3rd party provides good documentation (XSD, etc), they have no way to simulate a game happening, and so to test code I have written against this API I would have to wait for an actual game to be happening. My only recourse is to write code to simulate a game on my own, but it seems like a lot of work. Has anyone any experience with any tools similar to Apiary to do this? How would you approach this? Thanks


Can profiling be used to verify if optimization was successful?

I know that profiling is useful to identify bottlenecks and determining what parts of the code require how much time to execute. The latter isn't always very easy to track in the midst of other paths being executed, so once I decide what I want to optimize it might be problematic to see the improvement in numbers. This is especially true in desktop apps which run constantly and it is difficult to: execute the same path and execute it the same number of times to have reliable comparison. It won't help me if before optimization the function ran X times and took 500 milliseconds, and after optimization it run Y times and took 400 milliseconds. In such cases, can I somehow use a profiler to determine improvement or do I have to resolve to other options?


Bloom filters or similar, but with no false positive

To improve some lookups, I am considering the use of Bloom Filters. But in my use-case, the most probable outcome is that the element do exists in the target set. Bloom filters can have false positive, but no false negatives. That would make me check the real (big and slow) storage most of the time because of the uncertainties. Is there another algorithm/data structure with the same properties for space and computation speed (and parallelism of query) that can assure no false positive and a low probability of false negative? (The max size of the set will be around 300k items, the items will be strings of, at most, 512 characters, and I will have hundreds of sets like that.)


Java Swing in real world software development?

Is Java Swing really used for constructing real-world software? I'm taking an introductory course in Java, but nothing more than drawing some shapes, lines & basic tables.


What teamwork methods can be learned without being in a team?

I've worked in team-based environments most of my career, but not as a programmer. (I am trained as a musician/composer.) I'm becoming aware of _programming specific_ team-based concepts, though--slowly but surely--such as Version-Control, SDLC, documentation, etc. I'm getting a certain theoretical understanding, but not really feeling confident about it. **I'd like to practice anything I can to help me learn how to work more effectively in a team.** ...before I actually go and bother someone with my heavy-handedness or ignorance. I'm not sure if it's possible or even recommendable to attempt to 'practice' team-based methodologies privately. Maybe the only way to really learn how to work in a team is to just experience it. Likewise, I wouldn't know how to explain teamwork to another musician, but as musicians we don't really have codified methodologies in the same way that programmers do, and I think that could make all the difference. In music there are certain conventions and inflexibility due to the mechanical nature of the instruments/recording equipment (akin to hardware/language, I suppose), but otherwise we kind of make it up as we go along (and I assume programmers do a little bit of that, too, depending on the context--I wouldn't know. That's kind of what I'm trying to figure out). I'm pretty sure that the inevitable answer is that I should work on something open-source; the world is flat, after all, and it's not difficult to communicate across great distances as a programmer (like it often is with musicians). But my feeling is that I'm not ready for that. I would feel safer learning _how_ to approach teamwork with programmers before just diving in, because programmers can perhaps be a little persnickety. I'm trying to avoid a trainwreck-type of experience that might cause some irrational fear. So is there anything I can study beforehand, and if so, is there a generally accepted way to go about it? Like mock-teamwork, team-related practices that can be practiced privately; is any of this making sense?


How to store progress of abstract events?

I making a game in node.js. I have players and they can perform a lot of actions. Actions are all coded as functions, and they change certain variables in either User object or other objects that are stored in a database. Actions are like: 1\. Player enters room (filled with other players and some objects)               room.players.push(player);      2\. The room distribute some things to the players (increments a variable in player object) who were already in the room, and the player that just entered.               player.gemDiam++;      3\. A host player in the room asks the player to give up something (decrement some variable) of his own.               player.potion--;         host.potion++;      4\. The player asks other players to give something else to the room. (decrement their own and increment some of the rooms's variable)               room.players.forEach(function(player){             io.sockets.socket(player.socketID).emit('askNicely');             io.sockets.socket(player.socketID).on('agree', function(){                 player.gemCirca--;             });         });      5\. They all give up what the room game them originally (delete the variable Room set a value for on them) and walk out.               room.players.forEach(function(player){         player.gemDiam--;     });      Now, mind that the players are actual players (that are controlled via client- side socket.io) and these actions are just one of many I chose for this example. How should I go about storing all that in a way that I can reproduce without actual players, sort of like a history of what happened in that room?


How to read from a database, and write to a file asynchronously / non blocking way in Java

I'm trying to modify a serial program that reads from a database, and writes results to a file, this is done in a blocking way and I think we can get performance boost of there is a memory buffer and have the file being written in the "background" asynchronously I can think of the "job interview" solution, using Threads, shared resource, syncronized blocks etc... but I'm sure there is a better way (is there a nice little "delayed write" library out there that will do it for me?) Does any of the java.util.concurrent package offer any help? java.nio? or perhaps JMS/ActiveMQ? What about PipedOutputStream / PipedInputStream as a basis for my buffer? How do I implement a delayed / background / buffered / non-blocking / asynchronous file writter in Java?


Has the license changed for the parts of BOOST that have been accepted into C++11?

The Boost Software Library is licensed under the BOOST License Now, if you only use C++11, does this mean you're bound by the BOOST license terms if you use those parts of C++?


Good questions to ask a potential new boss?

Imagine you were working as a software developer. Imagine that the manager of your team leaves and your company is looking for a replacement. Imagine that as part of the hiring process you had the opportunity to talk with him. You are not the only person doing an interview, and while it is not ultimately your decision whether or not to hire him, you do have an influence. What questions would you ask? What would you talk with him about?


Why does Java's Collection.size() return an int? This limits the size of collections to just over 2 billion entries. With the rapidly increasing amounts of memory available to us, this seems a little short-sighted - no?


"Is" prefix and "On" suffix as reasonable exceptions to a "non-hungarian" naming standard?

First, I believe I've seen this question discussed here before, but I cannot find it. My apologies if you do find it. I'm starting a new project, and trying to figure out why IsResolved and/or ResolvedOn make more sense to me than Resolved. Obviously, when something is named "CompanyName" (for example), I'm fairly confident I'll test it as a string. However, when I see "Resolved", and I know the object it describes may not have a valid value for a resolution date, it bothers me that I have to inspect the type to determine how to test it: for undefined/null/etc. (as a date), or as a boolean value. Is it reasonable to claim that Is and On typically do more than declare the variable type; they declare the intent? Or perhaps simply that it makes the code clearer for some other reason I'm not quite able to codify? Arguing the other side, if I look at the type of Resolved, and see that it is a boolean, I will have my answer. Perhaps this is no different than knowing that I'll need to inspect a "Feasibility" variable to determine if it is an int, enum, or something else. (Although perhaps just that means "Feasbility" would be a sub-optimal name also.) And regardless, in the case of "ResolvedOn", I still have to inspect whether it is nullable to determine if I additionally need to inspect an "IsResolved" value. What is the point of the verbosity, encoding a second time in the variable name that which can be deduced from the type? Please give me a hand understanding **why Is[Property] and [Property]On make sense to me** , although Hungarian in general does not. Or, explain why an exception like this wouldn't make sense? Note: I primarily work with SQL, C#, and JavaScript.


How to motivate students for a programming section?

Last year I tried establishing a programming section at my alma mater. We started with a clear document detailing our plans and goals and a solid attendance (around 20 students). I ran into following problems:   * I found it hard to manage such a large team   * the majority of students had little or no programming experience other than `C` starting courses I tried splitting the section into 4 teams of approximately 5 students each, with more experienced programmers at the head of each team. We defined some real world problems to solve to make it more interesting for students and got to work. However, with upcoming exams attendance dwindled and then finally stopped. At the time I felt that the students were not willing to put in the effort to learn something new. Later, I believe that they felt the task was too hard for them, and motivation suffered as a result. My question is therefore: how would you motivate students?


Am I shooting myself in the foot if I use Mercurial for Rails development?

I'm a Rails developer and I prefer Mercurial over Git. However, I know that the Rails community is very pro-Git. So my question is it possible that my choice of version control system would turn back some developers?


Genetic Algorithm - solving a matrix with hard and soft constraints

I'm writing a Genetic Program that I need some advice on for crossover operations. The GP is attempting to find the best solution for a matrix that has hard row constraints and softer column constraints. For a given solution in the population, the rows contain a random combination of object type ids from a fixed set. The GP is trying to find a solution where, after the rows are laid out, if you tally the id's in each column, the number of each type must fall within a recommended range for that id. I wrote a fitness function that allows me to grade the solution on how close it comes to the columns constraints - 100% being all the columns fall within specs. Since fitness is tied to columns it seems logical that the crossover operation should grab columns of two parents to create a candidate offspring. Should a multipoint crossover be a better way to go? My concern is a crossover operation, almost certainly, will break the row contraints. Thanks for any advice.


help in theory regarding prefix_suffix_set

I found this question at codility.com, but I don't understand the question. Can you help me figure out what do they want? I am more interested in the theory than a code. A non-empty zero-indexed array A consisting of N integers is given. A prefix_suffix_set is a pair of indices (P, S) such that 0 ≤ P, S < N and such that:   * every value that occurs in the sequence A[0], A[1], ..., A[P] also occurs in the sequence A[S], A[S + 1], ..., A[N − 1],   * every value that occurs in the sequence A[S], A[S + 1], ..., A[N − 1] also occurs in the sequence A[0], A[1], ..., A[P]. The goal is to calculate the number of prefix_suffix_sets in the array. For example, consider array A such that:   * A[0] = 3   * A[1] = 5   * A[2] = 7   * A[3] = 3   * A[4] = 3   * A[5] = 5 There are exactly fourteen prefix_suffix_sets: (1, 4), (1, 3), (2, 2), (2, 1), (2, 0), (3, 2), (3, 1), (3, 0), (4, 2), (4, 1), (4, 0), (5, 2), (5, 1), (5, 0). Write a function:   * function solution(A); that, given a non-empty zero-indexed array A of N integers, returns the number of prefix_suffix_sets.


Should you use "internal abbreviations" in code comments?

Should you use "internal abbreviations/slang" inside comments, that is, abbreviations and slang people outside the project could have trouble understanding, for instance, using something like `//NYI` instead of `//Not Yet Implemented`? There are advantages of this, such as there is less "code" to type (though you could use autocomplete on the abbreviations) and you can read something like `NYE` faster than something like `Not Yet Implemented`, assuming you are aware of the abbreviation and its (unabbreviated) meaning. Myself, I would be careful with this as long as it is not a project on which I for sure will be the only developer.


What should junior developer expect from their senior team lead

Disclaimer: Opinions expressed are solely my own and do not express the views or opinions of my employer. I work for a small company, in which few people are developers, others are QA/Test and 1 is a Manager. I joined this company 1.5 years ago. 3 senior developers have 8+ years of experience. These are the observations which I made about the team lead. (considering me as a fresher with less experience compared to them in all aspects )   1. They never discuss 1:1 or they never consider the junior suggestion (I agree that it's up to them, whether they accept it or not, at least they should consider an opinion).    2. As senior team leader they can try to refactor the codebase with new technologies ( including the factor of rolling out new technologies is possible and other developer and infrastructure also ready), but these team leader feel less in-secure to work with new technologies, as they are not up to date. (reason I am telling, they don't know what current programming trend, *(such as popular open source projects like modernizr, bootstrap and many others).    3. In our codebase more than 10000+ lines are repeated, so I told them about `DRY: Don't Repeat yourself`. Their reply was : "It is a fascinating article, but never works in practice". I just told them if we do not make it 100% DRY, we can at least use interfaces, but that also was not considered. *(interfaces can be added for new features, not touching the previous codebase, if they are not ready to refactor)    4. All senior developers do maintenance and hot fixing of patches. The rest of the time they just spend on entertainment sites. They are just happy to finish the task.    5. Introducing new technology is bad? *(including factor of feasibility can be done).    6. Manager also least concerned about the things which I am talking about.    7. Junior expects they can learn many things from team lead. *(not by asking help or senior coding for them).  My questions are:   1. Am I too aggressive about the changes which I am proposing?    2. What should I expect from senior dev leads who have 8+ years experience?    3. Am I wrong to expect to learn and gain experience from a company? Update : Why they feel DRY is impractical: because they don't want get involved with OOP concepts. They are happy with repeating tasks. New technologies I am proposing:   1. Usage of Minification of CSS, JS, SPrite images    2. Usage of Interfaces and .net framework 4, generics and many others.   3. Client side libraries such as modernizr, knockout js, bootstrap for responsive,


Who is using the MVVM architecture for large applications?

I am currently working on an LOB application which I am basing on the MVVM architecture. Going by the answers to the questions I'm asking, it seems like there are not that many people building _large_ and/or _complex_ applications in MVVM. Hopefully, there is a number of you who have built such animals. If so, have you found that MVVM scales?


I've been on C# course and struggle to remember things?

I'm an apprentice and I've been on a couple of training courses in C#, I understood the concept of c# programming and covered inheritance etc, but when I've came to code for my coursework "I've got to make a shopping basket and save the contents into a .txt" I just seems to not know what to do, as if I've got no idea how to program. I've got a copy of the end product apart from it's altered so we can't copy it whole, so I've just been taking code and not really understanding everything that's doing on. I just seem as if I don't want to program as if I'm in a different mind set, I just seem to go blank at the thought of creating a simple program from scratch and have no Idea where to start? Any one got any ideas for help ? :) thx


I'm not sure how to add common functionality to my business objects using DTOs/DDD?

I have created a couple of projects to create a better division of my code: I have a Portable Class Library targeting all frameworks that contains just basic DTOs (auto-generated against a database). These DTOs will contain some basic DataAnnotations for the class representing the table. For example:               [DataContract]     public class OrderDetail     {         [DataMember]         public virtual int Id { get; set; }              [DataMember]         [Required]         [StringLength(32)]         public virtual string OrderCode { get; set; }              [DataMember]         public virtual DateTime OrderDate { get; set; }              [DataMember]         public virtual DateTime? ShippedDate { get; set; }     }      * * * Now, the problem I have is that I want to create a "Business Object" and provide common features such as n-level Undo/Redo, marking child objects for deletion, etc. The ways I could think about doing this is as follows: **Option 1** : Inherit the DTO to add the additional members (build out the object graph). I can use partial classes and interfaces and even some AOP to implement the common features. For example:               // OrderDetail.generated.cs: Auto-Generated/T4     public sealed partial class OrderDetail : DTO.OrderDetail, IUndoRedo     {         // Common Features coded here (i.e. n-level Undo/Redo)     }          // OrderDetail.cs: Custom Code     [DataContract]     public sealed partial class OrderDetail     {         [DataMember]         [Required]         public Address ShippingAddress { get; set; }              [DataMember]         [Required]         [Cardinality(1, Cardinality.Infinity)]         public ICollection<ProductDetail> Products { get; set; }     }      Now, the problem with this is that every single Auto-Generated business object extension of each DTO (`OrderDetail`, `Address`, `ProductDetail`, etc.) needs to have the common business features available (i.e. n-level Undo/Redo), but they can't inherit from some sort of `BusinessBase` class because they inherit from the DTO. **Option 2** : Inherit each business object from a `BusinessBase` abstract class which already has common features built into it. Then, simply wrap the DTO properties and re-expose them?               [DataContract]     public abstract class BusinessBase : IUndoRedo     {         // Common Features coded here (i.e. n-level Undo/Redo)     }          [DataContract]     public sealed class OrderDetail : BusinessBase     {         // Wrapped Properties         private Dto.OrderDetail Dto { get; set; }              [DataMember]         [Required]         [StringLength(32)]         public string OrderCode         {             get { return Dto.OrderCode; }             set { Dto.OrderCode = value; }         }              // etc ...              // Custom properties (Object-Graph)         [DataMember]         [Required]         public Address ShippingAddress { get; set; }     }      The problem with this is all the wrapped up DTOs, and it lacks inheritance, so the "Business" version of OrderDetail isn't a type of DTO OrderDetail, and the wrapped properties can get redundant. I'm really stuck as to what should be done here, is one option better, or maybe some other way of doing this that wasn't accounted for (Option 3, 4, 5, etc.)?


How to visualize the design of a program in order to communicate it to others

I am (re-)designing some packages for R, and I am currently working out the necessary functions, objects, both internal and for the interface with the user. I have documented the individual functions and objects. So I have the description of all the little parts. Now I need to give an overview of how the parts fit together. The scheme of the motor so to say. I've started with making some flowchart-like graphs in Visio, but that quickly became a clumsy and useless collection of boxes, arrrows and-what-not. So hence the question:   * Is there specific software you can use for vizualizing the design of your program   * If so, care to share some tips on how to do this most efficiently   * If not, how do other designers create the scheme of their programs and communicate that to others? * * * Edit: I am NOT asking how to explain complex processes to somebody, nor asking how to illustrate programming logic. I am asking how to **communicate** the **design** of a program/package, i.e.:   * the objects (with key features and representation if possible)   * the related functions (with arguments and function if possible)   * the interrelation between the functions at the interface and the internal functions (I'm talking about an extension package for a scripting language, keep that in mind) So something like this : ![enter image description here](http://i.stack.imgur.com/pohJ4.png) But better. This is (part of) the interrelations between functions in the old package that I'm now redesigning for obvious reasons :-) PS : I made that graph myself, using code extraction tools on the source and feeding the interrelation matrix to yEd Graph Editor.


How to learn to translate real world problems to code?

I'm kind of a beginner to Java and OOP and I didn't quite get the whole concept of seeing a real world problem and translating it to classes and code. For example, I was reading a book on UML and at the beginning the author takes the example of a tic tac toe game and says: "In this example, it's natural to see three classes: Board, Player and Position." Then, he creates the methods in each class and explains how they relate. What I can't understand is how he thought all this. So, where should I start to learn how to see a real world problem and then "translate" it into code?


Learning MVC - Why does home and about share the same controller?

Let me start this out by saying I've been a asp.net web forms developer for a while now and that I understand mvc is a new way of doing things. As I'm learning mvc and going through tutorials and training videos, I have questions that these tutorials don't address. This is my attempt to address them here... I started a new project with the new internet application template in Visual Studio. I'm looking around the project trying to wrap my head around the mvc paradigm and I notice there is a Home and an About page. In the views, there is a file for each of these two pages. That makes sense. But why do they share the same controller? I think it would make sense if I had several screens that edit/view/delete the same data table, but the home and the about page don't necessarily have anything to do with each other. Does this mean if I create other pages that don't need a full blown controller (like a sitemap or something), I should just stick their views in the "Home" views folder? It just doesn't seem right. I know this basic stuff isn't that big of a deal, but this is the type of stuff that bugs the hell out of me. Thanks in advance for the clarification!


How to become a "faster" programmer?

My last job evaluation included just one weak point: timeliness. I'm already aware of some things I can do to improve this but what I'm looking for are some more. Does anyone have tips or advice on what they do to increase the speed of their output without sacrificing its quality? How do you estimate timelines and stick to them? What do you do to get more done in shorter time periods? Any feedback is greatly appreciated, thanks,


What are unique aspects of a software Lifecycle of an attack/tool on a software vulnerability?

At my local university, there is a small student computing club of about 20 students. The club has several small teams with specific areas of focus, such as mobile development, robotics, game development, and hacking / security. I am introducing some basic agile development concepts to a couple of the teams, such as user stories, estimating complexity of tasks, and continuous integration for version control and automated builds/testing. I am familiar with some basic development life-cycles, such as waterfall, spiral, RUP, agile, etc., but I am wondering if there is such a thing as a software development life-cycle for hacking / breaching security. Surely, hackers are writing computer code, but what is the life-cycle of that code? I don't think that they would be too concerned with maintenance, as once the breach has been found and patched, the code that exploited that breach is useless. I imagine the life-cycle would be something like:   1. Find gap in security   2. Exploit gap in security   3. Procure payload   4. Utilize payload **What kind of differences (if any) are there for the development life-cycle of software when the purpose of the product is to breach security?**


What is easier to do with web applications compared to native GUI applications?

I have the impression that more and more applications with a user interface use HTML+CSS+JavaScript client-side instead of a native GUI framework. I wounder what are the most important driving forces for this? or in other words what are native GUI frameworks lacking to be competitive? e.g. is it easier to do some kind of things with HTML+CSS+JavaScript than with native GUI frameworks. If we suppose the application is a client-server application where the client has a graphical user interface. **What is the most important things that are easier to do in HTML+CSS+JavaScript than in the most popular native GUI frameworks?**


Doing work in vector's push back

I often use the following syntax:               std::vector<foo> vec;     vec.push_back( someClass.getFoo(...).modifyAndReturn() );      Considered about exception safety, I quote the standard on vector's push back behavior (23.3.7.5): > If an exception is thrown other than by the copy constructor, move > constructor, assignment operator, or move assignment operator of T or by any > InputIterator operation there are no effects. If an exception is thrown by > the move constructor of a non-CopyInsertable T, the effects are unspecified.   * Is it a good practice to use complicated push backs?   * Are there any perils exception wise?


Validation and Authorisation in Domain Models and Carrying that through a Service Layer to MVC

With the current project I'm working on there's an architecture question being asked which feels like it might just be asking too much. System Basics:   * HTML/JS MVVM   * Asp.net MVC   * Web Services   * EF   * SQL 2012 The Web Services deal with DTOs passed back and forth either to the presentation layer (MVC or mobile app) or to various other external services. The **big question** at the moment is whether it's possible to somehow define our **DTOs** in such a way as to **include** all **Validation and Authorisation rules**. This then needs to be carried into, for example, our MVC presentation layer or View Models. The idea here is that we'll end up with 1) Validation rules on the ViewModel which then plug into the MVC framework 2) Only fields that the user is allowed to edit should be shown as editable. Some have mentioned Fluent or other mechanisms that will consist of an extra definition class somewhere used define these rules, then during compilation code may be injected into various view model classes or base view model classes are generated which one can inherit from. The overall objective is to keep validation and 'data authorisation' (can user X edit fields 1, 2 and 3 based on their permissions/roles) rules in one place. Is this stretching it, or is it possible?


What is the underlying mechanism behind va_list and where is it defined?

http://www.cplusplus.com/reference/cstdarg/va_list/ According to the above link, `va_list` is an argument or parameter used in some macros - `va_start`, `va_arg`, `va_end`. These macros are present in the `stdarg.h` file. I know that `va_list` can hold multiple values but what kind of an entity is `va_list`? My question is what is the underlying mechanism behind `va_list`? How is it able to hold multiple values? (For example, an array can hold multiple values and the mechanism behind it is multiple memory locations referenced by subscript values. Array is a predefined data structure present in C.) My second question is where is `va_list` defined?


Is it better to use a switch statement or database to look through 5,000 to 10,000 instances?

I have some JSON data in this format (5,000 instances for now):               {"id":"123456","icon":"icon.png","caseName":"name of case"}      I am allowing the user to search for the name of the case and then return the id and icon to them, and in some situations, **use** the case id to run other functions, based on the search. How should I read this data? I'm currently leaning towards a switch because I want the switch to allow me to define multiple cases giving me the same result:               name of case and name-of-case should return me the id 123456      I can easily use a switch based on the string, listing out different cases, to do this. Probably going to be extremely tedious, but it's an option. So, my options I can think of are as follows:   1. Run a massive switch based on the query string (probably in a separate PHP file)   2. Store this result in a MySQL database, then based on the query string, retrieve the data, and I probably need to do indexing (which I understand, but have no idea how to implement). Also, I would like to prepare for the scenario that this 5,000 instances increases to 10,000 instances at some point in time. What's the best way of going about this? Thanks.


Unit test JSON parsing code?

In my humble view of unit testing a unit test tests a single unit of code. For me, this means a single class. Every dependency for that class is mocked in the corresponding test class, and passed in the constructor (or injected via a DI container). This allows you to test the class in complete isolation from the rest of the system. I take this as the gospel truth of what a unit test is supposed to be. If you are testing multiple _real_ classes (more than one class in your test class is not a mock) then you don't have a unit test, you have an integration test. Given this point of view, there are things that _seem_ to fall outside of the realm of unit testing even though it seems as if you are testing a single class. One of these types of tests is data parsing tests. For example, given a data class:               public class Person {       private Name name;       private PhoneNumber phoneNumber;       private Address address;     }      a purported unit test then attempts to validate correct parsing:               @Test     public void shouldParsePerson() {         String json = "{ the json would be here }";         Person person = new Gson().fromJson(json, Person.class);              assertThat(person.getName().getFirst()).isEqualTo("Jim");         // more assertions based on what the JSON was would be here     }      What is this really testing? For me, it appears to be testing that Gson works. The test is tightly coupled to both the structure of the JSON and the class in Java that it maps to. Is the test really worth writing? Is it worth maintaining? Is it useful? Wouldn't an integration test somewhere else that relies on the parsing code catch this anyways? There is another question here that is related to my question, but it is actually different because it is asking **how** to unit test consumers of an API that wraps third parts classes, while I'm asking what constitutes a valid _unit_ test that involves a third party class. My question is more philosophical in nature, while the other is more practical. My question could also be extended to things like testing configuration code which isn't necessarily involving third party classes.


OpenGL's relationship to OpenGL ES (3.0)

I'm beginning my journey into graphics programming and want to learn OpenGL. Because I'm green to graphics programming but not to C and C++, a familiar question came up when I looked at OpenGL and ES... Is OpenGL a superset of OpenGL ES? I read in an ES 3.0 guide that it uses shader-based implementations that exist as part of OpenGL's embedded libraries, and that ES avoids using similar/redundant libraries provided by big 'ol OpenGL due to mobile hardware limitations... Are shader-based implementations which are a huge part of OpenGL ES less efficient solutions when programming on the desktop? OR should I look at the two APIs as different beasts altogether? thx in advance.


How does the product owner decide how successful a Sprint was?

Obviously if the product owner judges solely based on whether the committed stories were done, it wouldn't be good, because then the team will just commit to fewer stories next Sprint. On the other hand if the team made a tremendous job and overcame huge technical problems, but the commitments were not met, its also not good. I think that some measure is needed though, because if there is no feedback from the product owner, the team doesn't know what to improve, if at all. So what, in your opinion, are the criteria for the success of the Sprint?


Why did Facebook use C++ beside PHP?

What is the main reason that made Facebook need to use C++ beside PHP? I am wondering if I make a website with alot of vistors would I need to use C++ as well?


How to include database changes during application publish

I am maintaining a WinForms application, which talks to a SQL Server database. Sometimes I have to change database schema (for example to alter a sql procedure or add new one). For this purpose I have a SchemaChange.sql file, where I put the corresponding sql code. When I create an installer for my project, the msi package is created. It contains my application, referenced assemblies, COM+ assemblies,... Alongside the msi package I provide an SchemaChange.sql file, which has to be run on the production sql server. But sometimes I forget to add something to SchemaChange.sql file during development or I forget to execute it on production server after upgrading my application on client machines. Any advice how to automate this to avoid further problems?


Where are null values stored, or are they stored at all?

I want to learn about null values or null references. For example I have a class called Apple and I created an instance of it.               Apple myApple = new Apple("yummy"); // The data is stored in memory      Then I ate that apple and now it needs to be null, so I set it as null.               myApple = null;      After this call, I forgot that I ate it and now want to check.               bool isEaten = (myApple == null);      With this call, where is myApple referencing? Is null a special pointer value? If so, if I have 1000 null objects, do they occupy 1000 object memory space or 1000 int memory space if we think a pointer type as int?


Addressable memory unit

From Wikipedia: > the term endian or endianness refers to the ordering of individually > **addressable** sub-components within a longer data item as stored in > external memory (or, sometimes, as sent on a serial connection). These sub- > components are typically **16- or 32-bit words, 8-bit bytes, or even bits**. I was wondering what "addressable" means? For example, in C, the smallest addressable is a byte/char. How can a bit be addressable? Thanks and regards!


Developers Terms and Conditions

I've recently been approached to do some development work for a start up. The fellow has requested my terms and conditions. Being new to the industry, what sort of information would/should I include in this? Obviously pay rate and maybe information about ownership of Intellectual Property perhaps. Is there anything I'm missing?


What is a good intro to cloud-computing architecture?

Awhile ago I tried reading about Google App Engine, from its site and from the Wikipedia article. What I realized was that not only did I not understand what it did, I didn't even know what problem it was solving. I am a competent programmer in a variety of languages, but I have little experience with large frameworks. Is there a book/site that explains cloud computing in a way similar to how "Programming with POSIX Threads" explains threading, ie identifying specific problems and the mechanics of how they are solved, from a programmer's perspective? I tend to be a low-level bits-bytes-and-memory-addresses sort of person, so abstract explanations of the architecture tend to give me a giddy and uneasy feeling. I suppose cloud computing can't be understood at the byte-level, but the lower down it is the better I'll understand it.


For what purpose I can use c++ to increase my skills?

I want to learn new things. Initially I was a PHP programmer. Then I thought it was not enough. Then I started learning Java thing. It took me 3 months to learn. Java, J2EE, Spring, Hibernte, Spring Security, Spring Roo and many design patterns MVC and stuff like AOP, DI . I never knew that before but I got the idea what J2EE. After 3 months, I just made a simple page with Registration form integrated with Spring Security. I wanted to make one complete project in it but that was too much for me and I didn't want spend more time on it as then i need to host that as well so I left that. Then I started learning Python and made few sys admin scripts and then Django and now I am finishing a complete web app in Python. Now I want to learn C++, but before that I need to find out what i can do with it. Just like I know Python is very useful because I have my own servers so I can write scripting and websites so Python is good for me. But I am confused in which areas C++ can help me. I don't want to end up like I have with Java where either I have big projects or nothing for day to day use.


Tips to succeed in a new job for my situation

Here is my situation:   * I am switching to a new company in a new city as an engineer [code, test, performance etc].   * I was not particularly successful in my previous role [at least not as per my immediate manager] and finally decided to quit on good terms.    * The new job is exciting [I haven't started it yet]. I am the first engineer for this new team and there is no existing code for what I would be working on, except an old prototype.    * I have to work closely with sister teams to bootstrap my product.    * I am due for a performance review within 5 months. I will have to take a few weeks vacation toward the end of it. I am a little anxious about this since I think 5 months isn't much time for me to bootstrap and show some early successes.   * I am working in a new space I am not familiar with though the stack is mostly Java, Apache, etc. which I am more comfortable than other stacks out there.  I am currently reading _First 90 Days_ though it is a bit more focused on leadership rather than engineers. I am an engineer and not manager though would like to move to leadership roles future in my career. Thanks for your input and I will add more details if someone requests.


how to start fixing bugs in open source softwares

I a student and have good knowledge in C programming and like to contribute any open source project which is developed in C. I searched sourceforge and selected 7-Zip because its widely used one and developed using C. I thought to start first by fixing bugs (which was suggested by many people in their websites) and gone through few bugs but couldn't understand how to respond to them and how to start fixing them.. I didn't understand anything. Could you please explain how to approach this.. I have even gone through some files in the source code which I downloaded but didn't understood anything. Please help me!


How do you update copyright notices?

So now it's 2011, and as I carry on coding on our active projects it's time to update some copyright notices. eg. Copyright Widgets Ltd 2010 to Copyright Widgets Ltd 2010, 2011 My question is when do you update the copyright notices?   * Do you change the notice in the head of a file the first time you work on that file?    * Since a module is one piece of code consisting of many files that work together, do you update all notices in that module when you change a single file in that module?    * Since a program is one piece of code (maybe consisting of many modules), do you update all notices in that program when you change a single file in that program?    * Or do you just go through and change en-mass over your morning coffee on the grounds your about to start programming and updateing things?


Why Bootstrap 3 changes camelCase to dashes - is it more readable?

I'm wondering what's the reasoning behind Bootstrap's decision to change all camel case names into hyphenated names in v3.0. I searched on Google, and looked in a few books, but I can only find opinions one way or the other - no hard data. Are there any studies that suggest camel case variable names are more readable than dashes, or is this just a matter of personal preference?


Gap year in a computer science course

Due to circumstances outside of my control, I might have to take a gap year from my computer science course at university. The trouble is that due to other circumstances, for example, living in the middle of nowhere, and even entry-level programming jobs requiring a completed degree, there's a realistically zero prospect of getting a job in this period. What else can I do to significantly progress my career or education in this time frame?


What is Business systems exposure?

I saw this job adverted for db admin and one of the things they are looking is for someone who can demostrate in business systems exposure. What does Business systems exposure mean? Have I selected the right tag? Thanks


Java - multirow array

Here is my situation: a company has x number of employees and x number of machines. When someone is sick, the program have to give the best possible solution of people on the machines. But the employees can't work on every machine. I need a code for making little groups of possible solutions. this is a static example private int[][] arrayCompetenties={{0,0,1,0,1},{1,0,1,0,1},{1,1,0,0,1},{1,1,1,1,1},{0,0,0,0,1}}; => row is for the people and columns are for machines                   m1  m2  m3  m4  m5  m6  m7     p1  1               1            p2      1   1   1   1            p3          1       1       1     p4      1       1       1        p5  1       1       1       1     p6              1   1   1   1     p7  1       1   1   1   1   1      my question => with what code do i connect all the people to machine in groups (all the posibilities) like: p1 -> m1 , p2->m2 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6 p1 -> m1 , p2->m3 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6 p1 -> m1 , p2->m4 , p3 -> m5 , p4->m4 , p5 -> m5 , p6->m6 p1 -> m1 , p2->m5 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6 p1 -> m1 , p2->m2 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6 .... i need a loop buth how? =D thanks!


Differences between symfony 2 and 1?

I'm starting symfony and interested in learning where symfony is coming from. In terms of it's architectural challenges. What are the architectural or philosophical differences between symfony 2 and 1? What changes make it so different from the other point version?


How much does a progammer giving a free service make from donations?

I know this is long-shot question but if there's anyone making money from donations, would you share how much you're making from which service/website?


Is there a way to dispute or challenge poor iPhone app reviews?

Problem: user has left review of iPhone app which is simply incorrect Question: is there a way to make contact with the reviewer and a) explain how what they've said is incorrect and help them with their issue or b) challenge the review?


How does a binary delta update work?

Both Android and iOS seem to support their application having a binary delta update. But how does it work? I build a binary program, neither of the distribution sites have the source code - how does the update process know what is changed?


Is there a formula for this?

TL/DR: Any way to work out if known numbers between a known start and ending figure should be positive or negative numbers? I am developing an application in PHP which can import and read PDFs. The PDFs are financial ones such as bank statements with records of transactions in and out of a bank account. I only have PDFs to work with, no other formats such as CSV unfortunately. I convert the PDF to HTML using pdftohtml and start parsing the data, the intended end result is an array of transactions. So far I have it working smoothly collecting dates, descriptions and balance. Converting the XML instead doesn't help. There are other pieces of transcriptional data such as debit or credit amounts. In the PDF, the credit amount is in one column and the debit amount is in another column so it is quite clear in the PDF. However, when converted to HTML, the formatting is lost and therefor I don't know if the amount was a credit or debit amount. So, my question is, given a starting balance and an ending balance and several known figures in between, is it possible for a programme to work out if those known figures in between are credit or debit amounts? I imagine there could potentially be several combinations of those known values to reach the ending balance so I'd like to apply a formula to return the correct credit/debit sequence only if its the only possible solution. If there are several ways of adding/subtracting the known values to reach the end balance, I can ask the user to look at it manually but I'd like to keep this to a minimum if possible. Possible to do, do you think? Thank you in advance for any help.


Should I use a root namespace?

I'm currently working on a couple projects in Flash ActionScript, and I've been building up a small library of classes. I've been using a naming convention similar to: `foo.events.Bar` and `foo.controls.Baz`, but I've noticed that many people have released their libraries in the `com` and `org` package/namespace (i.e. `com.foo.events.Bar` and `com.foo.controls.Baz`). I assume the meaning of `com` is `common` or `community`, and that `org` is `organization`. Is there a particular reason to adding an _additional_ namespace? Is this common for namespaced languages (Java, C#, AS3,...)?


Maintenance wise, is `else while` without intervening braces considered safe?

Is `else while` without intervening braces considered "safe" maintenance wise? Writing `if-else` code without braces like below...               if (blah)         foo();     else         bar();      ...carries a risk because the lack of braces make it very easy to change the meaning of the code inadvertently. However, is below also risky?               if (blah)     {         ...     }     else while (!bloop())     {         bar();     }      Or is `else while` without intervening braces considered "safe"?


How do I document a communication protocol on top of message queues and channels?

I'm working on a large project at the moment and I'm trying to document the communication protocol that sits on top of a message queue middleware. The documentation is intended for another organisation that is going to be implementing a new back end to the client. The messages format uses protocol buffers, so I'm less interested in describing the wire format. I'm interested in documenting the interactions between the service and client. A typical interaction might be something like:   1. Client subscribes to Channel1   2. Client pushes RequestForStream to Queue1   3. Service reads from Queue1 publishes StreamResponse (containing endpoint to subscribe to, Channel2) to Channel1 and if successful starts publishing notifications to Channel2   4. Client receives from Channel1 and subscribes to Channel2   5. More stuff... How can I best document scenarios like this? Does anyone know of any examples of documented interactions with Queues and channels? Edit: I am not writing a Message Queue. I am using a JMS-like middleware named Nirvana. I want to document the application built on top of the Message Queue system. Edit 2: In UML how would I model a Queue or Channel? Would I show them on a sequence diagram?


Why don't software libraries solve all our problems?

Modular programming and reusable software routines have been around since the early 1960's, if not earlier. **They exist in every programming language.** Conceptually, a software library is a list of programs, each with its own interface (entry points, exit points, function signatures) and state (if applicable). Libraries can be high quality because modules are focused on solving narrow problems, have well-defined interfaces, and the cost can be amortized across all future software programs that will ever use them. Libraries are purely additive: adding new modules does not introduce bugs or limitations in existing modules. So why don't software libraries solve all our problems? Why can't we write software as merely a composition of high-quality software modules? Can we fix these problems with software libraries and unleash the full potential of this incredibly powerful mechanism for writing high-quality programs faster? Or are these problems intrinsic to libraries and can never be solved? _Note: Several comments said that I have too many questions. Please treat the above questions as the real questions and everything that follows as points for discussion._ It is true that software libraries are widely used. Some programming languages such as C, Java and Python have enormous software libraries. But there are numerous problems.   1. Some well-known languages have less than ideal library support (e.g. C++, Lisp). To some extent this is mitigated by piggybacking on a virtual machine platform (e.g. JVM, CLR). A corollary question, should all future software be written for a virtual machine platform to increase library support? This is problematic for scripts that don't want to incur the cost of launching a virtual machine every time.   2. There is a lot of "reinventing the wheel". Have you ever written a linked-list module in C? Yes, of course you have. I don't enjoy writing linked lists in C, but what is the alternative?   3. Can a given library (e.g. libfoo-0.1.2) be trusted as as a basis to write your important software? Is the library tested, documented, and does it implement the features you need? How can you tell?   4. Learning a library's API can be as time consuming as learning a whole new programming language.   5. If a bug is discovered in a library, what is the proper procedure for fixing the bug in your software? How should the bugfix be distributed to all library users?   6. How should libraries be built and distributed? (For example, autotools obviously got it wrong.) Semantic Versioning is good, but how can this be verified and enforced?   7. How should library dependencies be handled? Can we download and install automatically? Will the versions and licenses be compatible?   8. Is the license for a given library compatible with your software? How can you tell?   9. What should you do if the library is abandoned before starting your software? What about after starting your software?


Nested CSS styles ~ Where have I seen this concept before?

I can't find this now but I've read it before on various blogs discussing the topic. I'll give an example and hopefully it's clear (albeit it may not clarify anything at all). Given this piece of markup (arbitrary on purpose):

      While the CSS could read like this:               .myWrapper .img img {border: thin black solid;}     .myWrapper .img {margin:10px;}     .yourWrapper .img img {border: thick red dashed;}     .yourWrapper .img {margin:20px;}      It could also be written like this:               .myWrapper {       .img {          margin:10px;         img {             border: thin black solid;         }       }     }     .yourWrapper {       .img {          margin:10px;         img {             border: thick red dashed;         }       }     }      But I can't remember seeing where that was discussed or if it's something in the works. Anybody know what the hell I'm talking about? And I don't think this is an SO question or I would've put it on SO.


Build Process for Web Application

I have a web application with lots of Javascipt and CSS code. I want to minify the CSS and JS code using something like UglifyJS. However, I don't want to program with the minified code and I want my team to checkout only the non-minified code. What's the most common way of doing this? I guess you would push both the minified and non-minified code and have the code reference only minified files. Do most people create a file call BUILD that runs all JS/CSS files through the minifier? Programmers would then have to run the BUILD script before pushing right?


Why did Golang discontinue the "netchan" package?

The Golang "netchan" package seems to have been discontinued. That makes me think that the concept of "networked channels" were not a good practice after all. (Why wouldn't them just "let it be" otherwise?) Is this the case? And if it is, why is that?


People's experience of Cloud Computing (using Force.com)

I would like to know about people's experience of working with APEX and the SalesForce.com platform, was it easy to work with? How similar to Java and C# is it? What did you like? What don't you like? Would you recommend it? Do you think cloud computing has a long term successful future? My reason for asking is that I am currently looking at a new position which involves working with APEX on the SalesForce.com platform. The position interests me but I just want to try and understand what I might be signing up for with regards the languages/platform as it is completely different from what I have worked with before. I have seen lots of videos/blog posts online (mainly from the recent Dreamforce event) and they obviously are very positive but I was just after some experiences from developers, both positive and negative. I find cloud computing a very interesting idea, but I am very new to the subject. The position I am looking at offers a fantastic opportunity but I was just after some opinions on APEX and the platform as I have no real world experience just what I have seen from the online videos. I guess ultimately what I am asking is:   * Are APEX and the SalesForce.com platform good to get involved in? **Is development on the Force.com just a "career dead end"?**   * Is cloud computing just a fad? Or does it have a long term future? Apologies in advance if this is the wrong place to ask such a question. Thanks


Is Tracking Software Usage Illegal?

Let's say if I am doing desktop application, and I am interested to know whether our software really gets used or not. Is it alright to insert in code that tracks whether our software is used, for how long and so on? Note that no person-identifiable information will be collected, all I am interested to know is how frequent and for how long the software is used. The information will be sent to our server for diagnosis. What do you think?


Online courses focussed on learning LISP for beginners?

I'm looking for an online course that I can use to learn programming using Lisp (especially Scheme), from scratch. I didn't find anything similar on Coursera/Udacity - the only resource I found was on MIT Openware, but I'm not sure if its something that is tailored for an online audience, and also the fact that the lectures are based on the first edition which is not the one I have... I'm not looking for explicit video lectures - a set of good lecture notes, with exercises/assignments and if possible, an exam at the end would be great to get me started!


Can someone provide a short code example of compiler bootstrapping?

This Turing award lecture by Ken Thompson on topic "Reflections on Trusting Trust" gives good insight about how C compiler was made in C itself. Though I understand the crux, it still hasn't sunk in. So ultimately, once the compiler is written to do lexical analysis, parse trees, syntax analysis, byte code generation etc, a separate machine code is again written to do all that on compiler? Can anyone please explain with a small example of the procedure? Bootstrapping on wiki gives good insights, but only a rough view on it. PS: I am aware of the duplicates on the site, but found them to be an overview which I am already aware


Is there a design pattern that would apply to discount models?

Are there any known design patterns for implementing discount models? By discount models, I mean the following:   1. If a customer buys Product X, Product Y and Product Z he gets a discount of 10% or $100.    2. If a customer buys 100 units of Product X, he gets a discount of 15% or $500   3. If a customer has brought in the last year more than $100K, he gets a flat 20% discount   4. If a customer has purchased 2 units of Product X, he gets 1 unit of Product X (or Product Y) free.    5. ... Is there a generic pattern that can be applied to handle all of the above scenarios? I am thinking of a few models, but unable to come across a generic one.


Examples of permission-based authorization systems in .Net?

I'm trying to figure out how to do roles/permissions in our application, and I am wondering if anyone knows of a good place to get a list of different permission-based authorization systems (preferably with code samples) and perhaps a list of pros/cons for each method. I've seen examples using simple dictionaries, custom attributes, claims-based authorization, and custom frameworks, but I can't find a simple explanation of when to use one over another and what the pros/cons are to using each method. (I'm sure there's other ways than the ones I've listed....) I have never done anything complex with permissions/authorization before, so all of this seems a little overwhelming to me and I'm having trouble figuring out what what is useful information that I can use and what isn't. What I DO know is that this is for a Windows environment using C#/WPF and WCF services. Some permission checks are done on the WCF service and some on the client. Some are business rules, some are authorization checks, and others are UI-related (such as what forms a user can see). They can be very generic like boolean or numeric values, or they can be more complex such as a range of values or a list of database items to be checked/unchecked. Permissions can be set on the group-level, user-level, branch-level, or a custom level, so I do not want to use role-based authorization. Users can be in multiple groups, and users with the appropriate authorization are in charge of creating/maintaining these groups. It is not uncommon for new groups to be created, so they can't be hard-coded.


Moving away from .Net to Ruby and coping without intellisense

I am in the process of trying to learn Ruby, however after spending nearly 10 years in the MS stack I am struggling to get by without intellisense. I've given RubyMine a try which does help however ideally I would like to go free which would mean no RubyMine. How have other people learnt to cope with remembering everything instead of relying on Ctrl-Space? Any advice is appreciated at the moment as I am feeling very stupid (no jokes about MS devs please ;))


Interview questions for programming tutor?

My family is looking for a programming/computer science tutor. Personally, I want to learn Java or some other brand of web programming. I am best described as a PC "power user." I have never programmed in the past and would like a good jump start. I am a very quick learner and do not expect the tutor to have to teach me the ultra basic stuff that I can learn myself. My son also needs a programming tutor. He just got into Carnegie Mellon as a computer science major. Having done only robotics and mathematics in the past he is very nervous that he does not have the same level of knowledge as his future classmates. I need some help coming up with a list of questions to ask potential tutors and some criteria to judge them by. Thanks! Edit: So far I have come up with just the obvious... >   1. Where did you receive your education? >   2. What languages are you familiar with? >   3. How long have you been tutoring? >   4. What made you decide to become a tutor? >   5. What software projects have you worked on? >   6. What work references can you give me? >   7. How much do you charge? >


Designing web-based plugin systems correctly so they don't waste as many resources?

Many CMS systems which rely on third parties for much of their code often build "plugin" or "hooks" systems to make it easy for developers to modify the codebase's actions without editing the core files. This usually means an **Observer** or **Event** design pattern. However, when you look at systems like wordpress you see that on every page they load some kind of _bootstrap_ file from each of the plugin's folders to see if that plugin will need to run that request. Its this poor design that causes systems like wordpress to spend many extra MB's of memory loading and parsing unneeded items each page. **Are there alternative ways to do this? I'm looking for ideas in building my own.** For example, Is there a way to load all this once and then cache the results so that your system knows how to lazy-load plugins? In other words, the system loads a configuration file that specifies all the events that plugin wishes to tie into and then saves it for future requests? If that also performs poorly, then perhaps there is a special file-structure that could be used to make educated guesses about when certain plugins are unneeded to fullfil the request. Any ideas? If anyone wants an example of the "plugin" concept you can find one here.


SVN: Working with branches using the same working copy

We've just moved to SVN from CVS. We have a small team and everyone checks in code on the trunk and we have never ever used branches for development. We each have directories on a remote dev server with the codebase checked out. Each developer works on their own sandbox with an associated URL to pull up the app in a browser (something like the setup here: Trade-offs of local vs remote development workflows for a web development team). I've decided that for my current project, I'll use a branch because it would span multiple releases. I've already cut a branch out, but I am using the same directory as the one originally checked out (i.e. for the trunk). Since it's the same directory (or working copy) for both the branch and the trunk, if for e.g. a bug pops up in the app I switch to the trunk and commit the change there, and then switch back to my branch for my project development. My questions are:   * Is this a sane way to work with branches?    * Are there any pitfalls that I need to be aware of?    * What would be the optimal way to work with branches if separate working copies are out of the question?  I haven't had issues yet as I have just started doing this way but all the tutorials/books/blog posts I have seen about branching with SVN imply working with different working copies (or perhaps I haven't come across an explanation of mixed working copies in plain English). I just don't want to be sorry three months down the road when its time to integrate the branch back to the trunk.


Poltergeist and factories

I've just come across the Poltergeist anti-pattern \- and maybe it's because the morning coffee hasn't kicked in yet, but I read the description: > a poltergeist (or gypsy wagon) is a short-lived, typically stateless object > used to perform initialization or to invoke methods in another, more > permanent class. and thought that this sounds a lot like some implementations of Factory that I've seen (and written myself) - particularly in web development where a Factory might only be used once per request. Unfortunately, the wiki article is fairly superficial. Could someone explain a bit more about how a Factory should be implemented, and also why a Poltergeist is an anti-pattern.


How to completely decouple Model from View/Controller in Java Swing

Is there a collection of commonly-agreed-upon design guidelines for separating the Model classes from the View/Controller classes in a Java Swing app? I'm not so concerned that the View/Controller know nothing about the Model as the other way around: I'd like to design my Model to have no knowledge of anything in javax.swing. Ideally it should have a simple API enabling it to be driven by something as primitive as a CLI. It should be, loosely speaking, an "engine." Communicating GUI events to the model isn't too hard -- the Action Performers can call the model's API. But what about when the model makes its own state changes that need to be reflected back to the GUI? That's what "listening" is for, but even "being listened to" is not entirely passive; it requires that the model know about adding a listener. The particular problem that got me thinking involves a queue of Files. On the GUI side there's a `DefaultListModel` behind a `JList`, and there's some GUI stuff to choose files from the file system and add them to the JList. On the Model side, it wants to pull the files off the bottom of this "queue" (causing them to disappear from the JList) and process them in some way. In fact, the Model code is already written -- it currently maintains an `ArrayList<File>` and exposes a public `add(File)` method. But I'm at a loss as to how to get my Model working with the View/Controller without some heavy, Swing-specific modifications to the Model. I'm very new to both Java and GUI programming, having always done "batch" and "back-end" programming up to now -- hence my interest in maintaining a strict division between model and UI, if it's possible and if it can be taught.


Constants vs public properties for configuration

My application has a few high level configuration options such as directories which will be used for various things, database connection information and a few other settings which are required for the application to run. I'm debating with myself whether or not constants are better than variables for this purpose and would like some input. By having:                $config = new Config;      new Whatever($config->foo, $config->bar);      Instead of:               new Whatever(Config::FOO, Config::BAR);      I get the power of polymorphism, I can quickly swap between configuration settings by instantiating $config as a different class with the same class members. There's obviously a trade-off here. Anything which needs the config options must instantiate a $config object, using memory and creating extra code as well as making it so the config options are no long immutable. The immutability problem could by solved with a method e.g. $config->get('Foo'); so that is potentially a non-issue, although it does add to verbosity and a method call is more expensive than reading a constant or variable.


Is this proper OO design for C++?

I recently took a software processes course and this is my first time attempting OO design on my own. I am trying to follow OO design principles and C++ conventions. I attempted and gave up on MVC for this application, but I am trying to "decouple" my classes such that they can be easily unit-tested and so that I can easily change the GUI library used and/or the target OS. At this time, I have finished designing classes but have not yet started implementing methods. The function of the software is to log all packets sent and received, and display them on the screen (like WireShark, but for one local process only). The software accomplishes this by hooking the send() and recv() functions in winsock32.dll, or some other pair of analogous functions depending on what the intended Target is. The hooks add packets to SendPacketList/RecvPacketList. The GuiLogic class starts a thread which checks for new packets. When new packets are found, it utilizes the PacketFilter class to determine the formatting for the new packet, and then sends it to MainWindow, a native win32 window (with intent to later port to Qt).1 ![UML Class Diagram](http://i.stack.imgur.com/dtPwP.png) Full size image of UML class diagram Here are my classes in skeleton/header form (this is my actual code):               class PacketModel     {     protected:         std::vector<byte> data;         int id;     public:         PacketModel();         PacketModel(byte* data, unsigned int size);         PacketModel(int id, byte* data, unsigned int size);         int GetLen();         bool IsValid(); //len >= sizeof(opcode_t)         opcode_t GetOpcode();         byte* GetData(); //returns &(data[0])         bool GetData(byte* outdata, int maxlen);         void SetData(byte* pdata, int len);         int GetId();         void SetId(int id);         bool ParseData(char* instr);         bool StringRepr(char* outstr);         byte& operator[] (const int index);     };          class SendPacket : public PacketModel     {     protected:         byte* returnAddy;     public:         byte* GetReturnAddy();         void SetReturnAddy(byte* addy);     };          class RecvPacket : public PacketModel     {     protected:         byte* callAddy;     public:         byte* GetCallAddy();         void SetCallAddy(byte* addy);     };          //problem: packets may be added to list at any time by any number of threads     //solution: critical section associated with each packet list     class Synch     {     public:         void Enter();         void Leave();     };          template<class PacketType> class PacketList     {     private:         static const int MAX_STORED_PACKETS = 1000;     public:         static const int DEFAULT_SHOWN_PACKETS = 100;     private:         vector<PacketType> list;         Synch synch; //wrapper for critical section     public:         void AddPacket(PacketType* packet);         PacketType* GetPacket(int id);         int TotalPackets();     };          class SendPacketList : PacketList<SendPacket>     {          };          class RecvPacketList : PacketList<RecvPacket>     {          };          class Target //one socket     {         bool Send(SendPacket* packet);         bool Inject(RecvPacket* packet);         bool InitSendHook(SendPacketList* sendList);         bool InitRecvHook(RecvPacketList* recvList);     };          class FilterModel     {     private:         opcode_t opcode;         int colorID;         bool bFilter;         char name[41];     };          class FilterFile     {     private:         FilterModel filter;     public:         void Save();         void Load();         FilterModel* GetFilter(opcode_t opcode);     };          class PacketFilter     {     private:         FilterFile filters;     public:         bool IsFiltered(opcode_t opcode);         bool GetName(opcode_t opcode, char* namestr); //return false if name does not exist         COLORREF GetColor(opcode_t opcode); //return default color if no custom color     };          class GuiLogic     {     private:         SendPacketList sendList;         RecvPacketList recvList;         PacketFilter packetFilter;         void GetPacketRepr(PacketModel* packet);         void ReadNew();         void AddToWindow();     public:         void Refresh(); //called from thread         void GetPacketInfo(int id); //called from MainWindow     };      I'm looking for a general review of my OO design, use of UML, and use of C++ features. I especially just want to know if I'm doing anything considerably wrong. From what I've read, design review is on-topic for this site (and off-topic for the Code Review site). Any sort of feedback is greatly appreciated. Thanks for reading this.


What are invariants, how can they be used, and have you ever used it in your program?

I'm reading _Coders at Work_ , and in it there's a lot of talk about invariants. As far as I've understood it, an invariant is a condition which holds both before and after an expression. They're, among other things, useful in proving that loop is correct, if I remember my Logic course correctly. Is my description correct, or have I missed something? Have you ever used them in your program? And if so, how did they benefit?


On-site interview without phone interviews - meaning?

I recently applied to work at a tech company which - to the best of my knowledge - usually does two rounds of phone screening before bringing applicants in for the on-campus interview. They contacted me and want to bring me up without doing a phone interview. I know this isn't much to go on, but should I take this at face-value or should I read something into this? Call me an optimist, but it seems like a positive thing. Maybe somebody on the inside recommended me without my knowing? Or They found something on my resume/online they liked the look of? Or maybe there's some sort of interview quota they had to fill? Any insights from hiring managers/HR people would be greatly appreciated. If this is a common thing that means something specific, knowing what it is might be to my advantage. Thanks! EDIT: Since a few people seem to indicate that it might depend on the company in question, let's say that it's a large national company (not Google or Microsoft, though), and that I don't live anywhere near the headquarters (it's about as far away as two places can be in the continental US).


Are there problems with using Reflection?

I don't know why, but I always feel like I am "cheating" when I use reflection - maybe it is because of the performance hit I know I am taking. Part of me says, if it is part of the language you are using and it can accomplish what you are trying to do, then why not use it. The other part of me says, there has to be a way I can do this without using reflection. I guess maybe it depends on the situation. What are the potential issues I need to look out for when using reflection and how concerned should I be about them? How much effort is it worth spending to try to find a more conventional solution?


How can I capture an incoming email with ASP.net-mvc?

I would like to write a web system that can capture and parse incoming emails, traditionally the web system I write are asp.net-mvc, running in a cloud hosted environment like AppHarbour or Azure. How can I leverage those (and potentially my DNS) to acheive this?


Learning PHP with a Rails/Django/Lift background

While I have been at university studying a CS degree I have been picking up web development on the side. As I started in the last couple of years, I have mainly been using Rack/Ruby based frameworks such as Rails and Sinatra but I have also looked at - and occasionally used - Web.py, Django and Lift. I realised that I have never used or seen PHP used for web development. This might seem strange but, as a young twenty something, learning PHP doesn't seem like the most fun/hip route to take. Given this background (which I am sure is relevant to many people my age). What is the best way to approach learning PHP web development? What are the key differences/similarities? Also, what frameworks are widely used and/or respected?


Why does Resharper prefer "as" to "is"?

When I write code like this, where obj is a local variable:               if (obj is IMyInterface)     {        var result = (IMyInterface)obj;        // ....     }      Resharper offers to change it into code like this:               var result = obj as IMyInterface;     if (result != null)     {        // ...     }      I prefer the former, as it offers no opportunity for accidental null reference exceptions. What reasons are there for preferring the other form? Why does Resharper recommend this?


What are the pros and cons of Inter process communication done via sockets vs shared memory?

I understand that two of the many more options for inter process communication can be :   1. Shared memory   2. Sockets  Actually I saw these two options being exposed by Intellij Idea for debugging a Java application . I want to know what are the pros and cons of each approach .


How to avoid repetitively logging in to web site?

While developing web sites it can be annoying that I have to login to the site. Every time the session runs out I have to go through a flow like...   Open logon page -> enter username/password -> click link to navigate to my page. I sometimes use Selenium to record this flow, and then automate it. But Selenium doesn't work in all browsers, and it still takes too long to load etc.   I would like to be able to just refresh the page, exactly like I would if the site didn't have a login page. Does anyone use any strategies to achieve this? Any way to disable login during development? Or other tools which can help improve the situation?