title: How important is it to finish projects?

text: I'm a student (yet to go to uni) and I've been programming for about 5 years now. Over that time, I've flitted around from language to language, from API to API, and project to project. I've tried setting myself on one thing, but I lose interest. My entire PC is full of half finished projects (and at least four times as many have been formatted off my disk). I start to wonder if my lower motivation towards programming for the fun of it (it is one activity I really enjoy) is because I never get a finished project at the end. I can't tell if I just have too open ended goals, or just a low attention span. I tried doing some smaller projects just to finish them, but they do not interest me at all. Could this be a cause for my drop in motivation? Also, when I apply to go to uni (and in the future hopefully, a software job) is it likely to be an issue? **In summary:** _How important is it to finish side/hobby projects, be it for career, motivation, or education?_


title: Learning MFC: Pre-2010 vs 2010 and beyond

text: First, some background: I've been programming for about 12 years now. I am intermediate to advance in C# and a couple other managed languages, but never messed with anything native. I understand the concepts, just never had the time to dip into C/C++ and the like. Now, I am currently enrolled in the Game & Simulation Development course at DeVry, which gave me access to VS2010 (Finally!). After playing around with it, I noticed the default templates for MFC are...well, beyond words. (In a good way. - Referring to the wizards that generate a VS or Office-like interface for you.) Now that I've seen what is possible with MFC, I would love to learn how to use it to make awesome tools, but I don't know where to get started. The MSDN tutorials are pretty much useless, and I've been told that Ivor Horton's VC++ 2010 book is the best, but it doesn't seem to take into account (at least to me based on the more complext UI) the complexity that's added with what the new wizards generate. So I really have 2 questions:   One, is what is taught in his book sufficent for MFC in general? That would assume the "complexity" I'm perceiving is just cold feet. Two, does anyone know of a good resource to learn how to work with MFC that use the new VS and Office-like interfaces? Thanks ahead of time. **UPDATE** : It seems most of you guys are vehemently opposed to using MFC, so I'll add a bit to this question. The reason I want to use MFC is because the Visual-Studio-like interface seems like a very efficient way to lay out a lot of tools like the property view and such. The MFC wizard in VS2010 gives me all this by default. My ultimate goal is to create an application similar to GameMaker, but with a VS-like interface. (Personal improvement project; I know it's been done to death.) So with that said, is there a way to create a Visual Studio-like shell application without MFC (maybe using Qt, or even with the VS2008 shell)?


title: Options for a lead programmer who prefers programming to leading?

text: At the beginning of this year I was promoted to a lead developer role after our team's lead developer moved to a different department. I have about 5 years of job experience and due to availability and past performance I was management's primary choice for leading the project. I was a little apprehensive but decided it was a good opportunity for career advancement and experience, so I accepted. But my conclusion so far is that I don't enjoy it nearly as much as my previous developer position. Though I have successfully led a team of 5 developers through several releases, I almost never touch any code. Instead I perform planning and design and team management, along with code reviews. The need to keep track of many more things, and have tasks planned so they can be assigned to the team, literally gives me headaches most every day. Even though I rarely work overtime, I feel burnt out most every day when I leave work, and don't think I have even enjoyed off-work time as much as a result. So my question: **how would you handle, or how have you handled, such a situation?** For people in similar situations, did you find ways to better manage your team, tasks and time that made you enjoy the work? Or did you find a way to transition back into a more development-oriented position? I know that lead developer positions almost always pay a higher salary, but I can see myself getting to a point where I care less about money and promotions than I do about my enjoyment of my current job. I have not discussed this with anyone in management as I thought I should try to adjust for at least a year.


title: Multithreaded file copy

text: There is an utility we have which is used to upload files (and perform other operations on the file) to a network shared location.   The file size tends to vary from a few mb to 500 mb.   A suggestion has come up that we should maybe support multi-threading when uploading the files to the shared location - not required to do it in byte chunks - each thread should pick one file and try to upload. I am not so sure if multithreading can speed up IO operations like this. Is my hunch valid? If indeed we are required to build this functionality I was wondering what would be a good design approach for the copy file engine?   Would it make sense to use a tool like robocopy (I read the newer versions support multithreading)? Edit: Apologies for the delay and missing some vital information.   This utility is built using C# (.Net 2.0) and any future update also has to be using .Net (framework version is not a constraint). The utility is installed on the machines of the users (around 20 all on WinXP). The target share is on Win2k3 server. Edit 2: have decided to run some tests with a simple application implementing the file upload through TPL. Post this analysis we will decide whether to go ahead or not. Thanks everyone for the help extended.


title: In programming light, what is special about the number 1223?

