title: Is there any plugin for better viewing of exceptions?

text: I don’t think that I’m the only one that thinks that Visual Studio exception window is very poor. Trace information lacking formatting and is hardly readable.   * **Is there any plugin or external tool that shows exception information better?**


title: Question about Creating a Scripting Language

text: Say, for example, I wanted to pay somebody to create a programming language or scripting language for me. What type of document would they need, in order to fully understand what it is exactly that I want. I mean, are there standard documents that describe the new programming/scripting language in question?


title: Is there a design pattern for dynamically applying transformations or filters to a model?

text: For example, there is a model of an event with certain attributes that can be adjusted by existing processes: maybe one that looks at a geo-location stamp and determines a nearby city; another that looks at the number of registrations and applies rounding; another that calculates local popularity based on attendees vs. nearby events. The important piece is having a way to **dynamically order the operations** \--the filters/transformations/processing tasks--so that you can pass the events to a processing object that arranges the tasks in the correct order for the configuration/situation, and then passes the models through to apply them. I can think of some ugly ways to make this happen, but want to know if there is a SOLID pattern that would allow for better, more-testable code.


title: Single result as REST/ODATA response on GET

text: In an API which should be both restful and support OData for different client types. I have an endpoint that always returns a single result. Should I:   * Return the entity as a single entity?   * Put it in a list which will always contains 1 element?    * Do something completely different? Normally a Get request returns a list of items and Get(int key) returns a single item based on the key, this however is _the_ exception. I don't want to be inconsistent, but it seems counter productive to put a single element in a list.               public SingleEntity Get() { }     public IEnumerable<SingleEntity> Get() { }


title: How to allocate cross-cutting concerns in agile software development planning?

text: My employer has been moving from traditional waterfall projects to a modified version of agile. Work is broken into stories, which are estimated and sequenced into two-week long iterations. Each iteration includes points for building, testing, and accepting features. Stories are focused on testable business features. There is no way to plan and account for cross cutting concerns such as design, architecture, infrastructure, or (ironically) project management. Should agile teams explicitly include stories or tasks for these cross-cutting concerns? How does your team handle tasks that never go away? Are they "off book"?


title: Can I claim the website I made when the back-end technology such as MySQL and PHP weren't invented by me?

text: That's just an example case. What I'm trying to point out is, how can you claim something (software/website/or any 'ontouch-able' products) as yours while at the same time you are using some existing technologies behind it? (such as database engine, programming languages, compilers, or even the computer it self!). If you can, how far can you claim it?. Can we put a notice (Copyright (c) by Me) on an website that built on top of LAMPP?. Or can I put my own copyright notice for the program I wrote on top of OpenGL? I have the basic ideas about software licenses such as GPL, MIT, LGPL, etc. What I still don't understand is, the fact that we are all being helped all the time by existing technologies such as DBMS, compilers, IDE, and even the computer we use, now if we create something from these technologies, how far we can claim it as ours?


title: Intel mnemonic to machine code converter library

text: I'm trying to do the following: take a single IA32 instruction in the Intel syntax (such as `ADD EAX, EBX`) and produce the corresponding machine code for this instruction. Is there some small library, preferably open source, that can do this for me?


title: non-volatile virtual memory for C++ containers

text: Is there a virtual memory management process that would allow a program to use the standard container structures and classes, but retain these structures and their data when the program is not running (or being used), for use by the program at a later time? This should be possible, but can it be done without changing the source code and its (container) declarations? Is there a standard way of doing this?


title: Of which bad practice is require calling functions in order a sign?

text: Sometimes I find myself writing comments on class methods like this:               class A : public Base     {     public:         /**           * Sets variable;           * should be called before ImplementsInterfaceMtehod(),           * else has no effect.           */       void SetSomeVariable( var_type value );            virtual void ImplementsInterfaceMethod();     }      The callers of `Base::ImplementsInterfaceMethod` obviously do not know about the variable, and should not. But the users of `A` should set the variable if they want it to take effect. It is not required to set the variable (else it could be a parameter for the constructor), so I cannot throw exceptions in `ImplementsInterfaceMethod` if it is not set. Is this a sign of some typical bad practice? Is there a better way than writing a comment as shown to deal with this? **edit** here's a more concrete example resembling part of some realtime 3D image processing code; because of the realtime part and the fact images can get huge, everything has to be preallocated.               class DataProcessor     {     public:         /**           * Sets dimensions of the data for the next call to Process().           * Can be used by implementations to setup internals, eg preallocate.           * Upon returning out contains the dimensions that will be returned           * by the Process call, given dims as input dimensions.           * (A)           */       virtual bool SetInputDimensions( const Dimensions& dims, Dimensions& out ) = 0;            virtual bool Process( const Data& in, Data& out ) = 0;     };          class ImageStitcher : public DataProcessor     {         /**           * Set size of the output image returned by Process() as a factor,           * eg when size == 2, image will be twice as big.           * (B)           */        void SetOutputSize( const double size );              /**           * Set the position at which the next Data object passed to Process()           * will be stitched.           * (C)           */        void SetStitchPosition( double x, double y, double alpha );     }      So here (A) must be called at least once before Process() is called. Which I enforce by returning an error in Process() if that was not the case. Most of the time the dimensions are not known when constructing the object though so a constructor parameter is not an option. Two main components use the DataProcessor interface: all processors are in a network of processors, and that network is unaware of the type of processor, it just takes care of transferring data between them by calling Process() multiple time. Another component takes care of setting up the network by calling SetInputDimensions(), again unaware of what type the processor is. (B) should be called before SetInputDimensions() gets called, as it defines the size of the resulting image. (C) should be called before each call to process else the stitcher doesn't know where to put the image Now this whole processing network is actually used in commercial applications and works extremely well since I made sure everything is called nicely in order. Yet each time I write 'must/should be called before' bells start ringing all over the place..


title: What was the first commercial open-source software?

text: According to the Wikipedia article on open-source, the philosophy of sharing code has been used in projects since the early computer days (mostly through Universities sharing code). However, I'm interested to know what (and when) was the first commercial open-source software (successfull or not)? If there's any confusion on commercial, I define it as thus: "Having profit as a chief aim".


title: How did programming work when programmers used punchcards?

text: I saw this: Learning to program on punchcards and I've seen this: http://en.wikipedia.org/wiki/Computer_programming_in_the_punched_card_era but they leave much to be desired. Can anyone explain to me how programmers programmed when they used punchcards? Specifically, the system of input computers used to derive instructions from the punched card itself. I do not know much about retrocomputers, so any one system of input you are familiar with would be fine. More general answers are also appreciated.


title: Should Equality be commutative within a Class Hierachy?

text: It is easy to define the `Equals` operation in ways that are not commutative. When providing equality against other types, there are obviously situations (in most languages) were equality not being commutative is unavoidable. However, within one's own inheritance hierarchy where the root base class defines an equality member, a programmer has more control. Thus you can create situations where               (A = B) ≠ (B = A), where A and B both derive from base class T      Substituting the `=` with the appropriate variation for a given language. (`.Equals(_)`, `==`, etc.) That seems wrong to me, however, I recognize I may be biased by background in Mathematics. I have not been in programming long enough to know what is standard/accepted/preferred practice when programming. Do most programmers just accept `.Equals(_)`may not be commutative and code defensibly. Do they expect commutativity and get annoyed if it is not. In short, when working in a class hierarchy, should effort me made to ensure Equality is commutative?


title: How do you put a database online?

text: I have a very beginner question regarding web development. I've had some experience with JSP, Hibernate, and MAMP to create a simple system for tracking inventory and sales. But this was all done locally on one computer. This time, I want to create a system that could be accessible online. It's to help my mother track her business wherever she goes. So there would be similar aspects like tracking inventory and sales. I understand that you have to have a server in which to host all the files in. But I don't understand how you can access your database online. Or what sorts of applications or products should be used. Currently the host of my database is localhost. How do put it online such that you can still do CRUD operations? Are there any guides to do this?


title: In Scrum, should you split up the backlog in a functional backlog and a technical backlog or not?

