title: Would it make sense to use objects (instead of primitive types) for everything in C++?

text: During a recent project I've been working on, I've had to use a lot of functions that kind of look like this:               static bool getGPS(double plane_latitude, double plane_longitude, double plane_altitude,                            double plane_roll, double plane_pitch, double plane_heading,                            double gimbal_roll, double gimbal_pitch, double gimbal_yaw,                             int target_x, int target_y, double zoom,                            int image_width_pixels, int image_height_pixels,                            double & Target_Latitude, double & Target_Longitude, double & Target_Height);      So I want to refactor it to look something like this:               static GPSCoordinate getGPS(GPSCoordinate plane, Angle3D planeAngle, Angle3D gimbalAngle,                                 PixelCoordinate target, ZoomLevel zoom, PixelSize imageSize)      This appears to me to be significantly more readable and safe than the first method. But does it make sense to create `PixelCoordinate` and `PixelSize` classes? Or would I be better off just using `std::pair<int,int>` for each. And does it make sense to have a `ZoomLevel` class, or should I just use a `double`? My intuition behind using classes for everything is based on these assumptions:   1. If there are classes for everything, it would be impossible to pass a `ZoomLevel` in where a `Weight` object was expected, so it would be more difficult to provide the wrong arguments to a function   2. Likewise, some illegal operations would cause compile errors, such as adding a `GPSCoordinate` to a `ZoomLevel` or another `GPSCoordinate`   3. Legal operations will be easy to represent and typesafe. i.e subtracting two `GPSCoordinate`s would yield a `GPSDisplacement` However, most C++ code I've seen uses a lot of primitive types, and I imagine there must be a good reason for that. Is it a good idea to use objects for anything, or does it have downsides that I am not aware of?


title: Non-Solicitation clause in my offer letter - Prospective employer says this is non-negotiable. Is this a deal-breaker?

text: I recently received an offer from a company that I'll call ACME. In the NDA that came with the offer this clause appears: > 2.Non-Solicitation. I agree that so long as I am employed by ACME and for a > period of two (2) years thereafter, I will not directly or indirectly > solicit for other employment or work any employee, consultant or advisor of > ACME, nor will I interfere with ACME's relationship with any such persons, > or endeavor to entice them away from ACME, or aid any other person(s) in > enticing them away from ACME. Now, I've done my homework. In particular, Joel's excellent article NDAs and Contracts That You Should Never Sign has informed me that this clause is definitely not in my best interest to sign. I emailed the recruiter back and asked them to remove this clause; she responded saying it was non-negotiable. **Is this worth sticking to my guns on?** I am very happy with the offer package otherwise, and this is very much a dream job for me, located in silicon valley, a place I've wanted to work in since I started college. **What are the chances this clause will hurt me?** My nightmare scenario is that some of my coworkers will leave to start a really cool startup but will not be able to bring me on board; I do not like limiting my future career like this. **How often is this clause actually enforced?** I've read that sometimes this clause and other 'non-compete/non-solicit' clauses like it are unenforceable in some jurisdictions anyway. I don't know about California, though. **Edit:** A couple of these answers are slightly ridiculous in their accusations that I wish to 'poach' employees from this company before I even start working there. This is a bit much. My objective is to have a good job that I enjoy doing, and this company will very likely provide that. My simple concern is if this clause will interfere with my career a few years down the line, if I want to move on to a more senior position or to the possibility of starting my own business.


title: What natural language has the advantage when it comes to programming?

text: Linguistic relativity is the idea that language shapes the way we think. My question is, how much, and to what extent, does this apply to programming?   * Are some native, natural languages better-suited for thinking about programming than others? For instance, can the following be stated more concisely in a non-English language? `Select a pivot. Move all the items less than the pivot to one side of the list, and all the items greater than the pivot to the other side.`   * Does a Chinese-speaking programmer view programming in a radically different lens than an English-speaking programmer, or do the differences fade away when both are immersed in the subject?   * Are some programming languages and domains easier to think about in one language or another. For instance, is it any easier to grok Ruby if you are Japanese because the creator of Ruby is Japanese? Note that this question is not focused on "how do programming languages affect the way people think about programming", but rather "how do **natural** languages affect the way people think about programming". To get it out of the way, one language that clearly has a pragmatic advantage is **English**. I think the advantage has little to do with programming languages choosing English keywords like `if`, `for`, `while`, and `do`, just as musicians who don't speak Italian aren't tripped up by words like _forte_. It has more to do with communication of ideas with other programmers, as English is the lingua franca these days, at least in the programming world. For instance, to ask a question in StackOverflow, you really need to know English and know it pretty well if you want good answers. Although this sounds like an imperialist attitude, it really is true in practice. That aside, how do the intrinsic properties of languages affect how programmers who speak them think about data structures, algorithms, etc.? Are any languages particularly concise when it comes to talking about logic and programming, allowing native speakers of those languages to think faster?


title: What hardware/software tools were used to build commercial quality 8-bits games?

text: I mean, I still have a MSX2 with a Z80 processor and if you look at any Konami's game made for that computer in its time (roughly between '84 and '90) is amazing the high quality code of those games. I was a kid at the time, trying to learn how to program a computer and still today fascinated me how well made they are, mostly zero bugs or glitches, despite the really complex behavior. What hardware/software tools could they have used to accomplish that quality, which metodology? I know computers are really more complex today but at that time, even a stock control program I made in Basic was plagued with many bugs and was painful to debug. Any light you can shed will be deeply appreciated.


title: Should I expect to know a lot about every language I put on my resume as a college student?

text: If I am asked to program an algorithm, say binary search, in languages other than Java during an interview, I will have a hard time trying to remember the syntax. Is it okay to tell my interviewer that I can only code this in Java, because I have worked with other languages before but have not used them for a while? If not, what suggestions do you have (i.e. what languages and parts of those languages among these should I pick up the syntax of before my interview)?


title: Comment before or after the relevant code

text: Assuming a comment won't fit (or can't go) on the line it applies to, should one write the comment before the code or after? Well, wherever future readers will best understand the comment's scope. In other words, wherever most programmers/scripters put such comments. So **where do most programmers/scripters put a comment: before or after its code?** If your answer applies only to specific languages, please indicate which. And if you can cite an accepted spec or guide that supports your answer, so much the better.


title: Why would it ever be possible for Java to be faster than C++?

text: Sometimes Java outperforms C++ in benchmarks. Of course, sometimes C++ outperforms. See the following links:   * http://keithlea.com/javabench/   * http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/   * http://blog.cfelde.com/2010/06/c-vs-java-performance/ But how is this even possible? It boggles my mind that interpreted bytecode could ever be faster than a compiled language. Can someone please explain? Thanks!


title: Building a dropbox clone

text: I want to create my own Dropbox clone (for learning purposes - only the Windows app) and am looking for some tips. Currently, I use the `FileSystemWatcher` to check if there's a change, then use `rsync` to sync all the data. Now, how does this work with multiple computers? If computer A changes a file, it should be pushed to computer B (and vice versa). My questions are:   * Do I need to create a push notification system or are there (better) alternatives so I know if data has to be pulled (as in a file has changed on the server)?   * Dropbox has the green tick and a blue sync icon. How can this be done? How do I know which files are being uploaded/downloaded (if `rsync`-ing the whole directory)?


title: Does having pagination lessens server load? (theory)

text: I was wondering what is the reason behind pagination? Is it used because it lessens the burden on the servers since we would technically limit the amount of rows returned per page? I wanted to do something without pagination but given that I am new to this (I am an amateur) started wondering if its OK technically or not.


title: How to implement await in Android

text: This is a general question to understand how await in C# works, and particularly I am interested in implementing it in Android. So C# await allows you to go in to waiting mode in the middle of the method until the the task you are waiting for is complete, then you will continue the method execution.   How ever the interesting part is while you are waiting inside the method, the thread that you are working on is not getting locked(or at list it does not looks like it got locked) and the code will continue running from where you called that method. I want to understand what is happening there in C# and how can I implement it in Android?


title: Confusion regarding def function within Python

text: I've been learning Python for about 2 months now (Started with Learn Python The Hard Way, now reading Dive Into Python), and within both books, I still seem to be confused over this one bit of code. Lets just take the default code that Dive Into Python uses as an example:               def buildConnectionString(params):         """Build a connection string from a dictionary of parameters.                   Returns string."""         return ";".join(["%s=%s" % (k, v) for k, v in params.items()])          if __name__ == "__main__":         myParams = {"server":"mpilgrim",                     "database":"master",                     "uid":"sa",                     "pwd":"secret"                    }          print buildConnectionString(myParams)      How does the function `buildConnectionString` with the argument `(params)` know to get its data from the variable `myParams`? Or `params.items()`, too within the `return` line? Wouldn't the argument in `buildConnectionString` need to be set as `buildConnectionString(myParams)` in order for it to read properly? How can you set the variable of your data to `myParams`, but have the argument of your function be `params` and have it read? How does it know to read `myParams` as `params`? And is there a reason behind not naming your variable `params`, or vice versa naming your argument in your function `myParams`? It's just been extremely confusing seeing the argument set as one word, and then having the variable named something completely different, but having the function still be able to read your code, even when the argument name is different from your variable with the data you're printing from.


title: Do you feel bad when you have to learn new things?