text: Just came across this post on reddit, where someone was charged $1,223 for a "FREE STEAK SALAD". ![enter image description here](http://i.stack.imgur.com/yK7sy.jpg) I was trying to figure out 'Why 1223?' thinking that this might be a programming error somewhere. But 1223 seems to be pretty much an ordinary number (= 100110001112). Any ideas?


title: Should the database of a web application be considered an actor?

text: I'm just learning about use-case analysis and use-case diagrams and am a little confused whether or not the MySQL database of a web app should be considered an actor. Is the databased considered outside of "the system" or my application, because it is its own server, most probably on another physical machine? On the other hand, the database in a basic web application won't ever initiate a use case.


title: What is abstraction?

text: Is there a generally agreed upon definition for what a **programming abstraction** is, as used by programmers? [Note, programming abstraction is not to be confused with dictionary definitions for the word "abstraction."] Is there an unambiguous, or even mathematical definition? What are some clear examples of abstractions?


title: Criteria for selecting MigLayout for GUI code?

text: It seems to be easier to use and more feature rich than standard swing layouts. It looks like a do it all replacement for all standard layouts. If you are making simple code to just show the time in a window, then MigLayout is probably not useful. But, if you are making a flight cockpit panel, then MigLayout might be the best. However, even if your project is "complex" (like the flight panel example), how do you decide if you can do it well with the standard layouts instead of Mig ? How do you know when you should use MigLayout and when you should not ? Is it so good that one should use it right away for big projects without even considering the standard layouts ? These are the kind of points I am looking for - **(1) (fictional)** \- Mig can be slow for "big projects". If you want a fast loading GUI, then use the standard layout. **(2) (fictional)** \- Mig is still not as mature a project as the standard layouts. If you are making a mission critical app, i'd suggest not using Mig.


title: Rails: Law of Demeter Confusion

text: I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example: They believe that calling something like this in the controller is bad (and I agree)               @street = @invoice.customer.address.street      Their proposed solution is to do the following:               class Customer              has_one :address         belongs_to :invoice              def street             address.street         end     end          class Invoice              has_one :customer              def customer_street             customer.street         end     end          @street = @invoice.customer_street      They are stating that since you only use one dot, you are not breaking the Law of Demeter here. I think this is incorrect, because you are still going through customer to go through address to get the invoice's street. I primarily got this idea from a blog post I read: http://www.dan-manges.com/blog/37 In the blog post the prime example is               class Wallet       attr_accessor :cash     end     class Customer       has_one :wallet            # attribute delegation       def cash         @wallet.cash       end     end          class Paperboy       def collect_money(customer, due_amount)         if customer.cash < due_ammount           raise InsufficientFundsError         else           customer.cash -= due_amount           @collected_amount += due_amount         end       end     end      The blog post states that although there is only one dot `customer.cash` instead of `customer.wallet.cash`, this code still violates the Law of Demeter. > Now in the Paperboy collect_money method, we don't have two dots, we just > have one in "customer.cash". Has this delegation solved our problem? Not at > all. If we look at the behavior, a paperboy is still reaching directly into > a customer's wallet to get cash out. EDIT I completely understand and agree that this is still a violation and I need to create a method in `Wallet` called withdraw that handles the payment for me and that I should call that method inside the `Customer` class. What I don't get is that according to this process, my first example still violates the Law of Demeter because `Invoice` is still reaching directly into `Customer` to get the street. Can somebody help me clear the confusion. I have been searching for the past 2 days trying to let this topic sink in, but it is still confusing.


title: Law of Demeter confusion

text: I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example: They believe that calling something like this in the controller is bad (and I agree)               @street = @invoice.customer.address.street      Their proposed solution is to do the following:               class Customer              has_one :address         belongs_to :invoice              def street             address.street         end     end          class Invoice              has_one :customer              def customer_street             customer.street         end     end          @street = @invoice.customer_street      They are stating that since you only use one dot, you are not breaking the Law of Demeter here. I think this is incorrect, because you are still going through customer to go through address to get the invoice's street. I primarily got this idea from a blog post I read: http://www.dan-manges.com/blog/37 In the blog post the prime example is               class Wallet       attr_accessor :cash     end     class Customer       has_one :wallet            # attribute delegation       def cash         @wallet.cash       end     end          class Paperboy       def collect_money(customer, due_amount)         if customer.cash < due_ammount           raise InsufficientFundsError         else           customer.cash -= due_amount           @collected_amount += due_amount         end       end     end      The blog post states that although there is only one dot `customer.cash` instead of `customer.wallet.cash`, this code still violates the Law of Demeter. > Now in the Paperboy collect_money method, we don't have two dots, we just > have one in "customer.cash". Has this delegation solved our problem? Not at > all. If we look at the behavior, a paperboy is still reaching directly into > a customer's wallet to get cash out. Can somebody help me clear the confusion. I have been searching for the past 2 days trying to let this topic sink in, but it is still confusing.


title: What version control system can manage all aspects?

text: A few months ago I dug into Subversion and GIT and was disappointed. They handle SOURCE CODE fine but not other aspects. For example, a web site under version control needs to manage file/directory ownership, file/directory read & write access, Access Control Lists, timestamps, database contents. and external links. Is there a version control system that can do as perfect a reversion as reloading from a month-old backup?


What are questions to test a programmers knowledge of SQL? What is the answer to the question? And what would a lack of an correct answer mean in terms of time likely to understand the concept(s) related to the question? **GOOGLED:** sql challenge


title: How do you deploy your ASP.Net MVC3 application to the production server?

text: I just want to find out the best practice to deploy your MVC3 application and what tool you use to get the job done. I am using Visual Studio 2010. I publish my web site, then manually backup whats on the production server, then upload the new one there. It's tedious and error prone. What should I do to make this job easier?


title: What is the relevance of resumes in the age of GitHub, Stack Exchange, Coursera, Udacity, blogs, etc.?

text: My resume is no longer relevant. It can no longer contain an adequate description of my technical abilities. One can get a much better sense of what I am capable of by looking at my GitHub repositories, my Stack Exchange profiles, and the various courses that I am taking at Udacity and Coursera. The problem is that I have no idea how to tell employers that those are the places to look if they want an accurate description of what I can do. Every time a recruiter contacts me I gently nudge them towards all the resources I just mentioned and I also provide a link to a publicly visible Google doc that contains my resume along with links to all those resources. Yet, they keep coming back asking for a more descriptive resume. How can I make it even more blatantly obvious that if somebody wants to hire me then they can save themselves a whole bunch of trouble by just clicking on a few links and browsing around?


title: Reconciling the Boy Scout Rule and Opportunistic Refactoring with code reviews

text: I am a great believer in the Boy Scout Rule: > Always check a module in cleaner than when you checked it out." No matter > who the original author was, what if we always made some effort, no matter > how small, to improve the module. What would be the result? I think if we > all followed that simple rule, we'd see the end of the relentless > deterioration of our software systems. Instead, our systems would gradually > get better and better as they evolved. We'd also see teams caring for the > system as a whole, rather than just individuals caring for their own small > little part. I am also a great believer in the related idea of Opportunistic Refactoring: > Although there are places for some scheduled refactoring efforts, I prefer > to encourage refactoring as an opportunistic activity, done whenever and > wherever code needs to cleaned up - by whoever. What this means is that at > any time someone sees some code that isn't as clear as it should be, they > should take the opportunity to fix it right there and then - or at least > within a few minutes Particularly note the following excerpt from the refactoring article: > I'm wary of any development practices that cause friction for opportunistic > refactoring ... My sense is that most teams don't do enough refactoring, so > it's important to pay attention to anything that is discouraging people from > doing it. To help flush this out be aware of any time you feel discouraged > from doing a small refactoring, one that you're sure will only take a minute > or two. Any such barrier is a smell that should prompt a conversation. So > make a note of the discouragement and bring it up with the team. At the very > least it should be discussed during your next retrospective. Where I work, there is one development practice that causes **heavy** friction - Code Review (CR). Whenever I change anything that's not in the scope of my "assignment" I'm being rebuked by my reviewers that I'm making the change harder to review. This is especially true when refactoring is involved, since it makes "line by line" diff comparison difficult. This approach is the standard here, which means opportunistic refactoring is seldom done, and only "planned" refactoring (which is usually too little, too late) takes place, if at all. I claim that the benefits are worth it, and that 3 reviewers will work a little harder (to actually understand the code before and after, rather than look at the narrow scope of which lines changed - the review itself would be better due to that alone) so that the next 100 developers reading and maintaining the code will benefit. When I present this argument my reviewers, they say they have no problem with my refactoring, as long as it's not in the same CR. However I claim this is a myth: (1) Most of the times you only realize what and how you want to refactor when you're in the midst of your assignment. As Martin Fowler puts it: > As you add the functionality, you realize that some code you're adding > contains some duplication with some existing code, so you need to refactor > the existing code to clean things up... You may get something working, but > realize that it would be better if the interaction with existing classes was > changed. Take that opportunity to do that before you consider yourself done. (2) Nobody is going to look favorably at you releasing "refactoring" CRs you were not supposed to do. A CR has a certain overhead and your manager doesn't want you to "waste your time" on refactoring. When it's bundled with the change you're supposed to do, this issue is minimized. The issue is exacerbated by Resharper, as each new file I add to the change (and I can't know in advance exactly which files would end up changed) is usually _littered_ with errors and suggestions - most of which are spot on and totally deserve fixing. The end result is that I see horrible code, and I just leave it there. Ironically, I feel that fixing such code not only will not improve my standings, but actually lower them and paint me as the "unfocused" guy who wastes time fixing things nobody cares about instead of doing his job. I feel bad about it because I truly despise bad code and can't stand watching it, let alone call it from my methods! Any thoughts on how I can remedy this situation ?


title: Suggestions designing an XML polling deamon in python

text: I'm about to take on a new project for a client designing a server-side python program that will poll a number of XML streams at regular intervals and populate a Postgresql database with results. The system will basically act as an XML cacheing daemon and populate a database. That database will then be accessed by a separate program which will serve that data in JSON to a public- facing website. I'm wondering if anyone has suggestions as to the high-level design of the python caching/polling program. I'm thinking something class-based where a number of classes (one for each XML stream to be polled) descend from a common parent class, check for new content and then grab any if found. I'm thinking to have a table for each of the XML streams on the database, a column for each of the XML fields, and another table to keep track of the "last access" for each stream. For this I'm planning on using Python 2.7, pyscopg, and ElementTree for XML processing. Does anyone have any thoughts or criticism on my design or toolchain at this point? Is parsing my XML values to store in a Postgres database more work than is worthwhile? The front-end program that will be serving that data will be turning it into JSON rather than XML by the way.


title: Which approach would lead to an API that is easier to use?

text: I'm writing a JavaScript API and for a particular case, I'm wondering which approach is the sexiest. Let's take an example: writing a `VideoPlayer`, I add a `getCurrentTime` method which gives the elapsed time since the start.   1. The first approach simply declares `getCurrentTime` as follows:              getCurrentTime():number      where `number` is the **native number** type. This approach includes a `CURRENT_TIME_CHANGED` event so that API users can add callbacks to be aware of time changes. Listening to this event would look like the following:              myVideoPlayer.addEventListener(CURRENT_TIME_CHANGED, function(evt){         console.log ("current time = "+evt.getDispatcher().getCurrentTime());     });        2. The second approach declares `getCurrentTime` differently:              getCurrentTime():CustomNumber      where `CustomNumber` is a **custom number** object, not the native one. This custom object dispatches a `VALUE_CHANGED` event when its value changes, so there is no need for the `CURRENT_TIME_CHANGED` event! Just listen to the returned object for value changes! Listening to this event would look like the following:              myVideoPlayer.getCurrentTime().addEventListener(VALUE_CHANGED, function(evt){         console.log ("current time = "+evt.getDispatcher().valueOf());     });      Note that `CustomNumber` has a `valueOf` method which returns a native number that lets the returned `CustomNumber` object being used as a number, so:              var result = myVideoPlayer.getCurrentTime()+5;      will work! So in the first approach, we listen to an object for a change in its property's value. In the second one we directly listen to the property for a change on its value. There are multiple pros and cons for each approach, I just want to know which one the developers would prefer to use!


title: efficient way to count number of swaps in insertion sort

text: I am browsing some online coding challenge online and got struck somewhere . Objective of program is to find maximum number of swaps required in sorting an array via insertion sort in efficient time the first approach that is brute force approach gives the O(n^2) complexity The next i can think of is merge sort algorithm the code i use for that is               #include <cmath>     #include <cstdio>     #include <vector>     #include <iostream>     #include <algorithm>     using namespace std;          int mergesort(int *,int);     int _mergesort(int *,int *,int,int);     int merge(int *,int *,int,int,int);          int mergesort(int arr[],int n)     {         int temp[n];         return _mergesort(arr,temp,0,n-1);     }          int _mergesort(int arr[],int temp[],int left,int right)     {         int mid,count=0;         if(right>left)         {            mid=(left+right)/2;           count=_mergesort(arr,temp,left,mid);           count+=_mergesort(arr,temp,mid+1,right);           count+=merge(arr,temp,left,mid+1,right);         }         return count;     }          int merge(int arr[],int temp[],int left,int mid,int right)     {       int i, j, k;       int count = 0;       i = left;        j = mid;         k = left;        while ((i <= mid - 1) && (j <= right))       {         if (arr[i] <= arr[j])         {           temp[k++] = arr[i++];         }         else         {           temp[k++] = arr[j++];           count = count + (mid - i);         }       }       while (i <= mid - 1)         temp[k++] = arr[i++];       while (j <= right)         temp[k++] = arr[j++];       for (i=left; i <= right; i++)         arr[i] = temp[i];            return count;     }          int main()     {         int n,tc,i;         cin>>tc;         while(tc)         {           cin>>n;           int arr[n];           for(i=0;i<n;i++)               cin>>arr[i];             cout<<mergesort(arr,n);           tc--;         }         return 0;        }          The example test case is      Sample Input:     2     5     1 1 1 2 2     5     2 1 3 1 2          Sample Output:     0     4      this gives me a complexity of nlogn Initially the program reads number of test case that is 2 and followed by two test case the algorithm works fine for small range of values but show time limit exceeded error in some test case . What is the most efficient way of doing this i cant find out any suggestion or edits would be appreciated.


title: Should this code/logic be included in Business Objects class or a separate class?

text: I have created a small application which has a three tier architecture and I have business object classes to represent entities such as `User`, `Orders`, `UserType` etc. In these classes I have methods that are executed when the Constuctor method of, for example, User is called. These methods perform calculations and generate details that setup data for attributes that are part of each User object. Here is the structure for the project in Visual Studio: ![enter image description here](http://i.stack.imgur.com/TijRU.png) Here is some code from the business object class User.cs:               Public Class User     {         public string Name { get; set; }         public int RandomNumber { get; set; }         etc                  public User             {                 Name = GetName();                 RandomNumber = GetRandomNumber();             }                  public string GetName()             {                ....               return name;             }                  public int GetRandomNumber()             {                ...                return randomNumber;             }              }      Should this logic be included in the Business Object classes or should it be included in a Utilities class of some kind? Or in the business rules?


title: If someone changes their license, does it apply to previously forked projects under the prior license?

text: * Say someone puts their code on GitHub, under the MIT license.   * Then I forked it and use it in my project.   * Then they change the license so that it has a strict license that does not give permission to modify, sell, etc... Would the new license apply to my code, since the code I have was from before they changed the license?


title: Can the Clojure set and maps syntax be added to other Lisp dialects?

text: In addition to create list using parentheses, Clojure allows to create vectors using [ ], maps using { } and sets using #{ }. Lisp is always said to be a very extensible language in which you can easily create DSLs etc. But is Lisp so extensible that you can take any Lisp dialect and relatively easily add support for Clojure's vectors, maps and sets (which are all functions in Clojure)? I'm not necessarily asking about _cons_ or similar actually working on these functions: what I'd like to know is if the other could be modified so that the source code would look like Clojure's source code (that is: using matching [ ], { } and #{ } in addition to ( )). Note that if it cannot be done this is not a criticism of Lisp: what I'd like to know is, technically, what should be done or what cannot be done if one were to add such a thing.


title: Story Point Estimation vs Ideal Days Estimation

text: In my project we assign 4 hours for 1 story point and estimate based on story point. So in this case one ideal day of work will be done in 2 elapsed days. From an agile standpoint are we doing story point estimation or ideal days estimation or none of these?


title: Lucene + Joins == RDBMS?

text: Now that Lucene supports joins (at indexing time and at querying time) can one use Lucene as a databse (a NoSQL one, with Eventual Consistency)? Note: I was pondering on that for sometime and this is an idea that comes around again and again from time to time and there are proof that on actually can do that - to some extent (RavenDB). Besides I think referential integrity is over-rated - I never use foreign keys in a RDBMS when I work on a big, fast changing project with a small team; from experience it's pure maintenance headache and kills productivity. The only thing that seems to me a hurdle in building up this mindset is the lack of transactions - and yes; you can have 2 step transactions (with say MongoDB and Lucene uses that for some internals) but that's lots of work; and I do not know how that would be possible with Lucene.


title: Why did visual programming never take off and what future paradigms might change that?

text: As the number of "visual" OS's such as Android, iOS and the promised Windows 8 are becoming more popular, it does not seem to me that we programmers have new ways to code using these new technologies, due to a possible lack in new visual programming languages paradigms. I've seen several discussions about incompatibilities between the current coding development environment, and the new OS approaches from Windows 8, Android and other tablets OS's. I mean, today if we have a new tablet, it's almost a requirement for coding, to have, for instance, an external keyboard (due it seems to me it's very difficult to program using the touch screen), exactly because the coding assistance is not conceived to "write" thousands of lines of code. So, how advanced should be the "new" visual programming languages paradigms? Which characteristics these new paradigms would be required?


title: When to favor ASP.NET WebForms over MVC

text: I know that Microsoft has said > ASP.NET MVC is not a replacement for WebForms. And some developers say WebForms is faster to develop on than MVC. But I believe speed of coding comes down to comfort level with the technology so I don't want any answers in that vein. Given that ASP.NET MVC gives a developer more control over their application, why isn't WebForms considered obsolete? Alternatively, when should I favor WebForms over MVC for new development?


title: Is this a secure solution for RESTful authentication?

text: I need to quickly implement a RESTful authentication system for my JavaScript application to use. I think I understand how it should work, but I just want to double check. Here's what I'm thinking -- what do you guys think? **Database schema** users   * id : integer   * first_name : varchar(50)   * last_name : varchar(50)   * password : varchar(32) (MD5 hashed)   * etc. user_authentications   * id : integer   * user_id : integer   * auth_token : varchar(32) (AES encrypted, with keys outside database)   * access_token : varchar(32) (AES encrypted, with keys outside database)   * active : boolean **Steps** The following happens over SSL. I'm using Sinatra for the API.   1. JavaScript requests authentication via POST to /users/auth/token.   2. The /users/auth/token API method generates an auth_token hash, creates a record in user_authentications, and returns auth_token.   3. JavaScript hashes the user's password and then salts it with auth_token -- SHA(access_token + MD5(password))   4. POST the user's username and hashed+salted password to /users/auth/authenticate.   5. The /users/auth/authenticate API method will verify that SHA(AES.decrypt(access_token) + user.password) == what was received via POST.   6. The /users/auth/authenticate will generate, AES encrypt, store, and return an access token if verification is successful; otherwise, it will return 401 Unauthorized.   7. For any future requests against the API, JavaScript will include access_token, and the API will find the user account based on that.


title: Theory Of A Weird Thought - Forms Submission

text: In theory, if you were to open two computers that were perfectly synced together on a website that has a form. This form has fields where say for example the username has to be unique. Assuming both computers have the same information on the form, and in theory let's say that the submit button was pressed at the same time, and that these two computers have the exact same build and internet speed and the same response time from the server, whose information would be submitted to the database and whose information would be denied knowing the username field is unique.


title: "Interface" vs. "layer"

text: In computer science, what are the differences in meaning between _interface_ and _layer_? For example, an interface between A and B must belong to either A or B or both, while a layer between A and B must be a third thing that is neither part of A or of B?


title: Is there anything like chorewars for programming?

text: Chorewars gives rpg style rewards for household chores. Does anyone do this for programming? I know about coderwall and workforpie.


title: Space around operators? a=b/2; or a = b / 2; What are the arguments?

text: Personally I prefer space around operators. For me it makes the code much more readable. What are the arguments not have space around them? Line length? An example from the Python style guide (I agree with this): Yes:                 i = i + 1       submitted += 1       x = x * 2 - 1       hypot2 = x * x + y * y       c = (a + b) * (a - b)      No:                 i=i+1       submitted +=1       x = x*2 - 1       hypot2 = x*x + y*y       c = (a+b) * (a-b)


title: Why would universities educate IT leaders who lacks IT interest?

text: I am not sure if there is an obvious answer to this, but this question has somewhat baffled me from the first time I started thinking about it. My university's IT department educates managers and IT leaders with the slogan that "IT leaders will be able to perform their job better if they have an understanding of how the technology works". This course includes multiple technical classes alongside the typical business related classes. However, what I have started to notice is that the students that apply for this course have either a very lacking understanding of IT, or dislike technological classes such as software engineering and programming, and as thus get very poor exam results. This begs the question: Why would someone with no interest in deeper understanding of technology want to work as an IT leader? Or magnitudes more importantly; Why would anyone working as a developer want to have a boss who has no understanding whatsoever of what they're actually leading? It just feels very wrong to have someone lead you who lacks the experience of understanding why certain things are better done in certain ways. IT leaders who never programmed or cared about it won't understand why concepts such as technical debt really hurts and why it is important to avoid. To quote Uncle Bob: "A system architect should also be a programmer, that way they get to experience the mess they make for everybody else."


title: Isn't GPL enough to make a software free as in free speech?

text: ## Background I have read people rebutting the fact that a certain software is free as in free speech, even when it is licensed under GPL. Some say Java isn't free because to obtain a professional certification you must get it from Oracle. Some say Java JDK is not free to re-distribute. Some people even say the openJDK is not free or open. But Java is officially GPL. ## Questions   1. Doesn't GPL explicitly mean you are free to re-distribute ?   2. Isn't GPL enough to make a software free as in free speech ?   3. How can Java be both GPL and not-free as in free speech ?   4. Is there is any license that trully makes a software free beyond any possible subjetive point of view? **EDIT: These question is not about names or trademarks, it's about the code.**


title: How to construct UML activity diagram reflecting real programmed source code as docs

text: Please, tell me the things I must use for modeling an (Enterprise Architect) activity diagram of               object1.method1() calls object2.method2()      I'm able to dragndrop a method of a class from model tree-view to my diagram, and it appears as new action there. But there is no hint about its belonging object. Also I don't get it which arrow type I must use to model that one calls the other. My feeling is it's not very appropriate for constructing documentation of typical call scenarios of my application. You know I want to create UML docs for what we've programmed until now.


title: Looking for a dynamic programming solution

text: Given a sequence of integers in range 1 to n. Each number can appear at most once. Let there be a symbol X in the sequence which means remove the minimum element from the list. There can be an arbitrarily number of X in the sequence. Example: 1,3,4,X,5,2,X The output is 1,2. We need to find the best way to perform this operation. The solution I have been thinking is: Scan the sequence from left to right and count number of X which takes O(n) time. Perform partial sorting and find the k smallest elements (k = number of X) which takes O(n+klogk) time using median of medians. Is there a better way to solve this problem using dynamic programming or any other way ?


title: How can you tell whether to use Composite Pattern or a Tree Structure, or a third implementation?

text: I have two client types, an " **Observer** "-type and a " **Subject** "-type. They're both associated with a **hierarchy of groups**. The Observer will receive **(calendar) data** from the groups it is associated with throughout the different hierarchies. This data is calculated by **combining data from 'parent' groups** of the group trying to collect data (each group can have **only one parent** ). The Subject will be able to create the data (that the Observers will receive) in the groups they're associated with. When data is created in a group, all 'children' of the group will have the data as well, and they will be able to make their **own version of a specific area of the data** , but still linked to the original data created (in my specific implementation, the original data will contain time-period(s) and headline, while the subgroups specify the rest of the data for the receivers directly linked to their respective groups). However, when the Subject creates data, it has to check if all affected Observers have any **data that conflicts** with this, which means a huge recursive function, as far as I can understand. So I think **this can be summed up** to the fact that I need to be able to have **a hierarchy that you can go up and down in** , and some places be able to _treat them as a whole_ (recursion, basically). Also, I'm not just aiming at a solution that works. I'm hoping to find a solution that is relatively easy to understand (architecture-wise at least) and also flexible enough to be able to easily receive additional functionality in the future. Is there a design pattern, or a good practice to go by, to solve this problem or similar hierarchy problems? **EDIT** : Here's the design I have: ![Class diagram with methods included. The "Group" class is the hierarchy](http://i.stack.imgur.com/JXMBt.png) The "Phoenix"-class is named that way because I didn't think of an appropriate name yet. But besides this I need to be able to **hide specific activities for specific observers** , even though they are attached to them through the groups. * * * **A little Off-topic** : Personally, I feel that I should be able to chop this problem down to smaller problems, but it escapes me how. I think it's because it involves multiple recursive functionalities that aren't associated with each other and different client types that needs to get information in different ways. I can't really wrap my head around it. If anyone can guide me in a direction of how to become better at encapsulating hierarchy problems, I'd be very glad to receive that as well.


title: Is it an appropriate use of #define to make typing repeated code easier?

text: Is there any view on whether using the #define to define full lines of code for simplifying coding is good or bad programming practice? For example, if I needed to print a bunch of words together, I'd get annoyed typing               << " " <<      To insert a space between words in a cout statement. I could just do               #define pSpace << " " <<      and type               cout << word1 pSpace word2 << endl;      To me this neither adds or subtracts from the clarity of the code and makes typing slightly easier. There are other cases that I can think of where typing will be much easier, usually for debugging. Any thoughts on this? EDIT: Thanks for all the great answers! This question just came to me after doing a lot of repetitive typing, but I never thought there would be other, less confusing macros to use. For those who don't want to read all the answers, the best alternative is to use the macros of your IDE to reduce repetitive typing.


title: DB Schema for ACL involving 3 subdomains

text: I am trying to design a database schema for a web app which has 3 subdomains: a) internal employees b) clients c) contractors. The users will be able to communicate with each other to some degree, and there may be some resources that overlap between them. My primary question is if I should split up the roles into separate tables for each domain, as in internal_roles, client_roles, and expert_roles, or if I should just keep them in the one roles table, with a user_type field to differentiate the roles. Also, I'm wondering if having this type field will cause it to violate the 3rd normal form? Really appreciate your time and thoughts on this. Cheers! * * * \-- ## \-- Table structure for table `locations` CREATE TABLE IF NOT EXISTS `locations` ( `id` bigint(20) NOT NULL, `name` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; * * * \-- ## \-- Table structure for table `privileges` CREATE TABLE IF NOT EXISTS `privileges` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `resource_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ; * * * \-- ## \-- Table structure for table `resources` CREATE TABLE IF NOT EXISTS `resources` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `user_type` enum('internal','client','expert') NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; * * * \-- ## \-- Table structure for table `roles` CREATE TABLE IF NOT EXISTS `roles` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `type` enum('position','department') NOT NULL, `parent_id` int(11) DEFAULT NULL, `user_type` enum('internal','client','expert') NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; * * * \-- ## \-- Table structure for table `role_perms` CREATE TABLE IF NOT EXISTS `role_perms` ( `id` int(11) NOT NULL AUTO_INCREMENT, `role_id` int(11) NOT NULL, `privilege_id` int(11) NOT NULL, `mode` varchar(250) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; * * * \-- ## \-- Table structure for table `users` CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `salt` varchar(255) NOT NULL, `type` enum('internal','client','expert') NOT NULL, `first_name` varchar(255) NOT NULL, `last_name` varchar(255) NOT NULL, `location_id` int(11) NOT NULL, `phone` varchar(255) NOT NULL, `status` enum('active','inactive') NOT NULL DEFAULT 'active', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; * * * \-- ## \-- Table structure for table `user_perms` CREATE TABLE IF NOT EXISTS `user_perms` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `privilege_id` int(11) NOT NULL, `mode` varchar(250) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; * * * \-- ## \-- Table structure for table `user_roles` CREATE TABLE IF NOT EXISTS `user_roles` ( `id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `role_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


