What is the smallest snippet of code that can be copyrighted?

Obviously something as simple as `int i = 0;` or `for (int i = 0; i < 10; i++)` can't be copyrighted, but an entire function could be. Where is the line between copyrightable and uncopyrightable?


Is an architecture description document a violation of the DRY Principle?

The DRY Principle (Don't Repeat Yourself) states that "every piece of knowledge must have a single, unambiguous, authoritative representation within a system." Most of the time this refers to code, but it is often extended to documentation also. It is said that every software system has an architecture whether you chose it or not. In other words, the software you build has a structure and that "as built" structure is the architecture of the software. **Since a built software system comes with an architecture, is creating an architecture description of that system a violation of the DRY Principle?** After all, if you need to know the architecture then you could always just look at the code...


New job and my boss is frequently absent

So I just started a new position at a great company that is pretty much a dream to work for. The only problem is that there's a steep learning curve for the type of data I will be working with, and my boss/training lead **is never there.** I think he is, after 10 years, experiencing burnout. He's here probably 3-10 hours out of the week, and even then its not a guarantee he's checked-in. I can still contribute in some fashion (I don't need training on programming, per say), but I'm two months in and I still don't feel comfortable in my position due to the lack of one on one time. I can contribute to some projects which I volunteer for, but they're a little outside the scope of my primary responsibilities. I'm worried that the higher ups might view me as slow to adjust. Any suggestions to change this situation? edit: So I took the suggestion in the multiple answers to schedule face time. I did, and it took us about 20 minutes to accomplish a task that should have taken about 5. The reason it took so long? **He was talking about his kid.** FML


Improving exception handling?

I am a newbie programmer and I recently started learning about exception handling in Java. I know what try, catch and finally blocks do, but I really need to understand how to use them well and where to handle something in the call stack... I have a project right now that involves I/O and all I'm doing is handling the exception in the lowest possible method in the call stack. I'm sure my exception handling can be improved, so I'm asking you guys how you think of exception handling? How did you guys get good at this and how can I better wrap my head around this idea?


GIT branch model for derivative work

I'm planning on using Vincent Driessen's branching model which I found great for my current development. I think Vincent approach is very general to any development project but I'm finding it difficult to handle the following scenario. I'm working on an application that will be branded to several customers, so each one of my bundles is a different branch that I `rebase` from `develop` branch each time a new build is going to be released. Each brand has its assets (images and text) and they do not conflict with changes in `develop` branch because in that branch I never touch the assets. My question is, now that I'm planning on using it, how can I handle different versions based on the same code base but with different assets?


is c or c++ necessary for game programming?

Do you need to learn c or c++ for game programming? I am very good with java. Is it true that most game engines are in c or c++.should i learn c or c++ or start making games in java.Can you suggest some books to start with


When the shell prints "TBD: create a test thread to print info from the Test object", what does the 'TBD' stand for?

I did this after 'make' for some C++ files, and then running one of them. Does anyone know what the significance of the acronym 'TBD' is?


Is it bad practice to define/use "Preset" functions

Lets say I have an extremely robust and versatile function:   `void DoAnything(action, target, context)` In my program, 90% of the time I call this function, it's with the same parameters:   `DoAnything(eat, food, lunchtime);` Is it bad form for me to define a function such as:   `void EatLunch(){ DoAnything(eat, food, lunchtime); }` And call that instead?


How did we get saddled with the (hierarchical) filesystem as the basic data structure?

I'm self-taught and I don't have a CS degree. The more I've been learning about data structure, the more I wonder, in this day and age, how are we still saddled with the filesystem, with directories and files, as the basic data storage structure on the OS? I understand the simplicity of it, but it seems nowadays that there could be more options available natively. As far as I'm aware, the only project to improve the basic functionality of the filesystem was ReiserFS, where you could tell what line of a file was changed by whom, and when. For instance, if I could have native tagging for files, where I could tag images, diagrams, word-processing documents, an entire code repository, all as belonging to a single project, that would really be helpful to me. Since I'm stuck in the filesystem paradigm, I know that I could put all those into a single folder/directory, but what if they already exist in disparate directories, and they need to stay there? I know there are programs out there that can do this, but why aren't they on the filesystem? Something that would be nice to have is some kind of relational feature in the filesystem, like you get with RDBMSes. I understand that that was supposed to be part of Vista/7, but that fell off the feature list too. Sure, any program can store a binary file and have any data structure it wants in it, by why couldn't the OS offer more complex ways of storing data, beyond the simple heirarchy of the filesystem?


How to present my startup experience in my CV?

I started doing Android mobile development (with a partner) sometime ago. I do this in part time. I'm trying to find out how to display this information in my CV, since I believe it is relevant for the development jobs which I'm searching for (not only due to the Java/Android experience that I aquired but also in terms of showing some personality traits). I could place it in the "Professional Experience" section, but I fear that it could "flaky" (i.e. trying to pass a hobby around as real experience). Although it actually is real experience... Any suggestions? Thanks in advance. PS: I'm asking this because I did place it as a normal "job" entry in my CV (it contains a link for the startup's website which contains a description aboutthe product/app, and so on). Last week I had an interview and got questioned on it. Namely, the usage of the "founder" expression seamed to intrigue the HR lady. So I'm wondering if this may raise strange vibes or may look like I'm faking some experience.


Is it OK to push my code to GitHub while it is still in early development?

I have some projects that are in a very early development state. They are nowhere nearing completion but I do host them (as public repos) on GitHub because:   * I have multiple computers and I want access to my code everywhere   * I want a backup for my code   * I want it to be easy if someone wants to collaborate in some way   * I use GitHub Issues as a poor man's project management software Is it OK to publish a project on GitHub even when it is very early in the development? I am a bit concerned about someone to come by and say `OMG this is total BS, this code is so bad!` while looking at unpolished/still in development/not tested code. What are your practices when you start new public projects? Do you wait until you have something substantial to show or you create a bare repo directly on GitHub and start from there? I used `GitHub` throughout this post but this applies to every code hosting service out there.


Why isn't lazy evaluation used everywhere?

I've just learnt how lazy evaluation works and I was wondering: why isn't lazy evaluation applied in every software currently produced? Why still using eager evaluation?


Saying "no" to people asking questions

> **Possible Duplicate:**   >  When do you not give help to less experienced programmers? Currently, I am finding a lot of my day is taken up by people asking domain knowledge/system questions. This impacts personal productivity. Should developers learn to say "no" more to ensure they get asked less questions and be more productive, or should the developers help each other out? Stuff does get documented, but it is often easier to ask a "quick question". How do you handle this sort of scenario?


Software patterns for frameworks

I am currently doing some research about software patterns and about architectural patterns for frameworks specifically. Google is not really showing off for this topic, so I am curious which patterns would you consider specificially important for the architecture of frameworks? I am focusing on frameworks for web, mobile and desktop software, such as Rails, UIKit, etc.


Why does C# have much more features than Java?

Please note that this isn't meant to be a Java vs. C# argument. I'm a Java programmer with no C# experience, asking just out of curiosity. I did some reading on C#, and it seems it has much more features than Java. A number of examples:   * Type inference.   * `dynamic` keyword.   * Delegates.   * Optional parameters.   * Lambda and LINQ _(I actually have no idea what these are)._   * Properties. However Java doesn't really feature anything that C# doesn't have. My question is: why does C# have much more native features than Java? And why didn't Java add some of these throughout the years, for example Properties or type inference? Do the Java language designers take a more simplistic approach? What is the reason for this?


Is there a real advantage to dynamic languages?

