How to document and peer review design in scrum?

I am a relatively new developer in a small business (a team of 3 developers and an equally small QA branch) working on a medium-sized system. The current iteration is still under 100k lines of code (server & client combined), but I could imagine that, in the long term, the total size could be 200 kLOC or more. We are attempting to use Scrum for development, and we are working towards a CMMI level 2 appraisal. We are adopting peer review methods to verify our software design and source code. We elicit software requirements during the sprint planning meeting, and we document the software requirements in a master SRS. This also gives us a start into the software design, but we don't have a formal method for reviewing design concepts, such as OO design, UI design, re-usable design patterns, and more. For our source code, we are trying new techniques, such as using spreadsheets to document over-the-shoulder reviews and e-mail pass- around reviews, but it can be difficult for the reviewer to understand the design concepts from just looking at the source code. _(Please excuse me if I am misrepresenting concepts; we are attempting a lot of this from scratch.)_ We are not averse to using UML to express classes, objects, software interfaces, event patterns, or other design concepts, but we are not sure when or how to peer review our design efforts. Often, a developer can be 70+% complete with a user story and realize that a fundamental design element needs to be changed (and, subsequently, peer reviewed). In an attempt to avoid open discussion on the topic and promote concise answers, I'll try to propose two specific questions:   1. Does anyone know of any good resources (i.e. books, papers, articles) on the best practices of peer reviewing design concepts?   2. I have read that the code itself is the (implementation of the) design. Can the peer review of source code be utilized as the peer review of design? Thank you.


scoping concern when dealing with coupling

I'm learning ruby (and OOP in the process) and I find keep having to write the same patterns when logging progress so I want to wrap this up in a logging library that my other code can then just pass data to - say a string, a file name and a log level. This of course couples the logging library with other code - other code still has to be aware of how the logging library works (that it wants the string, name, & level). I tend not to like coupling like this but it seems like I can't really prevent it, but rather have to deal with it by consciously deciding to scope the library's use to an area of concern "ie: snoweagle's personal tech projects" Is this good design or is there a better way to approach coupling?


Getting List of objects of same class

I have a class 'Task' which represents any Task that is done by an individual employee. For this class I wrote properties like EmpID, Priority, etc. and methods like `AddNewTask(),` `ArchiveTask(),` `MoveTaskToUser(int userid),` etc. Then I wrote a method               public List<Task> GetAllTasks()      This seemed incorrect to me with regard to OOP. I thought any single task object should represent one single task and it doesnt seem right to call `taskObj.GetAllTasks()` because object taskObj should carry out methods on the single Task that it represents. So I changed the method to static:               public static List<Task> GetAllTasks()      Now I call `Task.GetAllTasks()`. Is this the proper way to follow object oriented approach. Was the earlier idea of calling the method from single object correct?


Multiple schemas vs aditional column per customer

