title: Building a WordPress-like filter system

text: This question is purely hypothetical. I use WordPress a lot and know the filter structure from an implementation point of view. I'm now wondering what's the best way to implement such a structure (not the way WordPress uses, but the _best_ way). I will give a short overview of what the WordPress filter structure is. After that, I'll list my requirements and thoughts. At last, I'll ask some questions. ### WordPress' filter structure WordPress sends nearly every data through a _filter function_ before it outputs the data to the browser. The WordPress Codex gives information in the Plugin API and the Filter Reference. For a plugin developer, it's quite easy to add a filter: >   1. Create the PHP function that filters the data. >   2. Hook to the filter in WordPress, by calling `add_filter()` >   3. Put your PHP function in a plugin file, and activate it. > Let's look at these steps in some more detail:   1. A filter function is a PHP function that takes one parameter, the input, and returns the output. It should not `echo` or `print` anything.    2. The `add_filter` function (reference) looks like:               add_filter ( 'hook_name', 'your_filter', [priority], [accepted_args] );      `hook_name` is the _action hook_ at which the filter should be called.   `your_filter` is the name of your filter function.   `priority` gives the, well, the priority of the filter (default: 10), where lower numbers are more important.   `accepted_arguments` tells WordPress the filter function will take more parameters, but let's leave that out here, it's not one of my requirements.   3. I don't have to explain this step, I think. ### Requirements I'd like to know how to implement a filter structure like WordPress has and for the sake of an actual answerable question, I have made up a hypothetical case with some requirements. My case is a forum, in which I have several cases in which I'd want to use filters for the content, like:   * A linkify filter to make bare URLs into nice, working hyperlinks   * A smiley filter to replace ASCII smileys like ':D' into an image ![enter image description here](http://i.stack.imgur.com/IRi6N.gif) (sorry for the imgur abuse) I think the advantages of using filters for this would be:   * Code clarity   * Filters can be easily reused   * Making it easy to implement that a user can switch a filter on and off   * Easy implementation of additional filters in the future ### My thoughts I imagine WordPress keeps a multidimensional array like `$filters[$hook][$filter]`. Here is `$hook` the name of the hook when the filter has to be called and `$filter` an array of the filter settings, basically those that were passed to the `add_filter()` function. When an action hook point is reached, WordPress can iterate through the `$filters[$current_hook]` array and execute every filter. ### Questions   1. Is this the best way to include a filter system with the requirements I listed? If so, why? If not, why not; and what would be a better system and why?   2. As I said I want users to be able to switch filters on and off.  I thought of adding a `enabled_filters` column to the user table in the database, which would be a bitmask of the enabled filters. That would mean every filter would have a unique identifier, but more important that there aren't very much filters possible. So this wouldn't be the way to go. I also thought of adding a table `enabled_filters` with columns `userId`, `filterName` and `enabled`, to set the filters on and off with a new row. With using the filter name in every row, this would cost some data space on much users and filters, so a better but similar idea would be adding a table `filters` with `id` and `filterName`, and changing the `filterName` column of the `enabled_filters` table into a `filterId` column. This would also allow an additional field in the `filters` table, `allow_disable`, to disable the disabling of the filter. Is this second approach a good one, or are there better options? Key requirement is that I don't want to have to modify the base system when adding a filter.   3. WordPress wants programmers to not print anything in a filter function, but return a new string. That means you'll have a variable `$return` in your filter function, to which you append new data all the time with `$return .= '...';`. Using `echo` or `print()` could be easier for programmers, also to make it easier to port existing code (which uses print functions) to a filter function. The filter system could use the `ob_*` functions to capture the printed data instead of sending it to the browser. Would this be a good way to implement filters? Are there any disadvantages, like speed?    4. The last question is about when to use filters, and when not. It seems clear to me that the listed cases (linkify and smileys) are cases where filters are well-used. For things like signatures or avatars, to stick with the forum, it's different. I've tried to figure out why it feels different, and think it's because that would limit the use of a filter to one place.  For example, avatars and profile overview filters could only be used next to a post. One of the nice things of a filter is that you can add the same filter function to a different action hook, so that you can pass both the post and the signature content through the linkify filter. Am I right here? Is it true that one shouldn't use filters for avatars, profile overviews and signatures? What can be said about general rules when and when not to use a filter? If I were to write documentation on my system for third-party developers, what should I write down on this topic?


title: Do variable names affect the performance of websites?

text: Do variable names affect website performance? I know this will going to be very low number, but still can any one provide the reasons for not choosing a long variable name in aspect of performance?


title: What should a repository really do?

text: I've heard a lot of the repository pattern, but I quite didn't understand what a repository should really do. When I say "what a repository should really do" I'm mainly concerned about which methods it should provide. For instance, should a repository really provide CRUD methods, or should it provide some different kind of method? I mean, should the repositories contain business logic, or should they simply contain the logic to communicate with the data store and manage the entities to be saved or loaded? Also I've heard that repositories are units of persistence for aggregates. But how is that? I fail to understand how this works in practice. I thought that we should have just one interface `IRepository` which contains the CRUD methods, and then for any entity the implementation would simply contain the logic to save and retrieve such type from the data store.


title: Skills for RAD developer

text: I am about to embark on an exquisite journey. I have applied for an event, where in span of 48 straight hours, strangers meet, throw around some great ideas, decide on teams, and make a working prototype of IT project. All within 48 hours. I anticipate, that this will be very skill and ability intensive experience, and I want to be prepared. Since i will need to develop my part of the code quickly, I have a following question: **What would be the most needed skills for these 48 hours?** I do know, that things like proper documentation, version control and such are pretty important for a full fledged application/program/web development, but for this span of frantic coding? _Background: I am a web developer, so answers applicable to web development would be more appreciated than others._


title: 10 years out of programming, wanting to return... How to best approach it?

text: I've searched, but found nothing directly applicable. I have 15 years or so development experience, in Unix, C, C++ mainly, (along with assorted script / minor languages) the last 5 years of this was contracting. My various testimonials and references over the years eventually convinced me I was pretty good at it too. Now, for the last 8 years I've been entirely non-technical and now know that to have been the wrong choice. The problem I face now apart from the skill set on the resume would put off some potential employers, is I've almost completely forgotten C++ and the little Java I had. I don't much fancy starting from scratch again! But that's how it feels when I sit and look at any non trivial C++ code. All that OO and class stuff and I'll pretty much give you a blank look. Surprisingly my C is still ok, well syntactically, though I imagine my design capabilities have taken quite a hit too. Anyone had experience of something similar? Am I realistically looking at years to get back to being half decent again? Apart from much practice and reading anything I can usefully do to get up to speed again faster? Ideally I don't want to face being stuck with the career change I **mistakenly** made 8 years ago. Help!


title: Diplomatically point out the obvious problem in a product

text: As we all know, every software has bugs in it. It is matter of time to discover it. Suppose if you just found your product has potential big issue and it was not developed by you. How would you deal with it? I usually speak up with some data & analysis even if it is not my part of code. I am wondering if it is too offensive because I often faced on some resistance(depending on the issue), which would eventually be gone.


title: Is it OK for a function to modify a parameter

text: We have a data layer that wraps Linq To SQL. In this datalayer we have this method (simplified)               int InsertReport(Report report)     {         db.Reports.InsertOnSubmit(report);         db.SubmitChanges();         return report.ID;      }      On submit changes, the report ID is updated with the value in the database which we then return. From the calling side it looks like this (simplified)               var report = new Report();     DataLayer.InsertReport(report);     // Do something with report.ID      Looking at the code, ID has been set inside the InsertReport function as a kind of side effect, and then we are ignoring the return value. My question is, should I rely on the side effect and do something like this instead.               void InsertReport(Report report)     {         db.Reports.InsertOnSubmit(report);         db.SubmitChanges();     }      or should we prevent it               int InsertReport(Report report)     {         var newReport = report.Clone();         db.Reports.InsertOnSubmit(newReport);         db.SubmitChanges();         return newReport.ID;      }      maybe even               Report InsertReport(Report report)     {         var newReport = report.Clone();         db.Reports.InsertOnSubmit(newReport);         db.SubmitChanges();         return newReport;      }      This question was raised when we created a unit test and found that its not really clear that the report parameters ID property gets updated and that to mock the side effect behavior felt wrong, a code smell if you will.


title: Would this development environment cover the bases for iOS and Windows 8/Windows Phone 8 apps?

