title: Mod lines in Java code

text: Often in C code (and some other languages as well) I have seen a section in the top-level comments for mod lines. These include the date a modification to the file was made, the user who made the modification, and a brief description of what was changed. I have not yet seen an equivalent of this in Java. I think this information is useful, especially when trying to track down bugs in code I did not write. Is this because Java code is often under version control, or are there other reasons? Are there any suggestions as to how to include the information in the code file?


title: How to extract JSON schema, using Java, from data without using available libraries?

text: The problem in extracting schema from any given data is that they can have other JSON objects embedded in them which in turn have others. Also the types of the values in the name-value pair have to be recognized. How can it be done effectively in Java?


title: How to code a function to be used with or without callback on Javascript?

text: I'm wondering how (if possible) I can create the same function, with exactly the same functionality, but to be used with a callback or without it. Here is an example with the "wanted effect" that is not working:               function getUsers(req, res, onComplete) {         // If the user is not logged in send an error. In other case, send data         if (!req.session.session_id) {             if (typeof onComplete === 'function') {                 onComplete({error: true, msg: 'You are not logged in'});             } else {                 res.json({error: true, msg: 'You are not logged in'});             }           } else {             //Another similar code...         }     }      It's not working because if I call "getUsers(req, res)", the typeof onComplete is always function, so I cannot detect when I call with or without the callback. The exact problem is that I can call this function from inside my code, with callback (a normal call, like `getUsers(req, res, function(cb) {//Do something with cb});` OR I can call this function from an AJAX call in my website, like `http://localhost:8080/api/getUsers`, what in that case is when it don't works. In the last case I get `typeof onComplete === 'function'` as true, so I never get the else part executed. I'm supposing that the "request" done by the http call have more parameters than req&res, and that's the reason why onComplete is a function, instead of undefined. The usual AJAX call is like this (javascript in the client side):               function getAllUsers() {         $.ajax({             url: '/api/getUsers',             type: 'GET',             success: function(data) {                 // Remove item and set as main topic the assigned on the server                  printUsers(data.users[0]);             },             error: function(XMLHttpRequest, textStatus, errorThrown) {                  alert(XMLHttpRequest.responseText);              }          });     }      And the route defined in the config.json of my Node.JS to call the final function is like that:               {"path": "/api/getUsers", "method":"get", "callback": "api#getUsers"},


title: How related is coding/information theory to computer networking?

text: I am taking a networking class(data communication) this coming semester. In many courses in my computer engineering degree, the books lack mathematical content. I am not a math wizard, but I think mathematics has the potential to give a much deeper understanding of different concepts, but it requires more work. Is it a good idea to focus on information theory(found a cool book by a researcher from Bell Labs) and use a more "high level" book like Computer networking, A top down approach as supplementary text?


title: Why it is necessary to to test my iPhone app on actual iPhone device

text: I developed one application for iPhone and now I want it on App Store. So many my iOS geek friends told me to test it on actual device i.e. on iPhone. So I wonder that why it is necessary to to test my iPhone app on actual iPhone device though they (Apple) have given "simulator" which is near about same as my device?


title: Is it common to prototype in a higher level language?

text: I'm currently toying with the idea of embarking on a project that far exceeds my current programming ability in a language I have very little real world experience in (C). Would it be valuable to prototype in a higher level language that I'm more familiar with (like Perl/Python/Ruby/C#) just so I can get the overall design going? Ultimately, the final product is performance sensitive (it's a database engine), hence the choice of C, but I'm afraid not knowing C well will make me lose the forest for the trees. While searching for similar questions, I noticed one fellow mention that programmers used to prototype in Prolog, then crank it out in assembler.


title: Using replacement to get possible outcomes to then search through HUGE amount of data

text: I have a database table holding 40 million records (table A). Each record has a string a user can search for. I also have a table with a list of character replacements (table B) i.e. i = Y, I = 1 etc. I need to be able to take the string a user is searching for, iterate through each letter and create an array of every possible outcome (the users string, then each outcome with alternative letters used). I need to check for alternatives on both lower and uppercase letters in the word A search string can be no longer than 10 characters long. I'm using PHP and a MySQL database. Does anyone have any thoughts / articles / guidance on doing this in an efficient way?


title: Are there programming languages that allow you to do set arithmetic on types?

text: Out of curiosity, are there languages that allow you to do set arithmetic on types to create new types? Something like:               interface A {       void a();       void b();     }          interface B {       void b();       void c();     }          interface C = A & B; // has b()     interface D = A | B; // has a(), b() and c()     interface E = (A & B) ^ B; // has c()      I know that in some languages these ideas can be expressed (i.e., Java has `List<Comparable & Serializable>` for the union of the interfaces) but I've never heard of a language that supports type arithmetic. Thanks!


title: How do I convince my users not to use a sketch UI?

text: I recently worked on a prototype of a new system using Sketchflow, and now some key stakeholders are pushing for a sketched look & feel in the final product. To make matters worse, the people viewing the prototype were asked to provide feedback on the sketched look & feel by way of a fairly leading survey question, to which 80% of the responses were positive. It's for an enterprise application that will mostly be for internal clients, but is also intended to be used by some external clients. The main reasons I have for it thinking it's a bad idea are:   * It doesn't look polished or professional   * The significant effort involved in skinning an actual application in the sketched style   * The sketched style doesn't make efficient use of screen real-estate I've been trying to figure out what the appeal could possibly be, and the only thing I can come up with is that people are attracted to the simplicity of it -- especially when compared with the existing system(s) it will be replacing. Can anyone point me in the direction of evidence of why using a sketch look & feel is a bad idea? Ideally something based on UI research. I'm worried that my voice isn't going to be listened to unless I can point to something concrete. **[Edit]** I should probably add that the difficulty of skinning the application is compounded by the fact that it is intended to be delivered as one or more Silverlight webparts in a Sharepoint site. Getting a consistent sketched look & feel across both technologies could be very difficult. **[Edit]** Just in case anyone's not sure about what a Sketchflow prototype looks like (and therefore what the people in question are asking for) they're essentially asking for a production application to have a pencil-sketch wireframe look & feel.


title: How one could use a live editor

text: I was thinking about a live editing environment where code / a source file is synchronized so that changes made by one user would be carried across to all others editing the file. Something like Google Wave, but for code. Could this kind of an environment be better for the code, as changes are shared instantly? (with revision-control, of course) Has anyone tried (or has had a need for) using a shared environment for code? I'd love to hear from someone who has used such an editor.


title: Path of Languages from High School to Career

text: I will be a freshman next year who has programmed for about 3 years. I currently know Java pretty well, but I am looking towards the future. In order to be at the top of the job market when I am out of college, what languages should I learn in high school?


title: What are the consequences of having unnecessary references and usings?

text: I'm a bit of a neat freak and tend to keep my projects by cleaning references and using in each class to keep only what's actually used. What other argument could I make (besides calming my OCD nerve) of keeping to the essentials? I'm thinking mostly system references, any reference to custom work will bring its lot of backward compatibility issues. Is the release footprint bigger? Compile time longer?


title: InterviewStreet (Vertical Sticks) just a tip where to get started

text: Having a lot of trouble with this question in interviewstreet.com: Given array of integers Y=y1,...,yn, we have n line segments such that endpoints of segment i are (i, 0) and (i, yi). Imagine that from the top of each segment a horizontal ray is shot to the left, and this ray stops when it touches another segment or it hits the y-axis. We construct an array of n integers, v1, ..., vn, where vi is equal to length of ray shot from the top of segment i. We define V(y1, ..., yn) = v1 + ... + vn. For example, if we have Y=[3,2,5,3,3,4,1,2], then v1, ..., v8 = [1,1,3,1,1,3,1,2], as shown in the picture below: For each permutation p of [1,...,n], we can calculate V(yp1, ..., ypn). If we choose a uniformly random permutation p of [1,...,n], what is the expected value of V(yp1, ..., ypn)? Input Format First line of input contains a single integer T (1 <= T <= 100). T test cases follow. First line of each test-case is a single integer N (1 <= N <= 50). Next line contains positive integer numbers y1, ..., yN separated by a single space (0 < yi <= 1000). Output Format For each test-case output expected value of V(yp1, ..., ypn), rounded to two digits after the decimal point. I serious don't want any code or a pseudo-code algorithm. I just want to know if there is any **specific** computer science theory or it's just something that I have to figure out with a custom method?


title: Is it customary for software companies to forbid code authors from taking credit for their work? do code authors have a say?

text: The company I work for has decided that the source code for a set of tools they make available to customers is also going to be made available to those customers. Since I am the author of that source code, and since many source code files have my name written in them as part of class declaration documentation comments, I've been asked to remove author information from the source code files, even though the license headers at the beginning of each source file make it clear that the company is the owner of the code. Since I'm relatively new to this industry I was wondering whether it's considered typical for companies that decide to make their source code available to third parties to not allow the code authors to take some amount of credit for their work, even when it's clear that the code author is not the owner of the code. Am I right in assuming that I don't have a say on the matter?


title: Diagram to show code responsibility

text: Does anyone know how to visually diagram the ways in which the flow of control in code passes between code produced by different groups and how that affects the amount of code that needs to be carefully written/reviewed/tested for system properties to hold? * * * What I am trying to help people visualize are arguments of the form:   1. For property P to hold, nd developers have to write application code, Ca, without certain kinds of errors, and nm maintainers have to make sure that the code continues to not have these kinds of errors over the project lifetime.   2. We could reduce the error rate by educating nd developers and nm maintainers.   3. For us to be confident that the property holds, ns specialists still need to test or check |Ca| lines of code and continue to test/check the changes by nm maintainers.   4. Alternatively, we could be confident that P holds if all code paths that could violate P went through tool code, Ct, written by our specialists.   5. In our case,      * test suites alone cannot give confidence that P holds     * nd ≫ ns     * nm > ns     * |Ca| ≫ |Ct| so writing and maintaining Ct is economical, frees up our developers to worry about other things, and reduces the ongoing education commitment by our specialists. or those conditions do not hold, so focusing on education and testing is preferable. * * * # Example 1 As a concrete example, suppose we want to ensure that our web-service only produces valid JSON output. Our web-service provides several query and mutation operators that can be composed in interesting ways. We could try to educate everyone who maintains those operations about the JSON syntax, the importance of conformance, and libraries available so that when they write to an output buffer, every possible sequence of appends results in syntactically valid JSON. Alternatively, we don't expose an output stream handle to application code, and instead expose a JSON sink so that every code path that writes a response is channeled through a JSON sink that is written and maintained by a specialist who knows JSON syntax and can use well-written libraries to produce only valid output. # Example 2 We need to make sure that a service that receives a URL from an untrusted source and tries to fetch its content does not end up revealing sensitive files from the file-system, like `file:///etc/passwd`. If there is a single standard way that any developer familiar with the application language's libraries would use to fetch URLs, which has file- system access turned off by default, then simply educating developers about the standard mechanism, and testing that file probing fails for some inputs, will probably be sufficient.


title: Can functional programming be used to develop a full enterprise application?

text: I am just beginning to learn Functional programming (FP). I come from a OOP world, where everything are objects, and most of them are mutable. I have a hard time wrapping around the concept that functions don't have side effects. If something is not mutable, how are common things objects like Employee or Person represented in FP. Can FP be used to create a full fledged enterprise application?


title: How much redundancy/robustness should complex software implement?

text: **The focus of this question:** Some software performs "extra work" in order to increase the chance of a "eventually successful/satisfactory" outcome, despite one or more internal errors in the software, which requires a longer execution time when those errors happen. All these happen without the user's knowledge if the outcome was successful. **Definition of complex software:**   * Contains code written by (contributed from) more than 10 developers over its lifetime, and not written in the same time frame   * Depends on more than 10 external libraries, each with caveats   * A typical software task (for generating a result wanted by the user) requires 10 or more input parameters, where most of them have default values but are configurable if the user needs control.   * Most importantly, software that has the appropriate complexity relative to the task being performed, i.e. _not unnecessarily complicated_. _Edited:_ What is complex? Please see There is a big difference between Complex and Complicated. (direct link) **Definition of Redundancy/Robustness** _within this question_ :    _(Added Robustness based on comments)_   * If a software task failed when the current set of parameters was used, try different parameters.      * Obviously, there must be inside knowledge that those "different" parameters use a different code path, possibly resulting in a different (hopefully better) outcome.     * Sometimes these different code path are chosen based on observations of the external libraries.   * At the end, if the actual task performed is slightly different from the user's specification, the user will receive a report detailing the discrepancy.   * Finally, like the 10-plus configurable parameters, the redundancy and reporting are also configurable. Example of such software:   * Database Migration      * Business database     * Source control database, etc.   * Batch converting between a Word document and an OpenOffice document, PowerPoint and OpenOffice Draw, etc.   * Automatic translation of an entire website   * Automatic analysis of software package, such as Doxygen, but where the analysis needs to be more dependable (i.e. not just a documentation tool)   * Network communication, where packets may be lost and a number of retries are expected _This question was originally inspired fromHow do you deal with intentionally bad code?   but is now focused on just one of the causes of software bloat. This question does not address any other causes of software bloat, such as addition of new features._ _Possibly related:_   * _How to deal with complex codes in (huge) projects_   * _How do people manage to write and maintain extremely complex and hard to read code?_


title: How should I pitch moving to an agile/iterative development cycle with mandated 3-week deployments?

text: I'm part of a small team of four, and I'm the unofficial team lead (I'm lead in all but title, basically). We've largely been a "cowboy" environment, with no architecture or structure and everyone doing their own thing. Previously, our production deployments would be every few months without being on a set schedule, as things were added/removed to the task list of each developer. Recently, our CIO (semi-technical but not really a programmer) decided we will do deployments every three weeks; because of this I instantly thought that adopting an iterative development process (not necessarily full-blown Agile/XP, which would be a huge thing to convince everyone else to do) would go a long way towards helping manage expectations properly so there isn't this far-fetched idea that any new feature will be done in three weeks. IMO the biggest hurdle is that we don't have ANY kind of development approach in place right now (among other things like no CI or automated tests whatsoever). We don't even use Waterfall, we use "Tell Developer X to do a task, expect him to do everything and get it done". Are there any pointers that would help me start to ease us towards an iterative approach and A) Get the other developers on board with it and B) Get management to understand how iterative works? So far my idea involves trying to set up a CI server and get our build process automated (it takes about 10-20 minutes right now to simply build the application to put it on our development server), since pushing tests and/or TDD will be met with a LOT of resistance at this point, and constantly force us to break larger projects into smaller chunks that could be done iteratively in a three-week cycle; my only concern is that, unless I'm misunderstanding, an agile/iterative process may or may not **release** the software (depending on the project scope you might have "working" software after three weeks, but there isn't enough of it that works to let users make use of it), while I think the expectation here from management is that there will always be something "ready to go" in three weeks, and that disconnect could cause problems. On that note, is there any literature or references that explains the agile/iterative approach _from a business standpoint_? Everything I've seen only focuses on the developers, how to do it, but nothing seems to describe it from the perspective of actually getting the buy-in from the businesspeople.


title: What are the main advantages and disadvantages of LL and LR parsing?

text: When building a parser to a programming language what I earn and what I lost choosing one or the other?


title: A testing feedback/report tool?

text: I'm thinking of developing a pluggable test and assessment module. This tool will be used especially for desktop application projects to report and log errors, bugs, missing features and suggestions from testers. The tool will be plugged to the application by putting a small icon to the application itself. When pressed the tool will be visible where user can create entries about the application. Is there already a tool like that? I am not speaking about UI testing btw. For example, this tool might have a form consisting of   * Page name   * Environment information   * Entry type (can be bug, feature request, suggestion)   * Message   * User Info (name, contact etc)   * Date I think such a tool can greatly help testers prepare reports. Developers can understand the issue better and track all the reports.


title: Sorting months with pre-defined order?

text: I want to sort the months of the year starting at any month, but January needs to show up after December if January isn't the starting point. Can I do that in an array or do I need a special data structure or algorithm to do that?


title: OOP language design attribute symbol

text: I am designing a language, and wondering which character (or string) to use to represent that something is an attribute of something else. In all languages I have used, this is done with a dot - `my_class_instance.attribute`. However, in this language, I want to have what would usually be methods as syntactic sugar for normal functions, like so:               x.f(y, z).g(a, b).h(p, q)      is the same thing as               x = f(x, y, z)     x = g(x, a, b)     x = h(x, p, q)      However, if I also use `.` to show that an attribute belongs to a class I think that will get confusing, so I'm looking for another symbol for that purpose (or another solution). Currently I am thinking that I should use either the apostrophe - `instance'attribute` \- which shows ownership in a clear way, but means it can't be used for strings, the backtick - `instance`attribute` \- kind of looks like an apostrophe, which is good in the sense it shows ownership, but bad in the sense it could be mistaken for one, and is less commonly typed, and therefore likely to be slower to be typed (and missing from some keyboards). Alternatively, are there any symbols I could replace the dot used for the syntatic sugar inplace function calling thing with?


title: php - auto populate the model member variable from database table

text: I am stuck with a very old large website which I need to do some modifications. I can't use or integrate a new MVC framework due to current site is outdated with some custom coding done long time ago. I am writing custom reflection class for the user table in the database, but I find it easy to work on the model creating when the parameter passed or primary key and populated the member variables , then use them in the code. for example               $user= new User($user_id);      and then if I need the age I can use               if($user->age > 18)      To do this you might say it's easy just create a constructor method and do a select and assign them to the member variables .. however tricky part is I want to   1. Even the database table design is changed I want them to be reflected in the coding without altering the code, ie. if we add a new field to the database table I want it to be called using `$user->new_field;` without touching the code. (I know Yii can do this but I can't use Yii as I have to write all functionality of the website if I have to move to a framework)   2. if possible assign them to the member variables with the data type i.e Strings, Int etc reading them from the database  How to build a model base on above (actually constructor method)?


title: Motivation and use of move constructors in C++

text: I recently have been reading about move constructors in C++ (see e.g. here) and I am trying to understand how they work and when I should use them. As far as I understand, a move constructor is used to alleviate the performance problems caused by copying large objects. The wikipedia page says: "A chronic performance problem with C++03 is the costly and unnecessary deep copies that can happen implicitly when objects are passed by value." I normally address such situations   * by passing the objects by reference, or   * by using smart pointers (e.g. boost::shared_ptr) to pass around the object (the smart pointers get copied instead of the object). What are the situations in which the above two techniques are not sufficient and using a move constructor is more convenient?


title: What is a stream, and how does it work?

text: Like a data stream in general, this can be an I/O stream or memory stream or a file stream or what not. I understand that it's some sort of stream of bytes, that you can read to parse very large amounts of data if needed, what I don't understand however, is how it works. Is it possible to 'miss' data from a stream if you start reading it too late? or does it wait for you? A lot of tutorials I find online just tell how to use a stream, but it doesn't actually get out of the way to explain how it works, one tutorial explained it like a river, but that just confuses me more; the water running in the river doesn't wait, which again brings me back to; what if I read it too late? Can someone explain this concept to me?


title: What advantages do we have when creating a separate mapping table for two relational tables

text: In various open source CMS, I have noticed that there is a separate table for mapping two relational tables. Like for categories and products, there is a separate `product_category_mapping` table. This table just has a primary key and two foreign keys from the categories and product tables. My question is what are the benefits of this database design rather than just linking the tables directly by defining a foreign key in either table? Is it just matter of convenience?


title: Why does assigning a variable to false return false?

text: Why does:               something = false      always return false? Since it is an assignment and not a comparison, it seems it would make more sense to return the result (success/failure) of the assignment ( **like pretty much every other assignment you do** ). **EDIT - this is wrong, as the answers below point out. My bad. Slight brain fart. See the original impetus for this question in the comments below.** What happens if `some_boolean_var = false` failed for whatever reason (unlikely, but theoretically possible, especially if you defined a custom method for this action)? That would also return false, so you have no indication as to whether the assignment actually worked. It basically just means you can't combine assignment and comparison in one line like you can do with nearly everything else in Rails. For example, you can't do:               if something = false (note the single =)       do stuff     end      I mean you can do it but not if you wanted to check and make sure the assignment succeeded first. Just really weird to me. I'm sure there is a reason for this so please enlighten me :) Thanks in advance!


title: Business Knowledge in Tech Courses

text: Few months ago, I was invited to a forum in a local university to discuss about programmers´s job market. The forum joined teachers and companies representants for understand this issue. The final conclusion of debate was that the students are focused on tech part of software but they don't get understand the business concepts because classes has a little bit or none focus at that. The university has commited to insert more business concepts on some tech courses. What do you think about this? More business concepts really would help companies and students or tech courses must focus on tech things? **EDIT:** The event was focused on Business Intelligence. So, companies were interested in programmers who had easy understanding to business rules too. I think that, in this area, is essencial have these knowledgment.


title: Should programmers itemize testing for projects?

text: I recently hired a programming team to do a port of my iPad app to the iPhone and Android platforms. Now, in a separate contract, I am asking them to implement a bunch of tips on how to play the app, similar like you would find in Candy Crush or Cut the Rope. They want to charge 12 hours @ $35/hr for the "Testing all of the Tips", telling me that normally it would take them more than 25 hours but that they will 'bear the difference'. I am not familiar with this level of itemization, but maybe it's a new practice? I am used to devs doing their own quality control, and then having a testing/acceptance period. They are using Cocos 2D-X, and they say that the tips going to multiple platforms makes all of the hours jack up. I feel like they might be overcharging, and it's difficult for me to know because it's kind of like with a mechanic. "It took us 5 hours to replace the radiator". How can you dispute that? It seems to me that most of you would charge for the work but NOT for hours that you are 'testing'. Am I missing something? Thanks for any help and advice you can give!


title: Are there more efficient ways to search for help/documentation than Google/SO/...?

text: Google sometimes come up with irrelevant links, not everything is available on SO, there are cases where the local documentation is also annoying to look through... Are there other efficient ways you use to search?


title: What to do when somebody forks my open-source project with the same name?

text: I have this GPL project, it got stuck for like a year, I really like the idea, then somebody fork it and changed the whole thing but used the same name, I don't mind for the code (it was GPL after all) but I like the name. What's the etiquette for this kind of situation? The project will benefit myself, and I like it, however the name wasn't for sale.. EDIT: I know if I contact the author he'll understand and change the name, but I have no time to work on that project right now, so I don't want to be a "name troll" for my folks (small community), so I'll let it be this time, my question is more about the etiquette of forking. If the project is apparently abandoned can they fork and use the same name or they MUST get a new name?


title: Advise on How To migrate a huge monolithic java application towards something service-oriented

text: I am confronted with the problem of migrating a huge monolithic java web application towards a more service oriented approach. The application has grown for years from what it was originally desinged for and is still growing. That means a lot of changed customer requriements where development under time pressure with few concernce about code quality. That led to very very complex code structure (no modular packaging, a lot of complex inheritants, mix of functionality in classes and as good as no documentation). Now step by step funcionality shall be extracted and run as service. Replacement/Redevelopment is currently out of questions. So the code should be extraced and wrapped so it can be replaced later with a new cleaner version. The problem I now have to deal with is that it is really hard to identify the code that represents a functionality and extracting it without breaking other functionalities or even the whole application. Any ideas how I can approach this problem? I am open to everything.


title: How To Explain To My Dad What I have Programmed

text: > **Possible Duplicate:**   >  My Dad is impatient with the pace of my learning to program. What do I do? I am 14 and have been studying programming for 4 months now (3 months Python, 1 Month of Ruby). I haven't been pushed by my parents to do it, I took it up on my own. Whenever I try to show something I made to my dad, he says he finds no value in it. At first, I wrote simple text games, like a text version of rock paper scissors, roulette, blackjack, etc. When that got too easy, I tried to make them as advanced as possible. I made a roulette game in Ruby based off `instance_eval` and `method_missing`. I showed them to him, and he said that was "childish" to make games. After games got too easy, I have started extending the features of the languages, I made a module for a "Changeable Range" in Python, where one could just write:               j = crange.CRange(5)      then               j.shift(10)      to shift the start and stop up ten and               j.reverse()      to create a reversed range. I showed it to him and he said "There is no value in that." Is there a way to explain to him that there is value in my programs, or am I just moving at a very slow pace in my learning?


title: What's more restrictive, the RPL or the AGPL?

text: What's the difference between the RPL licence and the AGPL licence? Which one is more restrictive?


title: Moving from developer to programming teacher

text: I'm interested in the experience of software developers who have become programming teachers, -- at a junior college, teaching college or high school. I'm wondering if anybody has made the switch and if they've stuck with it or if they've gone back to industry -- and why. I've been thinking for the past 7 years (on and off) that I'd like to try it out and see what it's like. I have friends that are teachers and seem to love their jobs. From what my friends know of me and from what I know of myself, I think I'd like it.


title: AGPL License - does it apply in this scenario?

text: There is an AGPLv3 based software (Client) that makes web service calls (using SOAP) to another software (Server - commercial, cloud based). There is no common code or any connection whatsoever between these two except for the web service calls being made. My questions -   1. Does the Server need to be AGPL too? I guess not - but would like to confirm.   2. Let us say the end point URL for the Server can be configured on the Client side (by editing an XML file) to connect it to different Servers (again, there is no connection other than the webservice calls being made) does it require any of these Servers being AGPL?   3. Are there any issues in running the Client as a DLL that is loaded by other commercial applications on users' desktops? Does it require these other applications also to be AGPL?


title: What are the benefits of using the command line for software development?

text: What benefits are gained from using the command line for software development over using an alternative GUI? Is the command line faster for certain tasks? Are certain tools only available via the command line?


title: How to manage many mobile device users at server side?

text: I built a social Android application in which users can see other users around them by GPS location. At the beginning thing went well as I had low number of users, but now that I have increasing number of users (about 1500 +100 every day) it has revealed a major problem in my design. In my Google App Engine servlet I have static HashMap that holds all the users profiles objects, currently 1500 and this number will increase as more users register. **Why I'm doing it?** Every user that requests for the users around him compares his GPS with other users and checks if they are in his 10km radius. This happens every five minutes on average. Consequently, I can't get the users from db every time because GAE read/write operation quota will tear me apart. **The problem with this design is?** As the number of users increases, the Hashmap turns to null every 4-6 hours, I think that this time is getting shorter, but I'm not sure. I'm fixing this by reloading the users from the db every time I detect that it becomes null, but this causes DOS to my users for 30 sec, so I'm looking for better solution.   I'm guessing that it happens because the size of the hashmap. Am I right? I have been advised to use a spatial database, but that means that I can't work with GAE any more and it means that I need to build my big server all over again and lose my existing DB. Is there something I can do with the existing tools? Thanks.


title: Colons in internationalized UI

text: When using gettext or a similar framework, should the translation strings include `':'` (like `"Label:"`) for generating labels for UI or should I add `':'` in UI code itself?


title: How do you keep all those languages straight in your head

text: I know Java, C#, C++. I have used Perl, and am picking up Python and Actionscript 3. This is certainly a path others have trodden, so I am asking how do you keep all these languages straight in your head?


title: Pair Programming Using Different Editors

text: I really like pair programming for particular projects or features. It can act as an immediate sanity check and increase code coverage across your development team. That said I always seem to run into an issue regarding editors. I primarily code Ruby and I personally like to use VIM whereas other developers on my team use EMACS, TextMate or RubyMine. On top of that, even if two developers are using the same editor, it seems that everyone has a different macro for running tests or executing a certain file. My question is this: how do you continue to pair program when everyone has a different editor preference? Is there some kind of software or development practice that would allow two developers to pair program from different editors? Do you just have to agree on a common editor that you can both use? How do you solve this problem in your company?


title: How do I improve my code reading skills

text: Well the question is in the title - how do I improve my code reading skills. The software/hardware environment I currently do development in is quite slow with respect to compilation times and time it takes the whole system to test. The system is quite old/complex and thus splitting it into a several smaller, more manageable sub-projects is not feasible in a neare future. I have realized is what really hinders the development progress is my code reading skills. How do I improve my code reading skills, so I can spot most of the errors and issues in the code even before I hit the "do compile" key, even before I start the debugger?


title: How can I get paid for reducing technical debt?

text: I'm currently working for small company that has few technically complicated products. I'm the one and only developer for one of them. About a year ago, I got the legacy version of the product and started "supporting" it. Customer only talks about new feature, business value and others of that kind. The problem is, though the code is in C#, it's quite procedural. There are no abstractions, classes are only used where Visual Studio requires them - Forms, for instance. The implementations of these classes are really awful and the code is really hard to maintain. For all these year I spend my own time for refactoring. In the latest version, there are pretty abstractions and such. I had to reimplement a number of components from scratch and I really feel that adding new feature or changing behavior to these components is MUCH easier than to others. The problem is, I spend my own time. I really like the results, but I don't like working 12 hours per day. Have you ever been to similar situation? What should I try? I've already tried discussing it, but still no success. I'm just scared of the moment when we decide implementing the new feature that requires a lot of changes to the legacy code. That just could be shocking to the customer: why do you need 8 hours for changing these icons? The customer just doesn't care that there are 500 places in the code that I need to change. And I should also find all these 500 places first. Any ideas?


title: When would I require a Macro instead of a function?

text: I am new to Clojure, I am new to Macros and I have no prior background in Lisp. I went on to create my own switch case like form and ended up with this:               (defmacro switch-case [v cases default] (if (cases v) (cases v) default ))       and then tried making a function and ended up with this:               (defn fn-switch-case [v cases default] (if (cases v) (cases v) default ))      Both               (switch-case 5 {6 "six" 7 "seven"} "not there")      and               (fn-switch-case 5 {6 "six" 7 "seven"} "not there")      Work fine. What could be the scenario where I would need a macro and a function wont work ? Is there a drawback in my function or macro implementations ?


title: Why don't computers store decimal numbers as a second whole number?

text: Computers have trouble storing fractional numbers where the denominator is something other than a solution to 2^x. This is because the first digit after the decimal is worth 1/2, the second 1/4 (or 1/(2^1) and 1/(2^2)) etc. Why deal with all sorts of rounding errors when the computer could have just stored the decimal part of the number as another whole number (which is therefore accurate?) The only thing I can think of is dealing with repeating decimals (in base 10), but there could have been an edge solution to that (like we currently have with infinity).


title: What is the best way for an experienced developer to work on a WordPress blog

text: I'm beginning to work on my first WordPress blog, however I've noticed most tutorials just have you do modifications (such as theme changes, installing plugins) on the production site. This worries me for a few reasons:   * No backups   * No version control   * If you make a mistake, your production site is affected   * Developing remotely is slower than local development, especially when tweaking css files. I understand why WordPress works like this - it allows people with no development experience to manage their WordPress installation (or the one provided by their service provider). It also allows you to work on the WordPress installation without having ssh access to the server. However as I am confortable working with tools like git and ssh, and am using a virtual server for the blog, this isn't very important to me. So I was wondering what techniques experienced developers use when working on a WordPress blog. For example:   * Do you develop locally, then push the changes to the live site? How do you do this?   * How do you manage database changes and backups?   * What do you store under version control (if anything)?   * If a plugin changes the database, do you somehow track the changes it does in version control, so you can rollback the changes done by the plugin if you need to? Or maybe I'm just overcomplicating everything if working on the production site isn't as risky as I am thinking it would be. I would appreciate any answers either way.


title: How can I bind an interface to a class decided by an xml or database configuration at the launch of the application?

text: I'm re-working on the design of an existing application which is build using WebForms. Currently the plan is to work it into a MVP pattern application while using Ninject as the IoC container. The reason for Ninject to be there is that the boss had wanted a certain flexibility within the system so that we can build in different flavor of business logic in the model and let the programmer to choose which to use based on the client request, either via XML configuration or database setting. I know that Ninject have no need for XML configuration, however I'm confused on how it can help to dynamically inject the dependency into the system? Imagine I have a interface `IMember` and I need to bind this interface to the class decided by a xml or database configuration at the launch of the application, how can I achieve that?


title: What are the pros and cons of running multiple instances of an app per marketplace?

text: One app to rule them all, and in the darkness, bind them. I'm speccing out a client app at the moment. The same service is to be delivered to two separate counties and the the content within: users, line items, etc. should NOT cross over between the marketplaces. This leads me to think that having two separate instances of the app, with separate databases is the best approach. However... That sounds like a LOT of extra work, and duplication, for two systems that would be, for the MOST part, identical Has anyone dealt with this architecture conundrum before and can you perhaps share some of the pros and cons of each approach, with an answer on your preference? FWIW it's a rails 4 app being deployed with Capistrano


title: In what specific ways did Pascal and or Delphi influence Java?

text: I was reading in the side bar of the Java language wiki page and it says it was influenced by Pascal and Delphi. this isn't the fact anymore, there are no references to Delphi on the entire referenced wiki page as of this edit, probably should remove all references to Delph from this question as well At first glance Java appears to just be C++ with a garbage collector, and no pointers. Delphi and Java both came out the same year. I am curious if someone who knows Java and Pascal / Delphi really well could look at Java and say **"Feature X in Java is influenced by feature Y in Pascal (or Delphi)."** Additionally was the influence in later versions of Java (so the feature from Pascal or Delphi didn't show up until Java version Z), or was it actually in the seeds of the Java language? Delphi and Java both came out the same year, so Delphi's influence in the genesis of Java seems less likely. Alternatively it may be that Delphi or Pascal influenced the Java Platform in some other way, and not the language specifically. _[This was rewritten to be clearer. That may have changed the scope of the question to the point the existing comments and answers don't fit. My intention was to clarify and not change.]_


title: What was the life span of Quick Pascal?

text: Microsoft had a Pascal compiler called Quick Pascal. I've seen some conflicting reports about when it was available. Does anyone know for sure? Did it introduce any new language features over the alternatives, or was it just Microsoft's version?


title: Was in it Turbo Pascal 4 that Unit were introduced?

text: I was surprised when I heard that Pascal didn't originally have units. If I recall correctly they were introduced in Turbo Pascal 4. Did other pascal version have units prior to that? How long before other Pascal's got units?


title: Is Free Pascal just an open source, multi-platform clone of Turbo Pascal & Delphi?

text: Does Free Pascal introduce any significant language features over Turbo Pascal & then Delphi, or does it just introduce the Turbo Pascal & Delphi flavors of Pascal to more platforms?


title: Does anyone else have a refactoring problem?

text: It seems like after I've written a significant amount of code I get this anxious feeling like I haven't done it in the best possible way, and I end up continuously refactoring and spending way too much time on the project, or never getting it done sometimes. Does this ever happen to anyone else, and how do you deal with this?


title: What useful bookmarks to programmers do you use?

text: I want bookmarks specific to aiding in programming tasks, not to every task. If the bookmark is awesome to every user, please don't post it as an answer here. I will down vote it and I suggest to users do the same. To general bookmarks, please post on Webapps.StackExchange Good answer is a bookmark which helps the programmer work. I don't expect get too many answers although it would be a great surprise if it happens. Please, explain what the bookmark does and where it can be used.


title: MVC and individual elements of the model under a common base class

text: Admittedly my experience of using the MVC pattern is limited. It might be argued that I don't really separate the V from the C, though I keep the M separate from the VC to the extent I can manage. I'm considering the scenario in which the application's model includes a number of elements that have a common base class. For example, enemy characters in a video game, or shape types in a vector graphics app. The view wants to render these elements. Of course, the different subclasses call for different rendering. The problem is that the elements are part of the model. Rendering them is conceptually part of the view. But how they are to be rendered depends on parameters of both:   * Attributes and state of the element are parameters of the model   * User settings are parameters of the view - and to support multiple platforms and/or view modes, different views may be used What's your preferred way of dealing with this?   * Put the rendering code in the model classes, passing in any view parameters?   * Put the rendering code in the view, using a switch or similar to select the right rendering for the model element type?   * Have some intermediate classes as a model-view interface, of which the model will create objects on demand and the view will then render them?   * Something else?


title: What would truly happen if java.lang.String weren't final?

text: I'm a long time Java developer and finally, after majoring, I have time to study it decently in order to take the certification exam... One thing that has always bothered me is String being "final". I do understand it when a read about the security issues and related stuff... But, seriously, does anyone have a true example of that? For instance, what would happen if String weren't final? Like it's not in Ruby. I haven't heard any complaints coming from the Ruby community... And I'm aware of the StringUtils and related classes that you have to either implement yourself or search over the web to just implement that behavior (4 lines of code) you're willing to.


title: Get Info From Database, or Build Inferred Info?

text: Does it make more sense to store and retrieve properties or information directly related to an item in a database, or, say in such a case that a product's ID could describe information about it, should the information be gathered from that? Example: Item SKU -- 4HBU12 4 - is the number of motors   H - the voltage   B - the color, blue   U - the model   12 - the length Should I store those individual attributes as well as the SKU, or should I store only the SKU and build the attributes from it?


title: How to access functions in extended classes efficiently?

text: In PHP I have classes as below               class Animal {         //some vars         public function printname(){              echo $this->name;         }     }          class AnimalMySql extends Animal {         static public function getTableFields(){              return array();         }     }          class AnimalPostgreSql extends Animal {         static public function getTableFields(){              return array();         }     }      Now I have an object `$lion = new Animal();` and I want to do               if($store == mysql)         //getTableFields from class AnimalMySql     else         //getTableFields form class AnimalPostgreSql      I am new to OOP and not sure what is the best way to call the method from the specific class P.S. Please leave a note with the answer to explain the efficiency of the approach


title: Designing a user-defined list to be stored in a relational database - Should I include user index?

text: By index, I mean, as the user creates the list, each item receives an integer index for its place in that particular list. Since there will be a table of ListItems, I'd prefer to avoid using the name "Index" for the field. Then I was thinking - should I even include the list index in the database? I figured I would because the list would be created in the same fashion every time, then. Or I could order the list for the user based on its actual primary key, since the list items are created in succession anyway... What should I do?


title: Pattern for data types that are related yet fundamentally different in utility

text: # Background I'm currently working on a codebase for what is to become a forthcoming website's content "engine", where it will take in different types of standardized data (implemented with XML), parse it, and then generate content dynamically and accordingly. The data itself also includes a list of context clues or helper objects for searching, comparing, analyzing, etc., which is being developed concurrently into a group as a data interaction layer and it is completely separate from the engine. Each generated content will emit some embedded "signatures" that can be sniffed by the interaction layer for post-processing (possibly with few generated hidden input values). # The Problem Nonetheless, the immediate problem that I'm facing is that although those list of hidden signatures are related to the content that is generated, it is essentially not needed by the engine to let the browser know how content should be presented initially. Logically speaking, is it usually the engine's job to parse all data no matter what type of data it is given so that the interaction layer can simply manipulate it later? Or, since that data type acts as a helper for data manipulation, should the interaction layer step in and act as the parent for that data type specifically, so that the engine can just focus on content? The root of the problem is that I started separating things to its specialized components for better maintainability in the future but I'm not exactly sure where to stop separating chunks to its essentials. Should I treat data as simply data? That can't possibly be right.


title: Unit testing - External vs Internal dependencies

text: Unit tests should be isolated, automated ( ie we don't need to do any prior- configuration for all tests to run at the click of a button ) and consistent in their results. For these reasons we should stub any _external dependencies_ ( ie databases, webservices etc ) used by unit under test **UUT** ( with integration tests **UUTs** do use external dependencies ). But based on what criteria do we decide which _internal dependencies_ called by **UUT** ( by _internal dependencies_ I'm referring to code which is under our control and that doesn't communicate with any external systems ) also need to be stubbed and which don't need to be? Is perhaps the criteria that methods defined in the same class as **UUT** don't need to be stubbed, while methods defined in other classes should be, or ...?


title: n:m as the only way to store notifications?

text: I have a user and a notifications table. I want to make sure that every users sees a new notification once and only once. Not more, not less. The intuitive idea is to have a n:m relation table with userId:notificationId. But isn´t it a little too much overhead to create a new table just for that? What about NoSQL databases? Would it be a good idea to just add an array of notification ids to the individual user in the user table?


title: Type of computer for a developer on the road

text: I am planning to be traveling through eurasia and asia (russia, china, korea, japan, south east asia...) for a while and, although there are plenty of marvelous things to see and to do, I must keep on working :(. I am a python developer, dedicated mainly to web projects. I use django, sqlite3, browsers, and ocassionaly (only if I have no choice) I install postgres, mysql, apache or any other servers commonly used in the internets. I do my coding on vim, use ssh to connect, lftp to transfer files, IRC, grep/ack... So I spend most of my time in the terminal shells. But I also use IM or Skype to communicate with my clients and peers, as well as some other software (that after all is not mandatory for my day-to-day work). I currently work with a Macbook Pro (3 years old now) and so far I am very happy with the performance. But I don't want to carry it if I am going to be "on transit" for long time, it is simply huge and heavy for what I am planning to load in my rather small backpack (while traveling, less is more, you know). So here I am reading all kind of opinions about netbooks, because at first sight this is the kind of computer I thought I had to choose. I am going to use Linux for it, Microsoft is not my cup of tea and Mac is not available for them, unless I were to buy a Macbook air, something that I won't do because if I am robbed or rain/dust/truck loaders break it I would burst in tears. I am concerned about wifi performance and connectivity, I am going to use one of those linux distros/tools to hack/test on "open" networks (if you know what I mean) in case I am not in a place with real free wifi access and I find myself in an emergency. CPU speed should be acceptable, but since I don't plan to run Photoshop or expensive IDEs, I guess most of the time I won't be overloading the machine. Apart from this, maybe (surely) I am missing other features to consider. With that said (sorry about the length) here it comes my question, raised from a deep ignorance regarding the wars betweeb betbooks vs notebooks (I assume tablet PCs are not for programming yet): If I buy a netbook will I have to throw it away after 1 month on the road and buy a notebook? Or will I be OK? Thanks! Hector **Update** I have received great feedback so far! I would like to insist on the fact that I will be traveling through many different countries and scenarios. I am sure that while in Japan I will be more than fine with anything related to technology, connectivity, etc. But consider that I will be, for example, on a train through Russia (transsiberian) and will cross Mongolia as well. I will stay in friends' places sometimes, but most of the time I will have to work from hostel rooms, trains, buses, beaches (hey this last one doesn't sound too bad hehe!). I think some of your answers guys seem to focus on the geek part but loose the point of this "on the road" fact. I am very aware and agree that netbooks suck compared to notebooks, but what I am trying to do here is to find a balance and discover your experiences with netbooks to see first hand if a netbook will be a fail in the mid-long term of the trip for my purposes. So I have resumed the main concepts expressed here on this small list, in no particular order:   * keyboard/touchpad feel: I use vim so no need of moving mouse pointers that much, unless I am browsing the web, but intensive use of keyboard screen real state: again, terminal work for most of the time   * battery life: I think something very important   * weight/size: also very important   * looks not worth stealing it, don't give a shit if it is lost/stolen/broken: this may depend on kind of person, your economy, etc. Also to prevent losing work, I will upload EVERYTHING to the cloud whenever I'll have a chance.   * wifi: don't want to discover my wifi is one of those that cannot deal with half the routers on this planet or has poor connectivity. Thanks again for your answers and comments!


title: I know JavaScript really well, but i bomb coding interviews

text: So I'm currently on a hunt for a new position as a Front-End Developer. I know JavaScript very well and can wax poetically about Closures, Currying, Prototypal Inheritance, Design Patterns, App performance and overall Front-End Architecture. But yet I still end up bombing job interviews. (FYI most of the jobs I'm interviewing for are for building SPA's with some sort of MVC framework) Usually the coding tests are small code snippets of things I never come across professionally. Like write a function to solve some sort of math problem. Aside from the inherit awkwardness of trying to code while holding the phone in one hand and having a stranger see your screen and watch every character you type, I just don't usually see this kinda stuff in the real world. Is this a serious skill set I'm lacking or are the interviewers asking me irrelevant questions. I guess I should work on my functional programming and algorithm chops but I haven't found many good resources on the web (or in print) any suggestions?


title: Automating form error handling

text:
I'm not sure if I'm being clever or making things more difficult. I'm working within a custom MVC framework, and within some of my "views" which contain forms I'm preserving input and styling errors as follows:               <form action="submit" method="POST">     Name:     <input <?php if (in_array('name', $error)) { echo 'class="form-error"'; } ?> type="text" name="name" value="<?php if (isset($name)) { echo $name; } elseif (isset($valid_user)) { echo $valid_user['name']; } ?>" maxlength="20" required="required" />
<input type="submit" class="submit" value="Update" />      In this example, `$valid_user['name']` would be the default value for existing data (when the form is first loaded), and `$name` would be the posted value being displayed here again in case there was a user error that needs to be fixed. Embedding all of these values is very time consuming when creating new forms, so I'm trying to make things easier on myself. I want to stick with a server- side solution since I believe websites should be complimented by Javascript, not dependent on it. I figure I could probably do all of this dynamically using PHP's DOMDocument:               $dom = new DOMDocument();     $dom->preserveWhiteSpace = false;     $dom->loadHTMLFile($view);     $forms = $dom->getElementsByTagName('form');     $total_forms = $forms->length;          for ($i = 0; $i < $total_forms; $i++) {         $inputs = $forms->item($i)->getElementsByTagName('input');         $total_inputs = $inputs->length;              if ($total_inputs > 0) {             foreach ($inputs as $input) {                 $type = $input->getAttribute('type');                 switch ($type) {                     case 'text':                         // check for errors                         $attr_name = $input->getAttribute('name');                         if (in_array($attr_name, $error)) {                             $input->setAttribute('class', 'form-error');                         }                              // check for default / posted values                         if (isset($$attr_name)) {                             $input->setAttribute('value', $$attr_name);                         } elseif (isset($_POST[$attr_name])) {                             $input->setAttribute('value', $_POST[$attr_name]);                         }                         break;                 }             }         }     }          echo $header;     // remove unwanted tags that are being automatically added     echo preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $dom->saveHTML());     echo $footer;      Going with this approach will obviously require writing a lot of extra code, so before going any further I'm just curious what your opinions are or if there are any potential downfalls I'm maybe not thinking of? Would it be better to stick with my original approach or are there other solutions to make this less tedious?


title: What are some good tips for a developer trying to design a scalable MySQL database?

text: As the question states, I am a developer, not a DBA. I have experience with designing good ER schemas and am fairly knowledgeable about normalization and good schema design. I have also worked with data warehouses that use dimensional modeling with fact tables and dim tables. However, all of the database-driven applications I've developed at previous jobs have been internal applications on the company's intranet, never receiving "real-world traffic". Furthermore, at previous jobs, I have always had a DBA or someone who knew much more than me about these things. At this new job I just started, I've been asked to develop a public-facing application with a MySQL backend and the data stored by this application is expected to grow very rapidly. Oh, and we don't have a DBA. Well, I guess I am the DBA. ;) As far as designing a database to be scalable, I don't even know where to start. Does anyone have any good tips or know of any good educational materials for a developer who has been sort of shoved into a DBA/database designer role and has been tasked with designing a scalable database to support an application like this? Have any other developers been through this sort of thing? What did you do to quickly become good at this role? I've found some good slides on the subject here but it's hard to glean details from slides. Wish I could've attended that guy's talk. I also found a good blog entry called 5 Ways to Boost MySQL Scalability which had some good information, though some of it was over my head. ## tl;dr I just want to make sure the database doesn't have to be completely redesigned when it scales up, and I'm looking for tips to get it right the first time. The answer I'm looking for is a "list of things every developer should know about making a scalable MySQL database so your application doesn't perform like crap when the data gets huge".


title: How should I choose the right Android phone for testing my app?

text: I am looking to buy an Android phone to test my first Android app on. What things should I pay attention to to make sure I pick the most suitable device?


title: 2 hour interview question for a senior software engineer

text: what kind of a question should be asked to test the programming and DB knowledge of a developer ? i am guessing 2 hours practical would be fine. This is for a senior PHP resource and can anybody please suggest me some examples of questions for a technical test? Not sure weather this is the right place to ask this question. if not, can i know where to ask this


title: What are/would be the characterists and applications of a programming paradigm where functions can't have statements?

text: Suppose there is a language where, instead of statements, functions could only be defined in relation to other functions and operators such as partial application and composition. What would be the characteristics of such language? Could everything that is done with statements be done on this design? What would be the limitations? Are there languages like this?


title: Storing large data in HTTP Session (Java Application)

text: I am asking this question in continuation with http-session-or-database- approach. I am planning to follow this approach.   1. When user add product to cart, create a Cart Model, add items to cart and save to DB.   2. Convert Cart model to cart data and save it to HTTP session.   3. Any update/ edit update underlying cart in DB and update data snap shot in Session.   4. When user click on view cart page, just pick cart data from Session and display to customer. I have following queries regarding HTTP Session   * How good is it to store large data (Shopping Cart) in Session?   * How scalable this approach can be ? (With respect to Session)   * Won't my application going to eat and demand a lot of memory?   * Is my approach is fine or do i need to consider other points while designing this? Though, we can control what all cart data should be stored in the Session, but still we need to have certain information in cart data being stored in session?


title: Static methods or static functions?

text: I was just reading http://stackoverflow.com/questions/155609/what-is-the- difference-between-a-method-and-a-function and all of a sudden, the thing came to my mind was the static methods. As static methods are no way associated with an object how can it be called as static methods (almost all developers do)? Is my understanding about the methods/functions is correct?


title: Advice on starting a new job

text: In a week I will start a new job at a manufacturing company managing the development of a new eCommerce site. The company scores about a 3 on the "Joel" test. I will inherit 3 programmers who developed the company web site and do general IT programming. I have the grey hair and credentials to have their initial respect but I'm an engineer, not a manager. I'm looking for practical advise - particularly for the first 90 days - on how to establish myself, keep the team together, and move forward.


title: Empirical evidence for choice of programming paradigm to address a problem

text: The C2 wiki has a discussion of Empirical Evidence for Object-Oriented Programming that basically concludes there is none beyond appeal to authority. This was last edited in 2008. Discussion here seems to bear this out: questions on whether OO is outdated, when functional programming is a bad choice and the advantages and disadvantages of AOP are all answered with contributors' opinions without reliance on evidence. Of course, opinions of established and reputed practitioners are welcome and valuable things to have, but they're more plausible when they're consistent with experimental data. Does this evidence exist? I know that evidence-based software engineering is a thing, but can I practice it in this context? Specifically, if I have a particular problem `P` that I want to solve by writing software, does there exist a body of knowledge, studies and research that would let me see how the outcome of solving problems like `P` has depended on the choice of programming paradigm? I know that which paradigm comes out as "the right answer" can depend on what metrics a particular study pays attention to, on what conditions the study holds constant or varies, and doubtless on other factors too. That doesn't affect my desire to find this information and critically appraise it. It becomes clear that some people think I'm looking for a "turn the crank" solution - some sausage machine into which I put information about my problem and out of which comes a word like "functional" or "structured". This is not my intention. What I'm looking for is research into how - with a lot of caveats and assumptions that I'm not going into here but good literature on the matter would - certain properties of software vary depending on the problem and the choice of paradigm. In other words: some people say "OO gives better flexibility" or "functional programs have fewer bugs" - (part of) what I'm asking for is the evidence of this. The rest is asking for evidence against this, or the assumptions under which these statements are true, or evidence showing that these considerations aren't important. There are plenty of opinions on why one paradigm is better than another; is there anything objective behind any of these?


title: What does good command over an API really mean?

text: I have seen many organizations looking for developers who have good command over Facebook, Google and other API's. Now I am a bit confused about it. I have developed Facebook fanpages, embedded facebook buttons to websites and used google maps API too but the thing is that these API's are very large to completely master. How much exactly do a good command over an API mean?


title: Why is NoSQL better for this scenario?

text: Hypothetical scenario: Let's say we are downloading JSON from Facebook with details of a user's friend's checkins, posts, etc... These come in as one document per friend per activity, so with 8 activities a user with 300 friends will cause our system to make 2400 requests to Facebook, downloading 2400 JSON documents. Let's say we want to merge these 2400 documents together, sort the activities by date_created descending and then page through them in a sort of pseudo newsfeed. Please do not comment on the wisdom of recreating a facebook newsfeed in this way. Let's also suppose that we want to re-download all of this data whenever we are notified that it has changed by Facebook. (FB has an update service you can subscribe to for users of your app). For argument sake let's assume all of the data has to be refreshed every 5 minutes, and further assume we want to be able to support 1000 simultaneous users, and that the average JSON document size is 25kb. I am curious as to how NoSQL techniques would be better than parsing the JSON on ingestion into a relational database? To me it seems like map/reduce are just synonyms for parse/aggregate and that both approaches will require the same thing to occur. What advantages would I get from using NoSQL?


title: Internationalization through SQL Database and performance issues

text: I'm using .Net technologies and because ASP.Net "instant translation" is not really easy to do with ResX, since it has to be compiled after every change, there are a few hacks available (http://www.onpreinit.com/2009/06/updatable- aspnet-resx-resource-provider.html), but as it is, they're hacks... and they seem to have problems. So I decided a while ago (in 2006, before I even saw solutions like the previous link) that I was going to set all the translation into an SQL Database, and cache all the translation needed in memory for performance. The real problem begins when I want to do joins betweens table with multiple fields that are translated. Basically what I do is to store the ID of the translation inside each field, so I can add or edit translations into languages independently. For example (it's not real but should show the concept):               ITEM(ItemID, TranslationReference_Name, TranslationReference_Use, ...)     TRANSLATION(TranslationReference, IDLanguage, Content)      After that as you can guess, when I want a SQL Query to contain I need to do joins And this is where it gets dirty, because I did not find any other way to do it, and for each field of ITEM that needs a translation into a specific IDLanguage, I need to do a join. This is bad for performance, because the TRANSLATION table contains thousands of lines. So each time I do need to do a full join for every column that needs a translation. Plus, the other problem is that I'd like to have the basic english translation if a specific language has not been translated yet, so as you can guess it becomes much more dirty to code... I have no idea how to improve it. Should I simply give up the database joins idea and translate each result of the database on my .Net code, refering to a dictionnary (that I already have) containing the translation, so it will require no actual joins? And this is only a few of the drawbacks of that solution... because in real use, I need users to upload their own dynamically translated content, and manage versions of these translations. `Keep in mind that I do not want to have N rows (N being the number of languages that this record is available) for the "ITEM" table, I know I could set 1 row by language, and have its translated content in nvarchar inside it, but that's not what I want because I need the same ID for every record, independant to the language it can be translated into.` I've searched accross the web and I did not find any good article about this. I talked to another developper that had several languages translation for his data-heavy website, if I remember well he was using multiple table for the translation, he would not store IDLanguage inside a global TRANSLATION table, but would split every translation in its own table and do something like injecting the language in the SQL code to change, something like:               SELECT Content FROM Translation_EN ...     SELECT Content FROM Translation_FR ...      It would be sure more effective than doing a join on a full table, but that won't simplify my SQL full of joins... So I probably have to think about alternatives and I need your ideas and comments about this. Thank you very much.


title: What exactly comprises 'Documentation'?

text: **When we say 'documentation' for a software product, what does that include and what shouldn't that include?** For example, a recent question asked if comments are considered documentation? But there are many other areas that this is a valid question for as well, some more obvious than others:   * Manuals (obviously)   * Release notes?   * Tutorials   * Comments   * Any others? Where is the line drawn. For example, if 'tutorial' is documentation, is 'video tutorial' documentation, or is it something else? Generally, something in software isn't 'done' until it is implemented, tested and documented. Hence this question, what things should we consider as part of documention to consider something 'done'. * * * Question inspire from recent customer feedback at our conference indicating that our doc needed more 'samples', which we previously hadn't been as good at considering as we should have been. Audience: Software developers using our database(s), programming languages and associated tooling (such as admin clients to said DB)


title: Object-Oriented Class Design

text: I was wondering about good object oriented class design. In particular, I have a hard time deciding between these options:   1. **static** vs **instance method**   2. **method with no parameters or return value** vs **method with parameters and return value**   3. **overlapping** vs **distinct method functionality**   4. **private** vs **public method** * * * _Example 1:_ This implementation uses instance methods, with no return value or parameters, with no overlapping functionality, and all methods public               XmlReader reader = new XmlReader(url);     reader.openUrl();     reader.readXml();     Document result = reader.getDocument();      _Example 2:_ This implementation uses static methods, with return values and parameters, with overlapping functionality and private methods               Document result = XmlReader.readXml(url);       * * * In example one, all methods are public instance, which makes them easy to unit test. Although all methods are distinct, readXml() is dependent on openUrl() in that openUrl() must be called first. All data is declared in instance fields, so there's no return values or parameters in any method, except in the constructor and accessors. In example two, only one method is public, the rest are private static, which makes them hard to unit test. Methods are overlapping in that readXml() calls openUrl(). There's no fields, all data is passed as parameters in methods and the result is returned immediately. What principles should I follow to do proper object oriented programming?


title: Peter Norvig's paper cited by Brendan Eich

text: I'm reading Coders at Work and Brendan Eich cites a paper by Norvig, from when he was at Harlequin, "about how design patterns are really just flaws in your programming language." Can anyone provide the link to this paper?


title: Is the 14th line of The Zen of Python a reference to Dijkstra?

text: Python's Zen states on line 14 that: > Although that way may not be obvious at first unless you're Dutch. Is this a reference to the famous Dutch computer scientist Edsger W. Dijkstra?


title: How to implement 'use case control' object in (iOS) MVC?

text: In an MVC architecture pattern (for e.g., in iOS) there is a controller per view. In UML there is a concept of having Control object per use case to encapsulate an use case, which may span more than one view. Sometimes a same view can support multiple use case, in which case it would be nice to have multiple 'use case control' objects. Should i create a separate 'control' object apart from iOS 'Controller' to encapsulate the use case? Any idea on how to implement 'use case control' object in iOS MVC? I am really interested in the concept of having control object for an use case, rather than per (use case fragment) view.


title: How to implement RGBA in 8-bit microcontroller?

text: I have successfully connected my microcontroller to my TV via through VGA adapter i made that convert digital to analog signals with the help of resistors. Currently i am utilizing 8 pins that I am using as 2 Red 2 Green 2 Blue 1 Hsyn and 1 Vsyn. I was thinking if there is a way to add 'A' Alpha in it, it's used for transparency. My another question is that is Alpha software driven or is it in the hardware? Apparently, i did not find any relevant resources on hardware side of RGBA. I did notice Gameduino has used it in their 16-bit microcontroller. Is it possible to use multiplexing/charlieplexing in this problem?


title: Trying to code the points on a circle

text: I am trying to understand this: I wrote a code for points on a circle of radius 1. Note that the first and last point intentionally coincide.               do i=1,imax     X(i,1) = COS(-2*4.0*ATAN(1.0)*(i-1)/(imax-1))     Y(i,1) = SIN(-2*4.0*ATAN(1.0)*(i-1)/(imax-1))     print *, X(i,1)**2 + Y(i,1)**2      end do      The code is supposed to be a circle, but the following figure demonstrates the plot in Mathematica. It looks to me like an ellipse. Am I doing something wrong? Or is this just the way Mathematica plots it? ![http://imgur.com/0XMfZsw](http://i.imgur.com/0XMfZsw.jpg) The command for the plot is               ListPlot[a, PlotLabel -> "MeshPoints", AxesLabel -> {"x", "y"}, PlotRange -> {{-2, 2}, {-2, 2}}]


title: Converting Java applet to web application

text: I would like to convert this Java applet into an equivalent web app. This is my first time creating a web app, but I have some programming experience and time, and am willing to teach myself all of the necessary tools. By "web app", I mean an application which would work in browsers without requiring Java or Flash, for example. Therefore, it could work on compatible mobile devices. What tools should I look into for this development project?


title: Use of raw types in Java XML-RPC

text: I have been investigating the implementation of XML-RPC in Java. The major open-source libraries (e.g. Apache XML-RPC) use raw types to represent certain XML-RPC types in Java, e.g. structs are represented as raw Maps. Raw types in new code are discouraged in Java. From the JLS, > The use of raw types is allowed only as a concession to compatibility of > legacy code. The use of raw types in code written after the introduction of > genericity into the Java programming language is strongly discouraged. It is > possible that future versions of the Java programming language will disallow > the use of raw types. But, because of the nature of the XML-RPC protocol, are raw types unavoidable in this case?


title: How to prepare for an online job interview (maybe through Skype)?

text: I'm applying for a company far away and if I get an interview it will probably be done remotely. I have been searching for advices regarding this but all tips seem to be directed at face-to-face meetings (things like "shake hands firmly"). What are the differences? How can I make the best out of those differences? Update: This is a software developer position, so there's also something about technical questions (such as, I can Google anything that they ask ;) This question also applies to any freelancers who are dealing with customers, or recruiters who are interviewing remotely. I hope that makes it relevant to this site. It may also help if you keep answers programers-related.


title: What is actually a module in software engineering?

text: As the definition "a module consists a single block of code that can be invoked in the way that a procedure, function, or method is invoked", the definition seems very vague and broad. So could anyone explain it in other clear words and show some actual example how to break a requirement into module. Thanks


title: Intro to C for an experienced programmer

text: This reply to the question "I don't know C. And why should I learn it?" has me interested in learning C. What is a good self-instruction program (textbook/website/OpenCourseWare, etc.) for someone who already has lots of experience in high-level languages?


title: What's the best way to run a technical book club?

text: At work, we've been doing lunchtime book clubs for a while. So far we've done:   * Clean Code   * Working Effectively with Legacy Code   * The Pragmatic Programmer We read a chapter per week, and one person is assigned to present over the content and help facilitate discussion. Of the three, we've probably had the most success with The Pragmatic Programmer. It seems like the more technically complicated the content was, the more people tended to drop out as the book went along. I'd like to do a technically-heavy book like SICP or Java Concurrency in Practice, but I don't know of good ways to make this work with the format we're currently doing. What advice do you have?


title: In MATLAB, how can 'preallocating' cell arrays improve performance?

text: I was reading this article on MathWorks about improving MATLAB performance and you will notice that one of the first suggestions is to preallocate arrays, which makes sense. But it also says that preallocating Cell arrays (that is arrays which may contain different, unknown datatypes) will improve performance. But how will doing so improve performance because the datatypes are unknown so it doesn't know how much contiguous memory it will require even if it knows the shape of the cell array, and therefore it can't preallocate the memory surely? So how does this result in any improvement in performance? I apologise if this question is better suited for StackOverflow than Programmers but it isn't asking about a specific problem so I thought it fit better here, please let me know if I am mistaken though. Any explanation would be greatly appreciated :)


title: Rule engine in .NET

text: I have to import data from Excel to an SQL database. The Excel data contains various parameters and their values, like P1, P1, P4, P5, etc. I have to apply business rules. Like _if (P1 > 100 and P1 < 200) then insert the record in database_. Similarly, in some cases, string values are also validated. Can I have any open source rule engine that contains UI to change, add, and delete the rules? I am using C# to read the Excel data and and inserting the records. One more thing, which of the following is the best approach?   * Read Excel data first and store every record as an object in a collection, iterate through the collection, apply business rules on every object and insert record in the database. Or   * Read one record from Excel, apply business rules and insert the record in the database. Repeat the process for the whole Excel spreadsheet.


title: Do compilers have to be written for each model of CPU?

text: Do you need to take account of the different processors and their instructions when writing a compiler? Have instructions been standardised? Or what tools and techniques are available to assist with this? E.g. Ignoring machine instructions that are specific to a certain processor model.


title: Detect frameworks and/or CMS utilized on websites in Firefox

text: I'm redesigning the website for my academic library and am examining other sites to determine to identify the technologies used. Things like:   * Web frameworks   * Javascript frameworks   * Server-side technology   * Content management system Now I've had some real success in Firefox using plugins like Wappalyzer, Firebug, and the DOM Inspector. But some sites just don't display any of the info. I'm looking for using these tools, especially it seems it an enterprise- level CMS is being used. Does anyone know of any other tools to detect this kind of data? Also with Firebug & the DOM Inspector, there is a lot of info. displayed and I wondered if there was a way to derive the presence of server-side technologies, CMS's, etc. within certain elements of a web page? Also, if this question is more relevant to another Stack Exchange site, please let me know and I'll post it there instead. Much thanks, Jason


title: Is this a worthwhile course to take?

text: I currently don't have any qualifications in any form of web development (except an A-Level in ICT). I started working for a web development company 4 years ago and have finally been given the chance to go on courses. My manager doesn't have much of a technical knowledge, so has left it to me to decide whether the course he wants to put me on is worthwhile. From your experience, is the following course a worthwhile and credible course to take in helping improve my skills in ASP.NET/SQL? http://www.cvision.co.uk/realcbt/mcpd-asp-dot-net-35-csharp.htm Or, can you recommend similar alternatives?


title: Unit testing coverage

text: How much of your code do you unit test? Do you try to get 100% coverage of everything or do you skip some classes? **Background** We've made a lightweight ORM layer which we have written plenty of tests for. On top of that we use Code Contracts to specify what each method in every interface should accept and return. **Classes to test or not to test** We create repository classes to fetch items or collections. These classes are basically SQL queries and calls to the ORM layer. We also have entity mapping classes similar to those in fluent nhibernate. **Why I ask** The reason I'm asking is that I don't really see the point in writing unit tests for these classes. Well, there is a point if we could use a test database to see that no exceptions are thrown. Our test databases are a bit messy and are never reseted, hence it's impossible to validate any data (and that is out of my control). We could use a fake/mock ORM layer to try the repositories, but I do not see the point in it.


title: Interface Segregation Principle - type hinting multiple interfaces

text: The question is about **typehinting of the role interfaces**. The _code example_ has two DataMappers which typehint the interface they need in the constructor, FooDataMapper type hints the Preparable interface. Because it dependens on it and no other method from the dependency. In the other mapper, BarDataMapper i replaced the type hint with ??? as it requires both the Preparable and the Queryable interface. How do i handle this (what should replace ???), typehinting a single of them would not suffice, should i make a new interface (maybe one that extends the previous mentioned) and hint this new interface? The code example is a boiled down example in PHP and the type hint (???) is in the last Class declared.               <?php     // TWO ROLE INTERFACES, SMALL SEGREGATED PART OF A DBAL          Interface Preparable {       public function prepare( .. );     }          Interface Queryable {       public function query( ... );     }               // ADAPTER IMPLEMENTS SEGREGATION          class DbalAdapter implements Preparable, Queryable {       private $dbal;            public function __construct($dbal)        {         private $this->dbal = $dbal;       }            public function prepare( .. )        {         ..         return $this->dbal->prepare( .. );       }            public function query( .. )        {         ..         return $this->dbal->query( .. );       }     }               // DATAMAPPER CTOR HINTS FOR METHODS IT NEEDS TO USE          class FooDataMapper implements DataMapper {       private $dbal;            public function __construct(Preparable $dbal)       {         $this->dbal = $dbal;       }            public function create(Foo $Foo)        {         ..         $this->dbal->prepare( .. )       }     }               // DATAMAPPER CTOR HINTS FOR METHODS IT NEEDS TO USE     // BUT THIS TIME NONE OF THE ROLE INTERFACES MATCH, BUILD A NEW INTERFACE?          class BarDataMapper implements DataMapper {       private $dbal;       public function __construct(??? $dbal)        {         $this->dbal = $dbal;       }            public function SomeMethodThatNeedsBothPrepareNQuery(Bar $Bar)        {         ..         $this->dbal->query( .. )         $this->dbal->prepare( .. )       }     }      The initial solution i come to is making a new interface extending the ones needed. _Beware the naming of classes in the code are only for shown, might as well have been Fooable, BarAble..._


title: Architecture Review Guidelines for Java/JEE project

text: We're going to do a complete review of a Java/JEE based application. This includes an architecture review, code review and platform hardware review. While we're a bit aware of code review techniques, I'm wondering if there is a template or reference model for doing **an architecture review for Java/JEE systems**. Currently we're looking at following the ATAM Model to build a Quality Attribute Tree to cover the elements of Performance, Reliability, Availability, Security, Modifiability, Portability, Variability, Subsetability, Conceptual integrity and Functionality This is a first for us - so the question is whether there are any other standard models you follow or whether anyone has tried ATAM before and has any **tips/recommendations/tools for the Architecture review.**


title: What work intervals are more productive: short or long?

text: Which sessions of work are more productive for programming: short (<= 30 minutes), mid-length or long (>= 2 hours)? In which cases? (Consider coding new functionality, doing small modifications, tweaking UI, refactoring, debugging, learning API, trying to understand other's code). What can you tell from your experiences? Information from studies and best practices are also very welcome. Though it would be nice to see links or references. Reliable information is prefered over complete answer. * * * Valuable takeaways:   * Focused thinking is the ultimate target here   * Generally uninterrupted work > 2-3 hours yields loosing focus and foggy thoughts   * When you are in flow, it's better to let yourself to work for 1-2 hours   * It worth to try practicing Pomodoro Technique, for helping to overcome thinking inertia and procrastination, to get better feeling of time. Especially it can help to start doing things that you don't like doing that much   * When using 'break management' software, you can allow yourself to be more flexible, e.g. to skip 1 break but not more. This allows you to adopt to the situation: be in flow, when there is a flow, stay manageable when are not in flow   * Fresh air, relaxing and excercises during break can help to get involved right hemisphere to get new ideas and solutions Try software tools for 'break management':   * Pomodairo - it additionally tracks list of tasks and has pice UI   * WorkRave - provides more flexibility in configuring. also usable without speakers


title: Database for storing books by grouping, their pages, and the table of contents

text: I'm looking for a better way to deal with the design I have here, I'm not confident it's really suitable. To give this some context, lets say we have a bunch of groups, one group could be "SQL", and another could be "Cooking". The SQL group would have books such as "Normalization" and "T-SQL", while cooking could have "Making pasta" and "Pizza is awesome". The books themselves will have many pages, which may not end up being set in stone, I need to be able to change them around (and this is really a problem with my already devised scheme). A table of contents for _Pizza is Awesome_ might look like this:               1. History         1. The great pizza revolution of 13901AD         1. The first pizza     2. Making pizzas         1. Mental preparation             1. Think like a gazel             1. Hunger like a lion         1. Building the oven             1. Real pizza is made with flamethrower.                 1. How to make a flamethrower                     1. How to get a permit for your flamethrower     3. Enjoying pizza     4. Credit      Then I run off and fill up my SQL tables like so: Groups: pizza, SQL Books: Pizza is awesome Pages: All the 13 pages I listed in the example Table of contents. Here's the snag: Table of contents. Under my existing design, I'd have a table that gives each item it's own position, so "credits", "history", and other first-level items are assigned their position with an nested value of 0. Items like "Hunger of a lion" are in position 7 in the table of contents, with a nested value of 2 (because it's 2 levels deep). This doesn't really provide for a bunch of needs without complex programming:   1. What if I wanted to move making pizzas above history? I have to re-index the entire thing!   2. What if I wanted to nest making pizzas under enjoying pizzas?   3. What if I write a whole new section?   4. How do I ensure nested levels make sense? I basically have to update the entire index, and the "nested" level has no way to check if something makes sense (ie, the first item could be nested 6 times). I'm looking for a better answer. As a side note, the actual database includes revision changes of each page, and a place for extra content such as comments. ![enter image description here](http://i.stack.imgur.com/PfnxU.png)


title: Testing C# Eventhandler Subscription

text: I want my unit tests to be able to verify that some events were subscribed or unsubscribed at specific points. Currently, I see two options. **VerifiableEventHandler** Each client subscribes using the common `+=` and `-=` notation. Each class that has a verifiable eventhandler needs to implement IsSubscribed(), which can query the eventhandler using GetInvocationList().               public interface IVerifiableEventHandler<T>      {         event EventHandler<T> EventHandler;         bool IsSubscribed(Delegate d);     }          // impl     public bool IsSubscribed(Delegate d)     {         return EventHandler.GetInvocationList().Contains(d);     }      **Custom subscription interface** The actual C# event handler would be hidden, and clients can only subscribe using the Subscribe / Unsubscribe function.               public interface IEventSource<T>     {         void Subscribe(EventHandler<T> func);         void Unsubscribe(EventHandler<T> func);         void Raise(object sender, T event_args);     }      **Pros and Contras** To me, the advantage of the first approach is that the principle of least surprise is not violated. A .Net programmer will expect events to be subscribed to using the `+=` notation. The advantage of the second approach is that it's very easy to test, as the functions are nothing special and can be verified easily if the class containing the eventhandler is mocked. Is there a better way to solve this problem? If not, which of the two variants should be preferred, and why?