title: How to design a performance comparison between two data structures

text: I want to compare the performance of two search trees of integers (an AVL tree and a RedBlack tree). How should I design/engineer the tests to accomplish this? For example, let's consider the _insert_ operation; what steps should I follow in order to state that on average this operation is faster in the RB case? What considerations should I take to correctly measure CPU time? Should both implementations be optimized, or may I compare an optimized implementation of AVL vs a straightforward implementation of RB? Any links or papers would be very helpful.


title: Are the only types of data "sources" static and dynamic?

text: Thinking that there might be others, but not sure -- but before getting into that, let me explain what I mean by static and dynamic data sources.   * **Static** (or datastore) - Meaning that the data's state is non-changing, and if was changed, that would be a new state, and the old data would be considered stateless; meaning it no longer is known to exist, or not exist. Another way of possibly looking at a static data source might be that if read and written back without modification, the checksum for before and after should be exactly the same regardless of the duration of time between the reading and rewriting of the data. **Examples:** Photos, Files, Database Record,   * **Dynamic** (or datastream) - Meaning that the data's state is known to be in flux, and never expected to be the same per input. **Example:** Live video/audio feed, Stock Market feed, First let me say, the above is a very loose mapping of the concepts, and I'd welcome any feedback. Next, onto the core of the question, that being are these the only two types of data sources. My guess, is that yes, they are -- but that there are **hybrid** versions of the two. That being, streaming data that has a fixed state. For example, the data being streamed has a checksum given and each unique checksum is known to be a single instance of static data. On the flip side, static data could be chained via say a version control system; when played back, each version might be viewed as a segment of a stream; thing is, the very fact that it can be played back makes the data source static. Another type might be that the data source is being organically discovered, and it's simply **unknown** what the state is. Questions, feedback, requests -- just comment, thanks!!


