OO design choice and single responsibility principle

I'm currently refactoring an application which periodically downloads content from various sources (http, ftp, sql, etc). There is a schedule which controls the times during which the application can be active. For example, it can download content between 8AM and 16PM. The application has been written in an object oriented language (C#). This is the general design I came up with in my first iteration: ![First iteration design](http://i.stack.imgur.com/aincc.png) The Scheduler class will be responsible for keeping to the general schedule. It starts the downloading at the start of the scheduled period, and stops it at the end. The Scheduler contains a number of ITask implementations, each of which have their own bit of downloading to do. I've created an abstract base class implementation which periodically calls the protected abstract method "StartDownload". Subclasses of Task will only implement this method, and won't have to worry about timing and scheduling. So far, so good. But while TDD'ing the Task baseclass, I realised that it was actually difficult to mock the behaviour of StartDownload. When the Task's timer ticks, it should only call StartDownload if it has finished the previous download iteration. But since these are implementation details, it's hard to mock. This made me wonder if the Task class isn't actually violating the Single Responsibility Principle. After all, it's taking care of the periodical invocation of StartDownload. And the StartDownload method is responsible for the actual downloading. So I came up with a more separated design: ![Second iteration design](http://i.stack.imgur.com/VVIA3.png) Here the responsibility of the Task class is limited to just periodically calling the Client. And the Client's only responsibility is downloading content. Testing the Task class will now be easier, because I can just inject an IDownloadClient mock. The Task and Download have a 1 to 1 relationship. So each Task performs one download, so to speak. In practice, all Task instances will be added to a single Scheduler instance and started/stopped from there. I do wonder if this is actually a clearer design though... The Task class now seems a bit odd, being just a single implementation without any subclasses. What do you guys think?


How can I solve this potential security exploit (concerning the saving of REST resources)?

I have a File database table with the following columns: `Id (PK), Filename` And a Document database table with the following columns: `Id (PK), Name, Description, FileId (FK)` When a user wants to "save" a Document, my client-side JavaScript does it in two quick AJAX calls (in an attempt to be RESTful and save each resource individually):   1. Uploads the file they have selected. This will create a File record in the database, and the client will receive its Id in response.   2. Saves the Document with the given data (Name, FileId, etc.). This will create/update a Document record in the database. I have a service set up that allows a user to download a file, provided they specify its Id. However, there is some security logic in the service that checks whether a user has _permission_ to download the file, by checking whether there is at least one database "entity" associated with it that the user has access to. For example, a Document would be one such entity. So if a user can access a particular Document (determined by some business rules - but let's just say multiple users can access the same Document), they can download its file. This all seems fine on the surface, **but there is a problem**. The 2-step save process for a Document is all client-side Javascript, so a hacker could easily modify step 2 so that any arbitrary FileId is sent to the server. This would then associate that file with the Document, meaning afterwards the user will have permission to download it! What are some ways I can solve this problem?


Should I manage authentication on my own if the alternative is very low in usability and I am already managing roles?

As a small in-house dev department, we only have experience with developing applications for our intranet. We use the **existing Active Directory** for user account management. It contains the accounts of all company employees and many (but not all) of the business partners we have a cooperation with. Now, the top management wants a technology exchange application, and I am the lead dev on the new project. Basically, it is a database containing our know- how, with a web frontend. Our employees, our cooperating business partners, and people who wish to become our cooperating business partners should have access to it and see what technologies we have, so they can trade for them with the department which owns them. The technologies are not patented, but very valuable to competitors, so the department bosses are **paranoid about somebody unauthorized gaining access** to their technology description. This constraint necessitates a nightmarishly complicated multi-dimensional RBAC- hybrid model. As the Active Directory doesn't even contain all the information needed to infer the roles I use, I will have to **manage roles** plus per-technology per-user granted access exceptions **within my system**. The current plan is to use Active Directory for authentication. This will result in a multi-hour registration process for our business partners where the database owner has to manually create logins in our Active Directory and send them credentials. If I **manage the logins in my own system** , we could **improve the usability** a lot, for example by letting people have an active (but unprivileged) account as soon as they register. It seems to me that, after I am having a users table in the DB anyway (and managing ugly details like storing historical user IDs so that recycled user IDs within the Active Directory don't unexpectedly get rights to view someone's technologies), the **additional complexity** from implementing authentication functionality will be minimal. Therefore, I am starting to lean towards doing my own user login management and forgetting the AD altogether. On the other hand, I see some **reasons to stay with Active Directory**. First, the conventional wisdom I have heard from experienced programmers is **to not do your own user management** if you can avoid it. Second, we have **code I can reuse** for connection to the active directory, while I would have to code the authentication if done in-system (and my boss has clearly stated that getting the project delivered on time has much higher priority than delivering a system with high usability). Third, I am not a very experienced developer (this is my first lead position) and have never done user management before, so I am afraid that I am **overlooking** some important reasons to use the AD, or that I am underestimating the amount of work left to do my own authentication. _**I would like to know if there are more reasons to go with the AD_** authentication mechanism. Specifically, if I want to do my own authentication, what would I have to implement besides a secure connection for the login screen (which I would need anyway even if I am only transporting the pw to the AD), lookup of a password hash and a mechanism for password recovery (which will probably include manual identity verification, so no need for complex mTAN-like solutions)? And, if you have experience with such security-critical systems, which one would you use and why? * * * _Update_ When I wrote the question, I had been told by my boss that I will get read-only access to the Active Directory, and that all users of my system would have follow internal procedures for managing accounts (such as showing a picture ID to our secretary to reset a forgotten password). I wouldn't have had the possibility to create my own groups. But after explaining the situation to my boss and to the AD administrator, I got permission to save my users' accounts in a separate OU and manage them as I see fit. So now I can use Active Directory and still offer an acceptable user experience. Still, if you have an answer which addresses my question under the old constraints, please write it down, I would be interested to hear more about it even if my interest is only academic now.


What exactly is distributed computing?

So I'm a senior in college and a couple of weeks ago, I interviewed at Microsoft for an entry-level SDE position. While most of the interviews (out of the total 7) were on the general principles of data structures and algorithms, one of the interviewers asked me if I knew anything about distributed computing. I replied that, while I haven't had a course on 'distributed computing' per se, I'd like to take a stab at the question. He proceeded to ask a question on mutexes and semaphores that was covered in our operating systems course, and I thought was more about parallelism and concurrency than distributed computing. Having gone through this experience, I am led to wonder as to what exactly constitutes distributed computing? Do multiple parallel threads trying to synchronize for access to a resource constitute a problem in the domain of distributed computing?


Basic memcached question

I have been reading up on distributed hashing. I learnt that consistent hashing is used for distributing the keys among cache machines. I also learnt that, a key is duplicated on mutiple caches to handle failure of cache hosts. But what I have come across on memcached doesn't seem to be in alignment with all this. I read that all cache nodes are independent of each other and that if a cache goes down, requests go to DB. Theres no mention of cache miss on a host resulting in the host directing the request to another host which could either be holding the key or is nearer to the key. Can you please tell me how these two fit together? Is memcached a very preliminary form of distributed hashing which doesnt have much sophistication?


How Should a model and controller be distributed between subviews of the View?

In many User Interface libraries, we have concept of views and subviews. so according to MVC pattern every view should update the model as soon as it changes. For that view should have a reference of its model. If we have a subview and it does some calculation, then should that model also be passed to the subview or part of that model pertaining to that subview should be passed to that subview. and Say when we take certain actions, should there be a separate controller for the subview or the actions on the subview should be handled by its parent view's controller ?


Good practices when writing a parser for a standard file format (such as ePub)

I am considering writing an Android reader software that can read ePubs and display them. I checked the ePub standard documents. However, these contain a lot of information. So I am wondering what is the process of implementing a standard for a file format. What are the steps to get a working implementation without passing by parts of the standard? Are there any best practices? Also, is it even possible to program this alone in a reasonable time? From what I have already found out, ePub is basically a zip archive. That means I could probably use zlib to decompress it. The content is in XHTML and CSS, so I believe it should be possible to display it in a WebView. The parts that are missing are writing the code that can read the metadata and manage the non-standard XHTML extensions.


Programming by usage

Iv'e been programming for 15 years now and I often read online that it seems like a lot of people will plan out their objects and how they interact and the data they need and that seems to shape the exposed interface. However, I find my brain works from usage backwards to the structure and data. **I'm wondering if this is common and any pros/cons to this approach that anyone can think of, and what your mindset is when a new task is thrown your way. I want explore other ideas and approaches in mindset but I only know my mindset and I've been doing it so long. Is this what everyone does?** For example if I were to be tasked with making a stapler class I would write the usage that would make sense to me first and how I would want to use it and then fill in that usage. The first thing I do is open up notepad++ and type:               Stapler stapler = new Stapler(200);          stapler.Load(200);     stapler.Staple(papers);     stapler.UnJam();     int stapleCount = stapler.StaplerCount;      By looking at this it tells me that my stapler needs these functions/properties and I can infer what the parameters are by looking at them most of the time. I seem to have an easier time thinking in code usage like this vs thinking about an abstract object and all it's functionality before writing any code. Writing out the usage often makes the abstract object real in my mind and is easier for me to grasp.


Windows Permissions for Developers?

I work at a Fortune 500 company as a Windows software developer in R&D. Corporate IT is currently gearing up for a company-wide Win7 deployment and as a part of it they are looking to completely lock down admin rights on all boxes (including our dev workstations). I've been tasked to work with them to make the transition as smooth as possible. Lucky me. I'd like to know if there are any published or other highly respected resources out there that I can use to:   1. figure out where to draw a line in the sand    2. back up my position.  Personally, my take is that we're R&D and our job is to do things that are 'out of the box'. Thus we need admin rights. However, having started my career as a Windows Admin, I'm aware of their goals and what they need to achieve. What I need to figure out and back up is a way to build the environment in a way that both IT and R&D can live with it and continue to perform their jobs productively. Development VMs with local admin rights will definitely help a lot, but not in all cases since we interface with lots of custom hardware. The CIO pushing these changes is definitely a 'pure IT' kind of guy with limited knowledge of the development process so I need some references that would be appropriate to share with someone like that. I'm not looking to gather a lot of personal opinions (a lot of which have already been shared here), I really need whitepapers, magazine articles, scholarly works, etc to use to make a strong case to upper management.


implications of a large partial class

I'm writing a middle layer between vendor code and company business logic. Part of the exercise is to insulate our business logic from vendor's types to make swapping out vendor code easier. As such, I'm writing a lot of extension methods that do translation to and from. I'm placing these extensions in public static partial classes. For organizational purposes and simply because, for static extension methods, the class it self does not matter(is this a correct assumption btw?) EDIT: To be clear I'm creating a lot of different appropriately named source files, that all implemented one partial class My question is, how much code is too much for a partial class. I could conceive having 100's of methods in a single class(at some point). When does this become a burden for the compiler and CIL layer? Is there really a limit if these partials classes hold no state/memory?


Will B-Trees and Other Data Structures Become Obsolete With The Advent of Solid State Drives?

Many (perhaps most?) database applications today use B-Trees and variations to store data, because this data structure optimizes the read, write and seek operations on a hard disk (and these operations in turn play an important role in the overall efficiency of the databases). Should Solid State Drives (SSDs) completely outplace traditional hard disks (HDDs), though, could we say that B-Trees and variations will become obsolete, giving room for data structures that are more efficient operating on direct access memory? If so, what will those structures be? (e.g., hash tables, AVL trees)


Why do JavaScript frameworks/libraries have functions which already exist in pure JavaScript?

I wonder why frameworks/libraries have their own helpers although they exist natively already. Let's take jQuery and AngularJS. They have their own `each` iterator functions:   * jQuery.each()   * angular.forEach() But we have `Array.prototype.forEach`. Similarly,   * jQuery.parseJSON()   * angular.fromJson() But we have the `JSON.parse()` function in vanilla JavaScript.


Setting up a simple Ruby\Rails environment

I am coming from a .NET background and beginning my journey into the Mac OSX\Ruby\Rails environment. A lot of the resources I have found such as this one have between 5-10 steps for setting up a Ruby\Rails environment. My question is, what are the bare minimum requirements for setting up a working Ruby\Rails environment? Can I use RailsInstaller and be done? Should I install all of the tools that the above link suggests (XQuartz, Homebrew, RVM, etc) even though I don't really know what they do? Right now I am not being paid to do this, but am also curious what professional Rails developers do when setting up an environment. I am also more concerned about the _why_ as in _why I shouldn't use RailsInstaller_ or _why I should install RVM_.


Converting Fortran 77 code to C#

I'm trying to convert a Fortan77 program to C#. I have a subroutine with about 650 lines of code and horrific GOTO statements all over the place. I'm having a lot of trouble even starting to visualise the flow of the subroutine to figure out what it does. Is there anybody with experience in this sort of thing who could give me any advice on how to get an overview of this subroutine? Are there some tools available to speed up or facilitate this type of conversion?


Config Class/Struct: Pattern or Anti-Pattern? Alternatives?

If you add new configuration options to a program, it can often have tons of ripple effects in terms of getting the options to where they need to be acted upon. There are three basic ways to deal with this that I'm aware of:   1. Pass all configuration settings to the parts of your program that need them explicitly as primitives. This is the most explicit way and the way that decouples things the most. The downside is that this is both verbose and brittle.   2. Make the most frequently used configuration settings global/static. This is the simplest way but introduces action at a distance, hinders testability and assumes that the configuration truly is global (that you'd only want one configuration at any given time).   3. Make a configuration class/struct that contains all the configuration options for the whole program or for each major concern within the program, and then pass this around explicitly. This is less explicit than (1) but more explicit than (2). If you want to change a setting just for one function call, you can clone the config object and change this one value. This is useful in both testing and in practice. However, you still end up potentially passing tons of info to a function that it doesn't need and changing a value in the config class/struct can still cause action at a distance. Would you consider (3) a pattern or an anti-pattern? If it's an anti-pattern, what do you do instead?


How to learn the math behind the code?

I have recently gotten into programming. (Although I know that the number of books you have read does not determine your programming competency or ability, just to paint a "map" of where I am in terms of the content I know...) I've finished the books:               Python 3 For Absolute Beginners     Pro Python     Python Standard Library by Example     Beautiful Code     Agile Web Development With Rails      and am about halfway into Programming Ruby. I have written many small programs (One that finds which files have been updated and deleted in a directory, one that compares multiple players' fantasy baseball value, and some text based games, and many more). Obviously, as I'm not some sort of child prodigy, I can't take a formal Computer Science course until high school. I really want to learn computer science to increase my knowledge about the code, and the how the code runs. I've really become interested in the math part after reading the source code for Python's random module. Is there a place where I can learn CS, or programming math online for free, at a level that would be at least partially understandable to a person my age?


