title: Should I be using a composite key for this table?

text: My database is going to store words, so the Word table is the most important. The Rhyme table lists which words a particular word perfectly rhymes with. It consists of three fields:               RhymeID - primary key.     WordID - foreign key linking to Word table     Rhyme - a non key integer which refers to a different record in the Word table.      E.g. 'cat' has WordID 009, 'bat' has WordID 014 and 'fat' has WordID 035, two records in the Rhyme table might look like this               RhymeId - WordId - Rhyme     001 - 009 (cat) - 014 (bat)     002 - 009 (cat) - 035 (fat)      The question is, should I make WordId a primary key to form a composite key with RhymeId? Do I need it to uniquely identify each record? I have no practical experience with databases, this one is still in the planning stage.


title: How can I test a search engine for an uncommon human language?

text: We are writing a search engine from scratch in a quite uncommon language, Aramaic, mostly for learning purposes but also because few resources are available in given language. The engine is/will be written in Python, and:   1. It is a human language search engine.    2. It's not about paying someone to do the tests, but trying to find a way to resolve the issue programmatically (if even possible) for learning purposes mostly. We would like to test automatically if the search engine works efficiently but without knowing the language we were wondering if there were maybe tools or ways to test it get statistics. If we had users who spoke the language we could ask them to evaluate the search results but not having that, what are the other ways to test a search engine?


title: When to use [Pure] on a constructor?