title: Approach to a programming task

text: All, Given a problem statement, when I start of with the analysis and design, I tend to think too much about the various functionalities associated with the task (sometimes not even mentioned in the task). My point is, I get diverted from the main task at hand thinking about various scenarios that I should consider while coding and this tends to demotivate me because I am often very confused in the end. What approach should I take in this case since thinking a lot on all possible scenarios comes naturally and I only try hard not to.


title: Usage of Repository Pattern

text: I'm using the Repository pattern in my application right now. It is a console- based batch processing tool. Essentially I need the repository to be able to randomly access the data. The trouble I am having is that my data needs to be:   1. read in once (from flat-file)   2. accessed randomly from the repository   3. written out once. I handle this in the code by using a guard clause to see if the records have been accessed yet, and if not then read them in. A simple example below.               public IUnit GetById(int id)     {         if (!ReadIn)         {              ReadAllUnitsFromFile();         }         return _listOfUnits[id];     }      My question is this: Would it be a bastardization of the Repository pattern if I had a module that ran before the rest of my program to read the data into the repository, and another module that ran afterward to write data out of the repository? Is this an anti-pattern? Is there a better pattern to suit my situation? Thanks


title: Difference between visibility of the project and micro-manage

text: Here is my situation. My boss wants to know everthing I am doing. We are using Scrum so we do 15 minutes daily meeting and I attend everyday.. I am perfectly fine with this and actually interested in this agile that my company started to practice.. My concern is my boss also want to be reported almost every issue I am handling for production and QA. If some production issue escalated to me and my boss is not included in the e-mail trail, she would storm me and escalate it to the director. If I fix one bug and deploy QA, she would like to know,,, in written. I stand up to the team once saying I attend daily scrum meeting and explain my status as detail as possbile, why I should send out e-mail again? I feel being micro managed. I feel there is no ownership for any task for programmers even we are practicing Agile. But would it be just my emotion? Maybe all she wanted is visibility of the task I am doing.. What do you fellow programmers think the difference between visibility of the task and micro-management.


