title: Trying to understand 3 layer programming

text: I am confused to understand the structure of a 3 layer programm. Where is good place for exceptions, entity and etc.? If I use MVC, in my UI model, how to transfer entity class to model class and etc.? I have created a project that called Ramznegar. It is web project. In this a user can register and get a account. Then login and can create category, like gmail, yahoo, etc... In each category user can add any item and its password. This programm actually is password keeper. For developing this program I created four project with following structure:   1. RamznegarDAL: contains all DAO file    2. RamznegarBLL: contains logic of the program. like password decrypt and encrypt class   3. RamznegarUI : contains all `JSP` and `Servlet` class.    4. entity : contains 2 type of classes. `entity` (like Category, Item and User class) and `exceptions` (include all exception class that use in program like `DataSourceAccessException`)   `RamznegarDAL` use `entity` as library.   `RamznegarBLL` use `RamznegarDAL` and `entity` as library `RamznegarUI` use `RamznegarBLL` and `entity` as library. Now, please say me this structure is correct or if I have a problem with 3 layer concept.


title: How do you program a way to create mathematics formulas?

text: For one of my project ideas, I want to create a dice rolling app. It would allow people to setup somewhat complex combinations of dice roll cascades in a visual way. I have a pretty good idea on how I would program the logic for the dice, namely as if you're creating a math formula; Class:               Formula      Properties:               Left formula     Right formula     Function      Thus, adding `X = A + B` would consist of Formula `X`, with left `Formula A`, right `Formula B` and function `Add`. Formula A and B would consist of left `a` or `b`, right `null` and function `Constant`. This approach seems fine to me, but I like to try and find approaches others have come up with. However, because 'programming math' tends to lead to completely different questions (of the 'Do I need to learn math to program' or 'How do I program this formula' variety), I'm having difficulties finding other approaches.


title: OOP Design: relationship between entity classes

text: I have at first sight a simple issue but can't wrap my head around on how to solve. I have an abstract class `Compound`. A `Compound` is made up of `Structures`. Then there is also a `Container` which holds 1 `Compound`. A "special" implementation of `Compound` has `Versions`. For that type of `Compound` I want the `Container` to hold the `Version`of the `Compound` and not the `Compound` itself. You could say "just create an interface `Containable`" and a `Container` holds 1 `Containable`. However that won't work. The reason is I'm creating a framework and the main part of that framework is to simplify storing and especially searching for special data type held by `Structure` objects. Hence to search for `Containers` which contain a `Compound` made up of a specific `Structure` requires that the "Path" from `Container`to `Structure` is well defined (Number of relationships or joins). I hope this was understandable. My question is how to design the classes and relationships to be able to do what I outlined. EDIT: Kind of translation issue. with version i did not mean in terms of "versioning" but more in terms of "different variety" but fundamentally the same. There is no active / inactive. All are active. EDIT 2: Also note that these classes are entity classes and hence complex inheritance and hierarchies can be problematic. EDIT 3: Just don't see how either pattern (Composite, decorator) can work. I tried but the problem is the "path traversal", eg. implementing it in the context of Spring-data and QueryDSL. I've created Class diagramm with comments that might help to understand the issue. Batch = Version. ![Class Diagramm](http://i.stack.imgur.com/s3Mgf.png)


title: Implementing oAuth 2 server

text: Do you have any pointers on how one should go about implementing the oAuth2 protocol itself? That is, the server side or the "provider" facet of OAuth2? If you have tried to implement (a part of) it, please share the issues and the solutions. Note that this is completely technology and programming language agnostic - except, of course, for the de-facto standard cryptological technologies that might be involved. The IETF draft (v23) for oAuth2 is located here


title: Refactoring an existing MVC codebase to remove business logic & data access from the Controllers

text: Product I've inherited has the following composition:   * MVC web site where the controllers make calls to Repositories to get, insert and update objects retrieved that are  defined in the:   * Data access layer written using Linq2SQL This means that currently the controller for the action /Account/Add will perform the following pseudo-code:   * Get the current user   * new() an AccountItem object   * Set the UserId, AccountItemTypeId and Value fields on the AccountItem   * Get an instance of Repository   * Call the repositorys InsertOnSubmit(AccountItem item) method   * Call the repositorys SubmitChanges() method   * new() an EmailQueue item   * Set the appropriate properties on the EmailQueue item (to, subject, body, etc,..) based on the inserted account item   * Get an instance of Repository   * Call the repositorys InsertOnSubmit(EmailQueue item) method   * Call the repositorys SubmitChanges() method I've already made a first pass through the codebase and injected, using Castle Windsor, the repository's in (actually injecting an instance of a type that implements `IRepositoryResolver` which has a method called `GetRepository<T>` so that I can decouple the controllers from the Linq2SQL dependent repositories. I've also started to write unit tests, based on the current behaviour of the controllers (to ensure that when I make further changes I can identify when I get it horribly wrong) but that's tangenital to my actual question. I've identified lots of places where the controller actions are performing identical actions against various repositories, such as getting a given users total `Value` for all `AccountItem`'s and am now considering extracting all this common logic into a business/service layer. My question is, would the following structure be considered "best practice":   * `AccountService`: Provides an `AddAccountItem` method (plus others such as `GetAccountValue`)   * `EmailService`: Provides an `AddEmailToQueue` method Should I be refactoring the controller so it does:               accountServiceInstance.AddAccountItem(userToCredit, userCrediting, AccountItemType.Bonus, 300);     emailServiceInstance.AddEmailToQueue(userToEmail, EmailType.AccountCreditBonus);      Or, should my `AccountService` take an `EmailService` as a dependency (that's satisfied by Castle Windsor) and it's the responsibility of the `AccountService` to call `EmailService.AddEmailToQueue`?


title: Naming: objectAction or actionObject?

text: The question, Stored procedure Naming conventions?, and Joel's excellent Making Wrong Code Look Wrong article come closest to addressing my question, but I'm looking for a more general set of criteria to use in deciding how to name modules containing code (classes, objects, methods, functions, widgets, or whatever). English (my only human language) is structured as action-object (i.e closeFile, openFile, saveFile) and since almost all computer languages are based on English, this is the most common convention. However, in trying to keep related code close together and still be able to find things, I've found object-action (i.e. fileClose, fileOpen, fileSave) to be very attractive. Quite a number of non-English human languages follow this structure as well. I doubt that one form is universally superior, but when should each be used in the pursuit of helping to make sure bad code looks bad?


title: Safe iPhone app ↔ server communication

text: What would be the best approach to achieving private communication between my iOS app and its server component? Is having a single unchanging “secret key” baked into the app source enough, or do I need to set up generations of such “handshake” keys dynamically somehow? The server by itself doesn’t have access to any sensitive data, so even if the user hits some private endpoints, it won’t get them anywhere, but I just want those to be hidden from the public. Basically, I want to ignore all requests hitting particular routes, unless they are coming from my iOS app. The server component runs on RoR, if that’s important.


title: Design decision - why generate <p> without </p>?

text: **tl;dr** Some widely used programs, which generate html, will only generate opening paragraph tags, and not closing ones, assuming that the browser will properly close paragraphs. On the face of it, it seems to me that the assumption that browsers will properly close paragraphs is not correct. Is my interpretation correct? More generally, what tradeoffs are involved in this kind of decision? * * * Browsing through moinmoin source code, the following line of code caught my eye:               # We only open those tags and let the browser auto-close them:     _auto_closing_tags = set(['p'])      (source) After reading throug the rest of the implementation, I've convinced myself that yes, indeed, when moinmoin generates html code for one of its pages, it will correctly generate paragraph open tags, where appropriate, while at the same time purposefully avoiding any of the paragraph close tags (despite being able to trivially do so). For my specific, rather unusual, use case, this behaviour is not correct. I'm tempted to submit a bug report and/or change the behaviour. However, it looks like this design decision was thoughtfully made. I'm not well enough versed in the intricacies of the html standard, or the various browser implementations, to be able to tell if this is correct behaviour in general, and I have the feeling that my instinct to correct/change this behaviour might be misguided. Is this code making a valid assumption about browser implementations? Is the generated html valid? More generally, what tradeoffs might I be missing here?


title: How should one properly comment and license a set of code files before uploading to the public?

text: I've written a decent chunk of code over the past few days and I'm ready to `git init` it and push it to github. But before I do so, I want to do this the "correct" way in case anyone else wants to use my code. So I guess I need to pick a license (probably MIT) and implement it, and write some sort of comment at the top of every file. What is a good style comment to put at the top of the file? What info should it include, what should it look like? And do I put the license in a LICENSE folder in the root directory, or at the top of every source file or something? And are there any other steps I'm missing before throwing this up to github?


title: Why aren't all programs being turned into web apps?

text: To extend from the question things like googledocs can handle word, excel and powerpoint so why aren't all programs being moved to web applications with the use of smartphones(blackberries, iphones and androids) and tablet pcs(ipad) increasing why isn't there a move to get every program browser based? With the increased capability of CSS and javascript surely this makes sense no need for clunky java programs which are 10 years old which just write to a database, that a rails/django application could probably do quicker and cost less money to maintain.


title: Results stored in a session - good idea?