text: I'm an experienced C# developer. I've created a couple Windows Phone apps and a Windows 8 app but have wanted to develop for iOS too. What I'm thinking is adding the following equipment and software to make this possible:   1. MacBook Air - necessary to compile/deploy to Apple's App Store and for some development tasks, as well as tools like PaintCode   2. iPad Mini - less expensive and able to do double duty testing for both iPhone and iPad screens (Ideally I'd have the budget for a phone too, but not in the cards)   3. Xamarin Studio Business Edition - pricier but integrates into Visual Studio, which is my primary dev environment and also home to Win8/WP8 app code Basically, I'm just looking for a reality check. Is this overkill? Not enough? I know I could save a few hundred getting a Mac Mini, but have other uses for a laptop. Can I get by with the Indie version of Xamarin or am I crippling productivity by constantly switching environments? (As soon as I get the hardware I'll start by testing the free version to help answer that question).


title: Storing Projects on Google Drive (Cloud)

text: I've started using Google Drive for my cloud needs and backing up pretty much everything. I've got the app installed so it auto-sync's all my content in most things. My question is this, I am currently coding for iOS (although this applies to any coding project) and am split on storing my project files on Google Drive while using sync. My theory is that if I did use it, I'd never have to worry about system crashes or lost code before backups, but if I do use it it will be sync'ing a-lot and I thought there might be problems with it detecting changes and trying to sync for example half way through compiling. Bandwidth isn't an issue as I have fast connection and unlimited monthly allowance. Has anyone ever used this, or similar cloud-based sync'ing (dropbox etc) for this and knows whether it works or not or whether there are any potential problems etc.


title: Why has C prevailed over Pascal?

text: My understanding is that in the 1980s, and perhaps in the 1990s too, Pascal and C were pretty much head-to-head as production languages. Is the ultimate demise of Pascal only due to Borland's neglect of Delphi? Or was there more, such as bad luck or perhaps something inherently wrong with Pascal (any hopes for its revival?). I hope it's not an open, unanswerable question. I'm interested in historical facts and observations one can back up, rather than likes and dislikes. I also failed to find a duplicate question, which actually surprised me somewhat.


title: What parts of my configuration and my code should I not post?

text: When people post code on forums they tend to change or blur out parts of their code. Probably because they want to protect certain parts that might be exploited if it ends up in the wrong hands, I guess?   But is it really necessary to do this? Here are a couple of things I see a lot:   * Renaming id's and class names in html and css   * Renaming variables and functions in code   * Bluring out parts of a folder structure    * Changing stored procedure names and it's parameters   * Posting of example code rather than real code Passwords and connection strings to the DB are obvious things you shouldn't post but how a bout the rest? Is it ok to give out a DB name? Is there anything in the web.config you shouldn't post? How about the .htaccess file on Apache or a folder structure on the system, etc... Basically what I'm asking is which parts are safe to post and which are not?


title: Do you have any teamguidelines regarding exceptions?

text: My team recently inherited a project from a team where the amount of developers dropped so low they had to offload some work. One of the projects we inherited was a project littered with nested code, and awful exception handling (Exceptions were in effect handled as goto statements and thus used as a part of the normal program flow.). All in all it was a hairy code ball someone had been coughing up for a few years. Now we've been having a few team guidelines in place for quite some time, but all of the regards to the structures of objects, coding styles and what not. But we havn't covered exception handling. So I'm wondering if you have any guidelines in your teams regarding exception handling, and if so how you enforce them?


title: Is it bad practice to output from within a function?

text:
For example, should I be doing something like:               <?php     function output_message($message,$type='success') {       ?>       <p class="<?php echo $type; ?>"><?php echo $message; ?>
       <?php     }     output_message('There were some errors processing your request','error');     ?>      or               <?php     function output_message($message,$type='success') {       ob_start();       ?>       <p class="<?php echo $type; ?>"><?php echo $message; ?>
       <?php       return ob_get_clean();     }     echo output_message('There were some errors processing your request','error');     ?>      I understand they both achieve the same end result, but are there benefits doing one way over the other? Or does it not even matter?


title: Ruby and Enterprise. Any future?

text: After Heroku acquisition by SalesForce, is there any chance for Ruby being adopted in enterprise development?   If you know any good examples already, please point to them.


title: ODBC Lic Restrictions / Need way around limitation here are me thoughts? What do you suggest?

text: We are currently using an old legacy ERP system (Thoroughbred) that we have been bolting on functionality by means of web apps we design in house. I interact with the legacy system via ODBC and have to pay on a per connection base via Licenses. I would like to build in intermediate system that would take the sql requests and process them so that any of our apps could just connect to it to avoid the lic issue. What would be the best way to build this adapter. I was thinking a web service but to be honest I am not even sure technically what a web service is. I envision that it just takes in requests and "does stuff" with the data and then returns results back to the requester. Sorry about being vague but like I said, I don't have a lot of experience working with web services. Maybe a web service isn't the best way to handle it and I should come at the problem from another direction. My current strengths are Python and turbogears so if I can stay within my comfort zone it's a plus but is not a requirement. Thanks for any and all input!


title: Seeking Windows file compare which accepts directories and filters for source code only

text: There are some good free file compare programs out there and most of them will compare directories too. But what I am look for is one where I can specify a filter like *.cpp and have it ignore object files, makefiles, executables, etc without me having to manually remove those before compare. Any suggestions?


title: Recommended guidelines for Mercurial setups

text: I've just recently installed mercurial, and have been playing around it with. Overall, it seems like a great way to do version control. However, the distributed nature of its architecture makes it _so_ flexible, I'm not really sure what the ideal configuration/topology is. I'm well aware that asking something like "what is the ideal Mercurial topology" will never get a meaningful answer without more specific details ranging from business requirements, number of developers, security concerns, nature of the project, etc. However, are there any general guidelines or "best-practices" when it comes to setting up a Mercurial system? In particular, I'm interested in hearing if most companies/projects setup a centralized, "canonical" repository. Mercurial doesn't require that you do this, and you could essentially say _anything_ is the "canonical" repository. (Perhaps you could consider the lead developer's working repository the "canonical" one.) But is it generally a good idea to setup a dedicated "source control" server which simply hosts the canonical repository, so every developer can clone it and work locally? Or is this unnecessary?


title: Not copyrighting code and then reusing functions later

text: I'm coding something for my job to copy directories and then use regex to make all the filenames uniform. I'm an undergrad student programmer for my university and I'm not sure what a professional coder would consider reasonable in this case. My job is mostly to implement mathematical research. The current assignment is outside what I've been doing and seems like it would be really useful to have some of the functions available in case I (most likely) encounter a similar assignment at some point in my career in the future. It's going to be really useful because the current filenames are so screwed right now that the admin assistants can't really keep up (and even trying to do so might just cause more human error). I'm thinking that it may not overall be useful outside the current assignment because the regex will be so customised to the way the file are incorrectly named. I'm wondering if this is simple work for a pro coder, and therefore I'm making this program to be much more important in my head than it actually is, or if this is something that a coder would really want to copyright or otherwise retain the ability to use this whenever and wherever else they feel like. They've already told me that there is no question that I'll be given credit for the work, which I'm excited about. My only concern was whether I should be thinking about reusing this code later or if this task is so generic that a pro coder would laugh about keeping the rights to such code. This thread was interesting but seems different from my situation: How can I reuse generic code for consulting between companies? EDIT: Florida, USA


title: What is an "assertion framework"?

text: I was reading about the js-test-driver unit-testing framework, when I found out that the guys behind the framework intend it to be integrated with an assertion framework. What is an assertion framework? Is it a kind of unit- testing framework? If it is the case what is specific to such frameworks?


title: What are the bad points of using Core Data for iOS like an ORM

text: I just starting to use `Core Data` for my iOS app and I am thinking about how use Core Data for my needs. **What are the features of my app:**   1. The user look for products proposed from a catalog.   2. The user can add products into a basket.   3. The user can customise each selected product.   4. The user have to create an account to purchase the order.   5. The user have to add recipients for his order.   6. The user pay the order. **How I would persist the datas with`Core Data`:**   * If the user isn't logged on `iCloud` or on my `RESTful API`: Persist the datas on the device.   * If the user is logged on `iCloud` but not on my `RESTful API`: Persist the datas on `iCloud`.   * If the user is logged on my `RESTful API`: Persiste the datas on my back-end. **Question** : After reading some articles about `Core Data`, I quickly understood that it is really verbose and I will rewrite lot of similar code in my app. After researches I found a wonderful article about libraries for `Core Data` by `NSHipster` and I am really interested by using Objective-Record library for my app. But one sentence on the `NSHipster`'s article alerts me on the consequences of using such a library: > Using Core Data as an ORM necessarily limits the capabilities of Core Data > and muddies its conceptual purity. I would have more informations about the " _limits the capabilities_ " of using a library inspired by `Active Records`. I wouldn't regret the choice of using Objective-Record library on my app if it can pose problems for the development of feature for me later. Thanks ! **Update:** The good point for me to use Core Data with a library inspired by Active Record is I have to do a lot of "requests" inside my app and this will allow me to write less code.


title: How to apologize when you have broken the nightly build

text: My first commit in my project resulted in the nightly build being broken and people are all over me as we are nearing the release. I want to send an apology email that should sound sincere and at the same time hinting that this was my first commit and this would not be repeated any more. Being a non-native English speaker, I have difficulties coming up with correct words. Can someone please help ?


title: Feature vs. Function

text: Often I hear PMs (Project Managers) talk about feature and function. And I'm just so puzzled to differentiate them. Sometimes I think of a feature to be equivalent to a user story. Something like "As a user, Bob should be able to see a list of his payments", and they call it a feature. Sometimes it gets as big as a subsystem, something like "the ability to send SMS via web application". Function on the other hand sometimes gets as small as a task, "implementing digit grouping for number inputs", while there are cases when it gets as big as a whole CRUD operation. My question is, how can we differentiate feature from function?


title: MVC URL formatting/design

text: In refactoring a lot of MVC code, I have run into an issue with my URL design. For example, let's say we have a `Venue` object               public class Venue      {         public long ID { get; set; }         public List<Event> Events { get; set; }     }      and an `Event` object               public class Event     {         public long ID { get; set; }         public Venue Venue { get; set; }     }      So my initial set up was to have an action set up in the `EventController` like               public ActionResult List (long? ID) // http://example.org/API/Events/List/12      where the `ID` specified the Venue, so it would return a list of events for that venue. If an `ID` is not specified, it returns a list of **all** events. This results in a confusing URL, because the `ID` parameter is ambiguous and misleading. I then thought to change it to               public ActionResult List (long? VenueID) // http://example.org/API/Events/List?VenueID=12      which makes a lot more sense and is more clear. An even cleaner URL would exist if the action was moved to the `VenueController` and set up like               public ActionResult Events (long? ID) // http://example.org/API/Venue/12/Events      as the `ID` would clearly specify the `Venue`'s `ID`. The issue with this URL is that you are primarily dealing with `Event` objects in the `VenueController`, which seems wrong. I have been leaning towards the first option (`http://example.org/API/Events/List?VenueID=12`) because, even though the other option is cleaner, it seems like I should keep the `Event` pages (as I view this List page as more related to the `Event` object) in the `EventController`. Any recommendations?


title: Getting practicality of PHP from Ruby or Python

text: I have a rather odd problem. I love the practicality of PHP - specifically that I can fairly safely assume that on any random server I'll have access to the MySQL libraries, and that I can go between PHP/HTML with `<?` and `?>`. That said, I find the language atrocious - Ruby and Python are considerably more expressive, yet since they're not web-specific, they lack both of those features - at least last I used them both. So my question is, is there some way to get the practicality of PHP from Ruby or Python (specifically the two issues I mentioned)? If not, is there some other language that doesn't feel like a C/C++ parser gone wrong?


title: Are wikis really appropriate to store documents for software development?

text: Everybody knows that well-documented software development leads to success. However, it usually means that not only plain text but also binary content will be involved in the document, such as a UML diagram. And I've heard many people say that. The version control system is not the appropriate place for the binary files. I totally understand and agree with the issue. I asked several seasoned developers where the best place to store documents should be and the answer I got was "wiki". Wiki is good but I considered another potential issue. How can the source code which has been stored in a version control system connect to its related document in wiki? Let's say someone clones the repository of git or mercurial. How can he/she find the document easily? Or have I just missed something? **Updated:**   I know some wiki systems have the ability to integrate with source control systems. But my concern is not about the ability of integration. If you have cloned source code from a git repository and after a while you get on a train and want to continue to work offline on the train (which is a big feature of DVCS). Then you suddenly realize you don't have any access to document since you are working offline on the train. On the other hand, if the document was stored in git repository you would have access to the document with repository cloned.


title: XML in the attribute of other XML

text: Today, another developer was talking to me about how he addressed an issue he was working on. The solution he found was to stick a string of escaped XML into the attribute of another XML element. In my head I was screaming "Is that even safe and wise to do???". According to him, that has been done on tons of other projects within the company that transmit XML back and forth. My question is this -   1. Is that a safe/smart thing to do (xml in an xml attribute)?    2. If not, should I bring that up? I have only been with the company for 2 years and have noticed many things that are just asking for a major catastrophe to happen someday (both in and not in projects I work on). I don't want to be the one that always says that they are doing things wrong... Any thoughts would be greatly appreciated! **FYI - UPDATED INFO RE: APPLICATION -** Flash is calling this API and parsing the XML it gets in the response. I do not think the Flash is using XPath or anything, just string parsing (but I could be wrong). I do not work on the Flash aspect, so I do not know where to look (nor would I understand it).


title: Computer Science Degrees and Real-World Experience

text: Recently, at a family reunion-type event I was asked by a high school student how important it is to get a computer science degree in order to get a job as a programmer in lieu of actual programming experience. The kid has been working with Python and the Blender project as he's into making games and the like; it sounds like he has some decent programming chops. Now, as someone that has gone through a computer science degree my initial response to this question is to say, "You absolutely MUST get a computer science degree in order to get a job as a programmer!" However, as I thought about this I was unsure as to whether my initial reaction was due in part to my own suffering as a CS student or because I feel that this is actually the case. Now, for me, I can say that I rarely use anything that I learned in college, in terms of the extremely hard math, algorithms, etc, etc. but I did come away with a decent attitude and the willingness to work through tough problems. I just don't know what to tell this kid; I feel like I should tell him to do the CS degree but I have hired so many programmers that majored in things like English, Philosophy, and other liberal arts-type degrees, even some that never went to college. In fact my best developer, falls into this latter category. He got started writing software for his church or something and then it took off into a passion. So, while I know this is one of those juicy potential down vote questions, I am just curious as to what everyone else thinks about this topic. Would you tell a high school kid about this? Perhaps if he/she already knows a good deal of programming and loves it he doesn't need a CS degree and could expand his horizons with a liberal arts degree. I know one of the creators of the Django web framework was a American Literature major and he is obviously a pretty gifted developer. Anyway, thanks for the consideration.


title: Choosing an ubiquitous language across different bounded contexts

text: If my domain has several Bounded Contexts, but only **ONE** team will work on all contexts, should I develop an Ubiquitous language for each context? or should I have only one and force to into all contexts? The bounded context definition from Evan's book states: > A BOUNDED CONTEXT delimits the applicability of a particular model so that > team members have a clear and shared understanding of what has to be > consistent and how it relates to other CONTEXTS. Within that CONTEXT, work > to keep the model logically unified, but do not worry about applicability > outside those bounds. In other CONTEXTS, other models apply, with > differences in terminology, in concepts and rules, and in dialects of the > UBIQUITOUS LANGUAGE. I don't understand what is meant by _"dialects of the UBIQUITOUS LANGUAGE"_. Should I develop a universal ubiquitous languge then modify it for each bounded context? My main problem is if a single team is going to work on all context they might get confused by the constant change in the terminology. **UPDATE** :   Let's use an example to illustrate the problem. If I have 2 bounded contexts `Operations` and `CustomerService` and an entity `Order`.   A customer may request a refund. In the Operations context this is called a `refund` while in the CustomerService context it is called a `cancellation`. In my models I gonna have something like `order.refund()` or `order.cancel()`. The question is should I have 2 models for the order entity one with a method called `refund()` while in the other context a method called `cancel()`? or should I force a single terminology? The implementation of the refund process might the same or different.


title: Package diagram for an MVC patterned project?

text: We are required to make a package diagram for our senior project. Since our project uses MVC patter design, we created an MVC class diagram, now, our problem is in creating the package diagrams from our class diagram. Is it possible to have packages with MVC at the same time? so it would be something like this: Package: Account   * Account Model   * Profile Controller   * Registration Controller   * Profile View   * Registration View These are the controller that cannot exists without the Account model, so I included them. Thanks in advance!


title: Which language for which job?

text: Today I asked myself a quite fundamental question, well .. I guess it is one. But google- and SEing couldn't give me the answer I was looking for. I'm writing programs for quite a few years now, but the languages in which they were written, was always given by higher seniors, customers or by myself for learning purpose. Let's say for instance that I want to write a application with basic functions, like database access, calling webservices and so on.   Which language should be used, and why? Ignoring factors like cross- platforming, UI, which DB system or webservices are used ... imagine something like a black body in physics. As example, why should I use Java over C++ or Python over Ruby? Not saying that this question is limited to these languages. Are there good reasons for choosing an specific language, like performance or memory usage, or is it, in case of a "black-body-situation", just the personal preference which determines the actual used language? Thanks in advance. ... and sorry if this question is to general.


title: Should I Prefer Session Timeouts Based off of Prime Numbers?

text: While researching some information regarding managing state and session in web applications, I stumbled across this nugget of information: > 67 is the first useful prime number after 60. (Yes, 61 is a prime, too, but > it's too close to 60 to be of use.) Setting timeouts in durations of primes > is common because it lessens the likelihood that two timeout sessions will > overlap. > > Of course, that's completely anecdotal and may not in any way be the reason > why they chose 67 minutes, but that's always made sense to me. At first glance, this seems to make perfect sense to me, and traditionally, I've never given a lot of thought to the variance of sessions timing out, but I wonder how much (if any) this strategy has been put into place in practice? Would making a change to timeouts ending on prime numbers really have that much of an effect long-term in a large scale application? Or would a change like this go mostly unnoticed? In other words, is this _really_ anecdotal? Or is it something that should be strongly considered as a best practice?


title: What is the name for the programming paradigm characterized by Go?

text: I'm intrigued by the way Go abandons class hierarchies and seems to completely abandon the notion of class in the typical object oriented sense. Also, I'm amazed at the way interfaces can be defined without the type which implements that interface needing to know. Are there any terms which are/can be used to characterize this type of programming methodology and language paradigm (or perhaps specific aspects of it)? Is the Go language paradigm sufficiently new and distinct from the classical OOP paradigm and sufficiently important in the history of computer programming to warrant a unique name?


title: Should I move invariant out of cycle

text: Should I care about moving invariants out of cycle scope if it worsens code readability? Let's take a look at a simple example:               for (var i = 0; i < collection.Count; i++)     {        ...     }      vs.               var collectionCount = collection.Count;     for (var i = 0; i < collectionCount; i++)     {        ...     }      The performance of second piece of code is better or equal to first one. It will be equal only if collection is fixed-size and Count is not calculated every time. It will be much better if, for example, collection is Linked List which doesn't cache somewhere its Length. I understand that second approach will unlikely kill my application performance (it is much more likely some inefficient SQL query will) but at the same time I don't feel comfortable when I write second piece of code as I miss (small) optimization. But at the same time from readability point of view I like the first piece of code more (less lines of code, less variables). I guess it is minor thing and may be it doesn't worth discussing but I would like to hear your opinion.


title: How to manage the task of reviewing localized strings by a non-developer?

text: In .NET Framework, localized strings are located in an XML file (or multiple files). Those files are part of the project and are committed to the source control as any other source code file. Usually, Visual Studio is used to display those files as a table and edit the localized strings. I work in a small team on a product which should have a multilingual interface.   1. As a developer, I draft the localized strings in both languages, given that the translation may be inexact,   2. Another person from the team (a non-developer) reviews the content in both languages and corrects it if needed. The current issue is that the non-developer person would not use neither source control, nor an IDE, since it would be too cumbersome and difficult (version control _is_ difficult for non-developers) for this person. An alternative solution would be for me to export the localized strings as an Excel file, wait for this person to review the Excel, then to re-import the modified strings. The caveat here is that I may be creating other strings, renaming existing ones, etc., making it difficult to diff the local version with the reviewed one. What to do? How does it happen in other teams?


title: Data validation best practices: how can I better construct user feedback?

text: Data validation, whether it be domain object, form, or any other type of input validation, could theoretically be part of any development effort, no matter its size or complexity. I sometimes find myself writing informational or error messages that might seem harsh or demanding to unsuspecting users, and frankly I feel like there must be a better way to describe the validation problem to the user. **I know that this topic is subjective and argumentative.** I've migrated this question from StackOverflow where I originally asked it with little response. Basically, I'm looking for good resources on data validation and user feedback that results from it at a theoretical level. Topics and questions I'm interested in are:   1. **Content**     * Should I be describing what the user did correctly or incorrectly, or simply what was expected?     * How much detail can the user read before they get annoyed? (e.g. Is "Username cannot exceed 20 characters." enough, or should it be described more fully, such as "The username cannot be empty, and must be at least 6 characters but cannot exceed 30 characters."?)   2. **Grammar**     * How do I decide between phrases like "must not," "may not," or "cannot"?   3. **Delivery**     * This can depend on the project, but how should the information be delivered to the user?      * Should it be obtrusive (e.g. JavaScript alerts) or friendly?     * Should they be displayed prominently? Immediately (i.e. without confirmation steps, etc.)?   4. **Logging**     * Do you bother logging validation errors?   5. **Internationalization**     * Some cultures prefer or better understand directness over subtlety and vice-versa (e.g. "Don't do that!" vs. "Please check what you've done."). How do I cater to the majority of users?   6. **Accessibility** (edit)      * This is an extension of the _delivery_ topic, but what are the best options for providing feedback to the visually impaired (color blindness or full blindness)? I may edit this list as I think more about the topic, but I'm genuinely interested in proper user feedback techniques. I'm looking for things like research results, poll results, etc. I've developed and refined my own techniques over the years that users seem to be okay with, but I work in an environment where the users prefer to adapt to what you give them over speaking up about things they don't like. I'm interested in hearing your experiences in addition to any resources to which you may be able to point me.


title: PyQt design issues

text: I've been working on a my first real project using PyQt lately. I've done just a little bit of work in Qt for C++ but nothing more than just messing around. I've found that the Qt python bindings are essentially just a straight port of C++ classes into python, which makes sense. The issue is that this creates a lot of messy, unpythonic code. For example if you look at QAbstractItemModel, there's a lot of hoops you have to go through that forces you to hide the actual python. I was just wondering if there's any intention of writing a python implementation of Qt that isn't necessarily just a wrapper? Either by Nokia or anyone else? I really like Qt but I would love to be able to write more pythonic code. I hope this is OK to ask here. I'm not trying to start a GUI war or anything.


title: If I try to monetize free software, what could possibly prevent someone from forking that software and creating a proprietary version?

text: I've only recently begun to learn about the tensions between free and proprietary software, and I've been very confused by the way that free software can make money. I understand that free software is "free as in speech, not as in beer," but if I release an open source program and then try to monetize it, what could possibly prevent someone from forking that software and creating a proprietary version? Is the only thing that stops them the investment of other members of the open source community in improving the software? It seems like every improvement free software makes is transparent so a proprietary copycat can make sure they are always up to date with the latest features in the free version, and then add their own features on top of that independently. I'm confused about how free software can survive in serious competition with proprietary software.


title: What processes do you follow when developing code for large corporations?

text: I'm interested in learning about any process you need to follow when coding for a large corporation. For example, it would be nice to see a little insight into how you (or your manager) handles   * Code reviews   * Deployment to production   * Procuring HW/SW for development   * Evaluating vendors   * SOX Compliance   * Security reviews  ... or anything else I may have missed. It would also be nice to see if you think there is any benefit to the paperwork, or if there is a comparable software alternative. I'm interested in everything from paperwork, meetings, routines, or even software tools you may use.


title: How to communicate side effects in a RESTful API on the server to the client?

text: I have been thinking a lot about Hypermedia REST-APIs for the last couple of weeks. One thing I am not quite sure about is how I want to model side effects on the server side. In my current project, I am using JSON+HAL as the content-type, and am making use of links and embedded resources. For example: Let's say some resource A gets PATCHed by the client, e.g. because a money value gets updated. Suppose this resource is used by another resource B. This resource B represents the sum of all resources that are of A's kind. Hence resource B would have provide a new value after A has been updated. What's the best way to communicate this to the client? The following options come to my mind:   1. Return all possibly updated links in the PATH response, i.e. especially a link to B. The client will then try to GET all provided links.   2. Embed those resources that may have been updated, and provide links to all other relevant resources.   3. Return a link to a parent resource of both A and B, because the whole state of A and B has been changed, and possibly even more. Option 1) seems not right, because I may provide links to resources that are not really in the vicinity of A. Also, I cannot distinguish between resources that I should GET because they were updated, and resources that may be useful in other ways (for navigation, manipulating application state, creating new resources, ...) Option 2) is basically the same as 1), but with the advantage that an embedded resource tells me directly the state of the resource, which is useful when I embed B. Option 3) sounds the best to me so far. In this example I might have a parent resource "spreadsheet", which contains row resources, like A, and a sum resource, like B. If I change one of the rows, I get a link back to the spreadsheet, which the client can then GET, and either get all rows and sums embedded or as links. Maybe I am missing some other options. I am really not sure what the best practice here is.


title: Why is "working with files" is an important subject when learning Objective C?

text: I'm reading a book on Objective C, and I was wondering how important the subject Working with files for learning to develop iOS in particular? On you tube the tutorials are very short, maybe 10 min of video that teaches you how to do stuff with files and URL's. But in the book its a very long chapter with lot's of detail. The basics of working with files and URL's if very clear and simple, so I was wondering when I be really need this and this information become handy, and if I need to dig that deep in this topic right now? The main question is, if I know the basics, can I move on and come back when I need it? or it's a really crucial to dig in right now?


title: Highly scalable and dynamic "rule-based" applications?

text: For a large enterprise app, everyone knows that being able to adjust to change is one of the most important aspects of design. I use a rule-based approach a lot of the time to deal with changing business logic, with each rule being stored in a DB. This allows for easy changes to be made without diving into nasty details. Now since C# cannot Eval("foo(bar);") this is accomplished by using formatted strings stored in rows that are then processed in JavaScript at runtime. This works fine, however, it is less than elegant, and would not be the most enjoyable for anyone else to pick up on once it becomes legacy. Is there a more elegant solution to this? When you get into thousands of rules that change fairly frequently it becomes a real bear, but this cannot be that uncommon of a problem that someone has not thought of a better way to do this. Any suggestions? Is this current method defensible? What are the alternatives? Edit: Just to clarify, this is a large enterprise app, so no matter which solution works, there will be plenty of people constantly maintaining its rules and data (around 10). Also, The data changes frequently enough to say that some sort of centralized server system is basically a must.


title: Define "production-ready"

text: I have been curious about this for a while. What exactly is meant by "production-ready" or its variants? Most recently I was looking for information about sqlite and found this thread, where many people suggest sqlite isn't ready for production. I know the difference between development/testing and production; my definition of production is anything that is provided to the customer or will be used by non-programmers. However, there seem to be many items that aren't defined as production-ready. But in reality, they may be perfectly suited and people just have a predujice against them, e.g. sqlite, python, non-MS products, etc. Small office vs. enterprise? Single user vs. multi-user? Client vs. server? Where do you draw the line?


title: Optimizing XML based protocol

text: We have recently replaced binary based communication protocol with XML one (between browser based client and server). The implementation is almost complete, however I am looking for ways to improve its performance both for faster transmission and parsing. Any ideas ? Please post link along with the answer.


title: Do non-pure interpreters still make the guarantees of functional programming?

text: I am assuming the implementations/compilers/generated C code (referred to hereinafter as generic, 'interpreter') for most functional programming languages are written in non-pure functional languages. If this is the case, the underlying interpreter for any given functional programming language exhibits destructive updates and is referentially opaque. Functional constructs are designed to make certain guarantees, such as concurrency and provability. If the interpreter is indeed an imperative program, how is it able to guarantee the 'no side-effects' properties of pure functional programs? Surely optimisations to functional code by the interpreter include changing the nature of recursive functions to imperative ones? My question is: **How do imperative interpreters still make guarantees about the functional program they are executing without being inherently functional themselves?**


title: How to implement a hybrid role-based access control model?

text: I am writing an enterprise web-forms-frontend application for in-house use. It has Direct access control (DAC) masquerading as Role-based access control (RBAC). For anonymization purposes, let's call the main unit of information stored in my application a Document, and the roles in the company a Boss, a Grunt and a C-level executive. There are also Externals (e.g. somebody working for a business partner of ours). The general guideline is that everybody but externals should be able to read all documents, C-level execs can write everything, Bosses can write the Documents belonging to their own department, and Grunts can only write Documents personally assigned to them. Fairly standard thus far. But what users actually want is that they can make arbitrary exceptions to the above. They want that any person in the system can be granted write access to any Document, and that Externals can be granted Read access to any document. (Actually, it is more complicated than that, with more roles and finer granularity of permissions, including management of who can propagate which permission to others, but the above description illustrates the core of the problem well enough). So what I have is basically permissions on a personal level, and the roles are only a convenient way of having default settings for the personal-level permissions when a user or a Document is added to the system, instead of having somebody fill out a whole row or column in an access control matrix by hand. Now I have already designed a Permissions table in my database, which has a User FK, Document FK and columns for the different types of permissions. What I am not sure is what I should save in the table.   * Alternative 1: I save all permissions in this table (pure DAC) and have the logic tier mimic a RBAC. E.g. when a new Boss is added, a row for each Document in the system is added to the DB, with Read permissions for all documents and Write for the Documents of her department.    * Alternative 2: I save the deviations from the role guidelines only. So when a new Boss is added, nothing is written to the permissions table. But when an executive gives a Boss the rights to write to a Document from a different department, then a single row is added to reflect that information.  I am not sure which alternative would be better. The first one feels closer to textbook implementation, and if a principle has made it into a textbook, then there is normally good reason to use it. But in my case, it also hurts the DRY principle - after all, if the information that a C-level exec can write to Document X is derivable from his role, writing a row with this information in the DB is redundant. What are the advantages and disadvantages of each approach in terms of a) application performance and b) complexity of implementation? What headaches can I expect from each? Keep in mind that 1) I don't plan to implement a full logic tier. The whole application is practically a convenient CRUD frontend to a database, so I will be doing DB queries for each page view instead of keeping a collection of Document objects in memory. (I know the advantages of a MVC pattern, but it was decided that it will be overkill for this project). 2) I am programming this in ASP .NET 4.5, so the closer I stay to roles, the more I can let the framework do the heavy lifting for me. 3) I have thought of implementing groups orthogonal to the roles to manage access, but it doesn't make sense in my case.