title: Why does Microsoft charge a fortune for its developer tools?

text: Microsoft charges thousands of dollars for most versions of Visual Studio. Compare this with companies like Apple and Google and with organizations like GNU and Eclipse that give away developer tools for free, it makes me wonder where the difference lies. The rationale behind Apple and Google giving away the tools for free is to make it easier for developers to develop for the platform, which in turn results in increased unit sales. Is Windows considered so ubiquitous that it doesn't need additional promotion, and can instead be leveraged by Microsoft to make money on the tools to develop for it? Is it simply because they _can_ charge as much as they do and that some people are willing to pay it? I'm also curious if the high cost of the tools has limited the number of small software shops that developing for Windows, if the existing shops either use the free (crippled) version, or other, less expensive tools.


title: How did Delphi influence the .NET Framework?

text: As opposed to influence on the C# language, did Delphi influence the .NET Framework too? At first glance .NET is Microsoft's version of Java, but .NET has properties similar to Delphi. Are there other influences?


title: In what specific ways did Delphi influence the C# language

text: I am specifically looking for language influences (as opposed to framework). At first glance C# seems to be an evolution of C/C++ or Java. But we know C# has the same designer as Delphi, and he even acknowledged some similarities and said "good ideas don't just go away." The one example I see of something in C# that is not in Java or C/C++ is properties. Is that it? Are there others?


title: FP for simulation and modelling

text: I'm about to start a simulation/modelling project. I already know that OOP is used for this kind of projects. However, studying Haskell made me consider using the FP paradigm for modelling a system of components. Let me elaborate: Let's say I have a component of type A, characterised by a set of data (a parameter like temperature or pressure,a PDE and some boundary conditions,etc.) and a component of type B, characterised by a different set of data(different or same parameter, different PDE and boundary conditions). Let's also assume that the functions/methods that are going to be applied on each component are the same (a Galerkin method for example). The object's mutable state would be used for non-constant parameters. If I were to use an OOP approach, I would create two objects that would encapsulate each type's data, the methods for solving the PDE(inheritance would be used here for code reuse) and the solution to the PDE. On the other hand, if I were to use an FP approach, each component would be broken down to data parts and the functions that would act upon the data in order to get the solution for the PDE. Non-constant parameters would be passed as functions of something else (time for example) or expressed by some kind of mutability(emulation of mutability,etc.) This approach seems simpler to me assuming that linear operations on data would be trivial. To conclude, would implementing the FP approach be actually simpler and easier to manage (add a different type of component or new method to solve the pde) compared to the OOP one? I come from a C++/Fortran background, plus I'm not a professional programmer, so correct me on anything that I've got wrong.


title: How to find a software developer position in Europe

text: I live in a small Baltic country and I've been working as a software developer for 5+ years, with coding experience of 10+ years. Mainly specializing in C/C++. The problem is that the projects I had to work on, were really tiny in global scale, and also involved some switching to .NET and that likes. I want to keep growing, and try working on bigger things, with larger teams, environments with new methodologies, with teams following best practices, things like code reviews, and with super-star developers so that I could learn from them, and try to be like them. During the last few years, I've run into a situation where I only develop solutions, but I don't see any career opportunities or a way how I could learn more. I do read books in my free time, but I have a feeling they won't help me much to find a better position or extremely challenging projects. There are still things I want to learn, I want to find a challenging position that would allow me to learn how to write even more amazing things in C/C++, but I don't know how to search for these positions. Does anyone have any tips on where to start? It feels like I'm stuck where I am, but I still want to grow.


title: Why encapsulate container variables?

text: I wasn't sure how to formulate the title, but there's something that's made little sense to me in OOP I understand the idea of encapsulation, which is to create a layer of protection, and abstraction, so that there's no direct access to a given variable. However, there are cases where encapsulation doesn't make any sense to me, allow me to demonstrate using a simple C# class:               public class Person     {         public int Age { get; private set; } // makes sense, the setter is isolated         public string Name { get; private set; } // same story         public string ZipCode { get; set; } // doesn't make sense         public string Country { get; set; } // doesn't make sense either              public string City // also makes sense         {             get { /*some logic that gets the city based on zip code and country */ }             private set;         }     }      My issue here is that, according to good OOP practices, variables without any special rules, must also have separate accessors and mutators, but why should they if all you do anyway is set and get data to and from them? In the case of `Age` and `Name` it makes sense to encapsulate it, because the setter is private, you can't mutate it outside the scope of the class, likewise with the `City` field, that has a special getter, that gets the data based on special rules. What difference does it make if I wrap `ZipCode` and `Country` in a property or not? I can fully access and mutate the variables in either case. Could someone clarify this?


title: What tools do you as [web] programmers use to help your design skills?

text: As a programmer, I enjoy embarking on small personal projects and I have a load of open source scripts that I host on github. I am very much a **programmer** and not a **designer**. However, it is inevitable that sometimes I am forced to _design_. These are usually cases where there is no point in paying for a designer, but it would be nice if the page looked good. Some examples are:   * Creating personal pages, _e.g. blog, showcase_   * Landing pages for my github scripts _(gh-pages)_   * Designing personal pages for friends These are all situations that have come up and I end up creating spaghetti style css sheets. So... what tools, tips, hints, general advice do you have to offer for us programmers who have little creative imagination?


title: How to start embedded development for developing a handheld game console?

text: I work as a iPhone app developer now, so I know a bit of c, c++ and objective c. Also have fiddled with Java and many other. All of them have been just high level application/games development. My final goal is to make a handheld game console. More like a home made NES/SNES handheld console or even an Atari. I have found out about RaspberryPI and Arduino. But I need more information about how to approach this.   1. How Do I learn to pick the best board/cpu/controller/GPU/LCD screen/LCD controller etc?    2. Will learning to make a NES emulator first help me understand this field? If so are there any tutorials?


title: API Key DDOS protection

text: Hi I just wanted some feedback on a DDOS preventing php script that I'm designing. It is quite simple and I wanted some feedback on whether you guys think it would be effective. I'm currently using the ulogin framework as a base and have implemented API Keys. At the moment the user will send a request with a key. This key is checked against the database to see if it correct. So if the key is not correct the program will return. If the key is correct then some statistics are going to be calculated. The first thing is to increment the counter. The average hit per second will be calculated from the time they started requesting to the current time. Also there is a window of X seconds in which the counter will be reset (Lets say 300). The programmer specifies the max number of requests that should be allowed in this window. If the key is over the limit of requests per stats reset (Window) or over a certain amount of requests per second, they will be blocked and not given access. However the counter still increments but another counter is started (blockcount). When the counter is set to 0 at the end of the window, the count for the next window will be set to what ever the blockcount is and the blockcount will be set to 0. If the user doesn't use the API key for X (window) seconds then both counters will be reset to 0. I have added a transferpenalty variable (0-1) that will take a percentage of the blockcount on to the next window instead of the entire block count but I don't think that it is neccessary to have this. Is this already being done? Would this protect against a sniffed API key being used to (D)DOS a server? What are your thoughts :)


title: How does code coverage work?

text: Specifically, what is contained inside code coverage data (.nccov or xml file) and how is an html report generated by this? Does the coverage data not include the actual percentage of code covered? Is this only generated when the report is made from the coverage data? Is the coverage data sort of a guideline for the reporting process? Do coverage files need access to assemblies to create a report?


title: Should I add a key to the items of my REST API response?

text: I have an REST API endpoint which the JSON response looks like:               {         "products": [             {"id": 1040, "price": 2.95, ...}             {"id": 4545, "price": 3.95, ...}         ]     }      One of my colleagues suggested that I should add a key for each item in the list. He said it should make it easier to browse the API. He suggested is something like:               {         "products": {             "1040": {"id": 1040, "price": 2.95, ...}             "4545": {"id": 4545, "price": 3.95, ...}         }     }      Making it will not be harmful for my API's performance and I can understand how it should help the ability to browse it. Should I do that? Is there any example of public API that does something similar?


title: Becoming a polyglot programmer