Legitimate use for IRC bots

I recently saw a question on SE about how to do such and such when creating an IRC bot. The only use of IRC bots I was familiar with was message flooding and spamming. I did a Google search for the string I used as my title and was led to an **article** that was an eye opener as to what all an evil IRC bot could do, but I did not see any explanation of a benevolent (or neutral) use of an IRC bot. Is there any? If so, what are they used for?


Does the LGPL allow me to do this?

I am planning to develop a commercial software using a LGPL software. In the LGPL software that I am using some functions in a class are not fully implemented. I want to modify the LGPL code so that the class and not- implemented functions are made visible outside the dll by adding dllexport infront of class and by adding virtual keyword infront of function. Then I plan to implement those functions in my proprietary software. I am ready to distribute the modified LGPL code but not proprietary software that implements functions in the way I want. Does that violate LGPL terms and conditions?


Releasing patches and updates to web service users

I have written one web services using Java. Its already live (up and running). During development I have SVN (repository) + Jira for task maintenance + Maven for building the web services. Now I have some small update for my web services and I have created that task in Jira and committed the files in svn with respect to Jira-Id after all testing, etc. Say my web services is used by 10 clients, we did not give our source code to them. Is there any steps/procedure available to release patch/updates?   Is there any way to render/create the change log at the build time (maven)?   How do I manage the change log for all version or Patch updates during build time? (Automatically)


Should I go back to college and graduate with a poor GPA or try to jump into an entry-level development position?

