Some advice in open sourcing objective-c code?

I've been working on an iPhone app for the past month and am interested in open sourcing some of its code. I built a few categories that others might find useful for generating filler data during testing and debugging, and I also made a view controller for displaying images that others might like to include in their own projects. How do you go about packaging these types of things (categories, view controllers, etc.) for sharing? What are some naming conventions I should keep in mind? Is it standard practice to preface open source code with initials (EGOTableViewPullRefresh, MGImageUtilities, etc.)? Should I make an example xcode project which shows how they can be used? Should I make a webpage to document and/or promote these things? Is automated documentation generated from comments a good way to go? What sorts of licensing should I be considering?


Where should code refactoring and optimization fit within both an agile and waterfall process timeline?

There appears to be this notion among the project management team that stating that "it works" means it should then be deemed 100% complete. Most programmers know that isn't always the case. If I'm trying alternative approaches to get a piece of functionality working, that doesn't necessarily mean I found the best solution, or it won't require some rework after reviewing with other developers. I'll often get done with something, step back, and then ask myself what I can do better after the business rules are satisfied. Should this "I can do better" time actually fit somewhere within the timeline? I'm of the opinion that the best approach is that you always leave code better than when you found it (to a degree), which could mean post launch refactoring. However, project teams are often extremely uncomfortable with this approach because again, if it works, and has been tested, then why fix it?


Unit testing external dependencies

When writing a program, should I write tests that ensure that the dependencies I use are working? Those might help to check my assumptions about them, and may also help when deciding to upgrade said deependencies. Also, are there any established opinions or schools about whether or how one should go about that?


Tools for managing a complicated project setup with many frameworks and no documentation

We have to extend a huge java project that makes use of frameworks like maven, spring, struts, freemarker and closure templates. We do have access to source code but barely any documentation, and we have to extend this system. Our only solution is to find the place in the existing code, where something similar is already done. To find this place, we try to start from the action that is called and then with the help of the debugger try to find out which classes and Spring beans are involved. The stack traces from the debugger are quite hard to understand, since a lot of reflection is being used. Does anybody had a similiar setup and could provide a few tipps how to manage such a complicated setup?


Type-clarifying comments and type checking in dynamic languages

I often feel that there's something wrong when I code blocks such as:               function foo (arg){ // arg: a SomeClass object         ...     }      or               function foo (arg){         if (Object.prototype.toString.apply(arg) !== '[object Array]')             throw new Error("Parameter must be an array");         ...     }      . With a statically typed language I wouldn't have to either clarify the expected argument type or check compliance to this expectation. In addition, the possibility of specifying a return type makes the code even more descriptive. OTOH some cases lend themselves to self-documenting code:               function parse (json){         ...     }      . In the example above, it's reasonable enough to suppose that your API consumers will know both what the function is supposed to do, and what argument values will be acceptable. However other times clarifying the code intent by choosing "clarifying" names would yield long, awkward names that mix the expected type of a variable and its _role_. Am I using dynamic languages with the wrong mindset? What conventions, techniques, patterns can save one from having to write ugly type-checking code and/or excessively depending on comments?


Scrum, DDD, and front-end development in an enterprise environment

So, I've been working for a bank for the past 4 years. My main responsibility has been online banking. Over the past year, we've been implementing the scrum methodology. We've also changed to domain driven design. Now, my problem is regarding what management is planning on doing. They want to split the online banking team between the domain teams, so one developer from the online banking team will go into each domain team and work on online banking projects that are part of the domains. For example, if software development gets a project to create a new loan overview in the online bank, the loan team will handle it all the way from from database to UI. My problem with this is that there is no focus on the online bank as a product anymore. There is no way to veto any new feature. The product owners in the domains can just dump any obscure new feature into the online bank that they want to. There is also no work happening to revamp core features that our users use all the time. Every project is to make something new and once it's release, developers have to start working on a new project immediately. There is no teamwork, each web developer has to work on a separate UI for a separate domain. No hardening. Our suggestion to management is that the online banking team be it's own scrum team focusing on the online bank as a product. That team would have it's own scrum master and the online bank would have a product owner. That product owner would coordinate with the product owners of the domains and prioritize projects that have to happen in the online banks. If a project from one domain has higher priority than a project from another domain, he would explain to the domain PO that we have to work on the higher priority one first. Management hasn't listened to us. My question is, what is the right way to do this?


Been doing .NET for several years and am thinking about a platform change. Where do people suggest I go?

I've been programming in .NET for several years now and am thinking maybe its time to do a platform switch. Any suggestions about which platform would be the best to learn? I've been thinking about going back to C++ development or just focusing on T-SQL within the Microsoft stack. I'm thinking of switching because: a) I feel that the .NET platform is increasingly becoming commodified--meaning that its more about learning a GUI and certain things to click around than really understanding programming. I'm concerned that this will lend itself to making developers on that stack increasingly paid less. b) It's very frustrating to spend your entire day essentially debugging something that _should_ work but doesn't. Usually, Microsoft releases something that suggests _anyone_ can just click here and there and _poof_ there's your application. Most of the time it doesn't work and winds up sucking so much more time than it was supposed to save. c) I recently led a team in a small startup to build a WPF application. We were really hit hard with people complaining about having to download the runtime. Our code was also not portable to any other platform. Added to which, the ram usage and slowness to load of the app was remarkable for its size. I researched it and we could not find a way to optimize it. d) I'm a little concerned about being wedded to the Windows platform. What are the pros and cons of adding another platform and which platform do people suggest? Thanks!


When should an Aggregate Root contain another AR (and when should it not)

_Let me begin by first apologizing for the length of the post, but I really wanted to convey as much detail up-front so I don't take your time going back and forth in comments._ I am designing an application following a DDD approach and am wondering what guidance I can follow to determine whether an Aggregate Root should contain another AR or if they should be left as separate, "free-standing" ARs. Take the case of a simple Time Clock application that allows Employees to clock themselves in or out for the day. The UI allows them to enter their employee ID and PIN which is then validated and the current state of the employee retrieved. If the employee is currently clocked-in, the UI displays a "Clock Out" button; and, conversely, if they are not clocked-in, the button reads "Clock In". The action taken by the button corresponds to the state of the employee as well. The application is a web client that calls a back-end server exposed via a RESTful service interface. My first pass at creating intuitive, readable URLs resulted in the following two endpoints:               http://myhost/employees/{id}/clockin     http://myhost/employees/{id}/clockout      _NOTE: These are used after the employee ID and PIN have been validated and a "token" representing the "user" is passed in a header. This is because there is a "manager-mode" that allows a manager or supervisor to clock-in or out another employee. But, for the sake of this discussion, I'm trying to keep it simple._ On the server, I have an ApplicationService that provides the API. My initial idea for the ClockIn method is something like:               public void ClockIn(String id)     {         var employee = EmployeeRepository.FindById(id);              if (employee == null) throw SomeException();              employee.ClockIn();              EmployeeRepository.Save();     }      This looks pretty straight-forward until we realize that the Employee's time card information is actually maintained as a list of transactions. That means each time I call ClockIn or ClockOut, I am not directly changing the state of the Employee but, instead, I am adding a new entry into the Employee's TimeSheet. The current state of the Employee (clocked in or not) is derived from the most recent entry in the TimeSheet. So, if I go with the code shown above, my repository has to recognize that the persistable properties of the Employee have not changed but that a new entry was added into the Employee's TimeSheet and perform an insert into the data store. On the other hand (and here's the ultimate question of the post), TimeSheet seems like it is an Aggregate Root as well as it has identity (the employee ID and period) and I could just as easily implement the same logic as TimeSheet.ClockIn(employeeId). I find myself debating the merits of the two approaches and, as stated in the opening paragraph, wonder what criteria I should be evaluating to determine which approach is more suited for the problem.


C# dynamically linking different libraries and/or external classes