title: How would I make a suggestion for a change to the SQL standard

text: If I wanted to make a suggestion to a change to how the `UPDATE` statement works in `SQL`, how would I go about it? Is there a website for the next standard? I googled, but just kept getting the Wikipedia page.


title: Should You Log From Library Code?

text: If I am developing a Java library, is it good practice to issue log statements from within the library's code? Having logging within the library will make debugging and troubleshooting more transparent. However, on the other hand, I do not like littering my library code with logging statements. Are there any performance implications to consider as well?


title: Where can I read exemplary Scheme code?

text: Edi Weitz's libraries are often brought up when people ask for exemplary code in Common Lisp, the kind to read and learn from. Are there any open-source Scheme projects or libraries that you can recommend above others? I'm working in Gambit, so I'd prefer code without the Racket extensions. Applications in games or scientific/numeric computing would be a plus, but really I'm just looking for code to learn from. (Game and numerical code just tends to be easier to dive into for me, since the overall point of the project is readily understandable.) **Edit:** I am looking for complete projects and libraries, rather than isolated snippets such as those in a book. (Partially this is because I'm already reading SICP, and I'm looking for real-world applied examples to complement it, rather than another source of isolated functions/macros.)


title: Programming languages classification / taxonomy

text: Is there a rigorous way to classify programming languages ? If so, can the various "dimensions" be quantified ? (degree of purity) For instance, I just went on the Shade language website (I am not affiliated with it in any way) and saw :   * "semi-functional" -> But how much is that language semi-functional ? -> quantification need   * "full type checking" -> So type checking can be partial -> can be quantified too ?   * Objectif model / no object model...