I once attended a top-10 American university but I am currently not in school for several different reasons. Chief among them is that I did very poorly two semesters and even failed one of them (got two F's) which put me in automatic suspension. My major is not CS but math. I am in a pickle at the moment. After I was suspended I got a job at a niche IT company in the area. I am employed as something of an IT generalist; my primary responsibilities are Windows systems administration/networking but I also do some Android, iOS, and .NET development. I have released a few apps to the app store under my name and my company's name, and we have done work for a few big clients. I started working at my job about 1.5 years ago and I am somewhat happily employed but I do not see it as a long-term fit because it is a small company with little opportunity to advance. I would like to move out to California and particularly to the Bay Area to get a job at a more reputable or exciting company, even at a lower rate of pay, but I am not sure if I should do that or try to go back to school. If I went back to school, it would take 1-1.5 years to graduate and some $. Best case scenario I would graduate with a 2.9 or 3.0 GPA. It is a top-10 school, but that's a crappy GPA. If I do not go back to school, I will be a field where most people have degrees, without a degree. If anything goes wrong I could be really screwed as I feel I will get no respect without a degree. On the other hand I really would like to get started in the field and get more serious about developing good development practices, learning new languages/frameworks, and working with people who know a lot more than I so I can learn and grow as a developer and eventually do my own thing. Basically, I am wondering:   1. Should I just go back to school? How much does the bad GPA / good school reputation weigh in? What about the fact that I am a Math major and not a CS major (have never taken a CS course)?   2. Does my skill set as something of a generalist bode well for me finding work at a start up in the Bay Area?   3. If not (2), should I hunker down and focus on producing a really good (or a few mediocre) iOS apps? Android apps? etc.   4. How would _you_ look at someone who did great in HS, kind of goofed off in college and eventually quit, and got into development?


What web frameworks are capable of loading other web apps at runtime?

I am not sure how to phrase this, but in asp.net there is the notion of a "web application" that is fundamentally just a DLL that the web server loads. It has the ability to dynamically discover and load user controls at runtime (e.g. a customized button), using something called MEF (which can discover dlls and load them). What I have not been able to find anything about is if it asp.net is capable of loading other asp.net web applications. E.g. web application A, looks for any dlls in a folder and dynamically loads them one by one (and maybe loads their index.html pages in a iframe). Can this be done in asp.net or other web frameworks?


Implementing Bulk Update feature and its trade offs

The feature to implement is to allow a user to select items and apply data update in bulk. It is very similar to JIRA's ability to bulk update a list of selected issues. In my case:   * I iterate over the items,    * and for each item, I simply call the existing method used for individually updating an item.  Take note, I cannot do this in sql level (ie. sql batch update) as business logic is in java. Evidently, **for performance** , it will be slower given that a user decides to update multiple items, hence you can expect speed = # of items * rate of transaction. So in effect, updating an item individually should be same speed as bulk updating a list where the list contains a single item. That is fine, as **its a trade-off**. My **other concern** however is this: the method used to update individually, will remain unchanged, and will simply be called by bulk update multiple times according to the number of selected items; this method **acquires locks** to involved tables until it finishes its transaction. This in effect, will cause locking for long time if there where multiple items to be updated hence a user will not be able to use the view and search page that retrieves from the locked tables. It's a **trade-off that may not be as acceptable** as the first point I discussed above. I am conflicted, given that the nature of the existing method for individually updating an item, is really to acquire locks, and I am not suppose to touch that code. I am suppose to only reuse that method, calling it multiple times to implement the bulk update. **Is this 2nd trade-off something we cannot bypass, is it a valid trade-off?** _Please note also, I am not an expert in transactions and locks._


How do you bill your procrastination?

I've recently switched from being an employee to self-employment. However, on lots of days I spend a lot of time being unproductive and procrastinating. Many of my days look like once described by Joel Spolsky, it takes some time till I can start working. When I was still an employee in a company, this was part of my working hours. Now, I have the problem that I feel bad about billing my customers the time I'm not really working, but waiting to start working. On the other hand, I wouldn't be procrastinating if I would not work for the customers. How do you deal with this issue? Do you charge your customers for that time?


Is it ok to store code and use it later?

I've been programming for the many months. What I've found is :   * My team leader illustrates to me the project.   * I start up with an empty project.   * For many common tasks (like calling webservice, showing grid etc.), I either open my evernote account or my previous project.   * I copy and paste the code and tweak it to meet my current requirement.   * For just normal things (like alertboxes, storing cookies etc.) I use intellisense.   * For anything else I go to google, I search and copy the code after reading and adjust it to my need. When I complete my project my team leader and client are happy because the task is getting done. But is it OK to google the code, store it and use it later? Remember I understand the code, I can tweak it later but I don't remember even the proper names of classes. I don't really remember the code. Am I doing it right?


Clojure: vars, atoms, and refs (oh my)

also: defs, java fields, agents The clojure website has documentation for these concepts:   * Vars   * Atoms   * Refs   * Agents I understand the words, but I don't conceptually get the _purpose / meaning_ of these. When should I / how can I know when to use them?


Platform design Issues

Suppose I design a platform over a platform (say Java or Win32 or .NET), which consists of various layers like Database, User Interface, Cloud etc. Now every team would be working to make their product, say database best and less focused on their relationship with other teams, hence resulting in various issues when doing an integration of it. Now, these are my questions in order to achieve a stable and bug-free platform:   1. How could one ensure that while integrating all the layers, there is less overhead involved and also is there any other way to automate this process ?   2. Also, if one particular team is using the API calls provided by other team and if the other team is still not ready with the API calls, there comes a DEADLOCK . How to step over such situations ?   3. Say, I want to monitor and get feedback from various teams regarding their progress. Is there any automation available for such activities ?


How much of Computer Science is actually focused on programming?

The reason why I ask this is because, when I read articles such as Wikipedia's HCI or reports on A.I., I find that much of what it talks about is actual design _theory_. Is this what most of Computer Science touches on? They say there's a difference between being a Coder and a Computer Scientist. Is this like the difference between an Architect and a Draftsman?


What are some of the major differences in process management between CGI and newer (better) technologies?

I know CGI spawns a new process for every HTTP request that it serves, while servlets use one Java process to serve many requests. What do other technologies (rails, WSGI/django, mod_php, asp.net etc.) do so that web servers do not have to spawn a new process new HTTP request?


C++ equivalent to the Sun Java Language Specification and JVM Specification?

Does C++ have an "official" language specification document, similar to the Sun/Oracle: http://docs.oracle.com/javase/specs/#6.6.1


Which if statement requires less computation?

I have               if (!b && c || a && c)       //do action a     else        //...      Due to some internal relationship between a, b, and c. `!b && c || a && c` **is proved to be equivalent to** `(! a && b) || c`. I just wonder will `(! a && b) || c` be simpler than `!b && c || a && c`? Can you prove it? Assume the chances of a,b,c to be True or False is equal. I'm **not asking which style is better**. **I'm asking which statement has lower computational complexity**. Just like asking quick sort and Bubble Sort, which has lower computational complexity. You will not answer it depends, it is related to compiler and hardware because some hardware have special instruction for Bubble Sort. I hope to hear nlog(n) and n^2.


How could your company's learning/development department best serve you?

I'll preface my question with a disclaimer - I am not an engineer, I'm just someone who works with them full-time, in a learning and development capacity. Given that, one of the comments I get regularly from the engineers I'm tasked with developing is that they feel that they're having solutions (both technical and non-technical) for development "pushed" at them vs. anyone from my field consulting with them to determine what they really need. So my question is - if you could give your company a list of the top 3-5 things they could do - in a classroom, or elsewhere - to develop meaningful skills that would help you be a better engineer, a better employee, and one more likely to STAY with the company for the long haul, what would make the cut and why? Thanks in advance for your responses.


Getting data from a webpage in a stable and efficient way

Recently I've learned that using a regex to parse the HTML of a website to get the data you need isn't the best course of action. So my question is simple: What then, is the best / most efficient and a generally stable way to get this data? I should note that:   * There are no API's   * There is no other source where I can get the data from (no databases, feeds and such)   * There is no access to the source files. (Data from public websites)   * Let's say the data is normal text, displayed in a table in a html page I'm currently using python for my project but a language independent solution/tips would be nice. As a side question: How would you go about it when the webpage is constructed by Ajax calls? **EDIT:** In the case of HTML parsing, I know that there is no actual stable way to get the data. As soon as the page changes, your parser is done for. What I mean with stable in this case is: an efficient way to parse the page, that always hands me the same results (for the same set of data obviously) provided that the page does **not** change.


How do I impress employers with my resume?

I built an entire website from scratch in 10 days which looks and feels professional with the site being unique. The site has features like logging in, sending activation emails, tag/content search (lucence.net), syntax highlighting (prettify) and a diff (one of the js diffs), markup for comments all on this site and autocomplete in a textbox (remember, 10 days). I wrote that I have 5+ years of C# experience (I could lie and say more, but smart employers will know it's only 8 years old and 1.1 is very different from what we use now). I had employers REPEATEDLY say they are looking for someone who has more C# experience... wtf. Maybe they don't read my CV, maybe they don't believe it or ignore me because I am not yet a graduate. I laughed when I first read Steve Yegge The Five Essential Phone Screen Questions as I knew all of that (although i still never used graph datastruct nor know much about it). I'm pretty sure, competency-wise, I can do the job. I am also positive that no one noticed I have markup, a diff, auto-complete nor email activation/forget password (I offer a test user account). So maybe my site/example work isn't impressive because you don't realize what is in it. In short, I don't think they read my CV or notice my site. How do I impress employers? PS: The problem is that I don't get to the interview. I had one and ruined it by speaking too technical to the PM because I was nervous. The other 25+ jobs either didn't contact me or were kind enough to send a rejection email.


If immutable objects are good, why do people keep creating mutable objects?

If immutable objects¹ are good, simple and offer benefits in concurrent programming why do programmers keep creating mutable objects²? I have four years of experience in Java programming and as I see it, the first thing people do after creating a class is generate getters and setters in the IDE (thus making it mutable). Is there a lack of awareness or can we get away with using mutable objects in most scenarios? * * * ¹ Immutable object is an object whose state cannot be modified after it is created.   ² Mutable object is an object which can be modified after it is created.


finding houses within a radius

During an interview I was asked given the following: A real estate application that lists all houses that are currently on the market (i.e., for sale) within a given distance (say for example the user wants to find all houses within 20 miles), how would you design your application (both data structure and alogirithm) to build this type of service?      Any ideas? How would you implement it? I told him I didn't know becaue I've never done any geo-related stuff before.


Why don't programming languages separate out style from content?

My ideal programming language would let me define a custom css that would lay out code according to my specifications of columns/space/brackets placement etc. and check in only content. Everybody gets their own layouts - and hence we avoid all the long winded discussions about styles. A language that could do refactoring of variable names / function names as per my style requirements would be better. Another one that could translate to local language would be awesome! Is there one such language variant of C/C++? What are the negatives of this?


Transaction classification. Artificial intelligence

For a project, I have to classify a list of banking transactions based on their description. Supose I have 2 categories: health and entertainment. Initially, the transactions will have basic information: date and time, ammount and a description given by the user. For example:               Transaction 1: 09/17/2012 12:23:02 pm - 45.32$ - "medicine payments"     Transaction 2: 09/18/2012 1:56:54 pm - 8.99$ - "movie ticket"     Transaction 3: 09/18/2012 7:46:37 pm - 299.45$ - "dentist appointment"     Transaction 4: 09/19/2012 6:50:17 am - 45.32$ - "videogame shopping"      The idea is to use that description to classify the transaction. 1 and 3 would go to "health" category while 2 and 4 would go to "entertainment". I want to use the google prediction API to do this. In reality, I have 7 different categories, and for each one, a lot of key words related to that category. I would use some for training and some for testing. Is this even possible? I mean, to determine the category given a few words? Plus, the number of words is not necesarally the same on every transaction. Thanks for any help or guidance! Very appreciated Possible solution: https://developers.google.com/prediction/docs/hello_world?hl=es#theproblem


is OOP the dominant programming model in real world?

**Objects Never? Well, Hardly Ever** In the VIEWPOINT section of Communications of The ACM, I found an interesting article entitled "Objects Never? Well, Hardly Ever". It’s a radically different perspective than objects-first or objects-late. He suggests "objects-never" or maybe "objects-graduate school". The author talked about OOP and made a question about how OOP is used in real world programming environments. He thinks that OOP is not the dominant programming model. For example, he claims, 70% of programmings are done for Embedded Systems where OOP is not really suited. When some professors in universities wants to talk about the benefits of OOP, they talk about code-reuse. As another example, again, he claims, this is not the real case in real world. code-reuse is harder than what's claimed in universities. I claim that the use of OOP is not as prevalent as most people believe, that it is not as successful as its proponents claim, and, therefore, that its central place in the CS curriculum is not justified. It's interesting for me to know how people in stack-overflow think about this? Is OOP the dominant programming model from programmers' point of view? PS: I asked this on StackOverflow, but someone suggests it should be asked here. hope to find a good result :-) PS2: If I should choose/learn/use just one approach, is it OOP or not? why?


Licensing Options for a dead project

I'm currently working on a project where the original author informally told me that he didn't want to publish the source. Since then, the original author has gone leaving me to be the sole developer on the project. I've tried to contact him several times about making the project open source so that I can have other developers assist me but he is not responding to any communications. I'm not planning on trying to make money of the software, I just want a general license that allows me to put the code on GitHub or BitBucket so that other people in the community can assist me with the development. Can I do this since he is gone and not responding to any form of communication? Is there a time period I need to wait? I know what I asking for is legal advice, I just have no idea where to start looking to find the answer so I decided to start here.


Professional Mentorships and Study Groups for Seasoned Programmers?

I am presently an employed software engineer, less than a decade out of college. Given where I would like to be in my career, I am currently looking to sharpen my skills to find my next job. However, I feel that I have certain technical deficits, from my degree and work choices, that make it difficult for me to study on my own or pass muster in the positions I hope to achieve. Because of this, I am trying to find a professional mentorship or continuing study group for practitioners beyond my workplace, as I believe I would benefit from having someone with more experience elucidate areas that I might wish to build competence in. I believe this would also help identify material that I would not otherwise be able to find on my own. This is especially true for the algorithms training that I missed in college. While trying to shore this up, I have participated in Top Coder, Coursera, MIT Open Courseware, and Project Euler. I have also purchased, digested, and worked with many books focused on CS and programming. This is well and good, but having this process be solely self-directed is both isolating and lacking in necessary social feedback on how my studies connect with the real world. As such, I am curious what resources might be beneficial for someone looking for a human component to studying SE/CS outside of the workplace. Would it be valuable if I started a group myself, for people looking to study these areas? * * * _Full disclosure: This is a new account, because I prefer to separate this question from my professional identity. I almost feel embarrassed by it, to the point of not asking, which is precisely why I feel it may be valuable for others here._


What to do when blocked

I began to code 3 different projects, and it is alright, I have done it for 5 months, some php, some c, some matlab, but for some reason I got stuck... Usually when I pass through this I leave for a while or go to sleep (and while sleeping I'm thinking on a solution to the problem I´m currently facing, the most important or urgent), and usually when I return (if I slept well) I have the solution and code comes easily. I don not know what you think, but I have been stuck for around 10 consecutive days! I can't get out of the hole, I only see how time is passing... What do you do when you lose the inspiration? Some friends say Go get some air, do sports, well I have tried... I know lot of you have passed this stage but how?


How To Become More Comfortable with the Technical Terms

I have been working freelance for a few years, and before that I worked as an entry-level coder for a non-technical company. I "understand" how delegates, and MVC, and how to make an app and make it work, but I have done a few interviews recently and they are throwing questions at me that I don't know the answers to. These are questions that I think I _should_ know the answers to, but I basically haven't ever had to use the technical language. Needless to say I feel very stupid when this happens but I don't know how to prepare / remedy this problem without going back to Comp Sci 101. It's like I can do the work, but I don't know what they're talking about. Any suggestions would be much appreciated.


How to organize the quality testing of a large website?

I developed a pretty big website. I tested it myself to the best of my ability, but I cannot test all scenarios that my users may run in to. I found a testing team in India, but they don't seem to have any systematic approach to testing website functionality. They test each individual page rather than the full process that user takes on website. What processes or tools should I use to thoroughly test my website?


Passing data between classes

A question similar to this has been asked before, and will be asked again I am sure. I have spent some time googling and trying to work this out for myself, but I am at an impasse. What I am trying to achieve is to implement a database search screen for an application I have been tasked with creating. What I am doing is loading a JFrame with JPanels through a cardlayout. On a few of these JPanels I will have a button that calls another JFrame that will search a DB and load the result set into a table displayed on the frame. The search is only conducted after the user has typed in the search data and pressed search. The screen is to be disposed of, and return the values once the user has selected a row in the table and pressed another button. I have all the GUI components created, and the DB search functionality working. The problem I have is returning the value. At the moment I have the Search JFrame object created by the JPanel that has the button, but any attempts I ave made to get the data from the search frame have resulted in null results. Is there a way to return a value through this way and if so how? I have tried getter/setter methods, but obviously since the initial results of the variables are null it returns as null. I tried linking the result to the table with the same result. (Actually it returned -1, but that's just splitting hairs). I tried changing the search screen to a JDialog as I read that that can halt the running code while waiting for a response. I tried various methods to check if the search screen was enabled/visible and to hold on those. All to no avail. Any help is appreciated.


Is there such a thing as e-commerce without a shopping cart?

Imagine you want to set up a minimalist e-commerce website for a "lemonade stall". You only have two products - a large glass of lemonade _OR_ a small glass of lemonade (always either/or; never both). You want people to select, to pay, to enjoy - that fast, that simple, and with no other distracting features/options offered. Because you're a child who can't add, and in any case you make the rules, everyone has to pay for their one glass of lemonade separately. A shopping cart makes no sense, and in fact detracts from the value of the product you are offering. On the other hand, you do want to encourage repeat customers, so a customer database of some kind might be useful (or might not). And somewhere in the future you can imagine introducing a medium glass of lemonade as a third product. But that is as complex as it can possibly get. If that is your brief, what are the options one should consider? Writing the functionality from the ground up? Taking an off-the-shelf package and configuring/stripping it back? Using a shopping cart behind the scenes, but hiding it? I'm interested in knowing what approaches are viable, and which is likely to take the least work to get an acceptable result. Answers that lean towards implementation in PHP/MySQL, or e-commerce frameworks written in them, are preferred.


is it a bad programming practice to return a new object in a property

I've always had this question and I think it is time to settle the answer, is it a heavy load to do this :                   public Rect Bounds         {             get              {                 var Top = (_targetPosition + _translationY) - _size / 2.0f;                 return new Rect(callOutStarMargin, Top, _size, _size);              }         }      as an alternative of this :                   private Rect _boundsRect = new Rect();              public Rect Bounds         {             get              {                 var Top = (_targetPosition + _translationY) - _size / 2.0f;                 _boundsRect.Y = Top;                 return _boundsRect;             }         }      doing this I'm avoiding to create a new Rect everytime the property is invoked, I'm not sure if doing this in the first way would create an extra memory/speed overweight, if lets say this property is accessed 1 or 2 times on a list of 100 items each second. So which one should I choose ? **EDIT:** I think I'm not being clear here, my real question is How heavy is it making this new instructions of simple objects like Rect, How efficient is C# garbage collector for example in this scenario of 100 new rects per second , and the cpu cycle difference between one or the other way


Why we say Lisp are Human oriented and Fortran are Machine oriented？

> Lisp and Fortran were the trunks of two separate evolutionary trees, one > rooted in math and one rooted in machine architecture. I see this in _Hackers and Painters: Big Ideas from the Computer Age_. And someone said that Lisp are Human oriented and Fortran are Machine oriented. Here human oriented means that the way of problem solving is more likely human do.   And machine oriented means that the way of problem solving is more likely machine do.   I think that Lisp and base on S-expression and symbol. Fortran are base on von Neumann and Variables. Is it right?


How to add a new developer to the team

I run a small company composed of only 2 developers. We are building a very big application for one of our clients. Development on this project has gone on for 1.5 years. Now this client has secured an important sponsorship, and they are organizing events related to this project. So now we have a deadline in 2 months and we can't miss it. We are thinking of adding a new developer to the team, and I am wondering what we can do to help his integration. This is the situation:   * We are approaching the threshhold of Brooks's law \-- the point when adding new developers will be counter-productive.   * The application is relatively well-designed, but the implementation is chaotic in some points (especially older code).   * There are unit tests only for more recent code. When this project started, we didn't regularly conduct tests.   * Documentation and comments are incomplete.   * The application is both large and complex.   * The client has written down almost every detail about his project, in a very clear and "programmer-friendly" way. Is it a good idea to add a person now? If so, what can we do in order to help the new developer integrate into the team? EDIT: The sponsor is organizing an internet-based sport event for next spring. It must start on a specific day of the year. We can't change it. What we developers (I am one of the two) need to do is:   * Completing the existing application (about 25% of the work to do).   * Creating a new module, essential for the organization of this event (about 75% of the work to do). This new module can't be developed without understanding the main program's API. I can't do an exact time estimation, but we are in a risky situation.


Self-referencing anonymous closures: is JavaScript incomplete?

Does the fact that anonymous self-referencing function closures are so prevelant in JavaScript suggest that JavaScript is an incomplete specification? We see so much of this:               (function () { /* do cool stuff */ })();      and I suppose everything is a matter of taste, but does this not look like a kludge, when all you want is a private namespace? Couldn't JavaScript implement packages and proper classes? Compare to ActionScript 3, also based on ECMAScript, where you get               package com.tomauger {       import bar;       class Foo {          public function Foo(){            // etc...          }               public function show(){            // show stuff          }               public function hide(){            // hide stuff          }          // etc...       }     }      Contrast to the convolutions we perform in JavaScript (this, from the jQuery plugin authoring documentation):               (function( $ ){            var methods = {         init : function( options ) { // THIS },         show : function( ) { // IS   },         hide : function( ) { // GOOD },         update : function( content ) { // !!! }       };            $.fn.tooltip = function( method ) {              // Method calling logic         if ( methods[method] ) {           return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));         } else if ( typeof method === 'object' || ! method ) {           return methods.init.apply( this, arguments );         } else {           $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );         }                };          })( jQuery );      I appreciate that this question could easily degenerate into a rant about preferences and programming styles, but I'm actually very curious to hear how you seasoned programmers feel about this and whether it feels natural, like learning different idiosyncrasies of a new language, or kludgy, like a workaround to some basic programming language components that are just not implemented?


Why a write-enable ring?

Here's an "interview question" that while ostensibly about hardware really does inform a software design principal as well. Computers used to (still do I guess, somewhere) use magnetic tape reels to store data. There was a plastic accessory you could attach to a tape reel called a "write-enable ring". If the tape had such a ring, the tape drive allowed writing to the tape... if not, it only allowed read access. Why was the choice to design the system in this way? Why not have a "write protect ring" instead, with the opposite effect?


Event-driven vs. 'reference'-driven programming (i.e. in JavaScript)

I haven't been able to find the appropriate terminology to search for content on the web related to what I'm asking, so I'm hoping someone on here can at least point me in the right direction. I'm a fairly senior JavaScript developer, but I have a secret -- I don't like event-driven programming (aside from user-triggered event binding I mean). Something about it has never sat well with me, it's the feeling of a "disconnect" in the logic flow. In the simple example of some module invoking arbitrary numbers of views, an event-driven friend would create event listeners for elements those views could have and keep any reference to the parent module out of the view code. I, on the other hand, would pass reference to the parent module in to the views so that I could directly trigger the module's methods. I go for the second approach because I know exactly what is going to happen and what method I'm triggering at all points in the code. In the event-driven case I'm separating the assignment of an event response from the element that would trigger it, putting things in to the 'listening ether'. I know responsible event-driven programming should avoid any risks like double-binding, etc., but even when that care is taken I still see it all as a bit of a black-box ripe for debugging nightmares. While passing references may be a bit more cumbersome in the code, at least it's clear what things are going to happen and when. Can anyone identify the pros and cons of these two methods, and in particular why JS seems to be pushing in general toward the event-driven stuff?


Is there a standard for encoding recurring patterns of dates?

I'm trying to re-write a backend interface doohickey for a calendar, a todo list and another sort of calendar and found that they all were programmed to have subtly different formats for patterns of dates that could be used to configure certain properties in them. I have three screens that have different ways of essentially doing the same thing:   1. ![Calendar](http://i.stack.imgur.com/mtAdU.png)   2. ![Scheduler](http://i.stack.imgur.com/63x5L.png)   3. ![Todo](http://i.stack.imgur.com/M3Lw8.png) and they essentially have the same information. I've got objects for all these, but what I'd like to do is serialize the objects, not to bytecode, but to a semi-human readable format that could be transferred between not only these three screens, but stored as one field in a database and XML.


How to make the leap from classification to clustering

I have a clustering problem which I can't seem to solve, although if I treat it as a labeled classification problem, I can solve it with satisfactory precision. Is there an elegant way to make the leap from being able to solve the classification problem, to being able to solve the clustering one? The details: I have a labeled dataset of movements, from which I extract a features vector for each movement. I can then perform classification of the movements with several tools (SVM, decision trees, etc.) and I get satisfactory results (0.85 precision, which in my case is ok). The problem is, that the real world data I am facing, will of course not be labeled, and is not modeled after the labeled data I have (which means I can't train a classifier on the labeled data, and expect it to perform well on other data). The real world data will for sure not be comprised just of these two classes, it will be comprised of K unknown classes, which I would like to be able to cluster with satisfactory precision. So is it logical to assume that if I can solve the classification problem with high precision, I will be able to solve the clustering problem with high precision? Does it mean that my feature extraction, which works well for the classification, will work well for clustering? Because just throwing clustering algorithms at the problem (k-means, meanshift, dbscan, etc.) doesn't give good results. Usually I just get too many clusters, or just 1 cluster (although I know I have 2 classes), with horrible precision. Btw I am using Python's sklearn.


how to determine minimum requirements of a software

Some software (commonly the commercial ones) producers provide minimum requirements, some examples: Skype, Diablo III, Ubuntu-Server and OpenOffice. I wonder how those minimum requirements are determined, especially RAM, CPU frequency in general? Is there a logic behind it or is it just determined by testing the program with different hardware to find out what would be okay for the end user? If there is a logic to determine such parameters, e.g., how could I prepare such requirements for a C or JAVA code (assuming that it has >10k line)?


Why is it optimal to schedule shorter jobs first on a uniprocessor?

On a uniprocessor, it is apparently optimal to schedule jobs that take less time first assuming non-preemptive scheduling - once a job runs, it must finish. Why? I am confused about how the ordering would change the overall latency. Since a uniprocessor can only take on a single process at a time, wouldn't the latency be the same regardless of order?


Misunderstanding Scope in JavaScript?

I've seen a few other developers talk about binding scope in JavaScript but it has always seemed to me like this is an inaccurate phrase. The `Function.prototype.call` and `Function.prototype.apply` don't pass scope around between two methods; they change the caller of the function - two very different things. For example:               function outer()     {         var item = { foo: 'foo' };         var bar = 'bar';         inner.apply(item, null);     }          function inner()     {         console.log(this.foo); //foo         console.log(bar);      //ReferenceError: bar is not defined     }      If the scope of `outer` was really passed into `inner`, I would expect that `inner` would be able to access `bar`, but it can't. `bar` was in scope in `outer` and it is out of scope in `inner`. Hence, the scope wasn't passed. Even the Mozilla docs don't mention anything about passing scope: > Calls a function with a given `this` value and `arguments` provided as an > array. Am I misunderstanding scope or specifically scope as it applies to JavaScript? Or is it these other developers that are misunderstanding it?


Is it really free to deploy SharpDevelop apps?

I'm trying SharpDevelop to develop c# applications. Regardless of the language and the IDE, is it free to deploy applications that use WinForms? I've been developing with MonoDevelop just because it has a designer for Gtk# (client doesn't want to pay more for licences as to use VS...), but it's too buggy and it's making us lose lots of time. SharpDevelop looks great at first sight, but I wouldn't like the user or us to have problems with legal software. Thank you for the data! Warm regards.


Why is it so difficult to get a programming job?

I Have been looking for a job in the past 10 years. Since I believe the subject I know better is programming, I have been trying to find a programming job. I send my curriculum to a lot of companies, and they basically don't even reply. Lately I sent my curriculum to a php job and I got no answer. When I am called to an interview (yes, it happened) the interview doesn't even lasts 5 minutes and I am quickly dispensed. Sometimes they give a test for the position, and they tell me to go away without even bothering to test me. I have applied for jobs to work with Delphi and PHP. Basically the positions I have applied to, are for internships or first jobs. I never applied to a "senior" or "advanced" position. I am still undergraduate (from university) in compsci. Am I doing something wrong? Do I really need to finish my graduation or get a certification? Is there any tips for having a curriculum that gets you to more interviews? Does this problem happens to everybody or just me?


Client side web development, general question

I'm a novice web developer, mostly worked with ASP.NET. On the server side, everything is very well documented and whenever there is an error, you get an explanatory error message. But on the client side, I'm at a total loss. I never had to develop a very interactive user interface. For example, tag suggestions on this site while you are asking a question. How such a thing is developed? Writing pure javascript and jquery, onkeypress events then ajax, then manipulating the dom and styling newly created html... This should take days even weeks for a novice developer and it's totally error prone. Something always goes wrong and your best chance is guessing what could have gone wrong. It's not like programming with Java or C# etc. Shortly, what I'm asking is what technologies are used for rapid, robust client side web development, that both looks good and reliable. EDIT: An attempt to remove vagueness about question, writing pure javascript to create a highly interactive and elegant client side app is like programming in Assembly. What major frameworks/libraries/technologies used to overcome this complexity?


R vs Python for data analysis

I have been programming for about a year and I am really interested in data analysis and machine learning. I am taking part in a couple of online courses and am reading a couple of books. Everything I am doing uses either R or Python and I am looking for suggestions on whether or not I should concentrate on one language (and if so which) or carry on with both; do they complement each other? \-- I should mention that I use C# in school but am familiar with Python through self-study.


Java and what to do with it

I've been browsing through several websites and several topics on this website. Now I'm just a starting programmer and I want to make a good decision. From what I understand is that Java is used alot for server stuff, and web applets but not really for computer applications running on a client, it's also used for Android programming and several other mobiles. I'm really interested in Android programming, I really love to program for mobile devices, in this case Android because I really think it has a lot of potential and I don't like the iPhone. If I want to program on Android I have to learn Java (aside from Mono). but if my decision changes over the next couple of years I don't think Java is the right language to get a job that programs computer applications. I think I get a job where I have to program server stuff, rather than computer applications. That's why I think C# is a good choice. I can program for Windows Phone 7 (I hope that will get big). and I have the feeling C# is more widely used for computer applications. so I think C# is more versatile looking at Mobile programming and computer programming. Or am I totally wrong thinking this?


Creating Java EE Projects with Maven

I've been developing Java EE web apps with Eclipse for about a year. My employer doesn't use Maven, but the more I read about it, the more convinced I am that Maven + Hudson will be greatly beneficial for us. First, though, I have to become comfortable with those technologies in my spare time, so that I can create a proof-of-concept. Right now, I'm still a Maven newbie. Is there a set of best practices for creating Java EE web apps with Maven? For example, I could create a project with a basic archetype and then add all of the necessary JARs by putting dependencies in the POM for the servlet container, EJB, EclipseLink, etc... That might work, but it might not be the best way to do it. I'd greatly appreciate any guidance that you could provide on this topic.


Consistency vs. Usability?

When designing an API, consistency often aids usability. However, sometimes they conflict where an extra API feature can be added to streamline a common case. It seems like there's somewhat of a divide over what to do here. Some designs (the Java standard library come to mind) favor consistency even if it makes common cases more verbose. Others (the Python standard library comes to mind) favor usability even if it means treating the common case as "special" to make it easier. What is your opinion on how consistency and usability should be balanced?


How bad can it be to lack teamwork when you are a programmer?

I'm still at school, and I know I have problems dealing with other people. I'm not an angry or shy or different, I just like to work my way and with my opinions while respecting other's, I have a big curiosity and hunger for knowledge, but I lack practice and I guess people don't want to work with me because they might fear I would talk some kind of morale. (For example I started to learn programming using linux instead of windows, even if I use windows a lot. And I have a mac). What happens to programmers who lack teamwork ? Where does the problems begin ? Does being a good programmer compensate at least a little ? Is it normal for a programmer to have a vision about his work instead of just doing what he is told ? (I'm I france)


Development methodologies when hundred of developers are working on one single solution?

We are an organisation consisting of around 200 developers that are working continuously on one single product (using the revision control Git) which is planned to be released at a certain date. Due to the huge number of developers, we are trying to create "cross functional" teams with around 10 developers in each team, resulting in around 20 development teams in the organisation. Since we would like to maintain a continuously "high standard" (meaning when developer does a pull, the product should at least be compilable, etc) of the product in the main repository, we would like to use some kind of quality gates. I am a bit unsure how to phrase the question, but I am wondering if I could get some advice of development methodologies for such a large group of developers working on a single product. In our opinion, one end of the spectrum is to allow each developer to commit directly to the main repository, however we fear that due to the high number of developers / commits that the "main repository" might constantly be in a broken stage, due to we can't have a demanding "quality gate" for each commit. The other end of the spectrum might be like (we think Linus Torvalds / Linux does it) a tree or a pyramid structure, where the "main repository" only has three pull sources, these three only has a handful of trusted pull sources, etc. However, we feel that with a structure like that changes have a long chain to climb in order to come into the "main repository". Plus that if a merge conflict occurs, the problem lands on another developer than the "original developer". With all this background information and opinions stated, how can we learn and read recommended development methodologies for so many developers? How do large organisations (Microsoft, Facebook, Ubuntu, etc?) structure up their development?


Word for the superset of files and folders

I'm trying to come up with a name for a class that can represent both files and folders. Anyone know a word for this?


DI / IoC Abstract Factory Galore

Given a project architecture as follows, where each box represents an assembly (all are class libraries), and each arrow stands for a dependency: ![architecture](http://i.stack.imgur.com/IfvWU.png) Might be worth nothing that this project is **massive** (well, it will become!), the complexity incurred by such decoupling is absolutely warranted. **Business Logic Layer** The BLL library defines and organizes various sets of POCO **interfaces** in its `Abstract` namespaces, and implements various functionality _logic_ in its `Concrete` namespaces; the functionality logic refers to and uses the abstract POCO interfaces. **Data Access Layer** The DAL library implements the POCO interfaces from the BLL using `partial` classes that "extend" Linq to SQL (dbml) classes, so if there's a `Customer` L2S class, it implements the BLL `ICustomer` interface. Sometimes the L2S class has different types, or the BLL abstraction uses `enum` types, but most often the partial class code looks like this:               public partial class SomeEntity : ISomeEntity { }      This assembly provides the _Model_ , by exposing classes named "xxxxModel", which are constructor-injected with _repositories_ regrouped into _services_ , but there's a twist: the "xxxxxModel" classes implement an interface called `IUnitOfWork` which encapsulates a database transaction that **must** be able to operate on all repositories at its disposal... possibly with a dynamic (runtime-determined) connection string. To achieve this, I created "model factories" which create a single `DataContext` of the appropriate type, and inject the same instance in each repository. **Presentation Logic Layer** Some of the BLL POCO interfaces need a "ViewModel" implementation (e.g. to display as items in a list) - the PLL library defines them; however the goal of this library is more focused around, well, the actual presentation logic, **although there is no reference to WPF whatsoever** (other than a single reference to _WindowBase_ but I'll get to that). So this assembly provides the _ViewModel_. One thing to note is that the ViewModel here, completely _controls_ the View - each ViewModel is injected with an implementation of `IViewFactory` that creates an `IView` implementation - technically the ViewModel is blissfully unaware of the implementations, so I'm not sure how deeply it violates MVVM (to be honest I don't really care about that point - especially after reading a blog post like this one), but the thing to point out is that it's the ViewModel that litterally _creates_ the View and assigns the `DataContext`. This makes it very simple to deal with things that _should_ be simple, such as showing and closing a window. So all ViewModel classes inherit `ViewModelBase`, which is an abstract class that takes a `IViewFactory` in its protected constructor, effectively instantiating the View. Here's the offending code:               /// <summary>     /// An interface for a ViewModel.     /// </summary>     public interface IViewModel : INotifyPropertyChanged     {         /// <summary>         /// Notifies listener that the value of the specified property has changed.         /// </summary>         void NotifyPropertyChanged<TProperty>(Expression<Func<TProperty>> property);              /// <summary>         /// Notifies listener that the value of the specified property has changed.         /// </summary>         void NotifyPropertyChanged(string propertyName);              /// <summary>         /// Closes the view.         /// </summary>         void Close();              /// <summary>         /// Displays the view.         /// </summary>         void Show();              /// <summary>         /// Displays the view (modal) and returns a <see cref="DialogResult"/> value indicating how the view was closed.         /// </summary>         DialogResult ShowDialog();     }      So a ViewModel essentially _controls_ a View up to the point of _encapsulating_ it, which makes it easy to implement my own `DialogResult` enumeration (much closer to the way WinForms had it). **Views Assembly** Because this library references and consumes ViewModels from the PLL assembly which implement interfaces defined in the BLL assembly, an arrow is missing here - there's also a dependency upon the BLL, but it's only used indirectly. This library provides the _View_ , by defining WPF/XAML windows and controls. Apart from `IValueConverter` and other `MarkupExtension` implementations, there's not much C# code in this library, the hard references to ViewModel implementations are all in XAML `d:DataContext {d:DesignInstance...}` declarations. **So, what's wrong?** I definitely like the direction of the dependencies, including the PLL/Views one. The fact that the BLL has zero dependencies mean I can reuse that library and come up with a WebUI if I ever need one (and that WILL happen... eventually!), and the DAL/BLL decoupling means parts of the data model could be coming from Web services, some cloud, or whatever - business logic couldn't care less and that's good. The main issue I'm having, is that I find myself writing LOTS of abstract factories, and implementing even more of them, and I'm not always reusing these abstractions (hence the smell), but it seems to me like whenever I ask myself how I can inject a "dynamic" dependency, the answer is almost automatically - "an abstract factory will do!"... which is probably right, it's just that I don't think it's right that pretty much everything is a "dynamic" dependency!               public class SomeViewFactory : IViewFactory     {         public IView Create(IViewModel viewModel)         {             return new SomeWindow {DataContext = viewModel};         }     }          public class SomeRepositoryFactory : DataRepositoryFactory<SomeEntity>     {         public IRepository<SomeEntity> Create(DataContext context)         {             return new SomeRepository(context);         }     }      I even have an abstract `IFunctionalityFactory`:               public interface IFunctionalityFactory     {         IFunctionality Create();     }          public class SomeFunctionalityFactory : IFunctionalityFactory     {         private readonly IFunctionalityAuth _auth;         private readonly ISomeBusinessLogic _logic;              public SomeFunctionalityFactory(IFunctionalityAuth auth, ISomeBusinessLogic logic)         {             _auth = auth;             _logic = logic;         }              public IFunctionality Create()         {             var canExecute = auth.IsCurrentUserAuthorised(typeof(SomeFunctionality).FullName);             return new SomeFunctionality(canExecute, _logic);         }     }      Is it normal to have factories for almost everything - from repositories to services and models in the DAL, to Views and ViewModels in the PLL/View library? For now the project is rather small and I'm still the only programmer working on it; I'd like to have an architecture as SOLID and simple as possible when it comes to implementing new functionalities. This is only my 2nd project implementing DI/IoC, needless to say I'm trying to run (and swim, and perhaps even fly) before I can walk... Any tips or issues I'm not seeing? Am I abusing _Abstract Factory_? How else could I instantiate a View? How else could I have a data model that could connect to any of a given set of [almost] identical databases, at the user's discretion? I know I'm breaking MVVM, have I overlooked anything in the pattern that could simplify my existence?


C programming environment

I'm a retired software tool developer who worked in a Unix environment most of my career. I have a lot of games that I wrote in C that I'd like to get going again. Most use the curses library. These programs are quite old. Does Ubuntu support the compilers, link editors and libraries I would need to get this stuff running? I would prefer, of course, an env just like I had when I wrote these, ksh, vi, etc.


Selecting the (right?) technology and environment

We are two developers on the edge of starting new web product development. We are both fans of lean start-up approach and would like to practice continuous deployment. Here comes the dilemma - we are both coming from a C# / Windows background and we need to decide between: Stick to .NET and Windows, we will not waste time on learning new technologies and put all our effort in the development. Switch to Ruby on Rails and Linux which has a good reputation of fast ramp up and vast open source support. The negative side is that we will need to put a lot of effort in learning Ruby, Rails and Linux... What would you do? What other considerations should we take?


Does the ability to start a GPL add-on GPL-ize a program (Gstreamer)

This question is asked in regards to gstreamer but it could apply to any add- on based architecture. I have a Gstreamer based application that can ship as proprietary because I use unmodified Gstreamer in it with all LGPL parts. I may, however, also need to issue a version where one Gstreamer plugin is GPL. As far as I can tell that would contaminate the whole program. If instead of including the Gstreamer pipeline specification in the program, I publish it with the ability to read a pipeline spec from an external file (coded per some set of instructions - i.e. as a GstParseLaunch()-able specification) can I release the program as proprietary and the pipe-spec files as GPL? How far apart would I need to publish those items, that is, would the program be in one distribution and the specs separately released in another? What if the program is never truly released but is instead an embedded application sold inside an appliance and the appliance is sold preloaded with both the proprietary part and tghe non-proprietary part?


What can you specifically do with Basic?

I'm confused on what can specifically be done with Visual Basic programming. I read that you could do anything with it such as create games, so does this mean it could be used to make games that could be uploaded to a website like Kongregate? I'm just wondering what specific things you can do with Visual Basic. Like Objective-C can be used to make apps and Java could be used to make Android apps. What can Visual Basic be specifically used for?


Difference between Windows and Linux development environments?

I have an interview coming up soon for a Business Analyst position and the recruiter mentioned some feedback from a prior candidate that was interviewed who said the interviewers asked him what the difference between a Windows and Linux development environment was. Are there some high level things I need to be aware of from a business point of view when working with a development team or designing an application on Windows vs Linux?


In DDD are Value Object always at the leaves of a relationship tree?

If I have a photo album where each **Photo** can be commented on, Should the **Comments** be Entities or Value Object in these cases:   1. Comments can be added only anonymously (i.e. Comments have no relation to anything except the photo).   2. Comments can be added by registered users (i.e. there will be a relation between the Comment and User entity).   3. Comments can have comments (i.e. 1 user replying to another). I think modeling a Comment as Value Object in the first case sounds reasonable as a Comment won't have any relationships with any other entities. However, what about the 2nd and 3rd case? Does the need to identify which user Posted which Comment changes it from a Value Object into Entity?


Git commit messages with nvie branching model

This Git branching model recommends branching for all development efforts and merging when complete:   1. Branch   2. Develop   3. Merge when complete I'm wondering how this works in practice, given that performing a merge off this model will simply add a commit to the `develop` with whatever commit message happened to be the last one in line. Do people using this model do an interactive rebase on the feature branch before committing? If not, how do you ensure that the commits make sense on the main branch?


Does anyone still use logic analyzers for debugging real time systems?

Many years ago when debugging real time systems (such as the ones used in telephone switches) we had to use logic analyzers (which read execution straight from the CPU) or emulators (which physically replaced the CPU itself). Is there any situation where this type of instrumenting is still relevant?


I need a decent alternative to c++

I've learned php and c++, i will list the things i liked and didn't liked on each of them, how i decided to learn them in the first place and why i feel the need to learn a decent alternative to c++, i'm not a professional programmer and only do projects for myself. **PHP -** Decided to learn because i wanted to build a dynamic website, that i did and turned out very good, i even coded a 'not so basic' search engine for it that would display the results 'google style' and really fast, pretty cool stuff. **PROS -** Pretty consistent syntax for all stuff (minor caveats), great functionality, a joy for me to code in it (it seems to 'know' what i want it to do and just does it) **CONS -** Painfully slow for number crunching (which takes me to c++ that i only learned because i wanted to do some number crunching and it had to be screaming fast) **C++ -** Learned because number crunching was so slow in php and manipulating large amounts of data was very difficult, i thought, it's popular programming language and all, and tests show that it's fast, the basic stuff resemble php so it shouldn't be hard to pick up **PROS -** It can be used to virtually anything, very very fast **CONS -** Although fun to code at the start, if i need to do something out of the ordinary, memory allocation routines, pointer stuff, stack sizes etc... will get me tired really quick, syntax is a bit inconsistent some times (more caveats) I guess that from what i wrote you guys will understand what i'm looking for, there are thousands of languages out there, it's likely that one of them will suit my needs, i've been seeing stuff today and a friend of mine that is a professional programmer tried OCaml and Fortran and said that both are fast for numerical stuff, i've been inclined to test Fortran, but i need some more input because i want to have some other good 'candidates' to choose from, for example the python syntax seemed great to me, but then i found out from some tests that it was a lot slower than c++ and i simply don't want to twiddle my thumbs all day.


Which Continuous Integration framework do you use and why?

There are quite a few different Continuous Integration (CI) frameworks out there and I'm wondering which is the most popular. Which frameworks have you used at firms where you work? Is there any reason one CI framework is more popular than another - perhaps this is to do with the features it offers, things that integrate into it or maybe its just marketing? It seems like continuous integration is used more in the Java and .net worlds than say ruby or python. Why is this?


Does defining the stopping point of a genetic algorithm defeat the purpose of the algorithm?

Wikipedia defines the termination point of a GA to this: > Commonly, the algorithm terminates when either a maximum number of > generations has been produced, or a satisfactory fitness level has been > reached for the population. If the algorithm has terminated due to a maximum > number of generations, a satisfactory solution may or may not have been > reached. Now, if it terminates when a satisfactory fitness level has been reached, and you are the one defining that fitness level, why wouldn't you just be able to create the "perfect" genome from the beginning yourself, since you already know the characteristics of this perfect genome? I guess I'm just a little confused here. I thought the purpose of a GA was to constantly evolve and show us possibly an even better solution than what we thought of, and our fitness function was just something that helped it along the way, not something we put on the pedestal as the termination "perfect" state. Doesn't that destroy the point?


Technique/visualisation aids to help ourselves to have a clearer picture of the code?

Sometimes when code is too complex, I break it down into parts. Is there another kind of technique/visualisation to help have a more clear picture of the code?


What are combinators and how are they applied to programming projects? (practical explanation)

What are combinators? I'm looking for:   * a practical explanation   * examples of how they are used   * examples of how combinators improve the quality/generality of code I'm not looking for:   * explanations of combinators that don't help me get work done (such as the Y-combinator)


Persistent Storage format for (update+read)-intensive data

I am developing a Java application. While using the application, data would be generated that needs to be stored on disk. I am looking for an embedded database appropriate for a average use-case of the application. Initially I planned to use XML for storing information. But, then after some articles, I found a general opinion that XML is not a very good way for adding information due to I dunno why :P This is roughly the XML format, if I use it. It will give you a brief overview of the data-structure.               <A>       <B>          <C>something</C>       </B>       <B>          <C>some other thing</C>          <C>one more thing</C>       </B>     </A>      The data generated would be mostly elements/objects of type C. The data would seldom be deleted. It would be mostly be added or searched upon. In such a scenario what would be a good choice for storing the data.   1. XML.   2. Embedded Database.   3. Something else. I also looked up some embedded database options. The ones that I found most used are **H2** and **Java DB** (I guess same as Apache Derby?) and SQLite. Which one in your experience has given you better results.


Best practice for populating a dynamic popup menu?

I'm creating a dynamic popup menu whose contents depends on the state of what the user clicked on. Is it considered a better practice to create a template menu in html and modify which options are displayed in javascript, or to create everything in javascript on the fly? I'm using jQuery. code example: HTML:

Option 1

Option 2

     ...      Javascript:               showMenu = function (state) {       var menu = $("#menuTemplate").clone(true).removeAttr("id");       if (state) {         menu.find(".opt1").show();         menu.find(".opt2").hide();       }       // the rest of the function     }      or Javascript:               showMenu = function (state) {       var menu = $("

");       if (state) {         menu.append($("
Option 1
"));       } else {         menu.append($("
Option 2>/div>"));       }       // the rest of the function     }


How do I share common classes between windows forms and web applications using C#?

In our environment we have multiple ERP servers plus data that are coming from multiple sources. I need to create a development roadmap for the coming years as it is obvious that side applications will be needed for many things. The choice is that the development will occur with Microsoft technologies. This means that I will be building either web apps (MVC, web forms e.t.c) or standard windows forms applications. The thing here is that I will be creating classes that will encapsulate the business logic that I want to apply to the different projects. What I thought so far: 1) Create class libraries dlls containing the required logic 2) Reuse these libs in my apps. But what about the web apps? Should I use the dlls directly or I should encapsulate them in web services and consume the web services in web apps? In general I would like to find out how should I build my strategy.


An XML file or Database?

I am re-writing a section of my site and am trying to decide how much of a rewrite this will be. At the moment I have a web service feed that generates an xml once per day. I then use this xml file on my website to generate the general structure. I am trying to decide if this information should be located in the database or stay in the xml file.   1. The file can range from 4mb - 12mb.   2. The files depth can go on and on so I have to recurse to find the data I want.   3. I use the .NET serializer classes and store the serialized file in a global variable to avoid re-serializing it each time the page is loaded. My reasons for thinking a database would be better are:   1. I would know exactly where I am in the file by using an internal ID so I wouldn't have to recurse the file to get information.   2. I wouldn't have to load / serialize the XML and could just use my already open database connections.   3. Searching for the data in the file would be quicker(?) as I would just perform an SQL query rather than re-cursing the file. Has anyone got any ideas which is better and which option uses more resources on the server or be quicker? EDIT: The file is read every time the web page is loaded (although only serialized once). It isn't written to by standard users (only by an admin task that runs in the middle of the night). This is my initial investigation before mocking up.


How do graphics programmers deal with rendering vertices that don't change the image?

So, the title is a little awkward. I'll give some background, and then ask my question. **Background** : I work as a web GIS application developer, but in my spare time I've been playing with map rendering and improving data interchange formats. I work only in 2D space. One interesting issue I've encountered is that when you're rendering a polygon at a small scale (zoomed way out), many of the vertices are redundant. An extreme case would be that you have a polygon with 500,000 vertices that only takes up a single pixel. If you're sending this data to the browser, it would make sense to omit ~499,999 of those vertices. One way we achieve that is by rendering an image on a server and and sending it as a PNG: voila, it's a point. Sometimes, though, we want data sent to the browser where it can be rendered with SVG (or canvas, or webgl) so that it can be interactive. **The problem** : It turns out that, using modern geographic data sets, it's very easy to overload SVG's rendering abilities. In an effort to cope with those limitations, I'm trying to figure out **_how to visually losslessly reduce a data set for a given scale and map extent_** (and, if necessary, for a known map pixel width and height). I got a great reduction in data size just using the Douglas-Peucker algorithm, and I believe I was able to get it to keep the polygons true to within one pixel. Unfortunately, Douglas-Peucker doesn't preserve topology, so it changed how borders between polygons got rendered. I couldn't readily find other algorithms to try out and adapt to the purpose, but I don't have much CS/algorithm background and might not recognize them if I saw them.


Naming a class that processes orders

I'm in the midst of refactoring a project. I've recently read Clean Code, and want to heed some of the advice within, with particular interest in Single Responsibility Principle (SRP). Currently, there's a class called OrderProcessor in the context of a manufacturing product order system. This class is currently performs the following routine every n minutes:   * check database for newly submitted + unprocessed orders (via a Data Layer class already, phew!)   * gather all the details of the orders   * mark them as in-process   * iterate through each to:     * perform some integrity checking     * call a web service on a 3rd party system to place the order     * check status return value of the web service for success/fail     * email somebody if web service returns fail   * constantly log to a text file on each operation or possible fail point I've started by breaking out this class into new classes like:   * OrderService - poor name. This is the one that wakes up every n minutes   * OrderGatherer - calls the DL to get the order from the database   * OrderIterator (? seems too forced or poorly named) -    * OrderPlacer - calls web service to place the order   * EmailSender   * Logger I'm **struggling to find good names for each class,** and implementing SRP in a reasonable way. How could this class be separated into new class with discrete responsibilities?


Best practice for managing dynamic HTML modules?

I've been building web apps that add and remove lots of dynamic content and even structure within the page, and I'm not impressed by the method I'm using to do it. When I want to add a section or module into a position in the interface, I'm storing the html in the code, and I don't like that:               if (rank == "moderator") {        $("#header").append('
' +           // content, using + to implement line breaks        '
');     }      This seems like such a bad programming practice.. There must be a better way. I thought of building a function to convert a JSON structure to html, but it seems like overkill. For the functionality of the apps I'm using:   * Node.js   * JS   * JQuery   * AJAX **Is there some common way to store HTML modules externally for AJAX importation?**


DAL vs BLL functions' return types

Here is how I see the main differences between the DAL and the BLL:   * The DAL directly query the database.   * The DAL **doesn't create new information**. It may execute complex sql requests, joining several tables, but the result of such a request never gives any information that wasn't already in the database.   * The BLL applies a business logic on the DAL's informations to create new informations. Now, I wonder what datatypes these layers' functions are supposed to return. For the moment, all my DAL's function return DataTable. But my BLL's functions return some class or list of class that I created. For example:   * dal.getAllPortfolios() returns a DataTable (I'm working with Visual Studio), result of a join on several tables.   * bll.getAllPortfolios() calls dal.getAllPortfolios, but return a List of Portfolio. With my public Portfolio class being in the BLL's namespace. Sometimes, the BLL function doesn't really apply any "business logic" but only map the DataTable from de DAL into a BLL's class. I wonder if this is ok. Maybe all the mapping work should be done by the DAL? If this is the case, where to put my personal mapping classes? In the BLL or DAL namespace (those classes being required in layers above the BLL)?


How should I evaluate new browser languages?

In these days there are many projects whose aim is to bring new languages to the browser by compiling them to JavaScript. Among the others one can mention ClojureScript, CoffeScript, Dart, haXe, Emscripten, Amber Smalltalk. I'd like to try a few of these out, but I am not sure what I should be looking for when evaluating these languages to see if they are suitable for production. How should I evaluate a new browser language, and what are the pitfalls I should be looking for?