text: In our Scrum teams we use a backlog, which mostly contains functional topics, but also sometimes contains technical topics. The advantage of having 1 backlog is that it becomes easy to choose the topics for the next sprint, but I have some questions:   * First, to me it seems more logical to have a separate technical backlog, where developers themselves can add pure technical items, like: we could improve performance in this method, this class lacks some technical documentation, ... By having one backlog, all developers always have to pass via the product owner to have their topics added to the backlog, which seems additional, unnecessary work for the product owner.   * Second, if you have a product owner that only focuses on the pure-functional items, the pure-technical items (like missing technical documentation, code that erodes and should be refactored, classes that always give problems during debugging because they don't have a stable foundation and should be refactored, ...) always end up at the end of the list because "they don't serve the customer directly". By having a separate technical backlog, and time reserved in every sprint for these pure technical items, we can improve the applications functionally, but also keep them healthy inside. What is the best approach? One backlog or two?


title: Community Programming

text: **Background** I just began working for a religious non-profit organization. As with most non-profits, the organization is resource-poor and has no IT department to speak of. In my two months here I've received 20 requests for websites, apps, and internal automation. Many of these 20 requests have merit and would benefit the organization. I'm a .net web developer and as such the open source community is relatively foreign to me... **Question** _For the sake of this question, lets say I'm talking about building a single, large, website._ Does software (web based, hopefully) exist that would allow me to post requirements and assets (graphics and CSS) for a site, and then invite programmers to participate in the sites development? As a simple example, I could post the requirements and data for the about us page and an individual would indicate that they could/would fulfill the requirement. Upon completion, they could upload the new source code to the shared repository (github).


title: How to save useful code snippets?

text: I do a lot of web development and there are many code snippets that come up again and again so I dive back into the most recent project where I used it which isn't that efficient. How do you store all your useful and oft used code pieces? Are there any products meant for this?


title: Classes and library archive

text: We are a group of 5 developers(scientists end engineers) that write code in C++. What we would like to do is to make all the code available to all the developers easily. The first step in this process was to set up a SVN server, and it worked fine. Now we are facing another need: we would like to have a system were all the base classes, mathematical libraries, algorithms are public and accessible to every developer. Something like a Wiki, or like the root documentation http://root.cern.ch/root/html/TH1.html. A sort of site where you can upload code, you can describe it and you can point out how to use it. Do you have any suggestion?


title: How to go about saving a Snippet / Block of Code

text: I am currently learning C#, I am pretty proficient in Java. A project I have been working on for a while is basically an application that lets you input code "Snippets" or blocks of frequently used code and lets you tag them with specific topics for easy sorting. How should I go about saving the inputted code so I can access it later and possibly format it or keep it in the formatting it's pasted in? I would want to put more information into the file it is stored in addition to the actual code, like the tags and dates/times so things like XML have came to mind but I really am not sure. Just for clarification, I am aware of the snippet function in visual basic. What I am asking about is for making my own C# standalone application and how to store the code on my own.


title: How to avoid code duplication across unrelated projects

text: I'm a contractor at a large Telco where I'm usually working on several different projects at once. The VCSs I use (mainly git and mercurial) tend to make me keep the code bases for unrelated projects in separate repositories, and I realise many benefits of this approach. However, there are many little bits of utility code and helper functions I've written which are useful across two or more projects, and I'm well aware of the benefits of keeping my code DRY - for example sometimes I find a better way to implement some piece of code and I don't want to have to update it in every place where I've duplicated the same idea. What is the best way to refactor out this common functionality (it is not always so simple as copy-and-paste, but sometimes it is..) without creating unnecessary dependencies between unrelated projects, and without adding needless complexity?


title: Automatic code snippets in VS 12

text: I've decided to customize my VS12 to perfectly mirror my wishes. However, due to the lack of time, I'd like to start by just simply adding some code snippets first. Addins and such will have to wait until fall. :( So, basically, I'd like to type _hazaa_ and get some (preferably, but not necessarily, tab-jumpable) text saying _yo, dude_. Something like _prop_ spits out a stub for a property (with tab-jumpable parts of it being optional). I've found this tutorial and I wonder if that's the quickest way to start creating ones own code snippets. If so, I can as well do it right from the ground but it'd be nice to have something Q&D to start with. Also, I can't really evaluate how well that article adapts to the modern capabilities of VS12 (and the upcoming VS13). It'd be a blast if somebody with experience of that shed some light on the matter.   1. Is the article the quickest way to automatic code generation?   2. Is the article a reliable and updated way to customizing VS12/13?   3. Is there a better resource for my plans and, in such case, where?


title: What design pattern should be used for implementing maintainable complex dialogs?

text: From time to time I implement functionality which requires asking user questions sequentially.   Questions are conditional, that is the answer defines the set of the following questtiongs.   Sure it is Wizzard UI design pattern, but for now I have no clear understanding how it is implemented from the point of view of software architecture. Screen/question can be a somewhat complex interface but most fo the time it's just a selection of several options.   Nonetheless after any step some calculations can be required, not only to get additional data but to define the set of questions.   I guess Strategy pattern has to do with this but I feel that the with this pattern the code which builds "execution flow" can become ugly. Thanks in advance.


title: The Service class in MVC

text: From time to time I find there is a need to build a service class. Something I can't really attach inside a model in order to respected GRASP and SOLID. So I created a class called AccountTransferService. * Are service classes good design practice ?  * Do they represent a Model ?  * If a Service is not a Model what are they in a MVC arhitecture ?


title: Work flow when editing files in /var/www. Constantly needing to input "sudo" commands

text: I installed Apache2 and PHP5 last night on my fresh Linux Mint machine. I created a folder and created a simple `index.php` file with a call to `phpinfo()` to test out the installation and every works correctly. However when I open the file with Sublime Text 2 or any other editor, I cannot save my changes. I can use the `sudo nano` command to open it with super user privileges and I can save just fine. The same goes with Mercurial. I cannot `hg commit` because of permissions. I can only `sudo hg commit`. Is this how the basic workflow is supposed to be? If I run the `chmod` command and recursively give `777` permissions to the folders and files within Apache can run it just fine, but if it's a dynamically created file ( _created by my web app_ ) then it seems Apache cannot access or run it. I have to run the `chmod` command **again**! Any suggestions on what I should do? I feel like 30% of my time is spent on redundant processes that shouldn't be done at all.


title: Lisp As A Langauge For A Beginner?

text: Should I learn Lisp as my first programming language? I have no prior experience but have heard great things about it from programming friends.


title: is it possible to sell a web site

text: There might be a situation where one of my clients won't pay for the web site that I've made. So I am wondering if it is possible to sell a web site? It is an internet shop, so there is no content that comes with it, but the source code is fully available, and it has a decent design. I've seen people trying to sell web site templates, and I've seen people who try to sell already running web sites, and there are plenty of commercial web site engines out there. But what about raw empty web sites, is there a market for them?


title: Is IPv6 support a "nice to have" feature anymore?

text: I work on an app that does a lot of network communication. I know that IPv4 addresses are being exhausted. At the same time, none of our customers are asking for IPv6 yet. We are examining which new features to add to the next release, so I ask: is IPv6 support a "must have" or a "nice to have" feature at this point?


title: Where should a programmer explain the extended logic behind the code?

text: I have developed a few quantitative libraries in C# where it is important to understand not only the classic information that goes with the XMLDoc comments (which contains basic information with the method signature) but also the mathematical formulas being use within the methods. Hence I would like to be able to include extended documentation with the code, which could contain, for example Latex formulas, graphs, and so on. Do you think such information should be included in the API documentation? Or should it be included in a dev blog for examples? Are there common tools that are usually used for this kind of purposes?


title: Methodology for documenting existing code base

text: I work as part of a team on an existing application that has no inline documentation, nor does it have technical documentation. As I've been working on various bug reports on the application, I've written a sort of breadcrumb trail for myself - bug numbers in various places so that the next developer can refer to that bug number to see what was going on. My question is thus: What is the most efficient method for documenting this code? Should I document as I touch the area (the virus method, if you will), or should I document from each section on its own, and not follow paths that branch out into other areas of the application? Should I insert inline comments where none previously existed (with the fear that I may end up incorrectly identifying what the code does)? What method would you use to accurately and quickly document a rather large application that has no existing inline documentation, nor inline references to external documentation?


title: When do you start documenting the code?

text: Some friends and I recently started a medium-size project. We already covered the design part (at least the first attempt) and now we are moving into coding. We already have implemented some objects of the design, just to test if everything is going as expected (we are beginners, so we do not really trust our programming skills). The project is growing really fast but I do not really know when to start documenting the code. If I do it too soon the code will probably change, and so the documentation. Is there any "golden rule" for when to start documenting the code? Is there any time which is optimal to start? or it just does not matter? Thanks! **EDIT** : I changed "commenting" to "documenting" because I realized it is not the same. Sorry. * * * **ANSWER** Thank you all for your contributions. I'll try to post here the solution I got from reading all your answers. **When do you start commenting?**   * Comment the code as you write it because...     1. you wont come back later to comment     2. it will never be clearer in your mind   * Document the API. Create a design document separated from the original code and/or comment the header of your interfaces so:     1. It gets everyone in the same page     2. It helps everyone stay in the same page (no unwanted morphing)     3. It can evolve in the future into a more elaborated document I selected @Octávio answer as the right one because it hit an important fact: comment before it is too late. Thank you all again for your insightful answers!


title: How do I document my code?

text: I'm a hobbyist programmer (with no formal education) looking to start doing small freelance jobs. One of the things that hobbyist programmers can get away with that those with a "real" job can't is lack of documentation. After all, you wrote it so you know how it works. I feel a little silly asking because it seems like such a basic thing, but how do I document my code?   * How should it be formatted?   * How should it be presented? (HTML pages? LaTeX?)   * What does/doesn't need to be documented? ...And maybe more specifics I haven't thought of. I mostly program in PHP but also C#.


title: What does your Technical Documentation look like?

text: I'm working on a large project and I would like to put together some technical documentation for other members of the team and for new programmers joining the project. What sort of documentation should I have? Just `///` code comments or some other file(s) explaining the architecture and class design? I've never really done documentation except the occasional word doc to go with smaller apps, and I think this project is too large to doc in a single word file.


title: What are the best documentation patterns?

text: I've seen a lot of different ways to [or not to] comment out the code, specially patterns on desciptions of function details and file purposes. I'd like to know what is most used pattern to do that [I'm specially interested on documentation generators and their patterns]


title: When to write software project documentation on code

text: I usually write my software projects in java, and I am still a bit confused as to when to document my classes, interfaces and methods. There are two ways: **1)** Write documentation after declaring or coding a class/interface/method/constructor. This way I am sure documentation is handled immediately. **Disadvantage:** I might modify the arguments of a method/constructor or I might modify the functionality of the class or interface and forget to edit the documentation. **2)** Write documentation after finishing the project (or a major finish/version of the project), this way I am sure to document the full functionality/arguments of methods/constructors as well as documenting all exceptions thrown. **Disadvantage:** It usually becomes another great overwhelming task to go through hundreds of classes and methods at the end of the project, trying to write documentation code. As you can see both scenarios have their disadvantages but I think one is more advantageous than the other. I am puzzled as to which. Also I am not implying this to Java alone, it can be applied to any programming language that requires documentation.


title: How do you create documentation when there is none?

text: I have recently inherited a large, legacy system with a complex codebase that has a lack of documentation. I'm the sole internal developer embedded with the core users, taking some responsibility from an external contractor. While modules and functions are documented well enough, there is no documentation around the system itself. What it is, why it exists, how overall modules fit together. This is a web-application, and an example of this is how it produces a page. This requires executing PHP that makes a call to the database that retrieves some XSLT with custom extensions, that is transformed (this process may happen many times), it may retrieve PHP _from the database_ , however sometimes when retrieving PHP, it will retrieve a PHP stub, which indicates it actually needs to retrieve a PHP file from the file system. While individual chunks of this process are captured, there is no documentation that takes a systemic or macro view of the world. So I've come in, and have begun writing what I've been able to figure out from emails to the current consultant, what I've been able to figure out from the code, and just raw determination. Because of the importance of this system, the people I work with have its important that the system can be understood, so they are less reliant on a single person - be it me, the original developer or anyone. To be honest, I am happy with this, I'm secure in my own abilities, and if part of my task is to help mitigate the organisational risk if I was to disappear then thats fair. I also enjoy the task of unravelling a giant legacy system - its a giant puzzle. However, the challenge is this - I need to produce some solid documentation around how the system works, both for me and whoever follows. While I have started to get a clear understanding, what I would like to know is **what are the kinds of things a new developer would need to see to make sence of a legacy system that was new to them?** Similarly, knowing what needs to be written **how would you tackle diving in, dissecting and documenting a large legacy codebase?**


title: What justifies the use of an IDE versus a standard editor?

text: I find myself using my text editor of choice (vim, nano, gedit, pick your poison) much more often than any IDE as of late. After noticing my ide shortcuts getting dusty I started to think about this and wonder: **what justifies use of an IDE for you opposed to a text editor**? For that matter what rationale would you have for **not** using an IDE and merely relying on an editor?


title: Time to drop Emacs and vi?

text: Every time you are looking for a text editor, no matter what language you are using, vi and Emacs are hall-of-famers. However they are ancient, and we have better alternatives (at least I hope we do). Why are developers stuck on these two editors? Shouldn't we drop them and try to invent or look for something new? _(I have full respect for Emacs and vi fans)._


title: Why do people use terminal text editors?

text: Are there any inherent advantages to a terminal text editor over a gui version of the same editor (vim and gvim for example) or are the people using terminal text editors just using them because that's what they're used to? I am not asking about vim in particular. I am asking whether, all else being equal, a terminal text editor has advantages over a gui text editor.


title: Must a programmer learn text editors like Emacs and Vim? How important are they?

text: I have been writing code so far in conventional text editors that come with the OS so far or use an IDE in some cases. I know there are some advanced text editors like `Emacs` and `Vim` available solely for the purpose of coders. How important are they really? Should a programmer dealing with `PHP`, `Python` etc. learn these editors? What are the advantages that they provide over conventional editors like `Notepad++`, `Scribes` etc.?


title: Why would you use vi/vim

text: I often see people express a preference for vi or vim for text editing or even for programming. I've tried it and I can't see how it could possibly be any faster or easier. If you use one of them, why?


title: How to start a development project when there are too many potential stakeholders

text: I've just taken on a new job at a college as (the sole) Web application developer. The college has a number of disparate but all pretty badly coded legacy systems. Mostly built in PHP they deal with things like attendance, exam results, marking etc. My first job is to build a system that incorporates a lot of this data, which is currently resting in various databases without any kind of friendly API to pull it out (the existing systems are coded in vanilla PHP with no separation of data and view) with a new platform for recording pastoral information about students and presents it to tutors and senior staff in a useful manner so they can react to issues with students quickly. In our first meeting, there were 18 people! There was no clear leader or voice that represented the majority. No identifiable _client_. The meeting swung from detailed implementation ideas on minor features from heads of faculty to arguments about whether we should use Excel spreadsheets or not for data input! As you can imagine my head was spinning at the end. I actually had a lot of good ideas but I couldn't get them heard. This is a very new role for me, before I was part of a development team in a marketing agency. We had very well defined roles: Project Manager, Client, Designer, Developer. I'd like to know if any seasoned developers or managers out their can give me some pointers on how I can whip my colleagues up into something that resembles a project team. Is agile the way to go? How would you approach handling all the disparate voices? It's clear that some process needs to be put in place very quickly, I'm just not sure what that is.


title: C++ for C# Developers

text: I know C# pretty well (self-taught, sadly) and need to do some C++ programming for a Windows application. I have been able to find a ton of information for C++ developers learning C# but haven't been able to find much on learning C++ when you already know C#. Has anyone come across a good rundown of the basics? MSDN has a comparison but it is not very in-depth. I can piece together several sources but figured something was out there - I just can't find it. Thanks for your help.


title: Good resources for learning about recursion

text: > **Possible Duplicate:**   >  Resources for improving your comprehension of recursion? I am a programmer with 2 years experience, and sometimes think I could solve a specific problem with recursion, but in most cases I fail miserably. I am asking your advice about resources for learning, refreshing and deepening one's knowledge about recursion, preferably:   * helping to identify when you could use recursion.   * practical examples (applied to contemporary programming languages).   * a reference handbook.   * source code.


title: Should a new class refactored out of an existing one have history pointing back to it's progenitor

text: If I split one class into two classes should both classes have history in source control tracing back to the original class that contained both; or should the new class be added as a new file without any history tracing back? When splitting a large class into two similar sized parts this seems like the natural approach since the older versions of the combined class will have large amounts of relevant history for both descendents. When I'm just pulling one or two methods out to create a helper class, having the complete history for the new class be >90% changes in the parent that affected code that wasn't split out seems like a recipe for confusion in the future.


title: Checking if my app is using any undocumented parts of the API

text: I just read through this question, but I am still confused. How can I know if my app is using undocumented API calls before submitting to it to the app store? Are there any tools I can use?


title: Decreasing vars in Scala programs

text: I have been studying scala for the past week or so and the ideologies associated with it and functional programming in general. As expected, the leap from imperative to functional programming is not as easy as I had hoped. For example, I converted a programming exercise that I did in Java into Scala. What I found was that it was near impossible for me to switch from mutable variables into the Scala style of immutable vals. For the TL;DR people, my main question is, how does one decrease the var usage in a functional program? For the sake of a use case, I'll provide some sample code:               import scala.io._     object Bowling {       def main(args: Array[String]): Unit = {         val input = Source.fromFile("bowling.in").getLines         for(testCase <- input) {           val numberOfRows = augmentString(testCase).toInt           var index = 0           var a = 1           var sum = 0           while(index < numberOfRows) {             sum += a             a += 4             index += 1           }           println(sum)         }       }     }      EDIT: I'm accepting Karl's answer because of its conciseness though I do really appreciate Ptharien's code example and Doval's explanation of functional concepts as a whole.


title: I can't remember programming 5 mins after learning?

text: I'm learning Java, and I found a great teacher. He explains everything perfectly. I understand it _all_. My problem, is that after learning a short section, for example "Nested If Statements" or "Many Methods and Instances", I can type it all great, but in 5 mins, after going on to a new section (when I'm comfortable with the last section) I forget the code to type for the last section. Any tips or techniques you guys use to remember code????