title: Sequence Diagram for Response Redirect in ASP.Net Webforms

text: In asp.net webforms I have a home aspx page that has a “Go” button. [This is the only control in this page]. When this button is clicked, the user is redirected to “UserProfile.aspx” page. How can we represent this redirect action in sequence diagram? Any reference articles/blogs for this?


C# seems to be popular these days. I heard that syntactically it is almost the same as Java. Java and C++ have existed for a longer time. For what reasons should I choose C# over Java and C++?


title: Should we choose Java over C# for a new project?

text: We have a team of .NET developers (C#) with a range of experience from 2 to 6 years. Over the last few years we have been developing Silverlight, ASP.NET MVC, and WPF applications. However, there is a new two year project which means we will develop a HTML5 application on Linux. The company I work for would like all developers across their offices to use the same programming language which is Java. Although there is talk of using Mono but using the same language and sharing modules, services, etc. already created in Java is the main reason for moving to Java. Some of the developers here are upset. How do I find something positive in moving over that will convince the other developers? There will be a training budget, but the thought of learning to work with Java libraries and a new platform (Linux) will be scaring a lot of the guys. What should I do?


title: Drag-n-drop programming - would it fly?

text: All programming languages I know of are written - i.e. typed out as lengths of text one way or another. But I wonder if there's any programming language where you can just drag-n-drop the whole program; to get a loop, you select this box over here and drag it to that section of the "code" over there, and so on. And if there isn't one like this, would it fly if one was invented? Personally I don't believe it would be such a good idea, but I'd like to hear what you think.


title: Static linking with modified LGPL code

text: I'm writing a library which links with modified LGPL library,so two questions:   1. Do I have to make my code LGPL in case of static linking with LGPL library?   2. in case of dynamic linking?


title: In-memory datastore in Haskell

text: I want to implement an in-memory datastore for a web service in Haskell. I want to run transactions in the `STM` monad. When I google _hash table steam Haskell_ I only get this: `Data. BTree. HashTable. STM.` The module name and complexities suggest that this is implemented as a tree. I would think that an array should be more efficient for mutable hash tables. Is there a reason to avoid using an array for an `STM` hashtable? Do I gain anything with this steam hash table or should I just use a steam ref to an `IntMap`?


title: How should calculations be handled in a document database

text: Ok, so I have a program that basically logs errors into a nosql database. Right now there is just a single model for an error and its stored as a document in the nosql database. Basically I want to summarize across different errors and produce a summary of the "types" of errors that occured. Traditionally in a SQL database the this normalization would work with groupings, sums and averages but in a NoSQL database I assume I need to use mapreduce. My current model seems unfit for the task, how should I change the way I store "models" in order to make statistical analysis easy? Would a NoSQL database even be the right tool for this type of problem? I'm storing things in Google AppEngine's BigTable, so there are some limitations to think of as well.


title: How to deploy a GNU GPL software with Java Web Start?

text: I deploy an interactive software using Java Web Start. This is a quiet useful deployment technology and I don't want to change. Besides I am about to publish my software under a GNU GPL license. Usually, when a user installs a new software he is asked to read the license terms and accept it. Is there any equivalent process with Java Web Start ? How can I ask my user to accept the license terms before using it ?


title: Building a web app with encrypted MySQL database entries?

text: I have some experience in building PHP based websites with MySQL access, storing encrypted user details, but all other fields being plain text. My most recent project will require sensitive data to be stored in the database. All of which I'm hosting myself. I want to set up a system where a user can access his own entries and see the plain text results, but even if he was able to access someone else's they would be encrypted, unintelligible strings. I have an idea of how to accomplish this, but perhaps it's not optimal or there exist tools to do this already in a more efficient way.   1. Store username as plain text, and password encrypted with sha1(). Or both encrypted with sha1().   2. Take the user's password (not the encrypted one, but the one he typed in and use it do define a key specific to that username and password, which will then be stored as a session variable.   3. Encrypt, or decrypt all of that users data with that key. In my opinion even if someone gained access to the database and saw a list of plain text usernames and encrypted passwords they couldn't figure out the specific key since it's not stored anywhere. Therefore even if access was gained, they couldn't decipher the content of the sensitive database fields. Of course I'm building in ways to stop them accessing the database anyway, but as a catch-all effort this seems like a good set of steps. Could the experts please comment on this, and offer some advice? Thanks a lot.


title: What do you need to know before you build something like Facebook / Twitter / YouTube?

text: Of course you will need a programming language! But what other things that you should know before you build your first steps for a large website which will be for the community!   * What else do you need to learn in the programming language itself?


title: Starting with BI / Data Analysis

text: We have a bunch of data about our customers and we'd like to learn more about it. Writing queries to pull data out is not a problem, and we're doing that right now, but we'd like to take it to the next level. I keep hearing about BI, data analysis, regression, predictive analysis, etc. So, if we want to glean more information from our data, where should we start? Should we look into a BI tool? Should we just start learning about data analysis? Or maybe look into R? Any books you would recommend to start? Should I go back to school (college level math, but nothing fancy -- willing to learn)? Any online courses you recommend? Ultimately we would like to end up with more intelligent filters that would allow us to seep through our data more efficiently. Something like "only include people outside of cities in state X and Y because Z and Q". Thank you for any suggestions you may have. **EDIT** : Per JeffO's request. It's not necessarily about tools. More like: What should be the next step in learning more about our data, about the relationships within our data that we may not know about? Or where should we start exploring things like regression or predictive analysis?


title: Is it a good idea to always use Google as the first step to solving a problem?

text: > **Possible Duplicate:**   >  Importance of learning to google efficiently for a programmer? Avoiding lengthy discussions, as a senior level student in CS, how can I get away from Googling problems I run into? I find myself using it too much; I seemingly reach for the instant answer and then blindly copy and paste code, hoping it works. Anyone can do that. I've read the related threads about being a better programmer, but mostly those recommend practicing on pet projects, which I have done, but again I feel EVERY wall encountered, from design through completion, was hurdled with Google. Do professionals instantly "research" their problem? Or do you guys step back and try and figure it out yourselves? I'm talking about both 'algorithm/design' problems as well as compiler issues.


title: Can recursion be done in parallel? Would that make sense?

text: Say, I am using a simple recursive algo for fibonacci , which would be executed as:               fib(5) -> fib(4)+fib(3)                 |      |           fib(3)+fib(2)|                     fib(2)+fib(1)      and so on Now, the execution will still be sequential. Instead of that, how would I code this so that `fib(4)` and `fib(3)` are calculated by spawning 2 separate threads, then in `fib(4)`, 2 threads are spawned for `fib(3)` and `fib(2)`. Same for when `fib(3)` is split to `fib(2)` and `fib(1)` ? (I'm aware that Dynamic programming would be a much better approach for Fibonacci, just used it as an easy example here) (if someone could share a code sample in C\C++\C# as well, that would be ideal)


title: Ping one remote server from another remote server

text: It's simple to ping a server in C#, but suppose I have servers A, B and C. A connects to B. A asks B to ping C, to check that B can talk to C. A needs to read the outcome. Now, first of all is this possible without installing an application onto B? In other words, can I perform the entire check from just running a program on A? If so, can anyone suggest the route I would take to achieve this? I've looked at sockets but from the examples I've seen these require a client AND server application to function.


title: Is avoiding the private access specifier in PHP justified?

text: I come from a Java background and I have been working with PHP for almost a year now. I have worked with WordPress, Zend and currently I'm using CakePHP. I was going through Cake's lib and I couldn't help notice that Cake goes a long way avoiding the "private" access specifier. Cake says > Try to avoid private methods or variables, though, in favor of protected > ones. The latter can be accessed or modified by subclasses, whereas private > ones prevent extension or re-use. in this tutorial. Why does Cake overly shun the "private" access specifier while good OO design encourages its use i.e to apply the most restrictive visibility for a class member that is not intended to be part of its exported API? I'm willing to believe that "private" functions are difficult test, but is rest of the convention justified outside Cake? or perhaps it's just a Cake convention of OO design geared towards extensibility at the expense of being a stickler for stringent (or traditional?) OO design?


title: Software Design Idea for multi tier architecture

text: I am currently investigating multi tier architecture design for a web based application in MVC3. I already have an architecture but not sure if its the best I can do in terms of extendability and performance. The current architecure has following components   * DataTier (Contains EF POCO objects)   * DomainModel (Contains Domain related objects)   * Global (Among other common things it contains Repository objects for CRUD to DB)   * Business Layer (Business Logic and Interaction between Data and Client and CRUD using repository)   * Web(Client) (which talks to DomainModel and Business but also have its own ViewModels for Create and Edit Views for e.g.) Note: I am using ValueInjector for convering one type of entity to another. (which is proving an overhead in this desing. I really dont like over doing this.) My question is am I having too many tiers in the above architecure? Do I really need domain model? (I think I do when I exposes my Business Logic via WCF to external clients). What is happening is that for a simple database insert it (1) create ViewModel (2) Convert ViewModel to DomainModel for Business to understand (3) Business Convert it to DataModel for Repository and then data comes back in the same order. Few things to consider, I am not looking for a perfect architecure solution as it does not exits. I am looking for something that is scalable. It should resuable (for e.g. using design patterns ,interfaces, inheritance etc.) Each Layers should be easily testable. Any suggestions or comments is much appriciated. Thanks,


title: Macro vs. Static functions in Header

text: for a lot of quick tasks where one could employ a function `f(x,y)`, in plain C, macros are used. I would like to ask specifically about these cases, that are solvable by a function call (i.e. macros used for inlining functions, not for code expansion of arbitrary code). Typically C functions are not inlined since they might be linked to from other C files. However, static C functions are only visible from within the C file they are defined in. Therefore they can be inlined by compilers. I have heard that a lot of macros should be replaced by turning them into static functions, because this produces safer code. Are there cases where this is a not good idea? Again: Not asking about Code-Production macros with ## alike constructs that cannot at all be expressed as a function.


title: Which are the best ways to organize view hierarchies in GUI interfaces?

text: I'm currently trying to figure out **the best techniques** for organizing **GUI view hierarchies** , that is dividing a window into several panels which are in turn divided into other components. I've given a look to the Composite Design Pattern, but I don't know if I can **find better alternatives** , so I'd appreciate to know if using the Composite is a good idea, or it would be better looking for some other techniques. I'm currently developing in Java Swing, but I don't think that the framework or the language can have a great impact on this. **Any help will be appreciated.**               ---------EDIT------------      I was currently developing a frame containing three labels, one button and a text field. At the button pressed, the content inside the text field would be searched, and the results written inside the three labels. One of my typical structure would be the following:               MainWindow         |         Main panel            |            Panel with text field and labels.            |            Panel with search button      Now, as the title explains, I was looking for a suitable way of organizing both the MainPanel and the other two panels.   But here came problems, since I'm not sure whether organizing them like attributes or storing inside some data structure (i.e. LinkedList or something like this). Anyway, I don't really think that both my solution are really good, so I'm wondering if there are really better approaches for facing this kind of problems. **Hope it helps**


title: Methodology To Determine Cause Of User Specific Error

text: We have software that for certain clients fails to download a file. The software is developed in Python and compiled into an Windows Executable. The cause of the error is still unknown but we have established that the client has an active internet connection. We suspect that the cause is due to the clients network setup. This error cannot be replicated in house. What technique or methodology should be applied to this kind of specific error that cannot be replicated in house. The end goal is to determine the cause of this error so we can move onto the solution. For example;   * Remote Debugging: Produce a debug version of the software and ask the client to send back a debug output file. This involves alot of time (back and forth communication) and requires the client to work and act in a timely manor to be successful.    * In-house debugging: Visit the client and determine their network setup, etc. Possibly develop a series of script tests before hand to run on the clients computer under the same network.    * Other methodologies and techniques I am not aware of?


title: How much system and business analysis should a programmer be reasonably expected to do?

text: In most places I have worked for, there were no formal System or Business Analysts and the programmers were expected to perform both the roles. One had to understand all the subsystems and their interdependencies inside out. Further, one was also supposed to have a thorough knowledge of the business logic of the applications and interact directly with the users to gather requirements, answer their queries etc. In my current job, for ex, I spend about 70% time doing system analysis and only 30% time programming. I consider myself a good programmer but struggle with developing a good understanding of the business rules of a complex application. Often, this creates a handicap because while I can write efficient algorithms and thread- safe code, I lose out to guys who may be average programmers but have a much better understanding of the business processes. So I want to know \- How much business and systems knowledge should a programmer have ? \- How does one go about getting this knowledge in an immensely complex software system (e.g. trading applications) with several interdependent business processes but poorly documented business rules.


title: Learning Java with a simple project

text: As i remember the time when i was learning PHP, it was suggested to build a simple blog or a forum after reading the language fundamentals. I was told/read that this would cover everything that I would need to learn about PHP from a beginners book. This advice was out there in a number of places, and after following and working with PHP it seems quite good advice. Now, i am learning Java and reading the book "Thinking in Java" by Bruce Eckel. I wonder if there is any such set of similar, small projects that I could take up, that would cover all the essentials and most of what is covered in the book.


title: Which is a better design pattern for a database wrapper: Save as you go or Save when you're done?

text: I know this is probably a bad way to ask this question. I was unable to find another question that addressed this. The full question is this: We're producing a wrapper for a database and have two different viewpoints on managing data with the wrapper. The first is that all changes made to a data object in code must be persisted in the database by calling a "save" method to actually save the changes. The other side is that these changes should be save as they are made, so if I change a property it's saved, I change another it's save as well. What are the pros/cons of either choice and which is the "proper" way to manage the data? **EDIT** To provide more information, we're using Node.js, and we're writing our own wrapper for Neo4j because we feel that the current one available is not complete, or have run into issues where we need more functionality. That being said, an example of the save as you go method (these examples are in Javascript):               // DB is defined as a connection to the database via HTTP(REST)     // "data" being an object that would represent new data     var node;     db.getNodeById(data.id, function(err, result) {       node = result;       // This function task an optional callback as a third parameter because in       // in addition to setting the property on the "node" object it saves the       // new value to the database by making an HTTP request.       node.set("firstName", data.newFirstName);       // auto saved as well       node.set("lastName", data.newLastName);       // end here as the node has already been updated with your changes.     });      And the opposing example would be:               // DB is defined as a connection to the database via HTTP(REST)     // "data" being an object that would represent new data     var node;     db.getNodeById(data.id, function(err, result) {       node = result;       // This changes the value for the node object only, nothing in the       // database is changed.       node.set("firstName", data.newFirstName);       node.set("lastName", data.newLastName);       // Save all your changes       node.save();     });


title: How do you go about training a replacement?

text: I recently asked about leaving a position and got a lot of great answers. One of the common threads was that being around to train the new person would be expected and could go a long way. Now considering that (I think) most people don't stay at a company for a long time after they've given notice, and it will take time for the company to interview/hire one - that leaves for a short amount of time to get someone up to speed. I've also never trained anyone before. I did a bunch of tutoring in University and College, but teaching a language/technology is far different from training someone to replace you on your job. So the question is: how do you go about training someone to replace you in a, potentially, short amount of time?


title: How to transfer code responsibility to another developer

text: I'm in a situation at work where I have to transfer responsibility of a large code base that I inherited, re-factored and enhanced to another developer. This is the first time that I have to do such a thing and although I always thought it would be trivial the actual steps I have to follow seem vague. The code base I maintain is a module that includes a lot of stuff such as   * A persistence layer   * A service layer   * A presentation layer which sadly has a lots of business code in it   * An interface for module interaction I also have very good knowledge of the business assumptions made when it was developed as well as its technical foundation. I know that I can go with my mind's flow and give it my best but I prefer to do it in the most professional manner I can. So, I would like to ask you for advice on how I should approach this situation. Are there any standard procedures and good practices that I could follow?


title: job handover checklist

text: I have resigned my old employer to start a new job, and I need to prepare a handover [documentation to be taken by some new employee that haven't arrived yet, and would be some weeks from when I go to when they fill the position again]. So what important points should I make sure to cover, I was making some iOS apps, [90% completed], and a web portal [60% completed] the other IT engineer is here so he can update on passwords etc. Should I use some system like a wiki to leave things there for access? or just a normal doc? what other things should I consider?


title: Impact of ending contract with know-ins-and-outs lead developer of a project

text: I have a long time running project. Its been running for about 6 months. The project is very big. The lead developer/team leader designed the project and the whole project is in his brain. He knows all ins and outs. I also know almost everything. But I am not confident like him. Problem is recently he is charging quite high for simple bug fix and small change request. I am worried if I end the contract what will be the future of the project. I had 2-3 public demos. I must launch soon. The project is still in development alpha.   1. What happens to the project if I end the contract?   2. Are the high charges is because he knows I can not end the contract now?


title: What actions to take when people leave the team?

text: Recently one of our key engineers resigned. This engineer has co-authored a major component of our application. We are not hitting Truck number yet though, but we're getting close :) Before the guy waltzes off, we want to **take actions necessary to recover from this loss as smoothly as possible** and eventually 'grow' the rest of the team to competently cover the parts he authored. _More about the context: the domain the component covers and the code are no rocket science but still a lot of non-trivial stuff. Some team members can already cover a lot of this but those have a lot on their plates._ These are the actions that come to my mind:   1. Improve tests and test coverage - especially for the non-trivial stuff,   2. Update high level documents,   3. Document any 'funny stuff' the code does (we had to do some heavy duct-taping),   4. Add / update code documentation - have everything with 'public' visibility documented. Finally the questions: What do you think are the actions to take in this situation? What have you done in such situations? What did or did not work well for you?


title: Code ownership: What should I do when a dev leaves or team splits?

text: There are multiple ways of tracking code ownership (i.e., collective, team or individual). In case of team or individual ownership, how do you:   * track ownership?   * deal with situations when dev leaves or team splits/re-organizes for new projects?


title: Questions to ask before someone leaves

text: Apart from the obvious questions relating to specific project work someone is working on are there any questions I should be asking a fellow dev who is leaving the company? So far I am thinking about;   * Locations of things on the server he uses that not maybe everyone does.   * Credentials he has set up that we wouldn't have needed.    * Client details he has not yet saved into our CRM system.


title: New project from a third party and documentation

text: I'm going to become the custodian of an iOS project developed by a third party and my boss just asked me for a list of documentation that I think we should be asking the third party for when they hand over the code. I did some light searching on this and I've found incredibly varying answers to this, so I figured I'd ask a question more tailored to my particular situation. I'm working on a team of 7 individuals of varying experience levels, and I'm sure I'll be called upon to maintain or add features to this project in the future. What should I ask the third party to include when they hand off the code to help make my life easier? AppleDoc? UML diagrams?


title: Understanding high cohesion principle for methods in object oriented design

text: I know the idea of strong cohesion applies to methods as much it applies to classes. Just to be clear when I say _strong cohesion_ of a method I mean a method which does only one task and does it well. This idea really works for simple _getters_ and _setters_. But sometimes we usually come across methods that does more than one task internally , although it seems to be doing a single task if you look at a higher level of abstraction. An example of such a method can be :                public void startUp() {             List<SubSystem> subSystems = getSubSystems();             sychronized(subSystems) {                 for (SubSystem subSystem : subSystems) {                     subSystem.initialize();                 }             }         }      And inside those `subSystem#initialize()` methods a lot is going on. So is this a violation of the _high/strong cohesion_ principle ?


title: Is there a term for quasi-open source proprietary software?

text: Say a company wants to keep development of new features of a piece of software internal, but wants to make the source code for previous versions public, up to and including existing public features, so that other people can benefit from using and modifying the software themselves, and even possibly contribute changes that can be applied to the development branch. Is there a term for this sort of arrangement, and what is the best way of accomplishing it using existing version control tools and platforms?


title: Schema.org vs microformats

text: They both serve the same purpose: Providing a vocabulary for semantic markup. Schema is recognized and standardized… but the microformats standard is by an open community process. Schema exploits microdata in documentation, while microformats go on classes. (Of note: microdata means that an element must be of a single `itemtype`, while microformats allow several classes to apply to the same element. I can markup xFolk+hAtom with classes, but not with microdata.) Is this a black-and-white situation? Google says I can't use both "because it may confuse the parser". What's the consensus on these?


title: Clarification about Grammars , Lexers and Parsers

text: **Background info** ( _May Skip_ ): I am working on a task we have been set at uni in which we have to design a grammar for a DSL we have been provided with. The grammar must be in BNF or EBNF. As well as other thing we are being evaluated on the Lexical rules in the grammar and the Parsing rules - such as if rules are suitable for the language subset, how comprehensive these rules are, how clear the rules are ect. What I don't understand is if these rules are covered in a grammar defined in BNF (it's a new topic for us). **The Question** : Does a grammar for a given language that has been defined in either BNF or EBNF contain / provide rules for **_Lexical Analysis_** and/or **_Parsing_**? ( _or do these have to be specified else-where?_ ) Also what would be considered a lexical rule? And what would be considered a parsing rule?


title: What is proper etiquette for releasing a complete rewrite of an existing project?

text: I'm new to the opensource world. The project I'm working on resides on Github. (Just for reference) The project I'm working on is a plug-in for the Plex Media Server. I plan to submit my plug-in to Plex so that it will be included in their "app store". Now to my question. When I first started out, I found an older semi-abandoned plugin that did some of what I wanted but not very well. I started by contributing to that repo. I was immediately made a collaborator with full rights to the repo since the current owner said he was too busy to mess with it anymore. However, as I started to dig deeper into the code I realized that it was futile. The existing code base was terrible and there was no efficient way to fix it. I ended up just starting from scratch. The only code I used in my new plugin was the code I committed initially. Now the project is ready to be released. However I am unsure as to how to go about doing this. I see my options as follows:   1. Create a new repo and just forget about the existing one. I'm not sure if I should even mention the previous repo and or its contributors. I didn't use any of that code/resources and have created an entirely new code base. While the plugin does some of the same things the old one did, it does it in an entirely new way and more efficient way.    2. I fork the existing repo, delete the existing code, and commit my new code. I'm really new to Git, so I'm not sure if this is even possible.    3. I commit my changes to the existing repo and see how the current contributors have to say.  Of the three options, I'm strongly leaning towards the first. BUT! I'm new to open source and I want to make sure I'm doing things according to proper etiquette. I don't want to have my first project blow up in my face and become a disaster. Option two doesn't sound bad but I'm not sure if I'm supposed to do that. I'm not sure how the history and diffs would work. We're only talking about 500 - 1000 lines of code at most. So it's not a huge code base. Thanks for any input you can provide!


title: Where should UI errors be generated and printed from? Log errors?

text: Function `A()` calls `B()` calls `C()`, which encounters an error. Which function writes to the log and which function reports to the user? My first inclination is that all functions should write to the log, and that the inner-most UI-facing function should be responsible for outputting the error to the user. However, the _fix_ needs to be done in `C()`, so perhaps instead of having an super-long log file which will take a while to parse, I should simply have the function which encountered the error log the error and the parameters used to call it. Likewise, I'm not too convinced that the inner-most UI-facing function should output the error (consider CLI apps, as opposed to web or GUI apps). That was more of a gut-feeling decision, so any insight into actually _engineering_ a solution would be appreciated.


title: Where, in an object oriented system should you, if at all, choose (C-style) structs over classes?

text: C and most likely many other languages provide a `struct` keyword for creating structures (or something in a similar fashion). These are (at least in C), from a simplified point of view like classes, but without polymorphism, inheritance, methods, and so on. Think of an object-oriented (or multi paradigm) language with C-style structs. Where would you choose them over classes? Now, I don't believe they are to be used with OOP as classes seem to replace their purposes, but I wonder if there are situations where they could be preferred over classes in otherwise object- oriented programs and in what kind of situations. Are there such situations?


title: How is intermediate data organized in MapReduce?

text: From what I understand, each mapper outputs an intermediate file. The intermediate data (data contained in each intermediate file) is then sorted by key. Then, a reducer is assigned a key by the master. The reducer reads from the intermediate file containing the key and then calls reduce using the data it has read. But in detail, how is the intermediate data organized? Can a data corresponding to a key be held in multiple intermediate files? What happens when there is too much data corresponding to one key to be held by a single file? In short, how do intermediate partitions differ from intermediate files and how are these differences dealt with in the implementation?


title: What comes first, the ruby chicken or the homebrew egg?

text: Whilst installing Ruby on OsX I noticed I could do so by using a package manager called Homebrew. This seemed like an easy option, so I took it. Everything worked smoothly. Life was good. Being a curious fellow, I looked into what other benefits having homebrew installed would give me, and in my study found that Homebrew is written in ruby. Woah, wait a minute! How is it then, that I can install Ruby using something that is written in Ruby, not already having Ruby on my system, and once installed said ruby based system I STILL have to install ruby separetely? **Warning:** _Do not read this question aloud. You risk getting a Kaiser Chiefs single stuck in your head for the remainder of the day._


title: ERP/CRM Systems. Desktop Based ? Web based?

text: I have seen 2-3 ERPs in action. I am wondering what is better. Desktop based application or webbased displayed on a browser. My first experience was with a web based ERP when i was 14 years old.. It was web based and terribly slow... For most simple task you had to do lots of clicks... no keyboard support ..... Pages took ages to load. Last year I worked for migrating to a newer computer some old terminal based cobol application. The computer that worked till today and still has no problem was from 1993.   The user interface ofcourse was textbased.. The speed that guys placed orders was amazing! just typing the name of the customer , then 5-10 keys to add a product to order.... Comparing to this ERP the page for placing orders Link (click sales orders) seems terribly slow to add a product... No keyboard shortcut works to save what you added and generally I believe you need 4 times more time to place an order compared to the text interface...   Having to use both mouse and keyboard for this task is BAD and sadistic... So how can the heck these people ever use a system like that ??? So in the long run desktop application seems the only way... Of course browsers support shortcuts but the way to overide the defaults that browsers uses isn't cross compatible... That is a huge problem. Finnaly, if we MUST/forced use cloud in near future what about keyboard shortcuts?? I feel confused... I have seen converters of desktop applications to browser applications but are SLOW as hell... The question is what about user friendliness? What kind of application would you use?


title: How do you convince management to throw away a prototype?

text: I love prototyping as a fast effective way to put a UI in front of a user. Many times though, management get their beaks in the way, and the prototype is dragged kicking and screaming into main stream development. How do you manage management into not doing this?


title: Is it ever too old to learn how to become a programmer?

text: If you want to be a good developer, but start developing at the age of 26, is there any way to became a good programmer ?


title: How big can a mobile development team be without being too big?

text: I work for a company that is moving heavily into mobile. We find the majority of our customers use our mobile app pretty regularly. We have tons of things we want to add to it -- as well as to deliver all these new features on Andriod- and iOS-native apps. But I wonder how big we could possible make a mobile development team without making it too big to be practical. Can we have a mobile team that's 5 people? 10? 50? 100? If it made sense for us to build that many new features, from an Engineering standpoint is it practical? Or is there some limit of the amount of Engineers that could support a single app (across multiple platforms)?


title: Are there any free software tools to aid software cost estimation using object points?

text: I'm looking for a free (or if there is none, then paid too) software that could aid estimating the effort to create a software using object points. If anyone knows any other software that is able to aid cost estimation (and it's quite fast and reliable) then I would also be happy to hear about it. :)


title: Is it common to lie in job ads regarding the technologies in use?

text: > Wanted: Experienced Delphi programmer to maintain ginormous legacy > application and assist in migration to C# _Later on, as the new hire settles into his role..._ "Oh, that C# migration? Yeah, we'd love to do that. But management is dead-set against it. Good thing you love Pascal, eh?" I've noticed quite a lot of this where I live (Scotland) and I'm not sure how common this is across IT: a company is using a legacy technology and they know that most developers will avoid them to keep mainstream technology on their resumes. So, they will put out a advertisement saying they are looking to move their product to some hip new tech (C#, Ruby, FORTRAN 99) and require someone who has exposure to both - but the migration is just a carrot on a stick, perpetually hung in front of the hungry developer as he spends each day maintaining the legacy app. I've experienced this myself, and heard far too many similar stories to the point where it seems like common practice. I've learned over time that every company has legacy problems of some sort, but I fail to see why they can't be honest about it. It should be common sense to any developer that the technology in place is there to support the business and not the other way round. Unless the technology is hurting the business in someway, I hardly see any just cause for reworking the software stack to adhere to whatever is currently vogue in the industry. **Would you say that this is commonplace?** If so, how can I detect these kinds of leading advertisements beforehand?


title: Optionally Using GPL Library via System API in Closed-Source Application

text: Please consider the following situation: You write a closed-source application, let's call it A. A depends on a system API (i.e. provided by the OS), that is in turn configurable to use different backends. Each backend is identified by a simple string value and also selected via this identifier. The API itself is not bound by any GPL-like requirements. Now, a specific backend (B) would be preferred but is GPL-licensed. The application would run without it, and there are other backends available, just with worse performance or other downsides. Is any of the following permitted?   1. Hard-coding the identifier to B   2. Automatically selecting any available backend, but preferring B if available   3. Letting the user select a backend (and strongly suggesting B) Would it also depend on whether I ship A and B together, or just A and suggest the user that installing B would improve the application performance? I would generally think that all three options are o.k. since passing a specific string to a system API would hardly qualify for a _derived work_ (IMHO), but the FAQ of B basically state that _it does not matter how you call a function of B, any usage makes your program a derived work_. Are they right even in the three cases outlined above? P.S.: It is not my decision to make A closed-source, so GPL'ing it is not an option. P.S. 2: I omitted the names of the system API and B to keep the question more generic, but I can add them if it makes any difference. edit: From another point of view: When does the user (as opposed to the programmer) create a derived work? In the third case, it should be clear that the user creates the derived work since he installed A and B and actively selected B. This would be in line with MSalters' arguments in his comment. The second case at least makes it clear that the work does not depend on B, so this could be o.k., too. Probably it would be most in the _spirit_ of the GPL to just contact the authors; however, I'm not sure if their FAQ entry is in line with the _actual text_ of the GPL.


title: Is there any algorithm book that teaches like Head First series?

text: As a Java programmer I need to learn algorithms (for programming Challenges). I read some Head First Series (JAVA owned by me) and they are pretty brain friendly. So I was wondering is there any algorithm book that will be simple to understand and also goes to the crux of each algo.


title: What are the essential mathematics topics that a programmer should know in order to learn algorithms?

text: Being a electronics engineer, I was never exposed to any algorithms. Now I am a experienced programmer and want to learn Algorithms. I started with CLRS. But I was overwhelmed by the maths in the book. So which are the minimum maths topics should I know before I start Algorithms? Are there any good tutorials or books on this? I did find one book on maths by Donald Knuth, but i guess its too details and tough for beginners.


title: DDD and the persistence of value objects; must we denormalize?

text: I've been reading up a lot on Domain-Driven Development, and I came to the question of how to preserve lack of distinct identity with value objects (VOs). While in the DDD world, this is a requirement (yet I'm not sure I understand the full power of this) it poses problems for the lower ORM layers in terms of persistence. Tables, for the most part, like to be normalized. It makes life easy in terms of having no delete or insertion anomalies. My concern comes when implementing VOs; they do have primary keys - identities by definition (and foreign keys to their parent). Making them entities is violating DDD in favor of persistence. Instead, I could make a wrapper class that accepts a "bag" of parameters, and then attaches them to each parent's foreign key. While mechanically messy, it sounds like it will work. I've read a lot of responses on the internet (Stack Overflow also) about denormalizing tables. This concerns me, as now we're violating persistence for DDD. How to allow VOs to exist by their proper definition without a denormalization?