returning null vs returning zero, which would be better?

I inherited a project that I am managing and having to maintain pending the redevelopment of the code base. At the moment I am being tasked with adding little features all over the place and have gotten into the habit of returning `null` instead of zero in parts of the code where I am working on. The problem is we have a client that is using this code and parts of code that require data from my implemented features receive a `null` and dump the stack trace in the UI. I would like to avoid this entirely from my input but without the `NullPointerException` there's the potential that errors would be introduced into the client's data which may go un-noticed. Usually I would have come up with my own error notification system but I have never inherited a project before. So I am unsure whether to continue down this path. I still believe that the stack dump is preferable to un-noticed data corruption/inaccuracies.


Will all compilers start supporting C++0x as soon as it is officially out?

It's sometimes frustrating to know that one particular feature is working in one compiler and not in another. Even after downloading latest gcc4.6 few weeks back some C++0x features are not working. Will the **complete** C++0x support provided by the compilers (at least the popular ones) on the very 2nd day when the C++11 is released officially ? Have these compiler vendors decided any timeline to provide the full support ?


Get code from one open source project and add it to another

I found some functions that I want to get from WordPress source code and add want to add them into my project which is going to be open source. Do I simply get the functions that I want and add them to my project with a little comment saying that I got it from WP like:               /**       * Author: WordPress     **/      or is there anything else I have to consider before getting the code? Also, is there anything else apart from the above question that I have to consider if I want to sell to someone my project with these functions?


Do you do custom tests/work for a potential employer before the interview?

Every shop I've worked at we have followed what I thought was a standard hiring sequence:   1. Solicit resumes   2. Phone screen applicants we are interested in   3. In-person interview   4. In some shops, second in-person interview (just w/ CEO for example) Most places I apply to follow something along these lines. But some shops want to give me a test or ask me to build something after I send in my resume. They usually say "congratulations, you've made it to stage 2 of our hiring process!" But for all I know they are asking every applicant they get a resume from to do the same thing. This annoys me because it doesn't scale. If I'm applying for a lot of positions I can't spend all my time doing work that potentially can only land me one job. Plus there's no shared dedication to the process. If we do a 45 minute phone screen, that's 45 minutes the company commits to me and 45 minutes I commit to the company in hopes of a potential match. Do you guys have a policy regarding these sorts of things?


My company claims all rights to my hobby iPhone apps. What is your company policy?

I am a mobile developer in my day job. During my free time (nights and weekends), I develop my personal hobby projects. After I have published my iPhone apps, my company told me they own all rights to any technology related stuff that I create during my term. I read the contract, it is true, it is harsh. Is there better company policy on developing hobby projects? What's yours?


SQL Server 2000 vs 2008 Express?

Due to not wanting to pay licenses my company is still using SQL Server 2000 for new projects.   This is very limiting for multiple reasons.   I'm wondering what are the limitations of using SQL Server Express 2008?   Is there any reason NOT to use it to power ASP.Net MVC3 websites?


Should I build a multi-threaded system that handles events from a game and sorts them, independently, into different threads based on priority?

Can I build a multi-threaded system that handles events from a game and sorts them, independently, into different threads based on priority, and is it a good idea? Here's more info: I am about to begin work on porting a mid-sized game from Flash/AS3 to Java so that I can continue development with multi-threading capabilities. Here's a small bit of background about the game: The game contains numerous asynchronous activities, such as "world updating" (the game environment is constantly changing based on a set of natural laws and forces), procedural generation of terrain, NPCs, quests, items, etc., and on top of that, the effects of all of the player's interactions with his environment are programmatically calculated in real time, based on a set of constantly changing "stats" and once again, natural laws and forces. All of these things going on at once, in an asynchronous manner, seem to lend themselves to multi-threading very well. My question is: Can I build some kind of central engine that handles the "stacking" of all of these events as they are triggered, and dynamically sorts them out amongst the available threads, and would it be a good idea? As an example: Essentially, every time something happens (IE, a magic missile being generated by a spell, or a bunch of plants need to grow to their next stage), instead of just processing that task right then and adding the new object(s) to a list of managed objects, send a reference to that event to a core "event handler" that throws it into a stack of all other currently queued events, which then sorts them out and orders them according to urgency, splits them between a number of available threads for as-fast-as-possible multithreaded execution.


H.264 documentation and ressources

I'm tasked to use an API on a small embedded linux device. The use of the API is rather simple, but there are a gazillion of (face it, not documented) parameters to control multiple aspects of the codec. These parameters seem to be undocumented because they are not the responsibility of the codec supplier but core components to the h264 spec sheets. I'd like to find more information with solid sources on this codec. So far the best I've found is wikipedia. It is a good start but I'm not really sure where to move to from there. I'm asking here because I'd like to find something not too painful to read.


How can I answer interview questions about developing in a team when I've always been a lone developer?

In an interview, I was asked about about my experiences in developing in team settings. However, I've been self taught and have only worked on projects on my own. How would you go about answering this question? I just brought up school clubs and how I was able to play well with others, but this isn't really developer related.


How to manage version control company wide?

Are there any industry standards or best practises on how to manage a rapidly changing code base? The types of applications I am developing always have a custom aspect to them. So there will always be some code written which is client specific for every project. The method we are using now is as follows: Several 'CORE' projects exist in isolation from one another, each core project is a class library which is capable of running on its own, or with dependencies on other core modules. All of these core modules are documented (Sandcastle) and NuGet packages created for them, which are served up via a private NuGet feed. When a customer purchases the software we create a customer specific project which implements the bespoke code that they require, and pulls in the NuGet packages from the core libs as needed. The build of this project is what is provided to the customer, and each customer project has it's own Git repository. This has worked fine for a year or so, but I feel that as we add features to the core libraries the number of nuget packages is growing quite quickly. Is there a better method of organising code, whilst making sure there are not seperate version of the same code lying around? I know in this stackoverflow post it states that: > Google manages to keep the source code of all its projects, over 2000, in a > single code trunk containing hundreds of millions of code lines, with more > than 5,000 developers accessing the same repository. But this seems like it produce problems for us, due to having bespoke deployments. Any ideas or comments on what I am doing wrong? ## Edit The problems I foresee going with the google way are mainly to do with release management and build issues. We use continuous integration, so that every commit a build will be triggered and test automatically run. If we use one all encompassing repo I am not sure what effect this will have on the build and test servers. Will it have to build every customers project? Or would there be a branch per customer? In which case is this any better than a repo per customer?


Patent a program: possible or not?

Suppose I have devised a new algorithm that solves a particular problem faster/better than the currently available fastest algorithm for that particular problem. By faster and better I mean, **drastically** faster in execution time and better in terms of **very less space consumed** compared to an existing algorithm. My question is that can I patent this program? Do I need a second person as a partner? More importantly, **should I patent it?**


C++ for Java Programmers

I am going to have a lecture about C++ for experienced Java programmers. Because C++ is a big language and I have just one lecture, I want to point out the most important "gotchas" and C++ features when migrating from Java to C++. I myself went the opposite way (C++ -> Java) and therefore I would like to hear different opinions on this topic. What would you mention if you were me? The to-mention list I have so far:   * Use cases for C++ (when to use C++ instead of Java)   * Compiler stages (preprocessor, compiler, linker)   * Differences in data types (atomic data types, arrays, structs, classes, unions, enums), automatic conversion   * Pointers and memory management, difference between pointers and references, stack vs. heap allocations   * Interfaces and inheritance in C++ (multiple inheritance, virtual functions and the need of virtual keyword, pure virtual functions)   * Rewriting generics to templates   * STL (thanks Péter)   * Operator overloading   * Basics of macros EDIT: added suggestions from the answers


How to answer to this HashTable interview question?

Today I was asked this question during an interview: > What's gonna happen if we do not override hashcode method for our class, > then add it to `HashTable` and then try to get objects? Could you help me answer that?


Does profiling without benchmarking lead to micro-optimization?

**Read first:** For a definition of the two terms ("profiling" and "benchmarking") and the need for distinguishing them, please read this answer to a previous question. I have to admit that until I saw Winston Ewert's answer, I have never thought of the need to distinguish the two techniques. I simply think that "profiling" can be applied at different "scale levels" of software, and that when it is applied on the higher level, the profiling code in the lower levels ought to be turned off in order to lower the aggregate overhead. After I reflected on the answer, it might have explained why I fell prey to micro-optimization in my previous project. In an effort to optimize during that project, I implemented a low-overhead profiler (inserted into the source code) which is good at generating accurate profiling results at the millisecond level. I then spent all days tinkering with it, and optimized a lot of code based on the profiler's result. In the end, I was successful in reducing the _computation_ part of the project from several seconds to less than a fraction of a second. The next thing I learned, to my horror: when the optimized module was used in a larger project, _I/O and data conversion_ completely dominated the module's _computation_ time. The non-computation part is in the range of 1-2 seconds, making my optimization efforts moot. To this date, I still haven't got a chance to do a true "benchmarking", though I am going to give it a try very soon. Given that "Did you do profiling?" has become the cliche on both StackOverflow and Programmers.SE, is there a danger that my kind of ignorance is actually prevalent among fellow developers? Does this ignorance lead to micro- optimizations all over the places?