title: How do you keep cool when production system goes down?

text: This has happened to most of us... You come to work one day. Everything seems normal - the sun is shining, birds are chirping, but you notice a couple of weird things on your way to work that remind you of the déjà vu cat in the Matrix. You get into the office and there are a lot of phones ringing - but it could just be that they are doing a new sales promotion. You settle in, when you notice a dark cloud hovering over you. It takes you a couple of moments, but you recognize the cloud is your boss. Usually he checks on you every morning with his "Soooo Peeeeter, how about those TCP/IP reports?" routine, but today he forgot everything about common manners and rudely invaded your personal space. No "Good Morning", just some drooling, grunts and curses. He reminds you a bit of a neanderthal who is trying to get away from a cyber -toothed tiger, fear and panic all compressed in a tight ball. You try to decipher the new language that he created since yesterday and you start understanding that something bad happened overnight - the production system went down. Now, your system is usually used by clients during regular working hours from 9-5, but for whatever reason you didn't get any alerts on your beeper (for people under 30 - a beeper was like a mobile phone that could only ring and tell you who beeped you). You'll need to remember to charge it next time. So it is now 8:45am, and the system MUST be up at 9am. Every 10 seconds, your boss lets out yet another curse which communicates to you that another customer is having problems getting into the system. Also, several account managers are now hovering over your boss trying to make him understand how clients are REALLY REALLY suffering. Everyone is depending on you to get the system up ASAP and at the same time is hindering your progress by constantly distracting you. How do you keep cool in a situation like this?