text: I'm learning about code contracts in .NET, and I'm trying to understand the idea of pure constructors. The code contracts documentation states: > All methods that are called within a contract must be pure; that is, they > must not update any preexisting state. A pure method is allowed to modify > objects that have been created after entry into the pure method. And the `PureAttribute` documentation states: > Indicates that a type or method is pure, that is, it does not make any > visible state changes. I understand these statements when it comes to methods, but what about constructors? Suppose you had a class like this:               public class Foo     {         public int Value { get; set; }              public Foo(int value) {             this.Value = value;         }     }      This constructor obviously does affect the state of the new `Foo` object, but it has no other side effects (e.g. it doesn't manipulate any of the parameters or call any non-pure methods). Is this a candidate for `[Pure]` or not? What is the significance of placing a `[Pure]` attribute on a constructor, and when should I do this in my own code?


title: Alternative to Static Abstract Property/Method

text: Since trying to use them will cause an error what is the workaround to get the same effect as them? My Base Class:               public abstract class IPacket     {         public abstract int Identifier { get; set; }              public abstract void Handle();     }      Child Class:               public class DoSomething : IPacket     {         public override int Identifier         {             get             {                 return 1;             }         }              public override void Handle()         {             // Do Something         }     }      Incoming Packet Routing:               Dictionary<Byte, IPacket> Packets = new Dictionary<byte, IPacket>         {             {DoSomething.Identifier, DoSomething} // <-- Not Possible         };          Packets[ID].Handle();      Basically I get a packet from Server which contains an Identifier. I use this identifier to find the handler for that packet from a dictionary and pass the packet to it's handler.


title: Is it possible to automatically convert code from a low level language to a high level language?

text: I have seen several applications that claim to convert Java code to valid C or even C++. Converting from a high level language to a low level language is possible, no doubt about it. At least in theory, can the reverse be done _without_ any manual steps? For instance:   * Converting Assembly to C or Machine Code to Assembly?   * Hardware Description Languages (HDL) to Assembly? (which ever is lowest?)   * C to C#?


title: Do we really need to save source code?

text: While hacking on some static analysis tool, I realized I could make the task at hand (irrelevant for this question) much easier by saving the source files on-the-fly, while they were being edited. This seemed weird at first, but being a lazy cat I actually did it, and it turns out I find this pretty useful :   * no need to check if all files were saved before running a compiler/interpreter   * forces you to make granular commits much more regularly My editor has been behaving this way for a couple of days, I never had such a clean commit history, and didn't get burned yet. In the days of DVCS when by saving we actually mean commit, do you think that manually saving files is still a relevant practice ?


Are Chrome Developer Tools an adequate substitute for Firebug? I'm learning how to develop simple web apps using Django. The book I have recommends installing Firefox/Firebug. I'm used to Chrome and wanted to know if I need to switch or if Chrome Developer Tools contain all the essential functionality of Firebug.


title: Can I use GPL, LGPL, MPL licensed packages with my application and make it closed source?

text: I saw a company is using BusyBox and also using Gpl + Lgpl + Mpl packages on it, and then they have there own application running on it. Their application is a closed source package. You buy the device but its closed source. How come GPL mixed with LGPL+MPL becomes closed source? I thought the rule is?? Or I am wrong or this following info is wrong?: > GPL: If you use it in your application then you must release your > application under the GPL. That doesn't mean you can't also sell it (like > they sell Linux CD's) but you must also release the source code for free. > That might work for you, but probably not. > > LGPL: If you use it in your application then you can still have a closed > source proprietary licensed application. But if you modify the LGPL library > then you must release your modifications under the LGPL, even though your > application can remain closed source.


title: What are all these license types for applications?

text: I am thinking of making some applications for Linux (primarily Ubuntu) and I have an intention of selling some in the Ubuntu Software Center and offering a few applications for free. These free applications will be minor programs mainly used for fun and/or for a little convenience in day-to-day tasks (say, a ToDo list). What is the suitable license I should use for this? As for the paid applications, they will be more business-oriented (eg: a decision making software). For these, what is the suitable license type? I really confused about all these licenses (I have heard of Creative Commons, GNU, etc but have no idea whatsoever). And I'm hoping to make these applications using PyGTK and Quickly and some with Java. So if anyone could provide some light on this subject, I'm really grateful.


title: Will taking up a job in the enterpise s/w domain reduce my chances of later shifting to consumer software?

text: I have been offered a job from campus in the Enterprise s/w domain. I'm at loggerheads with myself deciding if I should take up the job, since I'm generally interested in consumer s/w esp in companies that encourage open source contributions. My question is if i'll find it difficult to later(maybe after a year or two) change my domain and move onto B2C (Business to Consumer) software companies. Will my past experience with enterprise software stand against me?


title: Almost Realtime Data and Web application

text: I have a computer that is recording 100 different data points into an OPC server. I've written a simple OPC client that can read all of this data. I have a front-end website on a different network that I would like to consume this data. I could easily set the OPC client to send the data to a SQL server and the website could read from it, but that would be a lot of writes. If I wanted the data to be updated every 10 seconds I'd be writing to the database every 10 seconds. (I could probably just serialize the 100 points to get 1 write / 10 seconds but that would also limit my ability to search the data later). This solution wouldn't scale very well. If I had 100 of these computers the situation would quickly grow out of hand. Obviously I am well out of my league here and I have no experience with working with a large amount of data like this. What are my options and what should I research?


title: How would you tackle a pattern-finding program?

text: Just to be clear, I don't think this should be question better suited for stackoverflow.com simply because there's not a single answer but a wide range of possible solutions, making this question far more subjective in nature. I was curious how you guys would tackle a pattern-finding program, which is to say I'd do the following operations:   1. I enter in some input.   2. Program predicts my next input based on all previous inputs.   3. Rinse. Repeat. Since the amount of input I could provide is so varied, including empty strings, conventional means such as switches or regular expressions are out, since it would require you to have an inkling of information about what to expect. I was thinking about some form of genetic algorithm, yet even then I don't have a clue as to how to approach a problem of this caliber. I think some feedback mechanism would be necessary as well as to let the program know how close it was. Anyone had to do a similar type program before?


title: Are there any GUI or user interface design patterns?

text: I was curious about GUI design patterns, so I searched and got some information, including a list of UI patterns for the web. This UI patterns website says that: > UI Patterns is a growing collection of User Interface Design Principles and > User Interface Usability Patterns present on web applications and sites > today. Are there any other design patterns for constructing websites or other user interfaces? Are there any books that describe these patterns? I'm particularly interested in patterns for Windows desktop development and web development in the .NET platform.


title: Object-Oriented Design of Car

text: While I am studying for job interview, I got this kind of OOD questions a lot. But from my TDD perspective, I think it would be reasonable to ask more about use-cases of (or requirements for) the Car. Otherwise, there are tons of way of designing car. Am I missing something here? How would you handle this sort of interview questions?


title: Is there anything special to consider when writing my own exception class in C++?

text: If I wanted to implement my own version of the std::exception for no good reason, are there any special things about implementing this kind of object that I should be aware of? It seems like a fairly simple thing that is mostly a string wrapper... Here is my implementation so far:               #pragma once;          #include <string>          class MyException     {     public:         MyException(const std::wstring&);         virtual ~MyException(){}              virtual MyException& operator=(const MyException& rhs);         virtual const std::wstring& what(){return msg;};          private:         std::wstring msg;     };          MyException::MyException(const std::wstring& message)     :msg(message)     {     }          MyException& MyException::operator=(const MyException& rhs)     {         if(this == &rhs)         {             return *this;         }         msg = rhs.msg;         return *this;     }


title: Difference between extensible programming and extendible programming?

text: What exactly is the different between "extensible programming" and "extendible programming?" Wikipedia states the following: > The Lisp language community remained separate from the extensible language > community, apparently because, as one researcher observed, any programming > language in which programs and data are essentially interchangeable can be > regarded as an extendible [sic] language. ... this can be seen very easily > from the fact that Lisp has been used as an extendible language for years. If I'm understanding this correctly, it says "Lisp is extendible implies Lisp is not extensible". So what do these two terms mean, and how do they differ?


title: Assuming "clean code/architecture" is there a difference in "effort" between PHP or Java/J2EE web application development?

text: A client asked us to estimate effort when selecting PHP as the implementation language for his next web-based application. We spent about a week exploring PHP, prototyping, testing etc., We are quite new to this language - may have hacked around it in the past but, let's go with PHP-noobs but application development experts (for the lack of a better, less flattering word :) It seems, that if we write, clean maintainable code, follow separation of concerns, enterprise architecture patters (DAOs etc.) the 'effort' in creating an object-oriented PHP based web-application seems to be the same for a Java based one. Here's our _equation_ for estimating the effort (development/delivery time):               ConstructionEffort = f(analysis, design, coding, testing, review, deployment)      We were specifically comparing effort estimates in creating an enterprise application with the following:   1. PHP + CakePHP/CodeIgniter (should we have considered others?)   2. Java + Spring + Restlet  It's an end-to-end application:   1. Client: Javascript/jQuery + HTML/CSS   2. Middle tier/Business Logic - _(Still evaluating PHP/Java)_   3. Database: MySQL The effort estimates of the 1st and 3rd tier are constant and relatively independent of the middle tier's technology. At a high level with an initial breakdown into user stories of the requested features as well as a high-level SWAG on the sheer number of classes/SLOC that would be required for PHP doesn't seem to differ by much from what is required of the same in Java. Is this correct? We are basing our initial estimates on the initial prototyping/coding we've done with PHP - we are currently disregarding fluency with the language as a factor, since that'll be an initial hurdle and not a long term impediment IMHO (we also have sufficient time to become quite fluent with PHP). I'm interested in knowing the programmers' perspective with respect to effort when creating similar applications with either of the languages to justify choosing one over the other. Are we missing something here? It seems we are going against popular belief of PHP being _quicker_ to market (or we being very fluent with Java have our vision clouded). It doesn't seem to have any coding/programming effort saving from what we/ve played around with.


title: Is possible to write too many asserts?

text: I am a big fan of writing `assert` checks in C++ code as a way to catch cases during development that cannot possibly happen but do happen because of logic bugs in my program. This is a good practice in general. However, I've noticed that some functions I write (which are part of a complex class) have 5+ asserts which feels like it could potentially be a bad programming practice, in terms of readability and maintainability. I think it's still great, as each one requires me to think about pre- and post- conditions of functions and they really do help catch bugs. However, I just wanted to put this out there to ask if there is a better paradigms for catching logic errors in cases when a large number of checks is necessary. **Emacs comment** : Since Emacs is my IDE of choice, I have it slightly gray out the assert statements which helps reduce the feeling of clutter that they can provide. Here's what I add to my .emacs file:               ; gray out the "assert(...)" wrapper     (add-hook 'c-mode-common-hook       (lambda () (font-lock-add-keywords nil         '(("\\<\\(assert\(.*\);\\)" 1 '(:foreground "#444444") t)))))          ; gray out the stuff inside parenthesis with a slightly lighter color     (add-hook 'c-mode-common-hook       (lambda () (font-lock-add-keywords nil         '(("\\<assert\\(\(.*\);\\)" 1 '(:foreground "#666666") t)))))


title: Has the MVVM pattern been adopted widely in real world Silverlight projects?

text: MVVM pattern is a hot word recently and I am planning to learning and refactor my existing project into this pattern. I have no experience and foresight of the potential risk. Have you guys really get lots of benefit from the MVVM Pattern in real-world projects? Is it worth refactoring an existing non-MVVM (mainly using Code-Behind files) into the MVVM pattern?


title: Explaining how the code you wrote works

text: I was asked to create for a freelance project a Monopoly game in Java. After finishing it the same guy asked me to create four UML diagrams from which he could understand how the game works. Everything went well this far but his third request presented me with some problems. He now wants me to write for him in about 20-25 pages, how the game's code works, so he can understand it. I have been programming for about a year and I was never asked to do this before. I don't even know where to start to do this, from which portion of the code should I start to explain it? I basically suck at writing. Is there any guide that could help me achive what I need? I've already created the use case diagram sequence diagram, class diagram and activity diagram.


title: Javadoc usage on real projects

text: I'm wondering if the Javadoc is using on real projects, what your experience says about it?


title: C library build system dependencies

text: This debate has cropped up on a mailing list for a project I'm involved in. Unfortunately we're quite a small bunch at the moment, so I want to ask a wider audience. We're writing a C library (for arbitrary precision arithmetic) and are investigating build systems. Currently we have a bash script in desperate need of work. I believe we can't use autotools etc due to licensing (bsd vs gpl). So I suggested we use a modern scripting language like python or perl. The question is: is having something like perl or python around at build time _an unrealistic dependency_ on Unix-like platforms these days?


title: Is there a correlation between some software engineering practices and software engineering success stories?

text: I've been reading the book "The Drunkard's Walk: How Randomness Rules Our Lives" by Leonard Mlodinow and it's a truly enlightening read. The book deals with probabilities and human reasoning. And let's just say, for the record, that while some things sometimes work, there's a chance that the things you thought made it work, are unrelated to what actually made it work. > Probabilities are unintuitive. However, it gave me an idea. There ought to be studies on this already, that have attempted to quantify the results of software engineering endeavors (which of course is a hard problem in itself). And these studies should point to what kind of software engineering practices are really important in terms of quantifiable success. i.e.   * A team that employs TDD is `this` much less likely to have `this` kind of problem.   * A team that employs SOLID principles is `this` much less likely to have `this` kind of problem.   * etc. etc. What I'm looking for here is software engineering practices that show strong correlation between implementation and success. I'm confident that these things exist but that they are hard to come by and that's why I pose this question. What studies or what practices do you know of that have strong correlation between implementation and success (where success is **somewhat arbitrary** but I think you get the idea)? > If we're gonna sell that idea that software engineering is better than > cowboy coding, I think we need proofs.


title: Are interviews required for software/programming internships?

text: Do companies interview prospective software or programming interns? Do any companies use video interviews? Thanks.


title: Wrapping a 3rd party API - Gateway Pattern connections

text: Given a 3rd party API with a very cumbersome object with many different responsibilities-- we decide to wrap using small, manageable, single- responsibility objects. This is the gateway pattern (I think). So any time you do this there is going to be some kind of "connection" where you have to connect to the resource. Furthermore, calling applications may want to keep a single connection open and use it with multiple objects (those small, manageable, single-responsibility ones we created). What form should this connection take? Should this connection be another object? Should it be passed it to the constructor of the small wrapper objects? Or, should the wrapper objects inherit from a connection object? Or aggregate it? What about the special case where we can have only have only one connection per application?


title: Studies of open source software adoption

text: I'm not 100% sure this is approriate here, but I figure the area of study is particular to programmers, since it's open source software. If it's better posted somewhere else then please say so and I will post it there. * * * Can anybody point me in the right direction of any studies on businesses and consumers adopting open source software? Ideally, I'd like some qualitative information on why both parties choose (not) to adopt open source software, but raw numbers are good too. Any relevant experiences and case studies of this from users would be welcome as well.


title: Why are you choosing XYZ? - Is this valid question in interview?

text: I am tired of the question from interviewers - Why have you selected 'XYZ' (the interviewer's organization). In today's IT world, does anybody go looking for a COMPANY. I mean what the interviewers are thinking? that somebody from the sky will come searching for their company and desperate to work with them.. I faced the same question multiple times. I dont understand what to answer this. Can anybody help here...


title: What is the name of this array transformation?

text: Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be.               [[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]]      At the other end of the transformation, you have an array of arrays where the first array contains the first element from each of the original arrays, the second array contains the second element from each of the original arrays, and so on.               [[1,5,8,11], [2,6,9,12], [3,7,10,13], [4,14], [15]]      Is there a mathematical or CS term for this operation?


title: Should I let my users write BnfExpressions to extend my grammar?

text: ## Preface I'm designing a templating language (please skip the don't/why?? speech). One of the major goals of this language is to be extensible. There are 2 main elements in my language. "Tags" and "Directives". Tags, for the most part, map 1-to-1 to HTML tags, with the exception of a few of them which do a bit more. "Directives" are things like conditionals and for/while loops. "Tags" are simple, because they all follow the same structure: `tag_name(arg1=val1, arg2=val2) { content }`. Directives are more complicated because they look like this: `directive(anything-can-go-here) { content }`. ## Question I'm trying to decide how to let users (other devs using the templating language) write their own directive -- i.e., define the "anything can go here" part. I'm using Irony to parse my language. Should I give them the same level of access, and define their own `BnfExpression` (requiring them to learn a bit of Irony/EBNF), or should I just toss them a string (the stuff between `(` and `)`) and let them parse it however they want? ## My Concerns The former is perhaps more powerful and easier to work with (once you know it), but it would also potentially give them too much power (they wouldn't have to stop at the next `)` \-- well, unless I stripped out the inner string first and then basically let them define a sub-grammar to parse only that). Not sure how to approach this. ## More About Tags For reference, users can define "tags" like this:               class ANode : HtmlNode     {         public ANode(AttrDict attrs, params TagNode[] children)             : base("a", attrs, children) { }     }      Would be the most basic example, which just extends the HtmlNode I've already defined. A more complicated one might define some default attributes or do something fancy with the child elements, or generate multiple html tags.


title: Interviews that include Algorithms and Data Structures

text: I want to start looking for jobs in great companies and I have four years of enterprise corporations development, three years with C#.NET and alomst one year with Ruby On Rails, JS, etc... But when I look up interview questions from Google, Amazon, Fog Creek, DropBox, etc... they are really targeted at students that are coming fresh out of college and still remember what was Dynamic Programming and Dijkstra algorithms ... but I don't! :( It has been a while for me ... If a I need a sort algorithm I would either Google it or there already is a library and method that does it for me. So what should I do? Do they realize that this guy is not coming from college and will ask more general questions about software architecture or nop! I should go back find my old Data structures book from the storage and read them? In that case wht books and language do you recommend to hone my skills?


title: Which license should I choose?

text: I'm working on an engine (I haven't started coding it yet but I like to have everything done as soon as I can, and since I'm unable to start coding it now, I'm working on these small things) and I want to license the code. For now, I'm thinking of leaving the project open-source, but later I might turn it proprietary so I was wondering what would be the best license for an open- source project (it's an offline project, I mean, it's C++/Lua based, not a web project) and also a proprietary license for later, in case I really turn it proprietary (I did search about both types of licenses, but from what I understood I have to make the proprietary license by myself, which would include registering copyright, contracting a laywer, etc. and don't want to waste money on this project, at least not for now). I would like users to have the possibility to modify, use parts of my code and use my whole engine in their projects (for the open-source license, of course the proprietary license will have other rights, but paid) BUT EVER HAVING STATED THE CODE IS COPIED/MODIFIED FROM MY ENGINE, AND IS NOT THEIRS CODE.


title: Architecting Challenge: How would you write an opensource script installer to run in a browser?

text: I currently have an installer that works, but I have to repackage the open source apps and hack things together to get the installer to install them. I want to be able to use the apps installation method without having to hack and repackage. So I am thinking about rewriting it. It will allow a user with little to no tech experience install open source apps (ie. WordPress, Joomla, Drupal, et.al.). There are a few requirements I want to meet:   * The installation should run the scripts install process to make sure the database is setup correctly and the passwords use the apps default password encryption processes.    * Ability to track the progress and report back any errors.   * Ability to run upgrades for future releases.   * Ability to remove the application if someone decides they do not want it any longer.   * The only access I will for sure have to the users remote server is via FTP. I have thought about using Selenium. However, if you were challenged to hand spin the code in PHP, how would you do it? **UPDATE FOR CLARIFICATION:** The installer will collect the scripts settings from a form in the browser filled out by the end user. The installation process (that runs in the background and connects over FTP to the users server) will then process the installation. (i.e. SimpleScripts, Installatron, Softaculous, Fantastico, WebPub, etc.) I am trying to figure out how you would design the cleanest simplest install process possible. It needs to create databases, install the application using the scripts install method (as if the user was running it manually), etc. I hope that clarifies the challenge.


title: Processes: documenting changing spec

text: A little background: I work at a relatively small (<10 developers) tech company which basically produces a single product, which is constantly evolving and being added to. The product is an off-the-shelf client/server product, where we run the server and the clients are mobile apps running on a variety of platforms (Android, iOS, WinMo, etc.). The bulk of the specification and documentation is maintained in an internal Wiki. Whenever we add a new feature or expand an existing one to the client apps, the process goes more or less like this:   1. A spec. for the change is produced. Generally these specs are very low on detail, often just consisting of a few user stories: "As a user, I want to..."   2. The feature is implemented on a single platform. Which platform often depends on which developer is most free at the time, as different developers specialise in different platforms.   3. Once the feature is more or less completed on the lead platform, it gets ported to the other platforms. Because the initial specification is so general, step 2 usually requires making a lot of the more detailed decisions - file formats, what to do when things go wrong, etc. Decisions are generally made after consultation with the project manager. The problem we have is that there's no real procedure for making sure the decisions made in step 2 actually get documented. In an ideal world I guess responsibility might fall to the project manager, but since he's also a company director he frankly doesn't have the time! My question is: **Can anyone suggest a process (or processes) we could use to ensure these decisions get documented?** It's all very well to say "just update the wiki when decisions get made" but real-world considerations (time pressure, interruptions to deal with user support issues, etc.) often mean that it gets forgotten.


title: Tracking software piracy to gauge strength of anti-piracy measures

text: I've been looking up this thread on how software piracy can be prevented. It's got a number of interesting suggestions ranging from using copy protection to providing free versions, and not surprisingly, none of them will satisfy you 100%. It will perhaps be apt to experiment with each of the popular anti-piracy measures to gauge success. Are there reliable surveys that point to the success or failure of such measures? Furthermore, surveys are often biased because of countless factors, and perhaps the software product developer himself should attempt to gauge success or failure of a particular measure. If I decide to resort to the second option, what would you suggest to obtain hard data about software piracy patterns for _my_ specific product?


title: What is meant by sandboxing?

text: Sanboxing is listed as one of the many security features in html5 specification . Can someone explain what is meant by sandboxing? Does it relate to HTML only or to JavaScript also?


title: Designing a Business Rule Engine

text: I have a requirement where there are 10 Rules to be applied on data in excel. If Rule 1 and Rule 2 fails rest of the rules are not checked. But if Rule 1 and Rule 2 passes the rest of all the Rules should be verified and if any errors found- they should be logged. Is there any design pattern which I can use to keep this Rule Engine flexible for adding these 10 rules and Closed for any additional chains in the Current Rule. I was thinking of something like a Decorator Pattern. Will this help me achieve that?


title: "Collection Wrapper" pattern - is this common?

text: A different question of mine had to do with encapsulating member data structures inside classes. In order to understand _this_ question better please read _that_ question and look at the approach discussed. One of the guys who answered that question said that the approach is good, but if I understood him correctly - he said that there should be a class existing just for the purpose of wrapping the collection, instead of an ordinary class offering a number of public methods just to access the member collection. For example, instead of this:               class SomeClass{              // downright exposing the concrete collection.                      Things[] someCollection;             // other stuff omitted              Thing[] getCollection(){return someCollection;}          }      Or this:               class SomeClass{              // encapsulating the collection, but inflating the class' public interface.              Thing[] someCollection;              // class functionality omitted.              public Thing getThing(int index){             return someCollection[index];         }              public int getSize(){             return someCollection.length;         }              public void setThing(int index, Thing thing){             someCollection[index] = thing;         }              public void removeThing(int index){             someCollection[index] = null;         }          }      We'll have this:               // encapsulating the collection - in a different class, dedicated to this.          class SomeClass{         CollectionWrapper someCollection;              CollectionWrapper  getCollection(){return someCollection;}     }          class CollectionWrapper{              Thing[] someCollection;              public Thing getThing(int index){             return someCollection[index];         }              public int getSize(){             return someCollection.length;         }              public void setThing(int index, Thing thing){             someCollection[index] = thing;         }              public void removeThing(int index){             someCollection[index] = null;         }          }      This way, the inner data structure in `SomeClass` can change without affecting client code, and without forcing `SomeClass` to offer a lot of public methods just to access the inner collection. `CollectionWrapper` does this instead. E.g. if the collection changes from an array to a `List`, the internal implementation of `CollectionWrapper` changes, but client code stays the same. Also, the `CollectionWrapper` can hide certain things from the client code - from example, it can disallow mutation to the collection by not having the methods `setThing` and `removeThing`. **This approach to decoupling client code from the concrete data structure seems IMHO pretty good.** Is this approach common? What are it's downfalls? Is this used in practice?


title: Globalizing geographical information in data design

text: I am building my database/models/viewmodels right now and can't think of a good variable name to define for the equivalent of a "state" in other countries. I currently have `Country` and `City` which are pretty common.   I know Canada has `Province`s and France has `Department`s instead of states.   What are some ways you guys have abstracted user's locations? I thought about `FirstDegree`, `SecondDegree`, `ThirdDegree` but that is too vague. What are some common field names you have seen in the past?


title: What is a good way to store geographical data for distance calculations

text: What would be the best way to store data in a database for geographical calculations? Say I have an `ItemsForSale` table paired to a `Users` table which holds their geo location. I know I can use latitude and longitude to look up items that are within a certain mile radius by using Lambert's formula for long lines or the Haversine formula but I am not sure if there is a better approach for this.


title: Permutations of an array

text: I have an array of integers of length 20, filled with fourteen 0s, two 1s, two 2s and two 3s. It is like this: [0,0,0,3,0,2,0,0,3,0,0,0,1,0,2,0,0,1,0,0]. I need a way to list all of its 20!/(14! 2! 2! 2!) permutations, without repetitions. (Note that in the list there are duplicate elements!) I'm just looking for the right idea, it isn't necessary that you write the code. But, if you prefer writing the code, I only understand C and Java. Thanks :)


title: Do you find languages with indentation requirements cumbersome?

text: Thoughts on these? Python is one example, and no this is not a stab against Python I like the language. What languages have a indentation requirement?


title: Are NuGet metadata a good place to exclusively set license for source code?

text: I've found a library (that I'd like to fork, if it makes any difference). On NuGet, the project file says it's distributed under the MIT license (with a link to the license). However, in the GitHub repository of the project, I don't see any mentions of the MIT license (or any other license) either in the source code files or in a readme. I'm a little concerned about this, since NuGet is a repository for binaries and I'm interested in the source. **Should I assume that the source code is covered under the MIT license, judging only by the NuGet metadata of a package?** Or does this mean that the permissions apply only for the binary and not for the source?


title: Do you keep your ideas secret? and why?

text: I believe any programmer has several ideas that she/he considers as innovative or at least valuable. It may be an idea of a new product which will make this world better or a new development approach, etc. But a great idea must be implemented and promoted/advertised. This requires a lot of work (proofs of concept, prototypes, technology previews, etc.) and a lot of money (appropriate advertisement, marketing, etc.). So months later, the idea stays in our heads, but nothing else is done, because it's difficult, long and expensive, sometimes even impossible for a single developer. On the other hand, it would be painful to share our ideas, and see a medium- size company which has enough resources making something useful from it and having success and money. So what do you do with your ideas you can hardly implement or patent? Do you talk freely about them in discussion boards and with other developers? Do you keep them like a precious thing without never talking about them to anybody? If you keep your ideas, why are you doing so? Is it just because you hope that one day, you will be able to implement them and have a huge success, while you know very well by experience that it's an utopia?


title: How to organize projects in Redmine?

text: I deployed a Redmine installation yesterday and today I try to fill it with some relevant data. One issue I came across is the organization of projects itself. While I took a look at how Redmine itself uses parts of the software, they unfortunately have only one project set up and I haven’t seen any other examples. I know that this is heavily tied to your workflow, but seeing / reading about some examples would guide me to the right path. We are two guys (a designer & developer, both of us do also other stuff like marketing or paperwork) and we have more than 20 projects that I want to map to Redmine. Less than a handful of projects are active at the same time and they aren’t specifically related. However, we want to see how much time we spent on all projects and also see the overall project situation, i.e. should we start another project or add this or that to the current one or won’t this be doable for such a small team? At the moment I tend to have one of these setups:   1. A company project and all of our real projects organized as subprojects.   2. Separate Redmine projects for each of our projects, and eventually subprojects for broader functionality if needed (sync support for app xyz). The problems I see with the first approach is that the projects aren’t necessarily related to each other. They may share a common framework which is a project for itself, but otherwise they are really separate things. All of them are software projects, so they share common metaphors like Trackers, though. I haven’t seen a way to separate versions. The roadmap would be an overview of the current work situation, but it could get pretty confusing. My biggest fear is that we will have endless drop down lists with unrelated things like versions from other projects. The second approach seems to be saner, but my biggest fear is that we won’t have the general overview. We would have to look at all other roadmaps to plan the current one, we wouldn’t see just one calendar with things to do in all projects. I think the core of the problem is that we have very limited human resources that have to be shared across a lot of projects, but they mustn’t overlap. Any ideas how this can be mapped to Redmine?


title: Aggressive Auto-Updating?

text: What do you guys think is best practice regarding auto-updating? Google Chrome for instance seems to auto-update itself as soon as it get's a chance without asking and I'm fine with it. I think most "normal" users benefits from updates being a transparent process. Then again, some more technical users might be miffed if you update their app without permission, as I see it there's 3 options: 1) Have a checkbox when installing that says "allow automatic updates" 2) Just have a preference somewhere that allows you to "disable automatic updates" so that you have to "check for updates manually" I'm leaning towards 2) because 1) feels like it might alienate non-technical users and I'd rather avoid installation queries if possible. Also I'm thinking about making it easy to downgrade if an upgrade (heaven forbid) causes trouble, what are your thoughts? Another question, even if auto-updates are automatically, perhaps they should be announced. If there's new features for example otherwise you might not realize and use them One thing that kinda scares me though is the security implications, someone could theorically hack my server and push out spyware/zombieware to all my customers. It seems that using digital signatures to prevent man-in-the-middle attacks is the least you could do otherwise you might be hooked up to a network that spoofs the address of of update server.