First I want to say Java is the only language I ever used, so please excuse my ignorance on this subject. Dynamically typed languages allow you to put any value in any variable. So for example you could write the following function (psuedocode):               void makeItBark(dog){         dog.bark();     }      And you can pass inside it whatever value. As long as the value has a `bark()` method, the code will run. Otherwise, a runtime exception or something similar is thrown. (Please correct me if I'm wrong about this). Seemingly, this gives you flexibility. However, I did some reading on dynamic languages, and what people say is that **when designing or writing code in a dynamic language, you think about types and take them into account, just as much as you would in a statically typed language.** So for example when writing the `makeItBark()` function, you intent for it to only accept 'things that can bark', and you still need to make sure you only pass these kinds of things into it. The only difference is that now the compiler won't tell you when you made a mistake. Sure, there is one advantage to this approach which is that in static languages, to achieve the 'this function accepts anything that can bark', you'd need to implement an explicit `Barker` interface. Still, this seems like a minor advantage. Am I missing something? What am I actually gaining by using a dynamically typed language?


How secure is my private repository on bitbucket

Does anybody know how secure are my private repositories on bitbucket.org? Can I rely on that? I have some repositories and I only want them to be reachable only by me and two others.


Rapid prototyping and refactoring

Sometimes when I start a small project (like an android app), I don´t know which approach will work out at the end, and I just go for one approach and give it a try. But if I never used this approach before (for a sort of application I´ve never programmed before) it is like stepping into unknown terrain. I don´t know which libraries to use (maybe I have to try out several libraries) and there are so many unkonwns (like: how to get raw audio data in android) So then my development process goes like this:   * Write a piece of code to see if the approach has a chance. (The more uncertain the approach is, the uglier the code gets)   * If it works, refactor a lot until it is beautiful I think it could be a waste of time if I planned my software design in detail at this point, it would be like planning a trip without a map. Is this part of aglie development? How do you deal with unknown terrain in software development?


Are there any existing real time trivia web apps I could contribute to?

I want to build a trivia app where people can take part in an in person trivia competition from their phone browser. Like, the question comes up on the screen and everyone can answer from their phone. I feel like this is probably already a thing, and would like to contribute to an existing project instead of building from the ground. But I cant find anything like this. Is there anything like this?


"The guard condition is false"

On the English Language Learning StackExchange, there is this seemingly simple question on whether you would throw a "be" in with "evaluates to": evaluates to be false vs evaluates to false The "be" is a word that most programmers -- I'd think -- would feel is _"in the way"_. Someone answered that part already. And I probably would not have thought much of this and clicked on... _if_ it hadn't been for the answer declaring the more natural phrase is _"the condition is false"_. That led me to internally consider that what I thought the right words would be in a simplification. _"The condition is **met** "_ ... _"The condition is **satisfied** "_ came to mind. Then I thought about the interchangeability of how we use "condition" to mean "conditional expression" and it made me want to talk about the subtler points. The risk I mention is that if we are to say that conditions are either "true" or "false" is that we have a limited vocabulary. When you have code that says `if (foo - bar)` then you run into problems when you talk about **"the condition"**. I'd say that common usage is that "the condition" mostly refers to "the conditional expression"; this is to say that "the condition" would be `foo - bar`. But even if we think throwing away "evaluation" is okay, then as false values in the language may be different from the logical falseness governing conditional statements, we should prefer "condition is not satisfied" or "condition is not met" unless we really wish to emphasize that an evaluation produced false. In that sense, I do not see "the condition is false" as being a good substitute; if one were to get literal then that might even suggest the code says `if (false)`. English Language Learners does not have a wide programmer audience, so I thought I'd bring the question here for insights. Think of `if (foo - bar)` where foo and bar are integers in a language with a separate boolean type (C++ for instance). What wording is best? When--if ever--is it okay to say "the guard condition is false"?


Spring MVC Workflow: multiple configurations for dev, staging and production

I'm looking for info about best practices of handling multiple configurations (not to be confused with - multiple configuration files) for seamless development of Spring MVC based app. I come from world of "big" PHP frameworks, where all you have to do is to write confirations specific for each phase (dev, staging, production) in separate files named as framework wants you to (Symfony), or writing one huge config file and dividing it into sections (Zend), and this will actually work. Sometimes you also/additionaly have to put some extra, `vcs` ignored files and it will do. How to handle this in Spring MVC, or Tomcat apps in general? If you're not sure about what I'm talking about, please refer to this article. To clear things up even more:   1. I'm talking (mainly) about `web.xml` and `pom.xml`.   2. I want to have (or maybe what I dream about):      * local configuration - for each developer in team, to run project locally, on `localhost:8080`, displaying full error messages and stack traces     * dev configuration - to run on test server, `dev.example-private.com`, show errors     * staging configuration - client preview, `staging.example-private.com`, nice error pages, send mails with critical errors and stack traces     * production configuration - `example.com`, nice error pages, send mails with errors   3. I don't want to switch configurations manually. I want `spring` to recognise the environment (maybe using `tomcat` config) and use appropriate configuration files. This is mainly because I want to make deployment as easy as merging branches.


How to select an appropriate Nvidia GPU for learning CUDA

What would be a good GPU to start learning CUDA on? Are any GPUs unsuitable?


How best to involve junior developer in designing an application from scratch?

We are a team of 3 developers (2 experienced devs and a junior). We just started a brand new project. We've designed the application, concentrated efforts on choosing the right architecture and now we are laying the first lines of code. We are writing the core of it, what will be the foundation of the entire application. This ain't no easy application either. Hard performance requirements, massively distributed, complex entity model etc. We are all out of our comfort zone, especially the junior. He doesn't have the experience to create a good design upfront. That's not a problem though because me and the other dev are there to help and we both believe in mentoring and in building teams, but... we don't know exactly what would be the best way to do it, so that he gets an enjoyable experience and learns the maximum amount of skills. We both realized that we didn't have a junior on new projects, only on existing ones where it was easier on the junior because he had an entire code base from which to learn and inspire. But for this app we have almost no code. We just started. We were thinking at a few approaches:   * have him try on his own for a couple of days then intervene and refactor the code together with him, steer him in the right direction then repeat => Might not be a fun experience for him since we will be pointing out his mistakes on every refactor;   * have him pair programming with one of us => he might become just a "bystander" and agree with everything we do, without actually learning a lot or digesting much of the information;   * have us build the skeleton of each module, with a solid design and then giving the module to him to add the missing pieces => might not be fun to pick up after us and there is the risk that he only pays attention to filling the gaps and not to the entire design. How can we involve him in the design so that he doesn't feel left somehow outside of it and so that he learns a lot from the experience and gaining enough confidence to try it on his own?


What's the appropriate procedure for subversion merges?

We have a project with a few release branches and a trunk. Lately we've been adding bugfixes and new features to the release branch, while doing simultaneous infrastructure development on the trunk. This has caused us some problems. Today I was told to merge changes from branch to trunk, using HEAD as starting/end revisions. It generated a dozen conflicts, which I resolved mostly by accepting the working copy of the trunk. After this was done, I found some scrambled code and some variables that didn't belong in functions. In addition to giving me a headache, this makes me re-think the way I approached merging. Is it a better practice to merge from a RECENT starting revision, as opposed to the origin of the branch? I actually did it this way first, and it didn't result in any scrambled code or misplaced variables.


Does distributing GPLd assets with a non-GPL application violate the license?

I'm trying to figure out if I can distribute the Faenza icons, which are GPL licensed, with some MIT-licensed software I'm working on. What does the GPL license really mean when applied to a non-software medium, like an icon set, that is primarily used in software applications?   * If I load the icons dynamically from external files instead of compiling them into an executable, would this violate the GPL license?   * If not, would it make a difference if the icons were compiled in?   * If I can compile them into a program, does the license just mean I can't compile the SVG "source code" of the icons into a program?   * If I can't compile the SVG source into a non-GPL program, can I load it dynamically?   * Even if I'm technically allowed to package the icons with my software under some of the above conditions, would I be violating the _spirit_ of the license? Relevant: Does distributing non-GPLd assets with a GPL application violate the license?


Semi-intelligent "diff" utility

Part of the QA steps required for a project I am tangentially involved with require the person who is responsible to integrate new version of source file to first calculate how many lines have been added, removed and "changed". Changes may include physically move a whole function or procedure around the source file (without altering the content, just reorganization) and this is counted as "no change" while actually altering a line, say from               a=b;      to               a=b--;      Of course the matching should not include extra spaces or comments. The question is: can you point to something (I suppose a Perl script would be enough as a starter) that given two version of a file can: Remove comments Count added, removed and "modified" lines, giving the three results, and not counting whole functions/procedures which have been moved up or down in the file without altering the workings? Language is C/C++. At the moment this is done by diff-ing the two source files and manually counting the lines. The result needs not to be precise to the line - basically if you get over a certain quota of "significant changes" the source goes through a more complicated integration/testing phase, so as long as the results are close enough to actual changes it's ok, in case of "too many changes" it will be reviewed by a human anyway.


Abstract DAL - Use Interface with Internal Class?

We have a business logic layer (BLL) that is tightly coupled to our data access layer (DAL). We make calls like this:               using (FooData data = new FooData())     {       data.DoSomething();     }      It's important to note that all of our data classes are `internal`, and they're in the same assembly as the logic classes, so that only the BLL can access the DAL. In order to decouple these (to help facilitate unit testing), one idea is to create IDataClass interfaces, like IFooData. At first I thought it may be a problem because we'd have to make our data classes public to implement the interfaces. But we should be able to keep the data classes internal, even though we still need the methods to be public:               public interface IFooData     {       void DoSomething();     }          internal class FooData : IFooData  // Notice the class is internal     {       public void DoSomething();  // Method is public, but that's ok because class is internal     }      So even though the method is public, since the class itself is internal, we should still allow only our BLL access. Is there anything inherently wrong with this approach? Is there a better way to abstract the DAL, for unit testing, without opening the DAL to the world by making it public?


What are the differences among the .NET certification exams?

I am a .NET developer using WPF and ASP.NET MVC and I was hoping to pass some kind of certification exam. There seems to be four exams but I am unable to understand what the differences are even with Microsoft's definitions:   * MCPD   * MCAD   * MCSD   * MTA How do they relate to each other? Is there a natural progression path through the certification exams? What version of .NET are they suited for?


Clarification on the Strategy Pattern

I've just been reading through some basic design patterns, Could someone tell me if the term "strategy pattern" only applies if your implementing a completely abstract interface? What about when your children (concretes?) inherit from a parent class (the strategy?) with some implemented methods and some virtual and/or abstract functions? Otherwise the rest of the implementation, the idea that you can switch between different children at run time, is identical. This is something i'm quite familiar with, i was wondering if you would still call it the Strategy Pattern or if that term only applies to using an interface. Apologies if this question is not appropriate! Or if this is just nitpicking :) I'm still learning and i'm not really sure if design patterns are quite heavily defined within the industry or just a concept to be implemented as you like.