title: Coding guidelines for seamless merging

text: I am looking for coding guidelines developers should follow while writing C#/ASPX/SQL code, so that merging into other branches is smooth if not seamless.


title: Should every programmer keep a "Lessons Learned" journal?

text: Every time I've finished a project, there is always something that I've learned (otherwise I don't find it very motivating). But I can't remember everything, and much later I may stumble across the same problem that I encountered in a previous project but no longer how I solved it (or at least what attempts I made). So would it be a good idea to write this down in a journal of some sort? I know that writing stuff down feels like writing documentation (which not everyone enjoys doing), and hope our memory to serve us when needed. But having it documented, it could be shared with other programmers and learn what lessons they learned. So, what do you think?


title: What to do when opensource project starts to tear apart? (or a manager tries to write code and then shouts at the team)

text: I'm working on an open source cross-platform client/server app. It is fairly complex and it's taken months for a group of developers to get it where it is now. At one point the team lead decided to implement a feature on his own. He had some development experience, but not a lot. He failed and the other developers finished the job for him. Since then his attitude got a lot more negative. He's trying to tell developers that their work is of poor quality and that all work should first be discussed with him. The current setup is that all team members are marked as "project owners" and thus have equal rights in the project. The team leader is now offering the developers the choice between always talking to him first or being demoted from project owners to contributors. So what are our options as developers? What arguments we can provide to the team leader to calm him down? Is it possible to save the project or is it better to fork out now? An important issue is that lately we had no active ticket system, and I personally think that this was the reason the mess appeared. So... any ideas?


title: Is it good idea to require to commit only working code?

text: Sometimes I hear people saying something like "All committed code must be working". In some articles people even write descriptions how to create svn or git hooks that compile and test code before commit. In my company we usually create one branch for a feature, and one programmer usually works in this branch. I often (1 per 100, I think and as I think with good reason) do non-compilable commits. It seems to me that requirement of "always compilable/stable" commits conflicts with the idea of frequent commits. A programmer would rather make one commit in a week than test the whole project's stability/compilability ten times a day. For only compilable code I use tags and some selected branches (trunk etc). I see these reasons to commit not fully working or not compilable code:   1. If I develop a new feature, it is hard to make it work writing a few lines of code.   2. If I am editing a feature, it is again sometimes hard to keep code working every time.   3. If I am changing some function's prototype or interface, I would also make hundreds of changes, not mechanical changes, but intellectual. Sometimes one of them could cause me to carry out hundreds of commits (but if I want all commits to be stable I should commit 1 time instead of 100). In all these cases to make stable commits I would make commits containing many-many-many changes and it will be very-very-very hard to find out "What happened in this commit?". Another aspect of this problem is that compiling code gives no guarantee of proper working. So is it good idea to require every commit to be stable/compilable? Does it depends on branching model or CVS? In your company, is it forbidden to make non compilable commits? Is it (and why) a bad idea to use only selected branches (including trunk) and tags for stable versions?


title: Why does the code auditing tools like FindBugs require a compile step to work properly?

text: Basically I ran Intellij Idea 's plug in called FindBugs-Idea to analyze my code . I corrected whatever errror was caught and then ran the tool again but it was still complaining about the same error even though it was fixed in the source file . It only stopped complaining after I recompiled my classses . Why does it require a compilation step ? Shouldn't it basically look in the source file and detect a possible bug ? How do these tools work in general ?


title: What's the name of this pattern involving multiple inputs and what to do based on an input?

text: If I've got code similar to this (although perhaps not as constrained as warning levels):               switch(item.StatusCode)     {         case StatusCode.SUCCESS:             CallSuccess(item);             break;         case StatusCode.WARNING:             CallWarning(item);             break;         case StatusCode.ERROR:             CallError(item);             break;     }      I often find myself converting it to something more like:               var behaviors = new Dictionary<StatusCode, Action<Item>>     {         {StatusCode.SUCCESS, (item) => CallSuccess(item)},         {StatusCode.WARNING, (item) => CallWarning(item)},         {StatusCode.ERROR,   (item) => CallError(item)},     }          behaviors[item.StatusCode](item);      I find that in a lot of cases this makes for more maintainable code. Is this a pattern, does it actually help like I think it does, and what's its name?


title: What does 'stage' mean in git?

text: I find git hard to understand as I could not find the meaning of the words used for the actions. I have checked the dictionary for the meaning of 'stage' and none of the meanings were related to source control concepts. What does 'stage' mean in the context of git?


title: Differential and integral calculus for programmer

text: > **Possible Duplicate:**   >  Where is the application of Calculus(of continuous quantities) in Computer > Science or programming   >  How can calculus and linear algebra be useful to a system programmer? Differential and integral calculus is part of my degree but I don't understand why. Where does it come in play, where is it used?


title: Where is the application of Calculus (of continuous quantities) in Computer Science or programming

text: I am a Software Engineer professional. I have studied calculus as a core course in my graduation studies. I want to ask question, that what/where is the implementation of calculus in computer science?


title: mysql fulltext search table design

text: I have been working on a Mysql db design which keyword based search seems to be necessary. Main table has two columns:               id | Title      For each entry, users will be required to enter 4 or 5 keywords. I think using a seperate table for keywords would be better. I would like to learn if there is any difference between these two designs in terms of performance, scalability and management. There will be millions of rows in the main table.               id | keywords     1  | 1kword1, 1kword2, 1kword3     2  | 2kword1, 2kword2, 2kword3      Or               id | keyword     1  | 1kword1      2  | 1kword2      3  | 1kword3     4  | 2kword1      5  | 2kword2      6  | 2kword3


title: Where can I get feedback and support from other programmers in real time?

text: I used to work in an office surrounded by a large team of programmers where we all used the same languages and had different expertises. Now that I am on my own forming a startup at home, my productivity is suffering because I miss having people I can talk to for specific help, inspiration and reality checks when working on a coding problem. I don't have access to business incubators or shared (co-working) office spaces for startups so I need to chat with people virtually. Where can I go for real-time chat with other programmers and developers (currently I'm looking for people developing for the web, javascript and python) for live debugging and problem-solving of the tasks I am working on? And what other resources can I use to get fellow programmer support?


Flow is a concept introduced by Mihaly Csikszentmihalyi; in short, it means to get into the "zone". You feel immersed in your task, focused; the task can be difficult but challenging at the same time. When people achieve flow their productivity shoots up. Programming requires a great deal of mental focus because we often need to juggle several things in our minds at once. Many like to work in a quiet environment where they can direct their full attention to the task. If they are interrupted, it may take several minutes or even hours to get back into flow. I understand there's a practice in agile development and extreme programming called pair programming. It means you put the whole software development team in one room so that communication is seamless. You do write code with your pair because this way you get instant code reviews and fewer bugs get through. I've always had problems achieving flow while doing pair programming because of constant interruptions. I'm thinking deep about an issue then all of sudden someone asks me a question from another pair. My train of thought is lost. How can you achieve and maintain flow while pair programming?


title: MVC/P in Desktop Application

text: I am developping a desktop application in C#, and have separated different layers in an MVC-ish architecture. As I have switched from GTK# to XWT, only views had to be adjusted, so the seperation of layers was done quite OK. As XWT does not have a layout designer, everything has to be set up in code, which in turn led to an architectural problem: I have one controller for displaying outlets, inlets and connections. This controller sends data to one view (outlined in red). This view in turn has subviews (green and blue), that only communicate with the view in red. ![Layout of view](http://i.stack.imgur.com/sQ2RT.png) On scrolling / collapsing / expanding the treeviews, the green view send events, which are received by the red view, which in turn trigger redrawing in the blue view. Controller does not see the green or blue views, every change in connections / outlets / inlets are only sent to the red view. My problem: As I understand MVC, views should not have much logic. But the green views is a class of 300 lines, the red view's class has 200 lines, which is too many. What architectural problem can arise from this? Am I overlooking a fault in my MVC logic?


title: How to increase the bus factor and specialize at the same time?

text: In agile pair programming it is recommended to switch pairs every now and then so as to increase the bus factor of the team. That means, most people in the team should work on different parts of the system at different times so that everyone has an understanding of it. Now it is impssible that everyone has an expert level of understanding of each part of the system. That's because people are urged to specialize in one area of expertise. If you are an expert database admin, what's the point of working on the user interface of the system when you switch pairs? You will not be able to do such a high quality job as someone who has extensive experience in UI design. How can you increase the bus factor and make sure that you have specialization in your team?


title: Does using GCC specific builtins qualify as incorporation within a project?