## tl;dr Is it possible to include an external library (and create instances of objects represented within that library) based on some condition? This must be done at compile-time, so separate builds? ## Background information ### Warning: Wall of text. If I have some code that requires a link to an external class:               using myExternalLibrary;     namespace myNamespace     {       public class Engine       {          public Engine()          {            // external class is contained            // within myExternalLibrary            public externalClass instanceOfExternalClass                   = new externalClass();          }       }     }          // external class     namespace myExternalLibrary     {       public class externalClass       {          public externalClass()          {            // constructor logic          }       }     }      By providing references to myExternalLibrary in the project that contains myClass and providing a using statement in a relevant place, I can create an instance of externalClass as and when I need it within myClass. This I am fine with. If I have some very common code that requires several different external libraries, I can do the same thing but with each of the external libraries that are required (i.e add a reference and a using statement for each one of the external libraries). However, due to the design of the software I am working on, I am required to use an external library only when certain conditions are met. I am also not to include references to those external libraries if they are not required. ## Class Detail I can't go into specifics about the class design, but this is basically what I have: I have a class (this is the Engine class) that is required to act as a bridge between the GUI and some hardware. The Engine class requires external libraries to allow it to communicate with external hardware. I have two external libraries for two separate types of hardware:   * InternallyDevelopedHardwareControlLibrary (our internally developed hardware library for controlling our internally developed hardware)   * LicensedHardwareControlLibrary (a library that we have licensed for controlling some hardware we have bought in). By default, the Engine will communicate via InternallyDevelopedHardwareControlLibrary to our internally developed hardware. However, Engine also needs to be able to communicate via LicensedHardwareControlLibrary to the licensed hardware, if (and only if) the end-user has licensed our software to run along side the externally developed hardware. LicensedHardwareControlLibrary will be licensed to the end-user with our software to some of our end-users. In this instance, LicensedHardwareControlLibrary is required to be shipped with our software. However, if the end-user has is not licensed to use LicensedHardwareControlLibrary, we are not permitted to ship that library with out software. Since Engine is taking the place of communicating with the external hardware via InternallyDevelopedHardwareControlLibrary by default, it requires a reference to it. However if a user is licensed to utilise LicensedHardwareControlLibrary, I need to add a reference to that, but only if the user is licensed to use that library. ## Question Since Engine is required to be generic, I need to figure out a way of conditionally including this second library. My initial thought was to move all of the elements of Engine to an abstract class, and to have two separate Engines (one for each of the libraries) that extend the abstract Engine class. Something like:               public class Engine     {       // all common code for each Engine       // type in here     }          public class StandardEngine : Engine     {       // the engine that will utilise       // InternallyDevelopedHardwareControlLibrary     }          public class LicensedEngine : Engine     {       // the engine that will utilise       // LicensedHardwareControlLibrary     }      The StandardEngine code will make use of an instance of the objects represented in InternallyDevelopedHardwareControlLibrary, and LicensedEngine will make use of an instance of the objects represented in LicensedHardwareControlLibrary. Or more simply put: Each of the less-abstract versions of Engine require to operate on a representation of an object that is contained within either InternallyDevelopedHardwareControlLibrary (StandardEngine) or LicensedHardwareControlLibrary (LicensedEngine). The standard build will only contain the StandardEngine class, however for some users we will need to run a separate build which also contains the LicensedEngine class. However, I feel that this will not be optimal because LicensedEngine will need to be external from the main project/library because it cannot be shipped in our standard build. What are the ways in which I can achieve this?


When do you drop old technologies from your resume?

I have been reviewing several resumes we have for a new position. I noticed that a few of them had many old programming language versions and old applications on their resume (e.g. SQL 4.2, VB5, Lotus 123, Novell). This left their list of computer experience very long. Do you keep it fresh? Do you show your depth of experience even though you will never use that techology again? When should you drop old technology on your resume? By keeping old technology on your resume does that do any harm in getting hired?


Why to say, my function is of IFly type rather than saying it's Airplane type

Say, I have two classes: Airplane and Bird, both of them fly. Both implement the interface IFly. IFly declares a function `StartFlying()`. Thus both Airplane and Bird have to define the function, and use it as per their requirement. Now when I make a manual for class reference, what should I write for the function `StartFlying`? 1) `StartFlying` is a function of type IFly . 2) `StartFlying` is a function of type Airplane 3) `StartFlying` is a function of type Bird. My opinion is 2 and 3 are more informative. But what i see is that class references use the 1st one. They say what interface the function is declared in. Problem is, I really don't get any usable information from knowing `StartFlying` is IFly type. However, knowing that `StartFlying` is a function inside Airplane and Bird, is more informative, as I can decide which instance (Airplane or Bird ) to use. Any lights on this: how saying `StartFlying` is a function of type IFly, can help a programmer understanding how to use the function?


How big of a team do you need to benefit from bug tracking software?

My development team just grew by 100% (from 1 developer to 2). My new cohort want to invest in bug tracking software. Is there benefits to such software for such a small team?


What is the Reluctant ideas at Extreme Programming (XP)

Regarding Software Engineering, there are several obstacles for Extreme Programming, one of them is reluctant ideas. Not to accepting certain kind of idea. What is the exact meaning of the term "reluctant ideas"


Software agreement for farming out development work

I'm looking for guidance from someone who has successfully hired a freelancer to assist with writing software they later marketed publicly. Simply, what kind of software agreement should I have the freelancer sign so I have full rights over the code and cannot be sued later. I'm currently independent but have plans to launch a software company once I've perfected my software products.


What are requirements for a successful SOA?

I’m an EA in an organisation with 10000+ employees. Strategically we are heading towards SOA. Currently I’m researching about SOA’s and creating a road map and I have come over many blogs that talk about “SOA is dead”. We can all agree that SOA is not just web-services. The problem is that I have hard to find any information on the reason behind SOA-fail stories in enterprises. What went bad and what went right? My question is: **What are common SOA mistakes in enterprises that make SOA fail in long term? Is the any best practice for SOA? What are the most important requirements for a successful SOA in an enterprise?** It would be good feedback towards our SOA strategy in this organisation. I have tried to narrow down the question, but it’s hard due to the nature of the question.


Why is the usage of string keys generally considered to be a bad idea?

This has been bugging me for a while. Most of the time, when it comes to storing data in structures such as hashtables, programmers, books and articles insist that indexing elements in said structures by String values is considered to be bad practice. Yet, so far, I have not found a single such source to also explain WHY it is considered to be bad practice. Does it depend on the programming language? On the underlying framework? On the implementation? Take two simple examples, if it helps: An SQL-like table where rows are indexed by a String primary key. A .NET Dictionary where the keys are Strings.


Are external configuration files considered an antipattern?

Many times I have been in a situation where an application is apparently broken, only to find that an external configuration file has been at fault. Typically this is because the wrong file is there, or that it contains incorrect data. Is there a better way to allow an external user/process to modify the runtime characteristics of an application, or is this the best known solution to the problem? I'd like to see discussion on the general case rather than focusing on, say, Unix `/etc` or Java JNDI and so on.


Task Scheduler shared hosting

I am using a shared host that which doesn't support CRON/TaskScheduler (it is a windows Godaddy server). I need to search on email server for new emails on each 1 hour, I have the script on PHP. Can I use `PERL` to emulate a task on certain times, or is there any other alternatives?


Programming interview: on sorted arrays, algorithm proof

The following is a programming interview question: Given 3 sorted arrays. Find(x,y,z), (where x is from 1st array, y is from 2nd array, and z is from 3rd array), such that Max(x,y,z) - Min(x,y,z) is minimum. This question is discussed here: http://www.careercup.com/question?id=14805690 One possible solution discussed in the career cup page is the following: "Take three pointers. Each to the first element of the list. then find the min of them. compute max(xyx)-Min(xyz). If result less than till now result change it. increment the pointer of the array which contains the minimum of them" My question is, how can we prove the correctness of this algorithm? If not, can we come up with cases where the algorithm fails. And if so, what is a correct algorithm to solve this problem with the proof.


OS choice for functional developing