text: New thing is not always cool. I see many people say they are very bored by doing the similar things day after day. For me it's the opposite - I'm always learning something new. During the last one and a harf year, nearly every two months I need to do lots of researches on a totally new topic: RTMP, MP4, SIP, VNC, Smooth streaming, ..., I have to read lots of specifications, download tones of open source projects to understand concepts, and turn them into my runnable code. And it was so bad! My brain has never been very sure and very familiar with anything, and when it's close to be sure and familiar, it'll have to switch to next thing. I kind of envy people who build upper level applications because they can be very focusing, and their knowledge set includes most things their job requires. Everything is quite measurable, direct and straightforward. Have you ever had the similar feeling? I'm thinking of asking my boss to assign me some other piece of work so that I work like moving forward on a broad road instead of figuring out a way in the dark, I think it'll be more relaxing, any suggestion?


title: Proper library for enums

text: I'm trying to refactor some code such that the display is separate from the implementation, and I'm not sure where to put the existing `enum`s. My project is currently structured as follows:   * **Utilities**   * **RemoteData** ( _Depends on:_ `Utilities`)   * **LocalData** ( _Depends on:_ `RemoteData`, `Utilities`)   * **RemoteWeb** ( _Depends on:_ `RemoteData`, `Utilities`)   * **LocalWeb** ( _Depends on:_ `RemoteData`, `LocalData`, `Utilities`) I'm now trying to add " **ViewLibrary** ( _Depends on:_ `Utilities`)" to this list, and then adding it as a new dependency to both `RemoteWeb` and `LocalWeb`. It will contain a set of interfaces which the other two projects will implement, use to populate the view, and then consume the result. There's an `enum` which is currently used in all the projects _except_ `Utilities`. It thus lives in the `RemoteData` project, because everything else depends on it. But this new `ViewLibrary` won't depend on either data project. So how will it know about this `enum`? Some options I see:   * Create a new project just for shared enum values.   * Add it to `Utilities`, even though it is related to data.   * Define it a second time in `ViewLibrary`, and require both `RemoteWeb` and `LocalWeb` to convert the one type into the other when they access the shared views.   * Add a dependency on `RemoteData` to the `ViewLibrary`, even though it's supposed to be independent of data-source. Are there any better options? Is this structure flawed to begin with?


title: booth multiplication algorithm

text: Is booth algorithm for multiplication only for multiplying 2 negative numbers `(-3 * -4)` or one positive and one negative number `(-3 * 4)` ? Whenever i multiply 2 positive numbers using booth algorithm i get a wrong result. example : 5 * 4 A = 101 000 0 `// binary of 5 is 101` S = 011 000 0 `// 2's complement of 5 is 011` P = 000 100 0 `// binary of 4 is 100` x = 3 y = 3 m = 5 -m = 2's complement of m r = 4   1. After right shift of P by 1 bit 0 000 100   2. After right shift of P by 1 bit 0 000 010   3. P+S = 011 001 0 After right shift by 1 bit 0 011 001   4. Discarding the LSB 001100 But that comes out to be the binary of 12 . It should have been 20(010100)


title: When should complexity be removed?

text: Prematurely introducing complexity by implementing design patterns before they are needed is not good practice. But if you follow all (or even most of) the SOLID principles and use common design patterns you will introduce some complexity as features and requirements are added or changed to keep your design as maintainable and flexible as needed. However once that complexity is introduced and working like a champ when do you removed it? Example. I have an application written for a client. When originally created there where several ways to give raises to employees. I used the strategy pattern and factory to keep the whole process nice and clean. Over time certain raise methods where added or removed by the application owner. Time passes and new owner takes over. This new owner is hard nosed, keeps everything simple and only has one single way to give a raise. The complexity needed by the strategy pattern is no longer needed. If I where to code this from the requirements as they are now I would not introduce this extra complexity (but make sure I could introduce it with little or no work should the need arise). So do I remove the strategy implementation now? I don't think this new owner will ever change how raises are given. But the application itself has demonstrated that this could happen. Of course this is just one example in an application where a new owner takes over and has simplified many processes. I could remove dozens of classes, interfaces and factories and make the whole application much more simple. Note that the current implementation does works just fine and the owner is happy with it (and surprised and even happier that I was able to implement her changes so quickly because of the discussed complexity). I admit that a small part of this doubt is because it is highly likely the new owner isn't going to use me any longer. I don't really care that somebody else will take this over since it has not been a big income generator. But I do care about 2 (related) things   1. I care a bit that the new maintainer will have to think a bit harder when trying to understand the code. Complexity is complexity and I don't want to anger the psycho maniac coming after me.    2. But even more I worry about a competitor seeing this complexity and thinking I just implement design patterns to pad my hours on jobs. Then spreading this rumor to hurt my other business. (I have heard this mentioned.) So... In general should previously needed complexity be removed even though it works and there has been a historically demonstrated need for the complexity but you have no indication that it will be needed in the future? Even if the question above is generally answered "no" is it wise to remove this "un-needed" complexity if handing off the project to a competitor (or stranger)?


title: At what point can I say I've "learned" a language?

text: In my few years of programming, I've toyed with everything from Ruby to C++. I've done everything from just learning basic syntax (Ruby) to completing several major (for me) projects that stretched my abilities with the language. Given this variety (and the fact that truly learning a language never stops), when can I say I know (or have learned) a language?


title: Name of a class that creates a bunch of classes for a process

text: We all know that the hardest parts of computer science deal with cache invalidation and naming things; my problem is the latter. I have a process that raises events when various things happen. Rather than creating all of the objects for all potential events before the process is started, I have created classes that create the necessary dependencies for the event when the event is called, then calls the next sub-process. I have no idea what to name these classes. A typical example might include a logger, mailer and anything needed to render a view for that event, such as templates. Not every action needs these things or else I'd just create them and be done with it.


title: From an execution perspective is an interpreter the same as the JVM / or the .net Framework

text: I've recently started two introductory level courses - one using Python, the other Java. I've read the answers to **this Question** but still have difficulty understanding how each ends up with machine code and what the main differences between the two models are:   * Is an interpreter doing the same job as something like the **JVM**, just without the byte-code?    * For python is the interpreter taking the high-level code and translating it into machine code?    * The Java virtual machine needs to be installed on a machine for a java program to run on it - is it similar for python - if the interpreter is installed on the target machine then the python program will run?   * Is the JVM (& .net framework) effectively byte-code interpreters?


title: Are sequence designs appropriate for GUI button design?

text: Specifically, I have numerous buttons that will be changing color based on state information from operator input and input from various subcomponents and sensors. I would like to use UML or some other type of design diagrams to be able to capture the color transition. Some folks have suggested sequence diagrams, but I haven't been able to find any good examples that show how to incorporate this design artifact. I would really like to head in this direction to help developers. Are sequence designs in fact, appropriate, or is there a more appropriate design?


title: Optional semicolons

text: Most often, in a general-purpose imperative language - semicolons as statement-delimiters are either required, or completely disallowed (e.g. C and Python). However, some languages, like JavaScript, allow you to opt out of delimiting your statements with semicolons, in favor of other delimiters (such as a newline). What are the design decisions behind this? I understand that semicolons are essential when writing multiple statements on the same line, but is there another reason to make them mandatory (except following C)?


title: Zero as a constant?

text: I have come across this programming idiom recently:               const float Zero = 0.0;      which is then used in comparisons:               if (x > Zero) {..}      Can anyone explain if this is really any more efficient or readable or maintainable than:               if (x > 0.0) {..}      NOTE: I can think of _other_ reasons to define this constant, Im just wondering about its use in _this_ context.


title: What is a user-friendly solution to editing email templates with replacement variables?

text: I'm working on a system where we rely a lot of "admins / managers" emailing users from the database. One of the key features is being able to email several people at the same time, with specific information relevant to each of them. Another key feature is to be able to hand-craft emails, because it tends to be be necessary to slightly modify them each time, but having a basic template saves a lot of time. For this, we have the typical "templates" solution, where we have a template that looks kind of like this:               Hello {{recipient.full_name}},          Your application to {{activity.title}} has been accepted.      You have requested to participate on dates {{application.dates}}, in role {{application.role}}     Blah blah blah      The problem we are having is obviously that (as we expected), managers don't get the whole "variables" idea, and they do things like overwriting them, which doesn't let them email more than one person at a time, assuming those are not going to get replaced and that the system is broken, or even inexplicable things like "Hello {{John}}". The big problem is that this isn't relegated, as usual, to an "admin" section where only a few power users have access to editing the templates that are automatically send out, and they're expected to know what they are doing. **Every** user of the system gets exposed to this problem. The obvious solution would be to replace the variables _before_ showing this template for the user to edit, but that doesn't work when emailing several people. This seems like a reasonably common problem, and we are kind of hoping that someone has already solved it. Have you seen anywhere/created/can think of good solutions to this problem? **Update** What I ended up doing based on Daniel B's answer was detecting, based on the cursor position, and the position of {{ }} in the code whether the user is currently "inside a variable" or "outside". In inside, I show a little piece of text below the big textarea explaining that this is going to get replaced, and that they can remove it completely if they want, but they can't edit it. I do this onClick, onChange, onKeyDown, onKeyUp. For the "key" events, if we're inside a variable, I only return TRUE if the keyCode is one of a few "navigational" keys. Otherwise, I return FALSE, which effectively prevents the edition of that variable. It's not perfect, but it was very cheap, and seems effective.