text: To give a bit of background, lets say it's a generic results page, which is paginated so there are X results per page. Generally to do this, I have two queries on the page:   1. to get the total number of results   2. to get the results, limiting by the correct page's resultset However, recently I've been trying to cut down on the queries the site is making, and I thought one way to do this would be to only do the query if any parameters to the page have changed (except of course the page number)?   This would then cache all the result id's in a session, which can be sliced when I need to return the correct resultset for that page. I was trying to look around the net to see if there are downsides of this method, but I've found very little information about it. Has anyone done this before? Is it a good idea?


title: What's the difference between Microsoft's MCSD and MCPD certications?

text: I am looking on the website but the difference between the two isn't explained. To complicate matters a Google search tells me that developers should focus on the MCPD qualifications but an examination of the MCPD section of the site is telling me that the Web Application exams will expire in July 2013! It seems out of date. Meanwhile the MCSD exam seems to be a lot more up to date with references to HTML5/ASP.net 4.5 MVC applications! What's the difference? Are the MCPD certifications going to be updated after July?


title: Lua and multi-paradigm programming: scope and capabilities

text: Despite having started learning programming with Pascal and C, after the jump to OO (C++, Java) I lost sense of the structured programming paradigm. I have started learning Lua and I have researched many tutorials, but all of them only cover basic operations and language features and capabilities. They feel more like a reference doc than a programmer's guide. Now, when trying to work with day to day tasks, how does one go through most common design patterns like observer, or multithreaded programming, creating UI elements and polling system calls for keyboard or sensors? Is it even feasible in this languages or you have to work with the C binding, libraries and low-level programming to get most stuff done? Do I get the Lua scope wrong?


title: Should we bind view to a model property or ViewModel should have it's own..?

text: I am starting a project with following technical environment : .Net 4.0, Entity Framework 4.0, WPF with **MVVM Architecture** I saw lots of examples on the net, some books with this environment. In some of the examples authors had this Idea :   1. Viemodel will have an instance of Model class (Entity Framework Entity e.g. Person)   2. Bind the WPF view controls to the properties of Model While some authors did :   1. Viemodel will expose all the properties of the model.   2. Bind the WPF view controls to the properties of ViewModel rather than to the model directly. So is it a good idea to let the view bind property from model rather than viewmodel exposing it's own? Or which is more preferred?


title: Mobile/Global User Authentication? (Non-domain and non-enterprise)

text: What is the current way to authenticate users in a mobile/global fashion? In other words, assume a mobile application. And if there is a database server in the backend, how would these users typically register/login? Is there a current standard for non-domain, non-enterprise authentication? I was thinking just having a **basic username/password combination** , and **hashing** (and salting) the password on registration and login, and passing that over the wire to the cloud database. That gets a little fuzzy with password resetting, emailing, etc. though. Is there an _easier way_ (API, methodology, etc.) or _more-accepted way_ to do this? It's simple, but that simplicity is a good thing, I think. I don't need the complexities of other membership frameworks. I'm more curious if this is an accepted and secure approach. I am aware of ASP.NET's membership model, but the complexity is just way too much for a one-dimensional security model (users and auth, no need for roles, authorization, etc.). Not to mention, outside of an ASP.NET application, what would be used?


title: Database design: circular reference but dynamically created

text: I am trying to design database for this case:   1. Assignments have vectors, relation is 1:N   2. Assignments have submissions, relation is 1:N   3. Submissions have executions, relation is 1:N   4. Every execution have one vector. ![Database EER diagram](http://i.stack.imgur.com/MEHHW.png) Business logic   1. teacher creates assignments and defines test vectors   2. student upload his solution, so record in submissions is created   3. After successful compilation of submission, submission is executed with defined test vectors. Each execution is one record in executions (One execution per vector). So circular reference is created after successful execution, but if compilation failed no record is created in executions. Link between vectors and executions is needed for score calculation process, where is reference output from vectors compared to output from executions. So in my case, circular reference is not persistent, but it depends on runtime, so it is wrong design?


title: Understanding Front End vs Back End Javascript?

text: I've been noticing lately, as I've played around with javascript, HTML5, and node.js for the first times that javascript seems to be a language that is used very differently (and with different syntax) depending on where it is used at. My observation with javascript is this: -Front end javascript finds the JS embedded in HTML5 pages, where it is used to build dynamic webpages and react to events that occur on the page. -Back end JS is used as a solo language with node.js and its associated packages to handle web page requests, data transfers, and general server tasks. Have I accurately summarized front end versus back end JS?


title: Publish programming problems from interviews

text: I have read in a few places that publishing programming problems/puzzles/exercises from interviews is not nice with the company, but I have recently had a few interviews where I faced some interesting problems I really wanted to discuss with those who could have solved them better. Do you think that is fine if I don't copy-paste these exercises but try to "make my own version", for example rewriting it a bit so the whole point will be the same but in another format? Also if I didn't mention the company itself, not even the fact the problem was asked on an interview, would it still be a bad thing to do? Thanks in advance!


title: Is a Master's worth it?

text: I know there are a few questions already about getting a Master's degree in Computer Science, but my question is a bit different. I've started programming when I was quite young. I did receive a BS in CIS at Cal Poly Pomona over 4 years ago. Since then I've made a good living as a programmer for both Boeing and Disney (where I currently work). I feel that I've made very good progress as I quickly became a Sr. level developer in both companies within a year. I had considered getting a master's for a couple of years and finally started it a few months ago at Claremont Graduate in their MSIS program (http://www.cgu.edu/pages/201.asp). I've only taken a couple of courses but already I'm feeling like I already know this stuff and work with on a daily basis. I'm even wondering if it is worth me getting another "IS" degree and if I should look at a Computer Science degree instead. I had a couple of reasons of not going to CS in my undergrad, 1) I'm not great at math 2) I wanted to have a business degree to open up my options. I feel I'm a very competent programmer though and can work in a variety of languages, understand the software development process, etc. I'm just trying to figure out if I'm wasting my time with the current program I'm in. Sorry for the lengthy post, but I wanted to give some back story for better understanding.


title: I'm forced to write bad code. How do I save my face?

text: I'm only a junior developer but my job forces me to work with really terrible PHP code (think about the worst PHP code you've seen; then think about code twice as bad). I usually try to fix bugs and fight with the codebase to add new features. Sometimes I'm ordered to get things working ASAP which more often than not involves dirty hacks. The product was previously open source and I am concerned that it might go open-source in the future. I would be ashamed if someone (especially potential employers) could find my name next some of the changesets. What can I do to protect my good name? I am not sure if this is relevant but I'll add that neither my boss nor my colleagues want to admit that the code is bad, but I'm not sure I can blame them for that -- for many of them this is their first job.


title: How can I make sure that I'm actually learning how to program rather than simply learning the details of a language?

text: I often hear that a real programmer can easily learn any language within a week. Languages are just tools for getting things done, I'm told. Programming is the ultimate skill that must be learned and mastered. How can I make sure that I'm actually learning **how to program** rather than simply learning the details of a language? And how can I develop programming skills that can be applied towards all languages instead of just one?


title: Are your projects completed on time or past the deadline?

text: Are your projects completed on time? If not, what problems cause you to miss deadlines? How can they be overcome? Do your clients understand them?


title: modelling a restaurant availability search

text: I am looking into finding an efficient way which can scale up to thousands of restaurants, for doing a reservation search. Ideally, it would be efficient to answer queries like find a restaurant which has availability for 6 people at 19:00. Time slots are based on 15-minute interval, e.g 19:00, 19:15, 19:30, ... I am using a document database (RavenDB), but the issue is more conceptual and I don't think it is dependent on the underlying datasource. Each restaurant can have a different amount of capacity, for example restaurant A might fit 40 people, while restaurant B might fit 60. My first instinct was to have a `Restaurant` collection, and a `Reservations` collection. However, I cannot think of a way how an efficient query can be made on the restaurant/reservations collections to actually get a result for a restaurant only if it has enough space at that particular time for a booking. Sample data objects below:               Restaurant     ----------     Id     Name     Capacity          Reservation     -----------     Id     DateTime     RestaurantId     NoOfPeople        The other option that came in mind was to actually keep a track of each day and all the timeslots in a day (each 15 min interval). Then, with each booking, each respective timeslot is updated. Hence, the query would be a simple search on the timeslots. This would work (haven't tried it yet), but it involves more _'maintenance'_. Is this the best way to go for such a problem, or is there maybe a side of it which I'm not seeing? ## Computing availability on bookings My idea for the second option, to compute availability for bookings is that I would add another data object, as below               RestaurantTimeSlot     ------------------           RestaurantId     DateTime (e.g 18/02/2014 17:00)     AvailableBookings      MaxBookings      A background task would create new time slots for restaurants for subsequent days, example creating up to 90 days in advance so that users can book a maximum of 90 days from today. Each day would have all the different timeslots, example 00:00, 00:15, 00:30, so on so forth. Initially, the `RestaurantTimeSlot` would be set as `AvailableBookings` = 0, `MaxBookings` = maximum bookings of that restaurant (e.g 60). The reason for `MaxBookings` is because a restaurant availability might be based on time, and in 2012 it might have availability for 60, while in 2013 it might expand to 80. Then, when a booking for say 4 people is made at 18/02/2014 17:00, that respective timeslot's `AvailableBookings` would be added by 4. Then, when a search needs to be done, one would search easily in `RestaurantTimeSlot`. Does this make sense? My issue that having to constantly create these new data objects so that they are available for search, and keeping them in sync when a new booking is made. This looks like it can lead to the system being more error-prone.


