title: Performance of One API vs Multiple API's

text: I was having a conversation with a colleague and although my opinion makes sense to me, I wasn't able to back it up. I'm in the process of creating an API that will be hit hundreds of thousands of times per day. It's fairly simple, and will just be doing some inserts into a relational database. There are essentially 3 functions I would need to create. The question is, what would have better performance, creating one API with different controllers (using .NET Web API or NodeJS something like that) or 3 different API's. My thought is that, for example with the .NET Web API, no matter whether there are 1 or 3 they are all being hosted, and using the same resources. His thought was that having 3 API's would be 3 times faster because it would have 3 times the resources. I simply didn't have the proof to disprove that.


title: Managing JS and CSS for a static HTML web application

text: I'm working on a smallish web application that uses a little bit of static HTML and relies on JavaScript to load the application data as JSON and dynamically create the web page elements from that. **First question** : Is this a fundamentally bad idea? I'm unclear on how many web sites and web applications completely dispense with server-side generation of HTML. (There are obvious disadvantages of JS-only web apps in the areas of graceful degradation / progressive enhancement and being search engine friendly, but I don't believe that these are an issue for this particular app.) **Second question** : What's the best way to manage the static HTML, JS, and CSS? For my "development build," I'd like non-minified third-party code, multiple JS and CSS files for easier organization, etc. For the "release build," everything should be minified, concatenated together, etc. If I was doing server-side generation of HTML, it'd be easy to have my web framework generate different development versus release HTML that includes multiple verbose versus concatenated minified code. But given that I'm only doing any static HTML, what's the best way to manage this? (I realize I could hack something together with ERB or Perl, but I'm wondering if there are any standard solutions.) **In particular** , since I'm not doing any server-side HTML generation, is there an easy, semi-standard way of setting up my static HTML so that it contains code like               <script src="js/vendors/jquery.js"></script>     <script src="js/class_a.js"></script>     <script src="js/class_b.js"></script>     <script src="js/main.js"></script>      at development time and               <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>     <script src="js/entire_app.min.js"></script>      for release?


title: Potentially Shippable Product Increment - what if users don't like the latest increment?

text: In our company we do usability test at the end of each Sprint. Many times we discover that the users don't like the implemented feature, so we either completely change it or scrap it in the next Sprint. However if we start doing potentially shippable product, thus fixing all bugs, running a lot of tests, preparing documentation for FDA and for users, fixing little UI issues - all this work will go to waste if users will not like the feature. Isn't it better NOT to do all this extra potentially shippable stuff until we are sure users actually like the feature?


title: What workflow do you find efficient when simultaneously developing multiple inter-dependent GIT branches?

text: Let me start by saying that my GIT knowledge is fairly shallow, so I'm guessing that there might be something I'm missing. **THE SETUP:**   As an example, we have a project which is being developed as a collection of plug-ins/modules. Some modules, such as contact management, depend on others, such as validation. Each module has it's own branch. **CURRENT WORK FLOW:**   Our validation module is being concurrently developed with our other modules, just in a separate stream. In doing so, I am finding that I am having to do a **lot** of checking out back and forth (as well as a lot of stashing (and merging, but that I'm fine with)). For example, say I'm developing module_x which needs a new validation rule (which will have uses in other modules as well) ... I then:   1. stash my work   2. checkout the validation branch   3. write the rule   4. commit   5. checkout the module_x branch   6. pop the stash   7. merge the validation branch into module_x. Now, if I come up with an improvement for something in the validation branch (or just need to fix a bug), I have to go through all that all over again. Between new development, refactoring/improvements, and bug fixing, I feel like I'm spending entirely too much time just switching back and forth between developments streams, and can't help but think that there's a better way. **DO's and DONT's:**   Is this _really_ how it's done, or am I completely missing the bigger picture? :)   What works for you?


title: Why doesn't java use a radix sort on primitives?

text: `java.util.Arrays.sort(/* int[], char[], short[], byte[], boolean[] */)` is implemented as a 'tuned quicksort' rather than a radix sort. I did a speed comparison a while ago, and with something like n>10000, radix sort was always faster. why?


title: As developers is it our job to report issues if no one else in the org seems to care?

text: **edit:** I should point out; My personal view was that I should be proactive. I know sometimes I have to bite my tongue, and I wanted to get the communities input(was this one of those times). I couldn't find a more appropriate place to ask it in the SO family of sites. Here is the scenario --   * small org < 70 employees   * no qa department   * website viewed by thousands everyday.    * I am the sole website developer   * I have never had a single complaint that the site is broken in IE6   * I've discovered our site has not worked in IE6 for years. The person I replaced who created it must have been "testing" it only on IE7. I fired up Virtual PC and with IE6, and our site is a complete mess. You can not select some menu items they are so garbled. It looks terrible. So again, Is it our job to proactively seek out bugs, or do we just fix what the customer requests.... Personally, I want to leverage this opportunity with my org to drop any expectation of IE6 support or compatibility.


title: Why do operating systems do low level stuff in C and C++? Why not just C++?

text: On the Wikipedia page for Windows, it states the Windows is written in Assembly for the bootloader and task switcher, and C _and_ C++ for kernel routines. IIRC, you can call C++ functions from an `extern "C"`'d block. I can get using C for the kernel functions so pure C apps can use them (like `printf` and such), but if they can just be wrapped in an `extern "C "` block, then why code in C?


title: Will correctness proofs of code ever go mainstream?

text: All but the most trivial programs are filled with bugs and so anything that promises to remove them is extremely alluring. At the moment, correctness proofs are code are extremely esoteric, mainly because of the difficultly of learning this and the extra effort it takes to prove a program correct. Do you think that code proving will ever take off?


title: Browser support for internal corporate tools

text: We are on the verge of a conversion. For years, our company supported only IE for its internal (intranet) home-built tools. Since a few of our users are still on XP, which means IE only goes up to 8... a heavily JS / jQuery site wont even load! We have been in the process of converting to use Chrome instead, to make use of its javascript performance. But, it has now been suggested that we support all common browsers... internally for these tools. Which means more development time to scale-back some of these new applications, more time to test in all browsers, and we are already under staffed. Are there any good informational sites/posts out there, that already make this argument?


title: What's with the aversion to documentation in the industry?

text: There seems to be an aversion to writing even the most basic documentation. Our project READMEs are relatively bare. There aren't even updated lists of dependencies in the docs. Is there something I'm unaware of in the industry that makes programmers dislike writing documentation? I can type out paragraphs of docs if needed, so why are others so averse to it? More importantly, how do I convince them that writing docs will save us time and frustration in the future?


title: Data Aggregation of CSV files java

text: I have `k` csv files (5 csv files for example), each file has `m` fields which produce a key and `n` values. I need to produce a single csv file with aggregated data. I'm looking for the most efficient solution for this problem, speed mainly. I don't think by the way that we will have memory issues. Also I would like to know if hashing is really a good solution because we will have to use 64 bit hashing solution to reduce the chance for a collision to less than 1% (we are having around 30000000 rows per aggregation). For example               file 1: f1,f2,f3,v1,v2,v3,v4             a1,b1,c1,50,60,70,80             a3,b2,c4,60,60,80,90           file 2: f1,f2,f3,v1,v2,v3,v4             a1,b1,c1,30,50,90,40             a3,b2,c4,30,70,50,90          result: f1,f2,f3,v1,v2,v3,v4               a1,b1,c1,80,110,160,120             a3,b2,c4,90,130,130,180      algorithm that we thought until now:   1. hashing (using concurentHashTable)   2. merge sorting the files   3. DB: using mysql or hadoop or redis. The solution needs to be able to handle Huge amount of data (each file more than two million rows) a better example: file 1               country,city,peopleNum     england,london,1000000     england,coventry,500000      file 2:               country,city,peopleNum     england,london,500000     england,coventry,500000     england,manchester,500000      merged file:               country,city,peopleNum     england,london,1500000     england,coventry,1000000     england,manchester,500000      The key is: `country,city`. This is just an example, my real key is of size 6 and the data columns are of size 8 - total of 14 columns. We would like that the solution will be the fastest in regard of data processing.


title: how to create database in which new columns have to be added periodically?

text: I want to create a database that tracks different projects and their finances. As finances are tracked monthly, a new column has to be created for each month. I could create all tables together at the start, yeah, but I guess it would be bad development strategy. Also I would be guessing the number of months. I will be creating an application to monitor those projects (like graphs and such)... so maybe I could code the program to do it at regular intervals.


title: Is code ownership a code smell?