Is There a Real Advantage to Generic Repository?

Was reading through some articles on the advantages of creating Generic Repositories for a new app (example). The idea seems nice because it lets me use the same repository to do several things for several different entity types at once:               IRepository repo = new EfRepository(); // Would normally pass through IOC into constructor      var c1 = new Country() { Name = "United States", CountryCode = "US" };     var c2 = new Country() { Name = "Canada", CountryCode = "CA" };     var c3 = new Country() { Name = "Mexico", CountryCode = "MX" };     var p1 = new Province() { Country = c1, Name = "Alabama", Abbreviation = "AL" };     var p2 = new Province() { Country = c1, Name = "Alaska", Abbreviation = "AK" };     var p3 = new Province() { Country = c2, Name = "Alberta", Abbreviation = "AB" };     repo.Add<Country>(c1);     repo.Add<Country>(c2);     repo.Add<Country>(c3);     repo.Add<Province>(p1);     repo.Add<Province>(p2);     repo.Add<Province>(p3);     repo.Save();      However, the rest of the implementation of the Repository has a heavy reliance on Linq:               IQueryable<T> Query();     IList<T> Find(Expression<Func<T,bool>> predicate);     T Get(Expression<Func<T,bool>> predicate);     T First(Expression<Func<T,bool>> predicate);     //... and so on      This repository pattern worked fantastic for Entity Framework, and pretty much offered a 1 to 1 mapping of the methods available on DbContext/DbSet. But given the slow uptake of Linq on other data access technologies outside of Entity Framework, what advantage does this provide over working directly with the DbContext? I attempted to write a PetaPoco version of the Repository, but PetaPoco doesn't support Linq Expressions, which makes creating a generic IRepository interface pretty much useless unless you only use it for the basic GetAll, GetById, Add, Update, Delete, and Save methods and utilize it as a base class. Then you have to create specific repositories with specialized methods to handle all the "where" clauses that I could previously pass in as a predicate. Is the Generic Repository pattern useful for anything outside of Entity Framework? If not, why would someone use it at all instead of working directly with Entity Framework? * * * Original link doesn't reflect the pattern I was using in my sample code. Here is an (updated link).


Can a designer start an open source project?

I appreciate you can't start an open source project with just an idea but would just a design be enough? Has anyone ever seen that done where a designer posts a design and developers join to start the coding?


C++ Pointers: Number of levels of Indirection

In a C++ program that doesn't contain legacy C code, is there a guideline regarding the maximum number of levels of indirection that should be used in the source code? I know that in C (as opposed to C++), some programmers have used pointers to pointers for a multiple dimension array, but for the case of arrays, there are data structures in C++ that can be used to avoid the pointers to pointers. Are users who still create pointers to pointers (or more than this) trying to use pointers to pointers only for performance ETC. reasons? I have tried NOT to use any more than a pointer to a pointer, only in the case that a pointer needed modification; does anyone have any other official or unofficial guidelines or rules regarding the number of levels of indirection?


Application Design with a Shared Database

I have a generic design question that relates to enterprise applications but I think that software developers from other types of projects may have experience with this as well. The scenario is following - you have a database and you are about to write an application that provides access to its data. The database also contains data about user accounts, their roles and authorization. The problem is that other processes are accessing the database as well and any one of these processes may change any data at any moment (e.g., delete a user). In other projects I used to have exclusive access to the database and so I usually wrapped the database with a layer that exposed the related domain functionality in a SOA-style. This wrapper had a rich domain model and could utilize caching of the database data because it was aware of any potential change (by intercepting domain events, CQRS) that could modify it. With a shared database I don't know how to approach the design. Imagine this situation:   1. HTTP request arrives to you application and you are to authenticate this request.   2. You query the database for the claimed user account and its login data. If the supplied credential matches then a session is established (e.g., in ASP.NET a secure cookie is sent to the client).   3. But then a subsequent request from that user arrives. The problem is that instead of doing something useful at this moment, it seems like that one needs to check whether the associated user account still exists in the database. Any information can stop being valid at any point because some other process may alter the database. This is of course a more generic problem. The data may not only change between requests but even between two separate database calls. The easy answer here is to use locks/transactions. But the truth is that this would require huge changes to the database schema. For example, every user account would require an additional column 'InUse' - but that is just a very simple scenario. I can imagine that completely new tables would need to be created. Also, the transactions would typically span across many HTTP requests and thus render the database useless for long periods of time for other users. I have read the PoEAA book and I am well aware of various synchronization techniques. What I am looking for here is some generic technique or methodology how to achieve the so called "good-enough-design" that does not require changes to the database schema and can handle the mentioned situations where anything can change between two requests. Right now I think I will go with the following approach - I will authenticate the user. Then I will **not** perform any subsequent checks to ensure that he was not deleted in the meanwhile. But when I perform some operation that relies on the existence of the user I will receive an exception and deduce that the user must have been deleted. The response will then be some kind of error message or error page. I am sure this is a common problem that many of you must have encountered. I will appreciate any solution or even a reference to some book or paper. Thanks.


What is the difference between waterfall model with iterations and evolutionary software development model?

Does anyone know the difference between those two? They are both created by iterative approach - giving successive revision after each iteration. They both have the initial idea->analysis->(outline)design phases.


Is it fine to have broken intermediate commits, as long as the final commit in any push works?

**Related:** Should every git commit leave the project in a working state? Suppose I make the following commits locally:   * Modify the database schema, breaking the application.   * Update the application so it is compatible with the database schema again. As long as I push both commits, `master` remains in a working state. However, a _historical_ version is broken. I'm aware that I can use `git rebase -i` to squash the commits together. However, the resulting commit will be large and less descriptive. If I need to search the commit history to find out why I changed something, I'd rather find the original commit showing what I did and why. My questions are:   * Has anyone encountered difficulties due to broken _historical_ commits in master?   * If so, is there a _simple_ way to avoid such difficulties, without discarding individual commit messages and changes?


How to work out a complex, untested scope?

The scope: it is part of a big ERP system which provides specific calculations. One can think of it as a salary calculation module in a CRM. Yet this is way beyond that in both complexity and integration points. Thus, there are a lot of technological debt, but not unmaintanable one. There some some unit/integration tests written. It _is_ testable, but it wasn't done much. It is an old part of that ERP system (3 years old), over the years it had mutated into what it is now, and there are willingness to try to complete it even if it costs some major efforts. The problem: the scope which provides a lot of various calculations based on a specific list of objects and the outcomes are not right sometimes. There are a lot of interesting (not so common) features about this scope:   * Dynamic C# formullas (loaded to context and then included in calculcations)   * A lot of reports doing the same calculations but on the database   * The scope is unstable and period-intense (new features and bugfixes are shipped every month) This scope has a lot of input parameters on all of the dependant objects. By multiplying all the possible parameter values we have 1,62*107 cases of possible outputs. Not all the parameters warry that much, but most of them do. So slicing half of that number is something around the practical possible otucomes. This scope is eating up a lot of time and money and is far from done in its current form. I would like to know what is ~~the silver bullet to~~ the most viable way to stabilize and finish the scope to the state where only minor bugs and nice to haves will occur? First of all I was thinking, that establishing a DoD (Definition of Done) would be a relevant thing to do. Then I came up to the fact that having that huge number of outputs working is half of that - everything must also be flexible on the UI scope as well. Will it be enoguh to establish a test plan, maybe do some bruteforcing tests? Should I consider any kind of design patterns? Validation options (like a solid third party validation service, etc.)? Will it be enough or maybe I have gaps in my modest knowledge that I should fill? _Note: the application is not what would one call monolithic. It is based on a lot of different services that can be easily extended, etc._


What is the architectural pattern: data pollers collect push normalized data to a central server for monitoring

I am trying to find a name for this architectural pattern that I have seen in many places before: Poller - (There are a number of these)   * These are either plugins or services acting on there own   * communicate with equipment of various sorts collecting data and pushing that data to a central service in a normalized form.   * each poller knows how to communicate with a particular device,   * collects the devices status but does not act on it, just passes it on. Central Server   * Receives normalized data, files it in key / value store.   * Periodically (or by some trigger) evaluates conditions that refer to the data. The conditions cause some action to occur (like an event to be logged, or message to be sent to an operator)


How are "Json.org"-like specs graphs called and how can I generate them?

In http://www.json.org Douglas Crockford shows the specs of the JSON format in two interesting ways: In the right side column he lists a text spec that looks like a YACC or LEX listing. In the main body of the homepage, he put several images that gives us a simple way to visually understand the valid sequences that composes a JSON string. Those images look like a description of the path that a finite state automaton would follow when parsing the JSON string. Wich are the names (if any) of that listing format and that kind of graphics? Is there any software that renders a source file containing the specification into that kind of images?


Design patterns to avoiding breaking the SRP while performing heavy data logging

A class that performs both computations and data logging seems to have at least two responsibilities. Given a system for which the specifications require heavy data logging, what kind of design patterns or architectural patterns can be used to avoid bloating all the classes with logging calls every time they compute something? The decorator pattern be used (e.g. `Interpolator` decorated to `LoggingInterpolator`), but it seems that would result in a situation hardly more desirable in which almost every major class would need to be decorated with logging.