What should I do if Scrum member leave half way?

Due to health condition of one of the scrum member, he has to leave the team. My question is, do I need to start a sprint planning session again? or change the burn-down chart? or ask all the team members to bite the bullet and do extra work to meet the target? Thanks


Should a poll framework be closed sourced

I was having a chat with a coworker who is working on a polling app and framework. He was asking technical questions and I suggested he open source the application to get more quality opinions from developers who are interested in this problem and are willing to give it heavy though. He has a different point of view which I think is still valid so I want to open this question for discussion here. He says he believes something like a polling framework should **not** be open sourced because it will reduce its security and validity as people reveal loopholes through which they can cheat. Can't say I completely disagree. I see a somewhat valid point there, but I always believed that solutions by a group of people are almost always better than a solution thought by a single person asking a small number of coworkers, no matter how smart that person is. Again I'm willing to accept that maybe some types of applications are different. Does anyone have an argument in his favor? I'd really like to present your responses to him.


What would help when refactoring a large method to ensure that I don't break anything?

I'm currently refactoring a part of a large codebase with no unit tests whatsoever. I tried to refactor code the brute way, i.e. by trying to guess what the code is doing and what changes wouldn't change it meaning, but without success: it randomly breaks features all around the codebase. Note that refactoring includes moving legacy C# code to a more functional style (the legacy code doesn't use any of the features of .NET Framework 3 and later, including LINQ), adding generics where the code may benefit from them, etc. I can't use formal methods, given how much would they cost. On the other hand, I presume that at least "Any refactored legacy code shall come with unit tests" rule should be strictly followed, no matter how much would it cost. The problem is that when I refactor a tiny part of a 500 LOC private method, adding unit tests appears to be a difficult task. What can help me in knowing which unit tests are relevant for a given piece of code? I'm guessing that static analysis of the code would somehow be helpful, but what are the tools and techniques I can use to:   * Know exactly what unit tests should I create,   * And/or know if the change I've done affected the original code in a way that it is executing differently from now?


How does code produced on an open-source framework is affected by it's original license (MIT in this case)

I'm looking into building a new PHP commercial app for a client that will be hosted as a paid service and possibly resold to third parties with a non- compete clause. I've tested a few frameworks and chose Laravel which is licensed under the MIT License. The framework itself will not be modified but the app will be heavily dependent on Laravel functions and architecture. How does the original license affects code produced with the software it's covering? MIT being a non-viral license, my humble guess is that my code can be distributed under a more commercial-friendly license that prevent third- parties to do anything else than using the app as a final product as long as the original licensed is kept for the framework part. Am I wrong? How should I do this?


What are some alternative methods to IronPython for calling Python code from .NET?

There are some great libraries for Python that have cousins in the .NET world, but some are unmatched. Realizing that Python is a dynamic language, which makes it difficult to mix with a (largely) statically typed language like C# (though this is seemingly getting easier with .NET 4.0), there are options like IronPython which can help match up the two languages. I've never come across any other options for dovetailing Python libraries with .NET. Are there any other ways to do this that are tried and true? I have far less experience with Python, so it's entirely possible that I'm overlooking something.


How many copies are needed to enlarge an array?

I am reading an analysis on dynamic arrays (from the Skiena's algorithm manual).   I.e. when we have an array structure and each time we are out of space we allocate a new array of double the size of the original. It describes the waste that occurs when the array has to be resized.   It says that (n/2)+1 through n will be moved at most once or not at all. This is clear.   Then by describing that half the elements move once, a quarter of the elements twice, and so on, the total number of movements M is given by: ![enter image description here](http://i.stack.imgur.com/cm5Mm.jpg) This seems to me that it adds more copies than actually happen. E.g. if we have the following:               array of 1 element     +--+     |a |     +--+          double the array (2 elements)       +--++--+       |a ||b |       +--++--+            double the array (4 elements)       +--++--++--++--+       |a ||b ||c ||c |       +--++--++--++--+            double the array (8 elements)       +--++--++--++--++--++--++--++--+         |a ||b ||c ||c ||x ||x ||x ||x |       +--++--++--++--++--++--++--++--+              double the array (16 elements)       +--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--+         |a ||b ||c ||c ||x ||x ||x ||x ||  ||  ||  ||  ||  ||  ||  ||  |        +--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--+         We have the x element copied 4 times, c element copied 4 times, b element copied 4 times and a element copied 5 times so total is 4+4+4+5 = 17 copies/movements. But according to formula we should have 1*(16/2)+2*(16/4)+3*(16/8)+4*(16/16)= 8+8+6+4=26 copies of elements for the enlargement of the array to 16 elements. Is this some mistake or the aim of the formula is to provide a rough upper limit approximation? Or am I missunderstanding something here?


Practical Usage Of Structures in c#

> **Possible Duplicate:**   >  When do you use a struct instead of a class? While working in OOPs, we always battle around structures and classes. But in real world, we always sticks to classes. I just want to know what is the practical usage of structures in C# and where are they beneficial over the classes. Or they are just a topic for theory.


Ms Build publishing vs Visual Studio IDE publishing

I am currently working on ms build to publish my winform application based on the environment selected (Dev or Prod). I am using Ms Build Community Task and referencing this article to achieve this purpose. I had a few theoretical doubts based on publishing application. 1) Is there any difference in publishing through the visual studio ide and msbuild? 2) What do most developers prefer to use and why? 3) What are the advantages of using MsBuild to publish an application as compared to publishing through the visual studio IDE? 4) What is faster? I am using a .net 3.5 winform application developed in Csharp and my question is pertaining to clickonce windows applications only. Please help me clear these doubts


Advice on which technologies to use for a client-server desktop application

I am writing a desktop application in Java which will allow clients to authenticate to a server with their credentials, and afterwards view and manipulate some data (orders, invoices, employees etc.) stored on the server. I have decided to use Java to write the client, with SWT for the GUI. However, since I haven't previously worked on any large Java projects, I am not sure what technologies to use to make my job easier in writing the server. The server application will be a frontend for an internal RDBMS, allowing the successfully-authenticated clients to perform various operations on the data the user has permission to work on (not all users have the same role). This will, in simpler terms, work in a similar fashion to a multiuser RDBMS where each database user is only allowed to execute certain stored procedures and nothing more. I would like to have to deal as little as possible with serialization, duplicated code, writing my own protocol for client-server communication, hand-written object-relational mapping etc. It would be nice to be able to have some data bindings between models and GUI and to abstractize away the networking (by some form of RPC, I imagine). The first question to be asked is whether the protocol would be stateful or stateless, but I assume stateless is better (providing the user with some session id after successfully authenticating). The next question is what technologies/protocols/libraries should I use? RPC or something else? SOAP, something else over HTTP, not HTTP? I realize this is somewhat a matter of preference, but I'm not really aware of what options I have. I am interested in what's commonly used in the Java world etc. I would probably also need some way of sharing the model classes' definition (to avoid code duplication) across the client and the server. The client would bind the models to the view and propagate the changes to the server (serializing the model before sending it probably). The server would then deserialize the model object and push it onto the database via some object- relational mapper. Of course, that's oversimplified and is just the way I imagine it would work, but I'm open to any suggestions. My initial impulse was to use Python for the server, because that would make things more interesting for me (plus I have more experience). However, I'm thinking that going in this direction might over-complicate things. It's probably easier to write some model class and use it in both the client and the server than write it once in Python and once in Java and make sure to never forget to sync the changes (but then again, I might be able to use some common format to describe the model and then have it generate code in both Java and Python; I think ASN.1 does something like that). Do you think I can do this using a Python server without too much time wasted caused by the fact that the client is Java? Thank you for taking your time to read this. All of your suggestions are appreciated.


In code quarterly interview with Rich Hickey Michael Fogus hints that Clojure borrows a lot from Haskell: _Fogus: As someone who only knows Haskell enough to read the papers, Clojure appears to be influenced by it substantially. From the names and operation of core functions—take, drop, iterate, repeat, etc.—to its protocols facility, there is a lot in Clojure that a Haskell programmer would recognize. Can you elaborate on Haskell’s influences on Clojure both positive and negative?_ _Hickey: I think Haskell is a fantastic, awe-inspiring piece of work. I haven’t used it in anger, but it certainly was a positive influence. Haskell obviously goes much further than Clojure in pursuing the ideals of functional programing. In particular they differ in the approach to using types to enforce things._ **My question is - Does Clojure borrow concurrency ideas from Haskell?** Fogus hints at some syntax, and there is obviously functional laziness. What about the STM and concurrency operators? **Assumptions:**   * I'm asking this question in a positive tone. I think it is great that Rich could see some of the treasures in Haskell and use them.


Layers - Logical seperation vs physical