text: I understand that linking to a program licensed under the GPL requires that you release the source of your program under the GPL as well, while the LGPL does not require this. The terminology of the (L)GPL is very clear about this.               #include "gpl_program.h"      means you'd have to license GPL, because you're linking to GPL licensed code. And               #include "lgpl_program.h"      means you're free to license however you want, so that it doesn't explicitly prohibit linking to LGPL source. Now, my question about what isn't clear is: [begin question] **GCC is GPL licensed, compiling with GCC, does not constitute "integration" into your program, as the GPL puts it; does using builtin functions (which are specific to GCC) constitute "incorporation" even though you haven't explicitly linked to this GPL licensed code? My intuition tells me that this isn't the intention, but legality isn't always intuitive. I'm not actually worried, but I'm curious if this could be considered the case.** [end question] [begin aside] The reason for my equivocation is that GCC builtins like `__builtin_clzl()` or `__builtin_expect()` are an API _technically_ and _could_ be implemented in another way. For example, many builtins were replicated by LLVM and the argument could be made that it's not implementation specific to GCC. However, many builtins have no parallel and when compiled will link GPL licensed code in GCC and will not compile on other compilers. If you make the argument here that the API _could_ be replicated by another compiler, couldn't you make that identical claim about any program you link to, so long as you don't distribute that source? I understand that I'm being a legal snake about this, but it strikes me as odd that the GPL isn't more specific. I don't see this as a reasonable ploy for proprietary software creators to bypass the GPL, as they'd have to bundle the GPL software to make it work, removing their plausible deniability. However, isn't it possible that if builtins don't constitute linking, then open source proponents who oppose the GPL could simply write a BSD/MIT/Apache/Apple licensed product that links to a GPL'd program and claim that they intend to write a non-GPL interface that is identical to the GPL one, preserving their BSD license until it's actually compiled? [end aside] Sorry for the aside, I didn't think many people would follow why I care about this if I'm not facing any legal trouble or implications. Don't worry too much about the hypotheticals there, I'm just extrapolating what either answer to my actual question could imply.


title: Testing Framework Selection: xUnit family theory

text: **Background:**   I am familiar with xUnit family frameworks and have had experience with (shunit2, PhpUnit and simpletest). I am currently trying to find a testing framework for C++. I did a quick search for frameworks using Wikipedia's list of documented frameworks; however, the framework I would like to use is very difficult to setup and is poorly documented. There is another framework that I have tried that was (IMHO) extremely easy to setup and integrate into my production workflow. The difference between my framework of choice (the one that is difficult to setup) and the one that I'm currently using (the one that was easy to setup) is compliance with xUnit methodology. **Questions:**   1\. I have read quite a few articles about xUnit testing frameworks. I believe that they use similar naming conventions and testing methods for their test. Is this true and what are the naming methods utilized?   2\. Does staying with xUnit testing frameworks make it easier to run integration tests when using multiple languages?   3\. From a training perspective is it more cost effective to teach new programmers a set of tools based on the same concept or different individual tools that do the same thing? _I kept the frameworks that I am looking at anonymous because I am more interested in industry best practices than a comparison of the two said frameworks_


title: EPL-Licensed Library with Closed-Source Commercial Product

text: The Eclipse Public License is not entirely clear for me. As I understand it, anyone who redistributes a Library whose code is licensed under the EPL is considered to be a Contributor. It then states that you are not required to redistribute source-code but you must make mention of where to obtain it. Other websites have said you do not need to release the source code of your project unless you specifically modify parts of the EPL-licensed program, but from reading the license, it seems to indicate otherwise. If I would like to use Library X in my Java program where I link the library to my project via the Build Path and then redistribute Library X with my program, am I required to allow the obtaining of the source code or not, "Ask A Lawyer" advice aside.


title: Splitting code from form operations in C#

text: I have a large (at least for me - approximately 10k lines) project that is written in C#. I have a treeview object on the left of my form and i have many nodes on my treeview. When i click a node, i bring up a panel on the right side of form. Since i only do GUI item operations (filling textboxes, clicking buttons, showing images on pictureboxes etc.), i write all of my code into MainForm class. This seems not very good but on the other side, i think i have to write into MainForm class because all of my job is to evaluate form items on panels. What should i do to write a more portable or understandable code? Do i have to write into MainForm class or do i have some options or methods to implement?


title: Where to position logging statements

text: I have the following classes :               class Task     {         public void DoSomething()         {              var s = new Service();             s.First();             s.Second();             s.Third();         }     }          class Service     {         public void First() {};         public void Second() {};         public void Third() {};     }      If I want to add logging, should I put logging statements like this :                   public void DoSomething()         {              Log("new");             var s = new Service();                  Log("First");             s.First();                  Log("Second");             s.Second();                  Log("Third");             s.Third();         }      Or should I put each statement inside the called methods of Service class ? I know it is quite subjective, and won't change a lot of things, but I'm curious about the pros and cons of each approach. Update : I'm not asking about verbosity or level, just about placement of the logging statements.


title: Hourly rate benefits for the customer

text: It is good for a developer to work on a per-hour basis, but it's hard to explain the advantages of hourly rate to the customer. What are your arguments on the hourly rate for the customer? How do you explain him his benefits and how do you argue on "I want to know the exact cost of the project"?


title: Pros and cons of custom exceptions

text: This may be an pointless question based on opinion, style, and context but I've been racking my brain trying to decide whether or not to make use of custom exceptions and would love to hear some pros and cons from anyone with experience from both approaches. For example I'm trying to decide between a custom ObjectNotFoundException vs IllegalArgumentException/IllegalStateException. (Please note that I am not intending to throw an exception whenever a service cannot find an object with a given identifier. We simply return a null in that case. I'm speaking of when an action is to be performed on an object with a given identifier. In this case, the object in question is expected to exist, so if it does not, we want to throw an exception.) On one hand, a "GiraffeNotFoundException" is explicit and could be handled differently than a generic IllegalStateException, but then again I suppose that would only matter if such a differentiation is actually required. Another pro is that a custom message for such an exception can be set as the default message for this exception (reducing a bit of redundancy). On the other hand, it might not be a good idea to clutter the source code with custom exceptions. Also with standard exceptions, the Assert class from spring can be used quite efficiently. There are no intentions of publishing our code as a third party library so there are no pressures for using standard exceptions from that end. Any other thoughts?


title: What are possible/useful implementations when extending exceptions?

text: I have seen a lot of exceptions - custom or integrated in the language (PHP) itself that have no differences but their class name. When extending default exceptions to use within your own code, are there any other things you could implement that are useful besides the more specific exception name that do not violate things like single responsibility?


title: GoF Design Patterns - which ones do you actually use?

text: I'm trying to educate my colleagues in the area of design patterns. Some of the original Gang of Four patterns are a little esoteric, so I'm wondering if there is a sub-group of "essential" patterns that all programmers should know. As I look through the list, I think I've probably used -   * Abstract Factory    * Factory Method   * Singleton    * Bridge    * Facade    * Command Which ones do you actually use in practice, and what do you use them for? Link for those wanting a list of patterns


title: Why isn't reflection on the SCJP / OCJP?

text: I read through Kathy Sierra's SCJP study guide and I will read it again more throughly to improve myself as a Java programmer and be able to take the certification either Java 6 or wait for the Java 7 exam (I'm already employed as Java developer so I'm in no hurry to take the exam.) Now I wonder why reflection is not on the exam? The book it seems covers everything that should be on the exam and AFAIK reflection is at least as important as threads if not more used inpractice since many frameworks use reflection. Do you know why reflection is not part of the SCJP? Do you agree that it's at least important to know reflection as threads? Thanks for any answer


title: Do input template languages exist?

text: When I have to create some textual representation of data, I can use a template language, so that my code does not have to worry about the structure of the output file - I can sometimes even write code that's independent of whether the output is XML, LaTeX or any other plain text. A simple example: Template (in separate file):               <someXmlTag>     $variableName     </someXmlTag>      Code:               Template(temstring).substitute(variableName="value")      Result (written to output file):               <someXmlTag>     value     </someXmlTag>      I want to do the same, but in the opposite direction. I have XML or plain text or whatever files to input. I want to describe the input structure in a separate file that looks like the input but has these variable declarations in it, and I want to handle it with code that's independent of the structure. **Has this been done before? What approach was used and how did it work out?** (We usually handle XML input by using an XML parser library to describe the input structure in program code, handle plaintext input by writing regexes in code, and don't handle LaTeX input because LaTeX can't really be parsed.)


title: What are some precedents on how substantial a snippet must be to be copyrightable?

text: I occasionally worry that when I borrow snippets of code from websites, etc. there's at least the theoretical possibility that this will be copyright infringement. However, small pieces of code to accomplish common tasks may be too unoriginal for copyright and in practice this kind of sharing happens all the time. What are some **rules of thumb** , ideally supported by legal precedent, as to how substantial and original a piece of code must be to be copyrightable? P.S. I **know** there are no hard and fast rules on this and that a definitive answer to a specific case requires a lawyer. However, since I'm only looking for rules of thumb here, answers to this effect will be downvoted.


title: ETL Software Research Question

text: Where I work, we use an in-house ETL solution that's homegrown and has been around for 5-10 years. I'm still new to my data analysis job, but I was wondering about the ETL tools that are out there. This is a new area for me. My situation, and job, is basically   * digging in a set of databases (DB2, SQL2005, Citrix, Ancient Cobol Database with a SQL Wrapper on top, MySQL, etc).   * Gather the desired information.   * combine the different datasets into one set.    * output into a file of choice (CSV, Tab Separated, Pipe Separated, XLS, etc).   * FTP to customer. I guess what my real question is, given my job, what are some good ETL suites that I can look at and compare to my in-house tools? This is more to research some other options. Ultimately, I'd either suggest a new solution or get options/ideas to improve our current app.


Should you sacrifice code readability with how efficient code is? e.g. 3 lines of code into 1 line. I read in _Code Craft_ by Pete Goodliffe that readability is key. Your thoughts?


title: Database Change Auditing - Part of or Abstracted from ORM / Application Layer?

text: My fellow developers and I are at a crossroads in how to go about continuing our auditing of database changes. Most of our applications log changes via `INSERT`, `UPDATE`, and `DELETE` triggers. A few of our newer applications audit at the ORM layer; specifically using Hibernate Envers. While ORM layer auditing provides a much cleaner interface and is much more maintainable, it will not capture any manual database changes that are made. ORM layer auditing also means that our libraries will currently require a dependency on our ORM implementation unless, specifically in our case for example, JPA plans on providing something in the near future. Is there a common paradigm that addresses this?


title: What is REST (in simple English)

text: Lately I have become interested in familiarizing myself with REST. I tried reading wiki entry on REST, but it was of no help. I would really appreciate it if someone can explain in simple English (that is without **unnecessary** tech jargon)   1. What is REST   2. What position it occupies in web architecture ecosystem   3. How tightly (or loosely) it is coupled with protocol.   4. What are the alternatives to REST and how does REST compare with them. I understand it may not be possible to answer this in one or two paragraphs, in that case relevant links will be highly appreciated.


title: How could the first C++ compiler be written in C++?

text: Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ). However, how is it even possible that the first C++ compiler be written in C++? The code that makes up the compiler needs to be compiled too, and thus the first C++ compiler couldn't have been written in C++, could it?