text: I know a few programming languages. The most marketable ones being Java, Javascript, as well as non-trival stored procedures. I also know some Python, Actionscript and a few dinosaurs language. I am starting up a toy project with Scala/lift. I enjoy each language for its own features and the paradigms they encourage. I am interested in the concept of a polyglot programmer and becoming one. What are the steps to being a true polyglot programmer? (I.E. I don't just know different languages, I know them well, and know good design patterns for them.) Is this something that can be made marketable?


title: Again MVVM / MVP story , passing interface of a view to its view model why it is bad?

text: I have used WPF for an Enterprise solution (hundreds views heavily used Data inputs and validation) in MVP pattern (it was a clean solution usually small amount of code behind forms and main code was in pretension layer which we called it user interface process or UIP layer ) For the next small projects I used WPF with MVVM. generally some ideas of MVVM looks nice like commands and bindings especially the concept of ViewModel (having a special version of Model dedicated for View) But I did not like so much the concept of Messaging and event aggregator I usually try to minimize usage of this patterns (for example between ViewModels I use ordinary Object oriented function call or from a View to ViewModel (I have ViewModel in my View so I use them to call ViewModel from View) but for a call from a view model to view I use messaging. though sometimes in place of sending messages (from ViewModel to View) I send an Interface of view to its ViewModel and use that interface to call a function in a view. Any body can tell me is this practice an anti pattern and why it is bad?


title: When and how to commit?

text: I'm getting used in working with git at the moment. And I'm touching an issue that is unclear to me. I feel compelled, if I think of commiting after a change and making a documenting description. I don't know exactly _when_ I should commit, because that's very relative and there's always something under construction. I tend to commit, when I fear to hose something. But then the summaries look like "Backup before trying this and that" or just "Backup". What do you do? Is there a better way, or is my practise common?


title: How can a programming novice identify poor code written by another?

text: I recently started to learn how to program and am looking to hire a Python developer. How can I separate good code from not so good code?


title: How to measure when a software project is complete?

text: I have very limited experience in software project management roles, and I was asked this question by another engineer and I was sort of stumped. How do I measure when a software project is complete? The part I'm struggling with is the "measure" part. I know there are measurements such as EVM, but they are more focused on overall project performance. For instance, having a low SPI or low CPI can indicate performance/allocation issues, but it doesn't really indicate how complete a project is. Is there a rule of thumb here to say my project is XX% complete or am I overthinking this?


title: How can a client authorize us to collect their data from a service provider?

text: Our clients need to authorize our partners to release data to us. We can collect this data via a push/pull mechanism. Since our partners have never shared data before, they don't have OAuth implemented. What is the best way for clients to tell their service providers (our partners) to release data to us without having each partner bear the overhead of implement OAuth. Is there a standard practice for this sort of an authorization? Thanks!


title: What is the role of a Software Architect in the Test-Driven Development process?

text: As I understand it, Test-Driven Development is about writing tests to define the program specifications (you can correct me if I'm wrong). If there is someone responsible for writing the specifications (including a public API) for the software (let's call him the Software Architect), does that mean that the Software Architect must write all of the tests? Or does the Software Architect write the specifications, and then hand them over to the developers to write tests against? Or do you allow the specifications to grow organically by allowing all of the developers to write their own tests, and forget about having a Software Architect?


title: How can a programmer work effectively with a remote web designer

text: I'm a programmer who understand html & css, but got no taste. My company decided to redesign our e-commerce website with new UI and move to ASP.Net MVC. They want a really good design, so they hire 2 designers to work with me, remotely. First designer to create design mockups (PSD/PNG) Second designer another one to slice the design into HTML/CSS/Images/etc.. Then, my part is to use the HTML/css as the template files (as View files in ASP.Net MVC project) Usually, even if the designer get involved in the project since the beginning, I still have to discuss many things with designer. sit together with the designer drawing something on papers and then see it directly the designer working with Adobe Fireworks, while the designer can ask if the change is feasible or not. Now I will work with designers, remotely, to redesign exisiting website. so, I will need to explain many things about this website with both of them, remotely. I would ask any of you who used to work with designer, remotely and have tips to share on how to make the collaboration more effective? Thanks :)


title: Teamwork 101 for the solo newbie

text: Forgive my newbishness but I have a question to ask about teamwork...mainly because I stink at it. Most of my projects up until this point have been solo so I have a very limited experience with teamwork. I did make graphics for a game that was being developed by several people, but that was _completely_ different than _programming_ with several different people. Right now I'm working with someone else on an indie MMO along with a few other team members. I've already made some pretty stupid mistakes, (like rewriting EVERYTHING) so I have two questions for you guys: 1) What are some of the most common mistakes that people make in a team environment and how can they be avoided? 2) How can the structure of your program be altered to allow for multiple teams members to work on different parts of the program at the same time? P.S. Is this the right stack exchange site for this type of question? (if not, where does it go? Thanks)


title: Organizing my products database

text: I’m developing a web-based store in MVC (very closely based on the SportsStore example in Pro ASP.Net MVC 3 Framework http://www.powells.com/biblio/61-9781430234043-0). I’m using a SQL database and accessing it through System.Data.Entity.DbContext I have a table that describes the products that I’m selling, with columns for name, description, price – this seems to work fine. However, I also want to include images. I’ll probably have between 3 and 6 images per product that are about ~150KB each. I think it would be convenient to store these images as binary data into another table in the database and include a column that identifies which product they’re related to. This should work but it seems inelegant – **do you have a better suggestion**? I’d really like to keep the images in the database, that seems easier than storing paths to images in the database and separately uploading the images to a webserver.


title: Strategies for managing use of types in Python

text: I'm a long time programmer in C# but have been coding in Python for the past year. One of the big hurdles for me was the lack of type definitions for variables and parameters. Whereas I totally get the idea of duck typing, I do find it frustrating that I can't tell the type of a variable just by looking at it. This is an issue when you look at someone else's code where they've used ambiguous names for method parameters (see edit below). In a few cases, I've added asserts to ensure parameters comply with an expected type but this goes against the whole duck typing thing. On some methods, I'll document the expected type of parameters (eg: list of user objects), but even this seems to go against the idea of just using an object and let the runtime deal with exceptions. What strategies do you use to avoid typing problems in Python? Edit: Example of the parameter naming issues: If our code base we have a task object (ORM object) and a task_obj object (higher level object that embeds a task). Needless to say, many methods accept a parameter named 'task'. The method might expect a task or a task_obj or some other construct such as a dictionary of task properties - it is not clear. It is them up to be to look at how that parameter is used in order to work out what the method expects.


title: Who is responsible for doing a patent search?

text: If a client requests that a particular feature is added into their website software, who is responsible for searching and recognising that a patent royalty has to paid?   1. client   2. web developer This question is aimed at freelance web developers. When a client says (for example) add a shopping cart to my site. This is a relatively straightforward task, but who is responsible for searching for and licensing patents? I was talking to another developer the other day and this came up. It sounds like an awfully large burden to be required to take on. Especially when it comes to offering clients quotes. When a client makes a request what is the general process for the freelance web developer?


title: Separating Data and Implementation

text: I'm working on a project that has frequent changes on the database and the implementation layers. I was releasing both the code and the database under the same release version, but since the database changes are more frequent than the core implementation, I'm thinking of separating their release/plan. Is this the normal way to do it?


I've seen a spate of questions on Stack Overflow and elsewhere about downloading programming tools and where to find them. Sometimes developers can't find a download link or availability in their country. Rather than encouraging them to violate laws, I think general education for these users is of the utmost importance. ## How do I know what tools I can download in my country? ## Why can't I download all tools for software development in my country? Acceptable answers will indicate why users can't download tools in their country. Any links to resources to make tools available in countries where they should not be available will be deleted without haste, and will likely result in a short ban-period for the poster. This is a how and why question.


title: Career path for software QA / Test engineer

text: I have been working as a software QA analyst for 6 years. I will be finishing a Masters degree in computer science this year. I’m just not sure how to advance my career after my graduation. I like programming, solving puzzles, but in the meantime, I don’t dislike software testing that much. Actually, sometimes it’s fun to find a bug and to be able to track it down to its root cause. I’m quite good at what I’m doing. Usually, I find 2 or 3 times as many defects as other tests can find in our team. However, sometimes, it’s a bit boring to test the same application over and over again, repetitive and monotonous. Although I did some automation tests in the past which are more interesting, still, the majority of the bugs are found manually. I think I have 2 options here, either continue doing software testing, but doing more automation tests which involve coding and scripting. To do this, I think I have to find a place where most tests are carried out using automated tools, like in Google (from their tester job description). Option 2 is to opt to the dev side to do full time programming which I always like. The downside of option 2 is I have to start from scratch as most of my past experience is in testing side. Anyone have any similar experience or advice?


title: How to genericize foreign key references in table?

text: I am trying to design a table to store references to multiple tables as a "target" of the item in each row. An example should clarify what I am trying to do: Imagine you have 4 tables (images, videos, comments, likes) with `likes` being similar to               CREATE TABLE `likes`     `target` int(11),     `user_id` int(11),     `created_at` timestamp      How do you make it so the "target" could be a row of images, videos or comments (eg, you like an image, video or comment) Also how would you go about representing this within your code? (abstract class Like and concrete classes for LikeImage, LikeImage, LikeComment?) or maybe have an interface ILikeable and then the Like object has a ILikeable object on hand? I'm running into this pattern more and more often making things such "like" (like an object) or "subscribing" (subscribe to changes on an object) to various targets and generating "notifications" (notify a user of a change on an object) that are generically able to target objects. Thanks for sharing your knowledge. **Update** :: Is there a nosql way to easily achieve this?


title: What level of understanding should programmers have about OO?

text: More specifically, what do you feel Junior, Intermediate, and Senior programmers should know about OO design and programming? I'm hoping that having some appropriate expectations will help us during the recruiting process.


title: Learning a scripting language

text: I believe every programmer must learn about a core programming language and a scripting language. Seriously I've no hand in any languages like Python, JavaScript, JScript, CScript etc. I'm native Windows Developer and which scripting language would be the best one to do some automation/web related stuffs.


title: How is a Java reference different from a C pointer?

text: C has pointers and Java has what is called references. They have some things in common in the sense that they all point to something. I know that pointers in C store the addresses they point to. Do reference also store the address? How they are different except that pointer is more flexible and error-prone?


title: Do pointers really exist in Java?

text: I read quite a few resources on the internet and now I am quite confused about the existence of pointers in Java. Some claim that there are pointers and some claim that there is no such concept. So what is the truth?


title: Difference between a pointer and a reference?

text: In Java and other high-level languages, a reference leads to an object. In C++, as far as I know, a pointer can also lead to an object. So what's the difference between a reference leading to an object, and a pointer leading to an object?


title: Why do C++ and Java both use the notion of "reference" but not in the same sense?

text: In C++ a reference argument to a function allows the function to make the reference refer to something else:               int replacement = 23;          void changeNumberReference(int& reference) {         reference = replacement;     }          int main() {         int i = 1;         std::cout << "i=" << i << "\n"; // i = 1;         changeNumberReference(i);         std::cout << "i=" << i << "\n"; // i = 23;     }      Analogously, a constant reference argument to a function will throw a compile time error if we try to change the reference:               void changeNumberReference(const int& reference) {         reference = replacement; // compile-time error: assignment of read-only reference 'reference'     }      Now, with Java, the docs say that functions arguments of non-primitive types are references. Example from the official docs:               public void moveCircle(Circle circle, int deltaX, int deltaY) {         // code to move origin of circle to x+deltaX, y+deltaY         circle.setX(circle.getX() + deltaX);         circle.setY(circle.getY() + deltaY);              // code to assign a new reference to circle         circle = new Circle(0, 0);     }      > Then circle is assigned a reference to a new Circle object with x = y = 0. > This reassignment has no permanence, however, because the reference was > passed in by value and cannot change. To me this doesn't look at all like C++ references. It doesn't resemble regular C++ references because you cannot make it refer to something else, and it doesn't resemble C++ const references because in Java, the code that would change (but really doesn't) the reference does not throw a compile-time error. This is more similar in behavior to C++ pointers. You can use it to change the pointed objects values, but you cannot changes the pointer's value itself in a function. Also, as with C++ pointers (but not with C++ references), in Java you can pass "null" as value for such an argument. So my question is: Why does Java use the notion of "reference"? Is it to be understood that they don't resemble C++ references? Or do they indeed really resemble C++ references and I'm missing something?


title: Which computer science subjects are required to follow introductory course in compilers?

text: I am non computer science undergraduate and work as a web-developer(java, python, AS3 etc.) as a professional. I take 1 course per semester at my local university. I had taken Artificial Intelligence(comprising logic, context free grammar, CYK parsing, introductory NLP, markov chains, HMM etc.) last semester. I am planning to take an introductory course in compilers in the coming semster which covers the following syllabus: > Lexical Analysis, Syntax Analysis, Semantic Analysis, Run-Time Environment, > Intermediate Representations, Code Generation, Register Allocation, > Instruction Selection and Scheduling, Introduction to Local and Global Code > Optimizations, Data Flow analysis My question is that, are there any computer science subjects which I should know before taking this course? If yes, it would be great if you could please list those courses.


title: What topics do I need to study for *web* client server programming?

text: I know about client server programming through _sockets_ in C/C++. **What topics do I need to study for _website_ related client server programming?** The database which we'll be using will be either _MySQL_ or _PostgreSQL_.   The platform will be _Linux_.   I don't know which language should be preferred here? Besides language, what are the **_topics_** that I need to know to get this done?


title: Tips about how to spread Object Oriented practices

text: I work for a medium company that has around 250 developers. Unfortunately, lots of them are stuck in a procedural way of thinking and some teams constantly deliver big Transactional Script applications, when in fact the application contains rich logic. They also fail to manage the design dependencies, and end up with services which depend on another large number of services (a clean example of Big Ball of Mud). My question is: Can you suggest how to spread this type of knowledge? I know that the surface of the problem is that these applications have a poor architecture and design. Another issue is that there are some developers who are against writing any kind of test. A few things I'm doing to change this (but I'm either failing or the change is too small are)   * Running presentations about design principles (SOLID, clean code, etc).   * Workshops about TDD and BDD.   * Coaching teams (this includes using sonar, findbugs, jdepend and other tools).   * IDE & Refactoring talks. A few things I'm thinking to do in the future (but I'm concern that they might not be good)   * Form a team of OO evangelists, who disseminate an OO way of thinking in differet teams (these people would need to change teams every few months).   * Running design review sessions, to criticise the design and suggest improvements (even if the improvements are not done because of time constraints, I think this might be useful) . Something I found with the teams I coach, is that as soon as I leave them, they revert back to the old practices. I know I don't spend a lot of time with them, usually just one month. So whatever I'm doing, it doesn't stick. I'm sorry this question is spattered with frustration, but the alterative to write this was to hit my head on the wall until I pass out.