If you have different database per customer as there is no need to share any data between them does the same apply if a customer has multiple stores ?   I believe that it is easier to do queries for statistics (some require 4-6 table join) if they are at a single schema rather than multiple schemas.   But everyone (haven't done anything yet) in team believes that cross schema queries is the way to go.They claim that postgres supports it well. Which is the way to go?


Terminating a freelance contract before completion

I've been building a large web application for a company. Initially the project owner appointed a Graphic/Web designer to complete all design/front end works. Me and who ever I bring in to complete back end and all the view binding at the front. The initially front end/graphics guy dropped out and was replaced with a (better) graphic designer who ISN'T producing the html/css required. This deficit caused many months of overrun with me having to try to introduce front end devs to complete the missing pieces. On top of that, numerous articles of the initial spec have been changed and several items added. A month or so ago after receiving an incredibly aggressive phonecall from the project owner decided I was no longer interested in being involved in the project. Obviously all the source code, all documentation etc belong to the client for them to bring in another party. I at this point had been paid 2/3 of the agreed sum. Also shouldered hosting costs myself. The clients response was immediately to threaten me with legal action claiming I'd be breaching our contract by not completing and that I had already breached our contract by running over on delivery dates. He also stated that he felt it would be impossible to replace me on the project because of the obscure technology I'd selected to build it (ASP.Net MVC). He suggested he would intend to attempt to recoup all monies paid so far and damages that he "calculates" (see:made up) to be about £70k. I do a lot of work for a company who's MD is a corporate lawyer. Who's confirmed that technically both parties are in breach of contract, but that's justified by the unforeseen changes in replacing designers etc... I've continued working to now. My (a little long-winded) question is morally and practically what would you do? I'm owed 1/3 of the remaining contract and hosting fees. (about £3500 total) They have lined up another .Net dev to build on the out of spec items as I've stated they're not my responsibility. The site is just undergoing bug/acceptance testing/fixing which the client doesn't believe they should have any involvement in. Should I stick around for the cash, which also ties me into any corrective maintenance for 2 months. Or do I write it off as a "make sure to re-agree terms when big things change" lesson?


On which abstraction level would you do TDD?

**Problem** I find myself nailing the class structure down by having too many unit tests which makes making changes hard. **Example** Assume we have a class A which uses classes B1 and B2. Class B1 uses classes C1 and C2. ![enter image description here](http://i.stack.imgur.com/XtOXG.png) I start off by writing tests first for class A. During that process, classes B1 and B2 are created. To make sure that classes B1 and B2 work, I start writing tests for B1 and B2. Same for C1 and C2. Now, I end up having unit tests for all the different levels off abstraction. Assuming class A was for example a payroll system and classes B1, B2, C1 and C2 came to existence while building A. **Question** Where did I go wrong in my process? Shouldn't I have written tests for levels B and C? Should my unit tests in level A cover all the functionality in levels B and C? What is the process which will lead to the "correct" unit tests and a flexible design? Perhaps you can make an example with two or more levels of abstraction and show me your process and the code (including unit tests and production code and design) that comes out of your process.


Unit testing methods which access an Internet API

Hi I'm developing a Wordpress plugin which accesses a couple of API's (Amazon Product API, Flickr, Freebase, Ebay). I've already started writing unit tests for it but I'm still wondering if its really the way to go since it takes a lot of time downloading data from the API primarily because my download speed isn't that fast (around 2 Mb/s max). Currently it takes 2 hours or more to run the whole test suite and sometimes I even reach the API limit and the test won't pass. Is there a better way of doing this? Perhaps automating the test or even allow me to upload the tests somewhere which has a faster download speed. Do I really need to be testing methods which access the API to begin with? Can I just make use of a mock data instead of querying the API directly? Thanks in advance!


PHP class data implementation

I'm studying OOP PHP and have watched two tutorials that implement user login\registration system as an example. But implementation varies. Which way will be more correct one to work with data such as this?   1. Load all data retrieved from database as array into a property called something like _data on class creation and further methods operate with this property   2. Create separate properties for each field retrieved from database, on class creation load all data fields into respective properties and operate with that properties separately? Then let's say I want to create a method that returns a list of all users with their data. Which way is better?   1. Method that returns just an array of userdata like this:              Array([0]=>array([id] => 1, [username] => 'John', ...),            [1]=>array([id] => 2, [username] => 'Jack', ...),            ...)        2. Method that creates a new instance of it's class for each user and returns an array of objects


What is a resonable workflow for designing webapps?

It has been a while since I have done any substantial web development and I'd like to take advantage of the latest practices but I'm struggling to visualize the workflow to incorporate everything. Here's what I'm looking to use:   * CakePHP framework   * jsmin (JavaScript Minify)   * SASS (Synctactically Awesome StyleSheets)   * Git **CakePHP:** Pretty self explanatory, make modifications and update the source. **jsmin:** When you modify a script, do you manually run jsmin to output the new minified code, or would it be better to run a pre-commit hook that automatically generates jsmin outputs of javascript files that have changed. Assume that I have no knowledge of implementing commit hooks. **SASS:** I really like what SASS has to offer but I'm also aware that SASS code isn't supported by browsers by default so, at some point, the SASS code needs to be transformed to normal CSS. At what point in the workflow is this done. **Git** I'm terrified to admit it but, the last time I did any substantial web development, I didn't use SCM source control (IE, I did use source control but it consisted of a very detailed change log with backups). I have since had plenty of experience using Git (as well as mercurial and SVN) for desktop development but I'm wondering how to best implement it for web development). Is it common practice to implement a remote repository on the web host so I can push the changes directly to the production server, or is there some cross platform (windows/linux) tool that makes it easy to upload only changed files to the production server. Are there web hosting companies that make it eas to implement a remote repository, do I need SSH access, etc... I know how to accomplish this on my own testing server with a remote repository with a separate remote tracking branch already but I've never done it on a remote production web hosting server before so I'm not aware of the options yet. **Extra:** I was considering implementing a javascript framework where separate javascript files used on a page are compiled into a single file for each page on the production server to limit the number of file downloads needed per page. Does something like this already exist? Is there already an open source project out in the wild that implements something similar that I could use and contribute to? Considering how paranoid web devs are about performance (and the fact that the number of file requests on a website is a big hit to performance) I'm guessing that there is some wizard hacker on the net who has already addressed this issue.


Implementing semantic actions in table driven predictive parsing

When doing table driven predictive parsing on an LL(1) grammar, (as explained in good detail here for example), how can we augment the algorithm to allow processing of semantic actions while doing the parsing. One technique could possibly use the same stack in the algorithm by defining the production rules with markers for the semantic actions, and pushing these markers on the stack the same way it's done with terminals/non-terminal in the rest of the production rule, and then processing the code designated by the marker when it gets popped out of the stack. So given something like this (from the Dragon book - actions in curly braces):               rest -> + term { print('+') } rest           | - term { print('-') } rest           | Epsilon          term -> 0 { print('0') }           | 1 { print('1') }           ...           | 9 { print('9') }      We can add a marker for each type of action, and push it in on the stack with the rest of the production terms, and then execute the corresponding code when the marker is popped out by the algorithm. Is this how this is done or is there better approaches?


What is an example of a continuation not implemented as a procedure?

An interesting discussion about the distinction between _callbacks_ and _continuations_ over on SO has prompted this question. By definition, a continuation is an abstract representation of the logic needed to complete a computation. In most languages this manifests as a one argument procedure to which you pass whatever value needs continued processing. In a purely functional language (where all functions are pure and first class citizens), I would think a continuation could be entirely modeled as a function. This is, after all, how I've previously understood continuations up to this point. However, the world is full of state (sigh..) and so the general definition does not require that a continuation capture program state -- it need only encompass intent. To help my understanding, can an example be provided in a functional language where the continuation is expressed in a more abstract way than a function? I know Scheme allows you to grab the current continuation in a first-class manner (call/cc), but even so, it seems that the one argument procedure passed to call/cc is simply given the current continuation in the form of another one argument procedure to which the call/cc'd function can apply its result.


Learning barriers for beginners towards a programmers mind (Study)?

I stumbled upon this Study (of The Development of Programming Ability and Thinking Skills In High School Students)( **link only opens with left-click correct, not in new tab?! dunno why** ) claiming, that students seem to have serious problems learning how programming, abstraction into algorithms,... actually works. What do you think about this and has somebody links to newer free available studies investigating the learning process of programming newbies? Im wondering if this is mainly due to worse teaching or more abstract & difficult to learn languages like C in the past. Of course abilities in mathematics play likely also a bigger role, but this shouldnt be a fundamental hurdle? Is there maybe a connection to how difficult your mother language is structured (grammar, syntax, vocabulary). It is known that programmer newbies of distinct mother languages faster adapt to distinct programming languages? Are there programming languages specially oriented to, for example, chinese/german language? Is the origin of more and more new programming language a sign of individual adaption to a single programmer liked syntax? I would suppose that from a theoretical informatics view there should be a limit of use & different problem types how many different programming languages are really needed. But they seem to grow on and on.


How to get Datasource JNDI access to work with WebLogic reliably (no NameNotFoundException)?

in a WebLogic web application (bundled and deployed as a Jar) I sometimes get a NameNotFoundException when I try to fetch a datasource using JNDI lookup. The datasource is not shown in the JNDI tree then, but it can be seen under Services -> Datasources. It did work as expected and I don't think I changed anything since then. It seems like a race condition or something similar might play a role. This does not seem to be a common problem, which makes me think that I might be missing something very basic. I went through the wizard to create the datasource (Datasource and JNDI name are identical) and I tested it. Again, the programmatical access did work properly as well.               try {         Context context;         context = new InitialContext();         DataSource dataSource = (DataSource) context.lookup(datasourceName);         connection = dataSource.getConnection();     } catch (NamingException e) {         throw new ConnectionException(e);     } catch (SQLException e) {         throw new ConnectionException(e);     }      Are there any best practices or completely different ways to work with datasources? Anything you can think of that might make a difference?


What is the origin/meaning of the name 'NHibernate'?

Been poking around the web because I was curious as to why they called it that but haven't found anything yet. Anyone know? _(I checked the FAQ and it wasn't clear if questions on history/origins were OK to put here or not, but I figured it wouldn't be good on StackOverflow, feel free to start closing it if it is out of scope and I will delete.)_


Stopping endless technical discussions and making a decision

I always come across people who like to bang on for ages over the smallest "technical things". Don't get me wrong, I'm a geek programmer who loves what I do, but you know the type of conversation.   * Mac is so much better than Windows   * Don't use a For Each loop, use a While loop   * Don't buy an Intel based PC, get an AMD based one.   * We should use one IoC container over another. All these "things" have valid pro's and con's for both sides, and you'll never get a "correct" answer, and the person will never concede the point. (of course there will be some where there is an answer, maybe :). My question (I'm getting there!!) is: In a software team, how do you cut through these long discussions without inhibiting innovation, so that a decision can be made and you can get on to solving the real business problems.


Is there a Windows philosophy of programming?

I've been programming both in Unix and Windows environments. Mostly I've worked in Unix, where I've learned Unix Philosophy, which can be summarized as   * Write programs that do one thing and do it well.    * Write programs to work together.    * Write programs to handle text streams, because that is a universal interface. There seems to be a clear difference in programming cultures between Unix and Windows worlds, for example:   * GUI vs CLI   * Registry vs config files   * Lots of tools specializing for any given need vs group of generic orthogonal tools which can combined **Is there equivalent of "Unix philosophy" in Windows world?** What Unix- programmer can learn from Windows or should be aware of when moving to programming in Windows? I would like answers to focus on the best practices of Windows programming (and not a fight between Windows and Unix).


You make websites? So then you must have heard about Web 2.0, right?

The other day someone asked me what type of work I do. I answered that I help to build web sites (Asp.net, c#, mostly). So he said "so then you must do a lot of Web 2.0 stuff, right?". I proceeded to respond by trying to define Web 2.0 as a change in the way that websites were designed 5+ years ago, incorporating more client-side scripting, ajax and standards-based approach to building web sites. I then said that almost anyone doing web design/development today who has stayed up to date with new standards and techniques over the past few years, should be using "Web 2.0-like" techniques, and it is not a really accurate statement to describe a website today as being "Web 2.0". (Person with whom I was talking was a programmer, but in a totally different domain - C++/VOIP stuff). How do you answer (well-intentioned) people who try to talk to you about programming using the catch-phrases of yesteryear? ("Web 2.0" could apply for web development, I am sure that there are similar terms in other areas as well.) Just nod and say yes? Try to explain yourself?


Checklist for coding MVVM web application

We are a small team working on a web application using MVVM design pattern using technologies like .NET, Knockout and HTML. I am trying to come up with a code review checklist for this, so that my team can make use of it while coding as well as while reviewing. I tried to find in google, but no help there. Can you guys suggest me what I have to look for code review checklist?


alternate approach of binary serialization/de-serialization

Is it possible to convert a list of object directly to byte[] (and vice versa) to gain performance (by avoiding serialization/de-serialization)? What I have in mind is that a list is somewhere in memory(heap). If I could read the bytes in heap for my list I could just assign it a variable (of byte[]) in my program. Is it possible? and if yes, how would I get back the original list from byte[] without de-serializing using BinaryFormatter?


What are the downfalls of MVC?

I've been using MVC/MV* since I started actually organizing my code years ago. I've been using it so long that I can't even think of any other way to structure my code and every job I've had after being an intern was MVC based. My question is, what are the downfalls of MVC? In what cases would MVC be a bad choice for a project and what would be the (more) correct choice? When I look up MVC alternatives, nearly every result is just different types of MVC. To narrow down the scope so this doesn't get closed, let say for web applications. I do work on the backend and front-end for different projects, so I can't say just front-end or backend.


Never use Strings in Java?

I stumbled upon a blog entry discouraging the use of Strings in Java for making your code lack semantics, suggesting that you should use thin wrapper classes instead. This is the before and after examples the said entry provides to illustrate the matter:               public void bookTicket(       String name,       String firstName,       String film,       int count,       String cinema);          public void bookTicket(       Name name,       FirstName firstName,       Film film,       Count count,       Cinema cinema);      In my experience reading programming blogs I've come to the conclusion that 90% is nonsense, but I'm left wondering whether this is a valid point. Somehow it doesn't feel right to me, but I couldn't exactly pinpoint what is amiss with the style of programming.


Teaching Classes and Objects

I'm trying to teach how an object is just an instance of a class to a buddy of mine. However, he doesn't seem to understand it so well. I've heard a ton of the examples (blueprint to a house, etc.) But does anyone have a real concrete way of teaching this?


Placing elements in graph with a streaming/online algorthm

We have a stream of points with about 1000 points per second. For each point, we have a complex vector (hundreds of dimensions). Our goal, for each point is to link it to the 5 closest points that we've already seen. We determine "closest" by computing a distance (euclidian or other) between 2 points. Obviously, in a perfect world we would have enough money and time to compute the distance between a new point with each of the points we've already seen and it would keep the 5 closest. The world is not perfect and we're looking for a solution. Has anyone worked with this before?


How can a programmer contribute to planetary science?

I'm just getting back from WWDC13, and had the opportunity to see Bill Nye speak at the last day's lunch session. Of course, I grew up watching him, and left incredibly excited for what lies ahead for humanity ... but at the same time, I'm left wondering how can I, as a "lowly" software engineer, contribute to progress in the space industry. Of course, there are some obvious choices: I could donate cash to the Planetary Society. Or I could go to college and start doing physics research (I never went, though am really happy with my career arc over the last 14 years). So, I guess it's a bit of an open ended question, but what areas of opportunity might be available to someone with more time and skills than money that still wants to find a way to contribute?


When internationalizing texts, should underscores (for keyboard shortcuts) be part of the texts to be translated?

I have a project where I need to translate a lot of words and text fragments in different languages. In these texts, underscores are currently added in these text (fragment(s)) to be used as keyboard shortcuts (used in Visual Studio). However, I was wondering if this is the way to go, or if it would be better to remove the underscores and add them AFTER translation. Is there some guideline to follow?


Karger's algorithm for bin-packing?

I first came across that algorithm as the "Random minimum cut" algorithm. And recently a colleague was trying to pack a big quantity of small textures into one image file. Then it clicked - why not use Karger for this packing problem? I don't know a good way to map this problem to a graph defined in order to minimize the wasted space between images. Here I define the minimum cut as "the atlas with less blank filler pixels". So I need to generate a graph that represents a "distance" between images as an edge. Any suggestion on what type of distance to use? Here is the first idea I had: Given an image A(w, h) where w is width and h i height, if B(w', h') exists for w = w' or h = h' create an edge between A and B. (The same rule with a certain tolerance could be used, like + or - 1%). I would be very surprised if I am the first one to think about this. So if anybody knows about anything similar that has been done, please do say so.


Recommended sprint length when adopting Agile?

I'm new to a small development company (half a dozen programmers and should grow to possibly a dozen eventually). We also have a few external contractors working with us (just to add a bit of complication). I would like to slowly start adopting Agile, or more importantly short sprints. I was curios to know, from past experience, what would you recommend that our initial sprint length (in weeks) be? Maybe I can even go as far as asking what is the sprint length of a very mature and experienced Agile team (shorter [2 weeks] or longer sprints [4 weeks])? My initial thought was to use a shorter sprint, say 2 weeks and then in time, once we get the hang of things and all has smoothed out, we could simply double it to 4 weeks.


I had this question asked on stackoverflow, but it was closed _"as not a real question"_. So i decided to remove all rumbling and post that question here, assuming that this stackexchange is for _"conceptual questions about software development"_ The main question is in the title: **Why rpm and deb package formats are not unified into one standard system?** I think that this is very important step, which we need to do, because such format fragmentation is bad, and not only for independant software developers, but for other tools and languages, who reinventing own packaging, like vim, python, ruby, nodejs, php, eclipse and many many others


What should I do when I've already waited too long between commits?

I was naughty... Too much "cowboy coding," not enough committing. Now, here I am with an enormous commit. Yes, I should have been committing all along, but it's too late now. What is better?   1. Do one very large commit listing all the things I changed   2. Try to break it into smaller commits that likely won't compile, as files have multiple fixes, changes, additional method names, etc.   3. Try to do partial reversions of files just for appropriate commits, then put the new changes back. Note: as of right now I am the only programmer working on this project; the only person who will look at any of these commit comments is me, at least until we hire more programmers. **By the way:** I am using SVN and Subclipse. I did create a new branch before doing any of these changes. **More information** : I asked a separate question related to how I got into this situation in the first place: How to prepare for rewriting an application's glue


What is a faster alternative to a CRC?

I'm doing some data transmission from a dsPIC to a PC and I'm doing an 8-bit CRC to every block of 512 bytes to make sure there are no errors. With my CRC code enabled I get about 33KB/s, without it I get 67KB/s. What are some alternative error detection algorithms to check out that would be faster?


Find next occurence in a Tree

Have a tree of variable depth, and width. What is the best algorithm to find the next occurence of the node in that tree. Next = Search to the right side of the tree ( as in breadth first search ) The selection criteria for the next occurrence of the tree is changeable in different situations. For example, at one place, I want find the next occurrence of the node that contains the Value equal to the current node. In another, I want to select the next value that is less than the current value. Once the next Occurrence is found, the program can terminate and return the value or node.                         5          6           9      10  7  0      5 6 8     5  6   9 5      Suppose I've a pointer to node (depth = 4, value = 5, parent = 10)... when I perform the search I want to get the pointer to the node (depth = 4, value =5, parent=0). Say this is not there, then I want to get node(depth =1, value=5, rootNode).


Why define a Java object using interface (e.g. Map) rather than implementation (HashMap)

In most Java code, I see people declare Java objects like this:               Map<String, String> hashMap = new HashMap<>();     List<String> list = new ArrayList<>();      instead of:               HashMap<String, String> hashMap = new HashMap<>();     ArrayList<String> list = new ArrayList<>();      Why is there a preference to define the Java object using the interface rather than the implementation that is actually going to be used?


How can variables be created at runtime?

Is it possible to define variables dynamically? Last night I was writing some code (C and VB2010) and I ran into a problem related to defining variables in my program. The variables needed depend on the number of entries added by the user and the number of users. Even using dynamic memory allocation we have a size limit, but I wonder about this type of thing sometimes. We can define as many variables as we need (to a limit of course) when writing the code, but can't we define more at runtime? For example: say your whole program is done and when user says 'x', this cannot be created as variable; rather we require a variable to store that x. Why cant we make x a variable at runtime? Can't we build a bridge between compile-time and runtime with some rules?


Implementing an interface from a framework vs simple java interface

This concept is unclear with me. I have worked on several frameworks for an instance Spring. To implement a feature we always implement some interfaces provided by the framework. For an instance if I have to create a custom scope in Spring, my class implements a org.springframework.beans.factory.config.Scope interface. Which has some predefined low level functionality which helps in defining a custom scope for a bean. Whereas in Java I read an interface is just a declaration which classes can implement & define their own functionality. The methods of an interface have no predefined functionality.               interface Car     {     topSpeed();     acclerate();     deaccelrate();     }      The methods here don't have any functionality. They are just declared. Can anyone explain this discrepancy in the concept? How does the framework put some predefined functionality with interface methods?


What's happens if I develop a program taking inspiration from another GNU GPL application?

My friend and I are planning to develop a tiny and simple CMS by taking some inspirations from an already existing GNU GPL CMS. We take the ideas and try to develop it as simply we can, is it possible ? We are planning to set up the same licence, GNU GPL. Is it a good choice ? Which are the conditions to do it ?


I feel I'm a good junior programmer, but how to become a good programmer who writes beautiful code?

As a beginner, I can say that in about six months I grasped very well many basic programming concepts. I began with php, then wen to c, then to java, and I know quite well the procedural and the object oriented concepts. Most important, I really enjoy programming, it's quite a lot a mental challenge than a duty for me. Reality is that I 100% (and more) improved my skills spending lots of time in the project Euler website (and I should be ashamed to say I just solved the first 30 problems, but all by myself without any external help, and I am proud of it). So I could think I'm in the right track. But at the moment I feel I'm in a phase when I don't know how and above all what to do then. In these months I also followed two courses, one for webdesigning (I know how to program css and html markups, and also know the basis of graphics processing), I'd setup a basic site easily, and the second course (which will finish on may) is going well meaning I have no problem to learn what the teachers tell me, and sometimes I find better solution than my php teacher (probably php being the language I'm most accustomed I find it easier). But apart from all the basic "garbage", all the simple exercises people do when learning and when beginning, I don't know how I'm supposed to go on. It's a fact many great coders say that I just have to begin to code, and code, and code, and I know that it is, but what code? If I should think about a real program, one of that you could be proud of it, I don't believe I know where I should begin. I also tried to read a couple of sources codes, and understanding them is one of the most difficult process I found and definitely depressing, as you think: "omg how much I'm ignorant?"; furthermore, my ideas are not clear; I would like to setup something but don't know how to put together all the things I could think, and I always think I'm forgetting something. I tried to read some documents and books about object oriented best practices, uml, design patterns, but it seems that, although all those readings make great sense to me, it stops then, I can't use nothing because I have this feeling I am still not enough good to use that and worst I am desperate to find the right track to do it, at the point I think that perhaps I'm not enough intelligent and programming is a too difficult task for me. Perhaps I should have a real job in some company where "learn" from other more experienced programmers, but companies hire just experienced programmers so what? Please can you address me in some intermediate-level activity I can take and enjoy in order to overcome this state? thanks.


Incorporating GPL Code in my Open Source Project

I have downloaded a currently inactive GPL project with a view to updating it and releasing the completed codebase as open source. I'm not really a fan of GPL though and would rather licence my project under BSD. What are my options? Is it just a case of keeping any existing non-touched code under the GPL and any updated stuff can be BSD (messy)? The source will essentially be the same codebase i.e. there is no logical separation between the two and they certainly can't be split into anything resembling different libraries. Are my only realistic options to either GPL the whole thing or seek the original author's permission to release everthing under BSD?


Should I try to write simple key-value storage by myself?

I need a key-value storage in a simplest form we can think of.   Keys should be some fixed-length strings, values should be some texts.   This key-value storage should have an HTTP-backed API. That's basically it. As you can see, there is no big difference between such storage and some web application with some upload functionality. The thing is - it'll take few hours (including tests and coffee drinking) to write something like this. "Something like this" will be fully under my control and can be tuned on demand. Should I, in this specific case, not try to reinvent bicycles? Is it better to use some of existing NoSQL solutions. If yes, which one exactly? If, say, I'd needed something SQL-like, I won't ask and won't try to write something by myself. But with NoSQL I just don't know what is adequate and what is not.


Model and ViewModel for View

I am new to the MVVM pattern. I have a window which has 3 text boxes (`Name`, `Address`, `Description`), a save button, and a listview which displays the above fields. When the save button is clicked I want to save the fields into database as well as show the record in the listview. How do I design my Model, ViewModel for this interface ?


Object Calisthenics - reducing to two attributes

I'm refactoring an expense tracker system using Object Calisthenics. I'm able to bring my Class down to five attributes. How do I go forward from here? This is my class right now.               public class Expense {         private Identifiers ids;         private AmountInCurrency amountInCurrency;         private Remarks remarks;         private UserList userList;         private ExpenseDate expenseDate;     }       Identifiers has attributes expenseId and reportId AmountInCurrency has an amount and a currency Remarks has a string with remarks. UserList has a List which is List as User has only userName (String). ExpenseDate is a Date object. Also I have a sql database where i'm storing the contents of the Expense object. Should I directly pass the expense object and retrieve the primitives or should I create an entity object which takes this expense object as a constructor argument? NOTE : This is not production code, I'm doing this just as an exercise.


Public-key cryptography security given NSA resources

I was wondering how secure public private key encryption methods are. If two individuals were sending emails back and forth forever, where each person would encrypt the body of the email they were sending with the other person's public key, would anyone be able to decrypt the body of those emails after a while? I'm assuming that each person creates their own private-public key pair and then if you wanted to send someone an email you would grab their public key and encrypt your message before sending it to them. They would then decrypt it with their own private key. Wikipedia (http://en.wikipedia.org/wiki/Public-key_cryptography) claims that its effectively impossible to decrypt email if all you know is the public key. But is this really true? What if you had the resources of the NSA, are they not able to brute force the decryption?


Where should I start and how to progress when learning Java EE

I know basic stuff like, what are beans, jsp, servlet, jsf and how this stuff should work together. I know how to make basic jsp page with database query for example. Now I need to know what is the best path to learn all this stuff. My plan is to learn in this order:   1. jsp (including persistance and JSTL)   2. servlets + beans   3. jsf   4. The jump to frameworks (hibernate, struts, spring, etc) Also I'm not exactly sure about JSF, is it a must to make great pages or is it just a convenience to know?


python vs php (for project managers)

Up to now, as a developer i preferred python for web programming and scripting. Now, i will manage some projects. I know that finding developers that know php is easier than finding developers that know python. I have a background of python, so if developers use python; i will be able to control and lead easier. This is a trade-off. What is your suggestion?


Representing and executing simple rules - framework or custom?

I am creating a system where users will be able to subscribe to events, and get notified when the event has occured. Example of events can be phone call durations and costs, phone data traffic notations, and even stock rate changes. Example of events:   * customer 13532 completed a call with duration 11:45 min and cost $0.4   * stock rate for Google decreased with 0.01% Customers can subscribe to events using some simple rules e.g.   * When stock rate of Google decreases more than 0.5%   * When the cost of a call of my subscription is over $1 Now, as the set of different rules is currently predefined, I can easily create a custom implemention that applies rules to an event. But if the set of rules could be much larger, and if we also allow for custom rules (e.g. when stock rate of Google decreses more than 0.5% AND stock rate of Apple increases with 0.5%), the system should be able to adapt. I am therefore thinking of a system that can interpret rules using a simple grammer and then apply them. After some research I found that there exists rule-based engines that can be used, but I am unsure if they fit our need as they seem more appropriate for business logic, as hinted in Does Your Project Need a Rule Engine and Jess guildelines. Is there a open source Java framework suited for this area? If anyone can point me to the correct direction, or recommend some system, that would be great! **Edit:**   Thoughts for custom solution: I am thinking of using an event-to-rule mapping, where each rule is assosicated with a set of events. Then, when an event occurs, I know what rules that can be applied. If each rule is represented by is own class, then triggering the rule is simply to execute the class. Pros: Simple and easy implementation. No need for interpretation of events to find rules Cons: Each new rule requires coding. Cannot do deduction analysis. If you see any major flaws in this approach please do tell me!


How can I convince my colleague to unit test his code?

> **Possible Duplicate:**   >  Colleague unwilling to use unit tests "as it's more to code" I've been trying in the last couple of months to convince one of my colleagues to start unit testing his code and drop the old "print, run, debug" way of doing things. I need clear and elaborated proofs that unit testing increases your productivity - this guy has a decent amount of experience and can give a counter-argument for all of the arguments I gave him until now. Unit testing is not a policy that's being enforced in the team, but is something that most of us do and it definitely worked for us, and we can see how print, run and debug isn't working for him - it's taking way too long to implement something and it's taking even longer to manually test his code.


MVC: Where should I store interchangeable algorithms used by the Model (whose names also need to be accessible to the View)?

Please consider a program, where the user chooses an algorithm from a list, and the Strategy pattern is utilized to set this algorithm as the model's operation. For example, an image procession application. There are a number of algorithms that can be used to manipulate an image (darken, brighten, contrast, etc). They are all encapsulated in objects, and the controller sets the model to use an algorithm from this list. The algorithms also need to be presented by name on the UI. This is how it will work: The user can select an algorithm from a list on the GUI. When he/she does, the controller is notified, and sets the suitable algorithm in the model. Later on, when the model is called `model.operate()`, it will delegate the operation to it's current algorithm. Classic Strategy pattern. Also, _the view needs access to the names of the algorithms_ , in order to allow the user to choose one from a list. My question is this: **Should I store the algorithms somewhere, where the controller will fetch them from when it needs to set an algorithm in the model? Or should the controller just instantiate a new algorithm whenever it needs to set an algorithm in the model?** If the answer is that it's good to store the algorithms somewhere - than where? In the model? - makes sense because the model encapsulates the business logic and data of the app. But how will the view fetch the names of the algorithms? In the controller? - makes sense because the controller is the one that sets the algorithms in the model. And also it can offer the view a method `getAlgorithmNames()`. But technically it shouldn't hold business logic objects, which is what the algorithms are. In a different class, where anyone interested can fetch the algorithms or their names from? I'm sure there have been a lot of applications where the user selects an operation, and the appropriate algorithm is set in the model. How do other applications do this?


Algorithms or patterns for a linked question and answer cost calculator

I've been asked to build an online calculator in PHP (and the Laravel framework). It will take the answers to a series of questions to estimate the cost of a home extension. For example, a couple of questions may be:   * What is the lie of your property? Flat, slightly inclined, heavily inclined. (these suggestive values could have specific values in the underlying calculator like, 0 degrees, 5 degrees, 10 degrees).   * What is your current flooring system? Wooden, or concrete? These would then impact the results of other questions. Once the size of the extension has been input, the lie of the land will affect how much site works will cost, and how much rubbish collection will cost. The second question will impact the cost of the extensions flooring, as stumping and laying floorboards is a different cost to laying foundations and a concrete slab. It will also influence what heating and cooling systems are available in the calculator. So it's VERY interlinked. The answer to any question can influence the options of other questions, and the end result. I'm having trouble figuring out an approach to this that will allow new options and questions to be plugged in at a later stage without having things too coupled. The Observer pattern, or Laravel's events may be handy, but currently the sheer breadth of the calculator has me struggling to gather my thoughts and see a sensible implementation. Are there any patterns or OO approaches that may help?


Does current JIT optimize generated machine codes for branch prediction based on runtime statistics?

Some JVMs would compile Java byte code into native machine code. We know that there are lots of optimizations we could apply for that. Recently, I also learn that a branch operation may block the CPU and affect the performance significantly, if a CPU makes a wrong prediction. Does anyone know if any JVM would generate machine codes easier for CPU making right prediction based on runtime statistics collected?


Including local headers first

So I read up on the ordering of your includes, and this guy suggested you include your local header first so as to make sure it doesn't have prerequisites. Ok, I get that. I'm on board. The whole compartmentalization thing is good. But I've got this file, file.c which includes it's `file.h`, which declares functions to save files. Which passes around the `FILE*` type used by `fopen` and friends. If I include `file.h` before I include `stdio.h` then there's an obvious parsing error when it's building `file.h` because it doesn't know about the `FILE*` type. I know I've got to be missing something dirt simple, but I can formulate this into something google can use. Should I be doing something different in `file.h`? Is this simply something that needs to be included in a specific order? Thoughts?


Should data structures be integrated into the language (as in Python) or be provided in the standard library (as in Java)?

In Python, and most likely many other programming languages, common data structures can be found as an integrated part of the _core language_ with their own dedicated syntax. If we put LISP's integrated list syntax aside, I can't think of any other languages that I know which provides some kind of data structure above the array as an integrated part of their syntax, though all of them (but C, I guess) seem to provide them in the standard library. From a language design perspective, what are your opinions on having a specific syntax for data structures in the core language? Is it a good idea, and does the purpose of the language (etc.) change how good this could be of a choice? **Edit:** I'm sorry for (apparently) causing some confusion about which data structures I mean. I talk about the basic and commonly used ones, but still not the most basic ones. This excludes trees (too complex, uncommon), stacks (too seldom used), arrays (too simple) but includes e.g. sets, lists and hashmaps.


What is the difference between a prototype and a production level solution?

This question is purely for learning and to step-up my technical understanding. I know there is no perfect solution and this question has possible never ending solution list but I think it's very important for every architect to understand the difference between demo and a live project. I created many demo solutions in .Net in the past. I now have been assigned to architect and implement a production level web solution so I wanted to ask - on a very high level, what is required to convert a demo into a production level solution. From my understanding, this will require (other than functionally implementing clients' requirements):   1. Unit testing every method    2. Ensuring ~100% code coverage is achieved   3. Logging all exceptions and possible pointcuts - possible with AOP   4. Using interface design pattern, dependency injection, possibly by using a framework e.g. spring.net    5. Using performance counters and profilers for instrumentation    6. Applying appropriate security - i.e. windows authentication (if that's whats required by client).   7. Transaction management on every single method    8. Back up of the web application files before new deployment of solution **What else?** My question is more related to technical side instead of functional/documentation because otherwise we will go into another path :-) Thank you.


Is POST for an element generally not exposed or invalid in REST APIs?

I was browsing around wikipedia on REST, reading specifically the section on REST APIs Reading the different ways to treat elements from collections I read that POST is _not generally used_. How does that work in practice? When successful REST APIs are developed, when it comes to elements, does POST just not exist or return an error? Is there a reasoning behind that I haven't grasped?


Is it practical to write exit codes in a script where the outcome is more complex than success/fail?

Where I work, we're in the process of automating a lot of tasks that currently need to be run manually by an IT person to determine if the next task can be performed (the second task depends on certain outcomes of the first task). We're ending the first phase of our script automation process, having reworked the first task to have better support for logging, error handling and even emailing a report, but we will not be able to get to reworking the second task right away so it will remain in its current state of manual use. In the meantime, it has been suggested that we implement exit codes into the first task so that we can simply chain the second task, in its current state, on a successful first task. The only issue here is that the first task is a little more complicated than just success/fail. There are many different parts that can pass that will allow the second task to be run a certain way. Now I know none of this is impossible with exit codes. We could take the time to implement the first task to return all these different exit codes so that the second task can be run in a semi-automated fashion based on these exit codes as a temporary solution to making the entire process automated until we have the time to go in and rework the second task the correct way. My question is, is it practical to take the time to implement exit codes into a script as a temporary solution to a larger problem where the script is more complex than success/fail? Note: The exit codes will take some time to implement as our rework of the first task was not designed to return exit codes (it is a self-contained script that handles its own logging and error reporting). Edit: It is a given that we **have** to go back and rework the second task in a way that the two tasks can be run independently of each other (their outcomes/state will be shared through a database). Edit: In general, I know it is useful to have exit codes, but my current situation involves spending a considerable amount of development time to go back and implement the exit codes properly (again because the outcome of the script is quite complex with many different levels of success/fail), when they aren't part of the overall solution, but a temporary hack to our new system in order to "fake" it as a completely automated system until we can actually complete the rework. I guess it's more of a "Is the time spent to implement this hack, while not a complete solution, worth it if we have to go back and undo the hack later?" question.


How to gracefully handle unsupported browsers?

Recently I have started experimenting with some of the newer W3C specifications such as WebGL and the Web Audio API that are not yet widely supported in browsers. As I want my page to look professional, I need a way to treat the unsupported browsers gracefully. Now I was wondering:   * Is there a standard or a guideline that details what a person should see when their browser does not support a certain page?    * Are there any pitfalls I should look out for when implementing a not-supported-message?    * And considering the extremely fast pace browsers release new, updated versions, how can I ensure that my script still works in future browser versions that actually do have the previously unsupported feature without blocking them?


Is executing SQL through a WebService a really bad idea?

Typically when creating a simple tool or something that has to use a database, I go through the fairly long process of first creating a webservice that connects to a database then creating methods on this webservice that do all the type of queries I need.. methods like               List<Users> GetUsers()     {         ...     }     User GetUserByID(int id)     {           ...     }     //More Get/Update/Add/Delete methods      Is it terrible design to simply make the webservice as secure as I can (not quite sure the way to do something like this yet) and just make a couple methods like this               SqlDataReader RunQuery(string sql)     {          ...     }          void RunNonQuery(string sql)     {          ...     }      I would sorta be like exposing my database to the internet I suppose, which sounds bad but I'm not sure. I just feel like I waste so much time running everything through this webservice, there has to be a quicker yet safe way that doesn't involve my application connecting directly to the database (the application can't connect directly to database because the database isn't open to any connections but localhost, and where the appliction resides the standard sql ports are blocked anyway) Especially when I just need to run a few simple queries


Best practices in comment writing and documentation

Commenting nowadays is easier than ever. In Java, there are some nice techniques for linking comments to classes, and Java IDEs are good at making comment shells for you. Languages like Clojure even allow you to add a description of a function in the function code itself as an argument. However we still live in an age where there are often obsolete or poor comments written by good developers - I'm interested in improving the robustness and usefulness of my comments. In particular I'm interested in Java/Clojure/Python here, but answers don't need be language-specific. Are there any emerging techniques that validate comments and automatically detect either "flimsy" comments (for example comments with magic numbers, incomplete sentences, etc..) or incorrect comments (for example, detecting mispelled variables or the like). And more importantly: Are there accepted "commenting-policies" or strategies out there? There is plenty of advice out there on how to code - but what about "how to comment?"


Atomic Memcache Operations in PHP

This post is a follow up to this question: PHP Atomic Memcache on StackOverflow. Considering I am using Memcache (no d at the end) on PHP 5.3.10, I implemented a custom locking system where a client will wait until a lock key is destroyed before it begins to modify a key on memcache. So:               Client 1 connects, checks for an active lock on key 1, finds none, and gets the data     Client 2 connects a few microsecond after Client 1, requests the same data from key 1,        but finds a lock     Client 2 enters a retry loop until Client 1 releases the lock     Client 1 saves new data to key 1, releases the lock     Client 2 gets the fresh data, sets a lock on key 1, and continues      This works 90% of the time. It would work 100% of the time if two requests are made far apart from each other (say 500ms). But lets say two requests are made at almost the same time (10 to 100 microseconds apart) the above solution fails, and both clients write to the same key, resulting in incorrect data. I have tried many things, including a loop that varies in wait time every iteration:               while(/*lock key exists*/)     {         usleep(mt_rand(1000,100000);     }      This helps only a little. What would be the solution to this particular issue? These mecache processes must be atomic. I am willing to tolerate a 1% failure rate (since it means I just need to work a little harder to make it 0), but anything more is just too risky. I've broken my head trying to figure this out. There is no possibility to upgrade to Memcached, and the value changes are not simple (they are not increments)


How to give life to my idea which belong to my company?

I wonder, what options do I have in the following situation. In the course of the several projects I realised the need in some auxilary software product (related to testing of the main products). I applied a creative approach to the matter and implemented a system which I think has a potential and looking promising (maybe not on the market but at least among some interested supporters). I have even more ideas related to this system and continue developing at my free and work time. It has become a work and hobby at the same time. Unfortunately, this work basically has nothing in common with the company's business and there is no way this will be organized in a form of standard development process and be presented to costumers as a product. What can you suggest in this situation? How to avoid breaching of contract? Have you had something similar in your career? What if my intention is to develop it as an open source project?


Quantifying the price for source code and software product

I'm about to undertake a project. This requires me to write code, and tons of it. The client's requirement is to hand in all source code at the end of the project. My question is: How do I quantify the price for source code and the software product? Is there any metric that one follows to determine pricing? How would I quantify the software product? _Extra info:_ The application must run anywhere, in any OS, including tablets (iPad, Galaxy tabs, etc.), Smartphones (iPhone, Android phones, etc.) and also on the web. _(Now, imagine how much code this will be)_.


C# type system and dynamic type

I'm writing a paper about the C# (and Go) type system with focus on the dynamic aspect. Does anybody have suggestions for papers/literature? The things I found don't go much into detail. I would like to add some paragraphs on how it's implemented, comparisons with other languages, speed, memory allocation etc.


Reflective practice in programming using keystroke playback

I'm thinking of applying Reflective Practice to improving my programming skills. To that end, I want to be able to watch myself writing code. In general, what is a good method for applying Reflective Practice to the craft of programming? In particular, if it's a good idea, is there an editor that records keystrokes then plays them back at a later time - possibly running the keys together without delays, or replaying at a 2x/4x/8x accelerated rate? Screencasting with RecordMyDesktop is an option, but has downsides of waiting for encoding and ending up with a big video file instead of a list of keystrokes. * * * _Update_ : From "watching myself code" I expect to learn what kind of mistakes I make most frequently or where I waste time while coding. Then I can work on improving those aspects. It could be certain formatting, syntax or runtime errors, or maybe long pauses that indicate I hadn't considered some issue before I started coding, or maybe I re-write entire functions because my initial design was wrong. I understand that there's a lot more to programming than the act of writing code and this won't capture all of it. As recommended I should make more design notes and reflect on those too. Recording keystrokes may be more helpful to improving my technique in time- limited programming contests, and less helpful for improving day-to-day programming at the office.


Are you a functional programmer?

Are you a functional programmer? By that I mean   * employed full time   * paid by someone else   * using a recognized functional language (Haskell, Scala, Erlang, F# etc, not just using FP techniques in an imperative language like Javascript) If so, what do you do, and how did you get there?


Studying parallel programming

I'm currently finishing my Bachelor's degree in Computer Science and thinking a lot about which specialisation to choose in my Master's degree. One subject I'm particularly interested in is parallel programming. However, this topic does not seem to be a standard topic in Computer Science degrees, although it is something that is used more and more - new processors nowadays are usually dual or quad cores. So I was wandering: does anybody know a good study program in this field? I was mostly looking for it at universities in Germany, but they tend to combine the application side with some type of engineering or natural science. Thus, programs are more the "Computational Engineering" or "Computational Science" type, but I'm more interested in the Computer Science part of it, i.e. parallel programming, languages and compilers, algorithms and hardware.


Is a program linked against an LGPL library in linux still under GPL?

If I were to write say, an embeded linux video server, how much of the code do I have to offer to someone who requests the source? Do I have to offer the code that directly links against the GPL covered code or do I have to offer all code? For instance, if I use gstreamer, or any other LGPL code, on a linux platform in my program, does all of my code become under GPL simply because somewhere in the chain, the LGPL program had to link agaist GPL code? I guess this is an extension of the question. Can you write a C library that compiles in linux that does not become subject to GPL?


Should refactoring be the exception or the rule?

I had a discussion with a co-worker yesterday about design philosophy. The other coder is more experienced then me, and I fully admit that he is likely much better at properly automating his testing, which I'm just now trying to break sloppy habits. However, it seems that some of our dispute is a philosophical issues where I'm unwilling to simply yield to his greater experience. Generally he is a Directing programmer, who follows all of the formal approaches. He has interfaces for nearly every class and has automated tests for everything down to getter and setters on basic POJO objects. He sees refactoring as a dirty word which is a sign that things weren't written/designed properly from the start, it’s inevitable and done as necessary but everything should be done to avoid having to do it and you should feel bad when you have to. I feel I'm a more flexible/Enabling programmer. I feel that interfaces should be used as necessary, but not thrown in until they are needed (KISS), and that it's easy enough to pull an interface out of an existing object by refactoring if you decide an interface/polymorphism makes more sense later. I also felt that, while I admit I need to be better at testing then I am currently, the level of automated tests he suggested seemed too rigors since it would take so long to implement and, more importantly, make refactoring a nightmare since I wouldn't be free to modify the behavior of any non-private method. As my requirements grow and change I find myself refactoring heavily and that level of testing feels like it would kill my flexibility. His view is that I shouldn't _be_ refactoring so it doesn't matter if the tests make it harder to do. Ultimately all of the other philosophical discussions seemed to boil down to the word 'refactor'. I love refactoring, I feel it should be used liberally any time you feel that something isn't quite as clean and beautiful as it should be, and that the natural course of growing a program or adding new requirements will necessitate refactoring to better enable code reuse, moving logic to new classes/packages as it grows more complex, and yes fixing inevitable design mistakes which will happen from a flexible agile development approach (and that’s not always bad if your code is written to allow modification!). He disagrees with all of that. I'm wondering what other's thoughts are on refactoring. How common should it be? Is writing code with a philosophy of "I'm doing it simple now, I can refactor it later if more complicated logic proves necessary" inherently flawed/dangerous? Does acceptability of refactoring depend on program approach and style? I generally am on rapid prototyping or “clean up this ugly, but working, prototype some non-engineers wrote”, while it sounds like he actually gets to do formal programming with official requirements that don’t change; I’ve never once had a job like that myself!


Kibibtye or Kilobyte to represent 1024 bytes

I am working on a project with several older programmer and we were doing up the documentation of the program when I had a heated debate with one of the older programmers regarding the term : `Kilobyte`. He wanted to stick to the old way of using `Kilobytes` to represent 1024 bytes as he said most programmers understood the term : Kilobyte to represent 1024 bytes. I wanted the new way of using `Kibibyte` to represent 1024 bytes as we can't forever be stuck in our old ways and this has been updated by the community. How should I resolve this conflict with him so as to appease both of us ??


Is there a named antipattern for unclear API not exposing the requirements?

In the source code I'm evaluating (jarjar), there exists java code that can be used like this:               JarJarTask fixture = new JarJarTask();     fixture.addConfiguredRule(new Rule());     fixture.execute();      Which will throw an exception like:               java.lang.IllegalArgumentException:     The <rule> element requires both "pattern" and "result" attributes.      Now, to me it is clear that the API is less than optimal here - if the rule element requires these attributes, it should ask for them in the constructor (or provide a Builder or similar that would require them). But I was unable to find coding conventions or java programming recommendations to agree with me. Is there some specific name for this that I can use to look this up in research, programming literature, style guides? Which terms could I use to find some discussion on this? Surely it's been discussed somewhere using some terms, but I seem to be unable to find anything. * * * I did find discussion around constructor injection as presented by Kent Beck in Smalltalk Best Practice Patterns and supported by Martin Fowler, which, according to this, makes it "immediately clear what a class requires when it is instantiated, and furthermore it is impossible to instantiate the class without passing in the field’s objects". So that's a starting point at least to find some discussion.


C++ Building Static Library Project with a Folder Structure

I'm working on some static libraries using visual studio 2012, and after building I copy .lib and .h files to respective directories to match a desired hierarchy such as:               drive:/libraries/libname/includes/libname/framework          drive:/libraries/libname/includes/libname/utitlies          drive:/libraries/libname/lib/...      etc I'm thinking something similar to the boost folder layout. I have been doing this manually so far. My library solution contains projects, and when I update and recompile I simply recopy files where they need to be. Is there a simpler way to do this? Perhaps a way to compile the project with certain rules per project as to where the projects .h and .lib files should go?


Do I need to notify a user if I am using statistics software in an iPhone app?

I am currently creating a (very simple) Objective-C client to send basic statistical data to my server for an iPhone app - just things like the state of the app (first-launch or launch, error, etc), along with the make/model/version (i.e.: "iPod touch 4.2"). No personally identifiable information or location data is sent. Is there anything, in the Apple Developer agreement or otherwise, that states that I must notify the user if I am doing this? I'm not interested in selling the data or anything, I just want to use the data to make my apps better. I am not adverse to telling the user I am doing this if it is required, I just don't want to scare the users (the paranoid "oooh, they're tracking me, they know exactly where I am" crowd) if I don't have to. Thanks for any advice.


Start with open source desktop application and move to iPhone/Android app

I'm a high schooler and I am competing in an open source software development competition. It must be a desktop application that runs on either Windows or Linux. I have a great idea for the open source desktop app, and I wanted to know if I could take it farther and port it to the iPhone or Android platform and make money (preferably through $.99 cost, not ads) I read somewhere that certain open source licenses allow me to do this... am I correct?


Best way to display domain object summary information efficiently and in an OO way from a large inheritance tree?

**I've provided only simplified code as it's more of an abstract design question.** So I have many, many nested business/domain event objects, e.g.                public class Event      {       //bunch of properties and standard accessors      }           public class ExplosionEvent extends Event      {       //properties and standard accessors       }      And many more of these at different levels. If I need information about any given object chosen, I display it in HTML like so                private String generateHTML(Event event)      {         StringBuilder sb = new StringBuilder();             sb.append("
");//simplified             sb.append("Time	");           sb.append("" + event.getEventTime() + "	");             if (event instanceof ExplosionEvent)        {          //append HTML and ExplosionEvent specific data        }             // ...many, many more calls like the one above             sb.append("
");      }      As I have many event types, this means loads of duplicated HTML table tags and uses of `instanceof` so `generateHTML` is hundreds of lines long, split into methods of course but still, it's a lot of code that makes this hard to understand, navigate and therefore maintain. This is ugly and I need a better design for this. I had the idea of creating a method on `Event` which is overridable by all sub methods               //Using LinkedHashMap to preserve order as Properties wont do that     public LinkedHashMap<String, String> getAttributes()     {      LinkedHashMap<String, String> list = new LinkedHashMap<String, String>();           list.put("Time", eventTime);     }      sub-classes then override this, call their parent and add date specific to them to the list meaning that no matter how many `Event` classes there is, the existing `generateHTML` method (external to `Event` objects) will then simply be one small loop               private String generateHTML(Event event)     {       StringBuilder sb = new StringBuilder();            b.append("
");            for (Entry<String,String> entry : event.getAttributes().entrySet())       {         sb.append("" + entry.getKey() + "	");            sb.append("" + entry.getValue() + "	");       }            sb.append("
");     }      Is this putting too much logic in business/domain objects? **Is there a better way**?


How essential is it to make a service layer?

I started building an app in 3 layers (DAL, BL, UI) [it mainly handles CRM, some sales reports and inventory]. A colleague told me that I must move to service layer pattern, that developers came to service pattern from their experience and it is the better approach to design most applications. He said it would be much easier to maintain the application in the future that way. Personally, I get the feeling that it's just making things more complex and I couldn't see much of a benefit from it that would justify that. This app does have an additional small partial ui that uses some (but only few) of the desktop application functions so I did find myself duplicating some code (but not much). Just because of some code duplication I wouldn't convert it to be service oriented, but he said I should use it anyway because in general it's a very good architecture, why programmers are so passionate about services?? I tried to google on it but I'm still confused and can't decide what to do.


How to get contributors assign copyright for copyright holder?

Let's say we have a company and we release our project under LGPL && GPLv3, as you know the only thing here is about contribution. People commit bug- fixes/features to the project, it's fine and we are GPL fans. Basically company makes money by this project. So what about contributors ? I know they commit code and software get better and it is actual repay to them, But how we can get contributors assign copyright for copyright holder?


Overriding GetHashCode in a mutable struct - What NOT to do?

I am using the XNA Framework to make a learning project. It has a Point struct which exposes an X and Y value; for the purpose of optimization, it breaks the rules for proper struct design, since its a **mutable struct**. As Marc Gravell, John Skeet, and Eric Lippert point out in their respective posts about `GetHashCode()` (which Point overrides), this is a rather bad thing, since if an object's values change while its contained in a hashmap (ie, LINQ queries), it can become "lost". However, I am making my own `Point3D` struct, following the design of `Point` as a guideline. Thus, it too is a mutable struct which overrides `GetHashCode()`. The only difference is that mine exposes and int for X, Y, and Z values, but is fundamentally the same. The signatures are below:               public struct Point3D : IEquatable<Point3D>     {         public int X;         public int Y;         public int Z;              public static bool operator !=(Point3D a, Point3D b) { }         public static bool operator ==(Point3D a, Point3D b) { }              public Point3D Zero { get; }              public override int GetHashCode() { }         public override bool Equals(object obj) { }         public bool Equals(Point3D other) { }         public override string ToString() { }     }      I have tried to break my struct in the way they describe, namely by storing it in a `List<Point3D>`, as well as changing the value via a method using `ref`, but I did not encounter they behavior they warn about (maybe a pointer might allow me to break it?). Am I being too cautious in my approach, or should I be okay to use it as is?


Designing models for a generic service layer

We are building a web interface to a tiered membership system, which will interface with a third-party CRM web service for the creation and management of accounts. The web service, unfortunately, is not yet built; however, we need to begin work. I have created an interface, `IMembershipService`, in which I am beginning to define "best-guess" prototypes, so we can begin building our User Controls. Most of these methods will return some data bundled in a Model object, e.g.:               ContactModel GetContact (string userId);      When the web service methods become available, I will create a concrete implementation of `IMembershipService` that will wire up the controls to the web service. The problem I have is that I don't yet know whether the web service will consist of:   * calls returning complex objects; e.g. a `User` object with a nested `Membership` object, which, in turn, has a nested `PaymentMethod` object   * simple calls for specific pieces of information; e.g. `String GetUserMembershipType (string userId);` This is causing me to have trouble specifying the structure of the models and interface, which is causing problems for the developers beginning work on the User Controls:   * If the service returns complex objects, I don't want my `IMembershipService` methods to be too simple, forcing me to use multiple web service calls where it is not necessary.   * If the service consists of simple calls, I don't want to have a load of complex models defined that I then can't implement, thereby having to do a load of refactoring. In theory, creating `IMembershipService` should allow me to abstract away from the actual nature of the web service, but the fact that each call to a method in `IMembershipService` will, ultimately, result in a web service call, thereby adding overhead, is making this difficult to spec. How can I design my models and `IMembershipService` in order to minimize the amount of refactoring I have to do when the nature of the web service becomes less elusive?


Value passing by reference

What's the key deference between passing by reference and passing by value in PHP ?               function ( &$var1 ,$var2)     {           var1[$x]...          }      Function that passes an array by reference and value, what would the impact be.


What's better right now: IronRuby or IronPython?

I have plenty of experience with both Ruby and Python, and I'm looking to embed either one of these on a C# application I'm developing. I don't really care which, but I'd like to know which one currently has better support and is overall less buggy, and is the easiest to implement and deploy. I also took a good look at Boo, which I'm also messing around with. C# Is too complicated and verbose, so I'm leaving that as the last option. As for what I'm doing, I need to extend some classes in a friendly and dynamic way, without the need to recompile. They will also need to have access to a data structure created on the C# side of the code. So, any recommendations on which should I use?


jQuery - programming style - many bindings vs. conditional single one

I frequently see code like that:               $("#foo").live("mouseover mouseout", function(e) {         if (e.type == "mouseover") {             $("#foo").append("
");         } else {             $("#bar").remove();         }     });      instead of more self-explanatory in my opinion:               $("#foo").live("mouseover", function(e) {         $("#foo").append("
");     })     .live("mouseout", function(e) {         $("#bar").remove();     });      the same goes with               $('#contentPageID, #itemURL').change ( function () {         if ( $(this).is('#contentPageID') )             ...         else             ...     });      does it have any purpose or is it just different coding style (counter intuitive in my point of view) ?


Will Java still be relevant in 5 years?

Will Java have the same importance it had in the past, or it will be less relevant than nowadays?


Oracle Database Integration with Team Foundation Server?

So my company is using TFS and SQL to Manage their Database (MS SQL Server). It integrates with the nightly build servers to do builds and produce scripts to build the entire Database. Also the Compare Schema tool that visual studio offers is really handy. We want to do the same with Oracle, Preferably with TFS if that's even possible. It can be done without, but is this a possibility? Also are there any tools to assist in automatically creating the Database in a Nightly Build? What about Managing Upgrades? Our Big worry is moving triggers and the MS SQL Service Broker to Oracle... this we might have to do manually though.


From this question, I have another question about...   How long and what type of complexity would have been involved in Chris Sawyer writing most of rollercoaster tycoon in assembler? In order to specify and break this question down, I am interested in;   1. Approximately how many man hours (have a guess) do you estimate it would have taken Chris to write the game by himself? Or alternatively give an approximate percentage of the ratio of assembler coding hours to say, writing the whole thing in C/C++.   2. Do the programmers that know assembler well think of this as an overly complex task for such a low level language abstraction? Apart from performance benefits is this just a freakish natural ability that Chris has, or a skillset worthy of learning to that extent? I'm interested if people think the complexity/performance thing is worth learning assembler that well (in order to write), or is it only "worth it" if you have a lot of naturally developed skills in assembler (presumably from working with hardware/hardware drivers/electronics/etc).


Object identification in Python

In learning Python, I found that when two "names" (or "variables") are assigned to the same value, both of them point to the same memory address. For example               >>> a = 10     >>> b = 10     >>> a is b     True      My question is, when assigning `b`, how does Python figure out that a `10` object already exists? One way might be to create the new object for `b`, scan pre-existing objects in memory to find a duplicate and, if found, point `b` to it. This sounds expensive, and tricky for more complex objects.


Is error suppressing bad practice?

On a SO question I asked here about some code I was unsure about, someone replied "BTW, horrible code there: it uses the error suppressing symbol (@) a lot." Is there a reason why this is bad practice? With things like:               $db=@new mysqli($db_info) or die('Database error');      , it allows me to display just a custom error message. Without error suppressing, then it would still display the typical PHP message of: **Warning** : mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: No such host is known. in **some\file\path** on **line 6** as well as 'Database error'. Is error suppressing _always_ bad, and if so, what specifically about the above is bad? Update: the actual code that I'm using is:               or error('Datatabase error', 'An error occurred with the database' . (($debug_mode) ? '
MySQL reported: ' . $db->error . '
Error occurred on line ' . __LINE__ . ' of ' . __FILE__ . '' : ''))      which removes all previous output and displays an error message. So the fact that the error message doesn't include details about what specifically happened (which people seem to be suggesting as a reason why error suppressing is bad) is irrelevant.


Best practice Java - String array constant and indexing it

For string constants its usual to use a class with `final String` values. But whats the best practice for storing string array. I want to store different categories in a constant array and everytime a category has been selected, I want to know which category it belongs to and process based on that. Addition : To make it more clear, I have a categories `A,B,C,D,E` which is a constant array. Whenever a user clicks one of the items(button will have those texts) I should know which item was clicked and do processing on that. I can define an `enum`(say `cat`) and everytime do               if clickedItem == cat.A      ....     else if clickedItem = cat.B      ....     else if       ....      or even register listeners for each item seperately. But I wanted to know the best practice for doing handling these kind of problems.


Interview question ranking FizzBuzz (1), implementing malloc (10)

I'd like to have your opinion on the difficulty of the following interview question: **Find the contiguous subarray with maximum sum in an array of integers in O(n) time.** This trivial sounding problem was made famous by Jon Bentley in his Programming Pearls where he uses it to demonstrate algorithm design techniques. On a scale of 1-10, 1 being the FizzBuzz (or HoppityHop) test and 10 being implement the C stdlib function malloc(), how would you rank the above problem? I think the people who can best answer this question are those who have read Programming Pearls and have tried to solve this problem on their own. To motivate those who haven't, 'Programming Pearls' gets featured many times in the 'Top 10 programming books' list. A couple of comments might help get a better rating:   * Implementing malloc() is not as formidable as it seems. See K&R's C Programming Language for example. It sometimes gets asked at Microsoft.   * CLRS observation on problem solving: **_it is often more difficult to solve a problem from scratch than to verify a clearly presented solution, especially when working under time constraints**._


Are there any good examples of open source C# projects with a large number of refactorings?

I'm doing research into software evolution and C#/.NET, specifically on identifying refactorings from changesets, so I'm looking for a suitable (XP- like) project that may serve as a test subject for extracting refactorings from version control history. **Which open source C# projects have undergone large (number of) refactorings?** **Criteria** A suitable project has its change history publicly available, has compilable code at most commits and at least several refactorings applied in the past. It does not have to be well-known, and the code quality or number of bugs is irrelevant. Preferably the code is in a Git or SVN repository. The result of this research will be a tool that automatically creates informative, concise comments for a changeset. This should improve on the common development practice of just not leaving any comments at all.


2D Game Data Structure in OpenGL ES 2.0

I'm trying to come up with some data structures for rendering my map on OpenGL. It is going to be ~ 100x100 blocks(squares) total, with each block being around 100 pixels. However, the screen will only display about 20x10 of these blocks at a time, depending on character location. So from this post: http://stackoverflow.com/questions/19979031/android-only-game-in-opengl- performance-in-c-ndk-vs-java-dalvik?newreg=53760d542cb94d05afe42faa39d1aef6 It says that I shouldn't do a lot of allocation with ByteBuffers. So here are approaches I came up with:   1. Allocate all 10,000 blocks, and simply change the vertices on every frame, for the ones I need to display. So no dynamic allocation, but a lot of up-front space.   2. Only allocate blocks as I need them. So if in a frame I move left, and have to display new blocks, I will allocate 10 blocks in OpenGL. That way I have less memory allocated at once. However there is dynamic allocation and I need to set up the textures on every frame.   3. Cache a few blocks of each type, and update the vertex information for them as I need them, that way I don't need to allocate a lot in the beginning, and I don't need to allocate anything dynamically. (So have 100 wall blocks, 100 door blocks, 100 floor blocks, all set up from the beginning) Are any of these approaches the right way to go about doing this? Or how would one go about displaying a bunch of Bitmaps and updating their location on every frame? Or is Java a bad idea from the beginning, even for a simple 2D game?


Is it common for the founder of a web app to lack technical expertise to scale it?

When I look at things like Twitter, it seems like the idea is so simple to implement initially that the founder does not have to be very technically talented. Basically it's just a guy with a good idea. But when an app / software blows up and entails much harder engineering problems, how does the founder deal with it? Have we seen cases in which the original guy with the good idea somehow falls off the enterprise as it becomes more about technical challenges and less about ideas?


Should I insist that we perform code reviews before merging back to trunk?

Requested re-post from StackOverflow: I'm working in a small development time with very limited time for development. We develop a tool that is important for the result of our work, but not used daily. I am the only person in the team that has a background as a programmer. My problem is that I have been pushing for code reviews before merging back to trunk for over a year. Everyone agreed on this, but still it's only my code that has been reviewed. Returning from a long vacation I come back to a trunk with code comments as "this is an ugly solution - remove as soon as possible" and "quick fix". What also is new is that a guy has been appointed the responsibility for the tool. (A role that first was offered to me but I turned down due to a non work related reason.) And he thinks that this is an ok way to work: As we have such limited time to develop, we should cut corners like that. My concern is that the other developers write ugly code: often breaking encapsulation, writing huge classes, adding internal classes at strange places, having few or no unit tests, and so on. It will eventually be impossible to develop the tool further. Should I insist that we perform code reviews before merging back to trunk or am I just a code quality bitch?


How to manage a project in school?

I just started doing PhD and we are supposed to do a project for a class, there are 14 people taking the class and we are supposed to develop a system all together. I was away from academia and working in the industry before, and I know it is very hard to manage even a couple of people towards the same goal. We are going to make the first meeting in a couple of weeks. First, I will suggest using a version control system like SVN. Second, I will try to take the lead for the architecture of the system, because I think I am more experienced. Since the class is about _computer vision_ and I anticipate that most of the people's background is research related so there is a big chance that I am more experienced. I will gladly hand architecture to someone else if he/she is more experienced. What else should we do to progress without much hassle? PS. You can assume every one of us is going to work remotely, and meet once in a week at it's best (not everyone will attend though). And the project needs to be finished in 2 months. It does not need to be a perfect, complete product, we just need to make a prototype. PPS. The aspects of the group reminds me of open source project groups, maybe the answers will be helpful for those groups as well.


Do functional generics exist and what is the correct name for them if they do?

Consider the following generic class:               public class EntityChangeInfo<EntityType,TEntityKey>     {         ChangeTypeEnum ChangeType {get;}         TEntityKeyType EntityKey {get;}     }      Here `EntityType` unambiguously defines `TEntityKeyType`. So it would be nice to have some kind of types' map:               public class EntityChangeInfo<EntityType,TEntityKey> with map        < [ EntityType : Person -> TEntityKeyType : int]         [ EntityType : Car -> TEntityKeyType : CarIdType ]>     {         ChangeTypeEnum ChangeType {get;}         TEntityKeyType EntityKey {get;}     }      Another one example is:                public class Foo<TIn> with map     < [TIn : Person -> TOut1 : string, TOut2 : int, ..., TOutN : double ]       [TIn : Car -> TOut1 : int, TOut2 :int, ..., TOutN : Price ] >         {             TOut1 Prop1 {get;set;}             TOut2 Prop2 {get;set;}             ...             TOutN PropN {get;set;}         }      The reasonable question: how can this be interpreted by the compiler? Well, for me it is just the shortcut for two structurally similar classes:               public sealed class Foo<Person>     {         string Prop1 {get;set;}         int Prop2 {get;set;}         ...         double PropN {get;set;}     }          public sealed class Foo<Car>     {         int Prop1 {get;set;}         int Prop2 {get;set;}         ...         Price PropN {get;set;}     }      But besides this we could imaging some update of the `Foo<>`:               public class Foo<TIn> with map         < [TIn : Person -> TOut1 : string, TOut2 : int, ..., TOutN : double ]           [TIn : Car -> TOut1 : int, TOut2 :int, ..., TOutN : Price ] >             {                 TOut1 Prop1 {get;set;}                 TOut2 Prop2 {get;set;}                 ...                 TOutN PropN {get;set;}                      public override string ToString()                 {                      return string.Format("prop1={0}, prop2={1},...propN={N-1},                                              Prop1, Prop2,...,PropN);                 }             }      This all can seem quite superficial but the idea came when I was designing the messages for our system. The very first class. Many messages with the same structure should be discriminated by the `EntityType`. So the question is whether such construct exists in any programming language?


Good practice or service for monitoring unhandled application errors for a small organization

I'm working with multiple software with varying ways of monitoring for errors. When I make software, I usually send email with the stack trace to admins(usually me). Some customer software is monitored by a team who check that a particular batch run was successfull. Other software might not have any monitoring at all(someone will call when things go wrong horribly). Sending emails is good, except when things start going wrong, my mail gets filled fast. Also I don't want to solve the same problem in code for every software. Is there some relatively cheap and low maintenance software or practice to handle this. I want it to be cheap/low maintenance because usually I work alone or in teams of 5 or smaller. For example it would be great if errors would be aggregated so I don't get 10 000 emails when something unexpected happens... For clarification: By unhandled errors I mean Exceptions that were unhandled by application code that were propagated to Tomcat or Jboss. I don't need help with how to catch those errors. I need help with what to do with them. Is there any cloud application that I could send my errors to? Or some simple server to install? Or some library that can handle errors using configuration files. I use Java if that is any help.


How do I determine if my code is optimized?

I am only developer working on a project. The functionality that I have coded works to expectations(desired result) but since I am the only one I don't know if I can do anything better to it. How do I determine if my code is optimized (I want to increase the performance of some features)? One thing that comes into mind is _Code Review_ but there is no one free over here to review my code. I just keep on trying with alternate logic but at times things get stagnant and really dirty. Is there any other possible way?


Datastructure for a factory pattern in practice

I'm implementing what's basically an event log system for a larger system. I used Single-table inheritance to build out the table. The problem I'm having is figuring out how to build out the classes from the database. It's easy enough for me to figure out what they are to load them into the database, but to pull them out and create objects and collections out of them is a little trickier. The only way I know of is to have a switch statement and hope that if someone implements a new object that they'll update the switch, but that doesn't seem practical. I'm sure I'm getting something wrong about how I'm thinking of the factory pattern here.


Choosing a licence for open source projects

I've done some open source projects, and I plan to do more in the future. So far, I've released all my code under GPL, but I've read a few articles which claim GPL is too restrictive for any code to be used in corporate environment. This, supposedly, reduces contributions. Here's what I wanted to accomplish: For **full applications** :   * no commercial use with the exception of selling _support_ for the application (i.e. the app cannot be sold, but everything around it can) For **libraries** (components, plugins, ...):   * can be included into commercial projects **without modifications**   * any modification the the library/component must be open sourced (contributed back) - the rest of the project, commercial or not, is not affected For applications, GPL still seems the logical choice. For libraries, my primitive understanding of licences makes me think that LGPL is a good match, but, I'm not sure. I've looked at MIT licence, and that seems too permissive. Most of the time, I want people to use my code anywhere they want to, as long as any improvements are contributed back. This brings me to my question(s): is LGPL a logical choice for open source libraries, components, plugins etc? Is there a better alternative? Is GPL a good choice for my applications or is there something better? **Update:** For those who are interested in my final decision, I've decided to release my libraries under multi-license scheme, MPL, LGPL and GPL. This enables virtually _everyone_ to use my code with no obligations, unless they modify it under MPL, in which case it would have to be contributed back. This means the code can be used by both FSF and proprietary software, but "bad" commercial exploitation is prevented (or so I'd like to think).