title: UI message passing programming paradigm

text: I recently (about two months ago) read an article that explained some user interface paradigm that I can't remember the name of and I also can't find the article anymore. The paradigm allows for decoupling the user interface and backend through message passing (via some queueing implementation). So each user action results in a message being pased to the backend. The user interface is then updated to inform the user that his request is being processed. The assumption is that a user interface is stale by definition. When you read data from some store into memory, it is stale because another transaction may be updating the same data already. If you assume this, it makes no sense to try to represent the 'current' database state in the user interface (so the delay introduced by passing messages to a backend doesn't matter). If I remember correctly, the article also mentioned a read-optimized data store for rendering the user interface. The article assumed a high-traffic web application. A primary reason for using a message queue communicating with the backend is performance: returning control to the user as soon as possible. Updating backend stores is handled by another process and eventually these changes also become visible to the user. I hope I have explained accurately enough what I'm looking for. If someone can provide some pointers to what I'm looking for, thanks very much in advance.


title: How Chatterbots are made?

text: I was having sometime making an application that deals with many of chatterbots APIs, That made me wonder, how these bots are exactly made? How they develop an answer for your questions? Do they rely on previous conversations with you/other poeple to develop a more reliable answer?


title: How to deal with different programming styles in a team?

text: We have a small dev team (only 3 developers) and we recently got a new team member. While he is a smart coder, his coding style is completely different from ours. Our existing code base contains mostly readable, clean and maintainable code, but the new team member is quickly changing many files, introducing ugly hacks and shortcuts, using defines all over the place, adding functions in the wrong places, etc. My question is if others have experienced such a situation before, and if anyone has tips on how to talk to him.


title: Webservice Design: benefits of piping use-cases to URL rather than using search param's, or vice versa?

text: I've gotta build a webservice for employee information, and I'm trying to plan it out. To clarify, we already have a REST-ish service for People and a separate REST- ish service for Companies.   This service will specifically be for the relationship between those two (all the data will be delivered from services to the data-consumers through a client (or clients) ). Among other tasks, this service will need to:   1. retrieve all employers (company id's) for a given person ID   2. retrieve all employees (person id's) for a given company ID    I could see doing this a couple different ways.   1. Using search parameters could look _something_ like:      * `http://blah/employee/find?person_id=12345`     * `http://blah/employee/find?company_id=9876`   2. Using the URL could look _something_ like:      * `http://blah/employee/find/employers?id=12345`     * `http://blah/employee/find/employees?id=9876`    Taking the URL approach, I'd be able to specifically validate for a single parameter for each the _employer_ and _employee_ cases .. seems nice and clean, but quite fixed.   Taking the parameter approach seems like it's less-rigid/more-flexible, but then requires more data paths (if/else), and therefore the code can take longer to understand when future-me (or anyone else) comes back to it after it's been long forgotten. What benefits might there be to going with once vs the other?   To me, the difference _**seems**_ kinda arbitrary, but this is the first time I've got to make this decision.


title: How serious is losing the source code?

text: If a software company loses the source code to one of the products they are selling, how serious would that be, in terms you could explain to a layman? Would the term "gross negligence" be too strong? Or "gross incompetence"? Obviously no one got killed but isn't it as serious as some financial negligence that people get jail time for? **EDIT:** Let's say it's not a case of a disk drive crashing, natural disaster or anything like that. Just they misplaced it.


title: Are testers considered low profile?

text: I happened to know some system admin and according to him, testing guys are not given preferences in an organization in comparison to developers. No doubt software releases are not possible without testers but I've never laid my hands on testing so not much aware of it. No offense intended.


title: App Engine SDK Dev transition to Google Plugin for Eclipse

text: I'm trying to understand the transition people make with their apps in the App Engine SDK and how/why/what they move to the Google Plugin for Eclipse. It seems you can create a web application using the App Engine SDK, or you can do the same with Eclipse. Why offer both? How do people transition App Engine into Eclipse and Google Web Toolkit?


title: What software can be used to create architecture diagrams?

text: I use MS Visio for most of my design/architecting work when I need to be able to save the diagram somewhere and edit it later. I'm not the biggest fan of Visio, but it gets the job done (and it's free at work). I was wondering if there were any good alternatives to the fairly expensive Visio software, maybe something even better, that you guys have used in the past and were comfortable with. I'd certainly like to have that program in my toolbox!


title: Mnemonic for always overriding equals when you override hashCode?

text: We java developers always know that you should always override equals() when you override hashCode(), but I consistently have trouble remembering this rule. What is a clever mnemonic to help Java developers remember this?


title: MySQL PHP User/Group Permissions

text: I am trying to configure a mysql database table that I can use as a per user/group permissions table. Almost like what Facebook has, for a local company intranet site. What is the best possible way to design this table, that would allow me to find user permissions with the fewest amount or queries?


title: Concrete examples of Python's "only one way to do it" maxim

text: I am learning Python and am intrigued by the following point in PEP 20 _The Zen of Python_ : > There should be one-- and preferably only one --obvious way to do it. > Although that way may not be obvious at first unless you're Dutch. Could anyone offer any concrete examples of this maxim? I am particularly interested in the contrast to other languages such as Ruby. Part of the Ruby design philosophy (originating with Perl, I think?) is that multiple ways of doing it is A Good Thing. Can anyone offer some examples showing the pros and cons of each approach. Note, I'm not after an answer to which is better (which is probably too subjective to ever be answered), but rather an unbiased comparison of the two styles.


title: Feasibility to take over a JavaMe Project by Coders who have no experience in JavaMe

text: As the original JavaMe team will leave to do other items. The JavaMe project will be taken over by some guys knowing nothing about JavaMe. Transition period: One month About this JavaMe project:   1. about 35000 lines of code (more than 180 java file, SourceCode is 8.5KB in total)    2. using the Polish, Proguard    3. document: The JavaMe project itself have no document. No UML map.  Difficulties I guess:   1. familiar with the JavaMe, this should be okay    2. In order to do the further development. We need to Read the sourceCode ---- It's not easy to read 35,000 lines of code having not enough comment   3. Adaptation work for more than 100 phone These are the questions, thank you!   1. In the case of our guys have no experience in JavaMe, Is one month too hasty?    2. In order to take the job in time . What we should ask the original JavaMe team to do .   3. Considering we hava no experience in JavaMe. The complication we taking the Adaptation work without the original JavaMe team?   4. Any other suggestions?


title: Should I be put off a junior role that uses an online development test?

text: I've applied for a junior development role, or rather been found by a recruiter looking for a developer. In order to get to a telephone interview stage I've been asked to sit one of those online coding assessments. This wasn't quite what I expected. I consider myself a fairly good developer for my age and experience, but I've no illusions about being Don Knuth or anything. The test was a series of incredibly obtuse questions asking about the results of various obscure evaluations. About 30 minutes in I was thinking to myself I hadn't intended to enter an obfuscated code contest/code golf exercise. After my last telephone interview I was asked to build something. I did. That seemed fair. Go away and work this out is more my in office experience of programming than "please evaluate this combination of lambdas, filters, maps, lists, tuples etc". So I'm a little put off, to be honest. I never claimed to know the language inside out or all the little corner cases. My questions, then:   1. Should I be put off? Why? Why not?   2. Are these kinds of tests what I should be expecting for junior roles?   3. Should I learn stuff exam style? That seems to be the objective of these tests, for which you are timed and not supposed to use references or books? Normally, in the course of development I have a fairly good idea of basic types, rules, flow control and whatever. Occasionally I'll come up on something I need to use a regex for and have to go and remind myself of the exact piece of syntax I need if trying what I think should work doesn't. Or I'll come up against a module I've not used before and go and look it up. For example, if I wanted to write a server using sockets in C right now, I'd probably check the last piece of code I wrote doing that (and or the various books I have) and work from there. Chances are I probably couldn't do it exactly from scratch and from memory, although I can tell you you'd need a `socket()`, `bind()`, `listen()` and `accept()` call and you might also want `select()` depending on whether you intend to `pthread_create` or not. So I know what the calls are, but not their specific parameter list.   4. What are your experiences if you are a recruiting manager? Are you after programmers who can quote you the API or do you not mind if your programmers have a few books on their desk and google function calls every so often?


title: What are the practical examples of code exploration techniques?