title: How can CoffeeScript be written in CoffeeScript?

text: How is it possible that written a programming language like CoffeeScript in itself like CoffeeScript? Firstly CoffeeScript doesn't exist that read CoffeeScript scripts and interpret them?


title: C is written in C, how is this possible?

text: > **Possible Duplicate:**   >  How could the first C++ compiler be written in C++? I know my question goes to the underground galaxy cave where languages are born and involves some lambda math and light-years of google-studying. But what kind of knowledge is necessary to create a language?


title: What should my "large codebase sample" look like?

text: If an employer asks for a large code sample, one for an entire project, what characteristics should the project have to show architectural skills and the ability to manage a large codebase? For example, should I show off managing modules/dependencies? writing test/build scripts? design patterns? etc.


title: What licensing implications (if any) are there when porting code from one language to another?

text: I'm considering taking an old PHP4 web application and re-writing it using ASP.Net MVC4 in C#. The old application was licensed under GPL2. I'm unsure how this affects my new application, if at all. I obviously can't directly copy any of the code from the old PHP application to my .Net application as the two languages are totally different. Equally, the old application wasn't even OO in nature, nor did it follow any kind of design pattern (i.e. MVC). In essence, my new application will only be taking the "ideas & features" of the original application. Even the database schema will be significantly different. Would I still have to GPL my new application or is it considered a new work where I choose a license myself?


title: Porting an LGPLv3 library to a different language under Apache v2 License

text: Is it legal / ethical to port a library that is written in C under LGPLv3 to (pure) Go under the Apache v2 license? Keep in mind the port will be 100% compatible with full attribution to the original author and it will be a complete rewrite being a different language and all.


title: Difference between Pattern and Principle

text: What is the difference between Object Oriented Design Patterns and Principles? Are they different things? As far as I understood both of them try to achieve some common goal (e,g. flexibility). So can I say a pattern is a principle and vice versa? Design Principle = SOLID (i.e. Dependency Inversion Principle) Design Pattern = Gof (i.e. Abstract Factory Pattern)


title: Is a client side developer usually expected to do design work also, or know designing and CSS as well?

text: If I'm applying for a client side developer job, am I usually expected to know designing as well? Such as CSS? I have knowledge of JavaScript, JQuery, Ajax and HTML5 basics, and HTML DOM. Is this enough or should I also be able to style nicely in CSS? I have a basic knowledge of CSS, but I certainly can't style anything at all. And I really dislike CSS or styling tasks


title: XML vs SQL for small projects?