title: Is it bad practice to include two types of views in the same class?

text: In my app, I use a widget with a loading spinner to signify that a network request is waiting. On failure, there will be another view which contains a failure message and a "Reload" button. My question is, since both of these views/widgets will ALWAYS be used together (either one or the other will be shown - or neither), should I merge them into a single widget? Would that be bad or good practice? That way I wouldn't have to prepare them both whenever I want to use one of them. The main disadvantage I see is that modularity would be destroyed.


title: Why do these iOS and OSX framework structures contain a version called 'A'?

text: I've been looking at development strategies for frameworks and have found a few good resources. However in the structure of frameworks in iOS and OSX I want to know why inside of the versions folder, there is a folder called 'A'?               MyFramework.framework/         MyFramework  -> Versions/Current/MyFramework         Resources    -> Versions/Current/Resources         Versions/             A/                 MyFramework                 Resources/                     English.lproj/                         InfoPlist.strings                     Info.plist             Current  -> A      According to the Apple documentation it seems that multiple versions can be created, however is there a logical or possibly historical reason why the character 'A' is used instead of using something like a date or version number? Sources:   * Apple Developer: Anatomy of Framework Bundles   * Cocoa Tutorial: Creating You Very Own Framework


title: OOP design question

text: I'm working on an application written in PHP using OOP principles. The classes in my application usually represent a table in the database; for instance, 'student', 'teacher', 'class', 'schedule', etc. As the application gets more and more complex, I start running into situations where it feels like writing a new query would be more efficient / faster than reusing the lower level objects + methods than I've already written. What's the standard philospohy when it comes to this? Is it handled on a case-by-case basis? Do you **always** reuse your code to prevent repeating yourself, even at the cost of the efficiency gained from one database query?