text: Code Exploration (CE) is quite a new term and I wonder if there already any successful examples of implementing this techniques in terms of Continuous Integration principles? In short, Code Exploration can be described as the process of testing your code using different parameters to achieve high code coverage. The one-and- only tool for .NET world is PEX, but I know there are commercial instruments for code exploration in java world. This topic is very powerful in conjunction with Design By Contract, because it provides you with the means of some formalism in reasoning about code correctness. For example PEX would show that next code contains error (source code uses Code Contracts and I assume default assembly configuration):               public int Factorial(int number)     {         //postcondition of positive result, precondition is omitted          Contract.Ensures( Contract.Result<int>() > 0 );               return number <= 0 ? 1 : number * Factorial( number - 1 );     }      Because by default overflow is not checked in arithmetic operations the input 17 will give the result of -288522240. PEX was discussed here several times here:   * How does Pex work   * Pex and Code Contracts But I don't want to touch internal implementation details, I'm interested in practical aspects of this problem. * * * Main questions are:   1. How exactly do you integrate Code Exploration with Continuous Integration?   2. Do you reject build if PEX gives errors or you notify team about inconsistencies and contracts violations?   3. Scott Hanselman has point, that PEX should run on separate machine (or multiple machines) continuously testing your code for errors (so called Continuous Exploration). You can listen to the talk Hanselminutes Podcast 93 - Pex. Are there any practical implementations of dedicated machine (would it be virtual or physical), that digs into your codebase in search of errors?   4. How do you treat test coverage of such tools? I think it would be unreasonable to merge code coverage results for unit tests written manually with the results by a code exploration tool.   5. Are there any examples of Parameterized Unit Tests in real projects, that would increase you productivity and unit tests quality?


title: How are crossplatform/multiple-OS C++ projects planned in terms of code and tools?

text: I want to create a project in C++ that can work in Windows, Linux and Embedded Linux. How are projects created when they have to work across many OS'es? Is it first created on one OS and then the code slowly modified to be ported to another OS? Eg: to me, the Linux version of Firefox appears to be created as a Windows project and a separate Linux project with a different code base, since Firefox behaves a bit different in Windows and Linux. Although the source code download is surprisingly a single link. If QT is used for UI, Boost threads for threading, Build Bot for CI and NetBeans/Eclipse/QT Creator for an IDE, would a person be able to minimise the amount of code re-write required to get the project onto another OS? Is this the right way to do it, or are such projects meant to be created as two entirely separate projects for two separate OS'es?


title: Does there exist a design-pattern for this problem?

text: I have a big database of data which we can consider today's system. The data has a web front-end which allows my users to update the data. Let's call this "original solution" When new users come in they come as a set of new users. These users need their own data and their own web front-end. Let's call this a "solution". Originally we have 1 solution (the original solution), however I now need the same solution for a different set of users. Some factors that need to be considered in the design:   * The original solution may choose to implement other solutions updates and inserts on the data.   * Any solution may choose to receive updated and inserted data from the original solution.   * Updates between solutions should be easily shareable. Now the easiest solution would be just to replicate the entire database and have some sort of process to write and read data between solutions. This however has a really high overhead when it comes to duplicate data, storage needs and so on. I would imagine storing some kind of delta between the data would be better? I imagine a possible solution would be to design the architecture much like a source code control system with branches would be? When a new solution is implemented we branch the original solution. The different updates in branches can easily be updated into the main branch and vice-versa. Is there any tips in how I can easily clone the data in the original solution to a new solution without replicating the actual database? Perhaps a design pattern I can use in the implementation?


title: Reasons for the build-technological fork between Java and UNIX/C/Fortran

text: When Java was developed, it's designers chose to discard an unusual amount of the conventional wisdom established in the UNIX and C oriented toolchains. For one (and in my view) the most major example, they chose to discard the practice of header files and Makefiles and tried to build a monolithic, dependency-aware compiler instead. Later on, `ant` was developed to partially remedy the (obvious?) deficiencies of this process, and effectively re- implemented the makefile logic. It's not like I resent old-style make and `#include` going overboard. However, their usage was reinvented in the Java world with `ant` and splitting each class into an Interface and an Implementation class, which is pretty close to the header file/source file pattern. I'm fairly sure the people behind Java knew of the existing tools and patterns and their purpose, so the decision to first do away with them and then reimplementing everything from scratch without even a hint of it in the language design is what astonishes me. Less costly ways would have been available (like parsing the source file and auto- generating a header file, which would have been fairly easy after pruning the C syntax a bit), but weren't taken, and I would love to know about the reason. Similar forks were performed in most other places, at considerable development costs and the considerable cost of a splitted community. Nowadays, Java-world and C++-world developers often have a hard time communicating and collaborating due to a split that seems disproportionate to the actual differences between the C/C++ language and the Java language. While I can see the basic motivation behind the process (everyone loathes Makefile syntax and changing header files manually), I still can't grok the magnitude of the change. Are there historical references about the motivation and reasons of this process? Are there any design documents or interviews with the people who drove this fork?


title: Why do most programming languages not nest block comments?

text: A few do, but not any of the popular ones as far as I know. Is there something bad about nesting comments? I plan to have block comments nest in the (small) language I'm working on, but I would like to know if this is a bad idea.


title: Is JavaBeans a good example of encapsulation?

text: I'm trying to understand if JavaBeans is a good example of encapsulation. In my view, it's **not** as usually all the internal state is exposed through getters and setters. A simple example is               public class Test {         private List<String> names = new ArrayList<String>();              public List<String> getNames() {             return names;         }              public void setNames(List<String> names) {             this.names = names;         }     }      This follows the JavaBeans standard but it leaks the implementation. For example a user could call `test.getNames().clear()`. Am I missing something?


title: How to trim all incoming values in an HTTP Post request?

text: I have an HTML form, with more than 30 fields in it. When this form is submitted to the server, all of the values of the fields should be trimmed. In other words, no value should start/end with any kind of whitespace (`\b`). There are many options available for me:   1. Manually trim each value   2. Looping over values and trim each one   3. Creating a framework (something like ASP.NET's HTTP Module) to sit at the way of any HTTP Post request, to trim the incoming value. The third option seems the best one. However, I don't know if it is **really** the best one or not? And I also don't know how to do it. Is it possible at all? What are other solutions?


title: place to propose a open source project and collaborate on software requirements before start to coding

text: I'm searching for a web site to start a new open source project. I want to start the developing of a "SPORT training log". I have some developing skill but not all I need (I dont know web coding). Anyone know a good starting point to meet some people, propose the software and then (in another place also) start the development all together? For example, I have python, c, c++ skills and a little training experience, but I want to make it in web, so I can't do all the stuff alone. I dont think I'm the only one who wants to make a training log but dont have necessary skills. I'm searching for a site to manage the idea behind a training log and get interested people to contribute in the idea and then eventualy contribute also in the code. What I mean is a step before actualy FOSS approach. The question is: Why start to code software I need if I can start global software requirements about a "sport traning log" and after a useful and global review, we can start all together to developt it? Why should I need to start developing the software with XYZ features and other people who need features YZQ need to start to write another one? Why not put the opensource comunity a step before in a more professional way starting an opensource project with a collaborative approach also in software requirements?


title: What are good social coding sites?

text: I'm used to CodePlex, and I've heard a lot about GitHub, but haven't looked around much there yet. What are the best social coding sites that tracks commits, interesting projects, etc? (From a large community and popularity standpoint)


title: Charts, SQL and REST?

text: We have created a REST API for a voting game. Now we are jumping into creating analytics/graphs/charts for moderators and users to watch how are they doing in the game. The game has a certain group of people vote or use their votes for a certain number of choices. Now there is a moderator for this group which can compare the activity and performance of a group consisting of approx 50 members. So the graph requires votes of a user for a particular choice in days.   * user      * vote     * choice     * when to show the people increase in voting activity over time against a number of choice. Or perhaps comparison of all users showing how many votes they made in days/weeks/months. What is the best way to do this using sql. Should a long running query like this can be a considerable solution. Should this kind of data be prefetched or pre calculated and refreshed after some time? For a real time solution what are the possible ways? If the query is the only way, how can we speed it up? Indexing? Views? Triggers? Procedures? I am familiar with sql but dont know anything more than indexing. So it would help explaining what can help why and where.


title: How do I use an open source project as an educational tool?

text: In order to provide a more comprehensive educations for computer science students at my old university, I'm trying to develop an open source group they can contribute to. What should I be looking for in project ideas so that they provide the maximum educational value for students who aren't very experienced in real-world projects? What should I be avoiding when deciding what to do?


title: What are the fundamental differences between C and C++?

text: Many tend to write "C/C++", as if they were the same thing. Although they share many similarities, they are clearly not the same. But what are really the fundamental differences between C and C++? Is C++ an enhanced version of C, or are there features in C which do not exist in C++?


title: How important is my job title?

text: I work on two internal, mission critical applications. Let's keep it simple and call them "Foo" and "Bar". Nobody outside of the company has ever heard of them - like I said, they're internal apps. Until now my jobtitle has just been "Software Developer". I've recently discovered that my jobtitle is being changed to "Foo and Bar Developer". I'm a little worried that, should I leave the company, I'll have trouble finding a new job because of my weird job title. My question is this: How important is my job title compared to everything else on my CV (or resume, if you're American)? Am I likely to be rejected by box- ticking HR people who don't realise that "Foo and Bar Developer" is the same as "Software Developer"? Thanks in advance.


title: Interview process: 'Exam' for empirical scoring of candidates

text: As part of an interview process for a senior software development role, we are being asked to create a language-agnostic 'exam' that can be sat as part of the face-to-face interview. The reason being that we will need to produce non-subjective empirical evidence as part of the justification of who is offered the role. **How would you structure/format it to give the most reasonable results possible?** **What sort of questions would you ask?** _(Note: this is not the majority of the interview process, just a small piece we must do)_


title: Best practices for upgrading user data when updating versions of software

text: In my code I check the current version of the software on launch and compare it to the version stored in the user's data file(s). If the version is newer, then I call different methods to update the old data to the newer data version, if necessary. I usually have to make a new method to convert the data with each update that changes user data in some way, and cannot remove the old ones in case there was someone who missed an update. So the app must be able to go through each method call and update their data until they get their data current. With larger data sets, this could be a problem. In addition, I recently had a brief discussion with another StackOverflow user this and he indicated he always appended a date stamp to the filename to manage data versions, although his reasoning as to why this was better than storing the version data in the file itself was unclear. Since I've rarely seen management of user data versions in books I've read, I'm curious what are the best practices for naming user data files and procedures for updating older data to newer versions. Edit: The 'date stamp' stemmed form a discussion here: http://stackoverflow.com/questions/8104812/does-releasing-a-new-version-of- the-app-delete-files-of-the-older-one/8104906#8104906 Since the question is too open-ended, I should say I'm looking for the recommended procedures for upgrading user data between versions. If possible, it would be nice to see iOS / objective-c practices, but it's not required.


title: Law of Demeter causing subclassing indecision and conflict with Single Responsibility

text: This is my situation: I have a class called CueList, which is basically a wrapper around ArrayList. I have another class called `TimeTicker` that alerts all the `Tickable` (interface) in its list that a certain amount of time has passed. Since I need to tick all of the items in `CueList`, but I don't want to violate DRY by keeping a copy of all of the CueList items in the `TimeTickable` class as well (which would make a nightmare when I want to delete a Cue), my immediate instinct was to make `CueList` a `Tickable` and have it pass on the "tick" message to all of its items. This seems to violate the Single Responsibility principle, which says that `CueList` should not worry about both keeping track of all the cues AND Ticking them. So what I did was create a `CueManager` class that is itself Tickable and links everything up (and ticks all of the CueList elements). But now, because of the law of demeter, I have a bunch of duplicate methods in the `CueManager` that just mirror the `TimeTicker` and `CueList` class. Doesn't that mean that the `CueManager` class has multiple reasons to change? Doesn't that mean it violates the Single Responsibility principle. Also, since most of the methods in CueManager mirror TimeTicker and CueList, doesn't that really mean that it IS a TimeTicker and CueList. Therefor shouldn't it INHERIT from CueList and TimeTicker! (Obviously you can't do multiple inheritance in Java, but I feel like it sort of makes sense to Inherit from CueList, but then that would violate Single Responsibility) So in summary: **Law of Demeter makes me make a bunch of methods that merror two other classes, but that makes me think that it really should just inherit from both of those classes, but that would mean that one class handles multiple responsibilities (even if it is through its superclass).**