title: Vertical alignment: yea or nay?

text: For instance, non-vertically aligned:               Name:   Hamt     Version:  0.1.0     Cabal-Version:  >= 1.2     License:  BSD3     Author:  Jason Baker      Or vertically aligned:               Name:           Hamt     Version:        0.1.0     Cabal-Version:  >= 1.2     License:        BSD3     Author:         Jason Baker      Which do you prefer and why?


title: How to manage accidental complexity in software projects

text: When Murray Gell-Mann was asked how Richard Feynman managed to solve so many hard problems Gell-Mann responded that Feynman had an algorithm:   1. Write down the problem.   2. Think real hard.   3. Write down the solution. Gell-Mann was trying to explain that Feynman was a different kind of problem solver and there were no insights to be gained from studying his methods. I kinda feel the same way about managing complexity in medium/large software projects. The people that are good are just inherently good at it and somehow manage to layer and stack various abstractions to make the whole thing manageable without introducing any extraneous cruft. So is the Feynman algorithm the only way to manage accidental complexity or are there actual methods that software engineers can consistently apply to tame accidental complexity?


title: What graph traversal algorithm should I use?

text: I would like to write an algorithm which can traverse a graph and hopefully later I can implement it to use for an indoor navigation system. The graph would come from floor plans of a building and the graph nodes represent the building objects such as doors, corridors, stairs, rooms, etc. The navigation system will accept different users with different capabilities, these capabilities are stored in user profile. For each individual user (or a group of users of the same type, e.g. staff member) the system returns a path specific to that user/s considering his personal functionality. For example if the user of the system is using a wheelchair the system should exclude all the stair nodes from the path (they will be marked non-traversable). Similarly if in order to enter into an indoor space, the user needs to have a key or be an staff member but he is NOT, the system should mark the node (e.g. the door which requires the key) non-traversable and should search for those paths which don't require these specifics requirements. This was the first part and here I use a function to check these conditions for a given user. The inputs to this function are a node and a user. If the conditions that are required by the node are NOT fulfilled (means user profile doesn't match the condition required by the node) the function returns false= non-traversable. If the condition holds true, the node stays isTraversable and will be stored somewhere and will be considered for the final path calculation. The second part is that I have a list that contains all the nodes that are traversable and now the shortest path will be calculate based on 3 different costs, Energy, time and money. The final cost can be a combination of these costs and it sets the weights for the edges. My problem is with the first part. I want to know how can I make an algorithm that produces the subgraph (the list with the traversable nodes in it). And later how can I use this algorithm to modify Dijkstra to fit this system. Can anybody help with writing a pseudocode for the algorithm so that I can understand how would it work in clear steps or any hints on how can I make these steps into pseudocode? Please note that at this stage the performance is not very important for me.


title: Is good code impossible in modern software development?

text: It seems that even that developer tools has become more solid and robust, writing good code has become a challenge. Even that tools are more powerful, quality of code haven’t got better. I come up with two important factors, there is less time and the projects are more complex. Because tools we use today are more powerful it is easier to write more complex code, but having no time to plan and without looking back decreases code quality and increases bugs and maintenance. It is not that we didn’t write complex code before. It is that we write more complex code. My question is the following: Considering we have more powerful language and tools.   * **Why is writing good code more difficult?**   * **Do factors, time and complexity contribute to this?**   * **Are methodologies not practiced correctly?** The type of project I consider is enterprise application with large complexity and business logic. The definition of “good code” is individual please don’t get stuck in the interpretation of “good code”.


title: Best practice- handling images on website

text: I am porting an old eCommerce site to MVC 3 and would like to take advantage of design improvements. The site currently has product images stored in 3 sizes: thumbnail, medium (for display in a list) and expanded for a zoomed look. Right now we are having to upload 3 separate images that are sized exactly right, provide 3 different names that match what the site expects, etc., it is a pain. I'd like to upload just 1 file, the large one, then let the site reduce it to needed sizes, and I'd like the flexibility to change the thumbnail and list sizes depending on user preferences, form factor (e.g. mobile, iPad, desktop), etc. so might need many copies of the same image. My question is should the image be reduced then saved several times upon upload and if so what is a good storage/naming convention? The other idea is to store just the single image but resize it programmatically before serving it to the client. Has anybody done this and what are the tradeoffs besides a few more machine cycles? How do you pass a temporary image in memory to the client (there is no URL)?


title: Explain to me what interaction oriented programming is

text: There is this new kid on the block called Interaction Oriented Programming (IOP). Can somebody explains how it works? How does it compare to object oriented programming. Will this replace object oriented programming or will it just be a niche thing? What exactly is it and what is it's intended purpose.


title: GMail API for a small app (Rails? Javascript? PHP?)

text: I want to create an app that accesses the GMail API, but I'm finding that it isn't as simple as I thought it might be. I'm hoping somebody in the community here might have some experience working with one of these API's and could not only recommend the right solution, but also show me to some tutorials or examples that could help me get up and running. Here are some of the requirements of this app:   * Preferably in Rails or Javascript or even PHP. I am open to other technologies as well, but hope they'd be easy to implement.   * Connects to gmail via Oauth   * Can read who emails have been sent to and received from. Basically would like to perform some analytics on who emails are sent to, when and how frequently. I've read that one reason why this isn't easy, and why there isn't an official javascript API provided by gmail, is that google is concerned it's going to make their service less performant for their users.


title: Does abandon-ware code ever properly die?

text: It is my impression that, over time, more and more open source code is generated, added to various free or partially free repositories, and then generally abandoned. Are there any generally accepted standards for disposing of abandoned code? Should this be enforced by repositories, or would this be something that's up to the original code authors to do?


title: Does responsive web design go against the Separations Of Concerns principle?

text: I'm wondering how responsive design plays along with the Separations of Concern principle, in respect of how we're allowing a single implementation behave for multiple presentation devices (mobile, tablet, browser sizes etc.). Is it breaking the principle? If I make changes to a web page that I know is behaving responsively and should work on 5 devices for example, am I not making the development extremely difficult due to possible regression that can occur from a single place in the software? Sure it's making me write less code and work a lot faster on multiple devices, but now each one of my pages requires potentially much more thorough testing, which is the cost I could move to not using a responsive web framework and maintaining separate implementations of a page.


title: Should I worry about switching over from IPv4 to IPv6?

text: As you must be aware that IPv4 addresses ar almost over and the switch to IPv6 is imminent, should I, as a programmer need to worry about anything to make my applications work with the new system ? Please pardon my ignorance. Its always better to ask and learn than pretending to know-it-all.


title: What is the most effective way of communicating potential delays in software development?

text: In development, what is the best way to manage delays? For example, you're doing a task, new requirements come in/something which further steepens the learning curve of something that must be learnt right there and then, and you need to communicate this to the PM/manager. What is the most effective way of doing this?


title: Is web session "Bad Design"? Why?

text: the other day I was discussing with a colleague and he came out saying that using user's session in a web application is just wrong. I replied that it could be wrong depending by the information you are storing, otherwise why should a web session service even being provided by Microsoft (we were talking about ASP.NET). He replied to me, again, that even in MS they could easily reply me that it was bad design. And that he could show me some white-papers demonstrating that. Unfortunately I have no opportunity to contact this guy anymore, but I would really like to understand more about his point of view. Does anyone have information/points of view about that here?


title: JSP Include: one large bean or bean for each include

text: I want to refactor a webapp that consists of very distorted JSPs and servlets. Because we can't switch to a web framework easily we have to keep JSPs and Servlets, and now we are in doubt how to include pages into another and how to setup the use:bean-directives effectively. At the first step we want to decouple the code for the core-actions and the bean-creation into servlets. The servlets should forward to their corresponding pages, which should use the bean. The problem here is, that each jsp consists of different sub- and sub-sub-jsp that are included into another. Here is a shortend extract (because reality is more complex):   * head      * header     * top   * navigation      * actionspanel   * main      * header     * actionspanel   * foot      * footer Moreover each jsp (also the header and footer) use dynamic data. For example title and actionspanel can change on each page-reload or do have links and labels that depend on the processing by the preceding servlet. I know that jsp-include-directives should only be used for static content und should be avoided for dynamic content. But here we have very large pages, that consist of many parts. Now the core questions: Should I use one big bean for each page, so that each bean holds also data for header and footer beside its core data, so that each subsequent included jsp uses the same bean-directive? For example:   * DirectoryJSP <-> DirectoryBean   * CompareJSP <-> CompareBean Or should I use one bean for each jsp, so that each bean only holds the data for one jsp and its own purpose. For example:   * DirectoryJSP <-> DirectoryBean HeaderJSP <-> HeaderBean FooterJSP <-> FooterBean   * CompareJSP <-> CompareBean HeaderJSP <-> HeaderBean FooterJSP <-> FooterBean In the second case: should the subsequent beans be a member of the corresponding parent bean, so that only the parent bean is attached as attribute to the request? Or should each bean attached to the request?


title: Why is the Unix linker called "ld"

text: Tried to search the web and couldn't find an answer. It might have something to do with "load", but that doesn't make much sense to me. Obviously, "ln" was already taken, but where does that "d" come from?


title: Selecting a point inside a non-convex polygon