title: Allowing enum to express a valid combination of values

text: Suppose in a manufacturing environment, there are certain stock materials available for use in a product. For example, there are only a few different sizes of copper tube, each having a specific thickness and diameter combination. For the purposes of clean and minimal code as well as the ability to control the available options, is an `enum` a good fit for this combination of data? I was thinking I could make an `enum` with a member for each valid stock item (representing metal, physical measurements, etc.), and then provide extension methods on the `enum` to return the mentioned details. The stocks available for use may change over time, so maybe an `enum` is not the best answer. Is there a better way to express the valid combination of related values? I am using c#.


title: terminology: Memory leak

text: When I hear the term _memory leak_ by that I mean a bug in a program that doesn't cause _any_ problems _except_ that it doesn't free memory resource and if it continuously does that it can eat a lot of memory, hurting system performance and in the worst case crash the program (or an other program, if the OS decides to choose to kill that one). But now in this comments section of this question the upvotes made me think whether that's the whole meaning of the term. I previously always saw used it in that meaning. http://stackoverflow.com/questions/7451437/is-this-a-mem-leak-in-main So, would you call something a simple memory leak that crashes a program by some other side-effect or causing a dead-lock by not freeing a lock? **Update** \- Note: unfortunately some admin deleted the comment section there so I cannot refer to that discussion anymore :/ Basically I said that a memory leak is _harmless_ except that it eats up memory (and consequently on the long term in that respect can be harmful, crashing the app/system). They said that's not true, with C++ RAII it can cause serious problems. - Yes, if you don't delete an object with some important code in the destructor that can cause problems, but in my vocabulary that's a major bug and not a memory leak.


title: Starting on Web Project now - Do we choose HTML5/JS over Silverlight?

text: we are about to start on a Web Development project (the planning starts early 2011). Do we choose HTML5/JS over Silverlight? Are there any applications which now run on HTML5? Samples? A simple Google Search led me here. Those look great (especially the Star Wars one!), but they are not what you call proper applications as such.


title: How to represent hard-to-calculate "properties" of "objects" in functional code?

