title: JS closures - Passing a function to a child, how should the shared object be accessed

text: I have a design and am wondering what the appropriate way to access variables is. I'll demonstrate with this example since I can't seem to describe it better than the title.   * `Term` is an object representing a bunch of time data (a repeating duration of time defined by a bunch of attributes)   * `Term` has some print functionality but does not implement the print functions itself, rather they are passed in as anonymous functions by the parent. This would be similar to how shaders can be passed to a renderer rather than defined by the renderer.   * A container (let's call it `Box`) has a `Schedule` object that can understand and use `Term` objects.   * `Box` creates `Term` objects and passes them to `Schedule` as required. `Box` also defines the `print` functions stored in `Term`.   * A `print` function usually takes an argument and uses it to return a string based on that argument and `Term`'s internal data. Sometime the `print` function could also use data stored in `Schedule`, though. I'm calling this data `shared`. So, the question is, what is the best way to access this `shared` data. I have a lot of options since JS has closures and I'm not familiar enough to know if I should be using them or avoiding them in this case. Options:   1. Create a local "reference" (term used lightly) to the `shared` data (data is not a primitive) when defining the `print` function by accessing the `shared` data through `Schedule` from `Box`. Example:              var schedule = function(){         var sched = Schedule();         var t1 = Term( function(x){   // Term.print()                            return  (x + sched.data).format();                      });     };        2. Bind it to `Term` explicitly. (Pass it in `Term`'s constructor or something). Or bind it in `Sched` after `Box` passes it. And then access it as an attribute of `Term`.   3. Pass it in at the same time `x` is passed to the print function, (from sched). This is the most familiar way for my but it doesn't feel right given JS's closure ability.   4. Do something weird like `bind` some context and arguments to `print`. I'm hoping the correct answer isn't purely subjective. If it is, then I guess the answer is just "do whatever works". But I feel like there are some significant differences between the approaches that could have a large impact when stretched beyond my small example. **Edit** I'll post the solution I'm using but I'd still welcome criticism: All `print` functions take, as arguments, anything `term` doesn't own. This way, `term` is not coupled to `schedule` in any way (obviously `schedule` is still dependent on `term`, though). This allows `term` to be initialized/constructed anywhere without needing knowledge of schedule. So, if `term` had an `init()` function it might take an object that looks something like this:               {         inc: moment.duration(1,"d"),         periods: 3,         class: "long",         text:"Weekly",         pRange: moment.duration(7,'d'),         //*...other attr*//         printInc: function(increments,period){             return moment(this.start).add(this.inc.product(increments)                   .add(this.startGap))                   .add(this.pRange.product(period))                   .format(DATEDISPLAYFORMAT);         },         printLabel: function(datetime){             return (datetime).format(DATEDISPLAYFORMAT);         }     }      Where increment, period, datetime would all be passed from whatever is using term's print methods (schedule in this case).


title: When is type testing OK?

text: Assuming a language with some inherent type safety (e.g., not JavaScript): Given a method that accepts a `SuperType`, we know that in most cases wherein we might be tempted to perform type testing to pick an action:               public void DoSomethingTo(SuperType o) {       if (o isa SubTypeA) {         o.doSomethingA()       } else {         o.doSomethingB();       }     }      We should usually, if not always, create a single, overridable method on the `SuperType` and do this:               public void DoSomethingTo(SuperType o) {       o.doSomething();     }      ... wherein each subtype is given its own `doSomething()` implementation. The rest of our application can then be appropriately ignorant of whether any given `SuperType` is really a `SubTypeA` or a `SubTypeB`. Wonderful. But, we're still given `is a`-like operations in most, if not all, type-safe languages. And that suggests a potential need for explicit type testing. **So, in what situations, if any, _should_ we or _must_ we perform explicit type testing?** Forgive my absent mindedness or lack of creativity. I know I've done it before; but, it was honestly so long ago I can't remember if what I did was good! And in recent memory, I don't think I've encountered a _need_ to test types outside my cowboy JavaScript.


title: MVC, when to separate controllers?

text: I'm starting with MVC and have a newbie question. What would be the logic criteria to define what a controller should encompass? For example, say a website has a 'help' section. In there, there are several options like: 'about us', 'return instructions', 'contact us', 'employment opportunities'. Each would then be accessed like 'mysite.com/help/aboutus', 'mysite.com/help/returns', 'mysite.com/help/contactus', etc. My question is, should I have a 'help' controller that has 'about us', 'returns', 'contact us', 'employment' as actions with their respective view, or should each of those be a different controller-action-view set? What should be the line of reasoning to determine when to separate controllers?


title: How to implement better security in Linux?

text: I'm just investigating the security and control of the Linux platform in comparison to Android. In Android there seems to be a huge development around security - Applications are required to ask for system permissions, and if the user grants that permission, then the system allows that application to execute with those granted privileges. It isn't like that on vanilla Linux. Applications can access anything they want, albeit not granting them to modify files, but nevertheless. Users simply don't know how applications work, and what information - sensitive information - they take and what they do with that information (upload it to a database and sell it to 3rd parties). So what is this dealt with? I'd imagine the Linux kernel has to be modified so it accepts access tokens per application basis or something similar. Windows at least has some type of security system with it's built in firewall and local authority service. (I know little about Windows.)


title: Why are semicolons and commas interchanged in for loops?

text: In many languages (a wide list, from C to JavaScript):   * commas `,` separate arguments (e.g. `func(a, b, c)`), while   * semicolons `;` separate sequential instructions (e.g. `instruction1; instruction2; instruction3`). So why is this mapping reversed in the same languages for **for loops** :               for ( init1, init2; condition; inc1, inc2 )     {         instruction1;         instruction2;     }      instead of (what seems more natural to me)               for ( init1; init2, condition, inc1; inc2 )     {         instruction1;         instruction2;     }      ? Sure, `for` is (usually) not a function, but arguments (i.e. `init`, `condition`, `increment`) behave more like arguments of a function than a sequence of instructions. Is it due to historical reasons / a convention, or is there a good rationale for the interchange of `,` and `;` in loops?


title: Cohen–Sutherland algorithm

text: I was reading Cohen–Sutherland algorithm on Wikipedia  and I am confused in these two parts,               int ComputeOutCode(double x, double y) {         ...         if (x < xmin)       code |= LEFT;         else if (x > xmax)  code |= RIGHT;         if (y < ymin)       code |= BOTTOM;         else if (y > ymax)  code |= TOP;         ...     }      and               if (outcodeOut & TOP) {           // point is above the clip rectangle         x = x0 + (x1 - x0) * (ymax - y0) / (y1 - y0);         y = ymax;     } else if (outcodeOut & BOTTOM) { // point is below the clip rectangle         x = x0 + (x1 - x0) * (ymin - y0) / (y1 - y0);         y = ymin;     } else if (outcodeOut & RIGHT) {  // point is to the right of clip rectangle         y = y0 + (y1 - y0) * (xmax - x0) / (x1 - x0);         x = xmax;     } else if (outcodeOut & LEFT) {   // point is to the left of clip rectangle         y = y0 + (y1 - y0) * (xmin - x0) / (x1 - x0);         x = xmin;     }      What I am confused is, How does it handle points who are top-left, top right, etc. It just handles top, left, right and bottom. Why use `|` in `code |= LEFT;` and `outcodeOut & TOP` in `if-else` below it? I know that these two somehow handle all 8 possible cases but I don't know how.


title: How to best protect from 0 passed to std::string parameters?

text: I have just realized something disturbing. Every time I have written a method that accepts a `std::string` as a paramater, I have opened up myself to undefined behaviour. For example, this...               void myMethod(const std::string& s) {          /* Do something with s. */     }      ...can be called like this...               char* s = 0;     myMethod(s);      ...and there's nothing I can do to prevent it (that I am aware of). So my question is: How does someone defend themself from this? The only approach that comes to mind is to always write two versions of any method that accepts an `std::string` as a parameter, like this:               void myMethod(const std::string& s) {         /* Do something. */     }          void myMethod(char* s) {         if (s == 0) {             throw std::exception("Null passed.");         } else {             myMethod(string(s));         }     }      Is this a common and/or acceptable solution? **EDIT:** Some have pointed out that I should accept `const std::string& s` instead of `std::string s` as a parameter. I agree. I modified the post. I don't think that changes the answer though.


title: How would you approach teaching web development to teenagers?

text: I have been tasked to build an 8 hour program of work to teach teenagers (12-15) the basics of web development. I am at a loss at where to start on such a huge subject. I'm not even sure what the target should be. Any tips would be great.


title: C++ strongly typed typedef

text: I've been trying to think of a way of declaring strongly typed typedefs, to catch a certain class of bugs in the compilation stage. It's often the case that I'll typedef an int into several types of ids, or a vector to position or velocity:               typedef int EntityID;     typedef int ModelID;     typedef Vector3 Position;     typedef Vector3 Velocity;      This can make the intent of code more clear, but after a long night of coding one might make silly mistakes like comparing different kinds of ids, or adding a position to a velocity perhaps.               EntityID eID;     ModelID mID;          if ( eID == mID ) // <- Compiler sees nothing wrong     { /*bug*/ }               Position p;     Velocity v;          Position newP = p + v; // bug, meant p + v*s but compiler sees nothing wrong      Unfortunately, suggestions I've found for strongly typed typedefs include using boost, which at least for me isn't a possibility (I do have c++11 at least). So after a bit of thinking, I came upon this idea, and wanted to run it by someone. First, you declare the base type as a template. The template parameter isn't used for anything in the definition, however:               template < typename T >     class IDType     {         unsigned int m_id;              public:             IDType( unsigned int const& i_id ): m_id {i_id} {};             friend bool operator==<T>( IDType<T> const& i_lhs, IDType<T> const& i_rhs );     };      Friend functions actually need to be forward declared before the class definition, which requires a forward declaration of the template class. We then define all the members for the base type, just remembering that it's a template class. Finally, when we want to use it, we typedef it as:               class EntityT;     typedef IDType<EntityT> EntityID;     class ModelT;     typedef IDType<ModelT> ModelID;      The types are now entirely separate. Functions that take an EntityID will throw a compiler error if you try to feed them a ModelID instead, for example. Aside from having to declare the base types as templates, with the issues that entails, it's also fairly compact. I was hoping anyone had comments or critiques about this idea? One issue that came to mind while writing this, in the case of positions and velocities for example, would be that I can't convert between types as freely as before. Where before multiplying a vector by a scalar would give another vector, so I could do:               typedef float Time;     typedef Vector3 Position;     typedef Vector3 Velocity;          Time t = 1.0f;     Position p = { 0.0f };     Velocity v = { 1.0f, 0.0f, 0.0f };          Position newP = p + v*t;      With my strongly typed typedef I'd have to tell the compiler that multypling a Velocity by a Time results in a Position.               class TimeT;     typedef Float<TimeT> Time;     class PositionT;     typedef Vector3<PositionT> Position;     class VelocityT;     typedef Vector3<VelocityT> Velocity;          Time t = 1.0f;     Position p = { 0.0f };     Velocity v = { 1.0f, 0.0f, 0.0f };          Position newP = p + v*t; // Compiler error      To solve this, I think I'd have to specialize every conversion explicitly, which can be kind of a bother. On the other hand, this limitation can help prevent other kinds of errors (say, multiplying a Velocity by a Distance, perhaps, which wouldn't make sense in this domain). So I'm torn, and wondering if people have any opinions on my original issue, or my approach to solving it.


title: How do I differentiate between old and new data in backbone collections?

text: A common pattern I come across is a backbone collection which is initially seeded from a database. However, the user can also add to the collection. When the user does add to the collection, these should be reflected in the db. Usually I would bind some kind of server call to the collection `add` event. However if I do that, the call will be made even during the initial seed. I only want it to be called on _new_ data. Whats the right way to tackle this problem?


title: business logic: client-side vs. server side

text: Let's say 3-5 years ago (more or less) n-tier application on the server side - and some javascript/html/CSS for the UI was a basic approach for web development. Nowadays we can see that traditional web development paradigm changes a lot. Each day I saw more and more application who do not have server side in traditional way. They just consume some services (data-service, auth-service, etc.) but the business logic placed on client side. Also already a lot of javascript frameworks creates for simplify development according such model (Angular, Backbone, etc.) What are the main benefits and disadvantages of new model versus traditional approach?


title: What do I do when my team leader is breaking my database schema with a release coming up?

text: My team leader has this terrible habit of mucking with the database schema, and making changes that would cause severe breakage on the code base (without really consulting me on how the changes would affect the code base). Normally, I would just live with it, but we have a deadline in 2 weeks and this has been happening ever since I started 1 and a half months ago. I was brought on, to speed up the development of the project. Due to the deadline I am already putting in 60+ hours a week, and dont really have energy left to deal with this (I have tried in some ways already). We are only a 2 man team, and besides changing the database on a daily basis, he has not contributed much in the sense of actual development (coding). Currently, I am feeling like I am doing all the work, plus having to 'fix' what he breaks with his changes. How does one deal with this? I have already spoken to our manager about his lack of effort in the development department. He has been there 6 months longer than I have, but I have written 95% of the code when you exclude the 5th normal form database monstrosity he 'contributed'. Any suggestions? **Post-mortem:** On Friday we had a discussion with manager, and I made my worries known. This led to a bit of confrontation, but overall I felt the manager was siding with me. So at least we have our data freeze in place now, let's see how it goes from here.


title: Why does Clojure neglect the uniform access principle?

text: My background is Ruby, C#, JavaScript and Java. And now I'm learning Clojure. What makes me feel uncomfortable about the later is that idiomatic Clojure seems to neglect the Uniform access principle (wiki, c2) and thus to a certain degree encapsulation as well by suggesting to use maps instead of some sort of "structures" or "classes". It feels like step back. So a couple of questions, if anyone informed:   * Which other design decisions/concerns it conflicted with and why it was considered less important?   * Did you have the same concern as well and how it end up when you switched from a language supporting UAP by default (Ruby, Eiffel, Python, C#) to Clojure?


title: How can I integrate local web development environments with a central SSO solution?

text: We have a single-page web application, and we have a new SSO site (also our own) using OAuth2, and are looking to hook them up. On our production/staging/CI deployments, it's easy to hook everything up. For instance:   * on production we'll have `https://app.company.com` access our prod backend point to `https://sso.company.com` for auth and vice versa   * on CI we'll have `https://app.ci.company.com` access our dev backend and point to `https://sso.ci.company.com` for auth. When we're doing development on the app, we access it locally at something like `http://localhost:8000/`, and it points to the shared dev backend. In the past, we've had it just do its own auth against the dev backend (getting the end user's credentials and submitting it), but we'd like to get it wired to use SSO to auth. The question comes up of how we can do this without every developer who wants to develop locally needing to set up and custom configure their own SSO service. Specifically, can we use the shared dev/CI SSO and have it point to our local deployments? **What we've considered:**   * Use a proxy file/hosts file and have `http(s)://sso.ci.company.com` point to `http(s)://localhost:8000`. This burdens us with setting up HTTPS locally or have the SSO direct to a non-HTTPS URL. Also, the setup is a bit of a pain.   * Have our local app redirect to the SSO with an argument identifying itself, and have the SSO use that to know where to redirect. For instance, redirect to `https://sso.ci.company.com/?appUrl=localhost:8000`. This forces us to punch an open-ended redirect in the SSO that we'd have to turn off for production and it is a bit "weird" but it works and can be black-boxed into the app.   * Just run the SSO locally on every dev box. This is basically the non-solution since it would require a lot of setup to get to a "one box that can run everything" script, and it negates one of our valuable advantages at the moment in that basically all you need to do is check out the code on any system and have it running. I've seen this done before commonly though (often on top of dev VMs); I would just like to explore options that we are potentially closer to. Is there a solution to this sort of problem or aspects of our ideas we haven't considered yet?


title: I want a trivial example of where MongoDB can scale but a relational database will have trouble

text: I'm just learning to use MongoDB, and when discussing with other programmers would like a quick example of why NoSQL can be a good choice compared to a traditional RDBMS - however the scenarios I come up with and can find online seem pretty contrived. E.g. a blog with lots of traffic could be represented relationally, but will require some performance tuning and joins across tables (assuming full denormalization is being used). Whereas MongoDB would allow direct retrieval from one collection to the same effect. But the response I'm getting from other programmers is "why not just keep it relational and then add some trivial caching later?" Does anybody have a less contrived example where MongoDB will really shine and a relational db will fall over much quicker? The smaller the project/system the better, because it leaves less room for disagreement. Something along the lines of the complexity of the blog example would be really useful. Thanks.


title: Structuring Resource Files

text: In .NET we've got Resource files which are great for allowing providing translations across your application. In the past I've seen these resource files grow into monolithic unmaintainable lists of words and phrases. What is the best way to avoid this?   * A single resource file for your entire application? It's easy to translate, has very few duplicates but grows to an incredible size   * A resource file per project, this has the benefit of keeping resources and code together, breaks down the file but creates a much higher chance of duplicates between the files.   * Many small files. For example a resource file per project in the BLL/Dal and one per Area/View in the UI (let's assume MVC). Having struggled to maintain massive resource files in the past I'm tempted by the third option. To create a single per controller/logical separation in the UI level. Although this may cost more in translation (and lead to more duplicates) it will be much easier to maintain. Is there another or recommended approach to handling resource files in larger applications?


title: "// ..." comments at end of code block after } - good or bad?

text: I've often seen such comments be used:               function foo() {        ...     } // foo          while (...) {        ...     } // while          if (...) {        ...     } // if      and sometimes even as far as               if (condition) {        ...     } // if (condition)      I've never understood this practice and thus never applied it. If your code is so long that you need to know what this ending `}` is then perhaps you should consider splitting it up into separate functions. Also, most developers tools are able to jump to the matching bracket. And finally the last is, for me, a clear violation to the DRY principle; if you change the condition you would have to remember to change the comment as well (or else it could get messy for the maintainer, or even for you). So why do people use this? Should we use it, or is it bad practice?


title: Deploying Web Applications

text: **Background** So I have developed an order system and order tracking for a organisation. Currently it is web based with plans to develop a mobile application and a desktop application. The business model is an exclusive membership where you sign up to be able to distribute their products at a cheaper price than other competitors. EDIT: To clarify its currently being developed using Yii Framework for PHP, but I have a basic stripped down version in PHP using no framework. It's still in a development environment, no code is live yet. **Question** What (in your opinion or the industries opinion) the most effective way to distribute this application to the members? Possibly in each of the stages of development (such as how to distribute a web app, desktop app or mobile app).


title: How do you write a linearithmic algorithmn?

text: > Write psuedocode to determine the number of pairs of values in an input file > that are equal. If your first try is quadratic, think again and develop a > linearithmic solution. I found this question in a textbook and I'm not sure how to write this algorithm. My guess at first was to write it along the formula nC2 = (n(n+1))/2. Any help is appreciated.


title: JavaFX 2.0 vs Qt for cross platform stand-alone application

text: I need a bit of advice from you developers who deal with cross-platform applications (specifically programs with a GUI). I will be creating an application soon that needs to be cross-platform and so I have done some preliminary research on two different frameworks: JavaFX 2.0 and Qt. Honestly, both would more than suit my needs. So then I asked myself why I would choose one over the other (SPOILER ALERT: I don't know the answer :P ). I do know that JavaFX 2.0 is rather new (as of 2012) and is not fully supported across platforms, but it will be eventually. The question I pose is this: which one of these would you use for a cross- platform application, and what criteria did you look at when making that decision? Thank you for taking the time to read this! :)


title: Getting into Medical Development

text: I'd like to start coding for medical techs such as 3D Echocardiograms and other imaging and sensor based technologies. I'm fine with the coding and design aspect but are there any resources on finding hospitals or organizations looking for this tech or do you just have to send out letter after letter to the business office of various hospitals?


title: Hosting own Git service?

text: I was wondering if it would be possible to install a git service for use by a small team. Would it be possible to install on a private network/locally or would it be more practical to install over a web network (e.g. a website domain). Thanks and please point my in the right direction, ~Daniel


title: Generic Adjacency List Graph implementation

text: I am trying to come up with a decent Adjacency List graph implementation so I can start tooling around with all kinds of graph problems and algorithms like traveling salesman and other problems... But I can't seem to come up with a decent implementation. This is probably because I am trying to dust the cobwebs off my data structures class. But what I have so far... and this is implemented in Java... is basically an edgeNode class that has a generic type and a weight-in the event the graph is indeed weighted.               public class edgeNode<E> {         private E y;         private int weight;              //... getters and setters as well as constructors...     }      I have a graph class that has a list of edges a value for the number of Vertices and and an int value for edges as well as a boolean value for whether or not it is directed. The brings up my first question, if the graph is indeed directed, shouldn't I have a value in my edgeNode class? Or would I just need to add another vertices to my LinkedList? That would imply that a directed graph is 2X as big as an undirected graph wouldn't it?               public class graph {         private List<edgeNode<?>> edges;             private int nVertices;         private int nEdges;         private boolean directed;              //... getters and setters as well as constructors...     }      Finally does anybody have a standard way of initializing there graph? I was thinking of reading in a pipe-delimited file but that is so 1997.               public graph GenereateGraph(boolean directed, String file){             List<edgeNode<?>> edges;             graph g;             try{                 int count = 0;                 String line;                 FileReader input = new FileReader("C:\\Users\\derekww\\Documents\\JavaEE Projects\\graphFile");                 BufferedReader bufRead = new BufferedReader(input);                 line = bufRead.readLine();                 count++;                 edges = new ArrayList<edgeNode<?>>();                 while(line != null){                     line = bufRead.readLine();                     Object edgeInfo = line.split("|")[0];                     int weight = Integer.parseInt(line.split("|")[1]);                     edgeNode<String> e = new edgeNode<String>((String)                     edges.add(e);                 }                            return g;             }             catch(Exception e){                 return null;             }         }      I guess when I am adding edges if boolean is true I would be adding a second edge. So far, this all depends on the file I write. So if I wrote a file with the following Vertices and weights...               Buffalo | 18  br Pittsburgh | 20 br New York | 15 br D.C | 45 br      I would obviously load them into my list of edges, but how can I represent one vertices connected to the other... so on... I would need the opposite vertices? Say I was representing Highways connected to each city weighted and un-directed (each edge is bi-directional with weights in some fictional distance unit)... Would my implementation be the best way to do that? I found this tutorial online Graph Tutorial that has a connector object. This appears to me be a collection of vertices pointing to each other. So you would have A and B each with there weights and so on, and you would add this to a list and this list of connectors to your graph... That strikes me as somewhat cumbersome and a little dismissive of the adjacency list concept? Am I wrong and that is a novel solution? This is all inspired by steve skiena's Algorithm Design Manual. Which I have to say is pretty good so far. Thanks for any help you can provide.


title: How do I know if a particular build has a particular version control change in it?

text: Let's say I have a build. I need to know if a particular changelist/commit is present in that build. How would I solve this problem? I can think of a couple of possible approaches: 1) Add the changelist number into the binary so that I can look somewhere in the GUI and know what the changelist number is. I can then use this information to determine if the change I'm interested in is within that build. 2) Tag version control using some string that uniquely identifies that build. What unique string would I use? Is either of these two better? Are there any other better approaches? The solution would have to work for both Mac and Windows builds.


title: Is it a bad habit to (over)use reflection?

text: Is it a good practice to use reflection if greatly reduces the quantity of boilerplate code? Basically there is a trade-off between performance and maybe readability on one side and abstraction/automation/reduction of boilerplate code on the other side. Edit: Here is an example of a recommended use of reflection. To give an example, suppose there is a an abstract class `Base` which has 10 fields and has 3 subclasses `SubclassA`, `SubclassB` and `SubclassC` each with 10 different fields; they are all simple beans. The problem is that you get two `Base` type references and you want to see if their corresponding objects are of same (sub)type and are equal. As solutions there is the raw solution in which you first check if the types are equal and then check all fields or you can use reflection and dynamically see if they are of the same type and iterate over all methods that start with "get" (convention over configuration), call them on both objects and call equals on the results.               boolean compare(Base base1, Base, base2) {         if (base1 instanceof SubclassA && base2 instanceof SubclassA) {               SubclassA subclassA1 = (SubclassA) base1;              SubclassA subclassA2 = (SubclassA) base2;              compare(subclassA1, subclassA2);         } else if (base1 instanceof SubclassB && base2 instanceof SubclassB) {              //the same         }         //boilerplate     }          boolean compare(SubclassA subA1, SubclassA subA2) {         if (!subA1.getField1().equals(subA2.getField1)) {              return false;         }         if (!subA1.getField2().equals(subA2.getField2)) {              return false;         }         //boilerplate     }          boolean compare(SubclassB subB1, SubclassB subB2) {         //boilerplate     }          //boilerplate          //alternative with reflection      boolean compare(Base base1, Base base2) {             if (!base1.getClass().isAssignableFrom(base2.getClass())) {                 System.out.println("not same");                 System.exit(1);             }             Method[] methods = base1.getClass().getMethods();             boolean isOk = true;             for (Method method : methods) {                 final String methodName = method.getName();                 if (methodName.startsWith("get")) {                     Object object1 = method.invoke(base1);                     Object object2 = method.invoke(base2);                     if(object1 == null || object2 == null)  {                         continue;                     }                     if (!object1.equals(object2)) {                         System.out.println("not equals because " + object1 + " not equal with " + object2);                         isOk = false;                     }                 }             }                  if (isOk) {                 System.out.println("is OK");             }     }


title: Entity Framework book for beginners

text: I picked up Julia Lerman 1st edition book: Entity Framework book 1st Edition I started reading that and it was pretty good, but I'm wondering if there is even a more higher level book for EF? From what I was reading in the 1st edition it was pretty technical. I'm looking for a real high level book. Almost like a precursor to Julia's book (2nd edition). Are there any out there that this group would recommend?


title: Cyclomatic Complexity Ranges

text: What are the categories of cyclomatic complexity? For example: 1-5: easy to maintain   6-10: difficult   11-15: very difficult   20+: approaching impossible For years now, I've gone with the assumption that 10 was the limit. And anything beyond that is bad. I'm analyzing a solution, and I'm trying to make a determination of the quality of the code. Certainly cyclomatic complexity isn't the only measurement, but it can help. There are methods with a cyclomatic complexity of 200+. I know that's terrible, but I'm curious to know about the lower ranges, like in my example above. I found this: > The aforementioned reference values from Carnegie Mellon define four rough > ranges for cyclomatic complexity values: > >   * methods between 1 and 10 are considered simple and easy to understand >   * values between 10 and 20 indicate more complex code, which may still be > comprehensible; however testing becomes more difficult due to the greater > number of possible branches the code can take >   * values of 20 and above are typical of code with a very large number of > potential execution paths and can only be fully grasped and tested with > great difficulty and effort >   * methods going even higher, e.g. > 50, are certainly unmaintainable > When running code metrics for a solution, the results show green for anything below 25. I disagree with this, but I was hoping to get other input. Is there a generally accepted range list for cyclomatic complexity?


title: Unit Testing in a "no setter" world

text: I do not consider myself a DDD expert but, as a solution architect, do try to apply best practices whenever possible. I know there is a lot of discussion around the pro's and con's of the no (public) setter "style" in DDD and I can see both sides of the argument. My problem is that I work on a team with a wide diversity in skills, knowledge and experience meaning that I cannot trust that every developer will do things the "right" way. For instance, if our domain objects are designed so that changes to the object's internal state is performed by a method but provide public property setters, someone will inevitable set the property instead of calling the method. Use this example:               public class MyClass     {         public Boolean IsPublished         {             get { return PublishDate != null; }         }              public DateTime? PublishDate { get; set; }              public void Publish()         {             if (IsPublished)                 throw new InvalidOperationException("Already published.");                  PublishDate = DateTime.Today;                  Raise(new PublishedEvent());         }     }      My solution has been to make property setters private which is possible because the ORM we are using to hydrate the objects uses reflection so it is able to access private setters. However, this presents a problem when trying to write unit tests. For example, when I want to write a unit test that verifies the requirement that we can't re-publish, I need to indicate that the object has already been published. I can certainly do this by calling Publish twice, but then my test is assuming that Publish is implemented correctly for the first call. That seems a little smelly. Let's make the scenario a little more real-world with the following code:               public class Document     {         public Document(String title)         {             if (String.IsNullOrWhiteSpace(title))                 throw new ArgumentException("title");                  Title = title;         }              public String ApprovedBy { get; private set; }         public DateTime? ApprovedOn { get; private set; }         public Boolean IsApproved { get; private set; }         public Boolean IsPublished { get; private set; }         public String PublishedBy { get; private set; }         public DateTime? PublishedOn { get; private set; }         public String Title { get; private set; }              public void Approve(String by)         {             if (IsApproved)                 throw new InvalidOperationException("Already approved.");                  ApprovedBy = by;             ApprovedOn = DateTime.Today;             IsApproved = true;                  Raise(new ApprovedEvent(Title));         }              public void Publish(String by)         {             if (IsPublished)                 throw new InvalidOperationException("Already published.");                  if (!IsApproved)                 throw new InvalidOperationException("Cannot publish until approved.");                  PublishedBy = by;             PublishedOn = DateTime.Today;             IsPublished = true;                  Raise(new PublishedEvent(Title));         }     }      I want to write unit tests that verify:   * I cannot publish unless the Document has been approved   * I cannot re-publish a Document   * When published, the PublishedBy and PublishedOn values are properly set   * When publised, the PublishedEvent is raised Without access to the setters, I cannot put the object into the state needed to perform the tests. Opening access to the setters defeats the purpose of preventing access. How do(have) you solve(d) this problem?


title: How to label software requirements?

text: What is a good strategy to label software requirements in an SRS? Typically outline numbering is employed on headers - but these will renumber if a new heading is inserted in the document. To me it seems like a good idea to aim for a more stable designation for each software requirement. This should make it easier to reference a particular requirement even in the face of an updated SRS. What are your experiences on this?


title: Does Silverlight5 provide anything new for WCF

text: From WCF standpoint, just wondering whether I can leverage anything after upgrade from `Silverlight 4` to `Silverlight 5`? I did some research regarding new features of `SL5` and cannot find anything about changes to `System.ServiceModel` and `System.ServiceModel.Web` namespaces, is it rigth that nothing were added or am I missing something? **My Questions:**   * Have there been any changes to WCF in Silverlight 5?   * If yes, has there been any changes to duplex polling on HTTP?


title: I have a bad memory. Is dynamic typing language+vim appropriate for me?

text: I am switching from C#+Visual Studio to Ruby+Vim for a few months. The **only** thing that I am missing from C#/Visual Studio is **intellisense** , especially when I have a new ruby gem to familiarize. As a programmer with a below-average memory like Joel, I miss the a happy time in Visual Studio that I can `Ctrl`+`Space` everywhere to get a hint list so that I don't have to memorize a single method , whether it's name or it's parameter list. I can even get it's usage/sample code at MSDN with only a press of `F1`. So, ruby(dynamic typing language)+vim/TextMate programmers, when you are coding Do you run google/gem API reference manual/irb/ri side by side with your vim/TextMate like me most of the time ? or A Good memory is a must-have for ruby(or other dynamic language) programmers?


title: What software do you use to help plan your team work, and why?

text: Planning is very difficult. We are not naturally good at estimating our own future, and many cognitive biases exacerbate the problem. Group planning is even harder. Incomplete information, inconsistent views of a situation, and communication problems compound the difficulty. Agile methods provide one framework for organizing group planning--making planning visible to everyone (user stories), breaking it into smaller chunks (sprints), and providing retrospective analysis so you get better at planning. But finding good tools to support these practices is proving tricky. What software tools do you use to achieve these goals? Why are you using that tool? What successes have **you** had with a particular tool?


title: Why five dining philosophers?

text: I was wondering why the Dining philosophers problem is based on a five philosophers case. Why not four? I guess that we can observe all unpleasant issues that can occur when discussing five philosophers example also when we are given four thinkers. Is it only for a historical reason then?


title: Is programming in the UNIX philosophy the same as Functional programming?

text: The UNIX Programming Environment (the classic text) states that the UNIX approach to programming is to build small, well-defined tools that can be combined to solve more complex problems. In learning C and the Bash shell, I've found this to be a powerful concept that can be used to deal with a wide range of programming problems. Just using a Linux platform, the concept is pretty clear and used all the time. Any expression formed on the command line that redirects I/O, linking system tools like ls, grep, more, and so on shows how powerful this concept is. The thing that confuses me is that many of these programs are written in C, using an imperative/procedural programming style, yet the way they are used and joined together on the command line seems much more like functional programming to me, where each program is an isolated function that doesn't depend on the state of any other program it might be joined to. Is this accurate, understanding the UNIX programming philosophy is basically functional programming using tools that may have been built using an imperative programming style?


title: Who owns the code I wrote, what rights do I have with respect to my employer

text: This is a legal question with mixing code I've written in my own time with code I've been paid to write for an employer. I'm employed at a company with an employment contract, and am paid hourly. This is in Ontario, Canada in case that that affects matters. I've been working on a project for my employer, and in this project I've incorporated some code that I had previously written in my own time at my house for another project (as in I own the code outright). My code is now tightly coupled with the project at work (as in it won't work without it). I have at times needed to make changes to my original code to get it working with my work project, and since I am paid hourly for my time, I've technically been paid to work on my own code. But since I was paid for it, does my employer now technically own this code? Suppose I leave this company tomorrow, do I need to leave my source code behind? I'm not saying I would, but do I still retain exclusive and unrestricted rights to my original code?


title: Is Entity Framework Suitable For High-Traffic Websites?

text: Is Entity Framework 4 a good solution for a public website with potentially 1000 hits/second? In my understanding EF is a viable solution for mostly smaller or intranet websites, but wouldn't scale easily for something like a popular community website (I know SO is using LINQ to SQL, but.. I'd like more examples/proof...) Now I am standing at the crossroads of either choosing a pure ADO.NET approach or EF4. Do you think the improved developer productivity with EF is worth the lost performance and granular access of ADO.NET (with stored procedures)? Any serious issues that a high traffic website might face, was it using EF? Thank you in advance.


title: How to justify having one (or more) mobile developers per platform

text: I've come across a situation at work where I have to justify why I need one (or more) mobile developers per platform. Although I'm quite aware of the why (each platform is substantially different, has its own philosophy, etc.) I can't seem to come up with more than that. Are there any articles I can read or even books that will give me hard data about the advantages?


title: Is it okay for an application to check for automatic updates in less than 20 hour interval?

text: I have a desktop application that has the ability to automatically update itself on the next restart (without the user's consent - but this is another issue altogether). Assuming that the user would never notice anything related to application updating (such as a progress bar, or pop-up requiring restart), and that our server would support the request spam load, is there any reason why it should not check for updates in less than 20 hour interval? The reason I'm asking this is because all applications that I know that have auto-update capability check for update every 20 to 24 hours and at startup. I was just wondering if there was an ethical rule about it, or simply because of the risk of overloading the server.


title: What techniques would you use for a next generation java web application?

text: I'm working at a site similar to Foursquare and Yelp, with approximately 100000 unique requests each week that generates content, growing steadily. We are currently using:   * Seam as Java web framework.   * MySQL as DB   * Hibernate as ORM   * Hibernate Search as Index   * EhCache for Caching. Since our site is slowly growing out of the current setup and has a lot of legacy code, it is time for us to start thinking about a major refactoring/changing setup.   1. Web framework We are not ready to change the language but we are leaning towards Spring Web Framework, since:     * Seam is no more.      * Almost all of us have worked with Spring and liked it.   2. DB and ORM We have done a little research and we are thinking about MongoDB.   3. Index Do we need to have a separate Index if we use MongoDB?   4. Cache ? So my question is basically: If you take Spring Web Framework and MongoDB into consideration, how would a good setup be for a web application that is growing and handles a lot of logged in users generating input and performing searches? **EDIT** I would like to thank all of you for taking the time to answer me, but the answer I'm looking for should be more specific: "We choose Spring as our web framework and **Freemarker** as our template language since freemarker is fast.... If you use **MongoDB** you will not need a separate index for doing geo searches since **MongoDB** supports location- based queries out-of-the-box... I very good cache solution to this setup is.... In my previous project we chose to use **Apache Solr** as our search platform because this solved the issue with fast updates..." Thank you // Jakob


title: Bug reopen vs. new

text: A bug was opened, fixed, verified and closed. A month later, it showed up again in a subsequent version after several iterations without any regression. Provided the bug characteristics are the same, would you **reopen** the existing bug ID or open a **new** one with a link to the closed bug?


title: Facing quality issues

text: A workforce management software has complex GUI (for example values in a page depends on the status (closed or open) of other pages). Only latest and near past development has test coverage. During our last release, we received lots of bugs from customer in-spite of 2 weeks of testing Sprint. We don't have dedicated test team. The developers does the unit test and User acceptance test. Every day triggers automated regression test. I am afraid the developers are not testing the entire workflow because its time consuming also not able to automate it because of its complexity. Any suggestions? The legacy code (15 years of development) has less code coverage. How can I improve quality? Note: Now not possible to hire testers to have independent test team.


title: Which development methodology for a solo programmer on a 1 month project?

text: I've been tasked with a solo project to investigate & resolve memory leaks in 8000 lines of Javascript code. I anticipate the project to take up to a month. Please recommend a development methodology I can use to structure my efforts. Prefer something light & easy to pickup and run with. Thanks


title: What did Alan Perlis mean regarding the ways to write error-free programs?

text: There's a quotation by Alan J. Perlis that says: > There are two ways to write error-free programs; only the third one works. I recently heard this quote from my friend, and was unable to understand the deeper meaning behind it. What is Perlis talking about here?


title: How to convince a teammate, who sees oneself as senior, to learn SVN conceptual basics?

text: To start with some background, I took up a new developer position this summer and ended up being the newest member on the team, yet with most experience under the belt. So far I have managed to push sanity initiatives through easily enough because of low adoption costs (in terms of time and effort). However things have leveled up a bit. One of my teammates, although experienced, does not really understand SVN. Naturally, blank areas on his mental map depicting oceans of SVN cause him to adopt rather strange usage patterns. For example, he had declared a policy of "1 SVN commit per day per developer" because otherwise "the server would soon run out of disk space". When I explained him that SVN commits are deltas, not full copies, he responded with doubt and even today I'm not entirely sure if he understands what it means. We also had a heated argument about whether to include Eclipse `.project` configuration in SVN. My teammate insisted we should, although it has caused numerous pointless conflicts. I was against keeping individual developer configuration files in SVN. Finally, it turned out that my teammate had a practice of re-checkouting the entire source tree after every commit to just make sure "code committed into repository works". That was the reason he was so adamant in keeping the project configuration in SVN - so it would be easy to re-import the project. When I explained that commit synchronizes working copy to remote byte-by-byte which makes re-checkout unnecessary, my teammate responded with doubt again and eventually waved the whole issue off as insignificant. In my opinion, our team wastes time by resolving SVN conflicts in project configuration files which contain only developer-specific settings that need not be shared to SCM at all. All this mess because someone tailored the process around incorrect assumptions. How can I convince a teammate, who sees oneself as senior, to get a better understanding of SVN basics?


title: How Do I calculate the the "Human Resources/Effort" for a programming project?

text: as a project manager or CTO how would I calculate the "time" it takes to develop a software system? For Example I would be responsible for developing a large web application in Java, MySQL, HTML, JSF. How do I correctly calculate how much time this takes? Prerequisites: I do not know the team that will do this job (so I can not ask them how long they might need). I did not do any calculations like this before. I am completely new in this role. But I have some very basic/slight programming background... Also any good resources (=links) or answers are very much appreciated.


title: Should I use Java applets or JavaScript/PHP to make my site more interactive?

text: I have a website that is about electronics. I want to make some functional calculators such as calculation for analog filters which will have to show lots of plots and stuff like that. This is a sample of what I am looking for and obviously it is only PHP and its graphic functions. I want to have similar thing but much more interactive with realtime sliders and stuff like that. What should I go for? Java Applets? or stick to JavaScript/PHP? I am asking this because I can do it with Java much faster (know it better than JavaScript and PHP). But I am afraid of browser incompatibility, security options for Applets and similar things. What is your suggestion?


title: What's the difference between the greedy and Hamiltonian methods?

text: Given _T={CTAGC, GAGCG, AGCGG, CGGAG}_ , using a greedy algorithm, the superstring _S_ will be _CTAGCGGAGCG_. From `S`, the combination of triplets will be given as _s = {CTA, TAG, **AGC** , **GCG** , CGG, GGA, GAG, **AGC** , **GCG** }_. Both _GCG_ and _AGC_ are repeated. If using _s_ to retrieve the superstring by using Hamiltonian method, would the repeated words will be used or omitted? If the repeated word is omitted, then _CTA_ , _TAG_ , _AGC_ , _GCG_ , _CGG_ , _GGA_ , and _GAG_ constructed back will become _GTAGCGGAGC_. So, in the end, both the greedy method and Hamiltonian method will provide different results in the superstring. Why are they different? In my research, all the examples I found showed that there are no repeated words in the combination, so if I reconstruct the superstring using the Hamiltonian method, the result of the greedy and Hamiltonian methods will be the same. But what about the repeated words?


title: Is this an anti-pattern?

text: I've seen this a lot in our legacy system at work - functions that go something like this:               bool todo = false;     if(cond1)     {       ... // lots of code here       if(cond2)         todo = true;       ... // some other code here     }          if(todo)     {       ...     }      In other words, the function has two parts. The first part does some sort of processing (potentially containing loops, side effects, etc.), and along the way it might set the "todo" flag. The second part is only executed if the "todo" flag has been set. It seems like a pretty ugly way to do things, and I think most of the cases that I've actually taken the time to understand, could be refactored to avoid using the flag. But is this an actual anti-pattern, a bad idea, or perfectly acceptable? Edit: The first obvious refactorization would be to cut it into two methods. However, my question is more about whether there's ever a need (in a modern OO language) to create a local flag variable, potentially setting it in multiple places, and then using it later to decide whether to execute the next block of code.


title: How can I introduce new technology to my team?

text: I work on several teams that are living in the past, and I'm trying to introduce them to new technologies like ASP.NET MVC2. What are good ways to introduce new technology in a positive light?


title: Why do some programmers think there is a contrast between theory and practice?

text: Comparing software engineering with civil engineering, I was surprised to observe a different way of thinking: any civil engineer knows that if you want to build a small hut in the garden you can just get the materials and go build it whereas if you want to build a 10-storey house (or, e.g., something like this) you need to do quite some maths to be sure that it won't fall apart. In contrast, speaking with some programmers or reading blogs or forums I often find a wide-spread opinion that can be formulated more or less as follows: _theory and formal methods are for mathematicians / scientists while programming is more about getting things done_. What is normally implied here is that programming is something very practical and that even though formal methods, mathematics, algorithm theory, clean / coherent programming languages, etc, may be interesting topics, they are often not needed if all one wants is to **get things done**. According to my experience, I would say that while you do not need much theory to put together a 100-line script (the hut), in order to develop a complex application (the 10-storey building) you need a structured design, well- defined methods, a good programming language, good text books where you can look up algorithms, etc. So IMO (the right amount of) **theory** is one of the tools for **getting things done**. My question is why do some programmers think that there is a contrast between theory (formal methods) and practice (getting things done)? Is software engineering (building software) perceived by many as **easy** compared to, say, civil engineering (building houses)? Or are these two disciplines really different (apart from mission-critical software, software failure is much more acceptable than building failure)? **EDIT** Thanks for all the answers and the interest in this topic. I would kindly ask you not to post any new answers if you do not have to add some observation that has not been covered by the existing answers yet. So please read all answers carefully before posting new ones. I try to summarize, what I have understood from the answers so far.   1. In contrast to software engineering, in civil engineering it is much clearer what amount of theory (modelling, design) is needed for a certain task.   2. This is partly due to the fact that civil engineering is as old as mankind while software engineering has been around for a few decades only.   3. Another reason is the fact that software is a more volatile kind of artefact, with more flexible requirements (it may be allowed to crash), different marketing strategies (good design can be sacrificed in order to get it on the market quickly), etc. As a consequence, it is much more difficult to determine what the right amount of design / theory is appropriate in software engineering (too little -> messy code, too much -> I can never get finished) because there is no general rule and only (a lot of) experience can help. So if I interpret your answers correctly, this uncertainty about **how much** theory is really needed contributes to the mixed love / hate feelings some programmers have towards theory.


title: Can anyone recommend a good robot kit for learning C++ robotics programming?

text: Preferably something that is a combination of affordable and close to real world robotics programming and will allow me to program it with C++.


title: Methods names prefixes and postfixes

text: Some time ago I've read some article (or it was a chapter in some book, cannot remember) about naming method prefixes, that reflect method behaviour like `addFoo()`, `setFoo()`, `removeFoo()` etc Could anyone point me to that article? Cannot google it and it makes me sad panda :-(


title: How can I change sloppy company culture?

text: Sometimes when I have a problem that needs to be solved, I find that the easiest way to solve it is by writing a small program as a personal tool. I don't make it super usable or super robust, as I am the only one going to use it, and I don't have the time to refine it and test it thoroughly. Then a coworker sees the program and asks for it, because he has run into the same problem and the tool could help. I give him the "It's not pretty but it'll get the job done" disclaimer and let him have it. Next thing I know, my superior is calling me, telling me that he's trying to get the software to work on a client's computer but it's showing X error message. WTF?? That software is not ready for release, nor was I told that it needed to be ready for release. But for some reason, my superior thought it was good enough and released it without telling the original developer. Now, this particular problem is easy to fix with a `MessageBox.Show("DO NOT GIVE TO CLIENTS!");`. However the problem is indicative of a much deeper problem: our company culture is sloppy. Sloppy software is OK and sloppy processes are OK. Don't worry about the future - put just enough effort into getting it barely working now, put the binaries in a .zip file, and ship it. Good enough for government work. This is a small company with 10 full-time employees, is growing, and has been around for a while. Don't get me wrong; I love working here and I love the company. Don't tell me to run; I want to be a part of making the company better. How do you start to bring good change to this kind of culture?


title: Objective C - nested messages ... confusion about

text: Wonder if anyone could shed some light on this messaging construct: The documentation says that messages appear btwn brackets [] and that the msg target/object is on the left, whilst the msg itself (and any parameters) is on the right: [msgTarget msg], e.g., `[myArray insertObject:anObject atIndex:0]` OK, simple enough... but then they introduce the idea that it's convenient to nest msgs in lieu of the use of temporary variables--I'll take their word for it--so the above example becomes: `[[myAppObject theArray] insertObject:[myAppObject objectToInsert] atIndex:0]` In other words,` [myAppObject theArray] ` is a nested msg, one, and, two, 'theArray' is the 'message'. Well, to say I find this confusing is a bit of an understatement ... Maybe it's just me but 'theArray' doesn't evoke a message semantically or grammatically. What this looks like to a guy who knows Java is a type/class. In Java we do things like `Class objectInstance = new Class() ... ` the bit to the left of the assignment operator is what this so-called nested message reminds me of ... with object and class/type positions switched of course. Anyway, any insight much appreciated.


title: What is the purpose of the stand-up and its duration in agile methodologies?

text: I used to work in a waterfall methodology and now I am in a team that is following an agile methodology. It seems they are doing it wrong. For example, we have stand-ups that last 25+ minutes daily, which is really annoying. Additionally, I feel more like I am justifying my salary to management than anything else. Am I wrong to feel this way? Is this how stand-ups are usually conducted?


title: How to make a "git push" update files on your web host?

text: I have a few sites which are all hosted on the same web hosting service under shared hosting. My web host supports Git and I have SSH access to it, and I also have Git setup on my laptop as well. I want to make it so that when I do a "git push origin master", it will automatically update the files on my web server, and also save a backup of the previous commit's files so I can easily rollback if I want to. Is this possible?


title: Using Java Reflection to decouple code modules

text: I'm involved in a project with several modules. I found that programmers have designed one module to be easily decoupled from its dependent modules using Java Reflection. If other modules need to call a method in this module, the programmers are expecting them to use reflection to call it. This has resulted in a lot of places with **hard-coded** reflection calls. By _hard-coded,_ I mean the class and method names are permanently fixed as Strings, which kind of defeats the purpose of reflection which is supposed to be for dynamic programming. How can this be justified? I feel they are being novice about it and misusing the reflection API. I think polymorphism is the right way to decouple a module from another without breaking functionality. (Unfortunately, changing the entire code base to polymorphism is way too much maintenance.)


title: migration and interoperability

text: A large system has already been done in visual fox pro. They want to add more requirements to a module and make some changes to the system.At the same time they are thinking about migration to .net. Some parts like report generation has been done in .net using visual fox pro database and loaded in vfp. Is it a good idea to start migrating database as well? I mean is it good to create database (and tables) for the module for new requirements and changes? I think this will cause problem and difficulty to maintain the software. How is the process of data migration initiated? Should it be done gradually (partly in visual fox pro and partly in sql) or should it be done all at a time?


title: Do gantt charts have a role in agile software development?

text: I've heard it said that gantt charts are a relic of waterfall project management techniques. I typically use an agile-like approach to project planning and tracking progress which provides good visibility into feature-time trade-offs as the project progresses. We're at the outset of a project in in which, while the exact front-end user interaction design is somewhat unclear at this early stage, the back-end requirements are fairly clear (components that communicate with various third- party APIs, the server infrastructure, etc). We'll be going through a process to develop good user interaction design for the front-end (starting with user stories and working forward from there), but we also wanted to get an idea of how long the back-end would take. I decided the best approach was to break it down into sub-components, where each component consisted of tightly coupled code that should probably be worked on in a contiguous period of time. I assigned rough time estimates to each component and sub-component, typically ranging from 1 to 10 days. I then used OmniPlan to indicate dependencies between these various components, and assigned developers to each task, with the goal of distributing effort as equally as possible. I then used OmniPlan's leveling tool. All, I think, a fairly standard way to use OmniPlan, and I thought reasonable way to come up with a rough time estimate. I should clarify that the intention was not to come up with a rigid blueprint about who would work on what and when, but more come up with at least one plausible way that we could build what we needed to build in a two month period. The gantt chart suggested that this was feasible. To my surprise, I received quite strong pushback from another team-member familiar with the agile development process, who accused me of adopting a waterfall methodology. Their more specific criticism was that the gantt chart was specified in terms of architectural components, rather than on user-visible features. They were frustrated that it didn't lend itself to saying "we should have functionality X by Y date". Where, if anywhere, did I go wrong?


title: What are great online code reviews tool for Open Source projects?

text: I would like to start new Open Source project, and I believe all check-ins should be reviewed before merged into trunk. What are some great **online** code review tools for Open Source projects that have this functionality, and what makes them great?


title: Should I use TDD and BDD if my project is changing fast?

text: I have my own little project I am creating using RoR, I plan it to have small- medium load.   With no doubt I started with BDD and TDD (Cucumber and RSpec to be exact, but I am also experienced with TestUnit), I like it but since it's my own project and it's a somewhat startup - I am changing many things in it, many requirements, many ideas how things should work and look. So it becomes too much time-consuming to always code it using BDD and TDD, even if I cover only common cases.   What should I do? Should I sacrifice BDD and TDD for productivity till I get to some point when I have a solid basis and it's time for production, and than I write tests?   Should I write them right now but as minimal as possible? Should I only write RSpec and forget about Cucumber for now? Or maybe just TestUnit to test model for now since it's the most important and everything else can change?   Thanks in advance! **Update:**   I know all the pros of TDD and BDD, by no means it makes it easier to scale and bugfix application in future and save time, but maybe it's more reasonable in my situation to wait few weeks till I have at least some skeleton architecture of my app and than once I am sure with it I can cover it with tests to have a solid base? And than continue with TDD and do all the tests with TDD.


title: Is there a name for this kind of database constraint? "Functional foreign key"? And is it a good idea?

text: Say we want to enforce that a table represents a tree. I have found this method for doing so:               create table tree (       id integer[] primary key,       parent integer[] references tree (id),       item text not null,       constraint tree_parent check (            (id = array[]::integer[] and parent is null)         or parent = id[1:array_length(id,1)-1])     );      A node in the tree is identified by its _path_ from the root node. As such, the foreign key `parent` is just that path with one element dropped off the end. The combination of `foreign key` and `check` guarantees the tree structure. **First question:** is this a good idea? Are there better approaches? In Oracle at least, I'm able to define `parent` as a virtual column, which is elegant. **Second question:** is there a name for this approach? I like to think of this as a "functional foreign key": `tree.id` references `tree.id`, but _via a function_ that drops the last element in the path. I think this concept has more general use than the tree example above.


title: Should I pay for the use of subversion?

text: I am confused about paying subversion. Our company has a solution and wants to manage the version of the source. Our company product is obviously commercial product and not open source. & it's not for distribute purpose.   1. Can I use the subversion without payment for the company?   2. Should I open the source of our solution because we use the subversion free?    3. Is there any obligation followed by this?   4. Exactly, in which case do I have to pay for using the subversion? Thank you.


title: Are my novice user stories correctly composed?

text: Is this user story substantively correct: > As a system owner, I want everybody that uses the system to have to log in > using a secure password and login system, to prevent unauthorised and random > access to system data. And then: > As a user, I want to be able to log in with my secure password, so that only > I can access areas of the system I need to do my work. I have several other stories for the system owner, like password format, lockouts etc. Is this a good place for these requirements? As stories for the system owner?


title: Deploying artifacts and dependencies on another system with Maven

text: I am coding a Java program on my development machine. Maven packages this a `myjar.jar`, and I can run it from the command line using `java -cp myjar.jar my.FantasticClass`. It uses library `somelib.jar`. I use Maven, and the project is hosted on github. When I want to run my project on the target machine, what is the best way to go? I could package my code as a jar, grab the `somelib.jar` and move it to the target machine manually, but I suppose I could also check out the Maven project from github on the target machine, run it, and have Maven both generate the jar and get the `somelib.jar` file. Or am I simply overlooking something?


title: What features/changes would you most like to see in Visual Studio 2012?

text: Or at least the "next version". There are some very interesting, grand ideas out there, threatening to revolutionise the way we code. Equally, there is likely a whole flurry of little improvements that might make the whole experience better. I do love Visual Studio 2010, it is a luxury environment for developers (in my opinion). What can be done next?


title: Why should we be aware of licenses?

text: I know this is common question, but why should a programmer be aware of software licenses as well as extensions and plugins licenses? I'm working in a company which focuses on the business process (Ruby on Rails) and I'm curious as to why they are strict on such licenses in the project development. What licenses should I be aware of and why?


title: Was Java originally designed for a toaster?

text: I've heard this tossed around few times, but never really a source. The wiki page says it was designed for home appliances, but never really references a toaster. Anyone have a source?


title: Is it bad to join open-source projects as an amateur?

text: I've thought for about six months now that I should join an open-source iPhone or iPad project to hone my skills in Objective-C, but every time I go to do it I see thousands of lines of code on huge projects that I end up convincing myself I would never understand. I always think that my commits would just end up being a hassle for project admins and more senior contributors, so I always back out at the last second. My question essentially is, **is it a hassle when an intermediately- experienced programmer joins an open-source project?**


title: What exactly is a programming language? What enables us to write in such a language?

text: Alright I'm new to programming and I admit this is a fairly abstract question. The natural language we speak every day exist because people can understand each other. How can computers understand my code written in a certain language? Let's say Mr. A creates a new language. How is that accepted by machines? Must the creator communicate with the machine using machine language to create a new language? What guarantees that we can written in a language while getting understood by the machine properly?


title: Best practice for code coverage of empty interface methods

text: Given a class that implements an interface, but does not need all of the methods implemented, what is the best practice for unit testing this class with respect to code coverage? - or is it considered a sign for a code smell? To make the problem more concrete, consider a Java class (the question is not limited to Java though) that implements `ComponentListener` but derives from some `X` (so as to rule out the choice to use `ComponentAdapter`). The class is however only interested in the `componentResized()` method and leaves the other callback method bodies empty. When checking the code coverage, we get a report that indicates correctly that the remaining methods are untested. For obvious reasons, I hesitate to add a test that simply calls a no-op method for the sake of coverage. While I am not bound to reach a certain coverage, I still think that in and of itself, this phenomenon may indicate a code smell with respect to the single- responsibility principle. On the other hand, it's not far-fetched either that a component representation is responsible for updating its state on a resize. Is there some sort of consensus or best practice on how to handle such methods, or is the question illegitimate as in it is a result of a supposedly bad design?


title: what are the practical steps of software development life cycle

text: I am building a software and trying to learn the typical steps for software life cycle, I am not sure if what I did is correct or enough so I would like to ask for the typical steps you follow during your life cycle in terms of actual steps taken for example requirement gathering is a not the step i mean, but gathering requirements using User Stories from the customer or from the requirements documents is the step I mean. This is what I do now,   1. Write User Stories from the requirement document I had.    2. Write Use Cases for these stories.    3. Collected nouns from the requirement documents and used them as classes to build class diagram.    4. Draw state diagrams for main entities in the class diagram.    5. Draw database diagram to map the class diagram to database tables    6. Started coding to 3-tier architecture.  Please tell me if I am doing it right or missing something.


title: When should a junior not be helping a senior?

text: What do you do when the person you’re helping is your senior, do you continue to help them? I've seen this happen at a previous job. A senior developer lost touch and was having trouble with the basics. He'd got lazy over years and was accustomed to loading work on the juniors. Restructuring meant that senior now had to work hard for the money. What do you do? Help or expect more from them. **EDIT:** Myself and the other seniors did help and the juniors. But the senior developer was accustom to delegating and many felt the senior developer in question just was trying to get others do their work. I was asking the question in reference to reading: When do you not give help to less experienced programmers? Basically when should you draw a line in the sand.


title: What is the best way to store files when using winforms and web?

text: I have to develop an application (in C#) that has to work with files. The application consists of two versions: a web version and a windows version. Therefore, the files must be stored on a place where both versions can access the files. In both versions, the files can be edited and new files can be created. I've been thinking about the following options to store files:   * IIS using WebDav   * Sharepoint   * Using a share and make this share a virtual directory in IIS. I don't have experience with one of these options and these were the options that came to my mind. What is in your eyes the best way to store the files?


title: Nice iterator naming

text: How do you name your iterators when you return a begin and an end iterator from a class? Without it sounding clunky, that is. Example:               typedef std::vector<Idea> Ideas_Type;          Ideas_Type::const_iterator GetIdeasBegin() const;     Ideas_Type::const_iterator GetIdeasEnd() const;      Should it be GetIdeasBeginIter? IdeasBegin?


title: Is Displaying Degree In Office Appropriate?

text: This is a little bit of a non-technical question for those working in the software development field. My employer has spent a fair amount to renovate 2 executive offices into 1 software development area. There are 3 programmers here, and I am the only one who holds a degree, and the only general software developer - my co-workers program in a scripting language that controls our hardware product. I feel that my employer is attempting to demonstrate to customers and others who visit the office that they are taking an active step in quality and functionality control by bringing the development in house (some of it has previously been contracted out). I feel that we're being looked after; new furniture, new hardware to work on, etc. I am considering whether it is appropriate to display my degree in the office. I generally feel that it would be fine, I'm proud of it and worked hard for it. My only hesitation is that there are engineers here who are much more well established in their careers who don't display any of their certifications (mind you, their work area is constructed of partition walls instead of drywall, but I don't think this is the deciding factor, but may be). I would, of course, consult my employer before hanging anything on the walls, but I thought it would be good to get a feel before approaching them. What has been your experience with this sort of decision, and are there other considerations that I am overlooking? Thanks


title: Sign Language Recognition

text: I am a final year undergraduate student of Information Technology. My team and I have taken up "Sign Language Recognition" as our Final Year Project. We have just started with it and we are in the phase of information gathering (gathering data). We plan to use Instrumented Gloves as the input device. But we do not have much knowledge in the area. Also, we came across the following methods for training the system for actual recognition of gestures and hence sign language.   1. Neural Networks   2. Symbolic Learning Algorithms   3. Hidden Markov Models   4. Instance Based Learning   5. Grammar based techniques Please tell me which of them I should use for sign recognition. Also, tell me about Instrumented Gloves and is there any specific variety which we should choose for our project?


title: What is the history behind the .NET platform's origins?

text: I watched Douglas Crockford's JavaScript talks recently, and at one point, he said that Microsoft did not consider JavaScript important because they saw the web as a passing phase of internet usage that would be supplanted by something loosely known at the time as "Internet X", and they wanted .NET to become "Internet X" Of course, the web is still with us and we know .NET as an application development platform. Can anyone tell me about the early history of .NET and how to went from being an intended replacement for the web to the platform we know it as today?


title: How to rotate an array of bits

text: ![enter image description here](http://i.stack.imgur.com/YmIEw.png) I currently have a PIL Image object which I store as an array of bits (1's and 0's). However I now would like to be able to rotate that image 45 degrees. One way to do it is take the original PIL image, apply a transform matrix on it, then convert that to an array of bits. Problem with this approach is that it's computationally expensive, especially if I want to start doing more than just one rotation. It would be faster to just modify the array of bits directly. I tried using numpy.roll:               numpy.roll(bits, 45) # rotate 45 degrees      Unfortunately, this just does a circular shift, not an actual angular rotation. What algorithm can I use on the array of bits to give me the desired output without having to go through the original image? Even though my application is in Python, your answer can be in whatever language you feel comfortable with, I'm more interested in the algorithm itself not the syntax :)


title: What is the typical workday in the life of a junior programmer?

text: I am a college student majoring in CS and I have yet to take an internship. I am wondering what the normal workday for a junior programmer is like. What is the normal daily work load like? Are there any specifics or office ettiquite to being a programmer that's different for other junior-level employees?


title: Encapsulate downcasting when returning from a method

text: In chapter 24 of Code Complete the author says, in reference to encapsulate downcasting when returning from a method, "If a routine returns an object, it normally should return the most specific type of object it knows about. This is particurlarly applicable to routines that return iterators, collections, elements of collections, and so on." Now, being a C# programmer, I typically always return ICollection instead of, say, IList or even List. By using an interface from higher up in the hierarchy I am free to switch collection type in the method without breaking the method interface. This seems like a good thing. What am I missing?


title: When not to use Spring to instantiate a bean?

text: I am trying to understand what would be the correct usage of Spring. Not syntactically, but in term of its purpose. If one is using Spring, then should Spring code replace all bean instantiation code? When to use or when not to use Spring, to instantiate a bean? May be the following code sample will help in you understanding my dilemma:               List<ClassA> caList = new ArrayList<ClassA>();     for (String name : nameList) {         ClassA ca = new ClassA();         ca.setName(name);         caList.add(ca);     }      If I configure Spring it becomes something like:               List<ClassA> caList = new ArrayList<ClassA>();     for (String name : nameList) {         ClassA ca = (ClassA)SomeContext.getBean(BeanLookupConstants.CLASS_A);         ca.setName(name);         caList.add(ca);     }      I personally think using Spring here is an unnecessary overhead, because   1. The code the simpler to read/understand.   2. It isn't really a good place for Dependency Injection as I am not expecting that there will be multiple/varied implementation of `ClassA`, that I would like freedom to replace using Spring configuration at a later point in time. Am I thinking correct? If not, where am I going wrong?


title: Why is MongoDb popular with Node.js?

text: I've been looking att different web stacks, mainly rails and node.js. One thing that strikes me is that while rails is often used with a relational database Node.js seem to go hand in hand with Mongodb, judging by the blogosphere. Is there a specific reason for this? I like the modularity of node but I'm also sceptical to NOSQL. I get the feeling that if having a rdbms is important I should use rails since they seem to be a second class citizen in the node ecosystem.


title: Is there value in learning Entity framework 4.0

text: I purchased a used book by Julia Lerman (2010) on EF4.0, and now I am wondering if the EF has changed dramatically since, I'm looking to learn this technology and i do not know if starting with a previous version matters or not ( deprecated functions, new practices, different approaches...). If I start with learning EF 4.0 will I be learning a dead or dying technology or will most of what I learn translate directly to EF 5. Are there things I should be aware of that are extremely different in the application of the 2 versions?


title: Why not commit unresolved changes?

text: In a traditional VCS, I can understand why you would not commit unresolved files because you could break the build. However, I don't understand why you shouldn't commit unresolved files in a DVCS (some of them will actually _prevent_ you from committing the files). Instead, I think that your repository should be locked from _pushing_ and _pulling_ , but not committing. Being able to commit during the merging process has several advantages (as I see it):   * The actual merge changes are in history.   * If the merge was very large, you could make periodic commits.   * If you made a mistake, it would be much easier to roll back (without having to redo the entire merge).   * The files could remain flagged as unresolved until they were marked as resolved. This would prevent pushing/pulling. You could also potentially have a _set_ of changesets act as the merge instead of just a single one. This would allow you to still use tools such as `git rerere`. So why is committing with unresolved files frowned upon/prevented? Is there any reason other than tradition?


title: Need Advice About A Specialized eCommerce System

text: I'm doing requirements/systems analysis on a particular project and could use some advice. **PROBLEM:** The project is for an organization that has a number of suppliers, with each supplier having up to several thousand items in their inventory. The supplier's inventory list will mostly be available via some sort of API. It's contain the product name, description, photos, unique identifier (e.g. barcode), and other details like dimensions, weight, colors, etc. depending on the inventory item. The organization has a number of retail stores. These retail stores may opt to sell the inventory items available from the organization's suppliers at whatever price the retail stores set. Retail stores also need the ability to:   * flag whether the inventory item is available in-store and/or online   * add items to their inventory that aren't part of the organization's suppliers' inventory list   * provide variable pricing models to the retail stores' customers (e.g. a set price for regular customer, a discounted price for preferred customers, etc.)   * allow customers to purchase items based on a line of credit For online purchases, the payment gateway/merchant account used should be either:   * the organization's payment gateway/merchant account, or   * the retail store's own payment gateway/merchant account Retail stores also need basic CMS functionality for their site, such as:   * ability to add pages   * ability to define custom data (e.g. like the "channels" concept in ExpressionEngine)   * member management The organization also need to manage the individual retail stores' website -- as well as allow the individual retail stores to do their own management/administration. So a "multi-site manager" feature + site level control panels are needed. The organization will also provide the retail stores a few templates to choose from. So, a robust templating system along with ability to choose templates would be needed. **PARTIAL CONCEPTUAL SOLUTION:** I was thinking that I should have a centralized repository for all the supplier's inventory items so that the suppliers can have a uniform way to accessing them. This would result in a duplication of data, but it might be necessary as the data will be needed for displaying product details, categorization, search, etc. Benefit of having a centralized repository are:   * any API keys that need to be managed in order to obtain the suppliers' inventory list would be in one place only   * any special code to obtain suppliers' inventory would only need to reside in one place, too **QUESTIONS**   1. Is my idea of having a centralized repository a good idea?   2. Is this a system that needs to be built from the ground up?


title: Using public API of a BSD-Licensed library in an MIT-Licensed project

text: I'm writing code that I would like to release under the MIT License. It uses the public API of a library licensed under the BSD 3-clause license. I am not redistributing the library with the source code, and I am not providing binaries, users must install the library themselves and compile from source. Do I need to include the license of the library in my project, effectively overriding the MIT License, even though I am not redistributing source code?


title: Examples of MVVM adoption outside the Microsoft community?

text: IS MVVM getting any kind of traction outside the Microsoft community? Within Silverlight this is a non-issue, but for other technologies, like JavaScript it surely is: For instance Knockout.js is a great framework, but the 'rest of the world' seems to be on a Backbone path. My concern is that MVVM frameworks (like Knockout) are going to suffer a lack of network effect by being constrained to the Microsoft ecosystem, and thus fall behind compared to the rest.


title: Is there any environments like Visual Studio for embedded systems?

text: I thought it would be very useful if there is an embedded application development tool like Visual Studio for web development. I mean when we develop web applications we have a toolbox and we drag and drop components and generally use events. In embedded systems events are interrupts. So why don't we have a toolbox which has electronic circuit components and we drag and drop them, also by clicking on them writing the behind code. Is there any extension like that for visual studio? or Is there any other environment like that?


title: Do I still own accreditation of work despite not owning copyright?

text: I completed some work at University for a website design. I understand that unless I request IP from the University they own full rights to the design. The clause is stated as below: > 18.1 All intellectual property rights in and to any work created by a > student during the course of his/her study will belong to and be the > absolute property of the University and the student will do all such acts > and sign all necessary deeds and documents to vest legal title in and to the > intellectual property in the University. The questions I have are:   1. Do I maintain any rights to the design?    2. Have I relinquished all rights to the work through this point?   3. Is accreditation and IP separate? I.e. do I still have the right to accreditation on the website despite not owning it? Any advice or help is much appreciated.


title: Are there any known effects on cognitive load of many files with one file per object?

text: There has been a trend in the Ruby/Rails community to create lots of objects that have very small functionality (SRP anyone?) and live in their own file. These are often extracted from large, bloated model files. This could be good, but I think it is often changing one problem (bloated models with hundreds of lines of code) for another, worse problem (hundreds of small object files in subdirectories several layers deep). Are there any known effects on the cognitive load difference between lots of small files and fewer large ones?


title: Why so many layers with domainobject like objects in an application?

text: Take a typical Line-of-Business Silverlight applicatioin for example.First,We have a Product table in database,which has fields of ID,Name,Price,etc; Then, on the server side,we should have a Product Entity class in the Data Access Layer,which has properties of ID,Name,Price,etc; Then, we should have a Product DTO Class with properties of ID,Name,Price,etc; Then, on the client(Silverlight) side, we have the Product DTO class with properties of ID,Name,Price,etc as Data Contract to communicate with the server; Then, We should have a Product ViewModel Class,which alse has the properties of ID,Name,Price,etc to binding with the View. **Don't these many layers of similar objects violate the Don't Repeat Yourself principle?** What if the Business Domain Model itself faces frequent change? For example, the customer wants to remove/add new properties to the product, which will cause all layers to change its code. We introduce an addtional DAL layer in the assumption that the underlying database will be changed,but in the real world, the business model itself changes far more frequently than data access or presentation logic.


title: Evaluating third-party libraries

text: At our company, we frequently use third-party libraries and frameworks in our products. Often, we are faced with the task of evaluating one or more libraries that full fill similar requirements (in a specific case we had to choose between some encryption libraries). We often do a simple prototype to try to figure out, if the library somehow works for us. However, often the prototypes get really complex and when we are at a point where we figure out, that the library is not suited for our purposes, lots of time was spend, that we could have used to write the desired functionality ourselves. My question would be, do you have or practice any guidelines when it comes to evaluating third-party libraries? More specifically, do you have something like a maximum time that will be spend on prototypes and do you have general requirements for libraries you use (license issues, support, documentation, ...)?


title: Pesky bugs - nonexistant?

text: Very short introduction (this is quite a context-heavy question): I'm a 17 year old script kiddo/programmer, doing some projects, usually netting around 20 files of 200 lines each. I usually don't program very low- level, more high-level with battery included API's like Python + pygame and Lua + WoW API. Nevertheless I've written quite some code in the lower levels of the computer too (mostly C/C++). Now, I read **a lot** of programmer discussion and a common returning argument is _preventing pesky bugs_ , for example in "reusing variable names". I always nodded and thought that it was a valid argument, but just now I wondered, how valid is it? To be honest, after thinking for a while, I figured I have no idea what they mean with _pesky bugs_. We all heard stories about phenomenal impossible-to- debug bugs, we all have spent useless evenings on that one annoying bug, but apart from a few cases I have never been busy with a programming-related bug for longer than a few hours. Though on the other hand, the projects I work(ed) on aren't huge 10 million line projects like the linux kernel, and are quite simple... scripts. I have a good understanding of them (or at least my part in collaborations) and are not very error-prone. So I'm wondering, do these pesky bugs occur exponentially more as the amount of code increases, or ...?


title: Should CMS be coupled with presentation?

text: There seems to be a growing trend for CMS systems to manage not only data capture and workflow, but to be an end-to-end product that manages presentation and end user content (like comments/forums). I thought it was a pretty ridiculous, but it seems like this approach is gaining more and more traction. It seems to me that the two concepts should be completely orthogonal. The CMS needs to either publish content to database or XML repo or expose an API (RESTful or otherwise) and remain agnostic to presentation. I'm sure there are some efficiencies in coupling, but at the expense of lock-in and inflexibility. I guess my question is, should I go with the flow or is this something I should keep fighting against?


title: from software developer to a software teacher career

text: I am a software engineer on a large company and I love what I do. However, I feel that on the long run I would like to become a teacher on these subjects, not exactly a classic uni teacher, but more like giving workshop/seminars for professional software developers. Any advice about stuff that I could start doing now to achieve that (in let's say 5 years), would be extremely useful. I live in London, UK, if that helps ...


title: Deploying Microsoft-Access databases with our application

text: Up to now we use DAO 3.51 (MS-Access 97) databases with our application. We are considering using a newer version.   * Which versions are available?   * How about deployment?   * How about royalties/licence fees?   * Any recommendations about alternatives? This question should be easily researchable, but I failed.


title: Testing an IRC Bot

text: I'm using Autumn gem to create a Ruby IRC bot for a game. However, it makes me feel rather embarrassed because I don't know how to test this kind of program... I think I should mock the IO process to have a control over it but I can't see how in this case when using the gem. Has anyone an idea ?


title: What should you include in a development approach document?

text: I'm in the middle of co-producing a "development approach" document for off- shore resources as they ramp up onto our project. The most recent (similar) document our company has used is over 80 pages, and that does not include coding standards/conventions documents. My concern is that this document will not be consumable and will therefore fail. What _should_ be in a development approach document? Are there any decent guidelines on this topic? EDIT: The development approach document should detail the practices and techniques that will be used by software developers while software is designed, built, and tested.