text: There are a lot of algorithms which will tell you whether or not a given point is found inside a polygon. I'm looking to write an algorithm which, given a non-convex polygon, will return a point which is inside the polygon. I don't need the point to be in any specific location inside the polygon, but I prefer to receive a point which isn't very close to an edge, but that is not a deal-breaker. It's there merely to mark that polygon's planar straight-line graph (PSLG) as an internal shape for use with Shewchuck's Triangle library for some complicated constrained Delaunay triangulations. My initial thinking is:   1. Compute the bounding box    2. Cast a ray from one corner in the direction of the opposite corner, or from the center of a bounding box edge to the opposite edge center.   3. Then, a point exactly between the first and second intersection will be inside the polygon. Is there a better approach?


title: Architecture for REST consumer

text: Are there any good samples of web applications that consume restful web services? I am developing a webapp with spring, and have come to the point of reading lists of elements and element details from a RESTful JSON api. I started developing as though I was using a database, creating services, model elements plus DAOS, but now I'm stuck on how to do a proper design here. Should model objects hold a fromJson/toJson method and encapsulate themselves the serialization info? What should DAO objects do? Where should I keep WS specific info (urls, api keys, item names, etc.)? Any good opensource apps would be nice.


title: How to update an existing excel file using java program?

text: I've made a file browser in java that opens and read already been made excel files. (using Apache poi 3.9 library) program read those files perfectly but i want to update some of those files. how can i be able to update those files through my program. is there is any library or function/class that might be helpful, or also any other language that can support that feature (among c/c++, python)..???


title: What is the average job duration in software engineering positions?

text: I was just curious to see if this was recently measured. How long do people expect to stay in a new job? How long do people actually stay within an organization or in a position?


title: Find index of item closest to value, but is also less than value

text: Let's say I have a sorted array of ints like so:               int[] numbers = new[] { 10, 20, 27, 30, 55, 70 };      What is the most efficient way, given a value, to find the value in that array (or the index of it) that is closest to the value but is not greater than the value? For instance, given the value 26, it would return the 20. Please note that the values in the array are dynamically assigned once when the program starts, but will not change for the duration of the program. The simple solution that I'm using now is this:               int GetNumber(int value)     {         foreach (int number in numbers)         {             if ((value -= number) <= 0)                 return number;         }              return -1;     }      It works, but it's not extremely fast. I'm hoping there's some kind of algorithm that allows me to "map" values to ranges or something that will make lookups faster. If it helps to know, I've used simple ints in my example, but the actual project I'm working on is a kind of segmented memory space where each of the segments are adjoined, but are of various sizes. This algorithm would allow me to pass in a memory address and get back the corresponding memory segment. This is the actual method that is currently in use:               public MappedMemoryArea GetArea(int address)     {         foreach (MappedMemoryArea area in _areas)         {             if (address < area.Size)                 return area;             address -= area.Size;         }              return null;     }      I have full control over the MappedMemoryArea type, so if adding a property to it would be beneficial for this purpose, it's totally doable.


title: An algorithm for a synchronization

text: I want to make a synchronization. What's the algorithm for it in a nutshell? 1) A client reads a local data and sends them to a server **afterwards**. The server compares them with its actual data, decides what are newer and overwrites its data with received data in case received data is newer. or 2) A client reads data from the server **first** , compares them with its local data and in case data from the server is newer, overrwrites them with the server data. And does the order matter?


title: How to handle complex views (consisting of several parts) in MVC web application

text: Lets say I am writing a blog web application using MVC pattern. Typical layout for the main page of the blog application is - some kind of a post index in the main part, and aside there are some addition parts, like timeline, tag navigation panel, subscribing panel, etc. Those controls also appear on a single post view, and may appear on other views I have. My question is - how should I handle those panels aside in my views and controllers. I see three approaches here:   1. Create a big viewmodel class that contains all the information required for rendering the view s (either index or single post). That case I could make these aside panels a partial views, and calling them from the view being rendered passing part of that big viewmodel. The drawback is - I will have the code filling viewmodel spread amongst various controller method, meaning code is duplicated. Which is quite bad.   2. Create another layer of view rendering. Say, the topmost layer of rendering recives a alreay rendered parts of html, or functions which when called outputs an html. The layer under this "combining partials layer" would give just partial views for each panel I want, include main content. The drawback here - memory usage. Most modern frameworks renders htmls directly to output stream, but in this approach partial views would be rendered into string objects first - which leads to memory overhead.   3. Use something like "RenderAction" from asp.net mvc, which calls a controller method from a view. I think this is a worst solution of 3 given, because it drops an MVC approach. The question is not tied to any specific framework, I want to understand the general way of doing things like that. **UPDATE** After an answer given, I've found out that post is not clear. So reasonable update here: Under _viewmodel_ term I understand an object that contains all the data required to render a particular view. All of three approaches involve building partial views with their own viewmodel. For example (using C# syntax):               class SinglePostViewModel {       string Text {get;set;}       string Title {get;set;}       string Slug {get;set;}       DateTime PublishedDate {get;set;}       ...     }          class TagNavigationPanelViewModel {       string TagText {get;set;}       int PostsCount {get;set;}     }          class CalendarNavigationPanelViewModel {       DateTime YearAndMonth {get;set;}       int PostsCount {get;set;}      }      My question is - how to nicely combine those partial views together.


title: RTOS experience

text: I have been working as an embedded software engineer on mostly 8 bit micro- controller firmware and desktop/mobile applications development for the past five years. My work on a WinCE project (in which I got introduced to .NET CF) was short lived. I did use core APIs for interrupt processing, peripheral communication, etc...but again, not exactly a pure RTOS environment. In order to get together more solid experience for growing more in the embedded field, I want to work more with RTOSes. Will buying an evaluation board with an RTOS and putting together a project at home be regarded as a good experience or will an online course be more useful? I am just not clear as to what will be regarded as good experience. Any suggestions or directions will greatly help me. I have a passion for the field but just a need a point in the right direction.


title: Dependency Injection vs Mixing Levels of Abstraction

text: I've been reading Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. One point he makes: > G34 Functions should descend only one level of abstraction However, I'm wondering about the functions that actually create the objects for an application. Say we have dependencies               App -> Book -> Database      Then using dependency injection, App would need to create both a Book and Database instance, and inject the database instance into Book.   * Is this an acceptable breaking of the mixing level of abstraction rule?   * If yes / no, why?


title: Algorithm for appointment reminders

text: My program allows users to store appointments in a calendar. What has been requested of me is the ability for SMS reminders to be sent to people to remind them of their appointment. The SMS would need to be sent out about 2 days prior to their appointment. I thought the best way to achieve this is to choose a time of the day (eg. midday) for the software to check to see which appointments are in 2 days time and then send out the SMS reminders to the people who have those appointments. Would this be an advisable approach to this problem? Is it advisable to have this happen at one time of the day, or would it be better to somehow spread it out over a longer time? I am assuming at this point that a background thread would be a good idea for this type of activity.


title: Serve content from server to remote embed HTML

text: The title is very bad so let me explain what I need to know. I have a server with let's say different images. What I want to achieve is be able to embed a frame, into any HTML site, and be the server the one that determines what image to show on that remote frame. Imagine the situation where you want to add a piece of advertising to your site, but you just need to paste a piece of JS or HTML into your HTML and be the advertising seller be in charge of showing whatever he wants on the size of the frame. My question is what is this technique/technology named ? What should I know, is it websockets ?, is it embedding ? How could I achieve this ? Thanks !


title: Viability of a Development Team with no *dedicated* Tester role

text: I've been thinking a lot lately about how to build a lean development team. Ultimately, I'd like to open up my own little software house with a small number of like-minded people. The goal won't be to become rich, but rather to have a healthy work environment. So far, I'm defining a lean team as the following:   * Small;   * Self-organizing;   * All members must have QA in mind;   * Members must be capable of performing multiple roles The last point is where I'm worried a bit because, as the mantra goes... > Developers make bad testers. While I understand that, often, developers are "too close" to their code or their colleague's code to make higher-level assessments of quality, I'm not convinced they are _de-facto_ bad testers. On the contrary, I'm of the opinion that the qualities of a good developer overlap greatly with the qualities of a good tester. Assuming this is correct, I've been thinking of different ways of getting around the dev/tester problem and I believe I have come up with a viable model. My model requires:   * A small software house with 2+ projects   * An Agile (iterative) approach to development and delivery   * 1 team per project   * All team members will be Software Developers      * Their job description will clearly state **Development** , **Quality Assurance** , **Testing** , and **Delivery** as responsibilities If all these preconditions have been met, then the projects can be organized in the following fashion (this example will refer to two projects, _A_ and _B_ ):   * Every team member will alternate between Developer role and Tester role   * If a team member is a Developer on project _A_ , they will be a Tester on project _B_     * Members will work on only 1 project at a time, and therefore are expected to be acting as _either_ a Dev _or_ a Tester.   * A **Role Cycle** consists of 3 iterations as a Dev and 2 iteration as a Tester (again, on two different projects)   * Project teams would have 3 Devs and 2 Testers at all times.   * Member Role Cycles should be out of phase by 1 iteration.      * This minimizes the abruptness of the team changes. For each iteration, 2 Devs and 1 Tester will remain the same as the previous iteration. Given the above, I see the following Pros and Cons: **Pros**   * Distributes project knowledge throughout the company.   * Ensures team members aren't testing the code they helped write.   * Out-of-phase role cycles means no project ever has a 100% member switch.   * Alternating roles breaks the monotony of boring projects. **Cons**   * The iterations of both projects are tightly coupled. If one project were to cancel an iteration halfway through and start again, then the two projects would be out of sync. This would make the role-cycle difficult to manage.   * Hinges on hiring Developers open working as Testers as well. I've received mixed reviews when discussing this approach with friends and colleagues. Some believe that few developers would ever want to alternate roles like this, while others tell me they personally would love to try it. **So my question is:** Could such a model work in practice? If not, could it be tweaked into a working model? _Note:_ For the sake of brevity I have only focused on the Dev and Tester roles. I'll expand on other roles if needed.


