Should I use a unit testing framework to validate XML documents?

From http://www.w3.org/XML/Schema: > [XML Schemas] provide a means for defining the structure, content and > semantics of XML documents. I'm using an XML Schema (XSD) to validate several large XML documents. While I'm finding plenty of support within XSD for checking the structure of my documents, there are no procedural if/else features that allow me to say, for instance, If Country is USA, then Zipcode cannot be empty. I'm comfortable using unit testing frameworks, and could quite happily use a framework to test content integrity. Am I asking for trouble doing it this way, rather than an alternative approach? Has anybody tried this with good / bad results? -- **Edit** : I didn't include this information to keep it technology agnostic, but I would be using C# / Linq / xUnit for deserialization / testing.


Is aspect-oriented programming a misnomer?

From everything I have learned about "Aspect-Oriented Programming" or "Aspect- Oriented Software Development," labeling it as a programming paradigm or methodology appears to be inaccurate. From what I can tell it is not a fundamental technique for programming. To nail down what is meant by "paradigm" and "methodology," please refer to the following definitions from the American Heritage Dictionary. Compare how well or poorly "Object-Oriented Programming" applies to each vs. how well AOP fits. > Paradigm: A set of assumptions, concepts, values, and practices that > constitutes a way of viewing reality for the community that shares them, > especially in an intellectual discipline. > > Methodology: A body of practices, procedures, and rules used by those who > work in a discipline or engage in an inquiry; a set of working methods. "Evidence-based medicine" satisfies the definition of paradigm, but "hysterectomy-based medicine" would be a misnomer because the problem space is too narrow. I am getting the impression that AOP may be misnamed because based on the "oriented-programming" suffix, AOP is alleging to be both a paradigm and a methodology in the same way "Object-Oriented Programming" is. Both of these terms (paradigm and methodology) indicate a fundamental technique, where what I understand about aspects is a technology for solving a narrow problem scope, maybe comparable in magnitude to the static variable feature of Java. If it's true that aspects solve a narrow set of problems, and AOP isn't a misnomer, then why shouldn't all programming techniques be given the "oriented-programming" suffix, such as "inheritance-oriented programming," "dependency-oriented programming," or "scope-oriented programming?"


How to verify/prove orthogonality of a programming language?

I know the concept of orthogonality, but from a programming language point of view, is there a way to verify/prove it? For instance in C#, one can use `public` or `static` for a method signature. You can use either or both and they wouldn't interfere with each other, so they are orthogonal to each other, right? My question is, how do I go about the rest of features, particularly features that are not related to each other? Do all the features have to coexist/stack together? Is there a programming language that is 100% orthogonal?


Are XML databases good for small to medium non-programming business project management?

Last couple of weeks I've been searching for some project management solution for a place where I work at the moment. There we rely on excel spreadsheets, but we meet limitations like access rights and concurrency (I have to work with a local copy of a spreadsheet and twice a day dump it to the main spreadsheet) and software versions compatibility (some people have the latest office, some have 2003). Redmine was the closest, but it really does not meet our needs - excel spreadsheets suck, but they have some stats tools, and anyone can edit them without any extra learning. Now, not to be immediately (or at all) proposed to use in production, but rather as a proof of concept, I would like to play with OODBMS or XML DB on my spare time, to make a web app for managing repetitive tasks which can however vary, for a group of 5-10 people, to be used not instead of 'serious' solutions, but maybe along with them. So I wonder, would these DB management systems work here or should I learn relational databases and ORM in details instead of wasting my time with these? Would they allow to clone existing workflows descriptions and fine tune them for another task? Would they be difficult to maintain?


How long would it take to learn Python?

I have decided to take the time out after work to learn Python. Python appeals to me because at work (Web and eLearning Company), I have to follow out very repetitive tasks like delete all these tags, rename all these tasks and even more advanced repetive tasks. Additionally it would be good for me to get an understanding of Python first because of its fairly easy to learn syntax. How long would it take to learn the basics of Python?


Why are there so many spaces and line breaks in Unicode?