title: What should developers know about UNIX-based systems?

text: I'm a bit amazed that this hasn't been asked by anyone yet, but at a high level, what should every developer know about working with UNIX-based systems? My *nix experience is very limited, because I have absolutely no reason to use it over Windows for my own purposes, but I have two interviews coming up where the companies ideally want someone with *nix experience. I have no problem becoming acquainted with it if they make an offer I want to take, but it's not worth the investment when the majority of my offers are dealing with Windows systems; hopefully this is understandable. Which tools should I know about? Any quirks that I should be aware of? Are there any good, concise resources that can be read quickly to get a broad understanding?


title: What is the role of the lead developer in an agile team?

text: In a non-agile development team a lead developer _generally_ :   * Sets the standard (coding and otherwise)   * Researches new technologies for the team   * Sets the technical direction for the team   * Has the final say on matters   * Designs the architecture of a system However an agile team works differently:   * An agile team will rely on emergent design, rather than up front    * An agile team designs together, rather than design being dictated by one person   * An agile team decides on their own technical direction, which is best to deliver a project Where does this leave a lead developer in an agile team? Is it possible to have a lead developer in an agile team? Does a agile team demand different responsibilities from a lead?


title: What is a dotted pair's analogy in other Lisp implementations?

text: What is Scheme's dotted pair construct analogous to in other Lisp implementations? I can make a vector or list quite easily, and understand those in Clojure, even though the syntax is a little different, like Clojure's vectors use square brackets []. However, seeing a dotted pair for the first time threw me. It almost looks like it is an implementation of of map. I'm not looking for a discussion, but more for use or the dotted pair equivalent in other Lisp dialects, like Clojure, or even Python.


title: Is it okay to test multiple similar files in one functional test

text: I've a functional test using `Junit` which tests delivery of xml file to an end-point. XML file is sent by client, so I copied it to a test folder, read it from there in my test and do asserts. We have 10-20 such files with different data but same format, my architect wants me to copy all of them into same folder, loop through them in same test, just to make sure that they are delivered successfully. Note, I am not testing any data validations in this test just successful delivery. I am not sure if its a good idea to loop through multiple files in a single test in my case because if one fails rest will not be executed and also not convinced for writing 20 tests doing exactly same thing. Please advice


title: What Is The Formula for the 3 of 9 Bar Code Alphabet?

text: Background: 3 of 9 Barcode Alphabet A simple syntax for 3 of 9 bar codes What is the formula behind the alphabet and digits in a 3 of 9 bar code? For example, ASCII has a relatively clear arrangement. Numbers start at 33, capitals at 65, lowercase at 97. From these starting points you can infer the ASCII code for any number or letter. The start point for each range is also a multiple of 32 + 1. Bar codes seem random and lacking sequence. If we use the syntax from the second link, this is the first six characters in 3 of 9:               A 100-01     B 010-01     C 110-00     D 001-01     E 101-00     F 011-00      I see no pattern here; what is it? I'm as much interested in the designer's intended pattern behind these as I am in someone devising an algorithm of their own that can give you the above code for a given character based on its sequence. I struggled with where to put this question; is it history, computer science, information science? I chose Programmers because a StackExchange search had the most barcode hits here, and because I wanted to specifically relate it to ASCII to explain what sort of formula/explanation I'm looking for.    ## Update For the curious, here's the full list of all basic characters in Code 39: http://jsfiddle.net/b9chris/LnX2e/2/ (the source lines are taken from my C# barcode lib) You'll notice that the simplified syntax proposed can confuse the issue a bit, because it might imply that every character is a 5-bit number with a dash position. The final 4 characters have numerous dashes (wide gaps). Really, these codes are best thought of as 9-bit numbers that happen to have most odd bits set to 0 for the majority of symbols. Here they are as 9-bit numbers: http://jsfiddle.net/b9chris/LnX2e/1/


title: A sample build.sbt to allow me easily specify source dirs and libraries?

text: I recently started learning Android development and I decided to follow the following development processes:   1. Preinstall Scala in emulator   2. Edit source files in IntelliJ IDEA 11   3. Compile the project with sbt in command line   4. Dex generated classes without Scala libraries   5. Build APK and test in emulator In the above steps, except step 3, I think other steps can be easily handled by command line/makefile. So here I am, I want a sample build.sbt to allow me easily specify the following information:   1. Source directories   2. Reference libraries   3. Output directory I am aware of sbt android plugin and sbt idea plugin but I want to avoid them for the following reason: projects generated by android plugin dex Scala libraries for each build but I want to have control on that part: I want to skip Scala libraries for development but include them for release build, which seams requires a lot of digging if I do it with the plugin but can be easily handled if it is done from command line/makefile. If overall what I plan to do makes sense, could someone familiar with sbt provide such a sample build.sbt? I have already spent hours following sbt tutorials but felt it’s so hard to make each seemed simple change to the default behavior of sbt. A side question, it seems that source directories added by unmanagedSourceDirectories get compiled every time regardless of the time stamp. If that’s the case, what’s the point of using sbt? I can just feed all sources files into scalac. **UPDATE**   This is the build.sbt based on Daniel C. Sobral's answer. When I type in sbt compile, it only prints some info like "Set current project to HelloAndroid...". No compilation happens.               name := "HelloAndroid"          scalaVersion := "2.8.2"          unmanagedSourceDirectories := List(       file("src"),       file("gen"))          libraryDependencies := List() // remove Scala's library from dependencies          unmanagedJars := List(Attributed.blank(file("C:/bin/android/platforms/android-10/android.jar")))          target := file("target")      I didn't expect it compiles because I still need to work out the jar files but at least I should get some compiler error. Any hint? **UPDATE** : the sbt compile outputs the following:               [info] Set current project to HelloAndroid (in build file:/C:/Users...     [success] Total time: 0 s, completed May 14, 2012 10:36:23 AM      I have two source files in src directory:               src/com/example/[HelloScala.scala MyActivity.java]      No class file is found under target folder.


title: What made BASIC profitable?

text: In the 1970s, a man called Bill Gates developed an interpreter for BASIC: the Altair BASIC. Per my understanding, he was able to persuade the guy in charge of a microcomputer company to include the interpreter program on every microcomputer he sold, which I assume brought Gates and his crew some royalties. Apparently this made Gates a fortune. What I don't understand is why programing languages aren't as profitable today. What factors in the past made them profitable, but not today ?


title: Which automated analysis tools can find the heartbleed bug?

text: After reading this description of the infamous heartbleed bug, and how the OpenSSL team is relatively small and lightly funded, I'm wondering: would this bug have been uncovered by coverity, valgrind or other tools?


title: Is having multiple CDN locations for a product self defeating?