title: When do domain concepts become application constructs?

text: I recently posted a question regarding recovering a DDD architecture that became an anemic domain model into a multitier architecture and this question is a follow-on of sorts. My question is when do domain **_concepts_** become application **_constructs_**. My application is a local client C# 4/WPF with the following architecture: **Presentation Layer**   * Views   * ViewModels **Business Layer**   * ??? **Domain Layer**   * Classes that take the POCOs with primitive types and create domain concepts (e.g. image, layer, etc)   * Sanity checks values (e.g. image width > 0)   * Interfaces for DTOs   * Interface for a repository that abstracts the filesystem **Data Access Layer**   * Classes that parse the proprietary binary files into POCOs with primitive types by explicit knowledge of the file format   * Implementation of domain DTOs   * Implementation of domain repository class **Local Filesystem**   * Proprietary binary files When does the MyImageType domain class with Int32 width, height, and Int32[] pixels become a System.Windows.Media.ImageDrawing? If I put it in the domain layer, it seems like implemenation details are being leaked (what if I didn't want to use WPF?). If I put it in the presentation layer, it seems like it's doing too much. If I create a business layer, it seems like it would be doing too little since there are few "rules" given the CRUD nature of the application. I think all of my reading has lead to analysis paralysis, so I thought fresh eyes might lend some perspective. **Update 1:** To clarify that the application is not a strictly CRUD, the domain layer would also contain signal processing functions and image transform settings. The signal processing functions must be applied on the raw pixel values directly from the DAL, while the image transform settings are stored with the domain objects to be applied by WPF as part of the presentation.


title: Why complex is better than complicated?

text: In python, when you "import this", you can get The Zen of Python. It says "Complex" is better than "Complicated". Why is that? What's the difference between complex and complicated in programming (or in general)?               Beautiful is better than ugly.     Explicit is better than implicit.     Simple is better than complex.     Complex is better than complicated. <--     Flat is better than nested.     Sparse is better than dense.     ...


title: Is using a lot of free third party libraries a good thing?