Unicode has maybe 50 spaces > > \u0009\u000A-\u000D\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000][\u0009\u000A-\u000D\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000 and 6 line breaks > not only CRLF, LF, CR, but also NEL (U+0085), PS (U+2029) and LS (U+2028). Maybe I could understand most of the spaces and PS ("Paragraph separator"), but what are "Next Line" and "Line separator" good for? It all looks like invented by a very big committee where everybody wanted their own space and the leaders were granted one line break each. But seriously, how do you deal with it when your programming language doesn't support it (or does it wrong as e.g. Java does)?


Is LISP still useful in today's world? Which version is most used?

I try to teach myself a new programming language in regular intervals of time. Recently, I've read how Lisp and its dialects are at the complete opposite end of the spectrum from languages like C/C++, which made me curious enough to know more about it. However, two things are unclear to me, and I'm looking for guidance on them :   1. Is LISP still practiced/used in todays world, or is it a legacy language like FORTRAN/COBOL ? I mean, apart from maintaining existing code, is it used on new projects at all ?   2. What is the most widely used dialect ? I came across Scheme and Common Lisp as the 2 most prevalent dialects, and wanted your opinion as to which is the most favored/useful one to learn - and would be immensely gratified if you can suggest any resources for a rank beginner to start from. While eager to learn a language which is fundamentally different from the procedural languages I'm used to, I don't want to invest undue effort in something if its totally obsolete - I'd still learn it if it was professionally "dead", but only with an academic perspective...


When would you want two references to the same object?

In Java specifically, but likely in other languages as well: when would it be useful to have two references to the same object? Example:               Dog a = new Dog();     Dob b = a;      Is there a situation where this would be useful? Why would this be a preferred solution to using `a` whenever you want to interact with the object represented by `a`?


API naming and namespacing

Is it right or more beautiful to name the functions with an prefix, like in Qt? Or using "many" namespaces, but 'normal' names for functions? For example, ` slOpenFile(); //"sl" means "some lib" vs some_lib::file_functions::openFile(); ` **Update:** I've read somewhere that the first variant(using some prefix) is better, because the API users can perform 'fast' search among the documentation and in the Internet. E.g. by typing the magic prefix search engine starts to advice the exact functions. Is it enough to use the first variant?


Is it technically possible to write a JS interpreter using Lisp macro readers, in the browser?

Using macros readers, it's possible to interpret JavaScript, and have it compiled just like normal Common Lisp code. Hence getting the benefits of Lisp implementations, notably their performance. Which would mean having native performance in the browser, without cheating. Would it be technically possible to build this for the browser? I'm mainly worried about the DOM bindings.


In which step of a software development life cycle I should design my computing algorithm?

In software design, we usually take care of UML diagrams and architecture design. But in case of a data analysis software, we must pay attention to design algorithms and stuff like that. Consider the case of a face detection software which needs AI. Do we need to design AI part of the software explicitly in software design? **P.S:** My manager says that it must set clear in feasibility study and be so clear that we could design it in design steps. Is he correct?


Primer on moving around in MVC

It was suggested on my Stack Overflow question that this might be better suited to this site, so I'm cross-posting it. I'm working on my first ground-up build of an MVC site. I have a collection of views, a collection of models, and I've tested most of my views and fixed the obvious bugs. The last step I need to do is tie the views together - to enable the user to click links/buttons and move between them. Most of my Google searches for Actions and ActionLinks in MVC/Razor lead me back to StackOverflow, to very specific questions which don't really help me out - the questions assume what I'm trying to learn. I'm trying to learn at a high level the way to pass various things to controller methods (i.e. override the controller method for a view to accept 2 parameters versus 3, or to accept POST data, understand what will be passed along from one view to another action from an Html.Action call, etc).


Do you tend to write your own name or your company name in your code?

I've been working on various projects at home and at work, and over the years I've developed two main APIs that I use in almost all AJAX based websites. I've compiled both of these into DLLs and called the namespaces Connell.Database and Connell.Json. My boss recently saw these namespaces in a software documentation for a project for the company and said I shouldn't be using my own name in the code. (But it's my code!) One thing to bear in mind is that we're not a software company. We're an IT support company, and I'm the only full-time software developer here, so there's not really any procedures on how we should write software in the company. Another thing to bear in mind is that I do intend on one day releasing these DLLs as open-source projects. How do other developers group their namespaces within their company? Does anyone use the same class libraries in personal and in work projects? Also does this work the other way round? If I write a class library entirely at work, who owns that code? If I've seen the library through from start to finish, designed it and programmed it. Can I use that for another project at home? Thanks, _**Update_** _I've spoken to my boss about this issue and he agrees that they're my objects and he's fine for me to open-source them. Before this conversation I started changing the objects anyway, which was actually quite productive and the code now suits this specific project more-so than it did previously._ _But thank you to everyone involved for a very interesting debate. I hope all this text isn't wasted and someone learns from it. I certainly did._ _Cheers,_


How to report on a bug to the boss

I am a programming intern who has worked for a company for 6 mnths now (this is my 1st programming job so I have 6 mnths experience). I am a 1 man team right now & I am creating a mobile application using the Mosync C++ API. **I am looking for advice on how to report a bug to a boss who is not a programmer. I have had trouble in the past explaining the gravity of a bug/programming issue & he will say "just work on something else for a couple of days" with the expectation it will be fixed in a couple of days anyway. The major problem is that he thinks that amount of effort directly relates to the outcome of solving a bug & if it is not fixed after a couple of days its due to lack of effort or skill** How can I explain that I cannot determine how long a bug will take to fix, & that if it does take a long time to fix its not related to lack of effort or skill? Some background information: I have a bug in a the current project(mobile app) I am working on. The mobile app was complete but my boss wanted me to add features to it. After adding a feature the app now crashes after transitioning screens X amt of times & it is very difficult to replicate the bug(seems random & intermittent) but it is also very serious because releasing an app that randomly crashes is obviously very bad. As a young programmer I know that my experience is most likely to blame for an error in my app & that there is much I could have done to avoid issues like this such as regression tests, maybe better app architecture design to allow for component based development(add new features that work well with existing ones). But I also know that bugs are a fact of programming & it will always happen.


Pro's/Con's to database table layout as it relates to maintenance & extensibility

Basic pseudo class layout below...               class Location(): # Class containing information about a location.         id         address_one          class CustomerLocation(Location):         customer_id         account_rep           class VendorLocation(Location):        vendor_id        drop_ship_cut_off_time      Let's say you have locations which are going to be used to store location info for customers and vendors. What would be the pro's/cons of the three options in how they relate to application maintenance and extensibility...   1. One large table containing all fields.    2. One large table containing all common fields with related tables containing specialized information about the large table records.    3. Many small tables containing all fields related to specific uses.CustomerLocation table VendorLocation without using a "master table" for common fields.


Abstract methods vs instance variables for reusable objects

I have quite a bit of Java code that I'm re-working to be re-used. The problem is that there are many pieces that are project specific so there are ends up being a higher level of coupling between the application project and the code base project. Compare to following situations where we use a class that implements the use of abstract methods to get the resources out of the child class, and one where we simply declare instance variables. Abstract methods:               public abstract class SuperBaseClass {              public abstract int getNumberOne();         public abstract String getStringOne();         public abstract String getStringTwo();              public printStuff() {             Log.i("IntAndTwoStrings", String.format("%i %s and %s",                                 getNumberOne(), getStringOne(), getStringTwo()));         }          }          public class ReusedAppClass extends SuperBaseClass {              public int getNumberOne() {             return 1;         }         public String getStringOne() {             return "String1";         }         public String getStringTwo() {             return "String2";         }              public ReusedAppClass() {             printStuff();         }          }      Instance variables:               public class SuperBaseClass {              protected int numberOne;         protected String stringOne;         protected String stringTwo;              public printStuff() {             //Possibly throw RuntimeExceptions if the app didnt set these             Log.i("IntAndTwoStrings", String.format("%i %s and %s",                                 numberOne, stringOne, stringTwo));         }          }          public class ReusedAppClass extends SuperBaseClass {              public ReusedAppClass() {             numberOne = 1;             stringOne = "String1";             stringTwo = "String2";             printStuff();         }          }      Is there a trade-off? Is the abstract method situation overkill, or is this what abstract classes were created for?


What is the purpose of NaN boxing?

Reading 21st Century C I arrived at chapter 6 at the section "Marking Exceptional Numeric Values with NaNs", where it explains the use of the bits in the mantissa to store some arbitrary bit patterns, to use them as markers or pointers (the book mentions that WebKit uses this technique). I'm not really sure I understood the utility of this technique, that I see as an hack (it relies on the hardware not caring on the value of the mantissa in a NaN) but coming from a Java background I'm not used to the roughness of C. Here is the snippet of code that sets and reads a marker in a NaN               #include <stdio.h>     #include <math.h> //isnan          double ref;          double set_na(){         if (!ref) {             ref=0/0.;             char *cr = (char *)(&ref);             cr[2]='a';         }         return ref;     }          int is_na(double in){         if (!ref) return 0;  //set_na was never called==>no NAs yet.              char *cc = (char *)(&in);         char *cr = (char *)(&ref);         for (int i=0; i< sizeof(double); i++)             if (cc[i] != cr[i]) return 0;         return 1;     }          int main(){         double x = set_na();         double y = x;         printf("Is x=set_na() NA? %i\n", is_na(x));         printf("Is x=set_na() NAN? %i\n", isnan(x));         printf("Is y=x NA? %i\n", is_na(y));         printf("Is 0/0 NA? %i\n", is_na(0/0.));         printf("Is 8 NA? %i\n", is_na(8));     }      it prints:               Is x=set_na() NA? 1     Is x=set_na() NAN? 1     Is y=x NA? 1     Is 0/0 NA? 0     Is 8 NA? 0      and at JSValue.h webkit explains the encoding, but not why it's used. What is the purpose of this technique? Are the benefits of space/performance high enough to balance its hackish nature?


What do you think about gems and eggs? Alternatives?

I've read recently some criticism (see 1, 2, 3) about the packaging distribution system of two popular programming languages: Ruby gems and Python eggs. The most important argument stated against them is that they replace the system package manager (in case there is one, as in every Linux distribution), which makes eggs and gems difficult to track, code difficult to patch, and so on. Are actually eggs and gems right? In case not, are there any alternatives to distributing Python or Ruby modules? Should developers focus on taking advantage of package manager (apt-get, pacman, ...) capabilities?


Returning an object or false in dynamic languages

Consider the following JavaScript function:               function Foo() {       function getPreferences() {         if ([there is an existing preferences object]) {           return preferences;         }         return false;       }     }      The calling code is:               var foo = new Foo();     var prefs = foo.getPreferences();     if (prefs) {       // do something with prefs     }        * Is the pattern of returning an object if it exists, or false otherwise, seen as a good or bad practice? Other alternatives I can see are to return an empty object {} or null.   * Does this pattern have a name?


Under which area of Artificial Intelligence is my knowledge store?

I've a maturing idea regarding a knowledge store. For the purposes of this question, the store would be used by a police force for the recording and querying of crimes. I believe that historically, police forces used to hold vast index card systems, allowing cross-correlation and querying. The knowledge store would contain a collection of known facts, collated in a way that supports unknown future questions. Obviously if I knew the future questions "how many crimes this month", "what tool is most commonly used for breaking and entering" it would be fairly straightforward to store, collate, and present the data. My requirement for unknown future questions presents the problem. I imagine a series of authors collating details of crimes. They'd submit details, making heavy use of relationships: "crime **occurred** in the evening", "burglar **used** a brick", "crime **committed** by Person_A". The when considering a crime, the user would enter "brick" and be presented with collated knowledge related to that concept.   * frequently used at night   * frequently used in opportunist burglary   * frequently used in in assault   * most common entry object used in Neighbourhood D   * most used object by Person_A, Person_B The user would then browse/wander through the information set learning more about past crimes. The underlying information store seems close to that in a Graph Database - but I don't want to "sleepwalk" into using one of those if there's a more natural, AI based solution that not only solves the storage/retrieval problem but which also provides expert-system style deductions.


Trying to find video of a talk on the impact of memory access latency

Some months ago I stumbled across a video on the internet of somebody giving a very good talk on the impact of memory access latency on the execution of programs. I'm trying to find the video again; maybe you know what video I mean and were I can find it. This is what I remember about the talk/video:   * I don't remember the title and it may have been broader, but the talk was a lot about impact of memory access latency in modern processors on program execution.   * The talk was in English and most likely the location was in America.   * The speaker was very knowledgeable about the topic, but the talk was in an informal setting (not a conference presentation or university lecture). I think the speaker was known to the audience and may even have been famous (I don't remember)   * The audience may have been a computer club / group of a local community or company (but I don't remember for sure)


Can I use a LGPL licensed library for my web project

I am looking to use a javascript libray licensed under the LGPL license v3. From what I have read so far, I understand that If I do not make any modifications to the library, I can use the library without any restrictions. But if I modify the library, I need to make the modified version available to the end users and also enable them to link the library dynamically. Since I am using javascript, my code is anyways open to the end user. Also the user can dynamically link to library through the debug console. So my question is, do I need to do anything explicitly since javascript is already open to users ? Also, are there any other restrictions that apply which I may have missed out ? Note: I found other answers that describe LGPL with respect to any application. But I am looking for an answer that describes how LGPL applies to javascript specifically.


Is there a representation for mixins or traits on UML?

Is there a representation for modern programming constructs that are becoming common in modern OOP/hybrid languages like mixins/traits/categories/partial classes ?


Model View Presenter over Model View Controller

> **Possible Duplicate:**   >  Building websites, which is the better approach MVP or MVC? I am trying to learn the difference between the MVC and MVP models. So far, I do not see much difference in terms of how they are architecturally set up. So my question is when should the MVP model be chosen over the MVC model? Are there situations where one is better than the other?


Blank lines in C

I'm working through K&R and I notice that their code is extremely tightly spaced. I haven't developed C since at University, but professionally most source from other languages I've worked in has used blank lines to aid readability. Is C generally more tightly packed or is it a historical matter related to display size in the 70s? Exercise 1-16 seems to hinder readability by, for example, an `if` immediately after `for` loop that doesn't have braces.               /* mygetline: read a line into s, return length */     int mygetline(char s[], int lim)     {       int c,i;            for (i=0; i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)         s[i] = c;       if (c == '\n') {         s[i] = c;         ++i;       }       s[i] = '\0';       return i;     }


Recommended library for getting 2d coordinates of head movement

My target platform is Mac OS X, but I'm looking for a library that will give me a 2D coordinate of someone's head, via the built in webcam. My requirements are that it be near real time if not real time, give me a 2d screen coordinate I can write out to a log.


How do I publicize a cool bookmarklet?

I wrote a really cool bookmarklet and now I want to tell everyone. I have absolutely no idea where to go, is there some sort of exchange for these things? In case anyone is curious: I was tired of having to retype URLs from my desktop browser on to my phone browser, with its itsy-bitsy keyboard, so I wrote a bookmarklet that converts the current URL to a QR code, which I can scan in a few seconds.               javascript:window.location="http://chart.apis.google.com/chart?chs=250x250&cht=qr&chl="+escape(window.location)


how to get from 1 byte to 2 bytes

I just got something I can't understand, so we have `1 byte`, which is `8 bits`, which is `2^8`. Now `2 bytes` should be `2 * 1 byte`, which is `2 * 2^8 = 2^9`, but actually 2 bytes is `2^16`. What I'm missing here? I mean, it seems like `2 bytes` isn't `2 * 1 byte`, it's more like `1 byte * 1 byte`, but this should give you `byte^2`, which doesn't make sense. Can Please someone explain me some concept I am getting wrong here? Thanks in advance.


Creating java package on ubuntu?

I am new to java. Here I am trying to create java package. And try to compile it from another directory . But there is an error like bash: `/home/gaurav/Desktop/package2/B.java: Permission denied` Here is My first code and directory is /home/Desktop/package/A.java               package package1;     public class A     {     interface A1     { void show();       void display();     }     }          class B extends A     {      public void show()     {     System.out.println("This is show method()");     }     public void display()     {     System.out.println("this is Display metthod()");     }     }      For compilation I did this command it's works fine. Working Directory is /home/gaurav > javac /home/gaurav/Desktop/package/A.java When I try to compile B.java which is in my Other drive > /media/gaurav/iPlay/package/B.java               package package2;     class B     {     public static void main(String args[])     {         System.out.println("Reached in Main method of B");         package1.A Object = new A();     }     }      I tired this vommand (grom previous working directory)               javac -cp /home/gaurav/Desktop/;/media/gaurav/iPlay/package/B.java       _Error Comes_               javac -cp /home/gaurav/Desktop/;/media/gaurav/iPlay/package/B.java      javac: no source files     Usage: javac <options> <source files>     use -help for a list of possible options     bash: /media/gaurav/iPlay/package/B.java: Permission denied      What i am doing wrong? Please it my assignment I am not able to move further without this. I changed permissions.


How far to go with Domain Driven Design?

I've read a little about domain driven design and the usage of a rich domain model, as described by Martin Fowler, and I've decided to put it in practice in a personal project, instead of using transaction scripts. Everything went fine until UI implementation started. The thing is some views will use rich components that are backed up by unusual models and, thus, I must transform the domain model into what is used by those components. And that transformation is specially "complex" in the view-to-domain portion, up to the point that some business logic is involved. Wich brings me to the questioning: _where_ should I do these adaptations? So far I've got the following conclusions:   * Doing it in the presentation layer is good because, well, if that layer imposes restrictions in it's model, then it should be the one to handle them. But it's bad because there'll be some business leakage.   * If I do it on the services objects (controllers, actions, whatever), then it'd be good because there won't be any change to the domain API just because of presentation layer, but it's bad because then I'd have transaction scripts, wich is not the intended design.   * Finally, if I do it on the domain model, there'd be no leakage of business logic at all. But in the future I could expect an explosion of the API into a series of methods designed just to handle that view-model <-> domain-model adaptation. I hope I could make myself clear on this.


Can I link GPL and CDDL if I do not distribute?

Perhaps this is an esoteric question, since I will never distribute the code in question and I can fairly easily avoid using GPL code, but I'm curious and it's bugging me--but not enough to consult a lawyer. What is more, I think I am more interested in the morality of this issue than the legality. I have a program that I use under the CDDL. The program had a pretty small user base to start with and the creators now offer a later version, which is closed source. Thus I have no interest in contributing my minor modification back to the project. For my use only, I would like to include a single module that is GPL to avoid a small amount of tedious coding. If I were to distribute the result, it is clearly a violation of the terms per various sources such as the FSF's comments on GNU GPL and CDDL. If I have correctly tracked the source of the incompatibility back to the MPL from the link from wikipedia, all of the issues seem to arise with clauses that occur with distribution. This would imply to me that I can legally modify and combine GPL and CDDL, but cannot legally distribute the combination. Setting aside the legality, does anyone see any moral issues with making a minor tweak to a program for my own use that introduces this incompatibility for distribution?


The difference between waterfall model and object oriented model?

Please explain the difference between the waterfall model and the object oriented model. Since the books and web sites that I've seen didn't provide much information about it, I need someone to explain it to me.


How can I keep track of all the websites I've made like a proper business would?

A few other students and I are forming a group that wants to become good at what we do: websites. We are making websites for free for friends at the moment in order to get ourselves some experience and to learn from each other. We are about to finish our first website this week. In 6 months time we plan to have a portfolio and hope to start charging for websites. The issue is that we are all beginners and we are unsure about how to keep records of the websites we do. It is important as we may want to maintain a few websites or add to them later on. How does a proper web design business keep records of all info needed? Is there a program or software package we can use?


Is there a download limit to ios apps?

With reference to iOS 7. I couldn't find any Apple documents with regards to this. Are we able to download any size of documents and manage them ourselves (within our app say < 100MB)?   Example, we roll out new content every month. Thus after downloading contents for this month, we should remove last month's content to save space. Content doesn't have to be backed up and will be stored in Caches folder.


Avoiding the Anaemic Domain - How to decide what single responsibility a class has

Even after reading a bunch I'm still falling into the same trap. I have a class, usually an enity. I need to implement more than one, similar operations on this type. It feels wrong to (seemingly arbitrarily) choose one of these operations to belong inside the entity and push the others out to a separate class; I end up pushing _all_ operations to service classes and am left with an anaemic domain. As a crude example, imagine the typical Employee class with numeric properties to hold how many paid days the employee is entitled to for both sickness and holiday and a collection of days taken for each.               public class Employee     {         public int PaidHolidayAllowance { get; set; }              public int PaidSicknessAllowance { get; set; }              public IEnumerable<Holiday> Holidays { get; set; }              public IEnumerable<SickDays> SickDays { get; set; }     }      I want two operations, one to calculate remaining holiday, another for remaining paid sick days. It seems strange to include say, CalculateRemaingHoliday() in the Employee class and bump CalculateRemainingPaidSick() to some PaidSicknessCalculator class. I would end up with a PaidSicknessCalculator and a RemainingHolidayCalculator and the anaemic Employee entity as seen above. The other alternative would be to put both operations in the Employee class and kick Single Responsibility to the curb. That doesn't make for particularly maintainable code. I suppose the Employee class should have some initialisation/validation logic (not accepting negative alowances etc.) So maybe I just stick to basic initialisation and validation in the entities themselves and be happy with my separate calculator classes. Or maybe I should be asking myself if Anaemic Domain is actually causing me some tangible problems with my code.


Flowchart with subroutine

I am not really sure how to correctly describe my question, so please forgive me if this is a duplicate. I am creating a flowchart for my program where I implement a method. Let's assume I call this method **someMethod**. The C code could look something like this:               bool someMethod(int Foo, int Bar)     {         foo += 5;         bar -= 5;         return (foo == bar);     }      This means that my flowchart will have a subroutine block where I call this function. But how do I correctly show the reader which integers I pass? And when I create the flowchart of "someMethod", I face a similar problem: how do I correctly show the reader that Foo and Bar are passed parameters? **EDIT:** From what I have found so far, people have solved it by using the Start block as some sort of function declaration block, where they would replace Start with _someMethod_ and place _foo_ and _bar_ on a new line. But from what I understand this isn't good practice since the start and end of every flowchart should be blocks containing respectively _Start_ and _Stop_. I also have seen people using an IO-block as the first non-start block where they would _"read"_ the passed parameters but that just seems like a hack. But unless there are better ideas, I suppose I'll have to go with that. **EDIT 2:** I am starting to wonder if this question is actually valid for this site. Is nobody using flowcharts anymore as a project preparation method?


Would learning any natural language in particular further your programming career?

It seems apparent that English is the dominant international language for programming based on previous P.SE questions (though a highly upvoted comment correctly points out that asking a question like that on a predominantly English site will skew the results). However, is there benefit in learning a foreign language for software development? For example, do the Chinese have completely different software tools, languages, technologies, etc? How about Japanese, Russian, and other non-latin based languages? **Is there an entire world of software development languages, tools and so on that only exist in these other languages?** **Or do people that know these languages use the tools and languages we know and love?**


Design pattern for window management in a Java Swing app

I've just started creating my very first little Java Swing app. When the program opens, it brings up a single, simple window with a label and a couple buttons. Clicking one of those buttons is supposed to wipe out the welcome screen and replace it with a totally different panel. I'm not sure what the best way to create that functionality is. One method would be to pass my `JFrame` as an argument into... just about every other component, but that feels hacky to me. Or, there's making each panel double as an action listener, but that doesn't seem right, either. Is there a design pattern I should be applying here? "Replace the contents of the main -- and only -- window" must be a reasonably common operation. A name for the pattern would be enough; I can use Google on my own from there. (I wouldn't say no to a longer explanation, though.)


While doing my pre-research for this question, I found that there isn't much well-organized information about Java Swing best practices out there on the Internet. So I figure I'll give Stack Exchange a shot at building that One Great List. What are the best practices of Java Swing development? What have you found to work for you, and why?


Saxon genitive in variable names - should we avoid it?

consider case of following collisions with plurals: `publisher_tree` instead of `publishers_tree` (genitive) which will be for plural (e.g container/list) the same `publishers_tree`. For me english is foreign language so I will appreciate the hints for good practice in naming.


Haskell AND Lisp vs. Haskell OR Lisp

I currently code with C, C++, and Python. I'm wanting to pick up a functional programming language, and right now I'm leaning toward Haskell. I do NOT want to start a "Haskell vs Lisp" war here; what I want to know is this: **if I learn Haskell primarily for exposure to functional programming, what benefits, if any, will I gain from later learning Lisp?** * * * Update: Thanks everyone for your answers. Now all I need to do is pick a dialect of Lisp, but _that's_ a question for another time.


When to write Abstract code and when to be more specific?

I'm working on a small tool as a toy project to show the difference between two directories, showing which files/directories were added, removed, modified, etc. I was trying to represent these changes as simply 'ChangeItem' objects, without distinction between whether it was a file or directory. However, that created a lot of problems, e.g how to display them in a tree, how to know who the parent of a child is, etc. And it was also very unintuitive. I then split the changes between directory changes and file changes. That immediately made it very easy to code and to understand what was going on. Now its a lot simpler to select all files in a directory, etc. My question is, how can one know whether to use abstraction or to get more specific in their code? How can you tell if you have too much or too little abstraction?


How do you document your large projects?

We've currently got a small team of programmers (3 people) but are expecting to add more soon and are starting to keep documentation on things that need to be interacted with a lot, or reusable generic classes we've written. Originally we were storing all this information on writeboards @ backpack, but it doesn't support code highlighting or much other formatting. My current choice has to been to install Media Wiki along with a javascript based syntax highlighter and it seems okay except for lack of being able to put things in a nested structure (the plugins I've found are either broken or too lacking in documentation). While this solution seems suitable now, I'm wondering what other approaches other teams take to storing/organizing large amounts of documentation to an ongoing, ever growing project.


How can a route finding program avoid obstacles/locations when calculating routes?

Do you delete nodes from the underlying graph representation? Or is there a more elegant way to do it?


Is it a good practice to choose the highest warning level in C++ programming?

I used to select the default warning level in C++ programming. For example, in VS, the default warning level is **`Level3 (/W3)`** and **`No (/WX-)`** (don't treat warnings as errors). I am wondering is it a good practice to choose highest warning level in C++ programming, e.g. **`EnableAllWarnings (/Wall)`** with **`Yes (/WX)`** (treat warnings as errors)? Any advice will be much appreciated.


Refactoring in domain driven design

I've just started working on a project and we're using domain-driven design (as defined by Eric Evans in _Domain-Driven Design: Tackling Complexity in the Heart of Software_. I believe that our project is certainly a candidate for this design pattern as Evans describes it in his book. I'm struggling with the idea of constantly refactoring. I know refactoring is a necessity in any project and will happen inevitably as the software changes. However, in my experience, refactoring occurs when the needs of the development team change, not as understanding of the domain changes ("refactoring to greater insight" as Evans calls it). I'm most concerned with _breakthroughs_ in understanding of the domain model. I understand making small changes, but what if a large change in the model is necessary? What's an effective way of convincing yourself (and others) you should refactor after you obtain a clearer domain model? After all, refactoring to improve code organization or performance could be completely separate from how expressive in terms of the ubiquitous language code is. **Sometimes it just seems like there's not enough time to refactor.** Luckily, SCRUM lends it self to refactoring. The iterative nature of SCRUM makes it easy to build a small piece and change and it. But over time that piece will get larger and what if you have a breakthrough after that piece is so large that it will be too difficult to change? Has anyone worked on a project employing domain-driven design? If so, it would be great to get some insight on this one. I'd especially like to hear some success stories, since DDD seems very difficult to get right. Thanks!


Seeking advice on system documentation

I have a rating engine (it is basically an algorithm) which when I started had no formal documentation. We have created a functional specification/decomposition which is our business level document but now I need something more technical (a technical specification). What I am struggling to understand is what that document looks like, what format it should be in and to what level of detail we should go into. We are in the process of commenting all of the code. We also have a rough document called a Blueprint which reflects the flow of the model and is written in pseudo code. Is the combination of this blueprint and the model comments sufficient as a Technical Specification?


Objective C style nil in java?

Objective C has a concept of a nil object which would accept any method call with any parameters without complaining and silently return another nil. I have used something similar in Java using easymock and mockito for testing. Is there something similar for main line code? Is it even a good idea to have something like this? One use-case where I am considering using it is with optional metrics. We have codahale metrics counters on which we call mark() every time an event is generated. This is surrounded by an If/then to check for metrics enabled flag. I could just use a nil object as counter and silently accept the mark call if metrics are not enabled.


GitHub OS project how to have a good version and a work in progress version

I have started my own OS application, I am hosting it on GitHub. My problem is that I push changes to the repository from more than one location so sometimes I want to work on it and sometimes I can't always finish something in time but I would still like to push it anyway so I can fetch it later from my other location. I'd like to be able to somehow have a stable version and have the master branch be a 'work in progress'. How do I do this? Is there some button I can push that will take the code from my master branch and make it into a zip file in my downloads tab and call it a version or should I do this by hand? Would it be better to have the master branch be nice and neat and have a separate branch to play with and then merge the two when the time is right? Would this not cause more problems in the merging phase?


Is it legal and ethical to reverse engineer software to port it to another system?

I love gaming, I love games that allow modding and I love linux. But the fact that most games right now are targeted for windows (consoles aside), most mods and modding tools are also targeted for windows. There is a certain modder called Boris Vorontsov that makes a famous visual overhaul mod series called ENB. What he does (or I think he does) is he enhances or changes the behavior of classes defined in the `d3d9.dll` library. Needless to say it almost never works under wine. Recently I have asked him if he would ever release his version of the library under some open license, and he said "no". Now that I think of it, even if he did release his code, he would have surely faced some legal problems. Now there is my question. Is it legal and ethical to reverse engineer his version of the library to adapt the wine's open source version of `d3d9.dll` to be able to run his mods?


What does it mean for a developer to be given "creative freedom"

So I was reading the flowchart shouldiworkforfree, and I was thinking what does it mean to be given `creative freedom`? as a developer?.. > _"Will they give you creative freedom?"_ For example does it mean, to be given the freedom to design the User Interface/Page on your preferences (and not somebody elses, such as management)? or is it to be given the ability to implement software features without approval?


Transition from enterprise-level PHP with Zend Framework to more enterprisey Java EE

I've been seriously considering my career progress and would like to know your opinion on the following:   * 5 years full-time employment as a software developer / web technologies / best practices   * MSc Software Engineering student   * based on typical tasks that I've been doing, I'd say I'm a Software Architect + sysadmin + security consultant. The problem which exists with PHP is that most of its users (incl. employers) are sort of technological enthusiasts without proper training. Companies are small, typically start-ups, and they cannot afford following formal processes. Consequently, requirements engineering is skipped, project management is skipped, testing is about systematically clicking everywhere because use cases are skipped, architecture is skipped, documentation is skipped, etc. I've been working on senior positions, incl. technical lead, and always addressed these issues until I started studying. For studies it's better to be an independent contractor working at home online. My aim is to join a medium / big company that can afford doing things as in the book and then I want to enjoy new challenges, bigger projects, other senior staff, etc. I've been also planning further study following my Master's. Do you think Web Development with Java EE and Oracle 11g is what I need to achieve these goals? For the record, I have several years of experience with C/C++ and Java, but I did that mostly as an additional work. My positions were more about PHP and various enterprise systems / frameworks. Thanks for exchanging your stack, this question may attract someone who has a few years' experience working exclusively with these technologies. :)


How to keep AST for feature access?

Consider such code (let's say it is C++)               Foo::Bar.get().X      How one should keep the AST for this -- as "tree" with root at left `Foo(Bar(get(X))`, or with root at right `(((Foo)Bar)get)X`? Or maybe as a flat structure (list)? The first one seems more convenient when resolving names, the second when working with it as expression. _I set tag`parsing` but I am asking from semantic analysis POV really (there is no such tag)._


What is the difference between the "lib" and "vendor" folders?

Regarding source folder hierarchy, there are always some common features, such as the `src`, `doc` or `test` folders, which have rather easy-to-understand contents. However, I realized that big projects have both a `lib` and `vendor` folders, while I had always thought they were the same, as their names hint at including “third-party `libraries` from external `vendors`”. Though, seeing both in the same project means there _is_ a difference. I couldn't find any information nor on Google nor on sources such as the Filesystem Hierarchy Standard, even though this is actually a somehow common practice. * * * Here is a more detailed example with Symfony: once you create a project, you get a `lib` folder at the root of your project. In this folder, the following structure is found:               lib     +--filter     +--form     +--…     +--vendor         +--simpletest         +--symfony      Here, the `symfony` folder contains all Symfony's core.


Loading database in memory vs querying

I am currently developing a continuous backup software. The key feature of the software is instant backup meaning that each time a file is created, modified, renamed or deleted the change is immediately reflected on the backup repository. In order to achieve this we designed the system so that once the client application starts, the entire backed up files database is loaded in memory. The issue arise when backing up large amounts of files say 10 - 15 million files. This first causes the load time to be slow and high memory usage. In some cases reaching 2GB. Querying the database on every change is also frowned upon as it will cause heavy loads on the disk where the database resides not to mention how slow the query execution time becomes as the database grows. So I was wondering what options does one have to design such a system to be memory efficient and reasonably fast.


Unit Testing an object which belongs to another

My example is in Rails/rspec, but is more generic in nature. I have an (abstract-y) class of `Events` which are attached to another (abstract-y) class, `Assets` (. Now, I'm testing using FactoryGirl and I'm not sure how to create events which are truly orthogonal to assets. If I build an event, it's only valid when it belongs to a asset, so am I supposed to build dozens of events, each of which has its own asset?


How Would You Design This Table?

I have to create a table where each row needs to store 50 number values. Each row will always need to store 50 number values. If this was a smaller number of values, I would just make fields for each of the values, but because there are 50, this approach seems a bit cumbersome (but since it will always be 50 values, maybe this is the correct approach?). Is there a way to store an array of values in a field? This seems like a nice solution, but the concept is almost identical to creating a relational database.


Why Should I Avoid Inline Scripting?

A knowledgeable friend recently looked at a website I helped launch, and commented something like "very cool site, shame about the inline scripting in the source code". I'm definitely in a position to remove the inline scripting where it occurs; I'm vaguely aware that it's "a bad thing". My question is: what are the real problems with inline scripting? Is there a significant performance issue, or is it mostly just a matter of good style? Can I justify immediate action on the inline scripting front to my superiors, when there are other things to work on that might have a more obvious impact on the site? If you pulled up to a website, and took a peek at the source code, what factors would lead you to say "hmm, professional work here", and what would cause you to recoil from an obviously amateurish job? Okay, that question turned into multiple questions in the writing. But basically, inline scripting - what's the deal?


Project Manager that wants to lock in time estimate with a signed contract

At a previous employment, a project manager (PM) wasn't satisfied with the delivery time of the code on a project I was on. I was told by my project lead that that the PM was considering having me _sign a contract to lock-in my time estimates_ I gave for tasks and delivery dates. The situation on the project was that we were working with new technologies, codebase, coding standards, and very prone-to-change requirements. I was learning new things and applying them the best I could on requirements that kept on changing. The requirements throughout the iterations grew by 2-3 times, with my estimate-to-complete growing by roughly 5-8 times. The only things that didn't change were the estimates and delivery dates. Yes, I did end up missing most deadlines. And I was working on some very new technologies that no one else on the entire development team could really help out on because they wouldn't be familiar with it. At least not easily. It seemed to me then, that the PM wanted his numbers to add up-- and thus wanted me to sign a contract to "ensure" that I would always deliver working code on time. I suppose with a signed contract the PM could use it against me if I couldn't deliver on time. I believe what happened next was that other project managers and/or project leads defended me, and didn't let this happen. My question is, **should this raise a red flag about the manager?** Is it common practice for a manager to lock-in time estimates of a software developer with a signed contract? Or in this case, try to. _Please note, I was a full time employee, not an independent consultant._ **Update** : I want to add that I did give new estimates weekly, but it seems the _original_ estimates and delivery dates were what the PM was fixated on.


Third party controls. Will experience in using them play a role while hunting a job?

We do end up using lots of third party controls in our development. They help us to develop quicker, help us to generate good looking reports etc. But do they really help us to get a good job elsewhere? Should we explain about third party tools we have used in our resume?


Iterative alternative to decorators?

So decorators wrap a base class recursively, right? And have a single super class object which is at the "core" class. Couldn't you just add an ArryList/LinkedList of decorations in the "core" class and achieve the same thing? This would avoid recursion (which is expensive), but allow the dynamic behavior of being able to "decorate" your classes. Is this a different pattern or an alternative version of decorators or something else? Ex: Decorator               Beverage class       getDescription(){blah}       cost();          HouseBlend inherits from Beverage       cost(){2.99}          CondimentDecorator inherits from Beverage       Beverage bev;       cost(){.19 + bev.cost}       getDescription{blah}      VS Other?               Beverage class       getDescription(){blah}       cost();          HouseBlend inherits from Beverage       List<Beverage> condiments             cost(){2.99 + iterative condiments}          CondimentDecorator inherits from Beverage       cost(){blah}       getDescription{blah}      It seems like the decorator might be a little more flexible, but the other version would allow you to keep track of specific instances of items. Also, if you had espresso you could have a double shot, where with a pure decorator that would be hard.


Best practices for expiration of tokens in a Security Token Service (STS)

When creating a Security Token Service (STS) for a claims based security model, it seems appropriate that tokens are generated in such a way that they expire after some duration, as suggested here. Around this concept, I have a few specific questions, but am looking for any feedback regarding best practices in this area.   * What are recommended values for the timeout length and/or what should be taken into consideration when determining this?   * If a user is active for longer than the typical expiration period, how should this be handled such that the user is no required to re-authenticate in the middle of their session?   * Is there an elegant way to design a service to perform batch actions "on behalf of" another user by utilizing the token? i.e. Utilizing the token at a later time may have caused it to expire.


what is difference between protected static method and protected method?

What is difference between `protected static` method and `protected` method? For example `demo` and `demo2` in `Data2` respectively Data.java:               package pack1;          import pack2.*;          public class Data extends Data2 {              public static void main(String args[]){             System.out.println("From main class");             Data d=new Data();             d.first();          }              void first(){             Data2 d2=new Data2();                  d2.demo();             d2.demo2();         }     }      Data2.java:               package pack2;          public class Data2 {         protected static void demo(){             System.out.println("In method demo");         }              protected void demo2(){             System.out.println("In method demo2");         }     }


Who is responsible for defects found during development?

When the QA find an error like 'broken design in web programming', do you call it a bug and the corrections 'patches'? (Assume all this is before delivery.) I was of the feeling that the corrections for bugs found after delivery were called patches. Developers don't add bugs intentionally and it's QA's duty to find bugs. Sure I agree a programmer should be able to solve the bug, **but should the programmer be blamed for these bugs?**


How much configurability to give to users regarding concurrency?

This question is a narrowing-down of these related questions:   * How much effort should we spend to programming for multiple cores?   * Concurrency: How do you approach the design and debug the implementation? Given that each user's computers may have different performance characteristics with respect to calculations, memory, disk I/O bandwidth and network I/O bandwidth, and that it is difficult to implement an automated self-tuning system in your software, how much configurability should we give to the end-users so that they can find ways (by trial-and-error?) to improve our software's efficiency? If we give users the ability to change these settings, how do we give visual feedback to users so they can measure the performance changes?


Am I missing a pattern?

I have a class that is a singleton and off of the singleton are properties that hold the instances of all the performance counters in my application.               public interface IPerformanceCounters         {             IPerformanceCounter AccountServiceCallRate { get; }             IPerformanceCounter AccountServiceCallDuration { get; }      Above is an incomplete snippet of the interface for the class "PerformanceCounters" that is the singleton. I really don't like the plural part of the name and thought about changing it to "PerformanceCounterCollection" but stopped because it really isn't a collection. I also thought about "PerformanceCounterFactory" but it is really a factory either. After failing with these two names and a couple more that aren't worth mentioning I thought that I might be missing a pattern. Is there a name that make sense or a change that I could make towards a standardized pattern that would help me put some polish on this object and get rid of the plural name? I understand that I might be splitting hairs here but that is why I thought that the "Programmers" exchange was the place for this kind of thing. If it is not... I am sorry and I will not make that mistake again. Thanks!


Scrum got specific ways for testing software?

When reading Scrum Guide, as the official text for scrum, I find out there is no specific solution to provide software testing in scrum. (the only hint is on page15) I'm a little vague on whether scrum is considered a software development methodology or not? If it is not, then how come some of its practices opposes _Extreme Programming_? (I know that in scrum guide, the author notes that scrum is a framework not a methodology, but still I'm not pretty clear on that) And what's more, I'm not sure if there are any other important textbook that I'm missing so far about scrum. I need them to be official or of great deal of public acceptance.


Is there a good design pattern for this messaging class?

Is there a good design pattern for this? I want to create a messaging class. The class will be passed: the type of message (eg. signup, signup confirmation, password reminder etc) the client's id The class needs to then look up the client's messaging preferences in the db (whether they want communication by email, sms or both) Then depending on the client's preference it will format the message for the medium (short version for sms, long form for email) and send it through our mail or sms provider's API. Because the fact that we want to be able to change out email and sms providers if need be I wondered if the Command Pattern would be a good choice.


What patterns book for iOS development contains this specific information?

I've read several books on iOS development and Objective-C, however what a lot of them teach is how to work with interfaces and all contain the model inside the view controller, i.e. a `UITableViewController` based view will simply have an `NSArray` as it's model. I'm interested in what the best practices are for designing the structure of an application. Specifically I'm interested in best practices for the following:   * How to separate a model from the view controller. I think I know how to do this by simply replacing the `NSArray` style example with a specific model object, however what I do not know how to do is alert the view when the model changes. For example in .NET I would solve this by conforming to `INotifyPropertyChanged` and databinding, and similarly with Java I would use `PropertyChangeListener`.   * How to create a service model for my domain objects. For example I want to learn the best way to create a service for a hypothetical `Widget` object to manage an internal DB and also services for communicating with remote endpoints. I need to learn the best ways to do this in a way that interface components can subscribe to events such as `widgetUpdated`. These services should be singleton classes and some how dependency injected into model/controller objects. Books I've read so far are:   * Programming in Objective-C (4th Edition)   * Beginning iOS 5 Development: Exploring the iOS SDK   * The iOS 5 Developer's Cookbook: Expanded Electronic Edition: Essentials and Advanced Recipes for iOS Programmers   * Learn Objective-C on the Mac: For OS X and iOS I've also purchased the following updated books but not yet read them.   * The Core iOS 6 Developer's Cookbook (4th edition   * Programming in Objective-C (5th Edition) I come from a Java and C# background with 15 years experience, I understand that many of the ways I would do things in these languages may not fit to the ObjC way of developing applications. Would someone be able to provide me with _the_ book on this topic containing this specific subject matter?


Useful design patterns for working with FragmentManager on Android

When working with fragments, I have been using a class composed of static methods that define actions on fragments. For any given project, I might have a class called `FragmentActions`, which contains methods similar to the following:               public static void showDeviceFragment(FragmentManager man){         String tag = AllDevicesFragment.getFragmentTag();              AllDevicesFragment fragment = (AllDevicesFragment)man.findFragmentByTag(tag);              if(fragment == null){             fragment = new AllDevicesFragment();         }              FragmentTransaction t = man.beginTransaction();         t.add(R.id.main_frame, fragment, tag);              t.commit();     }      I'll usually have one method per application screen. I do something like this when I work with small local databases (usually SQLite) so I applied it to fragments, which seem to have a similar workflow; I'm not married to it though. How have you organized your applications to interface with the Fragments API, and what (if any) design patterns do you think apply do this?


Theoretical basis for (Linux) kernel development

KernelDevViewpoint (an apparently serious source) makes kernel development look like an accessible art. According to them: > Contrary to popular belief, kernel developers rarely need to know math at > the calculus level. You need to be good at basic arithmetic and you must > know Boolean algebra to work on device drivers. > > One skill that many kernel developers learn on the job is the ability to > build state machines in your head of what the code is doing. (...) and > Technical skills for kernel developers include experience with the C > programming language, and knowledge of Git. Is that the basis of kernel development? Basic arithmetic, Boolean algebra, C and Git? Obviously, I don't expect to read "C in ten days" (or whatever similar book) and start contributing to the Linux kernel development, however, I wonder how difficult will be to obtain the skills to do that?


When should you trim input?

I am intern learning tons about the industry outside of academia. One thing I thought about today was trimming input. On one side of the coin I don't want the user/implementer to constantly receive unexpected results because their input had too many spaces, thus I need to constantly trim user input after every function call. But at the same time If I am creating a ~~API~~ library for internal use here at the office trailing/leading whitespace may be crucial to the results. Then there are instances were I am not sure if whitespace will be important or not. The big issue for me is that I find myself CONSTANTLY calling .trim() everywhere in my code. Does anyone have any tips/ rules of thumb or just thoughts on how to handle certain situations?


Why is the yield keyword used in conjunction with return and break, and not by itself?

In C# you can construct methods with the return type of `IEnumerable<T>` and use `yield return` and `yield break` to control the flow. Here is a simple example that uses both controls:               public IEnumerable<int> GetEvens(int start, int end) {         if(end < start)             yield break;              if(start & 2 != 0)             start++;              for(int i = start; i <= end; i+=2) {             yield return i;         }             }      My question is, why was it originally designed to use two keywords with `yield` and not use it like the following with the single `yield` "yielding the return value":               public IEnumerable<int> GetEvens(int start, int end) {         if(end < start)             return; // stop completely and return nothing              if(start & 2 != 0)             start++;              for(int i = start; i <= end; i+=2) {             yield i; // yield the current value.         }             }      To me, this is simpler to read and understand.


Version number as a part of a file name

I see that some software have the version number included as a part of their file name, while others do not. I am more used to the latter type, and I think that is more popular, but I see the former type sometimes in javascript libraries. For example, jQuery's file name is like `jquery-2.1.0.js` instead of `jquery.js`. Whenever I update these types of files, I have to look for the places in other programs that load these files, and change the file name they refer to, and manually delete the older version of these libraries. That is inconvenient to me, so I rather rename the file to exclude the version number, and keep the file name referred to to not include the version number. I suspect that these numbers are for some kind of version control, but am not clear when and how they are used.   * What are the pros and cons for including version numbers in the file name?   * Is there de facto consensus on which areas of software or languages use version number in the file name, and which areas/languages do not? If so, is there any rationare for that?


Why are they stacking technologies and languages for single person jobs?

I see this too often. They need **one** guy who is proficient in:   1. Assembly   2. C/C++ (sic!)   3. Python   4. Delphi   5. C#   6. PHP   7. SQL   8. Joomla   9. Drupal ... and so on. Why?


How can current IDEs improve the development experience? What secondary tools should be primary?

A modern IDE wouldn't be taken seriously if it didn't have a good editor with syntax highlighting, comprehensive warnings, and a source-level debugger. And there are many more tools/IDE features that programmers find essential:   * Refactoring transformations   * Unit testing support   * Source code control integration Yet, there are still **many good tools** that don't have the exposure and usage that they should. For example, the following tools are usually expensive or hard to find for a given language:   * Automated GUI testing   * Program slicing (e.g. CodeSurfer -- useful for finding what statements can affect another statement)   * Test coverage (depending on your language, this can be very easy to find, or quite difficult)   * Points-to analysis ("Do I really need to make this list concurrent, or will it ever be accessible by one thread anyway?") Partly it's an issue of education and awareness, and partly it's because IDE makers are often too busy supporting the next version of the language to dedicate resources to developing these secondary tools. _What features are missing in today's IDEs? What secondary tools should really be primary? What makes them so helpful?_ That is, what features do you think you'd use every month, or every day, if the tool was available? Please consider tools that both exist or should exist. For a tool that _should_ exist, make sure the idea is feasible.


When is it ok to use a Global variable

Ok, so this is a bit of a devils advocate question really. When are global variables ok, and if never, what would you use as an alternative? An interesting side-case to this question, how is a public static class field different from a global?


Lead Developer responsibilities

At my current job (been here for 6 years). The VP of the company has decided he wants to make me the lead developer. I believe this is being done because my current boss who is a BA was pin holed into that position, its not something he wants to be doing. I asked him what the responsibilities are and he mentioned I will be dealing with bugs, coming up with estimates and also still involved in coding. Right now its myself another senior developer and a junior. The junior and the senior doesn't know nearly as much as I do about the company specific components and business rules. I can't see myself doing both, to be honest it sounds like two separate jobs. Bugs take time to research and figure out the validity, etc. Writing emails back and forth to the project managers. And I still need to be responsible for coding?? My question is do lead developers usually manage tasks/people AND also code?


When comparing floats, what do you call the threshold of difference?

I'm comparing floats in Java right now and the simplest formula is:               Math.abs(a - b) < THRESHOLD      When naming your variable for the threshold of difference, should you name it delta or epsilon? Specifically, which of the two is the correct term for the smallest value that a floating-point number can represent? Is the term programming language specific, or is it universal across languages?


Replacing dao layer

I am developing a series of webservices (based on spring and spring mvc). For the first time in my dev career I do plan on replacing the dao layer in the future(I have always seen it mentioned but never had to do it). Currently I'm using spring annotations, so I could simply change the qualifier name of the injected dao in each place it is used; is there a better (global) mechanism I could use ? Currently my code looks like this (declaring the dao) :               @Repository("regionDao")     public class RegionDao implements IRegionDao      and Injecting it :               @Resource(name = "regionDao")     IRegionDao regionDao;      But going into each service class and changing the qualifier name seems rather long winded, is their a better way. Basically in the future I want to flip a switch and each reference to a _regionDao_ will then point to _newRegionDao_ and so on for other dao's. A solution using annotations is preferred- for no other reason than I subjectively prefer them. But I realize this may be a case for xml based config ?


Are t-shirt estimates a good way to conduct initial estimates?

I've read articles with very conflicting arguments on t-shirt estimates. Neither article seemed all that credible so I thought I would bring this up here. Are t-shirt estimates a good idea? For those who haven't heard of this: T-shirt estimates are the practice of giving very vague and high level estimates when given vague, high level requirements, and no resources to estimate. They are based on t-shirt sizes and as such are broken down into: XS, S, M, L, XL, etc. I don't see any problem in them in principle. Requirement gathering, requirements research and proper estimation all require time. Much of the time, 'clients' can request premature estimates and the ability to use t-shirt estimations allows for answers that are obviously overly vague and can't be held to any standard. At the time, this satisfies the 'clients' as they at least something to base their thinking on. Conversely, if you were to give the same client the answer of 5,000 hours but gave the stipulation that this was just a guess and put that in bold, red, and blinking text. You run the risk of the client 'forgetting' this and then getting upset when these hours change drastically when a proper estimate is done.


Can GPL v2 code link to an LGPL v3 library

If I write a library that is released under the terms of the GPL v2 (or higher, at option); may that library _depend on_ another library released under the LGPL v3 (or higher), without implicitly enforcing GPL v3. That is, I am purely linking to that library. Reading this and this, I understand that the LGPL v3 and GPL v2 are not "compatible". But it is not clear to me, whether compatibility means only mixing of code, or whether it extends to the linking (without modifying the LGPL'ed library).


How can I get involved with developer communities in my area?

I live in Manchester, UK, and while there are lots of developer communities (regular events, get togethers etc) in London, there are not many "up north". I know of a few (NxtGenUg and ManchesterGeekNights) but there must be more than this. What's the best ways of finding out about these? How have people got involved with communities in there area?


How to Convince management that a specific product training is important to QA?

I am leading a QA team of 10 people. we have been received the request for a training of a ETL dataware housing tool for QA, Support and Development. But however the management does not feel that it is important for QA to be involved in such a training as it is support and development team who will be involved ih developing or fixing the issues in the product. How do I convince the management that this training is very important from the QA perspective as this is the team that will find bugs and which will reduce the maintainance cost?


Is it a good idea to install Mercurial on your server and hg pull to deploy?

I've just started at a new job this past month and looks like they have NO source control for their code. They are relying on the backups their hosting provider takes for them. After talking a bit I convinced my boss that we should definitely be using source control and after I gave a short seminar on it, the entire team is on board; they loved Mercurial. So right now this is the way we work:               º----------BitBucket     º---------/     º--------/      Myself and the three other developers `hg pull` from BitBucket, make our changes, then `hg push` to BitBucket. Now for deployment, someone would need to FTP the latest files towards the production server. I was thinking of installing Mercurial on our server, and using `hg clone` (subsequently `hg pull`) to keep the versions up to date on production.               º---push->-----BitBucket----<-pull-----º (production server)     º---push->----/     º---push->---/      Is this a good idea? Any potential pitfalls I may not be seeing? Has anybody here done something similar? How do you deploy a large PHP framework application (We're using Moodle)?


Is it best to try to work at a company where your software directly makes the company money?

I was told once that the best place to work as a developer is a company where the software you write is what makes the company money, whether it be software production or software services like consulting. This is opposed to a company where the software you write is just to support some other part of the business that makes the money, like manufacturing or finance. I know there are always exceptions, but in general, are employees treated better if they are on the front lines of profit generation, as opposed to being just another cost center? **cost center (n.)** - A cost center is part of an organization that does not produce direct profit and adds to the cost of running a company. Examples of cost centers include research and development departments, marketing departments, help desks and customer service/contact centers.


Using UML and Use Cases in Game Design

In the Use case you need to make all the activities the user can do. And then in the Activity diagram I need to explain the Use cases, show the steps that it handles. But if this is all correct, where do I need to show the enemies? Like: Generate path, walk, etc... Because it isn't controlled by the player, the player has almost no influence on the enemy.


Best git practices for android project with multiple sets of resources

I have a commercial Android project that I have created a client-specific version for (mainly UI tweaks). Since the bulk of the tweaks are in the res/ folder in XML files, we have the changes currently in a branch but I really don't want to have to port changes back and forth between branches in perpetuity. I'm curious if anyone has any source control strategies that will make managing multiple client-specific versions of an Android application as painless as possible. Also, not sure if this belongs here or StackOverflow. Feel free to transition over there if I guessed wrong.


What should I know before starting a software company?

Seeing that so many of my friends are unemployed, some of my frinds and I are planning to create a small software company. What are the basic things we should know and do? Are there things specific to running a software company that we'd need to be aware of?


Is there a specific term for the variable in a `foreach` construct?

Does the variable used for iteration in a `foreach` loop have a more specific term than simply 'the foreach variable?' Especially to differentiate it from the collection variable? E.g. `item` in `foreach (item in collection)` Edit: Loop variant was suggested (wiki): > In computer science, a loop variant is a mathematical function defined on > the state space of a computer program whose value is monotonically decreased > with respect to a (strict) well-founded relation by the iteration of a while > loop under some invariant conditions, thereby ensuring its termination. To me this sounds similar to 'iteration variable.' Is this strictly speaking correct? I would have assumed that 'loop variant' refers to the internal integer (or similar) that the `collection` enumerator uses for its internal state- not the variable that is set to the `Current` value on each iteration. Also, an enumerator of a linked list or a dummy enumerator that never terminates do not have monotonically decreasing variables, while at the same time the `foreach` loop does have its `item` variable. Edit 2: The motivation of this question is to find a descriptive name for a parameter in a bytecode emitting API. This parameter is a number that refers to the local that will be set on each generated foreach iteration. It's not an `iterationLocal`, that would be misleading. `currentLocal` may be the most helpful name.


Event Sourcing for Enterprise Applications

Is it viable to store information a la event sourcing when dealing with large enterprise applications ? I know lokad has been using it for a long time, but they are not in the ERP business I have been looking for this solution, since is seems very interesting.


How to convince an employer to move to VB.Net for new development?

Some history:For the last six months I have been employed at a small firm with just three programmers, my employer among them. The firm maintains two programs written in VB6. I am asssigned as the lead programmer to one of these. In the last six months I did some maintenance and bug hunting, but created some new functionality too. I had an interview last december, which was favorable, and my contract was prolonged. I am very happy with this course of events as I only obtained a .Net certification a year ago and have no other qualifications (in the field of coding, that is). It is my strong opinion that, while migration of the existing program to .Net is advisable, it is paramount that from now on the new functionality should be written in VB.Net class libraries. After some study I found out how simple it is to integrate .Net class libraries into the VB6 development environment and how easy it is to add their functionality to existing installations by using application manifests. So, I have decided that now is the moment to roll up my sleeves and try and convince my employer that he should let me develop new code in VB.Net, using VB6 for maintenance only. We get along quite well, but I think I am going to need all the ammunition I can get to convince him. Any arguments, preferably backed up up ones, are very welcome, even arguments to dissuade me ;-)


Disillusioned with agile; how do you prepare for life after release 1.1?

My company is going full steam with the agile process, with multiple agile projects in work. The first agile team, the proof of concept, carried the product through release and the first post production release. After this successful effort, the team was quickly disbanded, sent off to help other projects on their agile way. My disillusionment with agile comes from third and later release stage of the software life cycle. Agile is good at pulling expert and building moment, getting all excited for a project, but how do you wind down a project and move it stage where existing customers must be kept happy, to keep paying for all that early agile fun? If you will, the party is over, and this light on documentation, don’t design it till you need it, and keep racing to the next sprint leaves little documentation, little vision, and poor records of why design decisions were made. This stage of life also has little interest in the initial agile developers, as they are done with that project and are off looking for new exciting teams to start. I understand, and have lived through waterfall of the problems with long term planning, schedules being missed, and requirements being out of date, but for part that was usable and accepted by the customer, there is information and distributed knowledge of why decisions were made, what steps were taken, and something more supportable in the end. Basically, what does an agile team need to be doing, what must it do, what must be deliverable, for an agile project to be successful, with success being defined as a sustainable, maintainable, and hopefully revenue generating product? If the agile software we build cannot be maintained, in a couple years agile will just be another broken promise, which business managers will not pay for, allowing them to go back to the old, micro-manageable waterfall process.


Tools aiding in documenting API requierements for a REST Service

We need to define our requirements for a REST API. What are tools which aid in creating a document which will fully describe the webservice so it can be created by another entity?


Do database tables need to have IDs?

Is an ID field is always needed in database tables? In my case I have a user with `firstName`, `lastName` and `email` fields. `email` is unique and not null, so it could be used as an ID, right? So in that case, could/should I try to remove the ID? Also I want to have another table which extends this one. Let's say its called patient and it has it's own field `additionalData` and I would like to link the relationship through the email of user I mentioned. So the relationship should be 1 to 1, right? and I wouldn't need the IDs? Somehow MySQL Workbench wants me to use the IDs. What do you guys think. Any suggestions on this topic?


Jython and JRuby vs. Groovy (and Java)

I am very interested in Python for programming on the JVM, and I've worked in Java and Ruby (not JRuby) a lot, and to a certain extent in Groovy. What are the limits to the Java-Jython and Java-JRuby integration right now? What about Groovy: are there any things that a Java class can do that a Groovy class cannot? And what about IDE integration (mostly Eclipse, but IntelliJ and Netbeans are also interesting)? **I'm not interested in whether Python, Ruby or Groovy is better/more- concise/whatever.** I'm just interested in how well they are working in the JVM and tools (especially IDEs) right now. My main interest is not inside a web server, if that matters. Simple examples of getting a HelloWorld which extends a custom Java class and implements a custom Java interface would be very useful to me.


How do you measure the effectiveness of your hiring & interview process?

Although I've seen many discussions on how to do an interview and develop your brand, I haven't seen many discussions on how to determine if your hiring & interview process is actually working well. I think this question has two parts:   1. How do you know your hiring process is getting the right candidates to apply and go through the interview process?   2. Of the people that you end up interviewing, how can you tell that the ones you choose to hire are better (on average) than those that you rejected? I suppose the "extreme" cases - when you end up with a superstar or a total dud - are pretty obvious, but what about the rest?


How is C different from C++?

Many people have said that C++ is a completely different language than C, but Bjarne himself has said that C++ is a language that is extended from C hence that is where the `++` comes from. So why does everybody keep saying that C and C++ are completely different languages? In what way is C different from C++ other than the extended features in C++?


What's the difference between "Programmer" and "Coder"?

Sometimes I heard people talking about how "that guy is not a programmer, he is just a coder." Could someone specify what's the difference between "programmer" and "coder"? Does the IT coder profession even exist?


Is there such a thing as "closure" with software work?

I burned out last year (after a decade of fulltime programming jobs) and am on a sabbatical now. With all the self-examination I've started to figure out some of the root causes of my burnout, and one of the major ones is basically this: there was never any real closure in any of the work I've ever done. It was always a case of getting into an open-ended support/maintenance grind and going stale. When I first entered the industry, I had this image of programming work being very project-based. And I expected projects to have a start, beginning, and END. And then you move on and start on something totally new and fresh. Basically I never expected that a lot (most) of software work involves supporting and maintaining the same code base for open-ended long periods of time - years and even decades. That, combined with generally having itchy feet makes me think that burnout is inevitable for me, after 2-3 years, in ANY fulltime software job. All this sounds like I probably should have been a contractor instead of a fulltimer. But when I discuss this with people, a lot of them say that even THEN you can't really escape having to go back and maintain/support the stuff you worked on, over and over (eg. Coming back on support contracts, for example). The nature of software work is simply like that. There is no project closure, unlike in many other engineering fields. So my question is - Is there ANY programming work out there which is based on short to mid term projects/stints and then moving on cleanly? And is there any particular industry domain or specialization where this kind of project work is typical?


How to create a "cult of quality"

DeMarco and Lister (Peopleware) suggest you create a "cult of quality" within your programming team. Frustratingly, they don't suggest how you go about doing that! Anyone got any thoughts on how to accomplish this?


Does your company donate financially to open source projects? Why not?

Does your company donate financially to open source projects? My company doesn't. We use open source operating systems, tools, libraries, IDEs, application servers, databases, websites (Wikipedia) etc. We produce a product from this which we sell. Yet we contribute nothing back. I'm sure this is the normal case in many companies. How can this be justified?


How to deal with complex codes in (huge) projects

I am preparing a memoir about "Why do (some) IT projects become too complex and how to avoid it ?". If you have ever encountered projects having complex codes or were hard to maintain, how did you manage to go through it? If you have to choose between several applications to use in your project, what would be your top priority in their functionality and why?


O good approach for permissions of an application' users

I have an app that have multiple users. In my app an user can - create contacts (people) - edit contacts - view contacts - create an entry to agenda - view entry from agenda Also I need that User A is allowed to view User's B contacts but is not allowed to edit that contact. User B can view and edit User's A entries in Agenda. The app will have about 10-15 permission for each module (Agenda, Contacts, Documents, EmailMarketing) and the number of modules can reach to about 20 Let's say "User A" is a sales person, and "User B" is the sales manager. For sure, each Business Object (contact, agenda entry,etc) will have a owner id. What is the best approach/design patter/good practice to use to handle this situation?


Hierarchic (tree) access control

I am currently at the task to create an hierarchic user management system. The requirements for me are to have **users** with rights (roles), **customers** with rights and **groups** (containers for customers and subgroups). The customers and groups can have users assigned to and those users should have access only to groups and customers below their assigned groups/customers. For this I am currently looking at ways how to implement it, my current preferred solution would be based on MongoDB with this concept: MongoDB array of ancestors The `ancestors` array would then be added to groups and customers so selecting all accessable groups/customers would be really fast by just looking into the `ancestors` array. Also updating the ancestors array seems to be pretty fast also if moving a group with ten thousands of groups/customers. Tough the problem I see is when the groups are being moved below other groups, for this I would have to remove the old parents from the ancestors trees with update and then add the new parents to the ancestors array with another separate update. The problem is that MongoDB is not able to isolate those 2 operations and therefore the chance for race conditions exist if the groups would be moved at the exact same time and the removing and adding of ancestors would overlap. Any ideas how to solve this within Mongo? I know an ACID conform relational DB could help me here, but I don't want to lose the ease of use when adding settings to a customer/user just by adding a new subdocument to them, also scalability may be easier.   Would LDAP be a good solution for this? Tough I have no experience at all in LDAP.   Another idea would to regularly check and update the ancestors if something is wrong by recursively checking all the elements. Tough ths doesn't sound very clean to me ;)


Few specific questions on how games are developed

When it comes to programming games from the old school sega games like sonic to indie games or angry birds or even to more advance games like Diablo, how exactly is level design done? As in, are the levels sometimes designed straight out of code in an IDE? Or do they create a visual level design editor where things can be placed at the click of a mouse button? I'm imagining old school games or very simple ones like indies are done via code, where extremely complicated ones require a visual editor. Is this correct? Also, when it comes to libraries like SDL or XNA, how often are these used rather than just utilizing OpenGL or DirectX? What about creating your own game engine vs utilizing one already made? Do most use already built engines? This question is directed toward the whole gaming spectrum of indie/big game development. Thanks.


Is it worth to learn Experimental Languages?

I'm a young programmer who desires to work in the field someday as a programmer. I know Java, VB.NET and C#. I want to learn a new language (as I programmer, I know that it is valuable to extend what I know - to learn languages that make you think differently). I took a look online to see what languages were common. Everybody knows C and C++ (even those muggles who know so little about computers in general), so I thought, maybe I should push for C. C and C++ are nice but they are old. Things like Haskell and Forth (etc. etc. etc.) are old and have lost their popularity. I'm scared of learning C (or even C++) for this same reason. Java is pretty old as well and is slow because it's run by the JVM and not compiled to native code. I've been a Windows developer for quite a while. I recently started using Java - but only because it was more versatile and spreadable to other places. The problem is that it doesn't look like a very _usable_ language for these reasons:   * It's most used purpose is for web application and cellphone apps (specifically Android)   * As far as actual products made with it, the only things that come to mind are Netbeans, Eclipse (hurrah for making and IDE with the language the IDE is for - it's like making a webpage for writing HTML/CSS/Javascript), and Minecraft which happens to be fun but laggy and bipolar as far as computer spec. support.   * Other than that it's used for servers _but heck - I don't only want to make/configure servers_. The .NET languages are nice, however:   * People laugh if I even mention VB.NET or C# in a serious conversation.   * It isn't cross-platform unless you use MONO (which is still in development and has some improvements to be made).   * Lacks low level stuff because, like Java with the JVM, it is run/managed by the CLR. My first thought was learning something like C and then using it to springboard into C++ (just to make sure I would have a strong understanding/base), but like I said earlier, it's getting older and older by the minute. * * * ## What I've Looked Into _**Fantom_** looks nice. It's like a nice middleman between my two favorite languages and even lets me publish between the two interchangeably, but, unlike what I want, it compiles to the CLR or JVM (depending on what you publish it to) instead of it being a complete compile. _**D_** also looks nice. It seems like a very usable language and from multiple sources it appears to actually be better than C/C++. I would jump right with it, but I'm still unsure of its success because it obviously isn't very mainstream at this point. There are a couple others that looked pretty nice that focused on other things such as Opa with web development and Go by GOOGLE. * * * ## My Question Is it worth learning these "experimental" languages? I've read other questions that say that if you aren't constantly learning languages and open to all languages that you aren't in the right mindset for programming. I understand this and I still might not quite be getting it, but in truth, if a language isn't going to become mainstream, should I spend my time learning something else? I don't want to learn old (or any going to soon be old) programming languages. I know that many people see this as something important, *but would any of you ever actually consider (assuming you didn't already know) FORTRAN? My goal is to stay current to make sure I'm successful in the future. * * * ## Disclaimer Yes, I am a young programmer, so I probably made a lot of naive statements in my question. **_Feel free to correct me on ANYTHING!_** I have to start learning somewhere so I'm sure a lot of my knowledge is sketchy enough to have caused to incorrect statements or flaws in my thinking. Please leave any feelings you have in the comments. * * * ## The Results... I'm truly amazed by the amazing responses, most of them so nicely pointing out my misunderstandings and misjudgments. I've learned quite a lot from this and I'm excited to hopefully utilize everything I've learned! I'll probably start learning Haskell next (the _not_ so old language, albeit over 20 years old - _hahaha_ ) and then start looking at some other options around me. _**Thanks_**