title: What is needed write an interface to Microsoft Dynamics GP web services?

text: We've went ahead and purchased Microsoft Dynamics (see edit history for why) in order to write 2 functions to interact with one tiny part of it to fulfill one big need. What I want to know is, from other programmers who have integrated their software with MS Dynamics GP. Is there any way to connect with it (fully) without having to write an interface in C#? We want to use GP SOAP services so we can communicate to it from Delphi and eventually Java, but it seems like the only way we're going to be able to maximize it's usefulness is to write some sort of middleware program in C#.


title: How to explain the difference between a variable and a key in a key-value pair?

text: Variables and the keys in key-value pairs are both identifiers for values, so, on a conceptual level, these seem very similar ideas. How would you explain the difference between these two concepts?   * Is it that key-value pairs are used in collections?   * Is it that variables point to a memory location?   * Or something else? (If I look at code, I'm instinctively aware of the difference, the question's more about how to explain it which doesn't seem too obvious given that they do similar things.)


title: Is Moore's law (empirically) the same for both memory capacity and processing speed?

text: Or, in other words, has memory and processing power increased over time around basically in the same rate, or we could say that one or the other has increased more? Has cost decreased in the same rate? And how about the near future? I am aware this question is not _directly_ related to programming, but I thought it would be better to ask it here for some reasons:   1. I work as a programmer, not a computer science theorist (so I probably would not find very helpful the kind of question I would receive from the Theoretical Computer Science site, for instance).   2. I prefer answers based upon a programmers real experience.   3. And I am worried about real programming-related issues, specially the functional x imperative debate. About the 3rd item: currently we've being seeing a lot of arguments about how the increase of using functional programming techniques is related to the now common multi-core machines, and how the free lunch is over [pdf]. But it seems to me that the functional paradigm is much more memory consuming (but this is an opinion, not a fact), and I have not seem many arguments about this future increase in memory needs. PS: Sorry about the not very good English, but I guess I have made myself clear (sort of).


title: Is there are problem holding large numbers of open socket connections for lengthy periods of time?

text: The application we have in mind is a relay server. The aim is to accept large numbers of incoming socket connections (at least thousands) that will stay open for lengthy periods (hours or maybe days). They will exchange modest quantities of data and they need reasonably low latency. The technical design is straightfoward and we have a test implementation. Our preference is to use Windows hosting and .NET, because that's the technology we know. However, this kind of usage is well outside what we are familiar with. The question is whether there are specific limits or constraints to be aware of that are inherent in or common to software that does this, and that we should allow for in our design and/or test for before a roll-out. I found this question (Handling large amounts of sockets) and this link (http://www.metabrew.com/article/a-million-user-comet-application-with- mochiweb-part-1), which tend to suggest that our solution should work. \-- Commenters have suggested opening and closing ports, or using some kind of protocol, without suggesting how. The problem is that at any time a message might be relayed to an individual known destination with the expectation that it be received quickly (say 1 second at most, preferably sooner). The destination is (in general) behind a firewall with unknown properties, so cannot (in general) run a server or accept incoming connections. It can only make outgoing connections. We think it needs a persistent outgoing connection in order to receive packets at any time without notice. Alternative suggestions would be of interest, although strictly off topic for this question. Other commenters have suggested there are OS limits, but not specified any. Assuming that this is some version of Windows server and some (perhaps large) amount of memory, are the limits likely to be a problem? Roughly what will they be? Is Windows a bad idea?


title: How to modify ELO algorithm when number of games is low to reduce outliers

text: I've developed the standard ELO implementation that can be found here, but the problem I'm running into is that my players will only have between 10 and 40 games in a "season". Since my first season has already completed (I'm just now starting my OWN rating system for my game), I know what the rank of my players ELO ratings should be, or at least very close to that. My problem is, after implementing that base algorithm, I have a some outliers that are way off. Since I only have 10 to 40 games, my first thought to remedy this situation was to implement a loop around this process, taking the end result ELO rating from one cycle, and use that as the starting point for the next cycle (for each individual player). Then, repeat these cycles until the average or max deviation of ELO ratings from previous to current cycles is not greater than X. This helped to resolve some of the big outliers. There are still some smaller outliers that I'm still not comfortable with... As an example, I have 7 divisions, for division 1, the guy that should be ranked #1 based on his ELO, ends up being ranked 5th, for division 2, the guy that should be ranked #1 is 3rd. The top 10 or so for each division are actually pretty close, except for these kinds of outliers. How can I modify my algorithm, or what approach can I take to try and reduce the outliers? Side note #1. For division 1, the guy that should be #1, that ends up #5, is actually ranked #1 for the entire season by the other rating system. I just don't know how that one is calculated (and it may not be calculated, it could be based on, I know x player is this good, so he's ranked #1). Side note #2. I have made a modification to the algorithm. I want to "weight" the wins/losses by how dominant they were. If player A beats player B 20-0, I want that weighted more heavily, especially if they ratings are very close, but if their ratings are further apart (where a is already greater than B), then the ELO change shouldn't be that much anyway since they were expected to win in the first place. So, what I did was instead of using the k factor/value of 400 like the original formula uses, I changed it to be `100 + ((score difference) * 2)`. So the max k factor would be 140 (20-0 is the biggest win, multiply by 2, add to 100). What other strategy could I implement to include weight results, as well as correct some of those outliers? * * * Without having the data in front of me (everything is at home), I'll try and sum up the scenario... ### Division I               #1 Elo Rating of 2250     #2 Elo Rating of 2200     #3 Elo rating of 2190     #4 Elo rating of 2175     #5 Elo rating of 2170      Where #5 guy just beat the #1 to win the tournament, and his "body of work" seems more complete than the #1 guy (aka he played against, and beat stronger opponents than the #1 guy did). Maybe it's because the "weighted" k factor is throwing this off because #5 had lots of wins that were by only 2 to 5 points, where #1 wins were by a higher margin, say 5 to 10 points. Maybe I just need to play around with my "weighted" k factor to see if I can get my calculated results closer to the actual results...


title: Defer items during sprint or at the end of sprint

text: When tasks take longer than expected, why is it better to defer items during a sprint than to just defer everything you didn't finish on the last day of the sprint?


title: How can I make the life of a new hire comfortable?

text: As a senior member of a software team that, unfortunately, has little documentation for legacy reasons, what are the things that one could do to make a new hire comfortable? I have been planning debug sessions with the person on specific defects/feature requests to get him/her acquainted with the code base. However the code base is real large, and its only a fixed amount of code I can expose the person to in this manner. I am looking for suggestions in either cases when the new hire is a recent graduate or an experienced professional.


title: Which "ebook" format for digitizing/coding project?

text: Does anyone have a suggestion for digitizing + OCR'ing a printed corpus with images? I have 1,200 pages of text sprinkled with essential photographs. Assuming I have perfect scans of the pages, what are my options for preserving the layout of the original text and allowing me to feed this to a program?


title: Using a Public Property AND a Public Field

text: Where I work, using Properties are discouraged. We have code generation tools to "speed things up". All object data ends up being Public fields. If you request properties anyway, you get something like this:               Public sFoo as String          Public Property Foo as String       Get         Return sFoo       End Get       Set(ByVal value as String)         sFoo = value       End Set     End Property      I can't think of a reasonable argument to do this. Are there any good reasons to use both a Public Property with a Public Field?


title: How can I conceptually model a craigslist search?

text: I'm trying to understand how something like this works, but I'm inexperienced and I'm trying to understand how the process would work. Say you have ten categories, a thousand zip codes, and ten thousand items listed in each category, each of which has a description. When a user does a search for (e.g.) "guitar hero xbox" in the "video games" category within "50 miles", what happens next? Would the database compare zip codes first, to find everything in range, then do a `SELECT items WHERE category="video games" and zipcode=A OR B OR C OR D`, then execute some sort of search on the description of each listing in the result set? How would that work? I'm not looking for exact answers about CL, I'm looking for a general idea of how this works anywhere/everywhere.


title: Has the term "Service Oriented Architecture" become meaningless jargon?

text: I was asked today if I had experience with "Service Oriented Architecture" and although I think I do. The concept, to me, seems so muddled I don't know how you could honestly answer that question anymore. I resorted to Googling the term in an effort to get a concise definition of the concept and how it differs from other architectures. After reading a number of articles on it, the only common thread I seem to be able to find is a system with multiple components that talk to each other over some kind of interface, with perhaps a slight preference for XML/SOAP. It seems like almost any application could be defined as SOA, especially a web application. Has this term fallen into the "Web 2.0" trap and become a term meaning whatever you want it to mean? Am I way off base here? When you guys hear the term does it mean anything specific to you? If so I'd love a concise definition that clearly demonstrates what is and what specifically is NOT SOA.


title: Would you fork an open source project because it's "poorly managed"

text: If you know of an open source project whose organizer   * has gotten really busy that he doesn't maintain it that much    * and he's the type of guy that doesn't accept contributions until a few months later (busy I guess) if at all   * and the project is starting to flounder  would you fork this project, give it a new name, and continue working hard on it and build a new community around it that's more encouraging to code contributions? Basically a better managed project since the concern now is bad management.


title: Evaluating a product owner

text: How do you evaluate a product owner? More specifically, how would one conduct a performance review of a product owner? What qualities or characteristics would one look at when reviewing a product owner?


title: Is It "Wrong"/Bad Design To Put A Thread/Background Worker In A Class?

text: I have a class that will read from Excel (C# and .Net 4) and in that class I have a background worker that will load the data from Excel while the UI can remain responsive. My question is as follows: Is it bad design to have a background worker in a class? Should I create my class without it and use a background worker to operate on that class? I can't see any issues really of creating my class this way but then again I am a newbie so I figured I would make sure before I continue on. I hope that this question is relevant here as I don't think it should be on stackoverflow as my code works, this just a design issue.


title: Intern Screening - Software 'Quiz'

text: I am in charge of selecting a new software development intern for a company that I work with. I wanted to throw a little 'quiz' at the applicants before moving forth with interviews so as to weed out the group a little bit to find some people that can demonstrate some skill. I put together the following quiz to send to applicants, it focuses only on PHP, but that is because that is what about 95% of the work will be done in. I'm hoping to get some feedback on   A. if it's a good idea to send this to applicants?   B. if it can be improved upon?               # 1. FizzBuzz     # Write a small application that does the following:     #   Counts from 1 to 100     #   For multiples of 3 output "Fizz"     #   For multiples of 5 output "Buzz"     #   For multiples of 3 and 5 output "FizzBuzz"     #   For numbers that are not multiples of 3 nor 5 output the number.          <?php                    ?>          # 2. Arrays     # Create a multi-dimensional array that contains     # keys for 'id', 'lot', 'car_model', 'color', 'price'.     # Insert three sets of data into the array.          <?php                    ?>          # 3. Comparisons     # Without executing the code, tell if the expressions     # below will return true or false.          <?php              if ((strpos("a","abcdefg")) == TRUE) echo "True";         else echo "False";         //True or False?              if ((012 / 4) == 3) echo "True";         else echo "False";         //True or False?              if (strcasecmp("abc","ABC") == 0) echo "True";         else echo "False";         //True or False?          ?>          # 4. Bug Checking     # The code below is flawed. Fix it so that the code     # runs properly without producing any Errors, Warnings     # or Notices, and returns the proper value.          <?php              //Determine how many parts are needed to create a 3D pyramid.         function find_3d_pyramid($rows) {             //Loop through each row.             for ($i = 0; $i < $rows; $i++) {                 $lastRow++;                 //Append the latest row to the running total.                 $total = $total + (pow($lastRow,3));             }             //Return the total.             return $total;         }              $i = 3;         echo "A pyramid consisting of $i rows will have a total of ".find_3d_pyramid($i)." pieces.";          ?>          # 5. Quick Examples     # Create a small example to complete the task     # for each of the following problems.     #   Create an md5 hash of "Hello World";     #   Replace all occurances of "_" with "-" in the string "Welcome_to_the_universe."     #   Get the current date and time, in the following format, YYYY/MM/DD HH:MM:SS AM/PM     #   Find the sum, average, and median of the following set of numbers. 1, 3, 5, 6, 7, 9, 10.     #   Randomly roll a six-sided die 5 times. Store the 5 rolls into an array.          <?php                    ?>


title: What do you call a queue when the word queue is reserved?

text: I'm working on a rails app, and in rails `queue` is a reserved word. I need to make a Queue model for my app, and I'm stuck because I don't know what else to call it. Has anyone else run into this before, and if so what did you call your Queue that can't be called a Queue?


title: Small self-contained windows desktop application technologies?

text: Firstly, I'm not new to this. I've written desktop applications for Windows going back to 1991 with Visual Basic 3.0. I've used C/C++ and Win32 API, VB3-6, C# 1.0-4.0 and currently knock out web applications in ASP.Net MVC. However I haven't touched desktop stuff since 2000 in depth bar playing around with some ClickOnce deployed WPF stuff in C#. However, I've recently stumbled on a requirement to throw out a small, self- contained .exe standard windows desktop application. I don't want to ship any major dependencies with it. In fact, I'd rather like it to be uTorrent style i.e. small, self-contained and without masses of crud around it and possibly UPX packed. This is part of the manifesto of the software: simplicity and the ability to install in a user LocalAppData folder. This is a diagnostic tool which will be used by our users and will scan the system and report various bits of specific information back to our web servers. This has to work on pretty much everything back to win2k. I really don't want to have to go right back to Win32 if possible. Now when I look around, everything has descended into a confusing mush of MFC, ATL, Managed C++, WTL, WPF, Metro and various other bits of string and sticky tape. Either that or heavy frameworks like Qt, Gtk and Wx. The question is simply: What, apart from Win32, is the best starting point for an application of this type? Or should I just write "yet another win32" wrapper?


title: Comparing one's self to others during interviews

text: I'm often asked at some point during the interview process to compare myself to my peers. For example, one of my first after-graduation jobs asked me to compare myself to my classmates. A job I recently interviewed for asked me to compare myself to my coworkers. I always play this down quite a bit. I'm always worried that, "I'm miles above everyone around me," sounds too arrogant. When push comes to shove though it is the truth. I graduated at the top of my class. I had a 3.99, the highest GPA of anyone else that year. My fellow students bitched and moaned about things like having to use the console to write "javac xxx.java" and build programs instead of just hitting the build button in VS. Most of them were utterly inept and I'd hate to see what happened to them in the real world. Others were miles above these people. There were like 3-5 of us that actually gave a damn, pursued our own education as if it mattered, and had whatever genes are necessary to think like a programmer or mathematician (the one guy I'd say was smarter than me was actually a math major--he graduated one year ahead of me or he would have taken my title). Even among these few "big hitters" I was one of, if not the best (some was due to more experience though). For about 90% of the other students though I see this not as me being so good, but them being really that f'n bad. I was often dumbfounded not just by their ignorance, but by their unwillingness to do what it took to loose it. My peers in college were lazy, bemoaning, irresponsible, sacks of stupidity that would rather run around puking from so much booze than put out the least amount of effort in learning anything. Then they blamed their ineptitude on the professors. As I entered the workforce I found that this trend continued. When I'm on the internet, talking to a worldwide populace of brilliant people I'm rather mediocre. I'm smart, excited, etc...I'm still very good but I'm much more able to see myself as a smaller fish in a larger ocean. Locally though, in personal real life experience....what I find easy others find hard even among what I'd call some of the best developers I've worked with. I know more about design, general development, and the specific language I use more than anyone else I know. Part of this is, I know full well, the kind of places I've learned in and where I've worked (who doesn't have the money to pay me what I'm worth). Still though, if I were to fairly compare myself to my coworkers, and in years past my co-students...don't I come off as more than a little arrogant? Others see me this way too though. It actually took me a while to recognize that there's actually something significantly special about the way I approach my programming (I really care), work ethic, and additionally my lucky roll in the gene game. I have seen it get to my head from time to time, and I try to avoid it, but in all honesty I'm just better than most. One thing that seems to differentiate me more than anything really is the fact that I continue to pursue greater knowledge at home, off hours. I'm one of the best because I want to be and it shows significantly. I've found that this is actually fairly rare in the real world, though many Internet people have me beat here as well. Knowing that there's certainly many more people like this out there, in fact I know of many people on SE that are much smarter than I am, how do you approach this question? Do you answer honestly? "I'm a fucking God that has do dumb down everything thing they do for the little people! The only way I can drag the rest along is by saying everything 20 times in 5 different ways." Or do you downplay yourself to make sure you don't come off as someone so damn arrogant they can't work with others? Edit: Yes, I make grammatical mistakes and additionally many more. I also suck at welding even though I tried very hard to get it. I also have a very hard time keeping my house plants alive. Some people are simply better at it. I'm simply better at programming.


title: Is the string "1.2.3f4" a standard format for version numbers?

text: The game development package Unity uses the following version numbering scheme:               {major}.{minor}.{patch}{type}{number}      With the following known types:   * **a** = alpha   * **b** = beta   * **f** = final Some examples:   * 1.2.3a27   * 1.2.3b4   * 1.2.3f2 Is this a standard formatting for version numbers?


title: Is the tool pywebsocket suited for production?

text: Is it a good idea to use **pywebsocket** in a production environment, since it is so widely used, but their google developer page states " _pywebsocket is intended for testing or experimental purposes_ ". Since Mozilla as well as Google use it to test their websocket implementations, and it was suggested (for production) in many SO threads, I thought it to be a pretty stable basis until I looked at their page. Or am I misinterpeting something, and it is just meant to be _especially_ helpful for testing, as well as suitable in production? Moreover do you know what the specific drawbacks of using it would be?   * Are there performance drawbacks?   * Is it not stable or unsecure in a certain way?


title: Automake - how to keep the source tree clean?

text: I have a project that uses GNU autotools to build itself. I am trying to modify so that autotools generates all the non-versioned control files in a separate directory so that I can keep the source tree clean of temporary files. Anyone has any ideas how to do this ?


title: RSpec + Selenium tests for .NET on Windows

text: I'm a Rails developer doing TDD on a Mac with RSpec, Capybara and Selenium webdriver. Now I have been asked by my company to use this approach for a .NET on Windows environment. What is the best way of doing this? I could just install Ruby and use RSPEC, Capybara and Selenium webdriver for integration testing. But what about unit tests? I also looked at NSpec, but I'm not sure if I can combine that with Capybara or Selenium for integration tests. What would be a good approach here?


title: How do you reduce geographic latency in web application (MVC ASP.net) backed by a single database

text: I'm working on a modest sized web application that receives circa 30k unique users per day, this is an MVC C# application hosted on 3 web servers and backed by a single SQL server, everything is hosted in one data center. The issue is we are seeing dom complete times upto 3 times slower in some parts of the world. We have done all the usual "quick wins" as suggested by yslow \- and are now looking to make architectural changes. Our initial plan is to create a web api that wraps our server tier, and then host the web tier in a second data center in a different part of the world closer to the users with the poor latency. The hope is that this in combination with caching and will help reduce latency. I appropriate that there will be latency between the api service tier and web tier, but the hope is that these will be lightweight http calls. Does this make sense?


title: The user interface in a clean architecture with client / server model

text: I have been reading (and watching presentations) about subjects like: DDD, TDD, BDD, SOLID (principles), design patterns, clean code, clean architecture, agile project methodologies. All in all I have quite a clear view on how to approach agile software development. Especially the DDD part really helps in communicating to all involved in the team (stakeholders, product owners, team members, etc). Developing good software is tough and I really value the opinions of experienced developers. They however say things like: "The user interface (or database) is an implementation detail". If you are looking from the core value of the product that is certainly true. In reality however, the end user solely deals with the user interface. To make our product really useful we need to have an excellent user experience. Let's say that we have a single page html/css/javascript client. Designing and creating all of the "only user interface" stuff is quite doable. I run into trouble with the following things:   * _Domain logic_ \- It lives in my domain model on the server. It feels fragile to duplicate it in the client. Exposing those parts of the domain model on the server might be an option, but that would probably create a lot of requests (a performance issue). Yet requiring the user to enter a value between 0 and 42 is clearly a business rule.   * _User stories / Scenarios / Behavior / Use cases_ \- Whatever you call it. The server is able to handle the use cases, if we've done it well they are nicely specified by behavioral specifications. The user interface should implement a 'view' or 'guide' for these scenarios. We should probably reuse these right? I could not find anything about the combination of these things. Do you have any resources or idea's about this? There must be some smart person that has said something very enlightening about this subject, otherwise: here's your chance


title: Scala or Clojure Functional Programming best practices

text: I did a lot of self-study coding, got some experience with Parallel Programming Models: Actors, Software Transactional Memory, Data Flow. When I am trying to apply these architectures to real life - into high load web application - any model doesn't support durability and persistence for data. Real life tasks requires to save data at the end. This means that still I have to use DB and trapping DB syncs, possible scalability bottle necks etc. Does anybody knows good example of architecture (src or text or diagram or blueprints) that uses _Akka_ Actors **or** Software Transaction Memory and implement persistence at the end? Any good example/idea for Transactional Memory, Actors, Dataflow, Tuple spaces in real life applications is welcome.


title: Modular Database Structures

text: I have been examining the code base we use in work and I am worried about the size the packages have grown to. The actual code is modular, procedures have been broken down into small functional (and testable) parts. The issue I see is that we have 100 procedures in a single package \- almost an entire domain model. I had thought of breaking these packages down - to create sub domains that are centered around the procedure relationships to other objects. Group a bunch of procedures that have 80% of their relationships to three tables etc. The end result would be a lot more packages, but the packages would be smaller and I feel the entire code base would be more readable - when procedures cross between two domain models it is less of a struggle to figure which package it belongs to. The problem I now have is what the actual benefit of all this would really be. I looked at the general advantages of modularity:               1. Re-usability     2. Asynchronous Development      3. Maintainability      Yet when I consider our latest development, the procedures within the packages are already reusable. At this advanced stage we rarely require asynchronous development - and when it is required we simply ladder the stories across iterations. So I guess my question is if people know of reasons why you would break down classes rather than just the methods inside of classes? Right now I do believe there is an issue with these mega packages forming but the only benefit I can really pin down to break them down is readability - something that experience gained from working with them would solve.


title: Can I use MIT licence plugins in my commercial web site?

text: If yes, what precautions should I take?


title: DRY, string, and unit testing

text: I have a recurring question when writing unit tests for code that involves constant string values. Let's take an example of a method/function that does some processing and returns a string _containing_ a pre-defined constant. In python, that would be something like:               STRING_TEMPLATE = "/some/constant/string/with/%s/that/needs/interpolation/"          def process(some_param):         # We do some meaningful work that gives us a value         result = _some_meaningful_action()         return STRING_TEMPLATE % result      If I want to unit test `process`, one of my tests will check the return value. This is where I wonder what the best solution is. In my unit test, I can:   1. apply DRY and use the already defined constant   2. repeat myself and rewrite the entire string               def test_foo_should_return_correct_url():         string_result = process()              # Applying DRY and using the already defined constant         assert STRING_TEMPLATE % "1234" == string_result              # Repeating myself, repeating myself         assert "/some/constant/string/with/1234/that/needs/interpolation/" == url      The advantage I see in the former is that my test will break if I put the wrong string value in my constant. The inconvenient is that I may be rewriting the same string over and over again across different unit tests.


title: Where do I learn most - by going to industry or pursuing a doctorate degree?

text: I enjoy learning new things, and thus I want to pursue a career where I can continue to do so. I'm currently doing my Master's thesis and will finish my degree beginning of next year. After that I'm at a crossroad of what to do next. My examiner wants me to continue my academic studies and apply for a doctorate degree, and I can't say I'm entirely against it; where can you learn more than by doing research? At the same time, however, I imagine that you'd get more practical experiences by going to industry. Then again it is always the risk of ending up in the guinea pig wheel and doing mindless work and never progress. And at research you might only research just that and never look at anything else. And let's not forget the higher salary in industry (at least when you compare the pays in Sweden, but I am willing to work for less if I get to learn more). So what to do?


title: A solution for a PHP website without a framework

text: One of our customers asked us to add some dynamic functionality to an existent website, made of several static HTML pages. We normally work with an MVC framework (mostly CodeIgniter), but in this case moving everything to a framework would require too much time. Since it is not a big project, not having the full functionality of a framework is not a problem. But the question is how to keep code clean. The solution I came up with is to divide code in libraries (the application's API) and models. So inside HTML there will only be API calls, and readability will not be sacrificed. I implemented this with a sort of static Registry (sorry if I'm wrong, I am not a design pattern expert):               <?php     class Custom_framework {              //Global database instance         private static $db;              //Registered models         private static $models = array();              //Registered libraries         private static $libraries = array();              //Returns a database class instance         static public function get_db(){                  if(isset(self::$db)){                 //If instance exists, returns it                 return self::$db;             } else {                 //If instance doesn't exists, creates it                 self::$db = new DB;                 return self::$db;             }         }              //Returns a model instance         static public function get_model($model_name){                  if(isset(self::$models[$model_name])){                 //If instance exists, returns it                 return self::$models[$model_name];             } else {                 //If instance doesn't exists, creates it                 if(is_file(ROOT_DIR . 'application/models/' . $model_name . '.php')){                     include_once ROOT_DIR . 'application/models/' . $model_name . '.php';                     self::$models[$model_name] = new $model_name;                     return self::$models[$model_name];                 } else {                     return FALSE;                 }             }         }              //Returns a library instance         static public function get_library($library_name){                  if(isset(self::$libraries[$library_name])){                 //If instance exists, returns it                 return self::$libraries[$library_name];             } else {                 //If instance doesn't exists, creates it                 if(is_file(ROOT_DIR . 'application/libraries/' . $library_name . '.php')){                     include_once ROOT_DIR . 'application/libraries/' . $library_name . '.php';                     self::$libraries[$library_name] = new $library_name;                     return self::$libraries[$library_name];                 } else {                     return FALSE;                 }                  }         }          }      Inside HTML, API methods are accessed like this:               <?php echo Custom_framework::get_library('My_library')->my_method(); ?>      It looks to me as a practical solution. But I wonder what its drawbacks are, and what the possible alternatives.


title: How do you off load work from the database?

text: In at least the web development field, web servers are everywhere but are backed by very few database servers. As web servers get hit with requests they execute large queries on the database, putting the server under heavy load. While web servers are very easy to scale, db servers are much harder (at least from what I know), making them a precious resource. One way I've heard from some answers here to take load off the database is to offload the work to the web server. Easy, until you realize that now you've got a ton of traffic internally as a web server tries to run SELECT TOP 3000 (presumably to crunch the results on its own), which still slows things down. What are other ways to take load off the database?


title: How can we improve overall Programmer Education & Training?

text: Last week, I was just viewing this amazing interview by Kevin Rose of Phillip Rosedale, of Second Life. And they had an amazing discussion about how to find, hire and identify good programmer's, and how hard it is to find good ones. Which has lead me to really think about the way we programmer's learn, are taught. For a majority of us, myself included, we are self-taught. Which is great about being a programmer, anyone can learn and develop skills. But this also means, that there is no real standards of what a good programmer is/are, and what kind of environment's encourage the growth of programming skills. This isn't so much a question, but just a desire in me, to see how we can change the culture of programming, and the manager's of programming, so that education and self-improvement is encouraged. There are a lot of avenue's for continued education, youtube videos, books, conferences, but because of the experiental nature of what we do, it isn't always clear what's important to learn and to master. Let's look at the The Joel 12 Steps. The Joel Test Do you use source control? Can you make a build in one step? Do you make daily builds? Do you have a bug database? Do you fix bugs before writing new code? Do you have an up-to-date schedule? Do you have a spec? Do programmers have quiet working conditions? Do you use the best tools money can buy? Do you have testers? Do new candidates write code during their interview? Do you do hallway usability testing? I think all of these have important value, but because of something I call the Experiential Gap, if a programmer or manager has never experienced any of the negative consequences for not having done items on the list, they will never see the need to do any of them. The Experiental Gap, is my basic theory, that each of us has different jobs and different experiences. So for some of us, that have always worked with dozens of programmer's, source control is a must have. But for people who have always been the only programmer, they can not imagine the need for source control. And it's because of this major flaw in how we learn, that we evaluate people by what best practices they do or not do, and the reason for either can start a flame war. We always evaluate people in our field by what they do, and think "Oh if this guy/gal isn't doing xyz best practice, he/she can't be a good programmer, so let's not waste time or energy talking to them." This is exactly why we have so many programming flame wars, that it becomes, because of the Experiental Gap, we can't imagine people not having made the decisions that we have had to made. So this has lead me to think, that we totally need to rethink how we train, educate and manage programmer's. For example, what percentage of you have had encouragement by your manager's to go to conferences, and even have them pay for it? For me, and a lot of people, this is extremely rare, a lot of us would love to go to conferences, to learn more, but the money ain't there to do that. So the point of this question is really to spark a lot of how can we train, learn and manage better? How can we create a new culture of learning that doesn't insult people for not having the same job experiences. Yes we all have jobs and work to do, but our ability to do our jobs well, depends on our desire, interest and support in improving our mastery of our skills. Right now, I see our culture being rather disorganized, we support the elite, but those tons of us that want to get better, just don't have enough support to learn and improve ourselves. I mean, do we as an industry, want to be perceived as just replaceable cogs? Thank you...


title: Is it better to concentrate on one or two research projects throughout undergrad?

text: Currently in the 4th semester of engineering in an Indian university. The thing is - is it better to do as many short-lived projects/research work on diverse topics of computer science or stick to one/two projects consistently throughout my undergraduate years? Case in point: currently working on an image-processing project that promises to carry on for a year or so (as per the prof). Does this seem like being over-specialized at too early a level? Although taking on too many things will spread me out thin and in all probability not end up getting any meaningful work done. Especially as I hope to apply for grad school in the US. Would really appreciate any views and suggestions on this.


title: Common interview: flexibility on code test?

text: I'm looking my first job and tomorrow I have my first interview in which they will test my programming skills by doing some code. I want to know if it's usual they let you search on internet if you don't remember an specific method name or something related to syntax's ?. If this is unusual then what should I do in case of forget something related to syntax?


title: Should I label class diagram variables as private or public?

text: In my program, I have several class variables whose access specifier is known as private package. The default accessor specifier in Java is known as private package where it is accessible within the package which the class belongs to. For the UML class diagram , should I label these variables as public or private? I can't decide because of this concept of private package.


title: Why use classes when programming a tkinter gui in python

text: I program primarily in python and have programmed a couple of GUI's with Tkinter, every tutorial I have ever seen has recommended defining and using a class for the GUI, but my GUI runs flawlessly using only procedures, without a class. Why use a class? It seems from my perspective to simply be an extra layer of complexity and unnecessary code.


title: Is better Show() + Hide() or SetVisible(bool visible)?

text: What is better and why? (From interface-design point of view) : a) To have two `Show()` and `Hide()` functions b) To have one `SetVisible(bool visible)` function EDIT: For example some object have visibility state and this functions is used to change it. c) To have all three `Show()`, `Hide()`, `SetVisible(bool visible)` functions