text: This is something I've been thinking about ever since I read this answer in the controversial programming opinions thread: > **Your job is to put yourself out of work.** > > When you're writing software for your employer, any software that you create > is to be written in such a way that it can be picked up by any developer and > understood with a minimal amount of effort. It is well designed, clearly and > consistently written, formatted cleanly, documented where it needs to be, > builds daily as expected, checked into the repository, and appropriately > versioned. > > If you get hit by a bus, laid off, fired, or walk off the job, your employer > should be able to replace you on a moment's notice, and the next guy could > step into your role, pick up your code and be up and running within a week > tops. If he or she can't do that, then you've failed miserably. > > Interestingly, I've found that having that goal has made me more valuable to > my employers. The more I strive to be disposable, the more valuable I become > to them. And it has been discussed a bit in other questions, such as this one, but I wanted to bring it up again to discuss from a more point blank " **it's a code smell!!** " point of view - which hasn't really been covered in depth yet. I've been a professional developer for ten years. I've had one job where the code was well written enough to be picked up relatively quickly by any decent new developer, but in most cases in industry, it seems that a very high level of ownership (both individual and team ownership) is the norm. Most code bases seem to lack the documentation, process, and "openness" that would allow a new developer to pick them up and get working with them quickly. There always seem to be lots of unwritten little tricks and hacks that only someone who knows the code base very well ("owns" it) would know about. Of course, the obvious problem with this is: what if the person quits or "gets hit by a bus"? Or on a team level: what if the whole team gets food poisoning when they go out on their team lunch, and they all die? Would you be able to replace the team with a fresh set of new random developers relatively painlessly? - In several of my past jobs, I can't imagine that happening at all. The systems were so full of tricks and hacks that you " _just have to know_ ", that any new team you hire would take far longer than the profitable business cycle (eg, new stable releases) to get things going again. In short, I wouldn't be surprised if the product would have to be abandoned. Obviously, losing an entire team at once would be very rare. But I think there is a more subtle and sinister thing in all this - which is the point which got me thinking to start this thread, as I haven't seen it discussed in these terms before. Basically: I think **a high need for code ownership is very often an indicator of technical debt**. If there is a lack of process, communication, good design, lots of little tricks and hacks in the system that you "just have to know", etc - it usually means that the system is getting into progressively deeper and deeper technical debt. But the thing is - code ownership is often presented as a kind of "loyalty" to a project and company, as a positive form of "taking responsibility" for your work - so it's unpopular to outright condemn it. But at the same time, the technical debt side of the equation often means that the code base is getting progressively less open, and more difficult to work with. And especially as people move on and new developers have to take their place, the technical debt (ie maintenance) cost starts to soar. So in a sense, I actually think that it would be a good thing for our profession if a high level of need for code ownership were openly seen as a job smell (in the popular programmer imagination). Instead of it being seen as "taking responsibility and pride" in the work, it should be seen more as "entrenching oneself and creating artificial job security via technical debt". And I think the test (thought experiment) should basically be: what if the person (or indeed, the whole team) were to vanish off the face of the Earth tomorrow. Would this be a gigantic - possibly fatal - injury to the project, or would we be able to bring in new people, get them to read the doccos and help files and play around with the code for a few days - and then be back in business in a few weeks (and back to full productivity in a month or so)?


title: Applying the Art Gallery problem to optimal sensor placement

text: I am trying to design an algorithm for _optimal sensor placement_ in a given area. After doing some research I found the _Art Gallery Problem_. However, this problem assumes that the guards can see all the way to the perimeter from their positions, which is not the case with sensors (sensors have a range). Is it possible to solve the optimal sensor placement problem by mapping it to an art gallery problem, and trying some recursive solution? I would be grateful if someone could throw some light on this question or guide me to appropriate resource.


title: Recommendations for a web-based help system

text: I'm putting together a fairly large GUI. I'm a tech person, but more on the hardware side, not software. I'm wondering what software package would be best suited to enable me to generate a web-based help-system. Preferably it takes care of a lot of coding, allowing me to focus on the content. For example, the user would click on a link in the GUI when they have a question, that brings them to a web-based Help Guide, for example, providing an overview of how to use the GUI, perhaps a searchable index (key-word based index), table of contents, etc, for navigating through the Help Guide. My first thought was to program everything in XHTML using Dreamweaver, but my layout requirements are fairly modest (just figures and text, maybe a few equations), and I'd prefer not to spend a lot of time concentrating on the programming. Was wondering if any software existed that made generating web- based navigable pages easy to create/publish. Again, I'm not really a programmer, so if there's something obvious out there, I'm probably not aware of it.


title: Does taking a series of contracts hurt your career?

text: So I've been contracting for 6-7 months now. The problem I have is that I take a contract while looking for work and then don't want to bail on the people working in my contract. Then when the contract is up, I tell myself I'm going to take a contract while looking, etc. I'm concerned that if this trend continues it will not be good for my career. I'm particularly concerned about the fact that the contracts (3 to 6 months) aren't really long enough for me to participate in a full SDLC. Does taking a series of 3-6 month contracts make it more difficult to land a permanent, senior position later? For example, I can't imagine someone hiring a consultant to be a team lead. So if you are going from contract to contract, does it hurt your ability to eventually become a team lead?


title: Is there an antipattern to describe this method of coding?

text: I have a codebase where the programmer tended to wrap things up in areas that don't make sense. For example, given an Error log we have you can log via               ErrorLog.Log(ex, "friendly message");      He added various other means to accomplish the exact same task. E.G.               SomeClass.Log(ex, "friendly message");      Which simply turns around and calls the first method. This adds levels of complexity with no added benefit. Is there an anti-pattern to describe this?


title: Am I sending large amounts of data sensibly?

text: I am about to design a video conversion service, that is scalable on the conversion side. The architecture is as follows:   * Webpage for video upload   * When done, a message gets sent out to one of several resizing servers   * The server locates the video, saves it on disk, and converts it to several formats and resolutions   * The resizing server uploads the output to a content server, and messages back that the conversion is done. Messaging is something I have covered, but right now I am transferring via FTP, and wonder if there is a better way? is there something faster, or more reliable? All the servers will be sitting in the same gigabit switch or neighboring switch, so fast transfer is expected. EDIT:   The question goes on the server <-> server side of things. The servers are co- located in same LAN, so the security of the interconnection there is not expected to be the main issue.


title: Software trial: limited time or limited functionality?

text: I am currently developing my first serious piece of software in C#. It is a good learning experience so far. My software is basically a task scheduling tool with some advanced features and capabilities. I am not near the finishing stages yet, but I was wondering what people's opinions are on trial versions of software. Do you think it would be more beneficial, in general, to have a limited time trial (say 30 days) or a limited functionality version of the software? I think I know which I would go with, however I always like to listen to the opinions of others. Thanks,


title: entity framework 6 agnostic enough different sql server and OS platforms?

text: It's my first time using sql server, I usually go with MySQL, so I'm unsure how to do this. The project I'm assigned will be deployed to multiple platforms particularly PC's with different SQL server ranging from 2008 to 2014, some of them are express edition, some are standard edition and in Windows ranging from XP, 7, 8 and 8.1 for both x86 and 64 bit systems If I use entity framework 6 in my development PC, 64-bit windows 8.1 and SQL Server 2012 Express. Will this pose a problem during deployment?


title: How do you handle changes in client focus?

text: We are working on a large ongoing project that has continual feature changes. These features could take as long as 3 - 4 weeks to complete. This would of course be fine, except the client is always changing its priorities/focus based on pushes from THEIR clients who may want certain features implemented before others. So, we often have to shift gears in the middle of a major feature build and start a new feature that all of a sudden has a greater priority. We then of course have the time cost of merging everything together at some point, and also the cost of that lost momentum on the original feature. Our estimates are out the window at that point. Is there any good way to handle this? Some options I've thought of:   1. assume this is the way things will be, and apply a 'distracted client' factor of up to 100% on all estimates (this is dangerous in the case where we can actually complete a feature without interruption)   2. educate the client on the costs of shifting gears, and perhaps apply a change premium to previous estimates if they want us to change to working on a different feature   3. refuse to work on more than one feature/release at a time (aside from bug fixes). This is probably not realistic. I'm looking forward to hearing about how others have tackled this. It can't be uncommon.


title: Serving images from google cloud resized to 300x200

text: I am working on an application that uses Google Cloud storage to serve my app images. The images are submitted from an android app to google app engine code that is supposed to upload the images to gcs then create a link and update in my db. This works fine. The challenge am facing is i need different devices to serve the same image but in different dimensions. e.g device1 can request images to be served with size 300x300 while device2 can request the same image to be served with size 500x500. I have tried to google the issue but i dont seem to get a correct way to serve my image in different sizes but only got some url structure that will use a blob key then parse the size as a get parameter in the url and the image is cropped to the required dimensions. e.g. http://lh4.ggpht.com/TgjDT- cPRr6bjrpSVQeILk93o4Ouzjo1ygMB6KpmnCHhyH5vJKKRrqxCD2bC3T09CRIP6h5QFsV_l0hnhio5bN7z=s1000-c My images urls are in this format http://storage.googleapis.com/myappname.appspot.com/images/random_generated_imagename.jpg Can someone suggest an idea on how i can achieve this using the url that i have? I have tried reading image from the url, resizing it image to the size requested by the device then pushing back the image to the device but this looks tedious to me and utilizes alot of server resources given that i can have an average of 100 connections per second requesting for images.


title: Software licensing and code generation