text: I was double checking the URL for the CDN version of jQuery this morning, and noticed that there are three different locations now. Is having multiple networks hosting a product bad, or even self-defeating? I thought a primary advantage is that as more and more sites use a CDN version, that the odds the library being cached in the browser keep going up. If the CDN is set up properly, and a user is using a decent browser, then the network doesn't even get accessed for a cached file. In the case with jQuery, does't having having three CDNs lower the cache hit rate by 1/3? Am I missing something here?


title: What source control would be best to use with my private gaming server?

text: I'm looking to version control everything, including sql server components, a client launcher, and server-side software. I want to use an online resource where people can make updates, and make it easier to roll out any changes to players. Most of the files are just text files, or gtx image files. I don't think this qualifies as open source, so I don't know what to do. I tried github, and have a free account there, but it was really clunky, mass adding every file to be comitted. I really don't like subversion but if that's the best option, I'll use it. The other people who will need access to the files will have no familiarity with any kind of source control, so I need an easy system for them to download files, make changes, and comit to the repository. Any suggestions?


title: What are the essential things I should know about the Mac?

text: I am about to start a new job at a startup company on Monday. Today they asked me what I want for a PC for work, Windows, Linux or Mac (presumably a laptop). I am proficient with Windows and Linux but I have never used a Mac, so without hesitation I said I wanted a Mac. Without looking like a idiot on the first day of the new job and without access to a MacBook over the Thanksgiving weekend, what resources would you recommend for me to learn as much as possible before I lay my hands on my Mac? Looks like they use Google Apps so the office suite part is all set, for development, I will use C++/STL/Boost and GCC. A few months ago, I asked about a slightly different question on the Stack Exchange Unix forum: Software developer switching from Linux to OS X, what are the gotchas? Update 1: I'm expecting to work longer than normal hours, so I wouldn't think using some time on the job to acquire a new skill is such a bad thing to the company. Update 2: I'm writing on my new MacBook Pro now, I love my new Mac. thanks for all the answers for helping with this transition. Update 3: to naysayers out there, I'm glad that I picked a MacBook without hesitation. I love my new job and new Mac. :)


title: Is it possible to build all features of functional language with only closure?

text: I'm trying to make a new functional language and it's interpreter for practice. As I know most basic building block is only a lambda function, and it's just a closure. I'm not understanding them well, so I want to ask about I'm right or what's wrong?


title: 8 bit and 1 byte, is this a valid question to be asked?

text: I saw these question in our school's past paper, and I'm wondering if this is a valid question. > How big is `bool` in C and C++? > > A) 1 bit > > B) 4 bit > > C) 8 bit > > D) 1 byte > > What is the smallest unit of memory C or C++ use? > > A) 1 bit > > B) 4 bit > > C) 8 bit > > D) 1 byte The answer to both are D, but I am thinking if this is inappropriate. EDIT: 1 byte is not necessarily 8 bits on some systems. See this StackOverflow post.


title: Are there any equivalent articles similar to hginit.com for git (and moving from SVN)?

text: I'm wanting to get the most out of git and not just be using it as a translated form of SVN. I've read hginit's article about coming from SVN. That article of course though is concerned with Mercurial. Git is distributed and similar, but I wouldn't think it to be the exact same. Is there any articles similar to hginit to forget about SVN and start over with a Git mindset?


title: How is the actor model used?

text: I have read a bit about the actor model, but don't really understand how to use actors in a real world situation – how to model a problem with them. Can someone please explain? A simple example or links to examples would be much appreciated.


title: Do non-manager coders in their forties or older out there sometimes regret about not being managers?

text: And why do most programmers quit coding and become managers so early compared to other areas? You can work as a construction worker, a lawyer, researcher, writer, architect, movie director for decades if not your whole life, without quitting the favorite thing you are doing. And yet most programmers think being a manager, or better, a non-coding manager is a cool thing and the ultimate goal of the software career. It's so rare to see an ordinary coder in his 40s or 50s (or 60s!) in a typical software company. Why? (And I am for being a coder for as long as you love doing it.)


title: Moving past the ignoring or considering whitespace binary: how should I compare files for e.g. commit review?

text: I am dissatisfied with the file comparison tools I have worked with so far. While no tool would be able to always predict the line matchings that make best sense, at least current tools should be able to do a better job when changes mostly consist of added and removed indentation. But the tools have I used end up matching braces in isolation and separating actually related code, and do other seemingly obvious mistakes. An example will speak volumes, let us take this:               // We also have to add any specified prefix and (pre-period) suffix.          if (prefix) [spriteName insertString:prefix atIndex:0];          if (suffix)     {        NSRange pos = [spriteName rangeOfString:@"."];        if (pos.location == NSNotFound)        {           // No point, it's a base sprite, so just append.           [spriteName appendString:suffix];        }        else        {           // Append where the period was found, just before it.           [spriteName insertString:suffix atIndex:pos.location];        }     }      and assume it gets changed to this:               // We also have to add any specified prefix and (pre-period) suffix.          if (prefix) [spriteName insertString:prefix atIndex:0];          while (we_need_to_do_stuff)     {        if (suffix)        {           NSRange pos = [spriteName rangeOfString:@"."];           if (pos.location == NSNotFound)           {              // No point, it's a base sprite, so just append.              [spriteName appendString:suffix];           }           else           {              // Append where the period was found, just before it.              [spriteName insertString:suffix atIndex:pos.location];           }        }     }      I don't want to namedrop too much, but what does FileMerge (the graphical diff/merge utility that ships with Xcode) do? This: ![Screenshot of FileMerge doing barely useful matching](http://i.stack.imgur.com/SBv0P.png) …how thoughtful, FileMerge, you made sure to match the braces because they were at the same indentation level, and separated the related code. Couldn't have asked for more. The usual solution in that case is to find the option to consider changes in the amount of whitespace as being not significant, and try again. But then I want to make sure I have not fumbled the indentation either, because it is something I am going to commit, so I go back to the options, disable the option, try again. Repeat for all the changes I want to review. There has got to be a better way. Is it just me using my tools badly? Is it theoretically possible to improve this workflow? And this is a simple case, have trickier ones been solved in the abstract? How should I look for better tooling in this domain, given that this is hard to express as a search engine query?


title: Storing a re-orderable list in a database

text: I'm working on a wishlist system, where users can add items to their various wishlists, and I plan to allow users to re-order the items later on. I am not really sure about the best way to go about storing this in a database while remaining fast and not turning in to a mess (this app will be used by a fairly large user base, so I don't want it to go down to clean up stuff). I initially tried a `position` column, but it seems like that would be quite inefficient having to change every other item's position value when you move them around. I have seen people using a self-reference to refer to the previous (or next) value, but again, it seems like you would have to update a whole lot of other items in the list. Another solution I've seen is using decimal numbers and just sticking items in the gaps between them, which seems like the best solution so far, but I'm sure there has to be a better way. I would say a typical list would contain up to about 20 or so items, and I will probably limit it to 50. The re-ordering would be using drag and drop and will probably be done in batches to prevent race conditions and such from the ajax requests. I'm using postgres (on heroku) if it matters. Does anyone have any ideas? Cheers for any help!


Does your company have a written policy about personal (technical) blogging? Care to share? We encourage our developers to keep personal blogs and talk about technical problems they've encountered at work that are not core competency or core IP. We've been doing it "don't ask don't tell" style, but it's time to write something down. **Update** : thank you all for your answers, we've implemented a policy for this last week - the full text is here.


title: Should you bother with SVN branches if you only ever have one?

text: If we only work with one branch in Subversion, should we even bother? Can't we just work on the trunk to speed things up? This is how we develop with Subversion:   * There is a trunk   * We make a new development branch   * We develop a new feature on that branch   * When the feature is done, it is merged in the trunk, the branch is removed and a new development branch is made from the trunk When we want to release to production, we make a tag from the trunk. Bugfixes are made on a branch from that tag. This bugfix is then merged in the trunk. This is why we make a new development branch after a feature is done. This way, the bugfix is included soon enough in our new code. Below is a diagram which should clarify: ![Our Subversion strategy](http://i.stack.imgur.com/DAm69.png) Now, there's a feeling this isn't the most efficient way of working. We build locally before we commit, which takes about 5-10 minutes. You can understand that this is experienced as quite a long waiting time. The idea of a development branch is that the trunk is always release-ready. But this isn't true in our situation anymore. Sometimes, a feature is almost ready, and some developers will already start coding the next feature (otherwise, they would be sitting around waiting for one or two developers to finish and merge). Then, when feature 1 is finished, it is merged into the trunk, but with some commits of feature 2 included. So, should we even bother with the development branch, as we only ever have one branch? I've been reading about trunk-based development and branch-by- abstraction, but most articles I've found focus on the branch-by-abstraction part. I get the impression that's for big changes that will span over several releases. This is not a problem we're having. What do you think? Can we just work on the trunk? Worst-case scenario is (I think) that we would have to make a tag from the trunk and cherry-pick the commits we need, because some commits/features aren't production ready yet.


title: IEEE SRS documents: lightweight version when working with outside contractors?