title: Can you use UML in a TDD project?

text: If so, at what stage? or it is also an iterative process? If iterative, how formal? Also, how useful is UML for a solo programmer doing open source? While I like to see a picture of the system, it feel so formal and a bunny trail for TDD. Thanks.


title: Same source code compiling in various languages

text: What do you call source code valid in several languages? There was a specific word for it and really crazy examples.


title: How should I handle using two databases with a legacy PHP application?

text: I have a legacy PHP application that was written in 2004 and uses MSSQL as a database backend. At this stage MSSQL is still supported by PHP but only just via a Microsoft driver. I have looked at converting to mysql via automated tools, which work quite well, but I have quite complex views which need a lot of individual work to convert. I don't have a great deal of time to do this. Many tools I wish to use and frameworks I would like to move the application to, don't support MSSQL, so I was considering adding new features using a new mysql database and wondered if anyone had opinions on the pros and cons of using two seperate database backends in a single application?


title: How to make custom libraries accessible?

text: I am trying to compile and install every custom module under it's own designated folder. (ex: `/myApps/myLinux/compiled_app`) I had luck with Python so far, where my Python is compiled from source and lives in: `/myApps/myLinux/python2.5` and "python2.5" -> `/myApps/myLinux/python2.5.6-gcc463` So I can access this Python through a wrapper script that sets the right environment. The question is recently I had to compile and add something called gperf3.0.4. So now it lives: `/myApps/myLinux/gperf3.0 and "gperf3.0" -> /myApps/myLinux/gperf3.0.4-gcc463 ` The question is: How will I point to this lib if some other app needs to access it? Is it done through the LD_LIBRARY_PATH variable?


