title: git workflow for separating commits

text: Best practices with git (or any VCS for that matter) is supposed to be to have each commit do the smallest change possible. But, that doesn't match how I work at all. For example I recently I needed to add some code that checked if the version of a plugin to my system matched the versions the system supports. If not print a warning that the plugin probably requires a newer version of the system. While writing that code I decided I wanted the warnings to be colorized. I already had code that colorized error message so I edited that code. That code was in the startup module of one entry to the system. The plugin checking code was in another path that didn't use that entry point so I moved the colorization code into a separate module so both entry points could use it. On top of that, in order to test my plugin checking code works I need to go edit UI/UX code to make sure it tells the user "You need to upgrade". When all is said and done I've edited 10 files, changed dependencies, the 2 entry points are now both dependant on the colorization code, etc etc. Being lazy I'd probably just `git add . && git commit -a` the whole thing. Spending 10-15 minutes trying to manipulate all those changes into 3 to 6 smaller commits seems frustrating which brings up the question **Are there workflows that work for you or that make this process easier?** I don't think I can some how magically always modify stuff in the perfect order since I don't know that order until after I start modifying and seeing what comes up. I know I can `git add --interactive` etc but it seems, at least for me, kind of hard to know what I'm grabbing exactly the correct changes so that each commit is actually going to work. Also, since the changes are sitting in the current directory it doesn't seem like it would be easy to run tests on each commit to make sure it's going to work short of stashing all the changes. And then, if it were to stash and then run the tests, if I missed a few lines or accidentally added a few too many lines I have no idea how I'd easily recover from that. (as in either grab the missing lines from the stash and then put the rest back or take the few extra lines I shouldn't have grabbed and shove them into the stash for the next commit. Thoughts? Suggestions? PS: I hope this is an appropriate question. The help says _development methodologies and processes_


title: Can Agile be accomplished without client involvement?

text: I couldn't write a book on Agile. I have worked in several shops that call their process Agile. One of the main points of Agile development is regular client involvement. After a sprint, the work can be demo'd to the client to obtain their feedback. Rinse and repeat. The problem I come across is that many clients do not want to be that involved. They would much prefer a waterfall approach. Gather the requirements up front, then come back when you are done. In my experience, waterfall does not work. Clients do not know what they want until they see it. The waterfall dilemma is further propagated by a large community of developers that want to have all the requirements up front. This way they know what they are building, they can architect accordingly, and the client is to blame because they "signed off" on said requirements. Am I incorrect? Can Agile work without client involvement? If so, how and how do you overcome the issues I discussed?


title: What would make you adopt a language with very few resources and tools, barely any libraries and more or less no other users for a project?

text: Often, many decent languages just won't get popular because of the chicken- and-egg problem where a language lacks resources (books, tutorials... other than for some basic language documentation), tools (IDE support, debuggers), libraries (other than for some kind of small standard library) and very few people have adopted it. The language might not have been standardized either. Such languages do still get used occasionally, as otherwise, we wouldn't have any popular languages today. Some got popular because they were created for a specific major product and used for that (e.g. C for UNIX), but some languages weren't, but still got quite popular (e.g. Java and Python). What would such a poorly supported language need to offer in order for you to adopt it for a software project you are going to create? Surely, there would have to be something quite revolutionizing or unique about the language.


title: How to instrument existing ASP.NET application?

text: We have several highly complex ASP.NET web applications that are used internally by hundreds of users. We are trying to figure out which areas of the applications to invest in to improve functionality, but we aren't sure which screens/features are more heavily used. So, ideally, I'd like to find a way to add a layer of instrumentation to the applications that gathers metrics on which buttons are being clicked, which text boxes are being used, etc. Are there any products / open source apps out there that will do this sort of instrumentation for ASP.NET? Obviously I could do it myself manually by going into the code and injecting logging statements everywhere but this would be a significant amount of work that will be hard to accomplish.


title: Idea of an algorithm to detect a website's navigation structure?

text: Currently I am in the process of developing an importer of any existing, arbitrary (static) HTML website into the upcoming release of our CMS. While the downloading the files is solved successfully, I'm pulling my hair off when it comes to detect a site structure (pages and subpages) purely from the HTML files, without the user specifying additional hints. Basically I want to get a tree like:               + Root page 1          + Child page 1          + Child page 2              + Child child page1          + Child page 3     + Root page 2          + Child page 4     + Root page 3     + ...      I.e. I want to be able to detect the menu structure from the links inside the pages. This has not to be 100% accurate, but at least I want to achieve more than just a flat list. I thought of looking at multiple pages to see similar areas and identify these as menu areas and parse the links there, but after all I'm not _that_ satisfied with this idea. **My question:** Can you imagine any algorithm when it comes to detecting such a structure? **Update 1:** What I'm looking for is _not_ a web spider, but an algorithm do create a logical tree of the relationship of the pages to be able to create pages and subpages inside my CMS when importing them. **Update 2:** As of Robert's suggestion I'll solve this by starting at the root page, and then simply parse links as you go and treat every link inside a page simply as a child page. Probably I'll recurse not in a deep-first manner but rather in a breadth-first manner to get a more balanced navigation structure.


title: Is there an efficient way to convert a Java project with a TUI into one with a GUI?

text: So I need to make the interface of a Java-database application a GUI. We coded the project in Eclipse, and I am going to import it into Netbeans. In Netbeans there's a great GUI builder, but I'm unsure about how to go about this.


title: How come the design process is so different for Web Design and GUI Design?

text: I had the opportunity to develop applications in several niches:   server back-end, desktop clients, and recently a small scale website. Once indulged in the website design I am asking myself and you   how come the UI design process is so different? Can you point out the differences, and why they originated? Once, HTML was for marking up text and desktop GUI was the front-end for doing the real job, but today, why the GUI development process is still so different? Here are some for a start: Desktop: **Use of explicit layout**. (ex: StackPanel in WPF, BorderLayout in Swing)   Web: **Layout is a set of CSS properties** (ex: height/width, margin/padding, float, display..) that are given to each container like element. Desktop: **Isolation of GUI components** to OO classes, easy reuse.   Web: **Components are not reused in html level** , they may be reused in dynamic server-side html generation. Only CSS styles may be reused. Can you name a few more? and why? Why can't they be similar? Side note: I have some experience with GWT, it creates a client application that runs in the browser, but why can't I make a webpage (like a blog page) with desktop UI design methods and tools?


title: Why does Knuth forbid the reading of pre-chapter quotations in The Art of Computer Programming?

text: After the preface to The Art of Computer Programming is the Procedure for Reading This Set of Books. Step 4 is to begin reading Chapter N, with the specific instruction to " _not_ read the quotations that appear at the beginning of the chapter." (emphasis his). This section is present in the 1997 3rd edition of Volume 1, but not in 3rd edition of Vol 2 or 2nd edition of Vol 3 both dated 1998. I have guesses as to why this curious instruction exists, but I've been unable to find any reference to it. Does anyone first hand knowledge about this, or a link to info?


title: What to choose: freeware, shareware or payware?

text: A few years ago I've developed a program that has a steady group of users. It became quite popular and now we have close to two million downloads on Download.com. At first I provided the application as freeware to reach as many users as I could, but there is server costs and of course it would be nice to receive a bit of money in return for your effort. I'm looking for a way to gain reasonable revenue from my freeware application, but still make a bit of money. Here's my experience so far (current in bold): Xacti.com : Low revenue and it took me a lot of emails to eventually get my money.   OpenCandy.com : Friendly, revenue is ok, good online overview of your downloads.   **InstallMonitizer.com** : We're testing with them right now, revenue seems higher and a referral program. Another option would be to switch to shareware (let's say 30-day trial based), but I think that would cost me a lot of users. The offer screens are harmless in my opinion. What do you use for your software (opensource, freeware, shareware)?   What are your experiences so far?   What would you accept as a user? **Update 28/12/2011:**   Number of installs is still increasing with InstallMonetizer: http://www.installmonetizer.com. The bundle automatically checks for the best match in geographic location and revenue. For some applications we see $1.00 per US download! Many other countries are supported as well. It will take a bit more time to update all of our mirrors. I'll keep you guys posted.


title: How to explain to a layperson the variance in programmer rates?

text: I recently talked to a guy that is looking for developers to build a product idea. He mentioned he has received interest from people but the rates have varied from $20-120/hr. This project he estimates should take 3-6 months and since he is non-technical, he is confused why there can be so much variance. I understand how I would choose someone but I am a developer and can gauge other people's work. How can I explain to him (in a non-biased way, if possible, as I will apply as well) about the variance in rates? Is there any good analogy that would help?


title: How do I develop in more languages with less IDEs

text: I would like to set up my computer so that I can develop in .net, C#, Java, ActionScript, JS/CSS, and functional languages such as Scala or Haskell. However, I want to do this with the least amount of full-featured IDEs to learn / programs taking up harddrive space on my computer / running multiple IDEs simultaneously. Which programs can I use to minimize the amount of full-featured IDEs I have to learn/use. (For example, if Eclipse could handle all of these frameworks, that would be a valid answer)


title: Which is more important: solving or implementing?

text: I guess I'm capable of solving problems with my pencil and paper easily, but I find it takes more time to implement the solution in code. Between "solving" or "implementation", which is more important in the IT field?


title: As a novice, how can I best overcome the complexity of larger projects?

text: Currently, I'm a student and I can tackle all my assignments which only require, at most, 3-5 classes to implement. Now, I'm wanting to develop programs on a bigger scale but I am having a really difficult time figuring out how to design the program from a higher level. The real world example I am working on is a group project to build an RSS reader. So far so good and I have a very basic prototype working that uses an RSS framework plus a few classes I created myself. Using the prototype as an example and the requirements document (well over 50 requirements, as of now) I need to build the actual program. I feel like I know a lot of the principles but I am not sure how to apply them to varying contexts such as this. I'm hung up on how to break this simple RSS reader into multiple components, classes, etc and what those should even be. I would really like to know how I can/should go about wrapping my head around this project. I want to be able to step back and visualize the different pieces of the program so I have some structure before writing any code. Extra kudos if you have a link to an article or blog that actually shows, by example, how you can take a concept and break it down at a high level. Sort of a "from concept to production" type article instead of just abstract information as available at sites like SourceMaking.


title: How to commit a file conversion?

text: Say you've committed a file of type _foo_ in your favorite `vcs`:               $ vcs add data.foo     $ vcs commit -m "My data"      After publishing you realize there's a better data format _bar_. To convert you can use one of these solutions:               $ vcs mv data.foo data.bar     $ vcs commit -m "Preparing to use format bar"     $ foo2bar --output data.bar data.bar     $ vcs commit -m "Actual foo to bar conversion"      or               $ foo2bar --output data.foo data.foo     $ vcs commit -m "Converted data to format bar"     $ vcs mv data.foo data.bar     $ vcs commit -m "Renamed to fit data type"      or               $ foo2bar --output data.bar data.foo     $ vcs rm data.foo     $ vcs add data.bar     $ vcs commit -m "Converted data to format bar"      In the first two cases the conversion is not an atomic operation and _the file extension is "lying"_ in the first commit. In the last case the conversion will not be detected as a move operation, so as far as I can tell it'll be _difficult to trace the file history_ across the commit. Although I'd instinctively prefer the last solution, I can't help thinking that tracing history should be given very high priority in version control. What is the best thing to do here?


title: Torvalds' quote about good programmer

text: Accidentally I've stumbled upon the following quote by Linus Torvalds: > "Bad programmers worry about the code. Good programmers worry about data > structures and their relationships." I've thought about it for the last few days and I'm still confused (which is probably not a good sign), hence I wanted to discuss the following:   * What interpretation of this possible/makes sense?   * What can be applied/learned from it?


title: Compiler design in Lisp

text: With some googling, I could easily find some documents in compiler design in C, Java, and C# and even in Haskell, but not in Lisp except implementing Scheme/Lisp in Lisp. Is Lisp not so popular in implementing other (not functional) programming languages? Do you know of some good documentation about implementing a compiler in LISP?


title: MVC: How to Implement Linked Views?

text: I'm developing a java application to visualize time series. I need (at least) three linked views, meaning that interaction with one of them updates the others. The views are:   1. A list represents the available and currently selected time series. The selected time series are used as input for subsequent computations. Changing the selection should update the other views.   2. A line chart displays the available and selected time series. Time series should be selectable from here by clicking on them.   3. A bar chart shows aggregated data on time series. When zooming in to a period of time, the line chart should zoom in to the same period (and vice versa). How to implement this nicely, from a software engineering point of view? I.e. I'd like to write reusable and clear, maintainable code. So I thought of the MVC pattern. At first I liked the idea of having the three view components observing my model class and to refresh views upon being notified. But then, it didn't feel right to store view related data in the model. Storing e.g. the time series selection or plot zoom level in the model makes implications about the view which I wouldn't want in a reusable model. On the other hand, having the controllers observe each other results in a lot of dependencies. When adding another view, I'd have to register all other views as observer of the new view and vice versa, passing around many references and introducing dependencies. Maybe another "model" storing only view-related data would be the solution?


title: Should I ask/tell my boss before freelancing?

text: I am currently working as an intern at a consulting firm. I am soon to move to a full time employee once I graduate next semester, and I love working there. However, as a student, I lack money and I have met a business owner outside of work who has offered to hire me for some freelance web development. Because I met this individual outside of work, I feel it would not be a conflict of interest to freelance for him. However, the work his is wanting me to do is very similar to what I already do for my current boss. Should I speak with my boss before considering the offer? **Edit** : I understand that I cannot take IP from work, and I am not in a contract, I'm employed at will.


title: Liskov Substitution and SRP Principle violation - how best to structure this scenario?

text: While learning SRP and LSP, I'm trying to improve the design of my code to comply best with both of these principles. I have an employee class that has a calculatePay method on it. Firstly, I believe following OOP SOLID Principles, calculatePay() method should not be an employee objects responsibility. Common responsibilities of employees would be to performDuties(), takeLunchBreak(), clockIn() and clockOut() etc.. Am I right in thinking this way? That's why I feel calculatePay() should belong in some other class. Okay so that's my SRP insecurity. Coming to LSP: I have subclasses like accountants, salesman, and directors. These are all employees that get paid. How would I change this design to better support volunteers? Volunteers don't get paid.               public class Employee {              private String name;         private int salary;         private boolean topPerformer;         private int bonusAmount;                   public Employee(String name, int salary, boolean topPerformer, int bonusAmount) {            // set fields etc..         }              // This method doesn't seem to belong here.         public int calculatePay(){             if(topPerformer)                 return salary+bonusAmount;              else{                 return salary;              }         }     }


title: how to install opencv's cross-compiled libraies on raspberry

text: my problem is may be complicated, I'll try to detail I cross compiled opencv for ARM (raspberry pi) from my host, and everything works fine. I also tried to cross compile an example and it also worked, i got an executable. but once the executable transferred to the raspberry, I cannot execute it and I get the following error: error while loading shared libraries: libopencv_core.so.3.0: can not open shared object file: No such file or directory. on my host, in my opencv's build folder, I have a "install" folder in which there are four subfolders: "bin", "share", "include", "lib". what am i suposed to do with these folder ?? i think i must use their content but don't know how. where and how do I install the cross compiled libraries in raspberry ?? how could i fix that error ?? thanks in advance


title: Moving my ASP.NET MVC application to Amazon AWS

text: I built an ASP.NET MVC application, and now I want to move it to Amazon AWS from my development server. My question is: How does one migrate an ASP.NET application to Amazon AWS? Here is what I have researched/found so far:   * Sessions don't work across instances, so I need to use DynamoDB or memcached to store state. I looked into various clients like Enyim as a possible solution to the session state problem using Amazon ElastiCloud.   * Amazon has a web service for SMTP emails. So I will need to rework the code that sends SMTP emails to send through Amazon SES, and reroute incoming emails to a separate mail server by changing the DNS records.   * There's an SDK for managing user identity (Amazon IAM). I will need to change the authentication code to use this web service. Perhaps there are more points that I am unaware of. So, how does one migrate an MVC app to AWS?


title: How to determine what should get it's own respective controller?

text: I'm using the MVC pattern in my web application built with PHP. I'm always struggling to determine whether I need a new dedicated controller for a set of actions or if I should place them inside an already existing controller. Are there any good rules of thumb to follow when creating controllers? For example I can have: `AuthenticationController` with actions:   * `index()` to display login form.   * `submit()` to handle form submission.   * `logout()`, self-explanatory. **OR** `LoginController` with actions:   * `index()` to display login form.   * `submit()` to handle form submission. `LogoutController` with action:   * `index()` to handle logging out. **OR** `AccountController` with actions:   * `loginGet()` to display login form.   * `loginPost()` to handle login form submission.   * `logoutGet()` to handle logging out.   * `registerGet()` to display registration form.   * `registerPost()` to handle form submission. And any other actions that are are involved with an account...


title: How do the blogging sites or sites that host prose like contents store the data?

text: How do the blogging sites, Q&A sites (or any other sites host prose like content) store their data? That is, how do you store blogs and Q&A content in the database? I hope it is not good to store this huge text data inside RDBMS table columns.


title: Optimal Database design regarding functionality of letting user share posts by other users

text: I want to implement functionality which let user share posts by other users similar to what Facebook and Google+ share button and twitter retweet. There are 2 choices: 1) I create duplicate copy of the post and have a column which keeps track of the original post id and makes clear this is a shared post. 2) I have a separate table shared post where I save the post id which is a foreign key to post id in post table. Talking in terms of programming basically I keep pointer to the original post in a separate table and when need to get post posted by user and also shared ones I do a left join on post and shared post table                   Post(post_id(PK), post_content, posted_by)              SharedPost(post_id(FK to Post.post_id), sharing_user, sharedfrom(in case someone shares from non owners profile))      I am in favour of second choice but wanted to know the advice of experts out there? One thing more posts on my webapp will be more on the lines of facebook size not tweet size.


title: Is this how Simplex Noise works?

text: I have done a huge ton of reading up on Simplex Noise now, and after a lot of confusion and headaches I think I am able to form an idea of how Simplex Noise works now. Am I right, that simplex noise (2D) is just a grid build of Simplexes, in this case triangles, where at every corner of a triangle there is a value between 0 and 1. When you ask the algorithm for a point it'll convert the 2D coordinates to the simplex grid coordinates, interpolate the noise and then return the actual value?


title: How to slowly release a web application to more and more users so that too many concurrent users don't crash your site?

text: I have a web application that I expect to go viral pretty quickly. How can I control traffic to it so that it doesn't crash under too much load? This application doesn't require user login. It will be properly load tested, but I am not really sure what kind of traffic to expect until I make it live.


title: WPF4 Unleashed - how does converting child elements work?

text: In chapter 2 of the book **WPF4 Unleashed** the author shows an example of how XAML processes type conversion. He states that               <SolidColorBrush>White</SolidColorBrush>      is equivalent to               <SolidColorBrush Color="White"/>      , because a string can be converted into a `SolidColorBrush` object. But how is that enough? It doesn't make sense to me. How does XAML know to which property should the value `White` be assigned?


title: IL and case-sensitivity

text: Quoted from A Brief Introduction To IL code, CLR, CTS, CLS and JIT In .NET > CLS stands for Common Language Specifications. It is a subset of CTS. CLS is > a set of rules or guidelines which if followed ensures that code written in > one .NET language can be used by another .NET language. For example one rule > is that we cannot have member functions with same name with case difference > only i.e we should not have add() and Add(). This may work in C# because it > is case-sensitive but if try to use that C# code in VB.NET, it is not > possible because VB.NET is not case-sensitive. Based on above text I want to confirm two points here:   1. Does the case-sensitivity of IL is a condition for member functions only, and not for member properties?    2. Is it true that C# wouldn't be inter-operable with VB.NET if it didn't take care of the case sensitivity?


title: Object-Oriented equivalent of LISP's progn function?

text: I'm currently writing a LISP parser that iterates through some AutoLISP code and does its best to make it a little easier to read (changing prefix notation to infix notation, changing setq assignments to "=" assignments, etc.) for those that aren't used to LISP code/only learned object oriented programming. While writing commands that LISP uses to add to a "library" of LISP commands, I came across the LISP command "progn". The only problem is that it looks like progn is simply executing code in a specific order and sometimes (not usually) assigning the last value to a variable. Am I incorrect in assuming that for translating progn to object-oriented understanding that I can simply forgo the progn function and print the statements that it contains? If not, what would be a good equivalent for progn in an object-oriented language?


title: Count function on tree structure (non-binary)

text: I am implementing a tree Data structure in c# based (largely on Dan Vanderboom's Generic implementation). I am now considering approach on handling a Count property which Dan does not implement. The obvious and easy way would be to use a recursive call which Traverses the tree happily adding up nodes (or iteratively traversing the tree with a Queue and counting nodes if you prefer). It just seems expensive. (I also may want to lazy load some of my nodes down the road). I could maintain a count at the root node. All children would traverse up to and/or hold a reference to the root, and update a internally settable count property on changes. This would push the iteration problem to when ever I want to break off a branch or clear all children below a given node. Generally less expensive, and puts the heavy lifting what I think will be less frequently called functions. Seems a little brute force, and that usually means exception cases I haven't thought of yet, or bugs if you prefer. Does anyone have an example of an implementation which keeps a count for an _Unbalanced and/or non-binary tree_ structure rather than counting on the fly? Don't worry about the lazy load, or language. I am sure I can adjust the example to fit my specific needs. **EDIT: I am curious about an example, rather than instructions or discussion. I know this is not technically difficult...**


title: Responding to end users about bugs they found

text: I have an issue tracking system, but sometimes users report bugs directly to me in an email. If I'm responding to a bug report in an email, what's a good etiquette to use? Do I thank them for reporting the bug? Do I apologize for it ? Is there a good template anywhere?


title: Multiple files in powershell

text: How to using multiple files in Powershell to ensure modularity? function.ps1 could have all the utility functions? command1.ps1 could have calls related to a command?


title: Question about mocking externals

text: at company we're developing quite a big project and we're arguing at the testing strategy. The question is: should all of the tests be executed in isolation of external services like database or APIs (facebook etc) or just part of them? Of course what I have in mind is using mockups. We discussed following strategies:   1. Write all of the tests in isolation of external services - mock externals everywhere   2. Write part of the tests in isolation and create single bigger functional test for every feature that tests it using externals (without mocking anything) - using fixtures   3. Run all tests communicating with externals (of course that's never appliable to unit tests so they're out of scope in that case) I know it can start quite a discussion but I think that's what it is all about, I'd like to find pros and cons that I didn't think of already.


title: Good practices for large scale development/delivery of software

text: What practices do you apply when working with large teams on multiple versions of a software or multiple competing projects? What are best practices that can be used to still get the right things done first? Is there information available how big IT companies do development and management of some of their large projects, e.g. things like Oracle Database, WebSphere Application Server, Microsoft Windows, ....?


title: Revamp application

text: I am a software developer having an experience of 3 yrs. I want to play with latest technologies always. But this is not practical. Because say, I developed a web application in .Net 3.5, now its 30% done. After the release of .Net 4.0, my mind is always goes with .Net 4.0. I think like this, lot of features are in new version, so why shouln't I implement those versions in my application. When I worked with IT companies, most of them code with very old versions, some body use VB.NET, C, even Classic ASP. So what might be the points should I consider if I revamp an application?


title: What is Context Diagram in a SRS?

text: I am learning how to write a System Requirements Specifications, and most of templates I have seen talk of a Context Diagram. What exactly is a Context Diagram?


title: Is "watermarking" code with random trailing whitespace a good way to detect plagiarism?

text: Consider this:               int f(int x)       {             return 2 * x * x;           }       and this               int squareAndDouble(int y)       {             return 2*y*y;           }       If you found these in independent bodies of code, you might give the two programmers the benefit of the doubt and assume they came up with more-or-less the same function independently. But look at the whitespace at the end of each line of code. Same pattern in both. Surely evidence of copying. On a larger piece of code, correlation of random whitespace at line ends would be irrefutable evidence of a shared origin. Now aside from the obvious weaknesses: e.g. visible or obvious in some editors, easily removed, I was wondering if it was worth deploying something like this in my open source project. My industry has a history of companies ripping off open source projects.


title: Architecture Question

text: I am writing a rules/eligibility Module. I have 2 sets of data, one is the customer data and the other is the customer products data. Customer data to Customer products data is one to many. Now I have to go through a set of Eligibility rules for each of this Customer product data. For each customer products data, I can say the customer is eligible for that product or decline the eligibility and should move on to the next product record. So in all the rules, I need to have access to customer and customer product data(the particular record that the rules are being executed against). Since all the rules can either approve a product or decline a product, I created an interface with those 2 methods and is implementing the this interface for all the rules. I am passing the Customer data and one product data for all the rules (because rules should be executed on each row of customer product data). An Ideal situation would be having the customer and customer product data available for the rule instead of passing them to each rule. What is the best way of doing this in-terms of architecture? Edit: Here is what I am doing               public class CustomerContract     {         public DateTime StartDate { get; set; }         public DateTime endDate { get; set; }         //Other Contract related details          }     public class Customer     {         public int ID { get; set; }         public string Name { get; set; }         public string state { get; set; }     }          public class CustomerInfo     {         public CustomerInfo(int CustomerID)         {             Customer = new Customer();// Get Customer from DB             AppliedProducts = new List<CustomerProduct>();// Get the customer products by customerID             CurrentContract = new CustomerContract();//Get the contract by CustomerID, State             declineReasons = new List<int>();// just intailizing. the decline codes are added by rules.         }              public CustomerContract CurrentContract { get; set; }         public IList<CustomerProduct> AppliedProducts { get; set; }         public IList<int> declineReasons { get; set; }         public Customer Customer { get; set; }     }          public class CustomerProduct     {         public decimal AmountCharged { get; set; }         public int DeclineReasonID { get; set; }         public int Product { get; set; }         public decimal DiscountApplicable { get; set; }         public decimal AmountQuoted { get; set; }         public decimal Tax { get; set; }     }          public interface IRule     {         // Since we need to have access to contracts when deciding the eligibility         CustomerProduct ExecuteRule(CustomerProduct currentproduct, CustomerInfo customerInfo);              //when denied,          CustomerProduct DenyProduct(CustomerProduct currentProduct);     }          public class EligibityEngine     {         List<IRule>  rules = new List<IRule>();         private CustomerInfo c;              public EligibityEngine(int CustomerID)         {             c = new CustomerInfo(CustomerID);             LoadRules();             foreach (var customerProduct in c.AppliedProducts)             {                 ExecuteRules(customerProduct);             }         }              private void ExecuteRules(CustomerProduct currentProductItem)         {             foreach (var rule in rules)             {                 currentProductItem = rule.ExecuteRule(currentProductItem, c);             }         }              private void LoadRules()         {             // add all the IRule types here             //rules.Add();         }     }      When I execute the rule, I have pass the customer Product data and customer data. I have to pass the result of one rule execution to the other. In the above pattern, if the rule changes data in customerInfo class, it is not save unless it is passes as ref. My question is I want the all rules to have access to this data with out passing them in. So I need not worry about capturing the out put of the rule. I want the executeRule method to void.


title: See number of SVN Checkins per folder

text: I have a very large SVN repository (working copy of several gb) that has just reached its 20,000th checkin. As a bit of an interesting statistic for our team (and to partly celebrate our 20,000th checkin) I'd like to make a graph showing which folders in the repository have had the most checkins. Is there any way to do this? We mostly use integrated SVN clients in our IDE and Tortoise SVN, but I'm willing to get other tools for this one-off thing.


title: Necessary Infrastructure for large project with many components communicating through IPCs

text: I have a fairly in depth question which probably doesn't have an exact answer. As a software engineer, I am usually tasked with working on a program or project with minimal understanding of how other components or programs in the project interact with each other. When one program fails in a sea of multiple components and processes, what infrastructure elements are necessary to ensure that the problem can be accurately tracked to the violating application? More specifically, what infrastructure elements should be necessary for this large project and which are optional but very helpful. One such example I can think of is some form of a common logging infrastructure that allows for a developer or tester to easily browse through a log that contains numerous components for messages that might allude to the culprit program along with a "trail" of what happened before the issue occurred. I'm thinking of something similar to Androids alogcat tool. These necessary infrastructure elements should be language-agnostic. While these elements should be understood by all engineers on the team in question, which elements should be understood at great detail by the technical system engineers and what should the individual software engineers be responsible for adding to their tools to allow for such infrastructures to take hold? Please feel free to ask for clarification if something does not make sense as I understand this question is very broad and needs some refinement. I will refine as necessary from the answers and comments I receive. Thanks for any help! Update: I am entering in a team that has maybe 5% of the code with Unit Tests and is just beginning to Instrument and Monitor. Each software programmer (I say programmer and not engineer because not everyone on the team is an engineer) does not understand the basics of fail immediately and sanity checking. Much of our software baseline is legacy code and is in the process of being ported over. Unfortunately we don't have the man power to refactor a lot of the older components. This is what led me to try and understand if there there are necessary infrastructure tools that can be used to detect and find bugs at the source in a much quicker fashion. While I am not expecting a tool to magically do this, I was thinking there might be tools or configurations that allow for more easily finding bugs in a sea of components.


title: Lead/Manager vs Individual contributor: which is better?

text: Currently I am working in a company as a manager (software dev). But I only have 6.8 yrs experience. I joined this company as a software engineer and got promoted to SSE, Lead, and Manager. Some of my team members have better experience than I, and I feel like I need to have more exposure/experience to take these roles. I feel like it is better to be an individual contributor and learn many things for another couple of years and become a Principal Software Engineer, rather than getting involved in management. Options I have:   1. Ask my current employer to make me an individual contributor?   2. Find a new company and join as an SSE to start over?   3. Find a new company for a lead position?  Please advise.


title: Efficient graph clustering algorithm

text: I'm looking for an efficient algorithm to find clusters on a large graph (It has approximately 5000 vertices and 10000 edges). So far I am using the Girvan–Newman algorithm implemented in the JUNG java library but it is quite slow when I try to remove a lot of edges. Can you suggest me a better alternative for large graphs?


title: Pure Java web browser, is it practical?

text: I know that a Java web browser is possible, but is it practical? I've seen the Lobo project and must admit I am impressed, but from what I've gathered it seems that development stopped in 2009. Would a browser coded in pure Java (no WebKit java bindings of any type) be able to compete with those among the ranks of Chrome or Firefox, or would it be inherently slower, hindering the user?


What are the factors that have made Java a success as a programming language in enterprise computing?


title: How can we make software development best practices more interesting to people without a software background?

text: Where I work there are a few experienced software developers with a software background, but the majority of developers are physicists or chemists with excellent domain knowledge but limited experience when it comes to developing high quality, maintainable software. To address this we have started running regular talks and workshops. **What topics do you think we should discuss to help make these people more effective software developers?** In particular we are struggling to gain enthusiasm for these talks as many developers do not see software as an interesting subject. **How could we make these more interesting to people without a software background?** Thanks


title: Is it a good idea to merge multiple HTTP requests to save bandwidth?

text: I am preparing a single page application that would be sometimes used over slow mobile connection. Some of its part are quite heavy in terms of API requests (fetching ten different resources for a new screen display). Now, is it a good idea to merge these services to one that provides all required data, but is not as "pure" in terms of REST principles? Are there significant performance gains to be expected?


title: Implementing a simple controller in embedded C

text: Is there a known method or pattern to implement a simple controller for an MVC design in pure C or the switch case approach is the standard? **Background :** I have an embedded application and I'm pleased with how the business logic turned out. I also finished the UI which boils down to basically 2 functions:               uint8_t getInput(void);     void display(logger toDestination, char* message, ...)      Inputs can come from multiple sources and outputs can be sent to several destinations. All of that is taken care of so the application has no idea if its run by a PC on on the device. It also has no idea if the events come from humans or are faked by unit tests. Where I struggle is with the application logic. My views are in charge of where and how to display the outputs. My drivers, regrouped into behavioral models providing clear features, know _how_ to do their jobs very well but not _when_. Here's my functional rough draft, which in my opinion violates principles like DRY, cohesion, flexibility and may present scalability problems: **Rough draft :** (I faked the names and reduced the size but you get the idea) _menu.h_               void goToMainMenu(void); // This is the entry point of the application after everything was setup correctly              void goToFirstSubMenu(void);             void firstFunctionality(void); //The last levels are the ones doing the calls to the business logic             void secondFunctionality(void);             //Other functionality or nested sub-sub-menus              void goToSecondSubMenu(void);             void thirdFunctionality(void);              int doSomethingWithTheBusinessLogic(int arg1, char arg2, void* arg3);              //Other sub-menus and options              /* And so on, the function prototype are indented to reflect the logical level of the menus.*/      Then most of the functions will roughly look like this: _menu.c_               void goToMainMenu(void)     {       uint8_t choice = 0;       resetDefaultState();             do       {         display(toTerminal, "Press 1 to go to sub-menu 1" ENDL);         display(toTerminal, "Press 2 to go to sub-menu 2" ENDL);         display(toTerminal, "Press 3 to do something with the drivers" ENDL);         display(toTerminal, "Press z to go back." ENDL);              choice = getChar(); /* Blocking thread waiting for events to pop from the other threads */              if     (choice == '1'){ goToFirstSubMenu(); }         else if(choice == '2'){ goToSecondSubMenu(); }         else if(choice == '3'){ doSomethingWithTheBusinessLogic(); }            }while(choice != 'z');            resetDefaultState();        /* When a submenu returns we're taken to the parent menu's do-while loop */     }        * Is it a good way to do things for small-medium systems?   * How could this be improved considering the limits of C and embedded environnements? **What has been tried :** I tried a n-ary tree approach where nodes are menus and leaves are functionality but without polymorphism it's hard to define elegently how both should behave to inputs. The strongly typed system also makes it hard to do a simple callbacks system because I end up needing tons of wrappers around the drivers to unifiy a single callback signature (`void myCallback(void*)`). It also seem to be overkill for this simple state-flow; I feel like I'm working against KISS and productivity only because I've been hammered with "chains of if-elses is the devil". **What I would like :** With higher level languages usually you can bind events and callbacks. Something along the lines of `bind(myMenu, thisInput, theCallback)` so whenever `myMenu` is focused and an event `thisInput` it raised `theCallback` is called. I'm unsure how to do this in C without going way overboard.


title: How to pick a framework

text: This quote by Joel Spolsky resonated with me: > Which is better, XUL, Eclipse's SWT, or wxWindows? I don't know. They are > all such huge worlds that I couldn't really evaluate them and tell. It's not > enough to read the tutorials. You have to sweat and bleed with the thing for > a year or two before you really know it's good enough... Unfortunately, for > most projects, you have to decide on which world to use before you can write > the first line of code, which is precisely the moment when you have the > least information. I'm enough of a perfectionist that I _hate_ the thought of picking a framework for a new project without complete knowledge of what the best choice is, but the fact is that, as Joel says, there's no (practical) way to have complete knowledge of what the best choice is. Right now I'm trying to pick a web framework. Right now, based on our target platforms and my judgment of various languages, I'd pick Python over Ruby, C# / ASP.NET, or Java / J2EE. Of the available Python frameworks, based on this SO question, I'd pick Pylons over Django. (Our intended projects are somewhat specialized, not content-related, so Pylons' flexibility sounds better than Django's CMS support and built-in admin. Our team has relatively little experience in any of the alternatives, so that's not a significant factor.) But Django is substantially more popular than Pylons, and Ruby on Rails or ASP.NET are substantially more popular than Django. So what am I to conclude?   1. The very popular choices are more popular because they're much better, so I should pick one of the more popular choices instead of what I'm currently planning.   2. The very popular choices are not necessarily much better, but more popularity means better documentation, better community support, better add-ons, and an easier time finding developers with prior experience, so I should pick one of the more popular choices instead of what I'm currently planning.   3. Any of the options would be good, so I should pick what sounds best for my target project without stressing about popularity.


title: What do you name functions/variables/etc when you can't think of a good name?

text: When you are defining a function/variable/etc and are not sure what to name it, what do you name it? How do you come up with a name? If you use a **_temporary_** name as a place-card until you give it it's real name, what temporary name do you use? * * * ### update I have been using things like `WILL_NAME_LATER`, `NEEDS_NAME`, or `TO_BE_NAMED`. I was hoping there was an adopted convention, I was actually hoping that if I used this adopted convention my IDE would highlight the name until I changed it.


title: Can I use publicly mentioned algorithms for writing programs?

text: I want to write a program that solves sudoku. So, I found some sudoku algorithms on Wikipedia. Can I use them or do I need to develop my own algorithm? Also, do I need to ask the specific license holder's permission?.. If so, how would I go about obtaining that permission?


title: trust factor in code review

text: How much should a reviewer trust the coder who submits the code for review? I always have that dilemma of whether I should go test of the changes proposed or should I trust the submitter that he would be _knowing_ what he is doing? Mainly because at the end of the day its reviewers responsibility also. Code-reviews are not fun always.


title: What is the equivalent of Josh Bloch's "Effective Java" for Objective-C/Cocoa?

text: I'm a newcomer to Objective-C and Cocoa but a reasonably experienced Java programmer. When I was starting out, reading Josh Bloch's Effective Java made me a 20% better Java programmer overnight. As its foreword says, most language books teach you syntax and vocabulary, but not much about idiomatic usage. I **hate** knowing I'm writing "The vase of my uncle is on the credenza of my aunt" kind of stuff in a new language. What's the equivalent of _Effective Java_ for Objective-C and Cocoa?


title: Guidance on Excel VBA resource scheduling algorithm?

text: This was posted originally at StackOverflow though suggested to post here instead. I am looking to create an Excel VBA solution that will create a rota/schedule allocating staff to service users using an algorithm. I believe there are already existing names for this kind of problem/algorithms but not entirely sure what to refer to it is. Here is my scenario: A colleague approached me with a problem of scheduling staff against visits required. Currently this is a manual process done every week and is labour intensive. The datasets are small, on average there would be 20 service users each requiring 2 visits a day with 5 members of staff available each day. I have a worksheet that contains the list of staff who are available for the following week. Each row of data contains their name, gender, skill level, home postcode, day working, start time and end time. A member of staff may be listed more than once on the same day as they may be available for hours in the morning and also in the evening. Another worksheet contains the list of service users and visits required for the following week. Each row of data contains their name, postcode, day of visit, time of visit, visit duration, gender required (i.e. must be seen by a male/female), skill level required (i.e. any, certified) and the number of staff required for that visit (i.e. 1 or 2). Again a service user may appear more than once on the same day as they may require multiple visits at different times of the day (i.e. morning and evening) I have already created some VBA functions to deal with handling of postcodes and getting latitude/longitude co-ordinates along with a function to calculate the distance between two points as the crow flies. At present the distinct values of postcodes with there co-ordinates are being stored on a helper sheet for the VBA to reference. What I am really looking for is guidance on how to even being creating a procedure/algorithm which will produce a suggested rota/schedule, this could be a simple table with pairings between staff and visits. The process must always make suitable pairings based on:   * Skill Level Required   * Gender Required   * Staff Availability Least important are that matches take into consideration the distance required to travel between visits. I believe this is referred to as a Genetic Algorithm? There may be instances where there are too many service users for the available staff and vice versa. Making use of all staff isn't necessary provided all visits are dealt with, if all visits cannot be paired due to a lack of staff availability then this needs to be listed as being unmet. I can utilize SQL Server if need be but ultimately the solution needs to be presented in Excel to the end user, as this is what they are most familiar with. I'm thinking the procedure/process would need to go something like this:   1. For each day, sort the visits by start time   2. For each visit, determine which staff members meet the gender and skill level requirement and is available on that day   3. For each of the staff member determined above, are they available at the time requested?   4. For each staff member that is available calculate the distance from their current location to the where they need to be   5. Rank them in order of preference by distance required to travel   6. Once this has been done for each day, come up with a suggested allocation of staff to visits using some kind of scoring method I'm no VBA expert and deal with SQL Server as my day job but I am willing to try and come up with a suitable solution, just need some guidance on how best to start.


title: Advice/Approach for distilling homogenous code and building common code for a team

text: I work for the State of California. Our programming team in my opinion is not really a 'team' in that we usually work solo on projects throughout the application/systems complete life-cycle. The end result is a lot of developers are 'reinventing the wheel'... writing their own data layers, even though the vast majority of us work on the same Oracle DB... writing their own security stuff... the list goes on. I can't change the mentality of my employees, and don't have any realistic ambitions in regards to changing our team process... but my goal is to get our team to work together a little more, at least to build common building block pieces that we can all use for boilerplate functionality. The obvious benefits are, testing and support are much more maintainable when all our users are familiar with a common piece, time to production is less when you aren't writing the same repository someone else already did, and we can focus on providing better solutions to the unique problems our apps must solve... etc. I'm preaching to the choir, I'm sure. The trick is, the State does not like change, neither do its employees. Managers often disregard new ideas simply because they like to avoid friction and would rather continue on as is. There are similar questions out there, but what I am looking for is advice on how any of you may have faced a similar situation, and any direction toward getting a 'grass roots' kind of effort going to have an easier time approaching management. EDIT: Just to clarify a few things:   * the scope I'm looking for is within the IT shop of my State Agency. I'm not trying to coordinate across several departments. Got get people off the training wheels before asking them to ride motorcycles.   * Security is not much of a concern, most of our applications are internal and written in Windows Forms distributed on Citrix (ugh.) and nearly all use the same enterprise tables in Oracle... very few if any apps are "classified" so to speak. it shouldn't hinder collaboration.   * I have gone so far as to setup a NuGet feed, with a couple of boilerplate pieces of code packaged, and written a few repos for Oracle, sent out some emails, but received little feedback. I've got about 1/3 of our team using ReSharper, and send emails from time to time with tips... again, not a whole lot of feedback.


title: Confused about layered application development

text: So, for the first big project that I'm getting paid for, I decided I'd do things right. To that end, I've created several projects in my Solution. Some of these projects are generic and handle common elements that can be used in any project (stuff like logging and such), but that's not where the focus of my question is. The projects I'm concerning myself with in this case are mostly to do with the database and the actual web application that will use it. So I have an `Ortund.Objects` Class Library Project and an `Ortund.DBContext` Class Library Project. **Ortund.Objects**   This project defines the classes, setting properties and default values that makes up the database.   For example, the Users class defines properties such as Username, EmailAddress, Password **Ortund.DBContext**   This project uses Entity Framework and the Objects project to build the database. DbSets of the classes in the Objects project and various other components explicitly define the structure of the database. Obviously, given this structure, I would have the DBContext project referencing the Objects project. This means that, while somewhere in my head, it makes sense to put all my methods and functions that the web app will use into the Objects project, I wouldn't actually be able to do anything because I won't have the DbContext. To reference the DBContext project would create a circular reference. So, in order for my application to interact with the database now, the only option I can see is to create a 4th project to act as the data layer, effectively becoming a "middle-man" between the web application and the other 2 projects. When I suggested this on IRC, someone answered with the following: > No, the application layer uses the database layer to provide persistence to > the domain layer. I don't understand what this means. Can someone help me to understand how best to structure this application?


title: What to plan before starting development on a project?

text: Say I've received the specs for a project from a client, and now its time to start developing it. Normally, I just start with the first module (usually user registration) and then go from one module to the next. I only plan in my head just before I'm about to start on a module how its going to work, but there's no planning before that. However, I think it would be better if I went over the specs and planned out how the system was going to work before I coded it, e.g what are the main components, how they're going to interact, etc. I'm just not sure exactly what I should plan. To give a better idea of what I'm asking for, how should I a) Divide the project into components, b) Plan their interactions, e.g should I do class diagrams, write unit tests, etc..? Any ideas?


title: Should the design take longer than code development?

text: I once heard that if you spend 90% of your time developing the design of your program the coding part will only take a trivial 10% of the time. I have found a lot more success in spending about 30% of my time designing the architecture than when I used to spend 0% in design. As a result my programs seem to avoid unnecessary coupling and are now more flexible to change before any re- factoring takes place. I usually finish the design phase once I have a clear idea of what all the objects should be named (I am really picky about naming objects) and what single responsibility each will have. Once I feel confident in my design and feel ready to start constructing the software, would there be any benefit to taking more time to keep re-thinking the design? To me it might seems like it might be overkill. What's an effective design to code development time ratio and should the design time be greater than the code development time?


title: How much time do you spend on design before coding?

text: In my experience, it is useful to spend a little while sketching plans for a project before getting into code. Such planning usually includes choosing frameworks/tools, writing requirements and expectations, and doing mockups. I usually only do this for serious projects though, not so much for one-off or short-lived attempts. I'd be interested to hear how much time you spend on planning/designing projects before starting to do the coding. Do you do it for every project, or just the "serious" ones?


title: Process of developing software?

text: > **Possible Duplicate:**   >  What to plan before starting development on a project? I was wondering when you start developing a software what process should you generally go through to do it? By this I mean after you get an idea, do you just sit down and start pushing out code directly, or is there some planning process that you should generally go through first? (i.e. flowcharts, diagrams etc.) Just wondering because I just had an idea and am about to embark on my first "real" application but have no idea where to begin. What would you suggest is the steps that should be taken to have a successful developmental cycle?


title: How much design to do first?

text: I have never worked with a professional software development team. As such, analyzing and thinking about each and every aspect of my software does not come naturally to me. Whenever I strike an idea that excites me I just start a new project in my IDE (after finishing the previous one) and I start designing the interface—which means to me as placing menubars, buttons and other components at their appropriate places—and start coding for them. Recently I started a chess game in Java and I followed that pattern: first programmed the black-white grid, then registered a mouse listener etc. without thinking about warriors/objects of chess game. One thing that annoys me is that I have never been able to completely use object-oriented features of object-oriented programming, though I understand it. I have the habit of taking on things when it comes. This could be the reason of the poor design I end up with. I complete all the projects that I start, but since they are personal projects I have never felt the need to refactor the code. But I know that if I am asked to modify any function of my program I could be in a mess because they are not properly designed (though they work as asked). What is the correct/better way to start to design software that is somewhat complicated like a chess game?


title: What should be first - functionality or design?

text: I've started reading a book from Head First series about OOP and Design. In a first chapter it is stated I have to worry about design of my application just after basic functionality is ready. Basic functionality is ready means you have something to show to your customer or boss. Do you think this is a correct approach? Shouldn't I think about design from the beginning? Can't it happen I won't have time for making a good design after functionality is ready because I will have new high priority requirements to implement? By 'design' I mean Object Oriented design, not GUI or something.


title: Starting a hobby project

text: > **Possible Duplicate:**   >  What to plan before starting development on a project? I have been going through the SE for quite a while but could not find a relevant answer for my question.The question is I am planning to stat a hobby project in my spare time using .NET and MVC3.I have everything set up on my box. But the biggest problem is I don't know where to begin with Shall I create a documentation first?   Start creating a web template? I am really eager to start this but need some guidance . Let me know if there are any ideas.


title: Five or fewer tips to writing good JavaScript?

text: JavaScript has obviously become pretty indispensable; however, I'm still new to it, and I've found it's hard to fight the feeling that it seems such a mess and I don't want to deal with it right now. I'm much further in my understanding of other languages than I am with JavaScript, because I can't seem to get a handle on this fear. I get a feeling that, when I'm writing JavaScript, I'm trying to paint a portrait of Weimaraner puppies. It usually helps me to keep a handful of the most important directives in mind that I can ask myself for each move I make. (To my mind, a handful is five or less.) Can you list five (or fewer) questions specific to JavaScript I should ask myself for each move I make, when I'm coding JavaScript? What would they be? Update: to clarify, I'm not asking for five things to keep in mind when learning JavaScript; I'm asking for five questions to always ask myself going forward, that everyone should alsways ask. High-level questions like: "Am I likely to repeat this somewhere else?" or "is this variable/function name specific enough (or too specific)" <== except these example questions are not peculiar to JavaScript. I'm looking for directives that are peculiar to JavaScript.


title: Workflow design for multi-step edits on a webapp

text: I have a web app (ASP MVC2) where some forms can be accessed via multiple routes, initially once a form was complete a user was kicked back to a default page for that form rather than the page they entered it from. Now I'm redesigning a sizable area I want to address this, I want a solution that is easy to add in. I have a couple of ideas but I'm not sure which to go with, I do know that I want it to be "invisible" (ie not touching my URLs). So I'm thinking either: I could have hidden fields for the referrer page on the forms. Alternatively I could use TempData and have an attribute that handles checking and adding the referrer URL (this would likely include a string for each of the different pathways so that a user could have 2 different forms open and not have the referrers interfere). The problem with the form value is that it would require putting non-model related fields in each of the views and would break if there's ever any GET requests in the workflow. it would also require manually handling this property in each view and action. The TempData+attribute approach would be a much neater way to apply this but it's possible for powerusers who are doing many things at once to have conflicting referrers for the same forms. I'm leaning towards the latter approach as it's more elegant and easier to keep track of as I don't see there being many of the edge cases where it gets overridden but I'm worried about the user experience for if it does happen. Is the trade off worth it?


title: Why don't browsers support haml and sass?

text: The time needed to download a website would be significantly reduced, and parsing would be also easier I think. Why are not these languages imposed as a standard? Obviously they are better than raw html and CSS... Browsers are the only thing that keeps us away from eliminating the intermediate HTML/CSS code.


title: Is it bad practice to make an iterator that is aware of its own end

text: For some background of why I am asking this question here is an example. In python the method `chain` chains an arbitrary number of ranges together and makes them into one without making copies. Here is a link in case you don't understand it. I decided I would implement chain in c++ using variadic templates. As far as I can tell the only way to make an iterator for chain that will successfully go to the next container is for each iterator to to know about the end of the container (I thought of a sort of hack in where when `!=` is called against the end it will know to go to the next container, but the first way seemed easier and safer and more versatile). My question is if there is anything inherently wrong with an iterator knowing about its own end, my code is in c++ but this can be language agnostic since many languages have iterators.               #ifndef CHAIN_HPP     #define CHAIN_HPP          #include "iterator_range.hpp"          namespace iter {        template <typename ... Containers>            struct chain_iter;        template <typename Container>            struct chain_iter<Container> {                  private:                using Iterator = decltype(((Container*)nullptr)->begin());                Iterator begin;                const Iterator end;//never really used but kept it for consistency                  public:                chain_iter(Container & container, bool is_end=false) :                    begin(container.begin()),end(container.end()) {                        if(is_end) begin = container.end();                }                chain_iter & operator++()                {                    ++begin;                    return *this;                }                auto operator*()->decltype(*begin)                {                    return *begin;                }                bool operator!=(const chain_iter & rhs) const{                    return this->begin != rhs.begin;                }            };        template <typename Container, typename ... Containers>            struct chain_iter<Container,Containers...>            {                  private:                using Iterator = decltype(((Container*)nullptr)->begin());                Iterator begin;                const Iterator end;                bool end_reached = false;                chain_iter<Containers...> next_iter;                  public:                chain_iter(Container & container, Containers& ... rest, bool is_end=false) :                    begin(container.begin()),                    end(container.end()),                    next_iter(rest...,is_end) {                        if(is_end)                            begin = container.end();                    }                chain_iter & operator++()                {                    if (begin == end) {                        ++next_iter;                    }                    else {                        ++begin;                    }                    return *this;                               }                auto operator*()->decltype(*begin)                {                    if (begin == end) {                        return *next_iter;                    }                    else {                        return *begin;                    }                }                   bool operator !=(const chain_iter & rhs) const {                    if (begin == end) {                        return this->next_iter != rhs.next_iter;                    }                    else                        return this->begin != rhs.begin;                }             };        template <typename ... Containers>            iterator_range<chain_iter<Containers...>> chain(Containers& ... containers)            {                auto begin =                     chain_iter<Containers...>(containers...);                auto end =                    chain_iter<Containers...>(containers...,true);                return                     iterator_range<chain_iter<Containers...>>(begin,end);            }     }          #endif //CHAIN_HPP


title: Does syntax matters for a (Lispy) Domain Specific Language (MELT, inside GCC)?

text: I am the main author and designer of MELT, a domain specific language to extend GCC (the Gnu Compiler Collection). The implementation is available free software (GPLv3 licensed). If you want a detailed description, from the point of view of a Domain Specific Language, read my DSL2011 paper on MELT. I have chosen a Lisp-like syntax for _MELT_ , so as in Lisp or in Scheme, every operation is written with _"Lots of Insipid Stupid Parenthesis"_ so the application of function `f` to arguments `a` and `b` is written `(f a b)` (like it is in Scheme or in Lisp). Of course, `(f)` -a function application without argument- is not the same as `f` -a simple thing denoted by a variable-. _MELT_ shares with many other Lisp-s and with Scheme the usual "control" operators like `let if defun define cond lambda letrec list definstance` etc... _MELT_ does not use the common names for primitive operations (no `car` or `+` in _MELT_ , which has `pair_head` `list_first` `+i` `+iv` with different meanings). And _MELT_ deals with both first-class values (like in Scheme) and "stuff" (for raw GCC data like _Gimple_ , details are in the DSL2011 paper) The reasons I have chosen a Lisp-like syntax includes:   * first, I am lame, and wanted to have a quick implementation. Parsing Lisp is trivial;   * I was (and am) able to use e.g. Emacs `lisp-mode` for _MELT_ without trouble.    * A small _MELT_ implementation was originally prototyped in Common Lisp   * Current _MELT_ translator is bootstrapped so is written in _MELT_   * The implementation uses classical Lisp tricks: S-expressions are expanded by a macro mechanism (into a sort of internal abstract syntax tree), then normalized, and finally translated to C code.   * GCC has several Lisp like formalisms inside (notably for the back-end, for "machine description" files).   * the GNU projects have Emacs Lisp and Guile as Lisp-like dialects (I was not able to use them for technical reasons detailed in my DSL2011 paper). My question is: _should I offer an alternative, infix-like syntax_ (a bit Pythonic or Lua-esque)? One one hand, I am afraid that some people (particularly young ones, who never met any Lisp-like programming languages; I had a course on Lisp in the 1980-s) are completely allergic to Lisp and won't even try _MELT_ because of its look. On the other hand, the only thing I could do is some simple parser producing the same AST as _MELT_ has today, and the syntax will be ad-hoc (but infixed) and probably not pretty. Also, working on an alternative syntax which I won't use will distract me (or take time) from other efforts (writing documentation & tutorial, making good examples of _MELT_ , debugging and improving the implementation). Some young persons (in particular Jeremie Salvucci and Pierre Vittet) have been able to learn and code _MELT_ without prior exposure to _MELT_ , to Lisp dialects (or Scheme) or even to compilation. Would an alternative syntax attract people allergic to Lisp? A nice guy told me that syntax does not matter really for DSL-s. They can be adopted if they bring some value, even with a not very sexy syntax.


title: When module calling gets ugly

text: Has this ever happened to you? You've got a suite of well designed, single- responsibility modules, covered by unit tests. In any higher-level function you code, you are (95% of the code) simply taking output from one module and passing it as input to the next. Then, you notice this higher-level function has turned into a 100+ line script with multiple responsibilities. Here is the problem. It is difficult (impossible) to test that script. At least, it seems so. Do you agree? In my current project, all of the bugs came from this script. Further detail: each script represents a unique solution, or algorithm, formed by using different modules in different ways. Question: how can you remedy this situation? Knee-jerk answer: break the script up into single-responsibility modules.   Comment on knee-jerk answer: it already is! Best answer I can come up with so far: create higher-level connector objects which "wire" modules together in particular ways (take output from one module, feed it as input to another module). Thus if our script was:               Foo.Input fooIn = new Foo.Input(1, 2);     Foo.Output fooOutput =  fooModule.operate(fooIn);     Double runtimevalue = getsomething(fooOutput.whatever);     Bar.Input barIn = new Bar.Input( runtimevalue, fooOutput.someOtherValue);     Bar.Output barOut = barModule.operate(barIn);      It would become with a connector:               FooBarConnectionAlgo fooBarConnector = new fooBarConnector(fooModule, barModule);      Foo.Input fooIn = new Foo.Input(1, 2);     Bar.Output barOut = fooBarConnector.operate(fooIn);      So the advantage is, besides hiding some code and making things clearer, we can test FooBarConnectionAlgo. I'm sure this situation comes up a lot. What do you do?


title: Is using ELSE bad programming?

text: I've often come across bugs that have been caused by using the `ELSE` construct. A prime example is something along the lines of:               If (passwordCheck() == false){         displayMessage();     }else{         letThemIn();     }      To me this screams security problem. I know that passwordCheck is likely to be a boolean, but I wouldn't place my applications security on it. What would happen if its a string, int etc? I usually try to avoid using `ELSE`, and instead opt for two completely separate IF statements to test for what I expect. Anything else then either gets ignored OR is specifically handled. Surely this is a better way to prevent bugs / security issues entering your app. How do you guys do it?


title: What are common categories for Kanban and Scrum JIRA boards?

text: One minimal Kanban-like system has three places for cards: "To do", "In progress", "Done". As I've seen Scrum and Kanban on the web, it is maybe five or six categories. What are some of the common options for categories for Kanban and Scrum JIRA boards?


title: Web standards or risk avoidance?

text: My company is building an App Engine application. The app encounters a bug (possibly due to an issue with App Engine itself, as per our research) on IE9, but it cannot be reliably reproduced and is experienced by a small percentage of users. The workaround is to force IE9 to use IE8 mode. As a lazy front end developer (who doesn't like CSS hacks, shims and polyfills) I think it's OK to at least try going back to IE9 mode and see what happens, while we're still in private beta. The senior engineer (being more pragmatic) would rather that we continue forcing IE9 users to use the older IE8 mode. Who is right?


title: HTML 4, XHTML and CSS 2 - How long until these are obsolete?

text: I got into the game of programming, exactly a year ago. Now i am posing as an HTML, CSS and Javascript Guru. html5 and css3 are the new things out there but in my opinion they are still experimental, (some new websites remind me of the blink tag). I know HTML 4.x and xhtml were out there for a very long time and eventually became standards. But i wasn't around to see that transition from experimental to strict standards. So my question is how long will it take for us to get there with these new versions of html, css and javascript. Most of the code I see around is accommodating older browsers, and i can fairly say that it is easier to write javascript code that work in ie5-8 than to write one that works with i9 and ie5 (let's take localStorage for this example). So when are we going to get to this level where if you want to make sure code works almost universally you have to make sure it's at least HTML5 and CSS3 compliant.


title: Refactoring options - multiple methods in same class or into separate classes

text: we have some API which will be called either by client A, B, C or D **Current code**               doSomething(String client){          if (client.equals("A")){     ...     }     else if (client.equals("B")){     ...     }      **Proposed refactoring 1** separate into multiple methods and have each client call the dedicated method such as               doSomethingForClientA()          doSomethingForClientB()      we need this because internally each method will call other private methods defined in the same class **Proposed refactoring 2** Use strategy (or template) pattern and separate into multiple classes for the clients to call the method call from client remains               doSomething()      Which approach is better in the long run? Is there any design pattern to help with option 1 ? or a 3rd option?


title: Centralized and decentralized logging mechanisms

text: I've worked different kind of applications both having centralized and decentralized logging mechanisms. I feel centralized logging mechanism is good to see the proper flow of code and timing of executions while debugging problems. Most of the implementations will have small fixed file size for easily narrowing down the problem. But if the number of components is too high within the system I feel the log directory will get exhausted with huge number of files. Is it a good idea to employ decentralized (module-wise) logging mechanisms in such situations? What are the pros and cons of the same?


title: Best practices for connecting from ASP.NET to SQL Server?

text: There are several different ways to connect to SQL Server from an ASP.NET application. I'm working on rebuilding an ASP.NET / SQL Server environment right now and I'm trying to figure out which method I should be going for. Here are the options as I see them:   * Connect via SQL Server ID that is stored in web.config. Pro: simple. Cons: password in web.config; have to specifically configure SQL Server ID.   * Connect via user NT ID via ASP.NET impersonation. Pro: no passwords in web.config; fine-grained control of security per user. Cons: administrative overhead of configuring user accounts in SQL Server; SQL Server monitoring of application is scattered across many accounts.   * Run ASP.NET as a custom NT ID, and have that NT ID configured in SQL Server. Pros: connecting to SQL Server as one ID - simple; no passwords in web.config. Cons: complicated from a security perspective. Have to configure custom SPNs in Active Directory for Kerberos authentication. Are there other options that I'm missing? Which of these options are used in which situations? Which are more standard? Are there pros and cons that I'm not thinking about? Note that my assumption is that users are authenticating with ASP.NET via integrated windows authentication; this is for an intranet application.


title: What would you say to a bunch of software engineering students on their first day at college?

text: Next Friday I'm giving a short (30 min.) talk to a bunch of software engineering students who will be attending the same university I did. Some context:   * The place is Montevideo, Uruguay   * The university is Universidad de la República (public, free university)   * The Software Engineering programme takes 5 years (if you're very good and don't start working early). Around 800 new students per year, around 80 graduates per year. Conditions are harsh, particularly the first two years. Most of them probably have no idea what software engineering or programming is. My goal would be to somehow give them an idea of the field and hopefully motivate them to endure the hardships ahead to eventually become successful developers. So the question is: what would you tell these people?


title: Paid vs ads-based Windows Phone app

text: I am looking to understand, before I publish my application on the Windows Phone Marketplace, what is the best way to monetize it. I am looking at 3 options:   * Free, ads-based (no paid version)   * Time trial, no ads + paid full version   * Free trial (not time limited), ads based + paid full version, no ads DISCLAIMER: *All the ideas below assume that the app is actually good and people use it :) The goal is to make as much money as possible. I am not a big fan of the ads- based applications but it sounds to me that having a constant cash flow from ads can bring more money, long term, than getting a lump sum once. I mean, in order to get more money from a pay-only-once application, you need more customers while the ads based only requires people to use the app; the ads based, long term, can generate more money with a smaller user base that is loyal. What do you experts think? Did others research/have experience with the actual amount of money that can be generated in each scenario?


title: Could we build a functional computer?

text: As mush as FP has done, in the end, all our programs are structured. That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly, so what actually runs behind the hoods are instructions, states and loops. We are kind of emulating FP. As a hardware noob, my question is: why aren't we using computer architectures that actually computed things in a functional style? For example, a computer could consist of primitive "functional chips" such as "concat", "map" and "reduce", and a program would merely tell the computer how to flow the data between those chips in order to compute the desired result, such as in concatenative languages. ![nonsense sketch](http://i.stack.imgur.com/7RA0Q.png) This doesn't really make sense but might illustrate what I'm thinking.


title: In Scrum, how to handle contention/workload at end of sprint

text: My team started using Scrum a few sprints ago. Our project involves building software interfacing with physical devices (think robots and sensors) and our typical Product backlog usually represent adding controls device to the whole system. We split down the task close to the example here. Each device integration feature is split into code, tests, integration tests, peer review, etc. Obviously, there is a sequence inherent to each Product Backlog Items. Typically, our sprints last 2 weeks and the team has between 4 to 6 members. We run into 2 problems at the end of sprints:   * The first is to keep everyone busy at end of sprint.   * The second (related) one is contention on system. We pretty much end up integrating during the last few days of the sprint. We only have one integration system, so people are often blocked from continuing to work on their task because they can't access the system. Since it is the end of the sprint, there is not much work left to do in the sprint backlog. What should these people work on? Pick up items from the top of the product backlog is not well received from the product owner, since the current items are not done. Working on technical debt will help the project as a whole but won't help completing the sprint. Are there any best practices to either structure sprints to avoid these issues? Tips to negotiate with product owners?


title: Is it possible to create and distribute an app for the BlackBerry Playbook that doesn't go into App World?

text: My company is looking to create an app that we'll use internally on several (about 20) BlackBerry Playbooks. We don't want it to be put up on App World because it's just an internal application. I'm wondering if there are any:   * Costs involved with this outside of paying a programmer to develop it - i.e. Are there any license fees, deployment fees, etc.   * License issues involved with deploying the app to multiple Playbooks without deploying it to App World   * Limitations on functionality of the app   * Other things we should be taking into consideration If it matters, the app will be collecting information and downloading it to a computer via USB.


title: Are regular expressions a programming language?

text: In the academic sense, do regular expressions qualify as a programming language? The motivation for my curiosity is an SO question I just looked at which asked "can regex do X?" and it made me wonder what can be said in the generic sense about the possible solutions using them. I am basically asking, "are regular expressions Turing complete"?


title: If condition not true: default value or else clause?

text: I have searched Programmers and Stackoverflow and was not able to come up with a satisfying answer, even though I'm quite sure it must have been asked many times before. The only question I found has answers only dealing with readability. The code excerpts below are from actual C# code I was writing. * * * When dealing with a local variable that has some calculated value when a condition is true but a default value otherwise, do I: First set the value, then change the value when the condition is true?               short version = 1;      // <-- set the value here.     if (separator != -1)     {         version = Int16.Parse(filename.Substring(separator + 1));         filename = filename.Substring(0, separator);     }      Or _not_ set the value, and add an else when the condition is false?               short version;     if (separator != -1)     {         version = Int16.Parse(filename.Substring(separator + 1));         filename = filename.Substring(0, separator);     }     else         version = 1;        // <-- set the value here.      Could a programmer have wrong expectations when confronted with either solution (e.g. when the if-clause is quite big and the else-clause is way down, out of view)? Do you have any experiences where the difference mattered? Is one particular style enforced at your company, and why? Are there any technical reasons why one would be preferred over the other? The first one sets a variable twice, but I'm not sure whether this would matter in modern- day optimizing compilers.


title: What is the term for IntelliSense in a non-Microsoft world?

text: When talking about IDE software or about what a programming language allows you to do or not at the source level, I often use the word IntelliSense, which has a precise meaning in the Microsoft world, but is inappropriate when talking to people who don't have to be familiar with Visual Studio. In this case, what is the appropriate term to use? I usually use the term "auto-completion", but it doesn't always work. In fact, IntelliSense includes auto-completion, but it also provides documentation and hints.


title: How do I make money from my FOSS while staying anonymous?

text: Let's say that:   1. You have created a FOSS project that other people find useful, perhaps useful enough to donate to or pay for modifications to be done.   2. It is a perfectly legitimate and innocuous software project. It has nothing to do with cryptography as munitions, p2p music, or anything likely to lead to a search warrant or being sued.   3. You want your involvement to stay anonymous or pseudonymous.   4. You would like to receive some money for your efforts, if people are willing. Is that possible, and if so, how could it be done? When I talk about anonymity, I realize that it is necessary to define the extent. I am not talking about Wikileaks style 20 layers of proxies worth of anonymity. I would expect a 3 letter agency to be able to identify the person easily. What is wanted is shielding from commercial competitors or random people, who would not be expected to be able to get the financial intermediary to divulge your details just by asking for them. Why would you want to stay anonymous? I can think of several valid reasons, maybe you operate a stealth mode startup and don't want to give your competitors clues as to the technology you are using. Maybe it is a project that has nothing to do with your daily job, is not developed there, but the company you work for has an unfair (and possibly unenforceable) policy stating that any coding you do is owned by them. Maybe you just value your privacy. For what it's worth, you intend to pay the relevant taxes in your country on any donations.


title: What are the Advantages of a "Combined" Getter/Setter VS Individual Methods?

text:
This is what I call a "combined" getter/setter method (from jQuery):               var foo = $("
This is my HTML
"),         myText;          myText = foo.text(); // myHTML now equals "This is my HTML" (Getter)     foo.text("This is a new value"); // The text now equals "This is a new value")      This is the same logic with separate (theoretical) methods:               var foo = $("
This is my HTML
"),         myText;          myText = foo.getText(); // myHTML now equals "This is my HTML" (Getter)     foo.setText("This is a new value"); // The text now equals "This is a new value")      **My Question:** When designing a library like jQuery, why would you decide to go the first route and not the second? Isn't the second approach clearer and easier to understand at a glance?


title: How to store a simple DB "in the cloud"?

text: Even though the name is similar my question is not a dupe of the very fine question here: Database in the cloud? I've got a webserver (Java/Tomcat) running a webapp (which I wrote) on a dedicated server (which I fully configured myself) and I'd like to have it now use a small persistent DB. I know how to install and configure a SQL DB like, say, PostgreSQL: I've already done it several times. But this time I'd like to do something different. The DB schema is very simple. So simple that a spreadsheet is enough to store the data (a few columns and lots of rows). It would only grow by about 2000 rows a day (and that requirement, seen the datasource, cannot change in the future). (*) I don't want to install PostgreSQL nor any other DB on my dedicated server: I don't want to bother with backup/configuration/re-installation if I migrate/update the server etc. so I'd like to keep my dedicated server as simple as possible and store the DB somewhere "in the cloud". By that I mean I'd like to have either Google or Amazon or someone else take care of the data (there's nothing confidential) and have an easy way to access it. Ideally it should be free. Here's what I'm thinking of at the moment:   * every time new data comes in (from a fat client) I _a)_ update a Google Doc spreadsheet using the Java API they provide and _b)_ I warn my Java webapp that new data did arrive (about once every 10 minutes)   * every time the Java webapp is launched and every time it gets notified that new data was in, it pulls data from the Google Doc spreadsheet using the Java API. The advantage is that:   * it's free   * the Google Doc spreadsheet limits of 400 000 cells per document would allow me to have one spreadhseet per week (for example)   * the DB is stored in Google's cloud, making it highly unlikely that I'd lose it   * I can easily visualize my data from wherever I'd be: I can simply log on to Google Docs an open the spreadsheet And of course I can still do my own daily or weekly backup of the data (offline onsite and online onsite for example). I don't see any particularly hard technical issues here but I'm wondering what would the other options be? How would you go about storing a very simple DB "in the cloud"? _(*) Should the requirement change later on, I could always move on to a "real" DB that I'd install on my server but as of now I'm really after having my data in the cloud_


title: On the path to Enlightenment: Scheme, Common Lisp, Clojure?

text: A lot of people smarter than me keep writing about when you learn Lisp it makes you a better programmer because you "get it". Maybe all I hear about Lisp(s) changing your life is just a big practical joke on the newbies, but I figure there's no harm in knowing more about the world, even if I find out I've been sent after a snipe or something. I'd like to follow the SICP book, and or ANSI Common Lisp, but at the same time be studying a dialect and implementation that I could go on to use on personal projects. SICP is focused on Scheme, so that's one big vote. Paul Graham said that if he were to teach newbies he'd do it in Scheme, but it sounded like Scheme was still inferior to Common Lisp. But then there's Clojure-- which I'm told is limited in ways, but more practical in others (JVM libraries). It sounds like I could get through Scheme materials easier, achieve "real" enlightenment from CL, or come close enough with Clojure and be able to get more done with it in the long run. How much of all of that is true? When should I stop thinking about what to learn about and just go and learn about it?


title: What's an Elegant and OOP way to create a tree from arrays and render it as a nested UL

text:
I have a series of arrays which represent file system paths, so each next value is actually a directory deeper, for example:               var a1 = ["Desktop", "Pictures", "Summer 2011"];      is the equivalent of               Desktop     |-Pictures       |-Summer 2011      I'm trying to find an elegant way to:   1. Flatten/merge all the different arrays I have to come up with one object/dictionary/multi-dimensional-array.   2. Parse the result and render a nested **`UL`** (html list) to the page which represents the hierarchy correctly.   3. Write what I already have in a more 'OOP way'.. I already have a working version:               <!DOCTYPE html>

                                 Thanks! EDIT: I'm starting from strings which represent the paths i.e. `"Desktop/Pictures/Summer 2011"` which are broken to arrays.


title: Is JSP a good alternative to PHP

text: I'm wondering is JSP a safe alternative to PHP? Some things I'm concerned about are cpu usage, memory usage, and security.


title: Getting started with repositories: are they what I need, or are there any alternatives?

text: I'm a solo iOS developer - mostly self taught, but have made several successful apps so far and potentially starting some slightly bigger projects. ## What I want to do: As I'm working on some bigger and more complex apps now, there's some things that I want to do - which from what I gather, repositories are what I should be looking at. Basically, I want to:   * Online backup of all my code (for now, dropBox works fine)   * Work on new features of apps, while somehow being able to update/bugfix the older version and have the changes applied to both versions So, are repositories what I should be looking into? From the brief look I've had, it does look like a bit of a learning curve, with the downside that I could only do work when an internet connection is available (sometimes not the case). ## Is there: any alternative to repositories that would achieve the 'branching'/new features - e.g. is there any way to already achieve this using Xcode and not relying on some server? This would be the easier option in my case. Alternatively, if there isn't: What repository system would be best for me, and easiest to use (and probably free!)?


title: Overloading interface buttons, what are the best practices?

text: Imagine you'll have always a button labeled "Continue" in the same position in your app's GUI. Would you rather make a single button instance that takes different actions depending on the current state?               private State currentState = State.Step1;          private ContinueButton_Click()     {         switch(currentState)         {             case State.Step1:                 DoThis();                 currentState = State.Step2;                 break;             case State.Step2:                 DoThat();                 break;         }     }      Or would you rather have something like this?               public Form()     {         this.ContinueStep2Button.Visible = false;     }          private ContinueStep1Button_Click()     {         DoThis();         this.ContinueStep1Button.Visible = false;         this.ContinueStep2Button.Visible = true;     }          private ContinueStep2Button_Click()     {         DoThat();     }