Some programmers recommend logical seperation of layers over physical. For example, given a DL, this means we create a DL namespace not a DL assembly. Benefits include:   1. faster compilation time   2. simpler deployment   3. Faster startup time for your program   4. Less assemblies to reference Im on a small team of 5 devs. We have over 50 assemblies to maintain. IMO this ratio is far from ideal. I prefer an extreme programming approach. Where if 100 assemblies are easier to maintain than 10,000...then 1 assembly must be easier than 100. Given technical limits, we should strive for < 5 assemblies. New assemblies are created out of technical need not layer requirements. Developers are worried for a few reasons. A. People like to work in their own environment so they dont step on eachothers toes. B. Microsoft tends to create new assemblies. E.G. Asp.net has its own DLL, so does winforms. Etc. C. Devs view this drive for a common assembly as a threat. Some team members Have a tendency to change the common layer without regard for how it will impact dependencies. My personal view: I view **A.** as silos, aka cowboy programming and suggest we implement branching to create isolation. **C.** First, that is a human problem and we shouldnt create technical work arounds for human behavior. Second, my goal is not to put everything in common. Rather, I want partitions to be made in namespaces not assemblies. Having a shared assembly doesnt make everything common. I want the community to chime in and tell me if Ive gone off my rocker. Is a drive for a single assembly or my viewpoint illogical or otherwise a bad idea?


Python: Counter for Simultaneous calls of a PHP script?

I'm trying to create a queue processing script that's purpose is to find particular files and apply actions based on specific parameters, with the result being to call a PHP script that serves to process a list of message files that we generated and passed to it. One of the things I need to specify in a config file the maximum number of concurrent calls to the PHP processor that can be running at a given time, and if max number of calls is >= then loop until <= Also need to specify a timeout variable 'tOut' in seconds... So basically it looks for the oldest file in the directory, locates a variable in that filename 'chCode', searches for the next oldest files in the directory with the same chCode and reprefix them and output file a list of those reprefixed paths. Then using Popen or Pcall the script with run 'php /path/to/filepathlist' and if: it returns output '00' then continue... it returns any text other than 00 then reprefix and mv.. it returns nothing for tOut secs then reprefix and mv. The counter is the part I'm really needing help with, as this needs to be proper accurate and high performance with batches of hundreds of thousands of outgoing text messages being sorted using this. I can confirm the counter from the PHP script but as said it needs to be accurate. Using Python 2.7 on CentOS6.


Does the programming language or database you use have any effect on the selling of your site?

I was just wondering if the programming language or database you use has any effect on selling your site to another company? I mean is it easier to sell PHP site than other language? How about database type? If I was using Redis instead of MySQL, would that make any difference?


Making my code more robust

I have recently finished a piece of code that passed all tests. (Here is some idea what it does and Here is some actual code.) Problems began, however, when I run my code on the cloud with actual data. Specifically, the remote database I am sending data to, rejects requests if data do not conform to certain scheme. E.g. I cannot send two hashes like that:               array(         array('key' => 'string'),         array('key' => array('string1', 'string2'))     )      Here the type of `key` must be fixed -- either string or array of strings (or sometjing else). I have tried to fix this problem quickly, which lead to some messy behaviour, showing that my code is not yet robust and my tests are not yet sufficient. I wonder what are best practices here. I've read Uncle Bob's book, where he recommends to test for _Boundary Values_. Does it mean to try all possible types of data as method arguments for testing? Does it mean I should start every method with multiple "if statements" to check for input validity, to make those tests pass? Are there cases where it is pointless to worry about errors but rather let them go and deal with them only if they occur? Is there good rule of thumb when to throw `Exceptions` and when only to log messages? I have tried to follow the approach to throw `Exception` when thing _should not happen_ and to output `message` when it can happen but I still want to continue. On the hand, I can still throw `Exception` and catch it later, so I am still not quite certain what is good approach here. I still haven't used custom `Exceptions`, any good practical examples you know to learn about them? Are there a good sources to learn about those things? I know it is a big topic and I've read long philosophical articles on TDD and BDD but they tend to dwell on the abstract level, without breaking down to simple practical rules supported by easy examples. So I am looking for more practical help here, many thanks!


Building a strong robust client-server system

I need some help with regards to implement a pre-designed system that has 4 components and several constraints. I've spent approximately 50 hours trying to determine the best way to build this system; however, I do not think I have a strong enough solution as of right now. ### ~~~ The Background Information ~~~ The purpose of this project is to allows for business owners (and their developers) to access data remotely. It has 4 components.   1. A Web Service    2. A Client   3. A Database For the webservice   4. A Database For the Client The user interface must be in the form of a web service as it is one of the design requirements. The Client is stored on a business owners computer (Which houses their database). It is a local program programmed in the .net platform. Business owners access the web service which then accesses a client, requests for data and passes that data to the client. The above is known and unchangeable (as I am not the person who makes the project specification) ### ~~~ The Real Problem ~~~ The problem is, The Client may not necessarily be at the same place every time, the IP of the client is subject to change. The Client may also simply not be online at the time of the request from the business owner. ### ~~~ My Present Solution ~~~ My Present solution to this problem is to create a TCP/IP Server on the Client. When the Client is turned on or started, it can "register" its TCP/IP Server credentials (the information needed to contact it) into the server along with some identification information. ~~~Editted for clarity~~~ When the Web Service gets a request, it can open a random TCP/IP connection and let the client (Remember the TCP/IP Server is on the Client) know it has a request for data. The Client can then get the request, process it and send a response with a 'request Id'. Based on this request Id, the web service can receive a call, let the client know it has a request, the client can go query the web service for the request, retrieve the request, process the request and send a response back to the web service which can then process the response (extract the request Id from it) and send it back to the appropriate web service caller.   ~~~ End Edit ~~~ (wow that sentence is a mouthful to read out loud) ### ~~~ What I Would Like ~~~ I feel my solution is sketchy and I would really like some feedback as to potential pitfalls that I may not see and better ways of approaching it.


Style guide for C++

Right now I am using Google C++ Style Guide in my C++ code and I was pretty happy with it. Recently I was told that this guide is very bad: it is used internally by Google (I knew that), is outdated, and promotes some very bad practices. So I want to use another coding style. What good and fairly used C++ style guides are there? I write code for both gcc and Visual Studio, and I use a lot of the C++11 features. What I liked very much about Google C++ Style Guide was the indentation, the whitespace and the naming conventions (specially naming all classes, types - including typedefs, type aliases and template aliases - with capital first letter). I know any answer is subjective (I hope this is ok on this site) and I would appreciate any opinion, but I am interested which guides are used these days.


Two-way calendar sync with any client

I have a database of calendar events, that can be administered by the user through a web application. I would like to offer to the user, functionality for viewing their calendar in any client of their choice (to the extent that open standards are implemented), primarily Outlook and Google calendar. I would also want for the clients, such as Outlook, to be able to edit and delete events, which would then be pushed to the web application, or which the web application would pull, or simply: which would somehow be synced. Additionally, it would be neat to be able to create a tentative event in the database, send a meeting request to the client, and have the client's accept or reject status somehow reported back to the application. But if this can't be achieved, that's no big deal. What would be the best approach for such integration? Would my application have to have built in support for communication with every single client API, such as Exchange etc.? Or are there any open standards that I could adopt? My initial attempts with iCal have not been rewarding so far. Perhaps I'm trying to do something that iCal cannot do. In that case, are there other techniques that can?


Opinions on logging in multiprocess applications

We have written an application that spawns at least 9 parallel processes. All processes generate a lot of logging information. Currently we are using Pythons QueueHandler to consolidate all logs into one file. Unfortunately this sometimes results in very messy files which make them hard to read (e.g. Track what exactly is going on in one thread). Do you think it is a viable option to separate all messages into dedicated files, or is this going to make things even more messy due to the high number of files? What are your general experiences when writing log files for multiprocessed/multithreaded applications?


Agile method for a non-technical product owner + one developer

My current client has several internal products which the IT-department supports. All product owners are non-technical and each application is always developed by one developer (and so is all change requests). The current methodology is a bit like waterfall. All uses cases are defined first by the product owner. Then the application is developed and released into a test-environment. The user tests it and says yes/no. Any changes results in a change request and a new release (including setup-packages). And it continues like that until the user is happy which results in the product going to production. I want to introduce an agile method instead to capture changes quicker and focus on the most important features from start. Scrum seems to be overkill since there only is one developer per project. Any other suggestions? **Edit** My client isn't going use anything that isn't documented. So I'm looking for an established and documented method (if there are one which suits one developer).


argument grouping with parenthesis are valid in C++?

On python I can group arguments into a tuple, something like               def func((a, b, c, d), x):         print a, b, c, d, x      I was wondering if it is possible to group arguments in the same way on C++, something like:               void func((int a, int b, int c, int d), float x)     {         cout << a << b << c << d << x << endl;     };


Are Request/Response Parameter Wrappers Good Practice?

I've seen several different ways to design WCF services, and it seems some developers prefer parameter wrappers while others favor 'naked' parameters. To explain what I mean, consider the following service interfaces: **'Naked' Parameters**               [ServiceContract]     public interface IService     {         [OperationContract]         string[] GetValuesByType(string groupName, ValueTypeEnum valueType)     }      **Parameter Wrappers**               [DataContract]     public class GetValuesByTypeRequest     {         [DataMember]         public string GroupName { get; set; }               [DataMember]         public ValueTypeEnum ValueType { get; set; }     }          [DataContract]     public class GetValuesByTypeResponse     {         [DataMember]         public string[] Result { get; set; }      }          [ServiceContract]     public interface IService     {         [OperationContract]         GetValuesByTypeResponse GetValuesByType(GetValuesByTypeRequest request)     }      I suppose there are cases where parameter wrappers make it easier to maintain the service over different versions of the software, since you can control serialization of each member a bit more directly than you can with the first method. But to be honest, parameter wrappers just seem like a lot more code for very little benefit. Am I wrong here?