text: I have a polyline "class" in my Clojure program, which is represented by a vector of points. (It's not really a class or anything.) The polyline's length (in the geometric sense) is something that is often needed for computations. It's also fairly slow to calculate every time it's needed. In OO code, I'd just have the length as a property of the Polyline class. But in functional code, I'm lost. Do I duplicate the OO pattern and make the polyline a map of `{:points points, :length (length points)}`? Do I make a `length` function and `memoize` it? Do I just depend on the compiler to cache the results?


title: What Are The Best Practices for Managing Version Strings in Google App Engine Apps?

text: In Google App Engine, you can upload up to 10 different versions on your appspot project. For instance, if I have a project called `example`, the URL would be:               http://example.appspot.com      Each version I upload is given a version string. Possible examples are:   * dev   * 1   * 1_2   * staging   * anystring To access a specific version, I would prefix the domain with the version string, like so:               http://1.example.appspot.com      Of course, if that version is made the "default" version, then I can access it without prefixing with the version string, such as in the original URL at the beginning, http://example.appspot.com. What are the current best practices for managing version strings on Google App Engine Apps, in your experience? Also, once I surpass the max 10 versions and have to start deleting them, what is the suggested practice?


title: Anyone Been Through the .NET Program with SetFocus?

text: By day, I'm a PowerBuilder developer. By night, I dream of being a .NET developer. Sure, I can self-teach mostly everything I need, but I also love classroom learning and 'earning' my education. I am considering 'attending' the SetFocus course for .NET development. My hesitations? It's expensive. Anyone? Feel free to tell me its a crazy idea, regardless of the money. I'm interested in your opinions.


title: Advice for becoming a better programmer

text: I am a team lead dealing with a programmer with a Bachelors Degree in Computer Science. He has a couple of years of experience and is still a code monkey. Having observed him for quite a while, he is very slow in programming even fizzbuzz style questions. For other stuff, he tries to make do with just tinkering with code or asking for help on programming forums. For scripting stuff he get can barely get by with that, but for our core work of embedded systems using our proprietary toolchains, online forums are not of much help. As a result, he is either very late or incomplete so that I am forced to assign his work to others. When confronted he acknowledges all of this, but he does not know what practical steps he needs take on how to improve. He gets stuck on issues for a long time, being unable to debug. How to develop his skills to the next level, make him a problem solver, develop architecture skills and understand large systems, debugging skills and make him plan his tasks? In all his annual performance reviews he has never rated high. As his team-lead I have to develop a plan of action in consultation with him. Asking him to quit is always the last option but I would like to avoid that.


title: Is C++ really a bad language for beginners?

text: I'm learning C++ right now, and it's the first language I'm learning. I keep seeing on stackexchange and other forums (Reddit, etc.) that I should drop C++ and learn a higher level language like Python or Java. The only arguments I see are that "C++ is harder to learn and is more low-level than others." which don't really give a reason NOT to learn it. I want to know if there are any actual reasons for dropping C++ and taking up another, "easier" language. Or if I should keep focusing on it, and just learn others later (which is what I plan on doing).


title: How did you pick up the art of solving real life problems? Can you shortcut the process?

text: I have been coding on and off on C and to a certain extent on C++ since my college days(2003), but I never had the opportunity to work with a hard core programming responsibility, which could have taught me "industrial grade coding" better and what is needed really for solving real life problems. To me it looks like I had been coding naive codes, like linked lists, binary trees, and Dijkstra and Kruskal's Algos all these years. Additionally I feel my academic experience just taught me the language not how to solve real life problems. So my question is:   * So how did you pick up the art of solving real life problems?   * Any way to shortcut the process?   * Is it only my education or in general everyone coding education sucked big time?   * How often do you have to learn "new things" to solve a problem in a better way.  For example, though I have used delegates and events for simple windows programming, but my current problem will require a much more in depth knowledge of it, plus I have forgotten most of it. So its as good as new for me. I will have to learn threaded programming and multicore programming. So it gives me an impression-"heck then what did I learn really all these years?"


title: Is it a "pattern smell" to put getters like "FullName" or "FormattedPhoneNumber" in your model?

text: I'm working on an ASP.NET MVC app, and I've been getting into the habit of putting what seem like helpful and convenient getters into my model/entity classes. For example:               public class Member     {         public int Id { get; set; }         public string FirstName { get; set; }         public string LastName { get; set; }         public string PhoneNumber { get; set; }              public string FullName         {             get { return FirstName + " " + LastName; }         }              public string FormattedPhoneNumber         {             get { return "(" + PhoneNumber.Substring(0, 3) + ") " + PhoneNumber.Substring(3, 3) + "-" + PhoneNumber.Substring(6); }         }     }      I'm wondering people think about the `FullName` and `FormattedPhoneNumber` getters. They make it very easy to create standardized data formats throughout the app, and they seem to save a lot of repeated code, but it could definitely be argued that data format is something that should be handled in mapping from model to view-model. In fact, I was originally applying these data formats in my service layer where I do my mapping, but it was becoming a burden to constantly have to write formatters then apply them in many different places. E.g., I use "Full Name" in most views, and having to type something like `model.FullName = MappingUtilities.GetFullName(entity.FirstName, entity.LastName);` all over the place seemed a lot less elegant than just typing `model.FullName = entity.FullName` (or, if you use something like AutoMapper, potentially not typing anything at all). So, where do you draw the line when it comes to data formatting. Is it "okay" to do data formatting in your model or is that a "pattern smell"? Note: I definitely do not have any html in my model. I use html helpers for that. I'm strictly talking about formatting or combining data (and especially data that is frequently used).


title: Is it poor practice to name a property/member the same as the declaring type in C#?

text: For instance, a class like:               class Dog { } //never mind that there's nothing in it...      and then a property like:               Dog Dog { get; set; }      I've been told that if I can't come up with a more imaginative name for it, then I must use:               Dog DogObject { get; set; }      Any thoughts on how to name these better?


title: How to bootstrap a FOSS social software project beyond 1 dog eating dog food?

text: The development target is a facility that provides a particular kind of structural support to open, public discussions. Each separate deployment of the facility is specific to a single topic of discussion. This is important to know, because the plan is to bootstrap the development of the facility by deploying it on the topic of the facility itself; so the developers will be eating their own dog food. The problem is, how should a lone developer go about attracting others to the food bowl? The only answers I have so far (and neither seems good enough) are:   1. Continually ask in public forums for advice on the development problems that arise, such as design or implementation bugs. Maybe someone will jump in and help. (But this is a little bit sneaky and spam-like; and I apologize because I'm doing this right now.)   2. Continually share information in private with experts such as social scientists; specifically new information that happens to cross their paths of expertise. Maybe they'll reciprocate or reply in some other helpful way. (But this seems too slow on its own.) What other strategies are there? * * * I'll post a link to the project later, in case anyone is interested. Some other things you might need to know in the meantime:   * The utility is novel and unique; no other facility serves the same purpose.   * Both the utility and the user base are comparable to web search. Picture a discussion search engine, but more useful.   * There might be commercial potential, but it might also be largely wiped out by a successful, non-commercial, FOSS launch. Please assume the second case.   * A fully functional prototype is already deployed on the topic of the facility itself (as planned) and is open for anyone to use. It was assembled from off-shelf components. No code was written to make it functional, but code will certainly be needed to improve it.   * The facility is viable with only one or two participants, but nothing to write home about. Its utility and attractiveness increase rapidly with scale. It works partly by crowdsourcing and partly by self-organization and self-governance.


title: What is this (anti?)pattern called? (or how to describe it)

text: The case where a source-level operator actually describes an operation to take place at some future point, thunking the real operator together with its operands. I don't know if this has any kind of general name, or perhaps it's too low- level a design element to be thought of as a "pattern" at all, but anyway it's an element that is frequently seen in a number of situations:   * If I understand correctly (not a frequent C++ user), Boost::Phoenix does this to represent its lambdas and lazy operations, e.g. overloading + to actually capture the arguments along with the real + function for their type   * Parser combinators in functional languages (or something like Spirit) look like operators on data, but actually build a parser that runs later   * Other EDSLs (in languages with operator overloading) seem to do this a lot, e.g. functional reactive programming libraries tend to invisibly build procedures that will do what the operation looks like it's doing right now   * (Again, if I understand correctly) IO in Haskell builds an imperative computation out of pure components that is then "executed" by dark magic hidden in the language runtime, while looking like it's just executing the functions in-place   * At a simpler level, Greenspunning an embedded mini-Lisp into a C program could be considered the same thing: S-expressions can be built out of calls to C functions, to be run later (this last one would probably usually be considered the antipattern case), letting you look like you're passing "a lambda" to a C function, when you're really passing interpreter data It's obviously not an antipattern in all cases, as in some of those it's the only way to use the tool in question (doing it in C might earn one a beating though). I don't think it's "Greenspunning" or "using an EDSL" by itself, as it can be more generic and widely applicable than that. I don't think it's the Interpreter pattern, although I may not have correctly understood that one: the computation is being built directly by executing host language code (so it effectively exists at compile-time, but usually not as a first-class language construct), rather than parsed out of a string or other runtime loaded data. In all cases, what seems to happen is that an operation looks like it's doing one thing (not necessarily very convincingly, if it's C and you need to write out Add instead of overloading +, but same idea), while actually packaging that action up for later consumption. Something like a "computation builder" pattern? But I haven't found that term in use. I don't have a practical problem to solve here; it's just bugging me that there seems to be a common design element that I can't put a name to. (Question originally posted at StackOverflow, moved by hand)


title: Is it possible to escape the GPL by deriving the same work from multiple sources?

text: Suppose you have an arbitrary code base, **C** , possibly composed of multiple programs, none of which fall under a copyleft license. Suppose this code, taken together, does the same job as a nice integrated program, **A** licensed under some copyleft license like the GPL, but that for whatever reason the GPL code is superior (faster, cleaner, less buggy, whatever). Now suppose that for each feature in **C** , you find the equivalent feature in **A** and, through careful step-by-step refactoring, create two chains of patches that converge on a third program, **B**. In other words, you can show step by step, via patches, how to derive any of the three programs from any of the others:               A <--> B <--> C      It seems that through this procedure, you have extracted value from **A** and even created a derived work, but the new work doesn't necessarily resemble **A** , and there is a clear chain of evidence showing that **B** was derived from a different code base entirely. My question is: **Would a " _dialectic_ " implementation like this provide the same legal effect as a traditional "clean room" implementation?** _Note: feel free to replace the licenses of A and C with your most and least favorite options, respectively. The question is about the process in general._


title: Given that I voluntarily choose not to implement virtual memory in my kernel, how would the memory-management-unit work?

text: For my basic kernel I refuse to implement the dreaded confusion of virtual memory scheming, so I want only real memory addresses for everything. Some people have argued with me that since virtual memory is hardware supported, and sometimes the MMU hardware is integrated with the CPU, is that a rule that virtual memory is mandatory by hardware-design? I have at least one good reason to not care about virtual memory at this point, being that the real memory I have is plenty (32 GB), and that I don't care to go through trouble and workarounds with virtual addressing and such(and that I honestly don't like the idea, regardless of the fact that it helps in many areas). So if my question wasn't clear, is it possible to write a dedicated kernel and not _at all_ implement virtual memory and use only real addresses for everything, with a MMU? (Some of these low-level programming and hardware-concepts are mind-boggling, even after hours and hours of studying and implementing). PS: I'm guessing the answer to some point is "yes", but hearing someone with more knowledge on the subject would definitely be a good pointer for me and others who read this.


title: How to solve binary labeling with graph cut?

text: Many literature references suggest that the _binary labeling problem_ can be converted into a graph cut problem and solved with the max flow/min cut algorithm. I'm trying to understand the formulation given in Xiaowei Zhou's presentation of the reduction. The binary labeling problem consists of partitioning `n` items (here segments of the overlapped regions of two images) into two disjoint sets in a way which minimises an energy function. We can denote the partition as a vector `(x_1, ..., x_n)` whose elements are `0` or `1`; we also have per-item fitness functions `D_i`; and we define a per-item-pair transition function `V_{i,j}` which penalises discontinuities. Then the energy function is given by               E(x_1, ..., x_n) = SUM_p D_p(x_p) + SUM_{p,q} V_{p,q}(x_p, x_q)      In my particular case I have 32 segments, so there are 2^32 possible vectors to evaluate. I could evaluate `E` for each combination, performing 2^32 evaluations, and so get the minimum energy and the combination which achieves it. This is what my intuition suggests. But this is impractical, because the complexity is exponential. Therefore I want to use the graph cut approach, but I don't understand how to formulate the graph. The 32 segments are the nodes of the graph, but what would be the weight of the edges? And what would be the capacity?


title: Existing buggy code or a brand new one? (From time perspective)

text: I am facing some issues with a buggy library I currently have and it's used in my current project, I need to finish this project as soon as possible in order to deliver it to our client. However, this library is horrible! Lots of bugs, lots of errors and bad performance, I thought to write my own library to handle what that library handles (GUI/Graphics and some Data manipulation) but I lack time to do it. I have wasted a lot of time repairing this library thus I am very close to my deadline with 85% completion and still lots of bugs I face and fix everyday. Maybe you will ask me the following question: > Why did you use it in the first place if you knew it was buggy? I will answer that question, the reason why is because the buggy library is considered a standard in out company; plus, I am not the only one who thinks that library is buggy, almost all developers hates it! My question is, should I deliver the current project with that library then develop a new library and use it to enhance the project after that deliver it to the client again as an update, or develop the new library and restart the whole project using the new one? and why?


title: Good principles to explain the use of data objects

text: I'm in a little need of names clarification. First a brief description of my position. I prepare as debutant giving a junior developer job descriptions, which also provided another perspective on how important communication is, and to put it beyond doubt. Simply; I like to understand what he mean with "Context" and I like to give a adopted description of what a POCO is. Now, this is not the exactly problematic words. We haven't even spoken yet. I describe it more as the semantic problem and focus on data and IoC, because there is the place we're going to met (He = GUI, I'm BL). I give a manual-typed sample just as a reference for naming different part of it. Some terms are local to a Manufacturer or tool and some are used more Generic, which I prefer the latter.               // Poco, Model?     public class Customer     {         public int CustomerId { get; set; }         public string Name { get; set; }     }               // A short sign of repository pattern     public class CustomerContext     {             // Is this a context or even a entity?         List<Customer> cust;        public CustomerContext()        {           cust = new List<Customer>();           cust.Add(new Customer() { CustomerId = 1, Name = "Doe" });           cust.Add(new Customer() { CustomerId = 2, Name = "John" });           cust.Add(new Customer() { CustomerId = 3, Name = "Zelda" });           cust.Add(new Customer() { CustomerId = 4, Name = "Kim" });        }             public IQueryable<Customer> Get()        {           return cust;        }     }      * _What terms fit best? *_ Are 'Customer' a Model (tooked from MVC)? Does we, simply put, mean the same with POCO? What do I call the sample typed data above? Mocks? Simply "Data"? What do I call the object CustomerContext? A repository? A Context? Is it an Entity? Are there other terms that have escaped this scope? It appears common to write about repositories and generics, even though fell into a scope of a manufacturer (where i.e. 'Entity' commonly means Entity Framework). A strong indication of what terms means what (and when), would be of help.


title: HTTP Request & Response Parameters

text: 1. How are request parameters stored and arranged for a post request if it's not json or xml?   2. Is it possible to send response parameters back in the same way?


title: Should I use expect or should when writing RSpec specs?

text: Please can someone explain to me how I should go about deciding whether to use expect or should syntax for my rspec examples. From my understanding we should no longer be using the 'should' syntax. The replacement is to use expect().to or is_expected.to Is this correct? On some really good references, it seems to be common practice to still use should. And these references are being updated consistently. Any help in the correct direction would be appreciated. References (+ others, but excluded)   https://github.com/thoughtbot/shoulda-matchers   https://www.railstutorial.org/book


title: ASP.NET deployment/maintenance best practices

text: I have been in the web development industry for around 5 years now, always working in an open source environment. Mostly apache, mysql, and php with a little bit of ruby, using git for version control. But recently took up a job where development is entirely C# ASP.NET MVC. While I was able to pick up the language etc fairly easily, the other members of my team (with a lot more MS Development experience than me) all have a different way of thinking when it comes to publishing and deployment of the final site, and particularly future changes. The mentality with the other developers is that once a site has been published it is final. No more changes can be made to the site, when I have asked the reasons behind this, the answers have been it is too dangerous, time consuming or difficult. From my past experience, updating a site is simply a case of uploading the changed files, which is usually quite quick if it was a little change, or putting the site in maintenance mode while the update occurs. We recently published an MVC Site, and the business contacted us to update some of the text and add a link to a new pdf document. The rest of my team were quick to say that this should not be done because the site is now live and should not be modified. Is there something I have missed by not being 'brought up' a Microsoft developer? What are the argument against making modifications to a live web application in production and is this mindset unique to .NET developers? I genuinely would like to understand this mindset and whether it is justified in a Microsoft development environment, or if this is just an older way of thinking. _NOTE: We use TFS for version control and use publish profiles to determine where the site gets deployed (UAT or Production)_


title: Building a template engine - starting point

text: We're building a Django-based project with a template/generator component. This component will be separate from the project as such and can be Django/Python, Node, Java or whatever works. The idea is to generate questions based on a pattern. For eg., I would want to generate questions like "What is 2 + 3", "What is 5 + 8" based on the pattern "What is X + Y ; where X,Y < 10". In this sense, it's like a template engine. The templates will contain references to objects with properties that are defined in the DB, say, a Bus. For eg, it could be something like > [object type="vehicle" weight="heavy"] and it would have to pull a random object from the DB fulfilling the criteria : type="vehicle" weight="heavy" (bus/truck/jet) and then substitute that tag with an image, say, of a Bus. Also it would have to be able to handle some processing. Eg: > What is [X type="integer" lte="10"] + [Y type="integer" lte="10"] > > [option X+Y correct_ans="true"] > > [option X-Y correct_ans="false"] > > [option X+y+1 correct_ans="false"] The engine would be expected to fill in a random integer value <= 10 for X and Y and show radioboxes for each of the options. Would also have to store the fact that the first option is the correct answer. Does it to make sense to write something from the scratch? Or is it better to use an existing templating system (like Django's own templating system) as a starting point? Any suggestions on how I can approach this? edit : Clarification of use case


title: Leading an offshore team

text: I'm in a position where I am leading two teams of 4. Both teams are located in India. I am on the west coast of the U.S. I'm finding leading remote teams challenging: First, their command of the English language is weak. Second, I'm having difficultly understanding them through their accents. Third is timing, we are 12 hours apart. We use Skype to communicate. I have a month to get the project done. We've burned through a week just setting up the environments. At this point I'm considering working their hours, 11p PDT to 7a PDT, to get them up to speed, so that I can get the project off the ground. A 12 hour lag time is too much. I'm looking for steps I can take to be successful at leading an offshore team. **Update** The offshore team's primary task is coding, of course, most coding tasks do involve some design work. The offshore team's are composed of one lead, 2 mid level (4 to 5 years) developers and a junior (~2 years) developer. The project is classic waterfall. We've handed the offshore team a business and a technical design document. We are trying to manage the offshore in an agile way. We have daily conference calls with them and I'm requiring the teams to send me a daily scrum in the form of an email answering the following questions:   1. What did I do today?   2. What am I going to do tomorrow?   3. What do I need from Chuck so I can do my job tomorrow? There is some ambiguity in the tasks. The intent was to give them enough direction for them to develop the task with out writing the code for them. I don't have a travel budget. I am using Fogbugz to track the tasks. Each task has been entered into Fogbugz and given a priority. Each team member has access to FogBugz and can choose what task they wish to complete. _Related question_ : What can we do to improve the way outsourcing/offshoring works? **Update 2** I've decided that I can not talk to the team once a day. I must work with them. Starting tonight I've started working the same hours they are. This makes me available to them when they have questions. It also allows me to gain their trust and respect. **Update 3** The project was completed and delivered on time. The key factor was me working the same time as the offshore team. If that had not occurred I'm confident we would have failed. I managed two offshore teams. One of the teams under preformed and I fired them taking on the work myself. Things that lead to success was: Communication, understand their culture and how they communicate. Build rapport with them. A couple of the workers I keep in touch a year after the project completed. Meetings, we met at the beginning of their day so any questions or blocked tasks could be addressed. At the end of the day a daily summary was send out by the worker describing their day and if they encountered any issues. Ideally we could resolve their issues by the start of their next day. Questions, ask questions. Most cases information is not volunteered. Be visible. Being online, available and reachable help fostered the team's commitment to the project. I was not just the daily email. Make it easy. Internally we had a complex QA system in which bugs where tracked. It was complex and hard to use. I paid the $$ for a fogbugz account for each of the team members. Most of the team had used FogBugz and understood the workflow. Daily I would update the fogbugz with new bugs and update the QA system from Fogbugz. **Stackoverflow question** Leading an offshore team


title: What can we do to improve the way outsourcing/offshoring works?

text: These days one only gets to hear the anti-outsourcing argument citing failed projects, lost jobs, cultural differences, communication issues and so on. The success stories, cost savings, shared cultural experiences often get conveniently ignored. What can programmers from both sides of the globe do as a community to improve the way outsourcing works and to make it more meaningful and relevant? Please suggest constructive ideas/experiences rather than letting this be another opportunity for ranting.


title: What kind of metrics, if any, can be collected from requirements development?

text: We elicit requirements from our product stakeholders by creating and refining user stories in monthly sprint planning meetings. This includes defining use cases, acceptance criteria, and identifying constraints, and the final result is a sprint backlog of user stories. The high-level customer requirements are refined into lower-level product requirements through design reviews among the development team throughout the sprint. The design reviews result in UML diagrams, software interfaces, and, in general, a human language description of various software requirements. We are increasing our metric-awareness as an organization so that we can better identify potential areas of process improvement (and so that we can eventually be appraised at CMMI level 3). What kind of useful metrics are there to collect in the elicitation and refinement of customer requirements?


title: Standards of unit testing output

text: Simple question, what's more common / standard / won't make future developers look at me cross-eyed for unit testing: Displaying just the errors, or reporting every passed test?


title: How much functional programming expertise can programmers be expected to have?

text: I'm coding in a non-functional language with functional mechanisms (C# to be specific, but you could substitute, say C++ and use function pointers, or what have you) on a small team. It's my habit to use functional techniques -- passing delegates (objects representing functions) as arguments, using closures, occasional anonymous functions, etc -- and I try to document this better than I think a reasonable programmer would need them documented. Looking at code I see online and on Stack Exchange communities, I think my style is pretty normal among C# developers. Our team, however, isn't sophisticated in these techniques and I end up having to explain (and defend) myself -- my high level of documentation is actually used as evidence by them that I shouldn't code the way I do for the sake of readability. Now, given the make-up of my team, I understand that I might just give up the good fight here and code to their standards, understanding its better for the team. Does anyone have successful experience using empirical studies, accreditation criteria or best practices lists published by respectable sources that suggest that programmers today have more experience in these functional programming idioms, and that, therefore, we don't need to shy away from them for purposes of maintainability?


title: Big Data: Can it be pre-processed?

text: My question is about "big data". Basically, big data involves the analysis of a large amount of data to make meaningful insights from it. I would like to know: Whether or not large amounts of data can be pre-processed? (like say for example you are running some matching service for people, so you take all the information you have on the people and you process it at a certain point for use later on) **If pre-processing is possible, how would you normally go about doing this?** * * * To help narrow the scope of my question, please look at this hypothetical scenario. > Say I have a customer database and my company is a global retailer that is > using some type of points system to reward the shoppers (for arguments sake, > the points are tallied up on a type of electronic card or mobile app). > > So based on my rewards system, I am now able to fully aware of exactly what > a shopper is purchasing and when they normally make purchases of recurring > items. > > My database is growing all the time with this information and I would now > like to make recommendations (or send notifications) to shoppers about > special offers of products they buy or related products that may interest > them, when they enter 1 of the stores. > > Instead of processing all the accumulated data when a shopper enters the > store, I would like to continually process the data-stream as the data comes > in (meaning from previous shopping experiences), so that when it comes time > to make a recommendation (for the next time a shopper walks into the store), > it is simply a matter of retrieving the recommendations and providing a list > of it to the shopper. > > With this method in mind, I can easily space out my CPU-intensive tasks, > instead of say: processing all customer data on a busy day when foot-traffic > is at peak volumes. By asking how I would do this, I would be referring to common methods available for achieving this. This can include any special databases or programming techniques or even specialized software that can carry out these timed calculations that can "pre-process" the data at specific times, in order to balance out CPU-intensive tasks. You can consider the customer-recommendation scenario as the "situation". It is the best example scenario I could think of that would explain why "pre- processing" (or calculating the recommendations at specific times) would make sense.


title: Can anyone point me to some examples / reading material that outline updating the dom automatically?

text: Basically I would like to know how apps such as hotmail receive emails in realtime, without making periodic checks on the server - I've sent an email to myself from outlook with hotmail open and saw this in the console a couple of seconds later - GET http://sn108w.snt108.mail.live.com/mail/messageshelper.mvc the contents of which is the html to update, but I'd like to know what listens for the get request which presumably fires some javascript to update the dom? My question isn't specific to hotmails methodolgy in fact far from it as they will be working on the .NET platform whereas my proficiencies (if you can call them that!) are in the LAMP stack but any reading material on the subject would be great, thanks!


title: How to write camel case for words like "phonenumber", "motorcycle", "wavelength", etc

text: I am having a problem in understanding how to apply camelCase syntax to some of my variable names. For example, how should I correctly write a word like "phonenumber" in camel case? Is it `phoneNumber` or `phonenumber`? Similarly with "username", is it `username` or `userName`? I think it doesn't look right with camel case like `motorCycle`, `passWord`, `sunDay`, `setUp` or `waveLength` since these are just one word each. I think that could be why it's called `hashMap` but also `hashtable` in camel case without the capital in the last case because hashtable is one word while hash map is two words. But if the motorcycle has a color then would it be `motorcycleColor` since a word is concatenated? Is that correct or should it be `phoneNUmber`, `waveLength`, `sunBlock` and even `sunDay` for the Sunday of the week? Why for instance is the method called `getISOCountries` while it says `HttpHeaders` e.g. it's not clear what becomes lowercase if we have a method like `String camelCaseString = dog.toCamelCase()` or `interface CamelCase`.


title: When does freelancing become a start-up?

text: In one of my previous question in this Q&A site, someone suggested me that freelancing is not for everyone. I gave a thought over it and came to a conclusion that it is correct. While it may be a choice of veterans and experts in their own fields in some countries, it is like a rescue boat option in few countries, where there is fierce competition. I am confused on when to use the term freelancing and when to use the term start-up. I may be a freelancer with my name on my business cards, whereas, I may be a freelancer with a one-man start-up, with my firm's name on my business card. I registered my start-up legally but still, it is a one-man show. It is a one- man company. Is it still freelancing? In that case, should I print my firm's name on business card or wait till I get a handful of hired employees? When does the label of freelancing get removed for someone who plans for a start-up?


title: What version control system is typically used in Java Enterprise development?

text: There are many vcs available. Which of them are typically used in JavaEE world?


title: What to do when coding begins to feel boring, like it is all just more of the same?

text: I started programming at the age of 6 on a Commodore 64. Now I'm 28, and I have to complete 4 courses from a first degree in Computer Science. I'm starting to get bored with writing code after all these years. I've taken a course in Computer Science in theoretical computer languages and 10 years of C system coding in network security field and I just don't get any stimulation from writing code. I can write code in C, C++, Python or whatever language you want, but I can't get excited about what I'm doing. I can't feel any challenge. I've written multi-threaded code, HTTPS MITM proxy and a WSGI application without the need of any specific algorithms skill. I feel that all this new stuff is all the same, with simpler (or more) abstractions or automation in it, but it all sounds the same to me. Over and over again. The computable language is all Turing computable, so coding is only a replication of a similar pattern in this subset of a partial function. In my everyday work I'm feeling bored even with searching for bugs, or doing benchmarks on code, or fixing the problem with the library X,Y,Z. I'm a very curious person. I always get stimulated by something. But I can't even when I look at great code. I feel more comfortable in how the things work. **Is it time to make an advance in my career? Or to get more challenging stuff in Computer Science? Maybe get a major degree in CS?** I've started to read my first book on project management "Peopleware" and I'm getting more interested in the software development lifecycle. What do you suggest to do? Perhaps trying to get into Google or Microsoft or Apple like some friends of mine have done. Or perhaps a more managerial career path. I have also tried to find a good book about communication rules and "people personality" to prepare me for the possibility of getting into management. Any suggestions? P.S: I have a lot of interest, **i'm not depressed** :) i love mountain, trekking, take photo shoot and i'm a sport climber, i love to swim and sport in general, sometimes i do running, actually I'm reading book about my country (Italy) story from AC to today and i love trips (this summer i made 4000Km to see a lot of place in Spain and climb in it, all over in only 3 week, not a holiday but a marathon, 24 km of trekking made my hernia injury .. :)))) ), i love theater and life in general * * * Thanks to all, thinking about all the answer give to me the opportunity to make my path more clear. For a summary purpose we can generalize about the most voted up answer. First of all all the people vote-up the **necessity** to made our work a support of your life and not the only reason to stay in life (this is not my case), so, if you only reason of life if working you come fast to a really depressive situation. As peopleware say, Vienna don't waiting for you :) After this reminder people suggest to:     * increase technical complexity I'm actually working on to increase challenge and get less bored about it.   * change the field of expertise to a non technical field trying to become a manager or make some carer advance in a non technical fields related to your work.   * change the field of expertise in another kind of technical challenge, are you a system programmer ? try to get less bored developing about application for human so you can feel more comfortable viewing people using your useful software   * make some advance in your computer science degree in your academic path For my purpose the right answer is to advance in computer science, for my feeling i think programming is not the only computer science way to get and i think i can feel better getting other path in computer science different from software engineering carer. Thanks to all.