Handling timeout in network application

How can I handle timeouts in a network application. I'm implementing a provisioning system on a Linux server, the code is huge so I'm going to put the algorithm, it works as like this   1. Read provisioning commands from file   2. Send it to another server using TCP    3. Save the request in hash.   4. Receive the response then      1. if successful response received then remove request from hash      2. if failed response received then retry the message The problem I'm in now is when the program didn't receive the response for a timeout reason then the request will be waiting for a response forever and won't be retried. And please note that I'll be sending hundreds of commands and I have to monitor the timeout commands for all of them. I tried to use timer but that didn't help because I'll end up with so many waiting timers and I'm not sure if this is a good way of doing this. The question is how can I save the message in some data structure and check to remove or retry it later when there is no response from the other end? Please note that I'm willing to change the algorithm to anything you suggest that could deal with the timeouts.


Git temporary code-change

My program interacts with another application via a socket communication. The current public version of this application does not support a specific command while the newest trunk does. To be compatible with the current public release, I just need to re-write few lines of code. From the current point on, development must continue with this _changed code_ , but in the future the original code should be used again. Is it possible to make a partial change to a file temporary with Git? I could create a branch, for instance, and continue developing in this branch. However, when I merge the branch into the master, I want the _changed code_ mentioned above to be reverted to its _original code_. _Note_ : I am well aware that I could distinguish between versions of the software, however the changes have also effect on GUI resource files which I can not affect from code other than simply loading a different resource file.


Should I use initializer blocks in Java?

I recently came across a Java construct I have never seen before and was wondering whether I should use it. It seems to be called initializer blocks.               public class Test {       public Test() { /* first constructor */ }       public Test(String s) { /* second constructor */ }       {         doStuff();       }     }      The code block will be copied into each constructor, i.e. if you have multiple constructor you do not have to rewrite code. However, I see three main drawbacks using this syntax:   1. It is one of the very few cases in Java where the order of your code is important, as you can define multiple code blocks and they will be executed in the order they are written. This seems harmful to me as simply changing the order of code blocks will actually change the code.   2. I do not really see any benefits by using it. In most cases, the constructors will call each other with some pre-defined values. Even if this is not the case, the code could simply be put into a private method and called from each constructor.   3. It reduces readability, as you could put the block at the end of the class and the constructor is normally at the beginning of the class. It is quite counter-intuitive to look at a completely different part of a code file if you do not expect that to be necessary. If my above statements are true, why (and when) was this language construct introduced? Are there any legitimate use cases?


What is the best way to design a web site to be highly scalable?

For websites that need to be highly scalable, such as social networks like facebook, what's the best way to design the website?   1. Should I have a web service which the site queries to get data that it needs? or   2. Should the site query databases directly? (can be done using built in language constructs to fill tables automatically etc). I would think the web service is the better design since it gives centralized data access and things like caching and the like become much easier to control, but what do others think?


Why should we use low level languages if a high level one like python can do almost everything?

I know python is not suitable for things like microcontrolers, make drivers etc, but besides that, you can do everything using python, companys get stuck with speed optimizations for real hard time system but does forget other factors which one you can just upgrade your hardware for speed proposes in order to get your python program fit in it, if you think how much cust can the company have to maintain a system written in C, the comparison is like that: for example: 10 programmers to mantain a system written in c and just one programmer to mantain a system written in python, with python you can buy some better hardware to fit your python program, I think that low level languages tend to get more cost, since programmers aren't so cheaply than a hardware upgrade, then, this is my point, **why should a system be written in c instead of python**?


What are your initial three steps when you are first presented with a software problem?

I am curious about the very early steps that a programmer's mind takes when it first encounters a problem that it is supposed to solve. How do you start reasoning about it ? What are the first questions you ask yourself ??. Ok, let me make it more concrete for those of you who think the question is too vague or entirely situation dependent. Pick **any** of the following requirements and think out loud about your very first hunches/impressions/tendencies about how to solve it. 1) build a simple word processor with about as much functionality as MS Word Pad   2) design a single person card game (e.g. Solitaire)   3) build a scientific calculator   4) Any problem of your choosing with similar scale/complexity as the above three


Authentication Systems - Separate for Management?

**Edit** : I admit to being unclear when I first wrote the question. I suppose I wasn't sure of the issue myself, the comments and answers provided up to now helped me focus on the issue, thank you to all involved. This edit is a total rewrite of the question. **End editorial comment** On a dynamic website we have two systems - content management, and user interface (trivial). We are trying to decide if the two should have separate authentication systems (being two systems, this might increase security [or not - @GlenH7?]), each having its own hierarchy of permissions etc. Or is it better to have a single system (it's the same database, after all... plus easier maintenance) and only play around with permissions (regular, jumbo, power, super nova, admin, Q)?


Is it a good programming practice to have a class with several .h files?

I suppose the class have several different interfaces. Some it shows to some class, some it shows to other classes. Are there any good reason for that? One thing I can think of is with one .h per class, interface would either be public or private. What about if I want some interface to be available to some friends' class and some interface to be truly public? Sample:               @interface listNewController:BadgerStandardViewViewController <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,NSFetchedResultsControllerDelegate,UIScrollViewDelegate,UIGestureRecognizerDelegate> {     }          @property (nonatomic) IBOutlet NSFetchedResultsController *FetchController;     @property (nonatomic) IBOutlet UITextField *searchBar1;     @property (nonatomic) IBOutlet UITableView *tableViewA;     + (listNewController *) singleton; //For Easier Access     -(void)collapseAll;     -(void)TitleViewClicked:(TitleView *) theTitleView;     -(NSUInteger) countOfEachSection:(NSInteger)section;     @end      Many of those public properties and function are only ever called by just one other classes. I wonder why I need to make them available to many classes. It's in Objective-c by the way What do you mean? Interface is interface. In C++ you can declare some classes as "friends". In Objective-c you cannot I think. Basically I want to emulate that. My friends can access some members that's not available too publicly,.


Design Pattern for Server, where application is single-page RIA

So I'm using Node and ExtJS server-side/client-side respectfully. By using ExtJS, I'm moving a lot of the presentation logic client-side. Thus, something like MVC wouldn't make sense server-side since the view-logic is all client- side. At this point, my Node server's responsibilities are essentially:   * Act as proxy to persistent storage (MongoDB) for ExtJS stores   * User validation/sessioning with Windows Active Directory   * Hooking-in with existing Enterprise infrastructure (databases, Salesforce.com, etc). Well I know design patterns aren't the end-all-be-all, and conforming to a design pattern can in some cases impede progress, but I'm relatively new to web-programming in general. I'd like to use a pattern to start just so I don't make any major architectural decisions that will haunt me for the rest of the project. Is there a pattern will suited for my needs that I could lean-on?


c style casts or c++ style casts

So, what do you use?               int anInt = (int)aFloat;      or               int anInt = static_cast<int>(aFloat);     // and its brethren      And, more importantly, why?


Is navigate between more than one class a bad practice?

I have the following class with the following function (some implementation details have been skipped):               public class TitleScreen : GameScreen     {          public Texture2D titleScreen;              public override void Draw (GameTime gameTime)         {             ScreenManager.SpriteBatch.Draw (titleScreen, new Rectangle (0, 0, ScreenManager.Game.Window.ClientBounds.Width, ScreenManager.Game.Window.ClientBounds.Height), Color.White);         }     }      This class is associated with a class "ScreenManager", which is associated with a Game, which is associated with a Window. As you can see, I navigate through several classes in order to obtain the bounds of the Window so I can draw it. My question is: Is that a bad practice? Am I coupling the TitleScreen class with Game and Window? It would be better to implement a function in ScreenManager to return the Width and Height of the window?


When can you call yourself good at language X?

This goes back to a conversation I've had with my girlfriend. I tried to tell her that I simply don't feel adequate enough in my programming language (C++) to call myself good. She then asked me, "Well, when do you consider yourself good enough?" That's an interesting question. I didn't know what to tell her. So I'm asking you. For any programming language, framework or the like, when do you reach a point were you sit back, look at what you've done and say, "Hey, I'm actually pretty good at this."? How do you define "good" so that you can tell others, honestly, "Yeah, I'm good at X". Additionally, do you reach these conclusions by comparing what others can do? **Additional Info** I have read the canonical paper on how it takes ten-thousand hours before you are an expert on the field. (Props to anybody that knows what this paper is called again) I have also read various articles from Coding Horror about interviewing people. Some people, it was said, "Cannot function outside of a framework." So they may be "good" for that framework, but not otherwise in the language. Is this true?


Enum with FlagsAttribute or IEnumerable<Enum>/ISet<T>

Which is the currently-accepted best practice in terms of C# enum usage, a bitwise [Flags] Enum (compared using | and &) or an IEnumerable of enum values? I'm thinking both from a code-conciseness perspective and from a maintenance perspective. The only downside to using the Flags approach that I can think of is the inability to enumerate the values without doing the reverse enumeration:               var possibleValues = Enum.GetValues(typeof(MyEnum)).Cast<MyEnum>();     var applicableValues = possibleValues.Where(x => (containerClass.EnumProperty & x) == x);      Whereas obviously the IEnumerable is easier to query. EDIT: As svick rightly pointed out, the IEnumerable would be perhaps the wrong collection to use, an ISet might be a better example.