python factory function best practices

Suppose I have a file `foo.py` containing a class `Foo`:               class Foo(object):        def __init__(self, data):           ...      Now I want to add a function that creates a `Foo` object in a certain way from raw source data. Should I put it as a static method in Foo or as another separate function?               class Foo(object):        def __init__(self, data):           ...     # option 1:        @staticmethod        def fromSourceData(sourceData):           return Foo(processData(sourceData))          # option 2:     def makeFoo(sourceData):        return Foo(processData(sourceData))      I don't know whether it's more important to be convenient for users:               foo1 = foo.makeFoo(sourceData)      or whether it's more important to maintain clear coupling between the method and the class:               foo1 = foo.Foo.fromSourceData(sourceData)


Prevent Click Fraud in Advertisement system with PHP and Javascript

I would like to build an Advertising project with PHP, MySQL, and Javascript. I am talking about something like...   * Google Adsense   * BuySellAds.com   * Any other advertising platform My question is mainly, what do I need to look out for to prevent people cheating the system and any other issues I may encounter? My design concept. An Advertisement is a record in the Database, when a page is loaded, using Javascript, it calls my server which in turn will use a PHP script to query the Database and get a random Advertisement. (It may do kore like get an ad based on demographics or other criteria as well) The PHP script will then return the Advertisement to the server/website that is calling it and show it on the page as an Image that will have a special tracking link. I will need to...   * Count all impressions (when the Advertisement is shown on the page)   * Count all clicks on the Advertisement link   * Count all Unique clicks on the Advertisement link My question is purely on the query and displaying of the Advertisement and nothing to do with the administration side. If there is ever money involved with my Advertisement buying/selling of adspace, then the stats need to be accurate and make sure people can't easily cheat the system. Is tracking IP address really the only way to try to prevent click fraud? I am hoping someone with some experience can clarify I am on the right track? As well as give me any advice, tips, or anything else I should know about doing something like this?


How to deal with almost the same enums?