title: What is it called when a website URL replaces WWW with something else, and what purpose does it serve?

text: What is it called when a website has another word in place of where `www` usually goes? For example, `images.google.com` vs `google.com/images`. I know the latter is a file on the server that the browser downloads, but what exactly is the purpose of the former? It would be helpful to know what this is called.


title: Pros and cons of an HTML/JavaScript only web app

text: I come from an ASP.NET forms background and have found server side coding very powerful in the past. More recently, however, I have been wanting to phase out the server side code of the front-end and replace it with pure HTML/JavaScript, which accesses the data through JSON webservices. I have no real experience in this, and so I would like to hear whether this is a tried and tested model. Also, what are the pitfalls surrounding it? I find ASP.NET user controls very useful, so I would like to keep the theory behind it by storing markup templates in separate HTML files on the server. These will be retrieved and used through jQuery AJAX and the jQuery HTML templates plugin respectively. Any input will be extremely appreciated. P.S. Sorry for the noob question, but is this type of Web architecture what is referred to as web-2.0 or am I completely off-track?


title: Could applications build by Xamarin be possibly banned by Apple for selling on app store?

text: Consider having restricted man resources and thinking about using Xamarin studio for building cross platform application. Will you be afraid of Apple trying to ban all applications NOT developed by xCode? I mean in future. It is obviously not banned now. I am just asking this because I heard this on a meeting today as argument of not using Xamarin studio. I am not an expert in this area but very curious because it sounds odd. The application should be banned because of some kind of generated code which is always there when building app using Xamarin.