title: How do you detect lying Stubs/Mocks?

text: Consider this piece of code from the PHPUnit manual(I'm using PHP only as an example):               class StubTest extends PHPUnit_Framework_TestCase     {         public function testStub()         {             // Create a stub for the SomeClass class that could be later injected into another class, but removed here for simplicity.             $stub = $this->getMock('SomeClass');                  // Configure the stub.             $stub->expects($this->any())                  ->method('doSomething')                  ->will($this->returnValue('foo'));                  // Calling $stub->doSomething() will now return 'foo'.             $this->assertEquals('foo', $stub->doSomething());         }     }      Now I just stubbed the method `doSomething()` to return `foo`. What if some time later in the future I decide to implement `SomeClass` like this:               class SomeClass{              function doSomething(){             return 'bar';         }     }      Of course i have tests for `SomeClass` that test for `bar`, but I totally forgot to test for `foo`. Now I have a lying test. How does TDD handle this situation?


title: Storing data in elasticsearch vs mongodb

text: We are trying to create an online-shopping like application in which we have to store a huge amount of data,since the data that will be stored are mostly document like data, the suggestion was to store the data in mongodb and using elasticsearch to add the search functionality, but i also know that elasticsearch itself can be used as a database to store the data, but I'm not sure if that's the right thing to do. Can you guys help me out?


title: Should I implement a function or a method?

text: Once in a while I encounter a C function in my colleagues' code. Mostly it is in some helpful objective categories, and those functions are mostly an internal calculation of something or a comparison of values. Since those guys are not part of the company anymore, I can't ask them why they decided to go with a C function instead of a proper objective C method. So the question is: Why implement certain algorithms as a C function instead of objective C method? What are the considerations?


title: Who is a CMS really for?

text: I have started lately discovering `Content Management Systems`, and I was wondering, who is really **CMS** for? What I mean by that: is it only for `companies`, `small businesses` or `individuals`, that pays a contractor to make a website that it's users can just upload content through a easy interface. Or is it used also by programmers, to build their own websites, projects? Would a _Facebook_ , _Tweeter_ , `StackExhange` ever started by using a **CMS** , a very powerful one for example. Would you as a programmer build your own "fancy" website on top of a **CMS** , for example like Typo3, or you would build it from scratch? P.S To be more clear is a summary: _`What I mean to begin with is, would I as a developer choose a CMS to develop a website that can be scaled with a big base of users, be stuck if I choose to start with a CMS system. What if I build a website using CMS, and the website explodes in popularity, and then I wanted to add much more functionality that I have planed, is it possible that the CMS will limit the growth, because it might have not been build for that kind of scale?`_


title: Should a developer also act as a tester?

text: We're a scrum team of 3 developers, 1 designer, the scrum master, and the product owner. However, we don't have official tester in our team. A problem that is always with us, is that, testing the application and passing those tests and removing bugs has been defined as one of the criteria to consider a PBI (Product Backlog Item) as done. But the problem is that, no matter how much we (3 developers and 1 designer) try to test the application and implemented use cases, still some bugs are not seen and ruin our presentation (Murphy's law) to stakeholders. As a remedy, we recommended that the company hire a new tester. Someone who's job would be testing, and testing only. An official professional tester. However, the problem is that, scrum master and stakeholders believe that a developer (or a designer) should also be a tester. Are they right? Should we developers (also designers) be testers too?