text: Typically we follow an Agile development process that tends not to put an emphasis on writing requirements and technical documents that nobody will read. We tend to focus our limited manpower to development and testing activities with collaborative design and whiteboarding as a key focus. There is a mostly standalone web component that will take quite a few weeks to develop, but this work can be mostly parallel with other project work going on. To try and catch up time I was given a budget for hiring a developer on oDesk to complete this work. While my team isn't accustomed to working off of a firm SRS document, I realize that with outsourced development that it is a good idea to be as firm and specific as possible so I realize that I need to provide a detailed Requirements and Technical Specification document for this work to be done correctly. When I do write a Requirements document I typically utilize the standard IEEE SRS document template but I think this is too verbose and probably overkill for what I need to communicate to a developer. Is there another requirements document that is more lightweight and also accepted by a major standards organization like the IEEE? Further, as what will be developed as a software module that will interact with other software modules, my requirements really need to delve into technical specifications for things to work correctly. In this scenario does it make sense to merge technical and requirements specifications into a single document, and if not, what is a viable alternative?


title: Is it ok to ignore poor performance for a resource that will be cached?

text: Let's say I have a web service that is poorly written and inefficient, but it's output is cached so there's no bottleneck. Do you just leave it? Would you go as far as to take deliberate shortcuts knowing that performance problems will be masked?


title: How to ensure a project 100% tested?

text: I want to know how exactly, we can ensure that a project is 100% tested ?   In banking or financial applications not 1% also tolerable.   So being a developer, how can you say your code is 100% tested?   Explanation with example is highly appreciated.


title: N-Tiered Web App Using JQuery/ASP.NET Web Services

text: For fairly small, non-complex web applications, we have utilized jQuery to make asynchronous calls to an ASP.NET web service for interaction with our Sqlite data store. This has proven to be a pretty clean way to isolate the application tiers while taking advantage of the powerful client-side functionality of JQuery. However, we are currently in the process of designing a larger application that consists of potentially hundreds of data elements. I am concerned that the sort of architecture mentioned above could get unwieldy pretty fast if we are passing hundreds of elements into the web service from a jQuery ajax post. I was interested in others experience with this sort of design and whether you would recommmend another approach.


title: Is 500 million lines of code even remotely possible?

text: The New York Times is reporting that the Healthcare.gov website contains "about 500 million lines of software code." This number, attributed to "one specialist", and widely repeated across the interwebs, seems incredibly far- fetched (even assuming a large fraction of that number includes standard libraries). If this is an accurate estimate, it would truly be staggering (as this fascinating infographic vividly reveals). I realize StackExchange:Programmers isn't Snopes.com, but I'd like to find out if anyone here believes this is even remotely possible. I'd like to know if there is a plausible system of accounting (using examples from publicly available data, if possible) that could lead someone to conclude that such an estimate is within the realm of reason. How could a codebase (by any measure) sum up to such an exhorbitant number of code lines?


title: Advice Required Regarding Creating a Self Learning, Self Organizing Programming Team…

text: I'm a senior student at my university and chairperson of IEEE Student Branch there. Recently I was thinking of some idea to acquaint students with the professional environment, how software is produced in the industry and get a practical experience.. Obviously trips to software houses are not enough and we cannot provide this many internships. So the idea of simulating a software house within the university popped in. Resources at my disposal are students with their own laptops, university UPS and lan network with internet access, and a reasonably sized room with a whiteboard and three hours free time daily.. :) However, I have absolutely no idea where to begin with. Milestones or whatever it may be called, are Requirements Document generation, sharing of resources, delegation of tasks, version controlling etc... I'd really appreciate some advice, programming tools (for JAVA), communication tools etc and other things used in a decent software house... Technologies to be targeted shall be random possibly starting with J2EE Spring Hibernate and Later Visual Programming in .NET C# and ASP.NET MVC as well as Android or iPhone development....


title: What happens at [platform] user groups?

text: I'm a .NET developer, but I've never been to a .NET user group meeting or anything like that. I might have the opportunity soon to start attending one, but I'm wondering. What happens at user groups? I'm not looking necessarily for info specifically about .NET ones, but they are preferred. What do you get out of it _excluding_ the opportunity for networking?


title: Software architecture map to aid cross team communication?

text: I work in a company where multiple teams each work on different parts of a software product in a vaguely agile/scrum manner. Mostly the organisation works well but there have been instances where a team may make a change without realising its impact on other teams. Where dependence is known communication has been good, and where dependence is suspected then 'broadcast' emails and informal conversations have also worked well. But there exists a sub-set of tasks that fall between the cracks. Broadcast emails are likely not the solution as they would become too numerous such that the email signal/noise ratio would fall. I'm contemplating a solution that involves a sort of map of the software, which details all of the various parts of the system and loosely tries to place interacting and dependent parts near to each other. Each developer then updates their position on the map (today I'm working on X and Y), and therefore if two or more developers happen to be co-located (or proximate) on the map then we can see this each day and this could form the trigger for further discussion on possible overlap and conflict. Is such a method out there and in use? If so what is it and does it work? Otherwise, do you think such a scheme has merit?


title: What intermediate representations can be used to reason about concurrency?

text: I am trying to better understand what would be required for a compiler to be able to make intelligent choices regarding concurrency on behalf of the programmer. I realize that there are many difficult aspects of this problem for instance:   * Ensuring that there are no race conditions   * Ensuring that the code to be run concurrently won't have side effects that impact the semantic meaning of the code   * Deciding whether the overhead from spinning up threads is worthwhile given the degree of parallelism available in the code My understanding is that the two major intermediate representations used in modern compilers are static single assignment for procedural and object oriented languages and continuations passing style for functional languages. Reasoning about any of the problems listed above seems difficult using these intermediate forms. Even languages that should in theory have the best chance at automatic parallelization (pure functional languages like Haskell with a guarantee of no side effects) have made limited progress on this front. So my question is really what intermediate representations have been used to try and tackle this problem? Are there other representations that have been used in academic research that I am not aware of that are better suited to this task? Is this problem one that fundamentally has to be resolved by the compiler front end by manipulating the abstract syntax tree before compilation reaches an intermediate representation?


title: Sequence Diagram. UML "Use Case Ends"

text: I have a couple of questions about UML.   * Firstly, how would you show "Use Case Ends" on a sequence diagram.   * Secondly, if you have an alt in a sequence diagram for "Variable == false", would you need to show what would happen if the variable is true, even if nothing would happen other than moving onto the next method call?    * Third, isn't the last arrow on the diagram always going to be asynchronous, because it can continue and does not have to wait?


title: Real-world use cases for Smalltalk

text: I've been playing a bit with Smalltalk, and I found it interesting. I know that there are some classical examples of Smalltalk: the Smalltalk images themselves and the Seaside web framework, and that there are lots of in-house custom applications built using this language. I'd like to know:   * if there are computer applications actively used and developed apart from the ones I mentioned;   * if there are software houses that use Smalltalk for doing their job;   * when would you use Smalltalk instead of another language for developing from scratch a new application;


title: How to foster intrinsic motivation in a software team

text: Jeff Atwood's blog post on Amazon's Mechanical Turk suggests that it should not offer monetary rewards but rather intrinsic motivation, _"motivation that is driven by an interest or enjoyment in the task itself, and exists within the individual rather than relying on any external pressure."_ How does a team member (a manager, a lead, or a developer) foster intrinsic motivation in a software team? **EDIT:** Please provide comprehensive answers. Share your personal experience with objective analysis. **EDIT #2:** To facilitate a productive and on-topic discussion, we should assume that monetary compensation is satisfactory to the developer.


title: Why don't we have web IDEs?

text: Why don't we have a lot of good web-based IDEs? Which aspects of the system make it difficult for IDE to be implemented as a web application?


title: Solutions for "Maintenance Mode"

text: Given a web application running across 10+ servers, what techniques have you put in place for doing things like altering the state of your website so that you can implement certain features. For instance, you might want to:   * Restrict Logins/Disable Certain Features   * Turn Site to "Read Only"    * Turn Site to Single "Maintenance Mode" page.  Doing any of the above is pretty trivial. You can throw a particular "flag" in an .ini file, or add a row/value to a `site_options` table in your database and just read that value and do the appropriate thing. But these solutions have their problems. ## Disadvantages/Problems For instance, if you use a file for your application, and you want to switch off a certain feature temporarily, then you need to update this file on all servers. So then you might want to look at running something like ZooKeeper, but you are probably overcomplicating things. So then, you might decide that you want to store these "feature" flags in a database. But then you are obviously adding unncessary queries to each page request. So you think to yourself, that you will throw memcached in to the mix and just cache the query. Then you just retrieve all of your "Features" from memcached and add a 2ms~ latency to your application on every page. So to get around this, you decide to use a two tier-cache system, whereby you use an inmemory cache on each machine, (like Apc/Redis etc). This would work, but then it gets complicated, because you would have to set the key/hash life to perhaps 60 seconds, so that when you purge/invalidate the memcached object storing your "Features" result, your on machine cache is prompt enough to get the the new states. What suggestions might you have? Keeping in mind that optimization/efficiency is the priority here.


title: Working alone vs with others

text: Being a student in a small school, there aren't a lot of people _(well, there aren't any)_ that share the same passion or skill of programming that I have. I have been learning to program myself since the age of 9, and I believe I have reached the level where I am ready to do something more ambitious, as opposed to the little scripts and personal web design I do at the moment. The point is: would having a small group - or just another person - allow us to achieve greater things? If so, how would I begin building a team?


title: Finding the name of a video game with a picture of its cover (Python/Java)