title: Egoless programming, is it possible or even desirable

text: After reading this question; Why are so many programmers arrogant It does bring a related question to my mind. Is it possible to have egoless programming or is it even desirable? As a profession we do seem to want to show off the latest gizmo, technique or say “look at this awesome piece of code I’ve written”. Yet we can get very defensive when asked to submit items of work for code reviews or get negative comments from other programmers (hearing the term WTF, has never been a good sign). Can we as a profession be able to sit down and analyse a piece of code, data or architecture for its merits or constraints and a calm and respetful manner, without causing offence or antagonising our colleagues, or are we just the archetypal Dilbert character, raging against the system?


title: Number Game Algorithm

text: Problem Link - http://www.iarcs.org.in/inoi/2011/zco2011/zco2011-1b.php The task is to find the maximum score you can get in the game. Such problems, based on games, where you have to simulate, predict the result, or obtain the maximum possible score always seem to puzzle me. I can do it with recursion by considering two cases - first number picked or last number picked, each of which again branches into two states similarly, and so on... which finally can yield the max possible result. But it's a very time-inefficient approach, since time increases exponentially, due to the large test cases. What is the most pragmatic approach to the problem, and to such problems in general?


title: Consultant in a firm that doesn't understand the tech!

text: I got the job as a Consultant in a firm that has 3 other programmers. My job is to rewrite all the old system in Java, Spring etc but the staff programmers only know perl and the manager does not know any programming. I am trying to get them to understand that I have 6 projects to rewrite here but no one has design docs or spec. the staff programmers never had to write any documents. Plus I cant get the manager to understand the new java tech stuff.. he keeps asking some of the staff for views on things but the staff don't know it or understand it. Where do I go from here to make the manager understand that the staff programmers or someone has to write a design document so I know what to build. or if I have to write the documents how do I get the information?