text: I'm working on a small project which will only have one user at a time since it's a local application (developed in WPF and C#). To store data I was thinking of using an XML file but I'm wondering if this would be the best approach. What the data is for:   * Shedules   * Library of files in folders (with Artist name, Title, Location on HDD)   * Possibly statistics based on the shedule data   * ... Information regarding the library would be fine in XML I imagine but about all the rest I'm not so sure. Also LINQ to SQL seems to be alot more profitable in terms of development speed than LINQ to XML. Is this correct or am I wrong? I was unsure if I should post this on SO or here but it seemed more appropriate here! Thank you in advance


title: How to create different paths for users to take through the pages in my site?

text: I have a website where users are directed to go through a sequence of pages to perform a sequence of work tasks (transcribe a paragraph, answer a survey, interact with another user, etc). For short, let's call these tasks A, B, C, etc. I'm using Django, and each task is currently implemented as a view function (or method), e.g. `def A(request)`. Currently, each view function has the next step hardcoded in an HTTP redirect, e.g. `HttpResponseRedirect(reverse(B))`. My challenge is that I will soon have a requirement to create various permutations of the sequence of tasks. Sometimes I will want users to do A, B, C; for others, B, C, D; for others, A, B, D, F. How can I architect this so that I can define these permutations elegantly and concisely in my code? Intuitively, I feel like I need to genericize the HTTP redirect calls with a variable, like: `HttpResponseRedirect(reverse(next_view_function))`, but I struggle to figure out where `next_view_function` should be defined, and how the definition of the sequence (e.g. A, B, D) should be persisted across requests. Can anyone lead me down the right path with a suggestion or idea? I'm happy to provide more details. **Edit** in response to Bart's questions:   * The order of tasks is predetermined. Once we have defined it, we send the users a URL that takes them to the first page. They should then be routed through the tasks. One group of users might get a URL that takes them through steps A,B,C, while another group of users gets a URL that takes them through steps A,B,D. We decide in advance which users should get which URL.   * Since the order is predetermined, the next step does not depend on the results of the current task. The only requirement is for them to complete the task (we of course validate the POST data they submit as a precondition to the HTTP redirect). **Edit 2** , my solution so far: A central concept in my code architecture is that of a "Treatment" (defined in my models.py). A Treatment is a specification of the experience a user has when they use my site, such as what UI is presented to them. I split my users into groups and assign each group to a different treatment by emailing them a URL that contains the PK of their treatment. (There are also different subclasses of Treatment, since some Treatments are totally different from others. SoccerTreatment and HockeyTreatment have little in common, so it makes sense to subclass them.) So, the class definition for a Treatment seems like the sensible place to store the sequence of views as a Python list, as follows:               # in soccer/models.py     class SoccerTreatment(BaseTreatment):              world_cup = models.BooleanField()         ....              def views(self, request):             seq = [soccer.views.ViewClassA]             if self.world_cup:                 seq.append(soccer.views.ViewClassWorldCup)                  return seq          # in shared/models.py     class BaseTreatment(models.Model):             def next_view(self, request):             seq = self.views() # views() method implemented by descendant classes             if request.session.get('current_view_index'):                 request.session['current_view_index'] += 1             else:                 request.session['current_view_index'] = 0             # [handle boundary cases, code snipped...]             # ...             return seq[request.session['current_view_index']]                   # ...          # in views.py, at the end of a view function     # ...     HttpResponseRedirect(reverse(user.treatment.next_view()))      However, the design above wouldn't work, since then models.py would have to import views.py, creating a circular import. So the list elements would have to be strings (either URLs, or a the name of the view class as a string), which could be brittle since renaming my classes or URLs won't automatically rename these strings. Maybe I am being too picky, but I wonder if there is a better design.


title: Chain class behaviour

text: I have a Bird class. A bird can learn and a bird can fly (methods). A bird can only fly after it learns. Considering both methods are public. How can you make this clear to another fellow developer. Usually they should take a look at the public method names and understand what they do. But how can he understand without reading comments or understand the encapsulated code that method2 can be called only after method1?


title: 25 years old and considering a career change...possible? practical?

text: I'm new to this site and new to programming as well. I've spent some time going through an intro cs book that uses python as the language of choice. I find the exercises interesting and engaging and I generally have had a favorable experience programming so far. I've gone through some of the basics with python like writing simple programs, basics of GUIs, manipulating strings, lists, defining functions, etc. And I've always loved technology. Although I've never done any real hardcore programming yet, I was inclined to building websites from a very young age but I never really developed my skills. Now, the thing is I'm 25, I have my bacholors in environmental studies and two masters degrees in urban planning and landscape architecture respectively. I know, it would be quite a departure to pursue a career in programming at this point. Currently, I'm working as a geographic information systems intern. I've taken some GIS classes and have a lot of experience with making maps, doing spatial analysis etc. So what I'm thinking is maybe I can learn some solid programming skills and apply these skills in the field of GIS. From what I've seen, .net languages are the norm in this arena. Could you perhaps provide some guidance to me in terms of what languages I should focus on or courses I should take at this point? What about for building web mapping applications? Also, I was thinking about getting a certificate in programming from a university extension program. Do you think it would be worth it? And furthermore, do you think potential employers would be interested in hiring someone like me (once I get a couple of languages down pretty well) as an intern or in an entry level position? I'll be living in the bay area so I feel that there should be decent opportunities even though I don't have a b.s. in cs.


title: Jargon to describe unnecessary running of code?

text: Some code works but it runs an unnecessarily large fraction of the code in many cases, though that extra code is still required sometimes. Better preprocessing, simple stoppers and conditional checkers would save enormous amount of running time. What is the technical jargon to describe unnecessary running where a programmer could simply place a condition or do better preprocessing?


title: Is it better to find issues myself or let the computer figure it out?

text: I'm about to start the process of migrating a program from one component to another. Most of the core functionality will be the same but I'll need to change database calls, etc. I'm sure there will be a few quirks somewhere. Naturally, there will be many errrrrrors, some of which Ill miss completely. Would it be better to completely scrutinize the code, checking for errors line by line, or to just write the code and see what errors occur?


title: How do I draft user stories as a developer?

text: I am writing a system where both the system owner and myself are developers, and we are currently the only source of 'requests' or requirements for the system, which I would like to capture in user stories tied to features{1}. My urgent priority now is to get a managaeble backlog captured. How should I go about capturing the level of technical spec I am used to to working with in users stories, which aren't supposed to be too technical. {1} I am evaluating agile project management service TargetProcess, and each user story must be tied to a parent feature. The system seems a good fit, so this small constraint is something I would rather work with than work around.


title: What makes a project big?

text: Just out of curiosity what's the difference between a small, medium and large size project? Is it measured by lines of code or complexity or what? Im building a bartering system and so far have about 1000 lines of code for login/registration. Even though there's lots of LOC i wouldnt consider it a big project because its not that complex though this is my first project so im not sure. How is it measured?


title: Do you spend your working hours on learning?

text: Do you spend your working hours learning new stuff, reading tech blogs, books on programming etc.? What's your opinion on it? Can an employer have benefits allowing developers to spend about 1-1.5 hrs a day on learning. Will it be repaid in future (with better productivity etc.)?


title: Most logically consistent way to create methods of the form a affects b?

text: I have a common scenario where I have an object (a) that logically affects another object (b), like a makes a note on b, or a marks b as disabled (usually a is a user object of the system and b is some kind of business object like a customer or an appointment). In the past, the method was on the affected object like:               customer.Disable(user); // user is marking the customer as disabled      ... but it doesn't read well (it appears backwards). The opposite:               user.Disable(customer);      ... reads better, but there's something about it that I can't put my finger on that just doesn't seem right. The only other option is to have a static intermediary:               ThirdPartyClass.DisableCustomer(customer, user);      ... but the domain objects end up becoming more like DTOs and I prefer the domain model approach because it makes more sense. So the question is: which makes the most sense? Is there an option I haven't considered? Who actually owns an operation like this? **Edit** With the second option, the actionable objects in the system (users usually) end up becoming huge because the users of the system are the ones that pretty much do and affect everything.


title: Language Niches and Niche Libraries

text: "Everyone Knows" ...   * ... that c is widely used for low level programs in large part because operating system/device apis are usually in c.   * ... that Java is widely used for enterprise applications in large part because of enterprise libraries and ide support.   * ... that ruby is widely used for webapps thanks in large part because of rails and its library ecosytem  But lets go into to details what are the specific niches and subniches. Especially with respect to libraries. Where might you embed lua for application scripting versus python. Where would you use Java vs C#. Which languages do different scientists use? Also which languages have libraries for these subniches? Things like bioperl/scipy/Incanter. Please no flamewars about how nice each language or environment is. This is where they used. Also no complaints about marketing/PHBs. **(Manually migrated) I asked this question again after it was closed on stackoverflow.com**


title: How will writing the transaction part in Java benefit the security of the application, when all other parts are being written in PHP?

text: A friend of mine while working on a PHP application asked me to write one part of the application in Java. The part that involved transactions. He said it will be better to write this portion in Java. He talked about how secure it will be! Though I was too busy to help him then, I want to know the essence of this idea. Why he was trying to use Java when he wrote the most part in PHP? Will it really boost up the security? And writing transactions in Java is only concerned with security? The thing seems very interesting but I really have no idea, what it is! Please provide some insight into the topic. Note: When I say transaction, it involves everything. From accessing account to transferring money.


title: Is there a loophole in the GPL that allows proprietary software to be linked with GPL libraries?

text: Let’s examine a hypothetical scenario: Company X writes a proprietary program (A) that dynamically links with a proprietary library (B). Company Y wants to use a replacement library (C) licensed under the GPL, and so writes a wrapper library (D) that dynamically links to both A and C and translates the API calls used by A to the API calls used by C. As D is intended to be used with C, and uses C’s API calls, it is a derivative work of C and must therefore be distributed under the terms of the GPL*. As a result, the combined work of A and D must also be distributed under the terms of the GPL, which is impossible given that Company Y does not possess the source code for A. That said, so long as Company Y distributes D by itself, there is no problem. _However, regardless of Company Y’s actions, Company X does not violate the GPL by distributing A, even without B. The mere existence of D does not mean that A is suddenly a derivative work of C (through D) that must be licensed under the GPL as well._ Now this is the loophole: _there is nothing that stops Company X from writing its own version of D, distributing it separately from A, and telling end-users to use D instead of B when running A._ It seems that a company is capable of designing a proprietary program to use a GPL library without violating the GPL, so long as a wrapper module is used to insulate the proprietary program from the GPL library and that module is distributed separately. Am I correct in my reasoning? Is this a real loophole in the GPL? *D is also a derivative work of A, but for the purposes of this scenario, Company X has explicitly authorized the creation of D and allowed it to be licensed under the GPL.


title: What type of code or program , i can post as open source on Git or Bit Bucket

text: I have seen many times that if you want to look good on resumes you should have some project coded as open source on bit bucket and Git. I want to do that , even though it may be small but at least i want to starts the steps which can make me a good programmer and it looks good on resume. I knows these languages like `php bash python django jquery joomla` Can anyone give me some example what type of projects i should upload there which i can mention in resume. i usually build websites , how can i put those type of codes. Does putting shell script for backing database can also be put in there


title: Process monitoring in Linux environment?

text: I'm trying to write a multi threaded/processes application and it need to know how to monitor a process from another process all the time. So here is what I have, I have a 2 processes, each with multiple threads that handle the network part, then another 2 process also with multiple threads that interact with DB and with the network processes, what I need to do is that if for example one of the network processes goes down the DB process start sending to the live network process until the second one is up again. I'm using fifo between the DB and the network process. I was thinking of sending messages with message passing all the time but not sure whether this is a good idea or I need to use some other IPC for this issue, or probably neither is good and I need to use entirely something else?


title: Do ORM POCOs replace domain entities?

text: This is somewhat similar to this question but more broad. In general, with ORMs like EF 4.1 supporting POCOs, does it now make sense to have your domain entities **be** the objects that are persisted to your database? With older ORMs like EF 4 or Linq-to-SQL, your "database objects" were auto- generated, and tightly coupled to your database, and so, for non-trivial applications, were mapped to more robust, intelligent domain entities before being put to work. Is the idea with newer ORMs to just build robust domain entities, and then have a data-layer that simply provides a mapping between said domain entities and your DBMS? In writing that I get the feeling that this has **always** been the goal, but not readily (easily) possible with the tools available, at least not in the .NET world.


title: constants/enums in API

text: What are a few ways constants and enums are dealt with when creating an API Client? I'm writing a client in python for our API and I've hit a sticking point with this. We use a lot of mappings to numbers (to save space) and I was wondering what the best technique is. I can hard code them into the client, but if a new enum/constant gets added, the consumer would have to update his version of the client. I also thought about grabbing the maps/enums when the client is first initialized and cached until there is an update. Are these typical approaches, or is there a more effective way to do this? Edit: This is a REST API but I'm making a python client (so platform specific I suppose) for it to make it easier to work with. For a little more detail, when I say enums, I just mean using a constant (like an integer) to represent a certain choice a consumer has for a certain attribute. So lets say someone using the API is saving what type of video game system they have. 1 = xbox, 2 = playstation, 3= wii, etc... Do I hardcode those into the python client for the consumer to use? Do I grab them from the server when the client is initialized and then cache them client side?


title: Is there justification for leaving conflict markers in checked-in code?

text: Consider conflict markers. i.e.:               <<<<<<< branch     blah blah this     =======     blah blah that     >>>>>>> HEAD      In the particular case which has motivated me to post this question, the team member responsible had just completed a merge from upstream to our branch, and had in some cases left these in, as comments, as a sort of documentation over what had just been resolved. He left it in a compiled state, tests passing, so it's not as bad as you would think. Instinctively though, I really took objection to this, however being devils advocate to myself I can see why he might have done it:   * because it highlights to other team developers what has changed as a result of the merge.   * because those who are more expert with the particular pieces of code can then address the concerns illustrated by the comments so that he doesn't have to guess.   * because the upstream merge is a right pain and it can be difficult to justify the time to resolve everything well and completely, so some semi-complete FIXME notice is necessary, so why not use the original conflict as a comment to document this. My objection was instinctive, but I'd like to be able to justify it rationally, or see my position more wisely. Can anyone give me some examples or even experiences where people have had a bad time with someone else doing this and/or reasons why it's bad practice (or you can play devil's advocate and support it). My own immediate concern was that it would clearly have been annoying if I had been editing one of the files concerned, pulled the changes, got real conflicts, but also pulled in the commented ones. Then I would have had a very messy file indeed. Fortunately that didn't happen.


title: MVC pattern with JSF-Spring-MyBatis webapp

text: I've a Java webapp with these frameworks and I want to know if my implementation meets with MVC pattern: **Controller Layer (V)** I'm using JSF               @ManagedBean     public class Controller{         @ManagedProperty("#{business}")         private Business business;              public void insert(){             business.insert();         }     }      **Business Layer (C)** I'm using Spring               public interface Business{         public void insert();     }          @Service("business")     public class BusinessImpl implements Business{         @Autowired         private DaoMapper mapper;              @Override         @Transactional         public void insert(){             mapper.insert();         }     }      **Data Layer (M)** I'm using MyBatis (This java interface is associated to XML file of MyBatis)               public interface DaoMapper{         public void insert();     }      My layers implemented MVC pattern? I'm confused :S...


title: Why in the world does a heap need to make sure it allocates in 8-byte alignments?

text: 4-bytes = word; 8-bytes = 2x word Then why doesn't the heap just go with 4-byte alignment (because it will be grabbing a word at a time anyway, right?) If we went with 8-byte alignments, why not 12? 16?


title: What is a suitable replacement for an Access 2003 database required to run an older PC?

text: Many years ago, I wrote a small Access 2003 database for a non-profit to track the donations they received. They recently wrote me asking for some new features (I was shocked it was still in use, honestly) and I'm wondering if I could rewrite the application with a newer technology/framework. Here are the machine specs:   * Pentium 4 2.8 Ghz   * 1 GB RAM   * Onboard Intel video card   * Windows XP SP3 What, if any, would be a suitable replacement for the database and UI? I'm mainly a C# developer so Winforms + SQL Compact 4 springs to mind (I don't know how WPF would perform on a machine that old). Perhaps there are other possibilities in Python/Ruby/etc? Update: I appreciate and agree that rewriting is rarely the right thing to do, but I was hoping to learn via this question, that given the PC's specs and OS, what possibilities would I have for writing an application that could   * perform CRUD for donations   * generate summary reports (totals by month/year/etc) Or, put another way, is Access still the appropriate tool for the job?


title: How do I know if I'm cut out for the position I'm in?

text: Most times someone gets the chance for more responsibility and growth in their career they would not know for sure if they can handle it until they are actually doing the work. When things dont seem to be working out, how would one know whether it is because of himself not capable of doing the work due to incompetence, or due to lack of experience? Keeping in mind that there is no one more senior than you at the company for the specific area of expertise. If you've been given a job that you are not ready/capable of performing adequately, what would be the better career move:   1. Push hard to skill up in order to be able to perform the job. potential Burnout danger, and then how would you handle the time between being incompetent and becoming competent.   2. Tell management that you are not ready for the job and they need to hire someone more senior. They may replace you all together.   3. Look for another job where your experience is correctly matched to your responsibilities   4. None of the above


title: What's the best explanation of what Story Points are?

text: We're starting to use Story Points here for our Agile development but I find it hard to explain and also can't find any definitive answer to what they are. The best thing I can do is point to other sites (like http://blog.mountaingoatsoftware.com/tag/story-points) and give some vague generalization of what they are. I'm looking for a good explanation with some examples of use that would be helpful for others to use. Are there any good resources for explaining story points?


title: Xerox SOLID example in PHP

text: There is a good example on Wikipedia regarding the violation of SOLID principles. > The ISP was first used and formulated by Robert C. Martin while consulting > for Xerox. Xerox had created a new printer system that could perform a > variety of tasks like stapling a set of printed papers and faxing. The > software for this system was created from the ground up and performed its > tasks successfully. As the software grew, making modification became more > and more difficult so that even the smallest change would take a > redeployment cycle of an hour. This was making it near impossible to > continue development. The design problem was that one main Job class was > used by almost all of the tasks. Anytime a print job or a stapling job had > to be done, a call was made to some method in the Job class. This resulted > in a huge or 'fat' class with multitudes of methods specific to a variety of > different clients. Because of this design, a staple job would know about all > the methods of the print job, even though there was no use for them. The > solution suggested by Martin is what is called the Interface Segregation > Principle today. Applied to the Xerox software, a layer of interfaces > between the Job class and all of its clients was added using the Dependency > Inversion Principle. Instead of having one large Job class, a Staple Job > interface or a Print Job interface was created that would be used by the > Staple or Print classes, respectively, calling methods of the Job class. > Therefore, one interface was created for each job, which were all > implemented by the Job class. > > http://en.wikipedia.org/wiki/Interface_segregation_principle I tried to find a good PHP solution for this, I got this far:                class Job implements StampleJob, PrintJob {      }           class Print {        protected $objPrintJob;        public function __construct(PrintJob $objPrintJob) {          $this->objPrintJob = $objPrintJob;        }      }           class Staple {        protected $objStapleJob;        public function __construct(StapleJob $objStapleJob) {          $this->objStapleJob = $objStapleJob;        }      }      I can understand how the interface will limit knowledge but this will not actually change the big Job class or remove the SRP violation. Can you clarify how this solution actually solves the problem: "The design problem was that one main Job class was used by almost all of the tasks"?


title: Why put SQL statement in a variable before using mysql_query()?

text: I'm been working with PHP on and off for a bit now, and I've seen plenty of code both ways:               $sql = "SELECT …";      mysql_query($sql);      vs               mysql_query("SELECT…");      Is there a reason for separating the two, beyond being able to also pass in something such as $con?


title: What does it mean for software, libraries, and languages to be asynchronous?

text: With popular software out today like Node.js, Celery, Twisted, and others boasting about being asynchronous, what does it mean? I've gone through the basic Node.js tutorials and written a few Node.js scripts, but still don't feel comfortable with the topic. Please note that I haven't had I had any formal introduction to the topic.   1. How exactly does asynchronous software work?    2. What are the pros and cons?   3. What are callbacks?   4. Lastly, how does a synchronous web server perform vs. an asynchronous web server?


title: Where does UI fit in a Multi Agent system

text: **tl;dr** How would I represent GUI as agents in a multi agent system. I am learning more about Multi Agent Systems. I like the concepts of such systems, it makes a lot of sense and it sounds very useful when I want to create a large system devised of smaller parts for the Web. So, I created a basic `Agent` class, taught my agents to negotiate and communicate, created an environment for them to be situated in and such. So, in a simple app attempt I have:   * Several "InfoBroker" Agents that handles communications with server services, wanting to obtain information about the world and willing to share it under certain terms (They hold an auction if that matters).   * A few agents that coordinate the communication between my services on the client side (Also "InfoBroker" agents I guess).   * A few working agents, that have a simple goal in their environment, performing calculations and performing (very basic) means-end reasoning in the environment. They're my 'manual labor' in the app.   * A few other things specific to my application. That's all great, but I have no idea where GUI fits in all that? I need to show information about my system to the user, the GUI isn't a small part (consider agents that speak to the DOM in a web app). How would represent GUI as an agent in a multi agent system? Note: I've implemented this in JavaScript, but this seems more language agnostic to me.


title: Keyword Collection, ManyToOne or OneToMany relationship?

text: I hope this is the right place for this type of problem. An Object of my class `Movie` can have several `keywords` ( like 'fight club', 'brad', 'fincher'), and be part of different `categories` (like 'Drama', 'Best Movies Ever') I implemented them as ManyToMany:               @OneToMany(targetEntity = Keyword.class,fetch=FetchType.EAGER)         private Set<Keyword> keywords;          @OneToMany(targetEntity = MovieCategory.class, fetch=FetchType.EAGER)         private Set<MovieCategory> movieCategories;      Somehow I don' think, this is not the correct relationshipmodel, how would you implement this? Right now hibernate wont allow me to fetch.eager. fetch.lazy is okay. I found this link http://www.mkyong.com/hibernate/hibernate-many-to- many-relationship-example-annotation/ but it didn't answered my question.


title: Is an "associate engineer" the same as a "junior engineer"?

text: I'm a recent college grad starting my first software engineering job. I received an offer I like but the title is associate engineer. I'm used to seeing junior engineer. Is this pretty much the same thing? Salary is $70k + stock options.