text: For your proprietary projects at work? Problems I can imagine are: more dlls (can be a problem when for example you have to include a big DLL but you only need few functions in that library), a lot of license statements you have to take care of when releasing your product, the reliability of the library, etc. Any other potential problems? What is your opinion? (info: I'm using .NET at work)


title: Java Transaction Service without the application server

text: Is it possible to have a Java standalone application (no application server attached) that exposes some operations that a client can call and be the one to manage the transactions? I was thinking this application to expose JNDI resources and get a hold of a java:comp/UserTransaction from there, get also a bean from there and call methods A, B and C on it and coordinate the transaction from the client? The application I'm writing isn't complex enough so that I need a big application server around it so I'm thinking to have a standalone JTS inside it that the client could interact with from a transactions point of view. I don't have much experience with distributed transactions and don't really know how to tackle the issue. Is it even possible? Am I getting myself into something beyond what a mere mortal (programmer) can handle? How can I approach this?


title: What writing rules are different for humans and code?

text: It seems that some rules of writing code are in direct contradiction with the rules of human writing. For example in code it's advisable to define each piece of information in only one place and in writing for humans it's normal to repeat important points (though usually phrased differently). **What rules of writing good code contradict the rules of good writing?**


title: How do you decide to Queue/Dispatch events Sync or Async? (in Observer Pattern)

text: Consider the following elements in an event-driven architecture:   1. Observable Object   2. Event Dispatcher   3. Observer(Listener) Now, we have two messages:   1. From Observable Object to Event Dispatcher   2. From Event Dispatcher to Observer(s). How do you decide to pass these messages Sync or Async? Do you use any particular API (in Java) to implement that? For example, in Java JFC/Swing, the first is Async and the second is Sync. The former is the reason that you can still fire more events even if the program is processing another event. The latter is the reason that you should avoid long operations in your listeners since they block the event dispatcher.


title: Managing Production Issues during a Scrum Sprint

text: The question of managing bugs in production has been a large feature in my mind of late. Sprint's are not meant to have any items added into them, but for **critical** bugs, this is simply unavoidable. How does one go about managing this break in the sprint? Do you simply give a sprint a percentage "allowance" of time, thus only filling say 80% of the schedule with sprint items "just in case"? Thanks, Kyle


title: Looking for quality sites built with JavaScript (not jQuery) to learn from their example

text: I'm new to JavaScript. I've read JavaScript: The Good Parts and half of Professional JavaScript for Web Developers. Now I want to follow this advice - find the best sites and look at their code. As suggested by Crockford in Coders at Work: Reflections on the Craft of Programming I want to find the best sites programmed with only JavaScript not jQuery because I want to look at their code and learn from them.


title: How can I automatically test a large, complex spreadsheet?

text: So, I've inherited one of those "Engineer's Special" spreadsheets -- the kind developed by Mort the Engineer, with lots of hairy VBA and WTF, complicated calculations, and no documentation. Fortunately, most of the primary inputs and outputs are on a single page. Maybe not enough for full test coverage, but a start. I'd like to create a quick, poor-man's regression test framework for Excel, but I haven't quite figured out the best method. My gut tells me to create some code that:   1. Has a macro that "saves" a the "main" I/O spreadsheet's values to another workbook, basically creating a user-named, value-only copy of the main input sheet. This "scenario" workbook would have, as its first tab, a list of all of the saved sheets, with metadata.   2. Has a separate macro that "loads" a given set of inputs from said sheets, but does not overwrite the cells used for output, headers, instructions, etc.   3. Has a third macro which is run from the scenario summary table. It would, in turn, load each scenario's inputs into the main workbook, compare each saved output to the current output, and record whether everything matches or not. It would run unattended until it reached a failure to match, then stop so the user can go look at the differences (which would be highlighted). The two caveats: (1) this requires manual synching of the master sheet and scenario sheets when the design of the master changes enough to reposition/add/remove inputs or outputs, and (2) this doesn't scale well if each scenario includes inputs/outputs to test on a multitude of workbooks. Saving/loading named ranges for each I/O cell rather than entire sheets might help with both situations, but has its own drawbacks. Has anyone come up with some other novel way to effectively regression test arbitrary spreadsheets?


title: Design Pattern: Algorithm varies according to the input arguments

text: I will give a simple example to help you understand my question. Suppose we have a rectangle and a Utility class with a method that creates a buffer arround a shape. The `.createBuffer` method has required and optional arguments:   * required: radius   * optional: direction (for example "inside" or "outside", default is "outside") ... maybe more arguments ... Every combination of arguments needs a different algorithm. Which design pattern is appropriate for solving similar problems?


title: What makes Java so suitable for writing NoSQL Databases

text: Looking at this page that aggregates the current NoSQL landscape, one can see that the majority of these projects are written in Java. Databases are complex systems software dealing with the file system, and so C/C++ would be a better choice than Java for this. (that's my thinking which might be flawed) Secondly, databases deal with transferring large amounts of data from disk to RAM -- which they call a working set. The JVM takes non-trivial amount of RAM for it's own purpose -- so it would be more efficient to use a platform that leaves lots of memory for data instead of hogging it for its own operations. The major relational databases are ALL written in C/C++               MySQL              C, C++     Oracle             Assembler, C, C++     SQL Server         C++     PostgreSQL         C     SQLite             C      So what makes Java so popular in NoSQL world.


title: How to script the creation & configuration of a portable (vm-based?) Windows 7 dev environment?

text: I'm getting a new computer and would like to minimize the time spent configuring and maintaining dev environments on my various machines. To that end, I'm thinking that creating a vm with my preferred ide and configuration and using that vm for development on all my machines. I'd like to use Windows 7 as the vm's os. For those who have tried or currently use an approach like this,   1. How can I keep the disk image synchronized without resorting to a thumb drive? What are pros/cons (if any).   2. As I do this first configuration manually, should I record my steps in the interest of scripting them later?   3. If so, what approach would you recommend for scripting? Cygwin + bash? Ant? Something else? Why?   4. Are there potential difficulties I should be aware of re: sharing a filesystem? For instance, in A) accessing vm files from the host machine or B) accessing the vm's HTTP server from the host machine?


title: Can Clojure's thread-based agents handle c10k performance?

text: I'm writing a c10k-style service and am trying to evaluate Clojure's performance. Can Clojure agents handle this scale of concurrency with its thread-based agents? Other high performance systems seem to be moving towards async-IO/events/greenlets, albeit at a seemingly higher complexity cost. * * * Suppose there are 10,000 clients connected, sending messages that should be appended to 1,000 local files--the Clojure service is trying to write to as many files in parallel as it can, while not letting any two separate requests mangle the same single file by writing at the same time. Clojure agents are extremely elegant conceptually--they would allow separate files to be written independently and asynchronously, while serializing (in the database sense) multiple requests to write to the same file. My understanding is that agents work by starting a thread for each operation (assume we are IO-bound and using `send-off`)--so in this case is it correct that it would start 1,000+ threads? Can current-day systems handle this number of threads efficiently? Most of them should be IO-bound and sleeping most of the time, but I presume there would still be a context-switching penalty that is theoretically higher than async-IO/event-based systems (e.g. Erlang, Go, node.js). If the Clojure solution can handle the performance, it seems like the most elegant thing to code. However if it can't handle the performance then something like Erlang or Go's lightweight processes might be preferable, since they are designed to have tens of thousands of them spawned at once, and are only moderately more complex to implement. Has anyone approached this problem in Clojure or compared to these other platforms? (Thanks for your thoughts!)


title: Should we (still) consider a synced XMLHTTPRequest bad practice?

text: As you may know, `XMLHTTPRequest` can be used synchronously or asynchronously, but synchronized requests have always been considered bad practice, and I've always agreed with that. Not only is the ideology of modern JS development heavily based on an event model, but there were also some more prosaic reasons to avoid synchronized requests. For example, old Internet Explorer versions could just freeze suddenly. Today I saw a synchronized request in Liferay source code and thought "What a shame, how dare they. Don't they know that it is wrong?". But then I asked myself what is actually wrong with this approach in modern times, and I wasn't able to give an accurate, logical answer. For example, on the server side it is common practice to use synchronized HTTP requests. Of course all the data could be fetched asynchronously, and perhaps should be fetched that way, but we often need data that will be used to fetch another chunk of data, so in that case the request must be synchronized. So, should this still be considered bad practice? **PS** : I haven't used the term `AJAX` since the first A stands for asynchronous. :)


title: Parsing stdout with custom format or standard format?

text: To integrate with other executables, a executable may launch another executable and capture its output from stdout. But most programs writes the output message to stdout in custom format and usually in human readable format. So it requires the system integrator to write a function to parse the output, which is considered trouble and the parser code may be buggy. Do you think this is old fashioned? Most Unix-style programs do that. Very few programs write to stdout in standard format such as XML or JSON, which is more modern. Example: Veracity (DVCS) writes JSON to stdout. Should we switch to use modern formats? For a console program, human readable or easy parsable: which is more important ?


title: What tasks should an Architect NOT do or limit to be effective?

text: There are plenty of questions/answers about what an architect does, but what should someone in an Architect role NOT do? What are the boundaries/limits to maintain to be an effective Architect? I'm thinking here of Architect vs Developer and Architect vs Project Manager For example, I'm finding myself in a role where my title is Architect but I am also the coding/development lead and project manager on multiple small enterprise projects. I'm struggling with all the task switching and now I want to limit task switching. Trying to wear every hat just isn't working. What tasks should an Architect not do at all? What tasks should an Architect limit? I do think an Architect needs to keep coding, but how to define an appropriate limit for coding work?


title: What are the pros and cons of directly exposing a Table/View entity class to the client?

text: I'm developing a multi-tier application. We separate our project into three logical layers: client, service and data access. However, almost all methods in the service layer don't do anything except returning table/view from DAL to the client and then the client continues processing data. More than 50% of the returned data is bigger than it really needs to be. For example the client needs a username and an email-address but the service layer returns way more data. This is the coding standard in my team. I tried to change this by shaping classes that return what the client really needs but they wanted me to change it back after I had done it. I'm curious what are the pros and cons of doing things that way?


title: BizSpark and SQL Server already present. Can and should we move to OSS?

text: I am starting a new role running engineering in a young startup. The stuff they have is in SQL Server / Windows. I get the feeling we should think about moving to an OSS architecture, main reasons being cost, the ability to test new tools on the fly as they come out, and integrate with leading technologies like RoR and Python easily. Anyone has any suggestions on this? Can it get ugly if we keep our DB backend on SQL Server / Windows and build a Linux / OSS architecture on top of that? Or is the software BizSpark gives you access to enough for anything you need while you stay in the MSFT world? Are tools like LINQ and SSRS good enough? Don't mean to start a fire here, just a real issue our company is struggling with. Thanks for any replies.


title: Is monkeypatching considered good programming practice?

text: I've been under impression, that monkeypatching is more in quick and dirty hack category, rather than standard, good programming practice. While I'd used from time to time to fix minor issues with 3rd party libs, I considered it temporary fix and I'd submit proper patch to the 3rd party project. However, I've seen this technique used as "the normal way" in mainstream projects, for example in Gevent's `gevent.monkey` module. Has monkeypatching became mainstream, normal, acceptable programming practice? See also: _"Monkeypatching For Humans"_ by Jeff Atwood


title: Why is a database represented as a cylinder in architecture drawings?

text: I'm a young upstart programmer and I've never actually seen a database. But computers in large part come in boxes, not in cylinders so I was wondering why they are always represented as a cylinder when people show their architecture drawings. Is there a reason why or is it just tradition to draw them like that?