I need to define **enums** in several classes. The **majority** of fields are the same in all of the enums. But one has one or two more fields, another has fewer fields. Now I wonder what is the best way to deal with this?   1. Create separate enums              public enum Foo {field1, field2, field5 };     public enum Bar {field1, field2, field3, field4 };        2. or use a general enum for them all               public enum FooBar {field1, field2, field3, field4 , field5};      The enumerations contain the list of actions available for each class. **Update** : sorry if the question was not clear enough . I want to use these enums as `parameters` in classes **methods** . for example `classOne` has a method as below :               public void DoSomeThing(Foo action,object moreData)     {         // operation desired     }      here I want **action** to be limited to `Insert` , `Update` and `Delete` while in `classTwo` :               public void DoSomeThingElse(Foo action)     {         // operation desired     }      I want to limit **action** availabe to `Insert` and `Select`


Is programming in the real world much less about programming itself?

I am in the second year of my CS degree, and so far most of the projects I worked on were pretty "programming intensive", which I like. For example, developing a Sudoku solver, creating a database management system from scratch in C, implementing algorithms to find the shortest routes between cities and so on. Recently I started working on some projects outside of my academic environment. Those include a web app and a couple of Android ones, which I shipped and got some people using. What I noticed with those "real world" projects is that I spend much less time programming, and a lot more time learning about the platforms, searching the web for that library I need, trying stuff until it works the way I need, learning to use tools that might help on the project and so on. In other words, I end up writing 5 to 10 lines of code per day because the rest of the time is spent learning auxiliary stuff. **My question** : Is this normal for real world projects, or once you master the platform you are working with you'll go back to programming intensive work?


One huge rails webapp or many small webapps?

We have a huge system to develop, it has 3 main functions:   1. API provider   2. Worker to automated data retrieval   3. Management of data built in workers They all share the same DB, but for scalability purposes we have at least one server for each function, that means initially we have thought on this server structure:   1. 1 server for DB (postgresql)   2. 1 server for load balancer (nginx + management section)   3. N servers for API providers (sinatra app)   4. N servers for workers (sidekiq or Resque) My problem with that is to handle migrations and models which I stated here on SO. Because I haven't found any solutions that we liked I started to think on build one rails app and ship everything inside of it (drop the sinatra and leave everything for the rails app)   1. Is this a good solution, to build a huge rails app and slicing it on each server?   2. Is this a good idea, to leave just the minimal code necessary to run a server?


How should I make progress further as a programmer?

I have just left my college after doing graduation in computer engineering,during my college life I tried to do some freelancing in local market.I succeeded in the last year and earned some small amounts based on joomla,wordpress and visual basic based job.I had some small projects on php,mysql also. After finishing my undergrad life,I sat for an written test for post of python programmer and luckily I got the job and is working there(Its a small software firm do most of the task in python).Day by day I have gained some experience with core python. Meanwhile an USA based web service firm called me for the interview and after finishing three steps(oral+mini coding project+final oral)they selected me(i was wondered!).And I am going to join their with in few days.There I have to work in python(based on Django framework,I know only basic of this framework). My problem is when I started to work with python simultaneously I worked in Odesk as a wordpress,joomla,drupal,php developer. Now a days I am feeling that I am getting "Jack of all trades master of none". My current situation is i am familiar with several popular web technologies but not an expert.I want to make myself skilled. How should I organize myself to be a skilled web programmer?


What kinds of non-source artifacts are vital to your development process?

The "classic" development artifacts are requirements documents and design specifications. But the development process includes many other non-source code artifacts: bug tracking databases, emails, wikis. What kinds of non-source code artifacts do you think are most vital to your development process? And how do you keep these documents up to date? Also, are there any artifacts that you don't necessarily find useful, but have to use because it's required by the contractor or management?


How do I improve my memory and recall?

How do I go about improving my memory and recall as it relates to Programming? I have a tendency to cache API information short term and then immediately put it out of my head as I move on to something else. This sometimes makes me look bad as I can't recall API information on code I should be really familiar with. It also can be a big time sink, as I often know that I can do something with an API, but I have to look up the specifics on how to actually do it. Are there any tools or methods I could use to make up for my memory short comings?


How to release bundled software with different licenses?

Recently, I was in a situation where I wanted to release a simple piece of JavaScript software under an open source license. However, I withdrew from it because the software contained several open source components that were released under different licenses. Under what license should the bundled software be released (given that various third party components are mixed into the software at code level)?


iOS NSError with global handler

I am in the beginning of programming an iOS app. Having read the Apple guides on how to deal with errors, I got the following most important points:   * Exceptions are for programmers   * Use `NSError` for the user Now, `NSError` is usually passed as out-argument which can then be used inside and has to be checked by the caller. However, I'm asking myself whether it is a good idea to use a global error handler, say a singleton which wraps around `NSError` and could be used to trigger errors and error handling from within the called function. Is there anything against that method or would it be a bad practice?


how to ask questions about bad practices in stackoverflow ( or other technical forums)

I had a case when I needed to do something in code that **I knew is a bad practice**. but because of a unique situation and after considering the risks thoroughly decided that is worth it. I cannot start explaining all my considerations that include buisness secrets over the internet but I do need technical assistance. when I tried to ask at SA I got heated responses why it is a bad practice instead of answeres to how to do this. poeple are so conserned about what is the right way to write code that they forget that there are other considerations as well. can anyone provide insight of how to correctly ask such a question in order to avoid "this is a bad practice" answers and get real answers?


Code review revenge

In the company where I work we are doing code reviews. I gave some negative comments about the code (code duplication) of programmer A. My commit was OK and ready to merge and then programmer A added negative comments to my code in revenge. What do you think about this kind of situation?


Does the usage of LINQ and Lambda Expressions lead to less readable code?

I'm having a discussion with a co-worker on Linq, I'll copy here: > Co-Worker: Lets be honest here. Linq syntax sucks. It's confusing and non- > intuitive. > > Me: oh come on, more confusing than T-SQL? > > Co-Worker: uh, yes. > > Me: it has the same basic parts, select, where, and from > > Co-Worker: Linq, to me, is a bastardization of relational + OO. Co-Worker: > Don't get me wrong - it's incredibly powerful, but they repurposed SQL to > use agains object collections. I'm of the opinion that using Linq + Lamda's is very powerful (he agrees), and also makes code easier to read (he disagrees on that point):               pickFiles = from f in pickFolder.GetFiles("*.txt")     where ValidAuditFileName.IsMatch(f.Name)     select f;      or               var existing = from s in ActiveRecordLinq.AsQueryable<ScannedEntity>()     where s.FileName == f.FullName && s.DocumentType != "Unknown"     select s;      or (VB code here)                  Dim notVerified = From image In images.AsParallel          Group Join verifyFile In verifyFolder.GetFiles("*.vfy").AsParallel.Where(           Function(v) v.Length > 0           ).AsParallel        On image.Name.Replace(image.Extension, ".vfy") Equals verifyFile.Name          Into verifyList = Group         From verify In verifyList.DefaultIfEmpty         Where verify Is Nothing         Select verify      To me this is clean and easy (at least easier than the alternatives) to read, what are your opinions on it?


Django - Using a JSON string as an attribute map to avoid subclassing

I have a Django model called Entity. Different types of Entity have different attributes (e.g. some have a currency associated with them, others don't). I'd rather not have to create a new subclass for every permutation of attributes. **Question** : Is it a bad design decision to create a CharField or TextField called "attributes" that uses a JSON-encoded map with the attribute names and values for a given entity? For the purposes of the answer, assume that I don't have many Entity records (~8,000) or users (~100 at one time, worst case) to deal with, so I'm not sure if the performance hit from dealing with a JSON object is a big problem.


Is it necessary to create a database with as few tables as possible

Should we create a database structure with a minimum number of tables? Should it be designed in a way that everything stays in one place or is it okay to have more tables? Will it in anyway affect anything? I am asking this question because a friend of mine modified some database structure in mediaWiki. In the end, instead of 20 tables he was using only 8, and it took him 8 months to do that (it was his college assignment). **EDIT** I am concluding the answer as: size of the tables does NOT matter, until the case is exceptional; in which case the denormalization may help. Thanks to everyone for the answers.


How to model future iPhone application GUI?

Say you're working on designing the world's greatest iPhone app. How do you decide what UI would be more effective, would be more intuitive etc? How do you take an idea and decide how to visually represent it? Do you use any programs (on a mac) to model something like that?


How is the router configuration gui designed and implemented?

It's a rather simple concept, and each vendor seems to have their own "Website" for their config. I am curious to find out a few things. In my linksys router, if I go to 192.168.1.1, it asks for a simple log in, followed by the status page. Here ports/passwords and all that can be completely changed. What's interesting is how the firmware updater works. You can click upload, drop in their new firmware, and it presumably flashes the device. What technologies / frameworks would be ideal for creating my own custom router page? I've seen a custom one (Tomato).


Microsoft Public License Question

Let preface this by saying that I understand that any advice I may receive is not to be taken as 100% correct, I am just looking for what people's understand of what this license is. I have been looking for a library that allow be to deal with archived compressed files (like zip files) and so far the best one I have found is DotNetZip. The only concern I have is that I am not familiar with the Microsoft Public License. While I plan to release a portion of my project (a web application platform) freely (MIT/BSD style) there are a few things. One is that I don't plan on actually releasing the source code, just the compiled project. Another thing is that I don't plan on releasing everything freely, only a subset of the application. Those are reason why I stay away form (L)GPL code. Is this something allowed while using 3rd party libraries that are licensed under the Microsoft Public License? **EDIT**   The part about the Microsoft license that concerns me is Section 3 (D) which says (full license here): > If you distribute any portion of the software in source code form, you may > do so only under this license by including a complete copy of this license > with your distribution. If you distribute any portion of the software in > compiled or object code form, you may only do so under a license that > complies with this license. I don't know what is meant by 'software'. My assumption would be that 'software' only refers to the library included under the license (being DotNetZip) and that is doesn't extends over to my code which includes the DotNetZip library. If that is the case then everything is fine as I have no issues keeping the license for DotNetZip when release this project in compiled form while having my code under its own license. If 'software' also include my code that include the DotNetZip library then that would be an issue (as it would basically act like GPL with the copyleft sense).


Can continuous delivery work in a big enterprise environment with lots of connected systems?

Much has been said lately of continuous delivery. It does sound appealing, but runs against the grain of convention wisdom in big corporations.   * Jez Humble - Continuous Delivery   * Thoughtworks Presentation - Continuous Delivery - Part 1   * Thoughtworks Presentation - Continuous Delivery - Part 2 Assuming the following:   * You have a number of remote systems connected via ESB   * You have an established system with several years of coding changes applied to it   * This is a website that allows financial transactions   * There are multiple backend systems responsible for processing different types of transactions   * Currently production releases assume a multi $10K investment in a manual regression test Can Continuous Delivery be implemented in such an environment? (ie is the underlying assumption behind Continuous Delivery that you invest a large amount in automated regression testing that is coordinated across systems?) (Surely automated unit tests can prove a system is not incorrect, but can't prove it is correct).


Learning basic graphics programming

After learning the basics of computing simple die throwing games and calendar applications, I want to explore simple graphics - drawing and moving around geometric objects is ok to start with, eventually adding pixel graphic of course. I've taken an introductory Java course but would rather do it in C++, Python or a combination of them (that's what we will eventually be using in school). I also want to learn the principles behind it, not just blindly applying incomprehensible syntax to make the compiler happy. Some posts seem to imply SFML is a solid choice, so I thought I'd get a book covering it and work through it, but there only seems to be ONE book on SFML available, and that one hasn't been reviewed at all. Not in the mood for a $30 gamble, so I'm feeling kind of lost! How should I approach learning basic graphics programming?


What does it mean for the JSON interchange format to have a license?

A recent flurry of comments on a JSHint issue alerted me to the fact that the JSON data-interchange format has a license. The content of this license can be debated elsewhere. What I'm unclear on is what it means for JSON (or any other data-interchance format) to have a license. If an a library simply consumes and parses JSON, does it have to include this license? I understand that using a library that contains this license would require a user to include it. I'm talking about writing a library from scratch. What if I have to use JSON because a third party service only communicates via JSON. If I'm serializing and deserializing data according to the RFC, do I still need to refer to the license?


Is there a title for someone who is both a Software Developer and a Business Analyst?

I usually see two job titles in the IT industry. My understanding of their most commonly accepted usage (simplified):   * **Business Analyst:** Main role is eliciting the users' needs   * **Software Developer** Main role is to design, build and test a software solution answering the needs I'm wondering: " _How we should call somebody whose role is to do both of the roles above?_ " Is this a common job title? And is trying to find people with these broadness of skills realistic, difficult? **EDIT:** I'm specifically interested to name Lead Software Developers who have eventually learned and can apply techniques of Business Analysis.


Tracking work history in a git repo

**Previous related questions:**   * Code bases for desktop and mobile versions of the same app   * Git branching and tagging best practices **Question:** I have split my repo into three directories (swing, android, and common) as suggested by @KarlBielefeldt in response to my previous question. Now I am jumping back and forth between developing my Android port and tweaking/adding features to my original Swing app. All of my commits are linear (fast-forward) and only my commit messages give hints indicating whether I'm working on my Swing app or my Android app. Is there a better way to keep track of the work flow in my git repo?


Learn to Program by Chris Pine book question

I don't know where to post this, so sorry if this is the wrong place. I bought the book Learn to Program by Chris Pine on my iPad, I will be travelling for about two days so want to read this book and learn to program obviously but won't have access to a computer so is it worth reading this book while travelling? I flicked through it and has some exercises so was wondering what I should do. thanks


Representing a parent/child hierarchy in a Relational Database

I am working on an application that connects to another application (Quickbooks) using an API by sending/receiving XML requests/responses. I am able to work with the data in the XML response and load it into a datatable in c#, so that's not the issue. What I am looking to do is write the data from the Quickbooks XML file to a relational database such as SQL Server so I can make it available to a web app or other applications. The problem I am having is that for the Accounts object, there are multiple child entities (up to 5) for a given parent. For example:   * Parent: Revenues    * Child: Charitable Donations   * Sub-Child: Homeless Shelter   * Sub-Sub-Child: Seattle Mission   * Sub-Sub-Sub-Child: Food This example is a bit extreme, as the particular file I'm working with only goes out to three levels, but a maximum of five is allowed by Quickbooks (thus I'm trying to come up with a solution that would scale well). When I create my datatable in C# from the data in the XML file, I have two columns: ParentID, ChildID. It would look like this:               ParentID     ChildID     Account               Balance     --------     -------     -------               --------     001          002         Revenues              45670     002          003         Charitable Donations   1500     003          004         Homeless Shelter        800     004          005         Seattle Mission         400     005          NULL        Food                    200      In this example, I am able to determine all of the child IDs of a parent, and then look to the ParentID with that ChildID and see if that child has any children, etc. I have a method which does a fairly good job of parsing through that, and it works fine for the time being, but is this really the best way to store it in a database if I wanted to permanently house the data in a relational database? It seems like there should be a more elegant solution, but I'm not sure what that would be.


How big does my project need to be for me to unit test it?

I assume that my project is decoupled enough to allow for unit testing. But how big, exactly, in terms of clases and functions does my project need to be to make unit testing worthwhile? We all make mistakes and no one's perfect, but I consider myself a decent programmer to handle small projects' errors with stepping through. Or is unit testing a hard necessity no matter of what size your project is?


Is donationware non-commercial?

I use quite some "non-commercial" applications when working on software projects. For clarification, I mean developing **applications** here, for example smartgit, **not libraries** or anything that gets shipped. Is it legal to provide a donation button for projects made using the non- commercial of certain applications? I know, I know, "consult a lawyer". Here's the real world: I'm a 16 year old hobbyist programmer that doesn't have the time nor money to consult one - a quick question on the internet would probably be a better idea.


Is there an industry standard for structuring code and comments?

I've worked with a number of professional teams and it seems that class code structure ranges from highly organized to completely cluttered. I did a project with the State of California recently and they required using specific Regions in my VB code, along with inline XML comments for auto-docs. It was very structured, but in many classes, there was more commenting than code. I'm just curious if there is an industry standard for code structure and commenting. **EDIT** Maybe a more appropriate question would be, what are some good practices to adopt for readability and maintenance and why? I want to set good coding habits early.


Google Summer of Code Experience

I was a Google Summer of Code student this year and successfully completed my project. It was an awesome learning experience. Just wondering, from an industry point of view - how is or how well is a Summer of Code experience viewed? I mean, if you were going to hire me, would it mean anything to you? I am just asking this since doing SoC != an internship. As a SoC student, I was a independent contractor for Google. Sure, there was proper development, but I am interested in looking at it from the experience you guys have here. Would you prefer me? Sorry for not revealing my name; I'd hope you understand.


Using a web framework as python GUI

If I built some useful piece of python code to e.g. scrape a website or to calculate something big, at some point I might want to add a GUI to my project. For this I could use Tk, Qt, Pygame or any python graphic/GUI framework. Now I also want this tool to be usable by clients without the need for a python installation. Of course I could use something like py2Exe or py2Dmg. But wouldn't it be cooler to use a python-based web framework for this? Something like Django or Pyramid. What would be the drawbacks of doing this? Can I just use the framework to execute my code on a server and only return the result? Or will this get tricky when there are multiple users?


Have you ever done a project using a languages that is not the mainstream choice for the specific niche of the project? Why?

I was thinking about my academic experience with Smalltalk (well, Squeak) a while ago and whether I would like to use it for something, and it got me thinking: sure, it's as good and capable as any popular language, and it has some nice ideas, but there are certain languages that are already well entrenched in certain niches of programming (C is for systems programming, Java is for portability, and so on...), and Smalltalk and co. don't seem to have any obvious differentiating features to make them the right choice under certain circumstances, or at least not as far as I can tell, and when you add to it the fact that it's harder to find programmers who know it it adds all sorts of other problems for the organization itself. So if you ever worked on a project where a non-mainstream language (like Smalltalk) was used over a more mainstream one, what was the reason for it? To clarify: I'd like to focus this on imperative languages.


where to get CodeIgniter views from

I just started using CodeIgniter I'm wondering if anyone knows where I can download pre-made views. For example right now I'm looking for an admin interface. I could write the code myself but I'm feeling lazy ;) Is there a place where you can get pre-made templates like you can for most CMS's? Thanks!


Can a shop score 12 on the Joel Test and yet be anything but Agile (or Lean)?

Inspired by this question - can an agile shop really score 12 on the Joel Test: Can you come up with explanations or examples where a software development organization satisfies **technically** all 12 points of the Joel Test, but fails to live up to the agile or lean principles?


Why are some classes or methods not "parameter compulsory" in java

Question title can be a little confusing but I didn't have a better way to put to put it. In Java you can have this:               JLabel HoHoHo = new JLabel();     ...     HoHoHo.setText("Ho Ho Ho");      And this:               JLabel HoHoHo = new JLabel("Ho Ho Ho");      In both cases, it gives a label with `Ho Ho Ho` on it. **Question** How is that possible? I mean, are there to JLabel classes, one with a `String` parameter and one without?


Software Licences Wizard

Is there a license "wizard" question system that asks you questions about how you would like to use the software, and then either allows you to compare it against one or more license types. Background: In asking a question that requires the open source image recognition software to have a license commercial internal distribution without release of the source code even internal to all those who have the binary... I realized that the current answer using a GPLV2 license likely mean it's a bad fit. I'd like to make the question more clear by adding a list of licenses that are known to be a fit, and those that are not a fit, but I don't even have a clue as how to do that other than to ask if there's a wizard that will help do this.


When are scripts inside HTML not considered a bad practice?

I am new to web development. While studying the Play framework and JSP, I noticed that they both give an option to place script (in jsp scriptlet) inside HTML, but in both books I am reading they both say it is bad practice and don't give an explanation as to when should I use scripts, only writing not to. My question is, if both frameworks supply such an option, when would it be ok to use scripts inside HTML? Please note, I'm talking about server side scripts for creating dynamic HTML (i.e. JSP scriptlet).


Why did the team at LMAX use Java and design the architecture to avoid GC at all cost?

Why did the team at LMAX design the LMAX Disruptor in Java but all their design points to minimizing GC use? If one does not want to have GC run then why use a garbage collected language? Their optimizations, the level of hardware knowledge and the thought they put are just awesome but why Java? I'm not against Java or anything, but why a GC language? Why not use something like D or any other language without GC but allows efficient code? Is it that the team is most familiar with Java or does Java possess some unique advantage that I am not seeing? Say they develop it using D with manual memory management, what would be the difference? They would have to think low level (which they already are), but they can squeeze the best performance out of the system as it's native.


OOP and relational databases

I see a lot of talk in the OOP world about principles and laws such as **Open/Close** and **Loose Coupling** , I can understand how they are so high valued, However I seem to have ran into a problem with applying these principles and laws once I start to include relational databases. For example purposes, if I have a application which we are able to separate well into multiple components( **Open/Close** design) and allow them to work with each other when if needed, I start to run into problems when trying to enforce **referential integrity**. If I enforce a relational setup, and enforce integrity through foreign keys and so on, the tables become dependent on each other, gradually my OOP application logic starts to fall apart and become one big system. I can of course remove all references to tables, but then I risk making data redundant and start to repeat code/data, which then goes against the Don't Repeat Yourself principle. Have you came across such problems before? If so how did you handle it? Perhaps there is a way to achieve both referential integrity and OOP open/close components. Thanks


What are the non-technical reasons that make Object-Relational Mapping tools (ORMs) so difficult to write?

I know the technical pitfalls of writing an ORM are pretty well-known nowadays, but what are some non-technical factors (e.g., Scope) that make it difficult to writing a good ORM? EDIT: I have already read the technical reasons for why ORMs are so difficult to write from this Stackoverflow post: http://stackoverflow.com/questions/404083/is-orm-still-the-vietnam-of- computer-science


What skills in game development are common in other software development areas?

I am a game dev who was working in the game-industry and then ... got laid off. Ever since then, life has been stressful! During this time, I have met so many other devs who have also been laid off irrespective of the number of years they have been in the game. There just aren't many opportunities for game development where I live. I can't think of a domain/place where I can use my game development skills. I know graphics/simulation/visualization is huge, but I can't think straight and am left clueless where to go from here. What are some of the domains/companies where I can use my skills? What skills are common between game development and other areas of software development?


How do you deal with design in Scrum?

How do you deal with design in Scrum? Do you still have well written design documents for each scrum iteration? Do you just do design notes featuring UML diagrams? Or do you just have well commented code? Each iteration may involve changing design so I just wanted to know how people capture this so new developers have an easy job of understanding the domain and getting on board as rapidly as possible.


What should I expect from my first programming job?

I just got hired for my first programming job! I am 25 and have been using Java academically for 6 years. Now that I have been hired I am nervous that my skills will not be what the employer expects. I am afraid I will be assigned to a project and have to ask lots of questions that my coworkers will feel are amateur. Is this a rational fear? What were your first programming job experiences? What should I expect? What advice could you give me? Thanks.


Creating system diagrams for a small app

I am learning system design (on my own) and still I am not clear on a few things. Assume there is a simple application with a front-end and a database for storing of the data. In the system architecture diagram, will there be only two parts (UI and DB) or should I include some UI modules for calculations, for example? And what about hardware devices that the system is using? To give a more precise example: I have an application that is used by two types of users (one has limited access). This app uses a DB and its modules are working with an external hardware device. I am not sure how should I start with the system diagram.


Well designed / high-quality open source software

I'm taking a software design class where I should choose an open source software to analyze from the Software Design point of view. It has to be a big project: not less then 100,000 lines of code. I would really like to choose a software that is very well designed and architected to have good insights on good software design. By good design I mean things like meaningful classes and architecture, good use of (design) patterns, good use of abstraction, good organization of components, high cohesion and low coupling between components, etc... Do you have any software to suggest me? Note that the software just need to have a good design, the design does not need to be documented! :) It does not need to be an application for the end user... It can also be a library, a tool, etc...


Data model - inheritance

I just started working on a project where I am trying to implement some backend logic which includes creating a data model for the given problem. Here is a problem I came across and I am curious what approach would be more suitable for tackling it. **Model:** There are various users in the system with different rights and structures but there is a very simple inheritance between them. There is a basic `user` that can browse and view some data, psot comments etc. Than, there is a `member` who can do everything the `user` can + something more and they share the basic data structures + `member` has its own. And there is a `producer` which is again just an extension of `member`. Each `user` can (but does not have to) be a `member` and each `member` can (but does not have to) be a `producer`. 1) My current idea: Create table `user` and tables `member` and `producer` which would reference each other using user's id. There would be 0 to 1 relationship between these tables:               USER {     id     username     email etc..     }          MEMBER {     userid     some_member_attributes     }          PRODUCER {     userid     some_producer_attributes     }      The advantage is, that it would save me a lot of NULL values in a single table and it feels somehow natural to me. The disadvatage is that I would have to query three different tables every time I would like to get some data from a `producer`. 2) The other possibility is implementing this as a one table with attributes `isMember` and `isProducer`. But again, this will result in a lot of NULL values since most of the users wont be `producers`. And its not very typical to have many 0 to 1 relationships in one model, I think... What do you suggest? I hope its not an off-topic here, I am just trying to get this right so I wont have to reimplement is a dozen times in future. Thanks for any tips!


The place of UI design when estimating and elaborating user stories

Our company is trying to follow Agile methodologies when it comes to estimating and prioritizing any new development work. The reading I've done makes this concept appear great so we are trying to give it a good crack at making it work for us and hence help with providing a better solution at the end of the day for our customer. A problem I have had recently is the position of UI design during the estimation of User stories. We kicked off a new project discussing what was required from a functional point of view and getting a set of user stories written down to be verified by the user. Our BA then asked us to estimate these stories. I went, hang on. Many of these stories might vary depending on the complexity of the UI design. However the BA wasn't ready to discuss UI just yet as she needed estimates so she could plan the sprints and get a costing for the project. So my main question is: > Where does UI design fit into the process between writing user stories and > estimation. Or, should it even fit in and just be a part of the development > work? Secondary question > How does agile fit into fixed price quotes for new work (based on your > estimations on the entire user stories set), and how then do you ensure you > deliver what you said as far as the user stories go against the quote given > i.e. a story is bigger than you thought so blows out My concerns around our process:   1. I can't estimate accurately enough at this stage of the process as some elements are missing i.e. UI. It's a new project for a new client so heading into some uncertain waters.   2. Some features are just too unknown to estimate (Do I need to just delve deeper into the murkiness to clear the waters to remove the unknowns??)  BA needs (as expressed to me)   1. Wants to have estimates so they can determine how many sprints this project will take   2. Wants to have estimates so they can determine the scope and cost of the project so that they can give it to the customer as a quote.


How do you typically become chief software engineer in a company?

I was under the impression that you start in a programming job, do a good job, demonstrate willingness, get sent to a bunch of internships by the employer, and make your way up until you are given responsibility of an entire project. But a friend of mine told me that you also need at least a Masters' degree to be considered for that job. Is that true? How do people typically get to be in that role? PS notice I said "typically". I want to hear the general case, not private cases about someone you know.


What to do when you're faced with a problem that you can't solve quickly?

I'm a beginner learning Java and after reading the docs I'm trying to solve some of the problems at codingbat.com. Some I managed to solve pretty quickly in a matter of seconds but some not quite. The problems themselves are easy (example http://codingbat.com/prob/p126212) but I sometimes have a hard time finding the solutions. In part because I think of the best possible solution and automatically discard the ones that might work but aren't so elegant and in part because I can't find the right algorithm. This is either due to my inexperience (I have used PHP for web development for about 2 months so I'm not a total beginner - even worked with one framework to build a website) or due to my inability to think of a good algorithm. I normally don't look at the solutions. I sometimes get stuck even for 1 1/5 hours at simple problems and some of them I eventually solve but some I can't so I eventually look at the solution. Is it normal/good/bad to concentrate this long if I find a problem I can't solve? I might overreact but should this be so hard for me? Is there such thing as not being able to think of algorithms even with much learning and reading? Thank you all in advance.


Unit Testing For Different Environments

How does one do unit testing for multiple environments that behave differently? Here is my problem. I have a PHP class for which I'd like to create unit tests. The class provides shortcuts for manipulating folders. On Linux, you can set the folder permissions without a problem, on Windows, you can't at all. Knowing this, what is the best practice for creating a unit test for this class? The test suite could be run on either Windows or Linux, but if you test the folder settings on Windows, the test will fail. Do you just live with the failing test, make it conditional on the OS, omit testing it altogether, or something else?


How to maintain user relationship when user unfollows another user

I have a table of user relationship which stores who follows whom, the table structure is as follows               -id     -follower     -following      when someone follows any other user, I add a record with follower user id and id of user he is following, now my question=> When user wants to unfollow that user, I have decided rather than deleting the record I can add another column `break` at the end of this table, which I will set to `true` when user wants to unfollow, this way I can maintain consistency in the records, that is there wont be any gap like 1,2,4,7,8,9,15 if I delete records. If I dont delete the record, I can use it if that user want to follow that user again in future I can set break column of that record to `false` and the relationship will exist again..what do you guys think should I use this approach or I should delete the record? Tell me if the approach is good or there could be any issues associated with it and also tell me if there is any better way you know. Thanks


What will be a good python script (or your favorite language goes here) to test a system's performance and capabilities?

Let's say you're in a computer store looking at 10 laptops, you want to really compare the system's capabilities. What will be an efficient "your fav language goes here" script that will allow you to do this? As an example, when I go to the store I usually open a macbook and a pro's terminal and write an equation in python, iterate it a million or so times, and time them. I like to compare the difference in time. What would be an ideal and simple script that can efficiently compare systems?


Learning a new language and framework, should I spike a project, or first ground myself in the language fundamentals?

I've got substantial J2EE experience, have worked with Grails, and am comfortable with several languages (Perl, PHP, Smalltalk). I've decided to try a new project using Ruby on Rails. For those who've decided to migrate to a new technology stack, how do you make the transition? Do you learn the details of Ruby first (I've done a few tutorials, and feel like I've got a decent enough grasp of the language to start doing some basic work) or do you do a full Ruby on Rails tutorial, and expand your knowledge from there. I'm leaning towards the latter approach because I feel like I can delve into details of the language as I encounter them. For those who work in Ruby on Rails, how did you learn, and which resources do you recommend?


Syndication feeds and show I bother with providing anything other than RSS 2

I'm creating a CMS and have lots of legacy code from other applications. I'm wondering should I bother providing other syndication formats except rss 2? I'm inclined to say no but was wondering what other peoples opinions were.


Can a non-programmer successfully run a software company?

Back in 2006, one Joel Spolsky made the following comment: > Watching non-programmers trying to run software companies is like watching > someone who doesn't know how to surf trying to surf. Overall the article is a great read (definitely take the time to read through it). Out of curiosity, **I would like to hear the experiences of folks here** who have seen programmers adopt the mantle and do a great (or rubbish) job, and the same for non-programmers who find themselves herding programmers (worse than herding cats I've heard). In short, what is the concensus of opinion on this matter?


Benefits of using XML builder vs templating language like ERB?

I'm doing a lot of work with XML, our legacy XML generators use the ruby template language ERB to create the XML files. I've been experimenting with Nokogiri and the builder model of creating XML, but I seem to be able to accomplish everything I want using both methods. So, what should I be taking into account when choosing one common method going forward? What are the benefits of using a builder method to construct the XML vs a template language? One that I can think of is the builder method(nokogiri) provides methods for do much more than creating the file, such as searching and rearranging, etc. So if I use the builder method I can have a common tool for doing all xml related tasks.


Single Responsibility principle VS KISS principle

Let's assume the modeling of `User` model in a context of a social network. User concept is composed of two notions:   * Authentication elements like userName/Password/Email etc...   * Extra data information sometimes called "User profile" like firstName, birthday, pictures etc.. At first glance, this analysis involves separation of tasks/responsibilities if we want to keep SRP. However, typically in the case of a social network, **userName may be seen as a pure information belonging to a user's profile rather than a pure element of authentication.** Thus, there is three ways, according to me, to model the `User` concept. First, the whole in one class:   `User` (userName, password, email, firstName, birthday, picture etc...) Second, a one-to-one relationship between `User` and `UserProfile`:   `User`(userName, password, email) `UserProfile`(firstName, birthday, picture etc...) Third, a one-to-one but with a redundancy of the common fields (being as focused on authentication as a visible user information on the website):   `User`(userName, password, email)   `UserProfile`(userName, firstName, birthday, picture etc...) Why repetition here? Of course for consitency and at the same time to avoid joins in cases of relational database when one want to retrieve each Use's profile data. What is a good practice to model these both concepts? **Where should I place`userName` field?** **Dilemma being: keeping KISS (Keep it simple stupid!) or SRP ;)**


Would it be ok if I decide to write all my Ruby as if it were Haskell?

Given that Ruby has good list operation capabilities in-built - reduce, map, select, collect etc. It has Procs, Blocks and Lambdas, and has nice iteration support (the `each` family), would it be a bad design decision if I attempt to write all my Ruby stuff in the most pure-functional way possible? Escpecially for code that has little or no I/O (thus less obvious side-effects)? I've been learning Haskell (called the 'real' Hacker's language), and am in love with it's way of doing things - I love Ruby, but think it can be even more fun when more Haskell spirit flows into it (well, didn't Ruby borrow / learn lots from it in the first place?) Constructive guidance is welcome...