PHP function types

I am trying to find a way of classifying different types of PHP functions. For example that fopen, fwrite, fclose and so on are all part of IO, and the MySQL functions and MySQLi class is all for mysql related things but something more automatic was wondering if there is some sort of function class mapping in PHP


What is this development methodology called?

I recall a methodology that emphasized making functions short and numerous. It said that if a section of code can be separated at all, it should be, even if the resultant functions are only used once. Some argue that it's DRY taken too far, and that this kind of obsessive refactoring is counterproductive. Does anyone know what it could be called? I don't think it actually had _refactoring_ in the name.


Should an Animal be abstract or allow for instantiation to represent a "general" instance?

After a short discussion in the comments here I have come to wonder whether or not a baseclass like `Animal` in the traditional OOP example should be marked as abstract or not. Personally I believe it should: there is no such thing as an "animal", it is merely a term that groups certain subtypes based on what they are. Any instance of an "animal" should be a subtype, a concrete example. The comment that followed on this was > There most certainly is such a thing as an Animal. Or would you insist that > Dog be broken down into Affenpinscher, IrishWolfhound, SiberianHusky, > EnglishSetter, and 600 other breeds? which is a fair remark but that is different from the original situation where the hierarchy was ![enter image description here](http://i.stack.imgur.com/keWQL.png) And there are no subclasses of `Dog` in the first place. Should there have been then yes, `Dog` should be abstract because the tree includes more specific leafs for that specific type. I can only assume that the reason you wouldn't make it a specific subtype is when you simply don't know it. I would instead add a "default" implementation of a dog to account for this so I can keep the `Dog` class itself abstract so there wouldn't be any ambiguity possible: you are forced to either create a specific dog or indicate that you don't know the type. Furthermore it also allows you to create `abstract` methods that every dog should implement for themselves because they are dogtype-specific. By using a non-abstract class you can't do this and you'll have to remember to override each method in the subclasses. ![enter image description here](http://i.stack.imgur.com/UXPFM.png) In the above tree I would make `Dog`, `Mammal` and `Animal` abstract and allow the others to be instantiated. The question boils down to this: **should you be able to instantiate a class that exists to indicate a subspecies or should you defer the creation of such a "general" object to a subtype?**


Contract Clause on Ergonomics/Injury Prevention

I'm sure many developers have faced this scenario: you're currently negotiating a new position at a company and you're going through the whole list (salary, perks, benefits, etc), but there's _always_ something missing. In my 8 years of professional work, not once have I seen a clause on ergonomics or injury prevention. I'm talking about providing an ergonomic chair, keyboard or even a stand for your LCD. I have a bad upper back and neck which I need to go see the chiropractor every week. I always make sure there's a least a good chiropractic plan in the contract, but that's just fixing the problem's surface. My chiropractor is telling me that my neck is straightening (not good) and that I should try to prevent bad ergonomics in the workplace to stop it. I'm at a point in my career where I'm in high demand and can make some reasonable demands myself. I have asked several companies in the past to procure me a better chair (Herman Miller, Humanscale, etc) or keyboard (Microsoft Ergonomic) or even an LCD stand, to which I normally get chuckled at. There is no doubt that this profession is ruining my neck/back, but good luck trying to pin this on any specific (or even collective) company for their lack of ergonomics. My question is, how do you approach the subject? Has anyone been successful in the past? Do you do on the contract or wait until you're in the company, then ask? How do you make sure the company hold's their end of the deal? Any suggestions and opinions would be greatly appreciated.


Would a NoSQL DB be more efficient than a relational DB for storing JSON objects?

I am using a library that returns a JSON object (as a string, but I think that's standard), and I would like to store the contents of this object into a local database. I'm fairly fresh-faced in terms of interfacing with DBs, but I can find my way around. I was using a MySQL database to store the data, but this involved using methods to extract the fields of the raw object, and slicing and dicing. I'm wondering if it would be more efficient to use a NoSQL solution to store the data, as it's already in the right form.


Are interfaces and method signatures copyright protected?

For example, is it copyright infringement if I write a class called Random with the exact same purpose and method signatures as Microsoft's .Net System.Random class? Does it make a difference what language it's written in? In this case I want to write a Random class for use in ActionScript, which lacks a built-in seeded PRNG class. If anyone has good links or reference suggestions for understanding what aspects of software are protected that's great too. And yes I know this isn't the place for "real" legal advice. If anyone goes to court pointing to a public message board as precendence--shame on them.


Necessity to learn haskell language extension for production

Haskell core language is really simple. Coming from an OO background, the main difficulty is to adapt to the pure functional paradigm. While learning "basic" Haskell, I have always considered language extensions as toys for CS people or as experiments for future versions of the language (like `from future import ???` in python). However when I began to look at web frameworks such as Yesod, I find that a lot of source files require between 3 & 4 extensions. Some look quite simple (StringOverload). Other are really intimidating (GADT, Type Famillies, Template Haskell). Their documentation links to research papers, which is scary for someone expecting to learn "just" a new library. Is it necessary to learn GHC language extensions to be productive in Haskell? If you were to hire a Haskell developer for a production application, would you ask for such knowledge?


Is a developer-driven product a good thing?

I work in a company where the CEO manages the product team, who mockup features and drop in the lap of developers to then implement said features. There is some iteration of course, developer's opinions are respected. But I wonder how effective this process is. Jason Calacanis just wrote : > The Zuckerberg Doctrine: Developers design products with significantly > improved speed and functionality compared to product managers and designers, > outweighing potential mistakes and drawbacks. > > ... > > Then it really hit me: Developer-driven startups always produce product > faster. > > This stands to reason: our nontechnical people are having discussions and > debates while Zuckerberg is coding his next feature. This is why no one has > been able to keep up with Facebook! > > While MySpacers debated how to iterate on their product, Facebook simply > tried stuff. Does this actually work better in practice ?


Running only some of the tests after a code change

Running the build can take a long time. Why run all the tests when a given change probably only has the potential to break some of them? You should be able to build a dependency graph of all the code that each test could possibly run, and then avoid running tests that couldn't possibly be affected. Is there anything that does this?


MVC is a GUI Architecture or a Architecture to GUI and Domain?

Fowler refers to the MVC, as a GUI architecture: > There have been many different ways to organize the code for a rich **client > system**. Here I discuss a selection of those that I feel have been the most > influential and introduce how they relate to the patterns. If MVC is a GUI architecture, then say that the M in MVC are the business rules or domain is not wrong?


Hiding away complexity with sub functions

I am having a discussion on code style, and it's starting to sound like a "matter of taste". I strongly believe otherwise, so I'm writing this to get your opinion and learn from your arguments for and against. The issue is that of hiding complexity by replacing a bunch of lines of code with a method. This discussion is unrelated to reusable functions, and I'm trying to make the argument for simple code organization, not for factoring out common functionality. So, take this example in loose java:               public void purchase(Customer customer, Set<Item> items, Warehouse warehouse){          int credit = customer.getCredit();              int orderPrice;               for(Item item: items){              orderPrice+=items.getPrice();          }               if(orderPrice + customer.getPendingPayments() > customer.getCredit()) {                   warehouse.reserveStock(items);                transportCenter.allocateTransport();                customer.bill(items, orderPrice);          }     }      As opposed to this:               public boolean isCreditOk(Customer customer, Set<Item> items){          int credit = customer.getCredit();              int orderPrice;               for(Item item: items){              orderPrice+=items.getPrice();          }          return  orderPrice + customer.getPendingPayments() > customer.getCredit();     }          public void purchase(Customer customer, Set<Item> items, Warehouse warehouse){          if(isCreditOk(customer, items)){                warehouse.reserveStock(items);                transportCenter.allocateTransport();                customer.bill(items, orderPrice);          }     }      The whole discussion now is: would you have created the `isCreditOk` method or would you have left if inline? When do you do one or the other? does it depend, in a general case, on:   * The length of the function to extract   * How many sub-functions and sub-subfunctions isCreditOk will end up having Again, this is not done because `isCreditOk` will be used often, but because it makes the code easier to read (in my opinion). Can I have your comments? Thanks! Note: I have found this question to be related: Is there such a thing as having too many private functions/methods?


Are factors such as Intellisense support and strong typing enough to justify the use of an 'Anaemic Domain Model'?

It's easy to accept that objects should be used in all layers except a layer nominated as a data layer. However, it's just as easy to end-up with an 'anaemic domain model' that is just an object representation of data with no real functionality ( http://martinfowler.com/bliki/AnemicDomainModel.html ). However, using objects in this fashion brings the benefit of factors such as Intellisense support, strong typing, readability, discoverability, etc. Are these factors strong arguments for an otherwise, anaemic domain model?


QoS implementation algorithm

I'm working on an application, that does IP routing and QoS. Today we have the QoS implemented, with 3 priorities (low, normal and high) and for each level we create a Queue and as soon as the packages are queued, we send it forward in a FIFO way (the scheduler spend 60% of time with the high queue, 30% the time with normal and 10% with the low queue). It works, but as FIFO it has some drawbacks like:   * An aggressive traffic will fill in the queue and all other flows with the same priority will be stucked   * under high usage, TCP will slow down and UDP will keep flooding our Queue. It means in the end UDP flows will have better priorization then TCP flows I was thinking a way to improve it and my idea is to implement a SFQ with the following algorithm:   * keep the high, normal, low, but they aren't just 3 queues, but one per (seen) protocol    * The scheduler still spending 60% of time we spend with the high queues, 30% the time with normal and 10% with the low queues. But now, it does a round-robin between the queues with the same priority. The choosen Queue, will still forward the packets in a FIFO way. drawbacks from this implementation:   * it is more expensive to the CPU Am I missing something? Any recommendation?


How much time can I spend learning at work?

I've been working as a software developer for about 2 years by now. It seems obvious that in a field so rapidly evolving as software development, you need to spend time on learning new technologies, frameworks, etc. I always thought I could take it for granted that if I need to learn something to solve a problem at work, I am free to spend the hours needed learning that at work as well. However, I have had discussions about this topic with various colleagues, and we were holding very different opinions, apparently on the span of two extremes: > Your employer pays you for knowing stuff. You got hired for having knowledge > on the field of expertise required for doing this job, and if the field > emerges so that you need to aquire more knowledge, it is only natural that > you do so in your free time. And the other extreme being > Whatever makes me more productive at work in the long run, is worth spending > the time on at work, because the employer will eventually profit from that. > This does of course apply to learning new techniques, but also, e.g. > learning VIM to get faster, etc. But even when discussing how long to spend time on something with the guys tending to the second extreme, we were of vastly different opinions, ranging from "an hour every now and then is okay" to "however long it takes". Does your workplace encourage learning new skills and if so what processes do they have to encourage this? How much time do you spend learning new things (and not writing production code) during your day as a programmer?


Java convention for if/else if order

I have an if/else if structure that on some cases does nothing. From the code I have seen in my career, the "empty" case is normally left out. But when I wrote my code, it just doesn't feel right to leave this case out, but to show it as a real case that simply does nothing. For example, in a case where something is done when a number is below 5 and above 10, but in between nothing is done:               int a = 4     if(a < 5) {       do something     } else if(a >=5 && a <= 10) {       // do nothing     } else if(a > 10) {       do something else     }      The reason I thought this is a better option is because:   1. The is how I though about the problem in my mind.   2. This shows the reader of the code that I thought of all the possibilities and didn't forget one by mistake. So I was wondering if this convention is either accepted by the programming community or it is shunned upon.


What is the accepted best practice for Java type conversions?

What is the current best practice for all the type conversions necessary in a Java web application? For example, `HttpServletRequest.getParameters(...)` returns `String[]`, but Hibernate does not allow `String[]` to be used in an IN clause for a numeric column. Therefore I need to convert `String[]` to `Long[]` via `Long.valueOf()`. What is the best way to handle this, short of rewriting in another language? Do people just create a class full of little static methods to do this?


Is integer used too much as a data type?

Do most application developers use signed integers in places where they really mean to use unsigned integers? I do it all the time, so do my co-workers. I haven't seen a lot of other extensive codebases (other than the Delphi VCL) and examples on the internet usually use integer. Whereas the VCL developers use their own data types (which would be the most non-lazy way to go about declaring variables). Something seems a little dreadful about code like this               TStuffRec = record        recordID : Integer;        thingID : Integer;        otherThingID : Integer;     end;      when it could be written as               TStuffRec = record        recordID : Cardinal;        thingID : Cardinal;        otherThingID : Cardinal;     end;      Functionally, these records almost always work the same (and hopefully will continue to work the same even in 64-bit Delphi). But very large numbers will have conversion issues. But there are drawbacks to using unsigned ints too. Mainly stemming from how annoying it is to mix the two. The real question is, is this a thing that actually gets thought about or included in best practices? Is it usually just up to the developer?


What is the best approach to solve a factory method problem which has to be an instance?

I have to add new funcionality in a web service legacy project and I'm thinking what is the best approach for a concrete situation. The web service is simple: It receives a XML file, unmarshalling, generates response's objects, marshalling and finally it sends the response as a XML file. For every XML files received, the web service always responds with the same XML structure. What I have to do is to generate a different XML file according to the XML received. So I have a controller class which has all marshalling/unmarshalling operations, but this controller class has to be an instance. Depending on XML received I need some marshalling methods or others. Trying to make few changes on legacy source, what is the best approach? My first approach was to do a factory method pattern with the controller class, but this class has to be an instance. I want to keep, as far as it goes, this structure:               classController.doMarshalling();      I think this one is a bit smelly:               if(XMLReceived.isTypeOne())         classController.doMarshallingOne();     else if(XMLReceived.isTypeTwo())         classController.doMarshallingTwo();     else if(XMLReceived.isTypeThree())         classController.doMarshallingThree();     else if ...      I hope my question is well understood


Why do many older algorithms papers reference implementations on a PDP-10 or PDP-11?

Take the original Boyer-Moore paper, for instance. It seems every time I look for an algorithm the paper I see referenced is talking about implementation idiosyncrasies on a PDP-10 or PDP-11. I know these were popular machines at one time, but not so popular as to account for the large number of references I see. Is there a specific reason these machines were used as examples in algorithms papers?


Do I need to make the source code available to a modified AGPL application if the application is only exclusively available over my private LAN?

I have a network game licensed under the AGPL that I modified to suit my needs. Theoretically, I want to charge people to play this game over a local area network that is set up in a private establishment of which I own all the local network infrastructure including the server and the game stations. would I still be required to make the source code available to these people?


How can I implement a modular "save" function for a game?

I have to implement a method to save my game in such a way that I can change the storage medium with the change of only a single variable. Ideally I'd use an interface to designate the required method signatures and implement that interface with a different concrete class for each medium. For example, one for database, one for xml, possibly one for serialized objects. How exactly I initiate the save function? For example, if I have a Class of type Persistence called PersistToXML, which is instantiated to some variable somewhere upon launching the game, how best should I implement it so that I can save my relevant objects as needed? I'm hesitant to use a Singleton due to all the bad reviews I read about it, and I don't really want to have to pass this object around to every class just in case I need to save something.


What "version naming convention" do you use?

Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3.               1.2.3 (11BCF) <- Build number, should correspond with a revision in source control     ^ ^ ^     | | |     | | +--- Minor bugs, spelling mistakes, etc.     | +----- Minor features, major bug fixes, etc.     +------- Major version, UX changes, file format changes, etc.


How do you version your files (Version Numbers)

I wonder how do you decide on the version number of your apps, do you really record down all changes made (for a change log)? Then how will you decide how to increment the version number. eg. +0.0.1 for each bug fix or something, +0.1 for each new feature release? or maybe you bundle many changes into +0.1 of your version number?


When do you change your major/minor/patch version number?

> **Possible Duplicate:**   >  What "version naming convention" do you use? Do you change your major/minor/patch version numbers right before you release or right after? Example: You just released 1.0.0 to the world (huzzah!). But wait, don't celebrate too much. 1.1.0 is coming out in six weeks! So you fix a bug and do a new build. **What's that build called?** 1.1.0.0 or 1.0.0.xxxy (where xxxy is the build number of 1.0.0 incremented)? Keep in mind you may have 100 features and bugs to go into 1.1.0. So it might be good to call it 1.0.0.xxxy, because you're nowhere close to 1.1.0. But on the other hand, another dev may be working on 2.0.0, in which case your build might be better named 1.1.0.0 and his 2.0.0.0 instead of 1.0.0.xxxy and 1.0.0.xxxz, respectively.


What is your application versioning strategy?

I would be interested to get the SO community's opinions on the best application versioning strategy. My questions:   1. How do you keep track of your application's version number? Do you have a formal definition of what each number/character in that version represents?   2. What do the different numbers/strings in the application's version mean for your app?   3. Do you use any automated updating system in your apps (e.g. something like Sparkle) and how good has it been behaving for you?   4. Do you have a separate update procedure for beta-testers or pre-release testers of your app?


[YYYY].[MM].[DD].[hh][mm] vs. [major].[minor].[revision]

> **Possible Duplicate:**   >  What "version naming convention" do you use? I am currently debating between the traditional versioning convention `[major].[minor].[revision]` and my own, almost whimsical, `[YYYY].[MM].[DD].[hh][mm]` for a new project I am starting. I understand that `[major].[minor].[revision]` is probably the most popular versioning method on the planet and it is indeed pretty straightforward and reasonable, except that determining which changes merit the label "major", "minor" or even "revision" could be... **subjective**. A versioning system based on a _timestamp_ is purely non-subjective and guarantees uniqueness. Which one would you choose for your project and why?


Recommendation for a book that explains web services in java

I am new to web services. I have been working with Java web applications for the past 3 years. Are there books that explain the basics of web services clearly. I have read Starting Java Web Services and feeling lost but I did not find a proper book recommendation there.


Is the JavaScript syntax the same for all browsers?

As for interacting with the DOM, different browsers will offer methods -and results- that are different between them to some or other extent. But how about JavaScript itself? Do all browsers (or platforms e.g. Adobe Reader) implement the same syntax and behavior? Aspects that particularly worry me are function/object handling and arithmetical operations.


Considering JCR as a NoSQL solution?

I'm evaluating some NoSQL solutions for a project of mine and JCR popped up during my searches as a document store. But it seems somehow of an obscure niche which didn't have the impact its designers hoped for. I'm interested in the technology, but so far there does not seem to be a lot of resources out there to show it's potential (there is some info on the Jackrabbit site, but otherwise, pretty much scarce info). Hopefully someone in the SE community could share from their experience with this technology. What are its advantages/disadvantages? In what situations does this technology perform best?


Open Source Web-based CMS for writing and managing API documentation

This is a question that have somewhat been asked before (i.e.: How to manage an open source project's documentation). However, my question is a little different because:   * We're not developing open source software, but proprietary software   * The documentation has to be hand-written, because we do not want to publish the actual software API documentation, but only the public API documentation   * I do want developers and project managers to write the documentation collaboratively Obviously, wikis are a solution, but they're very generic. I'm looking for a more specialized tool for this job. I've looked around and found a few like Adobe Robohelp, SaaS solutions and such, but I'd like to know if any open source software exists for that purpose. **Do you know any Open Source Web-based CMS for writing and managing API and software documentation?**


Building a Redundant / Distributed Application

This is more of a "point me in the right direction" question. My team of three and I have built a hosted web app that queues and routes customer chat requests to available customer service agents (It does other things as well, but this is enough background to illustrate the issue). The basic dev architecture today is:   * a single page ajax web UI (ASP.NET MVC) with floating chat windows (think Gmail)    * a backend Windows service to queue and route the chat requests      * this service also logs the chats, calculates service levels, etc   * a Comet server product that routes data between the web frontend and the backend Windows service       * this also helps us detect which Agents are still connected (online)  And our hardware architecture today is:   * 2 servers to host the web UI portion of the application   * a load balancer to route requests to the 2 different web app servers   * a third server to host the SQL Server DB and the backend Windows service responsible for queuing / delivering chats ![enter image description here](http://i.stack.imgur.com/AoSk5.png) So as it stands today, one of the web app servers could go down and we would be ok. However, if something would happen to the SQL Server / Windows Service server we would be boned. My question - how can I make this backend Windows service logic be able to be spread across multiple machines (distributed)? The Windows service is written to accept requests from the Comet server, check for available Agents, and route the chat to those agents. How can I make this more distributed? How can I make it so that I can distribute the work of the backend Windows service can be spread across multiple machines for redundancy and uptime purposes? Will I need to re-write it with distributed computing in mind? I should also note that I am hosting all of this on Rackspace Cloud instances - so maybe it is something I should be less concerned about? Thanks in advance for any help!


When should you use a document vs relational vs graph database?

For the purposes of discussion let's consider a FourSquare scenario. ## Scenario Entities:   * Users   * Places Relationships:   * Checkins: users <-> places, many to many   * Friends: users <-> users, many to many ## Database Design These will most likely have errors, please point them out. ### RDBMS Tables:   * Users   * Places   * Checkins (junction)   * Friends (junction) Pros:   * CAP: consistency, availability Cons:   * CAP: partition tolerance, aka sharding   * schemes = inflexible structure   * poor replication? ### Graph Objects:   * Users   * Places Edges:   * Friends: User <-> User   * Checkins: User -> Places      * contains timestamp Pros:   * CAP: consistency, availability?   * schemaless, easily mutable objects and edges   * graph traversal queries, for example:      * clustering        * finding groups of friends       * finding restaurants liked by similar people     * any other common / useful queries? Cons:   * CAP: partition tolerance? ### Document / Object 3 separate databases?   * Users      * friends list   * Checkins      * timestamp     * user     * place   * Places Pros:   * CAP: availability, partition tolerance   * schemaless, easily mutable objects Cons:   * CAP: consistency ## Questions For the record, they ended up using MongoDB. In addition to all those question marks above:   1. I'm not sure how to implement a document database.   2. How do document databases gain partition tolerance?   3. To get a single user's checkins, I assume the operation would parse all checkins and filter the metadata for username (map + filter). The performance of parsing 1,000,000+ documents for each user would be terribly poor. I assume this is not the correct behavior?   4. What other pro / cons are there?


Why would you want to use an array, or hash as hash key in ruby?

i'm using **Ruby 1.9.3** I figured out that you can use an `array`, or a `hash` as hash key in ruby:               h = Hash.new          h[Array.new] = "Why?"     h[Array.new] # Output: "Why?"          h[Hash.new] = "It doesn't make sense"     h[Hash.new] # Output: "It doesn't make sense"      But an object works differently...               h[Object.new] = "LOL"     h[Object.new] # Output: "nil"      But this one works as expected:               o = Object.new          h[o] = "LMAO"     h[o] # Output: "LMAO"      Tried this:               o = Object.new           # Output: #<Object:0x2c78c10>     h["#<Object:0x2c78c10>"] # Output: nil      Tried it in **Python** and **PHP** and it throws an error. I'm just curious about how it works, and why would you want to use an `array`, or a `hash` as hash key in ruby? Thanks.


Thread safe GUI programming

I have been programming Java with swing for a couple of years now, and always accepted that GUI interactions had to happen on the Event Dispatch Thread. I recently started to use GTK+ for C applications and was unsurprised to find that GUI interactions had to be called on gtk_main. Similarly, I looked at SWT to see in what ways it was different to Swing and to see if it was worth using, and again found the UI thread idea, and I am sure that these 3 are not the only toolkits to use this model. I was wondering if there is a reason for this design i.e. what is the reason for keeping UI modifications isolated to a single thread. I can see why some modifications may cause issues (like modifying a list while it is being drawn), but I do not see why these concerns pass on to the user of the API. Is there a limit imposed by an operating system? Is there a good reason these concerns are not 'hidden' (i.e. some form of synchronization that is invisible to the user)? Is there any (even purely conceptual) way of creating a thread safe graphics library, or is such a thing actually impossible? I found this http://blogs.operationaldynamics.com/andrew/software/gnome- desktop/gtk-thread-awareness which seems to describe GTK differently to how I understood it (although my understanding was the same as many people's) How does this differ to other toolkits? Is it possible to implement this in Swing (as the EDT model does not actually prevent access from other threads, it just often leads to Exceptions)


Why aren't we all doing model driven development yet?

I am a true believer in Model Driven Development, I think it has the possibility to increase productivity, quality and predictability. When looking at MetaEdit the results are amazing. Mendix in the Netherlands is growing very very fast and has great results. I also know there are a lot of problems   * versioning of generators, templates and framework   * projects that just aren't right for model driven development (not enough repetition)   * higher risks (when the first project fails, you have less results than you would have with more traditional development)   * etc But still these problems seem solvable and the benefits should outweigh the effort needed. **Question** : What do you see as the biggest problems that make you not even consider model driven development ? I want to use these answers not just for my own understanding but also as a possible source for a series of internal articles I plan to write.


Is there a canonical book on creating highly interactive websites (eg. "Flash" like) with HTML5/CSS3/JS/jQuery?

I know some of the basics of these technologies already, but it is mostly limited to more static sites. Using things like HTMl5 semantic elements, CSS3 gradients, shadows, `@font-face` etc. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on creating highly interactive websites with HTML5/CSS3/JS/jQuery? What about that book makes it special?


responsibility for storage

A colleague and I were brainstorming about where to put the responsibility of an object to store itself on the disk in our own file format. There are basically two choices:   1. object.store(file)   2. fileformatWriter.store(object) The first one gives the responsibility of serialization on the disk to the object itself. This is similar to the approach used by python pickle. The second groups the representation responsibility on a file format writer object. The data object is just a plain data container (eventually with additional methods not relevant for storage). We agreed on the second methodology, because it centralizes the writing logic from generic data. We also have cases of objects implementing complex logic that need to store info while the logic is in progress. For these cases, the fileformatwriter object can be passed and used as a delegate, calling storage operations on it. With the first pattern, the complex logic object would instead accept the raw file, and implement the writing logic itself. The first method, however, has the advantage that the object knows how to write and read itself from any file containing it, which may also be convenient. I would like to hear your opinion before starting a rather complex refactoring.


Is it better to load up a class with methods or extend member functionality in a local subclass?

Which do you like better? Class #1:               public class SearchClass     {         public SearchClass (string ProgramName)         { /* Searches LocalFile objects, handles exceptions, and puts results into m_Results. */ }              DateTime TimeExecuted;         bool OperationSuccessful;              protected List<LocalFile> m_Results;         public ReadOnlyCollection<LocalFile> Results         {             get { return new ReadOnlyCollection<LocalFile>(m_Results); }         }              #region Results Filters         public DateTime OldestFileModified         {             get { /* Does what it says. */ }         }              public ReadOnlyCollection<LocalFile> ResultsWithoutProcessFiles()         {             return new ReadOnlyCollection<LocalFile> ((from x in m_Results                                                        where x.FileTypeID != FileTypeIDs.ProcessFile                                                        select x).ToList());         }         #endregion     }      Or class #2:               public class SearchClass     {         public SearchClass (string ProgramName)         { /* Searches LocalFile objects, handles exceptions, and puts results into m_Results. */ }              DateTime TimeExecuted;         bool OperationSuccessful;              protected List<LocalFile> m_Results;         public ReadOnlyCollection<LocalFile> Results         {             get { return new ReadOnlyCollection<LocalFile>(m_Results); }         }              public class SearchResults : ReadOnlyCollection<LocalFile>             {             public SearchResults(IList<LocalFile> iList) : base(iList) { }                  #region Results Filters             public DateTime OldestFileModified             {                 get { /* Does what it says. */ }             }                  public ReadOnlyCollection<LocalFile> ResultsWithoutProcessFiles()             {                 return new ReadOnlyCollection<LocalFile> ((from x in this                                                            where x.FileTypeID != FileTypeIDs.ProcessFile                                                            select x).ToList());             }             #endregion         }     }      ...with the implication that OperationSuccessful is accompanied by a number of more interesting properties on how the operation went, and OldestFileModified and ResultsWithoutProcessFiles() also have several more siblings in the Results Filters section.


what should a developer know/address to build commercial Android Apps?

Android and mobile development is an exciting area of development. As it is a new discipline, what would be expected of an android developer to build commercially robust applications in terms of skills ? The problem that I and, i think, many other "noobs" into the technology would like to know are the areas of technical skills and the progression to the required advanced topics that goes beyond the the very basics provided by Google. There is _a lot_ of information that's quite useful but its not organised into categories of discipline nor order. **Update** : Look at it this way. If you're a senior dev, and needed to get a fellow colleague upto speed on Android for a particular project, (at your discretion for this question), what would you do ?


How can a CAPTCHA be integrated into a community?

I'm planning on making a **simple discussion feature** for a web framework I'm building. It should:   * allow anonymous posting   * block spam bots  The obvious answer is to use a generic " **captcha** " plugin, however I think there are some **creative opportunities** here that I would like to explore, e.g. questions like:   * (simple math) what is four + three? **___**   * (pop culture) who sings like a virgin? **___**   * (history) last name of first U.S. president: **___ __**   * (pictures) [picture of Obama], who is this?: **___ ___**   * (contextual) what year was our association founded? **___ __**   * (company) last name of our personnel director: **___ ___**   * (current events) the country that toppled Muburak: **___** The captcha could actually be used to **teach people about the community** , information that they had to look up, etc. Or these could be **collected from users** of the community, the ones which got approved and used would earn them reputation points. **What is the best way for a CAPTCHA to be designed so that it not only blocks spammers but helps reflect the knowledge of a community?**


Made a windows gadget for the local tram company without request. What now?

I'm too lazy to look at a pdf/table when the next tram is, so I did a windows widget that always tells me when the next one is. You can add, edit and delete trams to be watched. I don't work for this company, but I have tried to make it as professional as possible and I even threw the company logo into the widget. I believe other people could also use this and I would like to send this to the company. What's the best way to send it? Should I send photos, a video explaining the widget, the widget itself? I don't think they would pay me for this, nor do I expect this, but I'd love to make an internship there, if the spot is available. I could see myself developing an iPhone/Android app for the company, seeing that the only thing their app does is sell tickets and I'm sure other people would love to be able to see on their phone when the next train is. Even if they don't have an internship available, I'd still find it pretty cool if they made it available at their website and I somehow got credits for it. I think it's a pretty nice thing to have in the CV. But I wouldn't be interested if they are just going to publish it without any credits. What do you guys think? By the way, only a couple of trains and stations are available, as I don't have their database and right now what I have to do is manually insert the schedule. But this is very easy to add/change once they provide it. PS: Seeing this is career advice, to make it general, I guess the question is, how do I send software that was not requested, but could be useful, to a company? PS2: I'm sorry that I couldn't think up of a short concise title!


Create an Objective-C category to route methods depending on a specified type

For one project, I needed to find a solution to avoid code like this:               if ([self.desiredColor isEqualToString:@"Red"])         [self constructRedMenu];     else if ([self.desiredColor isEqualToString:@"Blue"])         [self constructBlueMenu];      So I decided to create an category of NSObject. You can find the open-source code here: https://github.com/JeanLebrument/NSObject-MethodCallDependingType But I have only been developing on iOS for a few months and I would like to have opinions from more experienced iOS developers. Is there any risk to the stability of the app using this Category? Any constructive comments or opinions are welcome! Edit : Change the exemple of using this category in this post and on GitHub.


Kerberos web authentication

I'v developed an internal singe-page web-app (unix, apache & postgresql) protected by a simple login page. Currently, the users have their own login role with a password. This is starting to get cumbersome for a couple reasons:   1. Users have multiple passwords (for my web-app and Active Directory, the company-network is windows).   2. Storing user information in two different places (would like to centralize). I've been looking into Kerberos to the point, I've set-up a KDC and am able connect to the database through GSSAPI authentication (command-line only). From what I understand I should be able to use my own KDC that will integrate with Active Directory. My problem I'm working through at the moment is web-app authentication via kerberos: If a user is on the web - how can I obtain/verify kerberos credentials? Can I store the credentials in a cookie? Do I have to resort using OAuth,Webauth, or something similar? To clarify, What I want to do is: If a user doesn't have valid credentials, give them the login page to obtain credentials (via kinit, but how through the browser?) and return valid credentials. (how can I store credentials in browser, can I create a cookie from the Kerberos credentials?). I've googled, and read a fair-few pdf's and web-resources, but unfortunately none of them were able to dumb it down enough for me to get a solid grasp of how to accomplish kerberos web authentication. If you didn't notice, I'm confused on how to piece everything together and would appreciate a conceptual over-view of how everything fits together.


Should fresh grads join startups keeping in mind the future?

I'll graduate next year and the campus drive has secured me a couple of jobs with what we call the "big" companies. But I had approached a startup recently as I really liked their projects and am also currently working with them, as an intern (though I work from home, keeping contact with my mentor there). I like the way they work, and they're offering me a position of software engineer with a nice pay-package. But the question is, if I join this startup as my first job, will I, should I choose to switch, be accepted in any of the "big" companies? I'm sure many of you must have encountered such a situation from either perspective - the job seeker or the employer.


How does learning assembly aid in programming?

I have been programming in higher level languages (Python, C#, VBA, VB.NET) for around 10 years and I have completely zero understanding on what's going on, "under the hood." I am wondering what are the benefits of learning assembly, and how will it aid me as a programmer? Can you please provide me with a resource that will show me exactly the connection between what I write in higher level code to what happens in assembly?


Is There Any Benefit to Learning Machine Code?

I mostly work in Python and Ruby, but I recently decided to learn some C so I have a better feel for how a computer _actually_ works. I've been wondering whether it is possible to take this even a step further. Does anyone learn machine code (whatever C is compiled into) anymore? Would I benefit from taking some time to learn it?


Freelancer.com—Any opinions?

Has anyone ever tried Freelancer.com (former GetAFreelancer.com)? Does anyone have any opinions/feedback on the site? I would like to start some projects as a freelancer but I would really like to get some opinions on the site to get started.


What is a good way to represent (programatically) graphs/networks?

SO I have made this program dealing with cities and the roads linking them, and I am wondering if anyone could point me towards a way to represent this "network" graphically (in 3 or 2Ds). Could be either a specific programming friendly file format (which I could easily generate an instance of programatically), or a specific language's api or library for such representation. My current work is in Java, but if there's a solution in an other language it's not a problem.


Good design for class with similar constructors

I was reading this question and thought that good points were made, but most of the solutions involved renaming one of the methods. I am refactoring some poorly written code and I've run into this situation:               public class Entity {            public Entity(String uniqueIdentifier, boolean isSerialNumber) {         if (isSerialNumber) {           this.serialNumber = uniqueIdentifier;           //Lookup other data         } else {           this.primaryKey = uniqueIdentifier;           // Lookup other data with different query         }       }          }      The obvious design flaw is that someone needed two different ways to create the object, but couldn't overload the constructor since both identifiers were of the same type (`String`). Thus they added a flag to differentiate. **So, my question is this:** when this situation arises, what are good designs for differentiating between these two ways of instantiating an object? **My First Thoughts**   1. You could create two different static methods to create your object. The method names could be different. This is weak because static methods don't get inherited.   2. You could create different objects to force the types to be different (i.e., make a `PrimaryKey` class and a `SerialNumber` class). I like this because it seems to be a better design, but it also is a pain to refactor if `serialNumber` is a `String` everywhere else.


Can anyone recommend a good resource for finding SQL Server training?

Either on site or off site training (no web training). I've been Googling but have only found a few companies. It would be nice to find something that offers reviews on various companies that provide training... Related to Can anyone recommend a good company that does SQL Server training?


How to avoid general names for abstract classes?

In general it's good to avoid words like "handle" or "process" as part of routine names and class names, unless you are dealing with (e.g.) file handles or (e.g.) unix processes. However abstract classes often don't really know what they're going to do with something besides, say, process it. In my current situation I have an "EmailProcessor" that logs into a user's inbox and processes messages from it. It's not really clear to me how to give this a more precise name, although I've noticed the following style matter arises:   * better to treat derived classes as clients and named the base class by the part of the functionality it implements? Gives it more meaning but will violate is-a. E.g. EmailAcquirer would be a reasonable name since it's acquiring for the derived class, but the derived class won't be acquiring for anyone.   * Or just really vague name since who knows what the derived classes will do. However "Processor" is still too general since it's doing many relevant operations, like logging in and using IMAP. Any way out of this dilemma? Problem is more evident for abstract methods, in which you can't really answer the question "what does this do?" because the answer is simply "whatever the client wants."