text: For the past few days, I've been trying to figure out how to take an image of a video game cover (like this one) and get the name of the game from it. Initially I attempted to use Google's Search by Image, but they're not fond of automated queries and sadly I am only able to reverse-image search from a browser and not programatically. I have a database of all of the video game covers and their names, but I'm not sure what approach I should take to matching the images (there are just around 7500 of them). I'll also need to account for lighting, orientation, and size differences, so that (I think) throws out pixel comparison. Someone else has done something similar (see this video on Youtube), so I know it's possible, I'm just not sure where to start. Any thoughts?


title: Should I use inheritance or an interface?

text: So in a nutshell I have an abstract class :               public abstract class Member       {     public string PCode { get; set; }     public string Reference { get; set; }     public DateTime? ElectedDate { get; set; }     }      And this is inherited by 3 other classes:               public class Fellow : Member     {      // some class level properties here     }     public class ForeignMember : Member     {      // some class level properties here     }     public class HonoraryMember : Member     {      // some class level properties here     }      And the usual CRUD operations are done through using a generic repository pattern: ### Interface               public interface ICRMRepository<T>     {         List<T> GetAll();         T GetById(int id);         T GetByPCode(string pcode);     }      ### Class               public class CRMRepository<T> : ICRMRepository<T> where T : class     {             public List<T> GetAll()        {         //actions go here        }             public T GetById(int id)        {         //actions go here                }             public T GetByPCode(string pcode)        {         //actions go here        }     }      The question is if I wanted to do a query that would bring back all the Fellows, HonoraryMembers and ForeignMembers in one result set, how would I do this? Would it be better to have an interface instead of inheritance e.g. IMember, and then the three classes use that interface? Or some solution that uses both?


title: What is the "Find-Fix-Verify" pattern?

text: What is the "Find-Fix-Verify" pattern, as related to the process of doing editing/spellchecking/debugging, etc.? Where is this pattern best described? What are some advantages and disadvantages of this pattern?


title: Best practice regarding security in mobile applications

text: A friend asked me recently about mobile applications and the security surrounding them. As he wishes to make a mobile app that would handle very secure information such as credit card numbers, I was starting to wonder about the issue of security surrounding these devices. Does it seem reasonable to store sensitive information inside of a mobile app? I wonder this because I have seen dex to class to java decompilers online and I imagine that on any mobile device there is no guarentee that the data in the _secure_ locations is as secure as they would like you to believe. But, I'm not an expert on these things; I feel like I'm a stranger when it comes to the wonderful world of security. So that's why I ask you this, what is the best way to securely store the data? Is it feasible to securely store credit card information/passwords/etc on a mobile device? If so, what methods should one take in order to assure the users that the best possible measures were taken to securely store their information. If not, what is a good alternative to store all that sensitive information? Even then, with the stories in the news about user data stored in web sites being compromised what measures should be taken to ensure that the data stored there is also secure?


title: What are the valid reasons to use ContentPresenter outside of template?

text: I stumbled upon an article by Den Delimarsky on What is a ContentPresenter? which says: > In WPF there is an element called ContentPresenter, that is often used > inside control templates, as well as inside the root application markup. I don't understand the "inside the root application markup" part, because I thought that ContentPresenter can only used inside of a ControlTemplate. The role of the ContentPresenter is quite clear when used in a ControlTemplate, but what are the valid reasons to use ContentPresenter outside of a template's markup?


title: Non-OOP Design Patterns?

text: I have only heard the term "design pattern" being used for object oriented code, and the GoF patterns include only OOP design patterns, but design patterns are elegant solutions for commonly occuring programming problems, right? There is nothing in there saying that they must be limited to OOP, is there? I would like to see some examples of design patterns _outside_ the realm of object oriented programming. Do you have any? Do such even exist (no book, like the GoF book, must necessarily have been written, they should just be used; that is enough)? They can be specific to some programming language(s), but general (paradigm- level) patterns are preferred, of other paradigms than the object oriented one.


title: Pros and cons of low-level vs high-level software development careers

text: I am in the progress of moving on to a new software development job. There are openings for both low-level control software and high-level application software. To me, both opportunities are exciting. Working on embedded/control software technically means programming the operating system for a specific hardware. But this might mean I will be an expert for only that hardware's API and if I move on in the future, I would have to throw away that knowledge. Working on application software, in my understanding, means software that can scale, so I will be developing my design skills as well. Moreover, libraries tend to be reused compared to hardware APIs so what I learn might be of use in the future. But that's my narrow view of the world. I do not have enough experience to see a bigger picture. Is there anything else I should be aware of in choosing between these two software development flavors? Thank you.


title: System requirement specification vs functional one - separate docs?

text: A lot of sources (e.g. Wikipedia) mentiones System requirement specification and Functional specification as two separate entities. However, Wiegers in his book writes: > The software requirements specification is sometimes called a functional > specification, a product specification... This is very confusing for me as I thought FS describes just functions while SRS whole system. From this point of view, FS would contain both non functional and functional requirements and everything else.


title: Why isn't Java being used for web multimedia applications?

text: I've been focusing on multimedia applications and I've noticed that most applications don't use Java in the back end. Instead, I see solutions with PHP/ROR/Python and Flash/Silverlight without any trace of Java in the application stack. What part of Java is either limiting or constrained - or perceived as limiting or constrained - when building multimedia applications? Let me clarify, when I said Java, I meant Java EE. Of course on the client side people will use flash or html5 for audio/video. But what I am trying is that, why is most multimedia platforms backend is created with PHP/ROR/Python(Django)? There are many audio distribution platforms out there. soundcloud.com (uses go lang), tunrtable.fm (uses Python) youtube.com (uses PHP), is Java EE not capable of doing those?


title: Is C# namespace should be Project-Name?

text: I am working with multiple websites (freelancer) and a good amount of them I write using C# MVC4. I created a very good boilerplace project that I plan to use on every next starting mvc4 application I build, however the namespace is named `Website`. I also do a lot of copy-paste from one project to another and then I always have to refactor namespaces, if I will use single namespace (Website) on all my websites then this problem dissapears. However - will this somehow impact my application, is it considered a very bad practice?


title: How to maintain view-related information in MVVM and may I store this in the model?

text: I have an ongoing discussion with some colleagues on how to manage the views to our model. We've got a model which may be represented by many views. Let's say we've got some data that is stored in an array and we'd like to display the data in a table and in charts.   A certain chart is unique but you're able to duplicate the chart. This duplicate should display the data in the very same way as the original, but it does not display the same part (e.g. if the data is too big to display it at once and you can scroll, so the original shows the first 10 items while the duplicated one shows the last 10). At any time you can remove a view. The view and the view-model are then deleted from the memory. The model persists even if there's no view representing the data. There is a handful of displaying information on the view which tells how and what part of the data is displayed. Scrolling is one of those, so let's stay with that example. This displaying information is neither persistent nor is it stored in the model. If you shut down the application and restart, we don't care about how the view has been before and we always set up a default. If you, however, delete a view and then undo, we'd like to display the data exactly as it's been before deleting. The newly created view is technically not the same as before.   In order to adjust the view, I need to maintain the scrolling position. I would simply put the displaying information into the model as this continued to exist for the whole time. However, some colleagues disagree and they say the model should only contain persistent data (like the actual data we're representing).   Hence we shouldn't keep track of the displaying information about the view in the model. Q1: Is it correct from a design perspective that the model contains only persistent data? If yes, how would you maintain view-related information? As said above, the model may be represented by many views, some of which may be duplicates of each other.   Let's say I found a way to maintain the data. I would have a collection of X displaying information.   Q2: When creating new views which actually replace the old views (keyword undo), how can I determine which displaying information of the collection should be associated to which view.   I mean even if my view had a unique ID, since we've created new one, we cannot rely on this data. I can't quite figure out how I could associate these information correctly. The only idea that raises is having a separate view-model for each view and keeping the view-models alive, too. On the other hand, I think that's not what it's supposed to be, is it?


title: How to translate SQL query into REST API requests?

text: Let's say I have a machine-readable description (such as in WADL, Swagger or RAML) of a REST API that provides interface to a database. My users submit queries about underlying database in form of SQL or similar query language. However, I cannot access the database directly, only through the REST API. **What approach would you choose to build (preferably semi-automatically from description) a system that translates such SQL queries into a sequence of requests to given REST API?** **How would you represent such problem? Are there any algorithms, theoretical frameworks or tools that can help?** The REST API supports:   * read-only operations, i.e. only `SELECT` SQL queries   * XPartial projections (e.g. `/persons?fields=firstname,lastname`)    * RSQL constraints (`/persons?query=firstname==John;department.code==42`, see another examples). Some references between tables (foreign keys) are represented as attributes in the REST API (such as `Person.department` in above constraints example), but some references are represented as subresource (e.g. `/persons/{userName}/projects`). This means that some queries requires to devise "a plan" to be answered in terms of REST requests. E.g.: Query for "names of active projects of Chuck Norris" would translate to:   1. `/persons?query=firstname==Chuck;lastname==Norris`   2. Get `userName` from result   3. `/projects/{userName}?fields=name&query=state==ACTIVE`


title: When is an API considered to be an embedded DSL?

text: What is the difference between an API and an embedded Domain Specific Language (DSL)? Is it just syntax? Consider an API like OpenGL. How is that different from a graphics DSL? In other words, if an API is sufficiently complex, can it be considered an embedded DSL?