Determine Programming Language Used for Project Based on Source Code

Is there an easy way to determine which programming languages were used in a project assuming you have access to the source code? I have been programming for quite some time, so I can recognize most of the major programming language by syntax or file extension, but I realized that I could not answer this fairly simple question (A problem I often ask myself when dealing with unfamiliar open source codebases). I understand that you could examine each file extension and Google it to determine whether it belongs to a particular programming language. However, this seems tedious (examining every file extension for a large project) and I am guessing there might be a better way.


How is the JVM and Java's WORA different from other high level languages?

In the Java world, we often talk about the JVM, and when Java was new it had the supposedly killer feature of "Write Once, Run Anywhere." From the way people talk and write, this seems different from the way that Python, for example, works. Yet I've not been aware of any way that Python code that I've written would work differently on another machine. (Though I haven't written that much Python.) So what am I missing? How is the JVM different from a Python interpreter? Is there a way that Python lacks Java's platform independence? Or is this just a cultural difference?


Using php functions, reserved words as local identifiers

I'm thinking of some of the array functions. "key", "each", "pos", "range". These are often very useful as local identifiers! I have also seen code that (ab)uses $return, $list, $array, $string. What are other PHP programmers views on this? Local identifiers only! I wouldn't use them as members or method names of a class, even less global variables.


If you had more freedom and flexibility, what would you change in your employment contract?

For example, code ownership/authorship rights, non-compete terms, vacation/holidays, working hours, termination notices from any of the sides, etc.


Permission to reuse iOS sample code in commercial app?

Do we have permission to re-use iOS sample code from the apple developer website in a commercial app? Are we allowed to use it with modifications? Not sure of how to interpret all the legalese on the source. Obviously there's an "All rights reserved..." at the end, but there also a > "Apple grants you a personal, non-exclusive license, under Apple's > copyrights in this original Apple software (theApple Software"), to use, > reproduce, modify > and redistribute the Apple Software, with or without > modifications, in source and/or binary forms; provided that if you > redistribute the Apple Software in its entirety and without modifications, > you must retain this notice and the following text and disclaimers in all > such redistributions of the Apple Software."


Communicating details of method result?

I have code like this (pseudocode)               foreach(Box box in boxes)     {         if(boxFilter.PassesFilter(box))         {           // do something useful         }         else         {           Log.Log(format("Box %s was rejected", box.BoxId))         }     }      But now I'm thinking I'd like the log message to have more information such as "Box 1 rejected because too tall" or 'Box 549 rejected: 25" height exceeds Max height of 24"'. What's the best idiom to get this information into the log? Do I have to create a `FilterResult` object that is returned from the `PassesFilter` method? Or I guess I could also throw an exception and catch it and log it? Or something else? I happen to be using C++. **Update** In addition to logging I might want to also present a message to the user in the UI.


What is the proper way to distinguish between keywords and identifiers?

I'm aware that most modern languages use reserved words to prevent things like keywords from being used as identifiers. Reserved words aside, let's assume a language that allows keywords to be used as identifiers. (For example, in Ruby a keyword can be used as a method name). During compilation, how would you deal with this ambiguity? The lexing phase doesn't seem like a good fit because it would have to consider the tokens around it. The parsing phase also doesn't seem like a good fit since ideally the parser would work with tokens that are _unambiguous_. If I had to design it myself, I suppose I would have the lexer yield an ambiguous token, then have another level that considers the ambiguous token in the context of the tokens around it, (e.g. does the ambiguous token follow a `def` keyword? Then it must be an identifier.) Then, I would hand the unambiguous tokens to the parser. **In languages that allow keywords to be used as identifiers, what is the standard way for the compiler to tell them apart?**


Bugs that can be avoided with coding standards

I am looking for statistics (or estimations) that backup the claim that coding standards help reduce bugs. Hard-numbers would be nice, although I haven't had much look finding any. I've even looked at bug tracking for various open- source projects, but have not been very successful finding what I need. Does anyone out there know of any place I might be able to find this? Or do any of you contribute to any open-source projects that have had bugs that may have been avoided with better coding standards?


Eclipse runs my java program 6 times faster... Can I achieve this performance without using it?

I've written a java program that generates all repetitive permutations based on the characters and the length given. When I execute my code in Eclipse, it generates a file with 1,000,000 permutations in only 15 seconds. Yet if I run the program on the same machine in the command prompt using "java permutation" It takes 1 minute 35 seconds to generate the same 1M permutations.. Why is this? And is there anyway I can get this type of performance without using eclipse? Edit: Added Java VisualVM results www.craftboom.co.uk/jvm.png - The CPU usage is higher when running in eclipse. Both CPU and memory usage seem to drop to 0 ocassionally in the shell o_O EDIT2: Turns out it is a problem printing to the screen. Didn't mention it in my original post, but the program prints each permutation to the console.. Commented that out and saved to a file instead.. now running equally fast in both shell and eclipse. :-) Thanks to all for replies.


How to handle the problem of modified encrypted files

I have a simple encryption/decryption application that I am testing to learn more about security. I found out that if the user modifies the encrypted file, then decryption fails because the hashing algorithm doesn't generate back the original content. What are the common practices that deal with the problem of encrypted files modified by users either intentionally or unintentionally? The only thing I can think of is timestamp checking, but I am not sure how useful that is. About my last statement, I guess I am not sure if there is a way to trick the OS so that the new timestamp is set back to the exact old time stamp although the content is modified.


I read that the definition of NP-complete is : These are the hardest problems in NP. Such a problem is NP-hard and in NP How do we know if a problem is hardest in NP, and no harder problem exists. I understand that let's assume that somehow magically we know that a problem L is hardest in NP and then we can find out more hardest problems H if we can reduce H to L and vice versa.But my question is how does it all begin? How do we know 1 hardest problem to begin with? Also, to be able to say that something is hardest (or any extreme), we need to know all possible problems in NP and then argue about the hardest.. How do we know all possible NP problems? Is this where turing machine comes useful and by using representation of output string in form of 1 and 0 in output tape, we can theoretically talk about all possible NP problems. I understand that I may not have been able to articulate my question well - due to confusion. Thanks,


Why don't research papers that mention custom software release the source code?

Is there a reason why the source code of software mentioned in research papers is not released? I understand that research papers are more about the general idea of accomplishing something than implementation details, but I don't get why they don't release the code. For example, this paper ends with: > Results > > The human line drawing system is implemented through the Qt framework in C++ > using OpenGL, and runs on a 2.00 GHz Intel dual core processor workstation > without any additional hardware assistance. We can interactively draw lines > while the system synthesizes the new path and texture. Do they keep the source code closed intentionally because of a monetization they intend to make with it, or because of copyright ?


Benefits of a leaderless team in Scrum

Scrum advocates assume that a team without a designated team leader (as it is in Scrum) is more effective than a team with a designated leader (as in traditional hierarchy). Although I can understand this point of view, I am not entirely certain that's the case. In Scrum teams leaders always emerge. Power vacuums get filled. So if the organization already recognizes certain people as talented leaders, why not assign them an official leadership role in the first place?


Is there a pattern for subscribing to fired events/messages at specific intervals?

I'm not sure if this a common scenario or not, but I have a need along the following lines: I have an object (I'll call it node) and this object has methods X, Y, and Z. I want to be able to have subscribers be notified if the methods are called in a specific order with specific timing (a range of time would be ideal). For instance:   1. Node.X() get called    2. Node.Z() is called 5 to 7 milliseconds latter   3. Node.X() is called 1 to 2 milliseconds after that   4. Node.Y() is called 2 milliseconds seconds after that.   5. Finally, An event calling a subscriber to this sequence is fired. Now, in this example I am simply using parameter-less methods, but in real life I'd need to be more specific about the contents of the parameters (I'd be looking for specific messages). For reference I am using C# .net 4. Are there any frameworks/patterns/libraries that exist out there that are built for doing this?


How do you combat programming fatigue?

Not fatigue as in 'I need sleep' but fatigue as in 'I just can't be bothered anymore' which usually sets in when you hit roadblocks in whatever project you're working on, generally the closer you get to deadlines. It can be in work projects or personal projects, but it's something I keep hitting more and more lately. I'll get an idea, get into working on it, have a few really good days and make progress, then just some niggly things will trip me up, I can't get things working the way you want, I've hit limitations in the framework, I've got problems I can't find documentation for, etc. and it just gets too frustrating. Or am I alone in this?


Brain picking during job interview

Recently, I had a job interview at a big Silicon Valley company for a senior software developer/R&D position. I had several technical phone screens, an all day on-site interview and more technical phone screens for another position later. The interviews went really well, I have a PhD and working experience in the area I was applying for yet no offer was made. So far, so good. It was an interesting experience, I am employed, absolutely no hard feelings about this. Some of the interviewers asked really detailed questions to the point of being suspicious about new technologies I have been working on. These technologies are still in development and have not come to market yet. I know some major hardware/software companies are working on this too. I have had many interviews before and based on my former interviewing experience and the impression some of the interviewers left behind, I know now all this company wanted from me is to extract some ideas about what I did in this field. Remember, I am referring to a R&D position, not the standard software developer stuff. Has anybody encountered this situation so far? And how did you deal with it? I am not so much concerned about "stealing" ideas but more about being tricked into showing up for an interview when there is no intension to hire anyway. I am considering refusing technical interviews in the future and instead proposing a trial period in which the company can easily reconsider its hiring decision.


How much time a week do you spend on extracurricular programming?

Background: I'm a microsoft DBA/IT type person by day, an iOS and Mac developer by night. I have one app in the App Store and another one in the works. I try to spend as much time as possible working on my two apps, but with a new daughter and other (non computer) hobbies, I find it hard to spend more than a few hours every week programming. I'm wondering how this compares to other developers. I see a lot of apps out there written by single developers who don't do iOS development as their main job. Are they spending 4 hours a night working on their projects, or do they just plug away for a year or two before releasing anything?