text: I'm developing a tool that generates code from some various data. The tool itself will be licensed with the MIT license, which strikes a good balance for me in terms of allowing the freedom to use and modify it, while still holding the copyright. OK, but what is the legal status of the code _generated_ by the tool? Who holds the copyright for code generated by a tool? Do I need to give users of the tool a license for the generated code, or do they already have that by virtue of it being generated by them? What is different about this code generation system (which may be relevant) is that the source information about the code generation is provided by the system itself. The user doesn't feed source data in; the source data is bundled along with it. They simply have the means to transform it in various ways (filtering out parts of the data they don't want, etc). Obviously they could edit the bundled data. Does that affect anything about this?


title: What options are there to programmatically use windows application in VB.NET? (Button Press and Keyboard Strokes)

text: I have this complex windows application that I need to create an automated testing system for. I need to use VB.NET, and it needs to be able to click all kinds of things, be conscious of the windows that open in the application, the dialog boxes, and do the things that a human would do in this application. Through my research, I discovered FindWindowEx will be useful for me. I would appreciate any feedback as to what direction I should go on creating this automated testing system. (are there any function, libraries, or other built in stuff that can help me? If so, what are they) Thanks, Phil


title: Do we need Logging when doing TDD?

text: When doing the Red, Green & Refactor cycle we should always write the minimum code to pass the test. This is the way I have been taught about TDD and the way almost all books describe the process. But what about the logging? Honestly I have rarely used logging in an application unless there was something really complicated that was happening, however, I have seen numerous posts that talk about the importance of proper logging.   So other than logging an exception I couldn't justify the real importance of logging in a proper tested application (unit/integration/acceptance tests). So my questions are:   1. Do we need to log if we are doing TDD? won't a failing test reveal what wrong with the application?    2. Should we add test for the logging process in each method in each class?   3. If some log levels are disabled in the production environment for example, won't that introduce a dependency between the tests and enviroment?   4. People talk about how logs ease debugging, but one of the main advantages about TDD is that I always know what's wrong due to a failing test. Is there something I am missing out there?


title: Is it a good idea to do TDD on low level components?

text: I'm considering writing a low level driver or OS components/kernels. The osdev.org folks seem to think that the important bits are not meaningfully testable this way, but I have read some discussions where people thought differently. I've looked around, but have failed to find any real life examples of TDD on low-level components. Is this something people actually do, or just something that people talk about in theory because there is not a good way to do it in practice?


title: How to implement proper identification and session managent on json post requests?

text: I have some minor messaging connection to server from website via json requests. I have single endpoint which distributes requests according to identification data. I am using asynchronous server and handle data when it comes. Now I am thinking about extending requests with some kind of session. I tried using REST/JSON approach, passing single id in json. For example I register on page, get some kind token id as response and used that token with each post request. Post request has three simple parts: type, data, token_id. My problem is I am not sure how to cache token on browser side. I am using Tornado as webserver and saving token via cookies like this(http://technobeans.wordpress.com/2012/08/07/tornado-cookies/). Problem is I am not sure how long set expire time and how I should force to renew cookie. For example, should I when cookie expires (I really do not know proper way to detect it) to launch event on client side to register. Also I tried to drop requests and use socket like interfaces (sock-js) to transfer data. There I find that handling was way more easier: login open socket post data, close. Where I could implement it, I was happy with it. However I feel that having open connection is not solution to all problems, specifically to rare irregular data transfer events. I am searching for ideas how to have post requests properly identified and how to handle irregular json connections. To sum up:   1. **What is the best way to define post requests session?** Get cookie when registered and use token as long as session runs with each request? Should I implement timeout for token? Is there alternative methods? Can I cache tokens to same origin requests? What could I use on client side (Web browser)?   2. **How about safety?** What techniques I should use to throw away requests with malformed data, to big data, without choking server down? **Should I worry?**


title: Low impact refactoring and code cleaning of sloppy code while waiting for requirements

text: I inherited an existing code base for a product that is reprehensibly sloppy. The fundamental design is woefully inadequate which unfortunately I can do little about without a complete refactor (HIGH coupling, LOW cohesion, rampant duplication of code, no technical design documentation, integration tests instead of unit tests). The product has a history, high exposure to critical "cash-cow" clients with minimal tolerance for risk, technical debt that will make the Greeks blush, VERY large codebase and complexity, and a battle-weary defeatist approach to bugs by the team before me. The old team jumped ship to another division so that they have the opportunity to ruin another project. It is very rare that I experience a Technical Incompetency Project Failure as opposed to a Project Management Failure but this is indeed one of those cases. For the moment I am by myself but I have a lot of time, freedom of decision and future direction and the ability to build a team from scratch to help me. My question is to gather opinion on low impact refactoring on a project like this when you have some free time during the functional requirements gathering phase. There are thousands of compiler warnings, almost all of them unused imports, unread local variables, absence of type checking and unsafe casts. Code formatting is so unreadable and sloppy that it looks like the coder suffered from Parkinsons disease and couldn't control the amount of times the space bar was pressed on any given line. Further database and file resources are typically opened and never closed safely. Pointless method arguments, duplicate methods that do the same thing, etc.. While I am waiting for requirements for the next feature I have been cleaning low-impact low risk things as I go and wondered if I am wasting my time or doing the right thing. What if the new feature means ripping out code that I spent time on earlier? I am going to start an Agile approach and I understand this is acceptable and normal to constantly refactor during Agile development. Can you think of any positive or negative impacts of me doing this that you would like to add?


title: How to explain that it's hard to estimate the time required for a bigger software project?

text: I'm a junior developer and I find it hard to estimate how much time it takes to finish a bigger software project. I know how to structure the architecture in general, but it's hard for me to know what details I have to do and what problems I have to solve. So it's hard to estimate how much time it will take to finish a bigger project, because I don't know what problems I need to solve and how long it takes to solve them. How do I explain this to a person that is **not a software developer**?


title: Sales Manager: "Why is time-estimation so complex?"

text: A few days ago a sales manager asked me that question. But at this moment I didn't know a answer which he can understand. He isn't a programmer! At the moment I work on a product which is over 8 years old. Nobody thought about architecture or evolvability. I have a swamp of code in front of me every day which is not tested. Because of that, time estimates are very difficult for me. How I can describe that problem to an **salesman**? Not only my swamp-code- problem, but general!


title: Setting Deadlines in software development

text: I have been working on a system alone for about two years. I inherited the system from a contractor who spent about two years working on it before me (alone). The system is not particularly well designed because there is business logic, presentation logic and data logic mingled together. It is a very complex system, which I am trying to refactor as I go along and this takes time. A new developer was recruited but he seems to be taking more of a Project management role. He is very direct asking exactly how long things will take; questioning all my assumptions and predictions, which is difficult because of the complexity and because I am the only expert at the moment. I am very organised in my personal life. For example, I was asked what time I would arrive in Manchester last week so I provided an exact time catering for accidents and road works on the way. I find it difficult to apply the same principles at work in software development at the moment. Don't get me wrong. I have worked with project managers on less complex projects in the past and have had a good relationship, but then the projects were less complex and I always delivered before schedule. I am struggling with this particular project manager and it is causing stress. How do other developers deal with project managers who want answers and accurate deadline dates?


title: Network application framework/API/etc

text: With all the web2.0 hype and webapps being all the rage, the only advantage from a corporate POV that I can think of webapps having is that it is easier to service your user base: upgrades become easier among several things. It's just that the browser is not a good platform. I've been mulling this over for a while now. My original idea was to use python, then I found out about QSA. I like QT. It's widgets are excellent for most purposes, and it's cross platform. A generic QT application is installed on the clients machine. They point it to a URL to begin executing the signed/encrypted application at that location. The actual application could be written in Qt script. It could be developed very much like a traditional MVC application. Or it could, and probably should, be developed like WT, so that a "web" application can be coded the same way as a "desktop" application. Before I go reinventing the wheel, are there any such platforms/frameworks in existence? If I do go inventing this wheel, what are some things I should be aware of?


title: What does Douglas Crockford mean when he says jQuery doesn't scale?

text: In the Q&A section of this talk, Douglas Crockford says that jQuery doesn't scale as well as some other popular libraries. What does he mean by that, and what is it about the other libraries that makes them more scalable?


title: When returning from a period of not programming, do you find you've improved?

text: It seems as though whenever I take an extended break from programming--whether to pursue other interests or simply because I fall out of the habit for a while--I invariably find that when I return to a project and set to coding, I come with an abundance of new ideas, novel approaches, and just plain better code. It may be because I have a lot of other creative interests besides programming, and my mind likes to find correlation and crossover between them, so while I'm doing one thing, in the back of my mind I'm usually also applying it to another. So what's your experience? Do you ever return from a break (whether intentional or not) feeling not only refreshed, but also somehow _noticeably improved?_ Is it actually the norm?


title: What is a uniform way to express Country, City, State? (ISO standard, etc)

text: I need to encode data into a user token that describes the user's Country, State, and city. I understand that different descriptors apply to different government hierarchies, but am looking for a standard of some type that has already sorted this out. What ISO standard, binary format, etc is best at describing a user who may be from any country?


title: Getting rid of Massive View Controller in iOS?

text: I had a discussion with my colleague about the following problem. We have an application where we need filtering functionality. On any main screen within the upper navigation bar, there is a button in the upper right corner. Once you touch that button, an custom written Alert View like view will pop up modally, behind it a semitransparent black overlay view. In that modal view, there is a table view of options, and you can choose one exclusively. Based on your selection, once this modal view is closed, the list of items in the main view is filtered. It is simply a modally presented filter to filter the main table view.This UI design is dictated by the design department, I cannot do anything about it so let accept this as a premise. Also the main filter button in the navbar will change colours to indicate that the filter is active. The question I have is about implementation. I suggested to my colleague that we create a separate XYZFilter class that will   * be an instance created by the main view controller   * acquire the filtering options    * handle saving and restoration of its state - i.e. last filter selected   * provide its two views - the overlay view and the modal view    * be the datasource for the table in its modal view.  For some unknown reason, my colleague was not impressed by that approach at all. He simply wants to do these functionalities in the main view controller, maybe out of being used to do this in the past like that :-/ Is there any fundamental problem with my approach? I want to   * keep the view controller small, not to have spaghetti code   * create a reusable component (for use outside the project)   * have more object oriented, decoupled approach.   * prevent duplication of code as we need the filtering in two different places but it looks the same in both.. Any advice?


title: Anyone knows good references for Machine Learning Algorithms and Image Recognition?

text: I need it for my thesis and for some reason I am having a hard time finding decent books or websites for it. My thesis topic is "Classification of Modern Art Paintings using Machine Learning Approach". My goal is to classify examples of modern art paintings to its respective modern art movement(expressionism, realism,etc..) using machine learning approach. Also, suggestions and comments about my thesis are greatly appreciated.


title: Looking for the tool that generated JSON Rail-Road grammar descriptions

text: I am currently working on a little language, and I'd like to express its grammar more rigorously. I know about EBNF and it's great to generate parsers (Bison/Yacc), however it's not that easy to visualize. The Wikipedia page on Syntax Diagram points out that one of the success of JSON is due to the display of its grammar as a Rail-Road diagram. Indeed if one goes to the JSON webpage, one can see nice diagrams, that are easily accessible and (I find) visually attractive, for example: ![http://json.org/object.gif](http://i.stack.imgur.com/raLaZ.gif) It easily conveys the structure of an `object` in JSON, dealing with multiple alternatives and repetitions easily. A very similar way of expressing the grammar can be found on SQLite (though I prefer the JSON one). ![http://www.sqlite.org/images/syntax/delete- stmt.gif](http://i.stack.imgur.com/Oiv6H.gif) Does anyone know if there was a tool used to generate the JSON diagrams ? (and if so, where I can find it). The wikipedia page reference some generators but none seem to generate such nice diagrams.


title: What are some easy techniques to scan books for new information?

text: I find it irresistible to keep purchasing cheap programming and technical e-books in fields such as Drupal, PHP, etc., and also compulsively download free material made available such as those from Microsoft's developer blog... The main problem with the large library I've developed is that there are many chapters (especially the first few) in these books packed with information I already know, but with helpful tidbits hidden in between. The logical step would be to skip those chapters and read the ones I don't seem to know anything about, but I'm afraid I may lose out on really important information this way. But naturally it is tedious to have to read about variables, functions and objects all over again when you are trying to know more about the Registry pattern, for example. It's hard to research on the net for this, because my question itself seems vague and difficult to formulate into a single search query. I need people- advice - what do you do in this situation?


title: What do you think about JavaFX script retirement?

text: Oracle will no longer develop JavaFX script ( the language ) and now the applications would be coded through the API. I think JavaFX script was kind of neat. Does it seem reasonable to stop the development of the language, and use it only through the API? Links: http://jonathangiles.net/blog/?p=916 http://java.dzone.com/articles/javaone-2010-alternative-jvm


title: Is it bad practice to store metadata information in file names? Better solutions?

text: I have noticed where I work people are keen on storing information in file names, and parsing the file names. To me this doesn't seem to be especially good practice. I already see the occasional issues with scripts globbing for a file, and getting the wrong one because another file matches first.We are also discussing how to get around problems with separators for the fields. Is it considered bad practice or not? What are other accepted solutions for retrieving files from a file system based on some type of metadata?


title: Load all templates at startup?

text: I am developing a jQuery mobile app. In this app, i often use Mustache.js templates in separate html files. Actually, every template is needed by the user, but my app loads a template (via GET method) only when it is needed. For now, all the templates are small and they're all used by the client at runtime. But obviously this won't be the case for long, in case I add extensions that will be needed or not by the users. I could load every template at once, but I'm afraid this could become a blocking point in the future. Based on your experience, what is the best thing to do? Load all templates at once, or load them one by one, when needed?


title: Is there any standard for design document

text: This question is purely from academic point of view. As part of the software engineering lab, a design document is to be created after generating the SRS. Is there any standard for creating the design document. Since we followed IEEE standard for creating the SRS. What all things can be included in the design document from the academic point of view? I am thinking of including different UML diagrams.


title: How should I test my application?

text: I have made a simple application which searches for files and folders on users computer. Since, I am a student currently in my 1st year and don't have any formal training and have made my application while I was still learning C# and .Net framework, I didn't have knowledge about unit tests and other good testing methods used by professionals. Although, most of my code is working fine, sometimes it throws exceptions or some other unexpected situation occurs and the code breaks. Keeping the above experiences in mind, I don't think my application is ready for deployment and so , I would like to test my application in a professional way, and be assured that my application is bug free. Therefore, I want to ask professionals here, that keeping my situation in mind, how should I start testing my application.   What are the steps that I should follow, to ensure the quality of my application.


title: Unit Testing in iOS -- Should I split out my Data Model into it's own class?

text: I'm attempting to try out using unit test in for the first time in new iOS activity for work. I love the idea of unit testing, but always find the specifics to be... messy. I get the general principals -- I have read a lot about it so I wanted to ask a specific question. My situation:   * I have a UITableView that can have anywhere from 10 to 10,000 items. I would like to do partial loading. Load the first 100 or so, and then when the user scrolls down half way, load the next 100. Or something like that.   * My calls to the DB are asyc (I do not control this, although I guess I could block and wait on the main thread if I really wanted to). My first thought is to have an NSMutableArray and a function to load/update the data in my UIViewController. I also need to keep track of if the data is finished loading and if the data is currently being reloaded (because it's an async call). However, I'm wondering if it's better to split this into it's own class for testability? Let's call it SmartMutableArray? My concerns are   1. If I do this, it requires more selectors then before. I already need to create a call back for my call to the database, and now I need to create another one for my UIViewController to be notified when SmartMutbleArray is completed loading. I would think this makes my code harder to read.   2. Because my new array is updated in the background, I think I need to use `self performSelectorOnMainThread:@selector(addObjectsFromArray:) withObject:response.balances waitUntilDone:YES];` to update the new array in my new SmartMutableArray class. Which seems weird to me, that this class needs to know it's a data source for a UI element.   3. If I don't break it up, I have to test all this loading indirectly by calling my UITableView delegate commands. I've plowed ahead with creating the new class for this list... but I'm curious what people with more experience think of something like this. Is it overkill? Thanks for any input, sorry for the length. Please let me know if I'm missing any details that would be useful though.


title: Using multiple Git repositories instead of a single one containing many apps from different teams?

text: I am migrating a 10-years-old big CVS repository to Git. It seemed obvious to split this multiple-projects repository into several Git ones. But the decision-makers are used to CVS, therefore their point of view is influenced by CVS philosophy. To convince them to migrate from one CVS repo to different Git repositories I need to give them some arguments. When I speak with mates working on Git repo for years, they say that using multiple Git repo is the way to use Git. I do not know really why (they give me some ideas). I am a newbie in this field so I ask here my question. **What are the arguments to use multiple Git repositories instead of a single one containing different applications and libraries from different teams?** I have already listed:   * branches/tags impact the whole Git repository files => pollutes other team projects   * 4GB limit Git repo size but this is wrong   * git annotate may be slower on _bloat_ Git repo...        **EDIT:**   * Eamon Nerbonne has noticed the related question:    Choosing between Single or multiple projects in a git repository?   * The reason the team managers finally have accepted the split: the single Git repo (550 MB) was requiring 13 minutes to be cloned on Windows.    * The _bloat_ CVS repo split in 100 Git repositories:      * each dead apps in one repo     * each stabilized library in one repo (source code almost never changed any longer)      * related apps/libs kept together in one repo     * moved large files not used for compilation (config...) to other repos (Git does not like large files)     * skipped other unrelevant files (`*.jar`, `*.pcb`, `*.dll`, `*.so`, `*.backup` ...)    * Successfully installed the `repo` tool used by Android Open Source Project in order to handle all these Git repos:      * easy installation on Linux      * more difficult on Windows because of Cygwin and NTFS native symlinks requirements


title: Where to put entity model classes in case of using a dataservice layer?

text: If my solution has both a "dataservice" project and a "business logic" project, where do the entity models, which represent database tables, belong? At first i thought putting them in the dataservice layer, but then i would need duplicate models in the business logic layer, if i wanted to provide reusable logic dealing with or being dependant of database data. Putting models in the business logic project, would force the dataservice layer to be dependant on the core project.


title: Custom PHP Template Engine

text: I've been developing a custom PHP template engine to suit just my needs and also to get a little more practice with PHP. What I did was to create a Template class that simply receives as constructor parameter a path to a template file and a string that should be the placeholder for the contents of the pages. In that case, the template file is an HTML file with some placeholders written as [placeholder]. These will be filled with real content by another class. So for instance, [title] should be filled with the title, [content] with the content of the selected page and so on. I've created also a Page class that receives as constructor parameter the directory of the pages and then has methods to set which name of file it should use (this is filled in as we like in the initialization, when working with friendly URL's the most common way I use this is setting as the first piece of the URL) and methods to set more data as pairs of placeholder string and real content. My only problem is with how to deal with titles and meta tags. For each page there's a title and a collection of meta tags. My only way to deal with this was to create in different files one array with titles and one array with meta tags. Both of them receives as index the name of the page file. So for instance $titles["home"] should be the title of the home page and $meta_tags["home"] should be the html code for the meta tags of the home page. The problem is that as soon as there are lots of pages this will have one unecessary cost of memory: the system would be loading for every requests all the titles and all meta tags, while it must load only the required one. I thought on using database, but it seems like killing one ant with an atomic bomb. So the next best thing I thought of was XML. Now, what's the best solution for this kind of situation? Use XML, use a MySQL database, or some other method? As I've said, I know that the recommended is that we use the template engines that are already out there since they are tested lots of times, are already stable and so on, but I'm struggling with those things as a way to get more practice developing with PHP. Thanks very much in advance for the help. Also, I didn't think it was needed to post any code I've written, but if some of the code will help, please ask and I'll post it.


title: C++ class with only pure virtual functions: what's that called?

text: So i'm looking for some input/consensus on what terminology we should be using to describe something that looks like this:               class Printable     {       public:         virtual void printTo(Printer *) = 0;         virtual double getWidthInPoints() = 0;         virtual double getHeightInPoints() = 0;     };      So this is a class that only has pure virtual methods. Any class that inherits it needs to implement the whole thing, i.e. there is no partial implementation. So what is this called? I have mostly seen two different names: 1) _Interface_ Used in Windows COM programming (perhaps it came from the IDL), it's a keyword in both C# and Java and also a compiler directive/keyword in Objective-C (but isn't the same thing). I've heard engineers using the phrase 'interface' synonymously with 'API', but, at least in this scenario, it's a single thing whereas an API could comprises more than one. 2) _Protocol_ I've seen this used in various open-source libraries such as Bloomberg BSL and it's a compiler directive/keyword in Objective-C, but does not necessarily need to be in the inheritance hierarchy. In the broader computer science sense, protocol is a formal definition of information exchange between two parties, like TCP and HTTP, but this definition kind of holds for the above class too. Is there any clear distinction between these in C++ or are they pretty much interchangeable?


title: Two bosses, both want different way of implementation

text: Over lunch, a colleague of mine, that has a manager (person in direct charge of the project) and a BOSS up top was asked to resolve one issue. The manager had arguments with the boss regarding how it should be resolved. They both agreed they would go with the manager's way. When my colleague was starting to resolve the issue, the Boss calls and said, "You do it my way." In this case, what would you do?!


title: What does the python Codecs module do?

text: I just read through the documentation on the Codecs module, but I guess my knowledge/experience of comp sci doesn't run deep enough yet for me to comprehend it. It's for dealing with encoding/decoding, especially Unicode, and while to many of you that's a complete and perfect explanation, to me that's _really_ vague. I don't really understand what it means at all. Text is text is text in a .txt file? Or so this amateur thought. Can anyone explain?


title: How to build child classes as parent configuration?

text: I'm using Codeigniter PHP Framework for developing a web application, and when developing an admin zone, I've ended building a generic parent class called AdminController which is extended by the child classes to develop my Admin zones. **I've shortened my code to show what I really want to show** , my code is something like: Parent Class:               class AdminController {          protected $url_action   = null;     protected $permissions  = null;     protected $formulario_gestion  = null;          function __construct() {         if ( empty( $this->permissions ) ) {             throw new Exception( 'No se ha definido permissions' );         }         if ( empty( $this->url_action ) ) {             throw new Exception( 'No se ha definido la url_action' );         }         if ( empty( $this->formulario_gestion ) ) {             throw new Exception( 'No se ha definido el formulario_gestion' );         }     }          public function create() {         if ( ! $this->checkPermissions( $this->permissions, $this->user ) {              redirect( base_url );           }              $formulario = new $this->formulario_gestion( null );         $formulario->setFormValues( $this->get_update_values() );              // More code below...     }          // Doing this to make sure I'll overwrite it     public function get_update_values() {         throw new Exception('No has definido get_update_values');     }          // More Methods and things...      And then, I use my child class to initiate all the values required in the parent, overwrite all the functions I need have to be overwritten, and go: Child Class               class Webs extends AdminController {          function __construct() {              // Initiating parent values:         $this->permissions = 'webs';         $this->url_action  = strtolower( __CLASS__) ;         $this->formulario_gestion = 'FormularioWebs';              parent::__construct();     }          // Overwriting what I need to be overwritten     public function get_update_values() {          $values = $array(              'field1' => 'value1'          ,   'field2' => 'value2'          );          return $values;     }      And this work quite well: All the pages share the same behaviour and I only write relevant code. **My problem is** : This is a nightmare when building a whole CRUD with it: I ended up with many properties I only use in some methods, and I don't know if there is a "standard" or correct way of doing it. I mean what are the flaws of doing this in this way? It is correct? I don't like having so many properties laying out there that are only going to be used in a method, and I don't know how to encapsulate them in a way only the method use it it'll have it. What I ended up is something like the code bellows, but I don't really like it, as you don't know in the parent where the value is declared. Method in Parent Class:               public function show() {          echo $this->var;     }      Method in Child Class:               public function show() {          $this->vars = 'value'          parent::show();     }


title: Merging around 15 small Git repos of non-optional centralized web service components to a single large repo

text: In a centralized web service we break down the components into various small Git repos by software modules, e.g. authentication module, authorization module, data access module etc. (around 15 repos at the moment) The good thing is it is easy to manage the smaller code base, however, our productivity has decreased a lot since quite a lot of changes need to be update several repos at once. Also, deployment is more difficult as there are multiple versions of module involved, we always need to think about the dependency. I am considering to merge all the modules back to a single repo, because   * our services must require all the modules to exists, they are not optional for our service   * we are not a big team (3 people actually) and the overhead in maintaining too many repos does not worth it, they all need to have knowledge on all the code bases What do you think? Any pros and cons if we merge into a giant repo?


title: Is modern C++ replacing C#? Is Microsoft pushing developers to adopt C++?

text: I hear about modern C++ popularity and some talks about migrating back to C++ from C# or other C-like languages. I know about C++11 features but I would like to hear your experiences, especially from developers who migrated from C# to C++. More importantly, does Microsoft push developers to use C++? If yes, why?


title: What exactly is “computer systems”?

text: My professor made a comment today - "...They've been having trouble with filesystem performance, and since they're more graphics guys, they asked us systems guys to help out...". What exactly is "computer systems"? What does it mean to be a "systems guy"? And, what is a "systems guy" passionate about? For contrast, what is not computer systems? What would possibly bore a "systems guy"?


title: One-time income with recurring costs: how to mantain an app in the cloud

text: You have an idea of a software/app/webapp/website that you would like to spend some effort and implement. Your idea uses a cloud system to keep things up and you think you could earn some money by distributing your product and charging a **small** one-time fee. But there is a problem: the first thing you realize is that one day that user using your system may eat all the money he gave you with his indirect recurring little spending in the cloud. How would you do the math to find out if your idea was feasible?


title: iOS app with a lot of text

text: I just asked a question on StackOverflow, but I'm thinking that a part of it belongs here, as questions about design pattern are welcomed by the faq. Here is my situation. I have developed almost completely a native iOS app. The last section I need to implement is all the rules of a sport, so that's a lot of text. It has one main level of sections, divided in subsections, containing a lot of structured text (paragraphs, a few pictures, bulleted/numbered lists, tables). I have absolutely no problem with coding, I'm just looking for advice to improve and make the best design pattern possible for my app. My first shot (the last one so far) was a `UITableViewController` containing the sections, sending the user to another `UITableViewController` with the subsections of the selected section, and then one _strange_ last `UITableViewController` where the cells contain `UITextViews`, sections header help structure the content, etc. What I would like is your advice on how to improve the structure of this section. I'm perfectly ready to destroy/rebuild the whole thing, I'm really lost in my design here.. As I said on SO, I've began to implement a `UIWebView` in a `UIViewController`, showing a html page with JQuery Mobile to display the content, and it's fine. My question is more about the 2 views taking the user to that content. I used `UITableViewController`s because that's what seemed the most appropriate for a structured hierarchy like this one. But that doesn't seem like the best solution in term of user experience.. **What structure / "view-flow" / kind of presentation would you try to implement in my situation?** As always, any help would be **greatly** appreciated! * * * Just so you can understand better the hierarchy, with a simple example :                                         -----> Section 1   -----> SubSection 1.1   -----> Content                               |                  -----> SubSection 1.2   -----> Content                               |                  -----> SubSection 1.3   -----> Content                               |                               |                               |     UINavigationController  -------> Section 2   -----> SubSection 2.1   -----> Content                               |                  -----> SubSection 2.2   -----> Content                               |                  -----> SubSection 2.3   -----> Content                               |                  -----> SubSection 2.4   -----> Content                               |                  -----> SubSection 2.5   -----> Content                               |                               -----> Section 3   -----> SubSection 3.1   -----> Content                                                  -----> SubSection 3.2   -----> Content                                |------------------|   |--------------------|  |-------------|                       1 UITableViewController   3 UITableViewControllers  10 UIViewControllers                              (3 rows)              (with different         with a UIWebView                                                     number of rows)


title: server and request understanding

text: I want to know what a server does to run a php application. Below is what I think: client A types www.blahblahblah.blah/   1. Server resolves url and directory etc.    2. Server go the index.php    3. index.php has a Singleton Pattern Class in it with a static variable called instance.  Now does the server allocate the memory to that static variable in its own RAM so that all the requests following this first one uses the same static variable? OR for every new request does the server allocate new memory and that new memory will have a new space allocated to that static variable? My Confusion: if every request is run in its own memory space then what is a persistant connection? Second thing I wondering about: Can I have a desktop program which is continuously sending a special key to my web application and my web application is sending the key back continuously to make HTTP a connection full instead of connection less? That way I can confirm who is connected to my APP as a client instead who is connected to INTERNET. I know sessions but they make http connection less and then chance of spoofing and session hijacking is there. I know you can make session secure but still my App won't know if the client is dead and can delete the data from the session and tell others that client blah is disconnected.


title: Performance impact of not implementing relationships at the database level?

text: Let's imagine a data model with customers and invoices. There is a 1 to n relationship between a customer and its invoices. We uses an ORM (like Hibernate). One can explicitely implement the 1-n relationship (using JPA for example) or not. If not, then one must do a bit more work to fetch invoices. However, it is much easier to maintain, improve and develop the data model of applications where relationships between objects are not explicitely implemented in the database. My question is, has anyone noticed a significant performance impact when not implementing the relationships in the database?


title: Strategy / resources for writing LISP webservices?

text: Background: I'm looking to write some fully functional webservices in Common Lisp as an April Fools prank on the rest of the development team at my company. There are two pieces to this: reading info from / writing it to a MySQL database, and receiving / processing / responding to requests over HTTP. (Actually, there's a third piece, writing automated tests, but my QA partner- in-crime is going to handle that part.) After some Googling I found a good resource here ( http://www.ymeme.com/creating-dynamic-websites-lisp-apache.html ), but I'm surprised that there's seemingly only the one walkthrough. Does anyone know of others, or can anyone share personal experiences with writing webservices in CLisp?


title: Cloud computing cost savings for large enterprise

text: I'm trying to understand whether cloud computing is meant for small to medium sized companies OR also for large companies. Imagine a website with a very large user base. The storage and bandwidth demands as well as the number of database transactions are incredibly high. The website might be hosting videos, music, images, etc. that keep the demands high. Does it make sense to be in the cloud when you know you need huge volumes of storage, bandwidth, and GET,PUT,etc. requests? (Each of these variables costs money in the cloud) OR does it make sense to build your own infrastructure? I can see the cost savings of cloud computing if you are a small business, but if you were aiming at the next big thing on the Internet, I can't quite see the benefits.


title: What would you think of a job based on mostly doing the proof of concept?

text: I'm working as a developer in a small software company whose main job is interfacing between separate applications, like between a telephony system and an environment control system, between IP TVs and hospitality systems, etc...And it seems like I am the candidate for a new job title in the company, as the person who does the proof of concept of a new interfacing project and does some R&D for prototyping. What do you think the pros and cons of such a job would be, considering mainly the individual progress/regress of a person as a software engineer? And what aspects would you consider essential in a person to put him/her in such a job position?


title: Are null references really a bad thing?

text: I've heard it said that the inclusion of null references in programming languages is the "billion dollar mistake". But why? Sure, they can cause NullReferenceExceptions, but so what? Any element of the language can be a source of errors if used improperly. And what's the alternative? I suppose instead of saying this:               Customer c = Customer.GetByLastName("Goodman"); // returns null if not found     if (c != null)     {         Console.WriteLine(c.FirstName + " " + c.LastName + " is awesome!");     }     else { Console.WriteLine("There was no customer named Goodman.  How lame!"); }      You could say this:               if (Customer.ExistsWithLastName("Goodman"))     {         Customer c = Customer.GetByLastName("Goodman") // throws error if not found         Console.WriteLine(c.FirstName + " " + c.LastName + " is awesome!");      }     else { Console.WriteLine("There was no customer named Goodman.  How lame!"); }      But how is that better? Either way, if you forget to check that the customer exists, you get an exception. I suppose that a CustomerNotFoundException is a bit easier to debug than a NullReferenceException by virtue of being more descriptive. Is that all there is to it?


title: Is there a canonical book on design patterns?

text: I am interested in learning design patterns and would like to know what are considered top tier books in learning this subject. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on design patterns? What about that book makes it special?


title: Setting realistic expectations for deadlines

text: I'm a tech lead for a small team. One of the major tasks on my plate is communicating with the client. One thing I find particularly difficult is dealing with deadlines because they are mandated by the client and I'm frequently not consulted. Usually, the interaction follows the following pattern. The client comes up with a feature they want to add, Feature X. Feature X would look good in the next week's app release that is about 6 business days away. At this point, the feature request needs to go through approval and there are frequently other dependencies that need to be deal with. Eventually, N days later, the feature request trickles down to my team. Even if the original dead line (that was set by a non-developer manager) was achievable it no longer is. My team is blamed, ~~feels discouraged and there's an overall atmosphere of defeat~~ , I feel discouraged and defeated. Clearly the overall process is broken. Unfortunately, there's not much I can do because I'm not in a position of power here. My current approach is to gently remind the client about our start date versus the deadline, the scope of the Feature, etc. This feels a lot like I am making excuses though. Have you guys been in similar situations? What has/hasn't worked for you?


title: Math Major wants to become a Software Engineer

text: I am a math major, what would be the best field of computer science/computer engineering for me to go into, where I could apply my skills that I used as a math major(i.e. Linear Algebra, Real Analysis, Number theory, Numerical analysis, etc...) Thanks


title: How defensive should we be?

text: We've been running Pex over some code, and it has been showing some good things (well bad things, but showing them before it gets to production!). However, one of the nice things about Pex is that it doesn't necessarily stop trying to find issues. One area we found is that when passing in a string, we were not checking for empty strings. So we changed:               if (inputString == null)      to               if (string.IsNullOrEmpty(inputString)) // ***      That fixed the initial issues. But then, when we ran Pex again, it decided that:               inputString = "\0";      was causing problems. And then               inputString = "\u0001";      What we've decided is that defaults can be used if we encounter `// ***` and that we are happy seeing the exception caused by any other odd input (and dealing with it). Is that enough?


title: What do you do to make sure you take proper/enough breaks, while avoiding unwanted side-effects of break taking?

text: preamble> It seems to me that computer programmers are one of a select few groups of people who actually take pleasure from sitting in front of computers for long periods of time. Most people in other professions actively dislike their time at computers, and do their best to avoid it (so, I assume, they don't have problems taking breaks). At least for me, having external cues for taking breaks, and clear instructions on what to do with each break (stretch, go for a walk, close my eyes, look into a distance of preferably a few km and focus on faraway objects, etc...), is a must. So far, I've just been making up the breaks and tools to get them as I go along, based on what looks to be low-specificity information found on the net (generic stuff ala ergonomics advice for office staff). This has led to all sorts of side effects - loss of attention as I get distracted if I walk around, breaks in flow with alarm clocks interrupting my thoughts, and people around me assuming I'm low on work due to the frequency of my walking around compared to everyone else. /preamble> **tl;dr**   * Taking breaks is important   * My internal break taking system doesn't work, and ad-hoc ones have unwanted side effects    * What do you do to make sure you take proper breaks?   * How do you avoid unwanted side-effects, such as getting distracted or interrupting flow or giving your co-workers the impression you're spending a lot of time goofing off?


title: Roll your own web crawler to crawl one specific website that has multiple entries

text: What sort of languages would be able to handle writing your own web crawler? Could PHP handle this? I'm quite good with PHP (following best practices etc). But I'd like a good reason to learn a new language if I need to. The idea is to crawl one specific website that has multiple entries, much like an RSS feed, but they don't offer that an RSS feed of the site...


title: Is it typical for a provider of a web services to also provide client libraries?

text: My company is building a corporate Java web-app and we are leaning towards using GWT-RPC as the client-server protocol for performance reasons. However, in the future, we will need to provide an API for other enterprise systems to access our data as well. For this, we were thinking of a SOAP based web service. In my experience it is common for commercial providers of enterprise web applications to provide client libraries (Java, .NET, C#, etc.). Is this generally the case? I ask because if so, then why bother using SOAP or REST or any standard web services protocol at all? Why not just create a client libraries that communicate via GWT-RPC?


title: How to collect seed data for a Products/Services User review website?

text: Data = information like name, address of local businesses. Companies, their products, services etc. Once users start engaging then they themselves can add/edit data wikipedia style. because if there is no data initially then users will not be attracted to come, and if there are no users then cannot expand the data. What are the various options to bootstrap with a seed dataset ? \- Crawl and find info from various web resources \- Collect and enter it manually \- Hire data collectors \- Any place to buy such data \- Any other ?


title: Repository query conditions, dependencies and DRY

text: To keep it simple, let's suppose an application which has `Accounts` and `Users`. Each account may have any number of users. There's also 3 consumers of `UserRepository`:   * An admin interface which may list all users   * Public front-end which may list all users   * An account authenticated API which should only list it's own users Assuming `UserRepository` is something like this:               class UsersRepository extends DatabaseAbstraction {         private function query() {             return $this->database()->select('users.*');         }         public function getAll() {             return $this->query()->exec();         }         // IMPORTANT:         // Tons of other methods for searching, filtering,         // joining of other tables, ordering and such...     }      Keeping in mind the comment above, and the necessity to abstract user querying conditions, How should I handle querying of users filtering by `account_id`? I can picture three possible roads: ### 1\. Should I create an `AccountUsersRepository`?               class AccountUsersRepository extends UserRepository {         public function __construct(Account $account) {             $this->account = $account;         }         private function query() {             return parent::query()                 ->where('account_id', '=', $this->account->id);         }     }      _This has the advantage of reducing the duplication of`UsersRepository` methods, but doesn't quite fit into anything I've read about DDD so far (I'm rookie by the way)_ ### 2\. Should I put it as a method on `AccountsRepository`?               class AccountsRepository extends DatabaseAbstraction {         public function getAccountUsers(Account $account) {             return $this->database()                 ->select('users.*')                 ->where('account_id', '=', $account->id)                 ->exec();         }     }      _This requires the duplication of all`UserRepository` methods and may need another `UserQuery` layer, that implements those querying logic on chainable way._ ### 3\. Should I query `UserRepository` from within my account entity?               class Account extends Entity {         public function getUsers() {             return UserRepository::findByAccountId($this->id);         }     }      _This feels more like an aggregate root for me, but introduces dependency of`UserRepository` on `Account` entity, which may violate a few principles._ ### 4\. Or am I missing the point completely? Maybe there's an even better solution?    **Footnotes:** Besides permissions being a Service concern, in my understanding, they shouldn't implement SQL query but leave that to repositories since those may not even be SQL driven.


title: Object inheritance and method parameters/return types - Please check my logic

text: I'm preparing for a test and doing practice questions, this one in particular I am unsure I did correctly: We are given a very simple UML diagram to demonstrate inheritance: I hope this is clear, it shows that W inherits from V and so on:                                 |-----Y     V <|----- W<|-----|                       |-----X<|----Z      and this code:               public X method1(){....}     method2(new Y());     method2(method1());     method2(method3());      **The questions and my answers:**   1. **Q:** What types of objects could method1 actually return? **A:** X and Z, since the method definition includes X as the return type and since Z is a kind of X is would be OK to return either.   2. **Q:** What could the parameter type of method2 be? **A:** Since method2 in the code accepts Y, X and Z (as the return from method1), the parameter type must be either V or W, as Y,X and Z inherit from both of these.   3. **Q:** What could return type of method3 be? **A:** Return type of method3 must be V or W as this would be consistent with answer 2.


title: How can I justify a technology over another? (Java over .NET)

text: We are working in a Java/.NET company and my team and I are planning a project for a client. One of the requirements is that the project has to be done in .NET I've asked about this requirement, and the client said that it doesn't matter, and that if I have a good reason we can use other technology. But, I have to justify the decision. As a Project Manager / Analyst I'm interested in making the project in Java because:   * The team knows java much better, regarding the language and frameworks   * I don't know anything about .NET technology (and maybe we could make bad decisions thinking in a Java way to do things)   * There are other people in company that have more skills in .NET but they have other projects with more priority. For experience, I'm sure that if we use Java, the project will have much more quality. But this arguments could be weak from the client perspective. How can I justify making the project in Java? EDIT: I'm not asking if one technology is better than other. "It's not a technology war" question.


title: What is the difference between  a freelancer programmer and a Programmer working in a Software company?

text: I was told by a HR department that freelancing experience is not considered as professional experience. What could be the reason?


title: Ruby: Multithreading a CSV with output

text: I have a script written in Ruby that has maxed out a core in my server's Xeon processor for the last 2 hours. Since it's currently only using 1 of four possible cores, I want to try and rewrite the script to take advantage of all four cores. I can use the .each_slice(n) method on the array that contains my data, but I'm curious as to what would then be the best/most efficient way to then write this data to a file. It seems that I have a couple options.   1. Pass the file object to the functions being called by the Thread.new function (I assume this is legal in ruby?) and have them write as they see fit.   2. Have each function store the results in arrays, return the array on completion and let the main program then write to the disk.   3. Pass the same array object to each item and have them all add to it, then sort it. My assumption is that although 2 would probably be more memory intensive, it'll by far be most efficient method. Is there a different way to accomplish what I'm doing?


title: The architecture and technologies to use for a secure, fast, reliable and easily scalable web application

text: ^ _For actual questions, skip to the lists down below_ I understand, that his is a vague topic, but please, before you turn the other way and disregard me, hear me out. I am currently doing research for a web application(I don't know if application is the correct word for it, but I will proceed w/ that for now), that one day might need to be everything mentioned in the title. I am bound by nothing. That means that every language, OS and framework is acceptable, but only if it proves it's usefulness. And if you are going to say, that scalability and speed depend on the code I write for this application, then I agree, but I am just trying to find something, that wouldn't stand in my way later on. I have done quite a bit reading on this subject, but I still don't have a clear picture, to what suits my needs, so I come to you, StackOverflow, to give me directions. I know you all must be wondering what I'm building, but I assure you, that it doesn't matter. I have heard of _12 factor app_ though, if you have any similar guidelines or what is, to suggest the please, go ahead. For the sake of keeping your answers as open as possible, I'm not gonna provide you my experience regarding anything written in this question. ^ _Skippers, start here_ First off - the weights of the requirements are probably something like that (on a scale of 10):   * Security - 10   * Speed - 5   * Reliability (concurrency) - 7.5    * Scalability - 10 _Speed and concurrency are not a top priority, in the sense, that the program can be CPU intensive, and therefore slow, and only accept a not-that-high number of concurrent users, but both of these factors must be improvable by scaling the system_ Anyway, here are my questions:   * **How many layers should the application have, so it would be future-proof and could best fulfill the aforementioned requirements?** For now, what I have in mind is the most common version:      1. Completely separated front end, that might be a web page or an MMI application or even both.     2. Some middle-ware handling communication between the front and the back end. This is probably a server that communicates w/ the front end via HTTP. How the communication w/ the back end should be handled is probably dependent on the back end.     3. The back end. Something that handles data through resources like DB and etc. and does various computations w/ the data. This, as the highest priority part of the software, must be easily spread to multiple computers later on and have no known security holes. I think ideally the middle-ware should send a request to a queue from where one of the back end processes takes this request, chops it up to smaller parts and buts these parts of the request back onto the same queue as the initial request, after what these parts will be then handled by other back end processes. Something *map-reduce*y, so to say.   * **What frameworks, languages and etc. should these layers use?**     1. The technologies used here are not that important at this moment, you can ignore this part for now     2. I've been pointed to node.js for this part. Do you guys know any better alternatives, or have any reasons why I should (not) use node.js for this particular job.     3. I actually have no good idea, what to use for this job, there are too many options out there, so please direct me. This part (and the 2. one also, I think) depend a lot on the OS, so suggest any OSs alongside w/ the technologies/frameworks.  Initially, all computers (or 1 for starters) hosting the back end are going to be virtual machines. Please do give suggestions to any part of the question, that you feel you have comprehensive knowledge and/or experience of. And also, point out if you feel that any part of the current set-up means an instant (or even distant) failure or if I missed a very important aspect to consider. I'm not looking for a definitive answer for how to achieve my goals, because there certainly isn't one, for I haven't provided you w/ all the required information. I'm just looking for recommendations and directions on what to look into. Also, bare in mind, that this isn't something that I have to get done quickly, to sell and let it be re-written by the new owner (which, I've been told for multiple times, is what I should aim for). I have all the time in the world and I really just want to learn doing something really high-end. Also, excuse me if my language isn't the best, I'm not a native. Anyway. Thanks in advance to anyone, who takes the time to help me out here. PS. When I do seem to come up w/ a good architecture/design for this project, I will certainly make it an open project and keep you guys up to date w/ it's development. As in what you could have told me earlier and etc. _For obvious reasonsthe very same question got closed on SO, but could you guys still help me?._


title: How to explain OOP to a matlab programmer?

text: I have a lot of friends who come from electrical / physical / mechanical engineering background, and are curious about what is "OOP" all about. They all know Matlab quite well, so they do have basic programming background; but they have a very hard time grasping a complex type system which can benefit from the concepts OOP introduces. **Can anyone propose a way I can try to explain it to them?** I'm just not familiar with Matlab myself, so I'm having troubles finding parallels. I think using simple examples like shapes or animals is a bit too abstract for those engineers. So far I've tried using a Matrix interface vs array-based / sparse / whatever implementations, but that didn't work so well, probably because different matrix types are already well-supported in Matlab.


title: Any empirical evidence on the efficacy of CMMI?

text: I am wondering if there are any studies that examine the efficacy of software projects in CMMI-oriented organizations. For example, are CMMI organizations more likely to finish projects on time and/or on budget than non-CMMI organizations? _Edit for clarification:_ CMMI stands for "Capability Maturity Model Integration". It's developed by the Software Engineering Institute at Carnegie-Mellon University (SEI-CMU). It's not a _certification_ , but there are various companies that will "appraise" your organization to various levels of CMMI, such as level 2 and level 3. (I believe CMMI level 1 is an animalistic, Hobbesian free-for-all that nobody aspires to. In other words, everybody is at least CMMI level 1, even if you've never heard of CMMI before.) I'm definitely not an expert, but I believe that an organization can be appraised for CMMI levels within different scopes of work: i.e. service delivery, software development, foobaring, etc. My question is focused on the software development appraisal: is an organization that has been appraised to CMMI Level X for software projects more likely to finish a software project on time and on budget than another organization that has not been appraised to CMMI Level X? However, in the absence of hard data about software-oriented CMMI, I'd be interested in the effect that CMMI appraisals have on other activities as well. I originally asked the question because I've seen various studies conducted on software (e.g. the essays in The Mythical Man Month refer to numerous empirical studies, as does McConnell's Code Complete), so I know that there are organizations performing empirical studies of software development.


title: Is this a pattern? Proxy/delegation of interface to existing concrete implementation

text: I occasionally write code like this when I want to replace small parts of an existing implementation:               public interface IFoo     {         void Bar();     }          public class Foo : IFoo     {         public void Bar()         {         }     }          public class ProxyFoo : IFoo     {         private IFoo _Implementation;              public ProxyFoo(IFoo implementation)         {             this._Implementation = implementation;         }              #region IFoo Members              public void Bar()         {             this._Implementation.Bar();         }              #endregion     }      This is a much smaller example than the real life cases in which I've used this pattern, but if implementing an existing interface or abstract class would require lots of code, most of which is already written, but I need to change a small part of the behaviour, then I will use this pattern. Is this a pattern or an anti pattern? If so, does it have a name and are there any well known pros and cons to this approach? Is there a better way to achieve the same result? Rewriting the interfaces and/or the concrete implementation is not normally an option as it will be provided by a third party library.


title: What's the benefit of object-oriented programming over procedural programming?

text: I'm trying to understand the difference between procedural languages like C and object-oriented languages like C++. I've never used C++, but I've been discussing with my friends on how to differentiate the two. I've been told C++ has object-oriented concepts as well as public and private modes for definition of variables: things C does not have. I've never had to use these for while developing programs in Visual Basic.NET: what are the benefits of these? I've also been told that if a variable is public, it can be accessed anywhere, but it's not clear how that's different from a global variable in a language like C. It's also not clear how a private variable differs from a local variable. Another thing I've heard is that, for security reasons, if a function needs to be accessed it should be inherited first. The use-case is that an administrator should only have as much rights as they need and not everything, but it seems a conditional would work as well:               if ( login == "admin") {         // invoke the function     }      Why is this not ideal? Given that there seems to be a procedural way to do everything object- oriented, why should I care about object-oriented programming?


title: What makes OOP "good"?

text: It's fairly obvious that OOP is viewed as a sort of silver bullet of programming today. In any computer science course, the merits of OOP are heralded. I would like to know why people like OOP. To be honest, combining procedures, types, and data structures into a single conglomerate seems bad to me. I'd much rather view data as simply data. I like to be able to think that I will pass the right data through a function and get the right output, and not have to consider that the data is capable of operating on itself. Also, I want to know if there are any good examples of robust programs written specifically with or without OOP, that have their source code available.


title: How is localStorage different from indexedDB?

text: localStorage and indexedDB are used for offline storage of data in HTML5. What are their key differences and which one is preferable in what situations?


title: Efficient algorithm to find a the set of numbers in a range

text: If I have an array of sorted numbers and every object is one of the numbers or multiplication. For example if the sorted array is `[1, 2, 7]` then the set is `{1, 2, 7, 1*2, 1*7, 2*7, 1*2*7}`. As you can see if there's n numbers in the sorted array, the size of the set is 2n-1. My question is how can I find for a given sorted array of n numbers all the objects in the set so that the objects is in a given interval. For example if the sorted array is `[1, 2, 3 ... 19, 20]` what is the most efficient algorithm to find the objects that are larger than 1000 and less than 2500 (without calculating all the 2n-1 objects)?


title: Running a process multiple times at the same time

text: I have a c++ program with opencv library which takes an image as input and perform pose estimation,color detection,phog. When I run this program from the command line it takes around 4-5sec to complete. It takes around 60%cpu. When I try to run the same program from two different command line windows at the same time the process takes around 10-15 sec to finish and both the process finish in almost the same time. The CPU Usage reaches upto 100%. I have a website which calls this c++ exe using exec() command. So when two users try to upload an image and run it takes more time as I explained above in the command line. Is this because the c++ program involves high computation and the CPU reaches 100% it slows down? But I read that the CPU reaching 100% is not a bad thing as the computer is using its full capacity to run the program. So is this because of my c++ program or is it something to do with my server(computer) settings? This is probably not the apache server problem because when I try to run it from the command line also it slows down. I am using a quad core processor and all the 4 CPU reaches 100% when I try to run the same process at the same time so I think that its distributed among all the processor. So I have few more questions: 1) Can this be solved by using multithreading in my c++ code?As for now I am not using it but will multithreading make the c++ code more computationally expensive and increase the CPU usage(if this is the problem). 2) What can be the reason of it slowing down? Is the process in a queue and each process is ran only a certain amount of time and it switches between the two process? 3) If this is because it involves high computation will it help if I change some functions to opencv gpu functions? 4) Is there a way I can solve this problems any ideas or tips? I have inserted the result of top when running one process and running the same process twice at the same time: Version5 is the process,running it once ![enter image description here](http://i.stack.imgur.com/V9KVi.png) Two Version5 running at the same time ![enter image description here](http://i.stack.imgur.com/h6aP4.png) Thanks in advance.


title: Java sql annotations ManyToMany relationships

text: I was wondering your thoughts on the best way to implement a SQL ManyToMany relationship in Java using annotations - in this case eBeans \- where there is extra data associated with the join. I have created a db diagram to help explain: ![An ERD](http://i.stack.imgur.com/brOxP.png) Using @ManyToMany on the organisation and users classes would create the join table but without the extra Job Title. Is the best way to implement this to create the Org_has_users class and use @OneToMany and @ManyToOne annotations? Would cascade on save ensure that I can access the full join relationships from both the Users and Organisations classes? I hope this is enough to get started. I am more interested in how you would implement this. Thanks! Anthony


title: TDD with SQL and data manipulation functions

text: While I'm a professional programmer, I've never been formally trained in software engineering. As I'm frequently visiting here and SO, I've noticed a trend for writing unit tests whenever possible and, as my software gets more complex and sophisticated, I see automated testing as a good idea in aiding debugging. However, most of my work involves writing complex SQL and then processing the output in some way. How would you write a test to ensure your SQL was returning the correct data, for example? Then, say if the data wasn't under your control (e.g., that of a 3rd party system), how can you efficiently test your processing routines without having to hand write reams of dummy data? The best solution I can think of is making views of the data that, together, cover most cases. I can then join those views with my SQL to see if it's returning the correct records and manually process the views to see if my functions, etc. are doing what they're supposed to. Still, it seems excessive and flakey; particularly finding data to test against...


title: Linux OS developers : do they unit test their code?

text: Linux OS developers : do they unit test their code ? If yes :   * since this OS is coded in C, how do they manage to write effectively unit tests in this language ?   * what are the "zones" in OS where unit testing is easier to write ? where is it harder ? where is it valuable ?


title: Why categorization into "Property" and "Methods"

text: I am looking at the String class in Actionscript 3.0. It's having a property String.length . Internally it's a getter function ( or method ?) returning the length of string. Why it can't be String.getLength() ? Methods can take in 1, 2 or more values.. so their significance can be understood. But what significance "property" has. As it's afterall, a function only. So, why categorization into properties? Just adding an overhead botheration to remember that something has been categorized into property ? In other words, as a programmer, how i am helped, when i am told that String.length is a property of String class. And you can't find any method for the same. While writing a program, how i would know what is a property, and what is a method? Appreciate having some light on this. V.


title: which license fits my needs?

text: Which license would fit the following requirements the most?   * Everyone is welcome to make updates and use the source code    * But nobody should sell it or sell an application that is using it, unless they make a deal with owners


title: Is it ok to include jQuery in a jQuery plugin?

text: The question jQuery plugin file including the jQuery library came up today on stackoverflow, and I strongly advised against including jQuery in the plugin. I didn't really get any support from others on this; in fact there was more support to include jQuery than not. Is this ok or are there good reasons not to do this? I think it's a really bad idea as I think it should be up to the developer using the plug as to what version of jQuery is being used.