I'm mainly a .NET developer so I normaly use Windows/VisualStudio (that means: I'm spoiled) but I'm enjoying Haskell and other (mostly functional) languagues in my spare time. Now for Haskell the windows-support is ok (you can get the Haskell-Platform) but latley I tried to get a basic Clojure/Scheme environment set up and it's just a pain on windows. So I'm thinking about trying out another OS for better tooling and languague support. Of course that leaves me with MacOS or some Linux distribution. I never used MacOS before and of course Linux would be cheaper (free) and I don't think I can parallel-boot MacOS on your normal PC-Hardware (can you?). PLUS: I don't have a clue about the tools you can use on those (to me) forign OSs. To make it short: I want to explore more Haskell, Clojure, Scala, Scheme and of course need at least good tooling for JavaScript/HTML5/Css. Support for .NET/Mono/F# would be great but for this I will still have my Win7 boot. So I like to know: \- what is your prefered OS, Distribution (is Ubuntu viable?) \- what Editor/IDE are you using Thank you for your help! PS: I'm not sure if this is the right place for this question but I surely hope so - if not please let me know where I should move this to (StackOverflow don't seem to be the right place IMHO)


How should web development design patterns differ from software development design patterns?

I want to become a better developer, and so have been dedicating most of my free time outside of work to learning design patterns, and when to implement them (since I feel learning general patterns is a better starting point than learning specific libraries or tools). One issue is, that the majority of highly regarded design patterns I'm reading about tend to described in terms of their applications in software development. I was wondering what should be considered when applying them to web development rather than software development? For reference, these(Reference1 Reference2) is what I've been using as a reference when picking out what design pattern would be best applied for my current project.


Immutable vs mutable object as returned parameter for class method

There is a class method (static method) in which I create and build some object. And for filling that object, I create it as mutable object. My mutable object is a subclass of immutable object. So i can return it as super Class type. That object is just created in class method and returns. It is not a part of object or class state. **Should I return mutable object or it immutable copy?** (what solution will be correct in concept of **encapsulation** ) For example there is some pseudo code:               // MutableArray is subclass of Array     MutableArray : Array;          // Another class          static (Array *)getEngineers {        Array *employees = Array.arrayWithContentsOfResource("employees.txt");        MutableArray *engineers = new MutableArray;        for (Employee *employee in employees) {           if (employee.profession == "Engineer") {              engineers.addObject(employee)           }            }        return engineers; // should I return Array.arrayWithArray(engineers) instead of engineers ?     }       **Update:** I mean, if I have a mutable array that is a member of the object, then it makes sense to return immutable copy in getter method (to provide access control and encapsulation). But if I have method like in example. I need only immutable object for using. But creating immutable copy of array is additional operations. Does it make sense to make it immutable?


How to cleanly add after-the-fact commits from the same feature into git tree

I am one of two developers on a system. I make most of the commits at this time period. My current git workflow is as such:   * there is `master` branch only (no develop/release)   * I make a new branch when I want to do a feature, do lots of commits, and then when I'm done, I merge that branch back into `master`, and usually push it to remote. ...except, I am usually not done. I often come back to alter one thing or another and every time I think it is done, but it can be 3-4 commits before I am really done and move onto something else. **Problem** The problem I have now is that .. my feature branch tree is merged and pushed into master and remote master, and then I realize that I am not really done with that feature, as in I have finishing touches I want to add, where finishing touches may be cosmetic only, or may be significant, but they still belong to that one feature I just worked on. **What I do now** Currently, when I have extra after-the-fact commits like this, I solve this problem by rolling back my merge, and re-merging my `feature` branch into `master` with my new commits, and I do that so that git tree looks clean. One clean feature branch branched out of `master` and merged back into it. I then push --force my changes to origin, since my origin doesn't see much traffic at the moment, so I can almost count that things will be safe, or I can even talk to other dev if I have to coordinate. But I know it is not a good way to do this in general, as it rewrites what others may have already pulled, causing potential issues. And it did happen even with my dev, where git had to do an extra weird merge when our trees diverged. **Other ways to solve this which I deem to be not so great**   * Next best way is to just make those extra commits to the `master` branch directly, be it fast-forward merge, or not. It doesn't make the tree look as pretty as in my current way I'm solving this, but then it's not rewriting history.   * Yet another way is to _wait_. Maybe wait 24 hours and not push things to origin. That way I can rewrite things as I see fit. The con of this approach is time wasted waiting, when people may be waiting for a fix now.   * Yet another way is to make a "new" feature branch every time I realize I need to fix something extra. I may end up with things like `feature-branch` `feature-branch-html-fix`, `feature-branch-checkbox-fix`, and so on, kind of polluting the git tree somewhat.  Is there a way to manage what I am trying to do without the drawbacks I described? I'm going for clean-looking history here, but maybe I need to drop this goal, if technically it is not a possibility. **Sample After-the-Fact Commit Messages**               Main commits:  alter module behavior to give user more information      Here I thought I was done, check out, & merge to master, then oops, forgot this (OFT):               OFT:  (enhancement) added better error messages      Okay, now I am done! Later, user comes back and asks for an enhancement/feature. Turns out a certain input number for an order can have a revision associated with it. So it's really two numbers, not one.               OFT:  (feature-add):  fix up order input to accept revisions      Now I'm done ...               OFT:  (bug-fix) there was a bug with the two-number input method, fix SQL for that      okay now I'm done ...               OFT:  (enhancement) oh wait, improved error messages again, for clarity!


How can if (sscanf(buf, "%i", &mode) != 1 || TRUE) be rewritten to if (TRUE)?

I got lost in the opening of this post on reddit. How can `if (sscanf(buf, "%i", &mode) != 1 || TRUE)` be rewritten to `if (TRUE)`? Does this assume that the `sscanf` never fails?


What is the problem git submodules are supposed to solve?

What is the problem that git submodules solve well? When should I use them? Or rather what is their use case? The only use of submodules that I have seen 'in the wild' has been when used to share code between multiple repositories. From what I have experienced, submodules do not appear to be ideally suited to this use case. You run into `git update submodule` woes and your history gets filled with `updating submodule pointer` commits. If the 'sharing code' use case is not best solved by submodules, what problems are?


Why is every programming language "powerful"?

Every time I check out a web page dedicated to some programming language I always see the word _"powerful"_ in the list of idiosyncrasies / attributes. If every programming language is powerful why do they put that word in the tutorials / documentations?


Version hash to solve Event Sourcing problems

The basic examples I have seen about Event Sourcing do not deal with out of order events, clock offsets in different systems and late events from system partitions. I am wondering if more polished Event Sourcing implementations rely on a version stamp of modified objects? For example, assuming that the system is rendering the entity **Client** with version id _ABCD1234_. If the user modifies the entity, the system will create an event with the modified fields AND the version id reference to which version it applies. Later the event responder would detect out of order events and merge them.


Recruiter asking for help understanding JEE5 or JEE6 and J2EE. (NOT A JOB POSTING NOT LOOKING FOR CANDIDATES)

I am a recruiter. I want to learn as much as I can about JEE5/JEE6 so when I try and find these types of candidates I can at least talk intelligently with them. What I need to understand is what goes without saying? So for example, if you were a J2EE or had experience with JEE5 or JEE6, could I assume you had spring and hibernate? Could I assume you had Jboss and Jboss admin? I guess it would be helpful if I posted a job description and let you guys tell me what is wrong with it? Candidate must have the following skills:   * Extensive experience with Java/J2EE Development   * Experience with various Development Tools (Eclipse, SVN, etc.)   * Database design and SQL expertise   * Web Services   * JavaServer Faces (JSF)   * Model-View-Controller (MVC)   * Comfortable working in a Unix/Linux environment   * Maven   * JBoss Deployment and Administration   * Swing/AWT   * Scrum/Agile   * TeamForge So if I was a certified J2EE would i have all these skills? Are these skills even grouped right? If you were writing this job description for a J2EE what would you change? I am trying to learn. I am not posting this to find candidates for a job. I am posting this to try and get a handle on what a hiring manager is asking for and be able to tell him, there is no way a J2EE has all these skills or, no problem, all J2EE's have these skills. Am I making sense?


Working as a sole developer: getting code looked over

I have _no choice_ but to work on my own, and can't find an adequate solution for getting my work looked over, sanity checked, having someone to brainstorm ideas with, discussing best practices and so on. I thought I'd get an answer via Jeff Atwood's article: In Programming, One Is The Loneliest Number, the best I could find on the subject, but it turned out to just reiterate my question. I know stack exchange sites such as this, and Code Review are an obvious potential answer, but as many would appreciate, it's FAR from ideal: While I can't list all the pitfalls, often, formulating a question and boxing it up into a self-contained problem often takes so much work that by the time you've prepared it sufficiently, you've answered your own question in more time than it would have taken otherwise. Also, hiding away details to ask a well defined question eliminates the possibility of someone spotting problems you hadn't thought of. Also, while I can't quite put my finger on it, the responsiveness of free conversation can't be matched by the any form of textual internet discussion that I can think of. Last but not least, I don't want to post my whole project for the world to look at for the rest of eternity, for obvious reasons. Are there any answers other than paying a consultant to look over my code?


How to get familiarized with certificate generation

I am supposed to work on web Services (using Apache CXF and Spring ) I was asked to get familiarized with certificate generation, as we will need to generate certificates going forward for the web services. One thing I knew is that they are using Glassfish server. I googled , but I didn't understand anything. I know that the information I provided is not sufficient, to expect a relevant answer But Could anybody please let me know , what will be the best starting point on this ?? and what other information should we need from the client to make it clearer ??


Why is naming a table's Primary Key column "Id" considered bad practice?

My t-sql teacher told us that naming our PK column "Id" is considered bad practice without any further explanations. Why is naming a table PK column "Id" is considered bad practice?


Why is build.number an "abuse" of semantic versioning?

I was explaining a proposed build system (Gradle/Artifactory/Jenkins/Chef) to one of our senior architects, and he made a comment to me that I _sort of_ disagree with, but am not experienced enough to really weigh-in on. This project builds a Java library (JAR) as an artifact to be reused by other teams. For versioning, I'd like to use the semantic approach of:               <major>.<minor>.<patch>      Where `patch` indicates bug/emergency fixes, `minor` indicates backwards- compatible releases, and `major` indicates either massive refactorings of the API and/or backwards-incompatible changes. As far as delivery goes here is what I want: a developer commits some code; this triggers a build to a QA/TEST environment. Some tests are ran (some automated, some manual). If all tests pass, then a production build publishes the JAR to our in-house repo. By this point the JAR should be versioned properly, and my thinking was to use the `build.number` that is automatically generated and provided by our CI tool to act as the patch number. Thus, the versioning would actually be:               <major>.<minor>.<build.number>      Again, where `build.number` is provided by the CI tool. The architect dismissed this, saying that using the CI build number was an "abuse" of semantic versioning. My question is: is this correct, and if so, why? And if not, why not?


When a developer should change technology or framework?

I'm an ASP.NET developer since 3 years ago and I'm now pretty powerful in WebForms. But now it seems that everybody is moving or shifting towards ASP.NET MVC, and my company is also taking this shift. The question is, when and how can you feel that it's the time to shift to a newer technology. For example, when and how can you feel that you have to go from HTML4 to HTML5, or CSS2 to CSS3, or ASP.NET WebForms to ASP.NET MVC, etc.?


Which design pattern is typically used when designing a WCF data services driven Winforms application?

Please excuse me as I am a bit new to the following technologies and practices. I have been given the task to create a management suite utilizing an MDI GUI. This suite will be the front end to a WCF data service. My question is, what design pattern is typically used by most professionals when designing such an application. At the moment, I have been looking into both MVC and 3-tier design patterns. If the MVC route tends to be taken, I'm assuming that because the WCF service is added as a service reference which provides visibility to all it's classes, the model part of MVC is pretty much covered? Would it make sense to generate an interface from the WCF class? If the 3-tier pattern is used, would it make sense to create datalayer objects for every visible WCF class (ex. PropertyDAL), and on top of that, business layer objects for each datalayer object? If this is the case, with there being over 114 classes which would be made visible, this would mean 228 additional classes which seems a bit bloated to me and not necessary. Here is the link to the usage of MVC design pattern which has lead me to my question.


Should development methods squash a developer's individualism?

I'm in my final semester of college and am taking a software engineering course. In the class we learn about various software development methods. The one we focused on, and used to develop our project, was the waterfall method. I feel like the instructor may have implemented it wrong. In our class diagrams, we had to list ALL properties and methods including private ones. I have read a few books, namely Clean Code, that say to keep functions as short and focused as possible. It seems tedious to list every little function in our diagrams if they don't help other developers out (they're private, no one else will use them). Plus, I may not think of every tiny function when designing the program, they may come along when refactoring. Did the instructor tell us wrong by asking us to list every function? And, do these design methods squash the developer's individualism to write code how they can best understand it?


Guiding Management to the Correct Decision

My supervisor (also a developer) and I have a running joke about writing a book called "Managing From Beneath: Subversively Guiding Management to the Right Decision" and including a number of "techniques" we've developed for helping those who make the decisions to make the right ones. So far, we've got (cynicism warning!):   * **BIC It!** BIC stands for "Bury In Committee." When a bad idea comes up that someone wants to champion, we try to get it deferred to a committee for input. Typically it will either get killed outright (especially if other members of the committee are competing for you as a resource), or it will be hung up long enough that the proponent forgets about it.   * **Smart, Stupid, or Expensive?** When someone gets a visionary idea, offer them three ways to do it: a smart way, a stupid way, and an expensive way. The hope is that you've at least got a 2/3 shot of not having to do it the way that makes a piece of your soul die.   * **All-Pro**. It's a preemptive pro/con list in which you get into the mind of the (pr)opponent and think what would be cons against doing it your way. Twist them into pros and present them in your pro list before they have a chance to present them as cons.   * **Dependicitis**. Link pending decisions together, ideally with the proponent's pet project as the final link in the chain. Use this leverage to force action on those that have been put off.   * **Preemptive Acceptance**. Sometimes it's clear that management is going to go a particular direction regardless of advice to the contrary, and it's time to make the best of it. Take the opportunity to get something else you need, though. Approach the sponsor out of the blue and take the first step: "You know, I've been thinking about it, and while it's not the route I would advise, as long as we can get the schedule and budget for Project Awesome loosened up, I can work some magic to make your project fly." So ... what techniques have you come up with to try to head off the problem projects or make the best of what may come?


do you allow people to work late?

I came across this link Parkinson Law where it says like "Work expands so as to fill the time available for its completion." Do you agree with this? If yes, how do you enforce this with the people? In our case, if we ask the people to complete the task sooner and ask them to leave, some people they feel it as demotivate. What is your opinion to avoid the demotivate feel as well as complete & leave from work soon?


Should one write Big Oh complexity in the documentation of algorithms?

When writing or using an algorithm, should the Big Oh complexity be mentioned?


Applied vs fundamental programming

My boss just let me choose what I want to do: program core that will be used by other programmers, or program applied systems that will use that core. What are pros and cons of both? What career opportunity will each one give me? What is interesting in each one?


How do I get fluid gesture motion in third party maps app on iOS?

There are a couple of apps on the App Store that use external map sources, for various reasons, to display map data. Some even have multiple sources for bike traffic and so on. However some of them are quite cumbersome to use, when panning and zooming they have a jerky motion while they keep loading and they are not as fluid as Apple's Maps app. However I did encounter some that are quite fluid and they app seem to wrap the actual "map" in a 3D sphere object that goes flat as you zoom in closer and closer. **How is this behavior achieved? Does apple provide a special class to get this kind of interaction?** I've also seen a similar solution in a Mac App Store app called Planito, the motion is very fluid and they can even display Bing Maps that way.


Greek philosophers, stone tablets and dumb slaves problem

This is one of the questions that I came across while preparing for a programming interview. > Design a system for Greek philosophers to exchange messages using stone > tablets carried by dumb slaves. Well, the guys who had this question have suggested to use analogy of a TCP/IP protocol to describe the communication and some suggested packet data communication to explain the design. Here is what I think of it going by the clues:   1. The Greek philosophers would act as 'machines' that are trying to communicate.   2. The dumb slaves would be the message carrier which is the 'network' in our analogy.   3. Stone tablets would be messages carried like the 'data packets'.   4. May be the slaves would reach philosophers by asking for the route from some random guys that will lead them to the philosopher's place just like the packets arrive at a destination using routers in the network.   5. And the message could be split in to multiple tablets and so, a message could be eventually carried by more than one slave who might take different paths and arrive in any order. There shall be a way to arrange the message in the correct order on their arrival at the receiver's end. (sequence number in the tablets?)   6. The system should also be able to handle missing tablets and in which case should the sender philosopher try and send the entire message again after a timeout?  **EDIT:**   I would like to ask the following questions:   1. Am I thinking on the correct lines?   2. Are there any important things that I am missing in the things that I have listed above?   3. This question to design a system looks vague to me. How would someone depict such a system in an interview ? Using diagrams to show interactions between entities?   4. Am I handling the missing tablets issue correctly (Mentioned as point 6. above)?


Should Sequence Diagrams be Specific or Abstract?

I'm creating a sequence diagram for a simple program I'm working on for work. The diagram I'm currently working on is very high level - it defines the interface with lots of alt paths, but does not exemplify any specific use cases. I was wondering whether would it be more appropriate to instead make several diagrams which demonstrate specific examples. I'm not familiar with the way that these diagrams are intended to be used, and I've seen both specific examples and abstract examples. Thanks!


Can a company deny that you teach people how to use a software under MIT License?

There's a way that a company/foundation that own an specific MIT licensed software (framework) deny or prevent you from teaching it to other programmers and make profit from it? And what if this company have it's own courses/classes about it? Can they prevent "anyone else" from teaching it too?


How to pick a web application software engineer?

How should I pick a web application software engineer? The (permanent) position is to rewrite the client of an existing desktop client server application. The pages will not be generated dynamically on a server, but the server will expose a full API in whatever way is needed, for example JSON RPC calls, and can make static files available. It will replace a client that people have to download and install, so requiring a decent browser with reasonable settings (e.g. JavaScript enabled) is fine. Almost all use cases are for a desktop P.C. It will not be accessible to search engines (it is an enterprise application). We can go so far as to write the whole thing in a single page, but don't have to. It would pretty much all be written by the web application software engineer in question. The exact open source libraries to use is also up to the engineer, within reason. I'm specifically looking for advice on what qualifications to look for/verify in an interview, since picking a web application software engineer in general is just too broad a topic. Edit - The position would be purely in-browser JavaScript programming (and be responsible for HTML and CSS) - other developers would develop the server but this position could request facades over the API. There is no Ruby, ASP, JSP, etc. because the web server layer is very thin and just translates calls to the business layer API and returns them as JSON (or whatever, but JSON seems easiest).


How do you organise your git repositories?

I'm struggling to phrase this question correctly, hence the poor title. Basically I have a simple Chrome extension that I am developing for work. It is in use at the moment and as I am using it regularly I am constantly thinking of improvements or extra features it could have. My file structure is like this (I'm on a mac) `~/Sites/Chrome_extensions/{my employers name}/CharCounter/` `CharCounter/` contains all the files needed for the Chrome extension. Whenever I am happy with a new version of my extension I pack it in Chrome and the resulting .crx file is called `CharCounter_{version number}.crx` So for example, the most recent is called `CharCounter_1.3.3.crx`. However, the development folder currently always has the same name. If I want to roll back and continue developing a previous version I can't. I have decided to start using git however I'm unsure how to tackle my version control. Should I set up my git repository in `~/Sites/Chrome_extensions/{my employers name}` then when I decide I am making a big enough change to the extension to warrant a new version number I duplicate the CharCounter folder and add `_{new version number}` to it? Thereby having several CharCounter folders each with a different version number appending to them. or should I set it up in `~Sites/Chrome_extensions/{my employers name}/CharCounter/` and never duplicate the CharCounter folder but just make a new commit every time I make a new version? How do you tackle version control? Does using git do away with having to keep multiple versions (current and legacy) of your code in folders called `folder_version_X.Y.Z` or is that still a good idea?


Writing simple executable script on Windows

I'm a Mac user, but I need to write a script on Windows, and I'm not sure how I should go about that. Here's the scenario: Someone adds photos to a USB drive. The drive is then inserted into a digital picture frame. In order for the photos to autoplay, a 'playlist.asb' file must be present on the drive. **I want to create a script that can be clicked on and executed to auto create the playlist file based on the image files added to the USB.** The script would do something like this:   1. Check if there are images in the 'slideshow' folder.   2. Check if file called 'playlist.alb' exists, if not create it. If so, overwrite it.   3. Loop through available images.   4. Add each image name and extension on a new line.   5. Save (and overwrite any existing playlist file) and exit. I'm comfortable with AppleScript for Macs, but I'm not sure if a Windows equivalent would make sense, or if some kind of command line script would work better. Any help is greatly appreciated.


How to design application with rollback capability

I am currently working on an application (basically its a kind of execution engine capable of running user defined jobs and generate output in real time) that needs to handle rollback functionality, it might sound crazy but is it possible to have such thing at the application level? e.g. imagine some user tries run a job J1 and once it is started to execute he wanted to Edit/Modify it ,      \- that means the current running job has to be killed,   \- all the action taken so far must be reverted and   \- re-run the job J1 again few things that comes in my mind is we must anyhow store or maintain application states somehow, somewhere and then call the rollback stuff along with the previous save points. I was reading few articles on DB level rollback but the scenario does not fit in this case as it need to work on a real time environment. But I am unable to find a proper approach as to how to proceed and what else should be taken into considerations. Please let me know if this sounds unclear, I shall try to provide more info if possible. Any help or advice?


If mutual exclusion is not implemented, how would we detect a race condition?

Suppose we are in a distributed environment, and mutual exclusion is not implemented yet. So how would we be able to detect race conditions? When I researched, use of non-blocking algorithms was found as a solution. That is using datastructures like stack, queue, etc. So that we could avoid mutual exclusion. But how do we detect it?


How much time do you give an interviewee to prepare before the actual meeting?

I thought giving 3-4 working days was fine. But now I am not so sure. The candidates these days seem to be researching me on LinkedIn, trying to hazard a guess probably on what I could ask them as opposed to brushing the fundamentals up, and taking some challenging exercises from SPOJ etc. I am just thinking should I make it a day or max. 2 days now?


Choosing an open source license such that maximum value is added to a startup

There are many companies that produce open source software products, and many business models that these companies can use. I'm particularly interested in companies like 280 North, the company behind Objective-J and Cappucino frameworks. My understanding of this organization's business model is that they:   1. worked to develop a tool which added significant value to developers,    2. released the tool under an open source license,    3. built a community around the tool (which was helped by the project's open source licensing),    4. created interesting demos illustrating the project's value All of these things added value to the project, and the company that owned it. Finally, 280 North was sold to Motorola. My question has to do with the role of software licensing in this particular business model. 280 North licensed their software projects under the LGPL, which gave them some proprietary control over how the project could be used. I believe that the LGPL is what's known as a "weak copyleft" license, meaning that the project can be linked to, without the linking code also being licensed under the LGPL; but software derived directly from the project would need to be licensed under the LGPL. For web-oriented libraries in particular, weak copyleft, or non-copyleft licensing seems to be quite common; I can't think of a single example of a popular or well-known web-oriented library that is licensed under the GPL (or AGPL). The question then, is, how much value would a weak copyleft license like the LGPL add to a software venture like 280 North, versus a non-copyleft license, such as the BSD license or the Apache Software License? I'd really appreciate any insight anyone can offer into this, but I'd be most interested in answers that can cite other companies as case studies or examples.


How do we set a link to a Paid version of app if we don't have the app in App Store ?

If we don't have the free and the paid apps on the Apple app store yet, how would we program in the free version to link to the paid version because the link is not there yet? Do we have to have a webpage as a placeholder to do the forward, for this first, initial case? Is this the only solution and what if we don't have a website?


Redmine (or Trac) integration with customer issue-tracking system

I'm working in a software development area in my university, and we've noticed we need some system to track errors and bugs, who and when it is dealt with. I've researched some software management/bug tracking applications, with Redmine being the one that appeals to me the most because of its simple UI (actually I discovered that our server has one system, Trac, already installed, but it has never been used at its time and my colleagues told me it would take the same time to use any). However, a colleague told me also that he has the idea of implementing a _customer issue-tracking system_ in the medium/long term (he told me about creating tickets for users' problem, search into a knowledge base of common problems, and mark frequent problems to deal with them. It seems that things like OTRS are close to what he was thinking about. He's also researching about ITIL). As far as I know, the developer issue-tracking system and the client problem- tracking system are different, and they must have some kind of integration between them. **Or aren't they?** In case it does, my question is: Is it possible to integrate Redmine (or Trac, if it's easier, or in general a project management/bug-tracking system) with this kind of customer issue- tracking systems? Do I have to worry about changing my project management system in the future to implement that? Or is the implementation easier with some of them?


Do certain corporations hold more weight on a resume?

Would a developer/tester position at Google, Apple, Microsoft, etc. (any large tech. company of which most people have heard) be more valuable on a resume than working as a developer/tester somewhere where tech. isn't the main objective (shipping company, restaurant chain, insurance company, etc.)? Let's say you have two offers, and you only plan to stay with whichever company for 5 years, before trying to get a better position at a different company. One at Google that has a starting salary of $60,000, and one at some insurance company that has a starting salary of $80,000. I guess what I'm trying to say is... with university's, if someone graduates from MIT or Carnegie Mellon, they can pretty much get a job anywhere. Does someone seem more valuable after having worked at a company like Google, Apple, Microsoft, etc.? In other words, would taking the lower paying job be better in the long run since it's at Google, or would it be better to take the higher paying job at the insurance company?


Shift Javascript framework - What pattern is this? MVP, MVC or something else

I have created a very tiny framework to be able to get away from all the clutter while developing. The point of the framework is not to replace any library of choice but simply segregate the code to it's correct logic. You can see the source on github along with a few code examples: https://github.com/erik-landvall/shift While I try to describe the pattern I'm using I'm starting to wonder how this should be defined. And that's my question for you. What would you say the following chart symbolizes? ![Flowchart of the shift framework](http://i.stack.imgur.com/3TAXX.png) I like to think of it as an MVP pattern, but would like to hear your opinion. Also, if you feel that the flowchart poorly resampling the code, give me a comment about it and I will attempt to fix it.


How should data transfer between a client and a web API for normalized data be designed?

I want to design an API backed by some database (doesn't really matter which, but to make the discussion more interesting, let's say it's Mongo - explanation below) which sends data to a client. The database contains several types of records. Some of them reference other types of records.   It's not uncommon for a record to be referenced by several other records from different types. Thus the data on the DB is normalized. **What are the considerations in designing an API server which sends records to the client?** Two options come to mind (you're invited to suggest more or correct me on those):   1. The API is granular. Send normalized data. Let the client ask for more records based on what it receives. The client may have a cache, it may decide it doesn't need to ask the server for everything.   2. The API sends all the records the client might possibly need based on the requested data. Thus effectively denormalizing the data. With option 1, the client may make more HTTP requests so it can have the complete data it needs. It means more network communication, which may make the total data transfer slower. The server is simpler though, and the client can selectively ask only for the records it doesn't already have. With option 2, less HTTP requests. But we may send the client data it already has (maybe it already received, and cached, some of the records in a previous request). The server is more complicated. Especially if it's not RDBMS. No joins in Mongo, so we have to query the DB more than once to get all the data. Further assumptions:   1. The data changes every few days (2-3 times a week). So the client can potentially have a persistent cache.   2. The Mongo queries are a bit slow (millions of documents in each collection).   3. In each such session about 2MB of data will be sent to the client.


Are these company terms good for a programmer or should I move?

Here are some of the terms and conditions set forward by my employer. Does these make sense for a job like programming? >   1. No freelancing in any way even in your free time outside company work > hours (may be okay. May be they wanted their employees to be fully > concentrating on their full time job. Also they don't want their employees > to do similar work for a competing client. Completely rational in that > sense). -> So sort of agreed. >   2. Any thing you develop like ideas, design, code etc while I'm employed > there, makes them the owner of that. Seriously? Don't you think that its bad > (for me)? If I'm to develop something in my free time (by cutting down sleep > and hard working), outside the company time and resource, is that claim > rational? I heard that Steve Wozniak had such a contract while he was > working at HP. But that sort of hardware design and also those companies pay > well, when compared to the peanuts I get. >   3. No other kind of works allowed. Means no open source stuffs. Fully > dedicated to being a puppet for the employer, though the working environment > is sort of okay. According to my assessment this place would score a 10/12 > in Joel's test. > So are these terms okay especially considering the fact that I'm underpaid with peanuts?


design for supporting entities with images

I have multiple entities like Hotels, Destination Cities etc which can contain images. The way I have my system setup right now is, I think of all the images belonging to this universal set (a table in the DB contains filePaths to all the images). When I have to add an image to an entity, I see if the entity exists in this universal set of images. If it exists, attach the reference to this image, else create a new image. E.g.:               class ImageEntityHibernateDAO {             public void addImageToEntity(IContainImage entity, String filePath,                     String title, String altText) {                 ImageEntity image = this.getImage(filePath);                      if (image == null)                     image = new ImageEntity(filePath, title, altText);                      getSession().beginTransaction();                     entity.getImages().add(image);                 getSession().getTransaction().commit();                  }     }      My **question** is: Earlier I had to write this code for each entity (and each entity would have a Set collection). So, instead of re-writing the same code, I created the following interface:               public interface IContainImage {         Set<ImageEntity> getImages();     }      Entities which have image collections also implements `IContainImage` interface. Now, for any entity that needs to support adding Image functionality, all I have to invoke from the DAO looks something like this:               // in DestinationDAO::addImageToDestination {     imageDao.addImageToEntity(destination, imageFileName, imageTitle, imageAltText);          // in HotelDAO::addImageToHotel {     imageDao.addImageToEntity(hotel, imageFileName, imageTitle, imageAltText);      It'd be great help if someone can provide me some critique on this design ? Are there any serious flaws that I'm not seeing right away ?


Is allowing voting without sign-in always a bad idea?

I have a mobile app from which I'd like to allow voting on Things. I don't want to force all the users to have to sign up using email/Facebook/etc. just so that I can properly limit voting. Is it really a bad idea to leave voting to be an "open" process where anyone can vote? I know theoretically that this allows improper voting techniques, etc. but on the other hand getting more votes really don't offer any kind of financial motivation. \--Edit-- Perhaps there are some ways to limit vote-faking? I know theoretically nothing is unbreakable, but maybe I can limit the amount of votes something can get in a minute/hour/day? \--Edit 2 -- Think of it as "views" on a video. It is a simple measure of popularity that requires no login. What are ways to limit view tampering, and when is it necessary?


No microsoft-official C# documentation generator?

I was unable to find any "official" documentation generator for C#. I am aware of projects like DOxygen, Sandcastle or NDoc. But for me these are more third- party tool. You could argue that javadoc is an external tool but it's part of the java dsitribution. What is Microsoft option, if any ?


Command execution structure for graph database

We're building an application which uses complex data with rich relationships. In order to allow us to make the most of this data and easily extend the model, we have decided to use a graph database (Neo4j with Cypher). I'm exploring the use of a CQRS-based application architecture (without event sourcing) to allow us to fully utilize the flexibility of the graph via varied commands and a flexible, almost ad-hoc read side. What I am currently wrestling with is how to structure the persistence part of the command side in such a way that we retain the flexibility of the graph but don't lose too much structure in the application (e.g. via repetition in Cypher queries or large, overly verbose interfaces). I've considered a few options:   1. Use repositories and aggregates, persisted either via reflection or accessors. The benefit here is that the interfaces are simple, the downside is that the repository itself could become complex for aggregates including many relationships (there are no well-maintained .NET ORMs for Neo4j). Another downside to this is the potential to load lots of unnecessary "aggregate fluff" into the domain for simple commands that don't necessarily need it (this problem applies even if I eventually steer away from CQRS).   2. Specialist repositories that expose more constrained commands (e.g. `AddThingToOtherThing`) that are invoked from command handlers. The benefit here is that there's no unnecessary querying. The downside is potentially large, clumsy repository interfaces (maybe there's a nicer way to break this up?)   3. Use _events_ (not event sourcing) and use event handlers to explicitly execute graph DB commands. The good thing here is I only ever execute the DB commands that I need to but my DAL becomes dispersed and more coupled to the application - thus, potentially harder to maintain. Is there a middle ground/alternative pattern (or even simplification) that I haven't considered?


Helping with creating own PHP MVC - how to write good router

1 year ago I created wannabe-MVC in PHP (some parts procedural, some in classes), now I'm intending to expand it a further to be more like real MVC. Folder/files structure:               html/     html/images/     html/css/     html/js/ (my JS)     html/js/lib/ (jquery...)     app/     app/controller/     app/include/ (special functions)     app/lang/ (languages - en.php, de.php...)     app/lib/ (php mailer, image resize class, facebook sdk...)     app/log/ (error log)     app/model/     app/view/     app/view/include/ (part of views that repeat - navigation, pagination..)     app/config.php     app/ini.php     index.php      In index.php I call router class where I find what controller and view to load, but it's written in switch case way. Have problems with autoload because it's dependence on the Database. **URL structure (fixed router):**               / (homepage) -> homeController.php     /error404/ (error page) -> error404Controller.php     /users/ (list all users) -> usersController.php     /users/2/ (page 2 of all users)     /users/login/ (login page) -> usersController.php?action=login     /users/login/facebook/ (when logging in, facebook redirects to this page) -> ??     /users/some-username-{ID}/ (user profile - a-Z-0-9 username and ID of that user) -> usersController?action=single      **URL structure (custom router - DB dependent):**               /categ/ (default router, getting categ from DB and list news of that category) -> categController.php     /categ/2/ (2nd page of category list of news)     /categ/news-title-{ID}/ (get single -> newsController.php     /categ/subcateg/ (get categ and subcateg from DB) -> subcategController.php     /categ/subcateg/2/ (2nd page of subcateg)     /categ/subcateg/news-title-{ID}/      and its goes to level 4 - categ/subcateg/subsubcateg/news-title-ID/ **userController.php (simplified)**               userController extends mainController{         function index(){             $users = new user();             $users->limit = 10;             $users->where = "is_active='1'";             $users_list = $users->loadAll();         }     }      **userModel.php (simplified)**               userModel extends mainModel{         public $tableName = "users";         public $limit = 20;         public $where = '1=1';              function loadAll(){             global $db;                  $load = $db->fetch_all('SELECT * FROM $tableName WHERE $where LIMIT $limit');                  return $load;         }     }      Questions:   1. How to create **Router class** to match this mix of **fixed and custom urls** ? Now is simple **switch case** where **custom router** is in **default: case**   2. Where can I put **user data** \- check if user is logged in or not so i can pull data based on that ? **init.php, userModel.php, userController.php** or ? I need this info before view loads...   3. Where to put querys that repeats like getting top navigation or footer data when it loads on every page ? in some **master controller or model** that loads automatically no matter on what page user is.   4. Is this good start or am I something wrong about, if yes, what ? I readed many MVC tutorials and someone says you need **fat Model** , someone says **fat Controller** so what is good practice here ?


Method vs Function vs Procedure

Simple question, but I often hear these three terms defined with such ferocity, but which have been known to me to mean different things over the years. What are the "correct" definitions of "Procedures", "Methods", "Function", "Subroutines", etc? Thanks!


Code Style for XAML

I started coding WPF applications a several months ago and now I am asking myself if there are some style guides for XAML. I do not need to get explained the benefits of Binding, Converters, Styles, Templates etc. My question is more basically. Is there an official (or unofficial) „best practice“ about the order of attributes etc: For instance:               <ComboBox Grid.Column="0" Grid.Row="0"               Name="CellType"               ItemsSource="{Binding EditorTypes}"               SelectedItem="{Binding EditorType}">      Is there something like   * always attached properties first [last]   * always declare a column [row] in a Grid, even if there is only one  Are there some rules/guides I should read to make my code look more common?


What technologies are needed to be a freelance web developer / designer targeting small businesses?

First off, I'm not looking for this answer: "learn PHP/MySQL, JQuery, HTML/CSS...." My background, I wear many hats, and do many things. Currently I manage investment accounts with a business partner who is also a friend. He happens to be attending business / law school perusing a joint JD and MBA. As a result, we're putting our into "coast", maintaining our current clients, but not acquiring more. Recently I've picked up some freelance graphic design / web development / online marketing side work (Photoshop, HTML/CSS, WordPress) through some personal networks. The work is enjoyable; now I'm thinking about expanding it into a larger business with these primary goals:   1. augment my finances (I'm shooting for about $1,000-2,000 per mo.),   2. learn new technologies,   3. involve myself with meaningful work. As an entrepreneur I don't mind the aspects of running a business that hassle other freelancers...   \-- the marketing   \-- the billing   \-- etc. I'm considering targeting the small to middle market businesses and organizations where I can contribute in marketing, design, and development building projects from the ground up. Thus I'll have freedom to decide the specific technology (I won't have to work with an existing code base). **What kinds of projects should I focus on? What technologies are a good fit for this style of work?** For example: It might be fun to develop with Ruby on Rails. However, maybe a lot of projects would be rolling out e-commerce solutions. Thus, I should focus on PHP due to more shopping cart options, skipping ROR entirely.


Term for accidental features

Despite the best intentions of programmers; oftentimes, in the real world, software systems contain "accidental features" that are accepted as part of a working system. For example, there may be some process that runs out of memory and crashes before the process exceeds its quota for calls to an external system (which will cost the company money). Though the software team acknowledges that this is an issue, there is simply not enough perceived business value to fix the problem. Advantageous accidental behavior like this is often lost in any type of significant technical migration. My question: **Is there a term for this type of "feature" that can serve to differentiate it from a run-of-the-mill bug?**


Providing an agnostic authorization system

I'm trying to design a small web platform that would host several "applications", with a common user pool. My reflection is now focused on the authorization system. I define an application as an interface that allows users to perform CRUD and more custom operations on a set of resources. I tend to prefer to model an application as a collection of RESTful webservices to be consumed from various front ends. I really would like to generalize the authorization system and to make it application agnostic; I'm thinking of implementing it as a webservice, leveraging unstructured document databases. Assuming that:   * A users and groups management service is available to the application developer;   * The scope of any application would be limited to perform CRUD and more custom operations on resources, as stated previously; My idea is to provide to developers read/write access to a structure like this:               [{         "Application":"Application1",         "Ressource":"ResourceType1",         "id":"123",         "read":{             "whitelist_group_ids":[ 2 ],             "whitelist_user_ids":[ 1 ],             "blacklist_users_ids":[ 2 ]         },         "CustomOperation1":{             "whitelist_group_ids":[ * ],             "whitelist_user_ids":[ 1, 2 ],             "blacklist_users_ids":[ 3 ]         }     },{         "Application":"Application1",         "Ressource":"ResourceType2",         "id":"13",         "read":{             "whitelist_group_ids":[ * ],             "whitelist_user_ids":[ 1 ],             "blacklist_users_ids":[ 2 ]         },         "CustomOperation2":{             "whitelist_group_ids":[ 2 ],             "whitelist_user_ids":[ 1, 2 ],             "blacklist_users_ids":[ 3 ]         }     }]      They would then be able to store, check and update their access restrictions on demand; What would be the flaws of such an approach? Is there any standard strategy to achieve something close to what I described?


How do you choose a programming/data structure/algorithm book?

I really should not be mentioning the name of the book, but the first time I read it (during my under-grad days) I almost concluded that data structure was a bad course to pick. Which brings me to the question I am asking here. What makes a programming or data structure or algorithm book tick? Clearly, lucid explanation is one. But I also realize that organization of the material is very important and so is diagrams. What else? Some pointers would obviously help when I hang out in my neighborhood computer book shop the next time.


Inheritance in test classes

I have an interface `Serializer` with methods `serialize` and `isSerializerFor`. I created a first implementation of this using TDD, and ended up with a nice clean test case fully covering a nice clean implementation. To get a more concrete idea, here is one relevant commit. Now someone else (who is not used to doing TDD) started with writing the second implementation of this `Serializer` interface. This person figured the test needed for the second implementation would have some overlap with my initial test. So an abstract base class for serializer tests was created, holding the methods that are suspected to be common to all serializer test cases. I'm not happy with this for two main reasons. First of all, the only reason inheritance is used here is for code reuse, which is a big code smell. Secondly, this breaks the TDD cycle. If I now want to create another implementation of `Serializer`, and create a derivative of the base test class, I end up having to implement all production code in one step. On the other hand, simply duplicating the common code in the test classes seems rather odd as well. I'm hoping composition can be used here in a sane way to avoid these problems. This seems like a reasonably common situation. How would you solve this? What would you do differently?


Observer pattern over HTTP and TCP/IP (Server-Client)

I have a server and many clients (around 50 clients) who connect to that server based on a web application, which is of course based on HTTP protocol, which in turn uses TCP/IP (correct me if I'm wrong, cause I'm not really good at networking). The problem is that, I should develop an alert mechanism, in which, when somebody submits a form with dangerous values, the manager (who is also connected via the same web application) should receive an alert pop-up on his screen, almost real-time (instantly). However, since the HTTP protocol is stateless, I' a little puzzled here. I don't know how I can implement this. One of the solutions could be to use JavaScript alongside `setInterval()` function to **pull** data each second from server. But this seems a little dirty to me and unprofessional. Do you guys have any idea of implementing another solution?


NDIS Driver Filter VS API Hooking

I've seen many developers asking for "How to intercept in/out HTTP packets ", "How to modify them on the fly". The most "clean" answer I've seen is to make a kernel-mode-driver filter from the scratch (TDI for XP and earlier winx9 or NDIS for NT systems). An other way, is to use a user-mode-driver like Windivert, also Komodia has a great solution (without writing any single code). The idea behind this introduction is just I want to know is API Hooking can be considered as alternative of writing of whole of driver-filter? writing a driver from the scratch is not an easy task, why just not Hooking the HttpSendRequest or any other API used by the browser? There are many free/commercial libraries to do this in a safe manner (eg: EasyHook, Mhook, Nektra..). I'm not the first who ask, there already Sockscap that uses Hook(DLL injection) to change behavior to other applications and force them to use a Socks proxy, also Form grabbing attack ' _used by keylogger.._


Program modules separated in different DLLs

We have an existing ERP system written in VB 6 that we are converting to .Net incrementally. Now, every module in the system is being separated into DLLs so that the product becomes customizable and flexible. I'm not sure if this is the way to do this. I think this will cost a lot of maintenance in the future. What do you think?


Where should I place my interface?

I have an interface to communicate with a DB (actually it is not a database, but this is to give a concrete example):               interface DbInterface{         Result sendQuery(Query q);     }      And I am trying to improve reusability by separating specific components into individual projects:   * App1, an application that requires access to a database   * App2, an application that requires access to a database   * DB1, a concrete implementation of DbInterface (let's say SQL)   * DB2, a concrete implementation of DbInterface (let's say using some NoSql database) How do you typically design such an architecture and where should `DbInterface` be located?   * in one of the applications? but that means all other three component depend on that project to access the interface - does not sound right   * in one of the DB implementations? same - does not sound right.   * in both DB implementations? code duplication.   * in a separate project, which would only contain that interface? seems abusive to include a dependency for one interface only. For reference, this is Java + maven, but the issue is fairly generic I suppose.


New PHP Project - Should I still be supporting PHP 5.2?

I'm about to start working on a new commercial PHP project with a friend that will be licensed and sold as a script to run on your own shared hosting account or server. Looking at the statistics (http://w3techs.com/technologies/details/pl- php/5/all) 50.3% of PHP 5 installations are still PHP 5.2 or lower (43.5% being php 5.2). With this in mind, is it wise to ensure new software still supports PHP 5.2 given that such a high proportion of installations arent going to support modern PHP features such as namespacing and the likes of Composer.


Pass around record ids in the url in PHP

I'm doing a PHP application with CodeIgniter and most of my controllers accept record ids as parameters for retrieving purposes. I also pass record ids in my forms action. Like this: www.sample.com/records/save/sFKu=4 Is this the right way to do this? Note that the record ids are encrypted.


How can I maintain proficiency in multiple languages?

How can I maintain proficiency (if not expertise) in multiple languages? In any large organization it seems necessary to know more than one language. For example, this week I've looked at if not written code in the following languages.   * VBA   * C   * C#   * Java Thankfully they're all imperative languages, or I would have lost my mind. I struggled for a day or so with the C as it's been a while (read: years) since I've used it seriously. What tips, habits, and training is there for keeping up your knowledge in so many languages?


Single sign on if you do not have control of one or more of the client/web apps?

I have a customer who has a client app and when they log in to their client app, they will see a link to my website. When they click on the link, it should log in them in automatically to the website without asking for the credentials. Is this only possible if the username/password are the same between the client app and the website? Also, what if the username/password is not known for the client app? How is this handled? I have heard of technologies such as openId, oAuth, etc, but these don't seem to fit my scenario where there is an existing client app that already has a membership base and it not needs access to my website. I am not sure what approach to make take here? If the above is confusing, I will give a scenario:   1. User A logs into there desktop application.   2. User A clicks a link to go to wwww.mysite.com.   3. User A is authenticated and authorized for www.mysite.com, so they do not need to provide credentials.


FizzBuzz - really?

When it comes to "interview test" questions, the subject of FizzBuzz often comes up. There is also a Coding Horror post about it. Now, if you bother reading sites such as this, you are probably less likely to be in the demographic of programmers who would find FizzBuzz anything but trivial. But is it really true that 99% of programmers will struggle with it? Really? What is the evidence to back this up? Some real-life examples would be very helpful in answering this question.


Why does Android's Bundle API accept ArrayLists rather than Lists

I'm new to Android and while going through a tutorial on saving `Activity` state to a Bundle, I noticed that instead of accepting the more generic `List` interface, `Bundle`'s put methods are expecting `ArrayLists`. Example:               Bundle.putCharSequenceArrayList(key, value)     Bundle.putIntegerArrayList(key, value)     Bundle.putParcelableArrayList(key, value)     Bundle.putStringArrayList(key, value)      Most of us are familiar with item 52 of Effective Java suggesting that objects must be refered to by their interface, so I am wondering what was the reason behind this API decision. Is `ArrayList` perhaps the preferred list implementation in Android?


Find the average speed for roads

I am working on a mobile application and I would like to ask you a question. Is there an API or a method to get/calculate the average speed that a car should have in a road. I am working on a GPS like application and I want to calculate the average time that it will take a user to cover a certain path. Thanks.


Is Systems Hungarian notation still a useful practice?

I searched the forum, but I couldn't find the answers why it should be avoided, only why it's not a silver bullet. So I don't think this question is a duplicate. Is there a **VALID** reason why I should unlearn Systems Hungarian I'm used to? So far I see the following benefits in using it:   * Consistent variable naming   * You see type without searching (intellisense is dead/indexing half of the time, so it's still a valid reason)   * Semantics can still be packed into second part of the name And following downsides:   * It annoys some people (no idea why)   * If type is changed, the type might not match the naming of the variable (I don't think it's valid reason, types are changed rarely, and you have "rename all") So why:               vector<string> vecCityNames;     wstring strCity = L"abc";     //more code here     vecCityNames.push_back(strCity);      is worse than:               vector<string> cityNames;     wstring city = L"abc";     //more code here     cityNames.push_back(city);//Are we pushing back int on a queue? Float on a stack? Something else?


How can we verify that software meets specifications meets requirements?

So we're pretty good at eliciting requirements from our end customers, business division and sales/marketing. We plan projects to add/enhance features to meet those requests and prioritize tasks to meet deadlines in most profitable order. Over time, the software product has grown, the market has changed and the original customers are less of a priority compared to some new opportunities. So, the requirements, and therefore specifications, have changed, although all the requirements of all the stakeholders can co-exist (there are no conflicts). We've also had some churn in the development team with people moving up, across or out and so now there's nobody who was there "at the beginning". This has led to some customer outages where we removed what looked like unused code paths (the logic was unfamiliar to everyone) only to find the customer that needed that logic happened to run through the application a couple of months later. We know that we could put in Unit Tests to verify that behaviour does not change accidentally (as in the case above), but this is a large code-base so it is taking time to unit-test everything. What non-manual techniques/technologies/best-practices are available to us to verify that the software (still) meets the specifications and requirements? I've heard agile/iterative proponents say something like "the Unit Tests are the specification". Is there any thing we could use to marry the unit tests to the original requirements? * * * _Footnotes_ (I saw this other post, but that is less about verification and more about usability testing) We already do iterative development, releasing every two weeks or less. The source base is mostly C++ on Unix. Requirements and specifications currently documented in Wiki, Word, ticketing systems and MS Project.


How can I track quality attributes on my team's Kanban?

My team uses a Kanban system for tracking day-to-day progress and it's worked out really well for understanding progress on features (captured as user stories). We have largely allowed our system design to emerge as we develop features which worked out well until recently. In the last two week we've had several discussions about architectural trade-offs specifically related to performance and modifiability quality attributes. I think what's happening is as we implement features and design the system, we're implicitly making decisions about the architecture but not considering those decisions in terms of our known quality attribute requirements. It would be really great if I could track/capture/visually depict how these important design decisions are being made so team members have a better chance to not create additional tension with in the system's architecture as it is being implemented. And of course, to complicate things more, features on our board aren't _exclusively_ functional and sometimes hide architectural complexity! How can I track progress on quality attributes (or other architecturally relevant decisions) visually on my team's kanban?


Which arguments pass by value and which pass by reference in Java?

I am starting to learn Java with the Java Trails tutorials offered by Oracle. I am in the section where it talks about passing arguments to methods (http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html). It says that primitive types are passed by value, which makes sense to me. Right after that it says: > Reference data type parameters, such as objects, are also passed into > methods by value. This means that when the method returns, the passed-in > reference still references the same object as before. However, the values of > the object's fields can be changed in the method, if they have the proper > access level. Now this doesn't make sense to me. If an object is passed by value, then changing the fields of that object will change the fields of the copy inside the method, not the original one. When testing with the program below:               class Point{             int x;             int y;                  public static void movePoint(Point p, int x, int y){                     p.x+=x;                     p.y+=y;             }     }          class App{             public static void main(String argv[]){                     Point p1;                          p1 = new Point();                     p1.x = 2;                     p1.y = 3;                          p1.movePoint(p1,2,2);                          System.out.println("x = " + p1.x +  " y = " + p1.y);             }     }      It worked as if the object was being passed by reference (it prints out x = 4 y = 5 after all). So what exactly did Oracle mean in the passage above? Also, can anyone summarize what's passed by value and what's passed by reference in Java?


When to store Date/DateTime?

I'm working on a social network website and I'm not quite sure when I should store the date/datetime. The service includes some of the following events:   * Register/Login   * Follow   * "Like" (images & comments)   * Post a comment   * Post an image In my eyes, I would use `DateTime` for all of them... Although I'm not sure if that's professional or maybe it's just a waste of space. When should I store the time of an event? Thanks in advance.


Naming of type parameters in java

We all know that it is good to use descriptive identifier names. However, the convention in java is to use a single letter for a type parameter identifier. The default most people go to is `T`, but if you are dealing with elements in a collection, you often see `E`. Now I can see how it makes sense to use single letter identifiers for unbounded type parameters, since they can really be anything, so you have no information to be represented by the identifier. But suppose you had two bounded type parameters, say `T extends Iterable<Integer>` and `S extends Consumer<Integer>`, wouldn't it make more sense to use more descriptive identifiers than `T` or `S` so you don't confuse them? You might be able to get away with using, say, `I` and `C`, but people would never (in my ideal world) be so terse with variable identifiers. So why are people so terse with type parameter identifiers? Or is the convention of single character type parameter identifiers not as pervasive as I imagine?


Should I use automatic properties?

I'm new to C# coming from a Java background. I'm working on a take home assignment for a coding interview. I normally write my code as following(Java):               public class Test {             //fields             private string fieldA;        private int fieldB;             public Test () {           //.....        }             public String getFieldA() {           return fieldA;        }             //ETC.     }      The point is that I use getters/setters like above. Now, I have a coding assignment to do for a job interview, and using C# I have stumbled across automatic properties. I was initially slightly confused about it but understand what it does now and have used it. So for fields I would write               public string fieldA {get; set;}      It feels weird declaring fields public like that and doesn't it violate some OOP encapsulation principles ? My question is, should I just go ahead and use automatic properties to show interviewers that I know what it is? In case I want to prevent setting a field I could just use:               public string fieldA {get; private set;}      But would it appear like I don't follow encapsulation "rules", I obviously wouldn't want to risk that. I could write it out as I do in Java. In general what is your view on using automatic properties ?


Mutable cursor in readonly object?

I've been searching for the different uses of the keyword `mutable`. I've found that it is generally used for caching, lazy computing, mutex, ... But I'm wondering if it is coherent to use it for a cursor on a readonly object. For example, I have a sound class, and I want each sound to be able to keep track of a play cursor, for play/pause use, but I don't think this is part of the state of the sound. A const sound cannot be modified, but it can be read. Is it ok to make the cursor attribute mutable?


Automated GUI tests take too long because of doing same steps before the "main test action" can proceed

We are developing a desktop application and I am responsible for GUI testing. Currently we have around 500 tests which take 8 hours to complete. The tests are testing almost every button/menu/field etc. in the application. Some functions are taking 3 - 15 minutes because the application is actually measuring something, but most of the tests takes around 2 minutes. The biggest problem I see is that a lot of tests are doing same steps before the "main test action" can proceed, for instance start with import of documents to use for testing, which takes several seconds. How to reduce this time? Parallel testing or some fancy execution environment is probably not a solution or what I ask for. I am more interested in the design of the test or some tips for decreasing the repetition of work.


Freeing Memory: Observer Pattern?

I am building a scientific application in matlab which handles several hundred large matrices (large as in 'very few of these will fit into ram'). Each matrix is contained within a dedicated object to handle its metadata (the property's name is .data). I use the getter method to load the data from file into ram as soon as it is needed. How do I decide when to unload? Most access to the object's data will be bundled, thus I don't want to unload every time I am done with getting data. Furthermore, I might need to use one or two more often than others. I do not think I can solve this within each object, so I thought I could implement a public function to clear the matrix from ram, called by an external object that decides when (and possibly, which) object is too much right now. Does this make sense or is it a recipe for disaster? Does this count as observer, or is there something else I could use? How to identify 'good' decision criteria? Thanks!


What to do about "Failure Driven Development"?

At our shop, we strive to be agile. And I'd say we are making great strides. That said, a few of us have spotted a pattern we have started calling "Failure Driven Development". Failure Driven Development can basically be desribed as an agile release/iteration cycle where the bugs/features are guided not by tasks and stories with acceptance criteria, but with defects entered in the defect tracking software. Our team has a great Project Manager who strives to get the acceptance criteria from the customer(s), but it's not always possible. From my development chair, this is due to the customer either not knowing _exactly_ what they want or (and this is the kicker) two different "camps" at the customer's main office conflict with how a story should be implemented. Camp A will loosely dictate that Feature X works like _this_ , then Camp B will fail it due not functioning like _that_. Hence, the term "FDD". The process is driven by "failures". This leads to my question: Has anyone else encountered this and if so, any tips/suggestions for dealing with it? We have, of course, tried to get Camp A and B to agree prior, but everyone knows this isn't always the case. Thanks


Learning About Languages

I'm interested in learning more _about_ programming languages. In particular, I'd like to look at some of the new developments in programming languages (even the really obscure ones that only academics care about). I need to learn to read grammar specifications, as well. Where should I begin?


What are other technologies that are capable of creating Websites with Animation, Load Detailed Images & Cross Browser

I am a Junior Web Programmer who is tasked with redesigning our website. Right now the website is made in ActionScript using the FLEX API(so its Flash based). **I am looking for advice on what technologies I can use to create interactive websites.** The website requirements I have been given are:   \- must work & look the same on iOS browsers   \- should include animation, element movement & show detailed graphics   \- look exactly the same across browsers _What technologies are available to me to create a website with these features?_ I know of so far:   \- Flash based websites can achieve this (ActionScript)   \- JQuery can create rich dialogs (not sure if it does graphic animation or has cross browser compatibility, does it?)   \- Can I use .NET for this? Would that mean I write the website in ASP .NET? \- Raphael.js - can rotate & animate images, is it cross browser?   \- Any others that you know of? What other technologies are out there that I dont know of?


What is the purpose of arrays in C, when pointers could have done the job?

Arrays and pointers are not the same thing in C, although they are related and can be used similarly. So far we all agree. However, I don't see why arrays were included in C, when pointers could have done their job perfectly. I am not saying to remove the array notation (e.g, a[5] or int a[4] = {0,1,2,3};), which is quite useful and convenient. But you could have that same notation working on top of pointers (as is the case), as a cosmetic measure. So the array notation is not a reason to have arrays, just the notation! The only difference I see is that arrays are constant pointers, and the size of memory they point to can't be changed. But this can be achieved with pointers as well, exactly by making them constant (the memory wouldn't be of fixed size, but I am not sure if this is an issue). So why not have only pointers and let the programmer decide how the pointer should behave (i.e., constant, not constant, fixed size, variable size, etc)?


terminology for upward devolution from modules to framework

Is there a word for the problem of a framework becoming married to the software modules it supports, for example adding methods to a base class that may apply only to certain subclasses or use cases? It's a particular kind of violation of separation of concerns. The words that come to mind are "upward devolution" or "feature capture," but these seem to belong to politics, not engineering. Wikipedia has an article on "subsidiarity" which mentions politics and object-oriented programming in the same sentence, but I'm still not sure.