title: Examples of when we'll use interpreted language over compiled language?

text: I understand the differences between interpreted and compiled languages, but if someone could provide some examples of situations when one is likely to use interpreted languages over compiled languages, as well as situations when one is likely to use compiled languages over interpreted languages, it'd be really helpful.


title: How to effectively put code live

text: What are the general strategies to employ when attempting to ensure that a module of code will function correctly on the live system? A common problem we have at our software house is that we typically deploy solutions to a remote client's server, which hasn't got any software-development-related software installed on it. When problems (inevitably) arise in the deployed software, we get annoyed clients telling us to fix the issue, but since we can't remotely debug the code, we get locked into a cycle of effectively having to guess whether our code will work before we deploy it, and then repeating the cycle when the deployed code has issues. Furthermore, due to the remoteness of the client, it's typically not possible to get a full working test copy of their system set up on our end, so we end up developing against approximations of their system on our end. This makes our debugging and code planning on the development side significantly less effective, because when we deploy we don't know precisely what variable between our test system and the live system is causing problems with our code. So far, I've implemented a basic error logger in all deployed code that captures the stack trace, exception details, method, class, namespace, parameters and additional messages and error codes at each exception, but this really just speeds up the process of fixing that specific error. I've also tried writing individual tests for specific subsections of modules as executables and running them on the client system, but for modules that are tens of thousands of lines long, this usually just isn't feasible without grinding all development to a halt. I'm trying to get a strategy in place which would help us better avoid the exceptions in the first place, but I'm stuck on the fact that:   * We don't have (and typically can't get) a working test system that accurately models the live system, e.g. an image of the live system, if we do have it then it's months out of date   * We can't install remote debugging software on the live server   * The client typically has no dedicated test server, so any deployments have to go straight to live   * Having no access to a copy of the live system means that we can't write effective unit tests which actually model the conditions the code will run under on the client side If it helps, the code is typically C# running under .NET 3.5. How to better tackle this issue?


title: Dealing with coworkers when developing, need advice

text: I developed our current project architecture and started developing it on my own _(reaching something like,`revision 40`)_. We're developing a simple subway routing framework and my design seemed to be done extremely well - _several main models, corresponding views, main logic and data structures were modeled "as they should be" and fully separated from rendering, algorithmic part was also implemented apart from the main models and had a minor number of intersection points._ I would call that design scalable, customizable, easy-to-implement, interacting mostly based on the "black box interaction" and, well, very nice. **Now, what was done:**   * I started some implementations of the corresponding interfaces, ported some convenient libraries and wrote implementation stubs for some application parts.   * I had the document describing coding style and examples of that coding style usage (my own written code).   * I forced the usage of more or less modern `C++` development techniques, including `no-delete` code (wrapped via smart pointers) and etc.   * I documented the purpose of concrete interface implementations and how they should be used.   * Unit tests _(mostly, integration tests, because there wasn't a lot of "actual" code)_ and a set of mocks for all the core abstractions.  * * * _**I was absent for 12 days**._ * * * **What do we have now (the project was developed by 4 other members of the team):**   * 3 different coding styles all over the project _(I guess, two of them agreed to use the same style :)_ , same applies to the naming of our abstractions _(e.g`CommonPathData.h`, `SubwaySchemeStructures.h`)_, which are basically headers declaring some data structures.   * Absolute lack of documentation for the recently implemented parts.   * What I could recently call a `single-purpose-abstraction` now handles at least 2 different types of events, has tight coupling with other parts and so on.   * Half of the used interfaces now contain member variables `(sic!)`.   * Raw pointer usage almost everywhere.   * Unit tests disabled, because "`(Rev.57) They are unnecessary for this project`".   * ... _(that's probably not everything)_. Commit history shows that my design was interpreted as an overkill and people started combining it with personal bicycles and reimplemented wheels and then had problems **integrating** code chunks. Now - the project still does only a small amount of what it has to do, we have severe integration problems, I assume some memory leaks. * * * **Is there anything possible to do in this case?** I do realize that all my efforts didn't have any benefit, but the deadline is pretty soon and we have to do something. **Did someone have a similar situation?** Basically I thought that a good (well, I did everything that I could) start for the project would probably lead to something nice, however, I understand that I'm wrong. Any advice would be appreciated, sorry for my bad english.


title: Where should I store my user session data?

text: Should I store only the user's session id along with the data in a table, or should I store the user's session id in a table and access an array of data from the user's session id? and why? What is more efficient? I will not be generating any reports.


title: Where are all the functional programming design patterns?

text: OO programming literature is full of design patterns. Most books on object oriented programming dedicate a chapter or two to design patterns like factories and decorators. So what are the equivalent patterns in functional languages and why hasn't anyone written a book about them yet? Is there something special about functional languages that obviates the need for design patterns?