title: Method to store some site content data, allowing reusability

text: (Don't believe this is a "best practice" question as I believe there will be a _single better_ choice). I need to choose a data storage option to store specific site data to allow easy management and re-usability: _array; class; DB; Other;_ but am not sure which one would be adequate. The data in question is my _Services_ , which is a list of titles and descriptions. Example of the text: > **On-site SEO**   >  We provide On and Off site SEO, by careful keyword assignment and > placement, blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, > etc. > > **Logo Design**   >  We can provide clean and elegant logos suited to your current company > branding... blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah > etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, etc blah etc, > etc. Each title is no more than 5 words, and descriptions are about 70 words/350 chars, and I have about 20 titles and descriptions. As services can be changed, retracted, and new added, I want control over the data - more than just editing a view/template file where the raw output/HTML is done, because I:   1. Require the data to be reusable on different templates   2. Want the option to use only a part of each data, eg just the title(s) so a specific array index, or class method, DB table row, etc I'm reluctant use an array, given the size of the _Description_ text and number of services (20). And it might end up fiddly accessing a specific array value, having to know the exact key (the title), and the key being long.   I could use a multidimensional array, with the top level key being a simple reference, but it seems well overkill for the requirements. It seems a waste of a class as the data itself is static, and feel I'd be abusing the point of OOP a bit. I could use a DB, but the site doesn't require a DB for anything else currently, though am happy to implement one if worthwhile for this. The site is on a framework, loosely on MVC/P, so can implement anything easily. So, out of the options: array; class; database; (other?) which would be the most suitable for this scenario? The overhead difference is not an issue, as it'll be marginal enough between all three for my requirements (small site, good hosting etc). Access to said data will only be on a couple of pages, so having it in memory isn't a large requirement (AFAIK).


title: Platform Independency Vs Architecture Neutrality

text: Is it true that platform independency is more of a myth today? Because programmers look for efficiency and power over portability which have to be compromised to some extent when achieving platform independency. On the other hand architecture neutrality is welcomed because it provides a very powerful way to make a software which can dominate a particular operating system family. My question is: Lets consider a hypothetical situation where we have to pick either one of them.What should be compromised? Portability or Power? I know this question is a bit subjective,but I'm looking for your views in general. Thank you. **EDIT:** Is it right to accept a particular answer just for the sake of it,especially for a question that would be answered according to individual perspectives?


title: Has anyone used git as a runtime datastore in their application?

text: I used to work on a document workflow system, and it basically implemented a half-baked version control system for documents; using a database for versioning information and a filestore for the files. It was a lot of code, and hard to maintain. There were all sorts of bugs with locking and similar things, you name it. If I had to rewrite it from scratch, I would seriously consider using git as my data store. It occurred to me that I haven't read much about git (and most version control systems) being used in application implementations, as versioned data stores. What applications use git, or another VCS, behind the scenes for storing and versioning data?


title: Consuming JSON stream into AWS Database on the cheap

text: I'm working on a project that needs to consume a JSON stream (approximately 1MB / minute), and parse and insert objects into a database. Amazon's DynamoDB or SimpleDB seem like attractive options for this. Is there a web service that can run a very simple script to eat the data and put it in a database? I could use a worker on Heroku or Elastic Beanstalk, or even pure EC2, but I'd like to find a service that's much cheaper, due to the very low amount of bandwidth and CPU required. (Sorry for the crappy tags. I'm not even sure where to categorize this question.)


title: Practical mysql schema advice for eCommerce store - Products & Attributes

text: I am currently planning my first eCommerce application (mySQL & Laravel Framework). I have various products, which all have different attributes. Describing products very simply, Some will have a manufacturer, some will not, some will have a diameter, others will have a width, height, depth and others will have a volume. Option 1: Create a master products table, and separate tables for specific product types (polymorphic relations). That way, I will not have any unnecessary null fields in the products table. Option 2: Create a products table, with all possible fields despite the fact that there will be a lot of null rows Option 3: Normalise so that each attribute type has it's own table. Option 4: Create an `attributes` table, as well as an `attribute_values` table with the value being varchar regardless of the actual data-type. The products table would have a many:many relationship with the attributes table. Option 5: Common attributes to all or most products put in the products table, and specific attributes to a particular category of product attached to the categories table. My thoughts are that I would like to be able to allow easy product filtering by these attributes and sorting. I would also want the frontend to be fast, less concern over the performance of the inserting and updating of product records. Im a bit overwhelmed with the vast implementation options, and cannot find a suitable answer in terms of the best method of approach. Could somebody point me in the right direction? In an ideal world, I would like to offer the following kind of functionality - http://www.glassesdirect.co.uk/products/ to my eCommerce store. As can be seen, in the sidebar, you can select an attribute the glasses to filter them. e.g. male / female or plastic / metal / titanium etc... Alternatively, should I just dump the mySql relational database idea and learn mongodb?


title: Is there an efficient way to adapt data from a structure to another in c++?

text: I'm writing an interface between two configuration models that use different structures. While I know that there is no "magic" way to do the translation from a structure type to another, I wandered if there might be some best practices or an efficient/effective way to setup such a system. I think it's similar to how programs may manage different configuration structures accross versions. Here's a simple example: let's say we have a structure of type A which contains 3 parameters:               struct A {       int alpha;       bool beta;       bool charlie;     };      The second configuration structure share the same parameters, but in a different order, let's see structure B:               struct B {       union {         struct {           char beta : 1;           char charlie : 1;         } bit;         char field;       }       int alpha;     };      A simple program to convert an A to a B would be:               void convert(A const *aelem, B *belem) {           belem->alpha = aelem->alpha;           belem->bit.beta = aelem->beta;           belem->bit.charlie = aelem->charlie;         }      So, while this may seem fairly simple with such basic structures, I'm dealing with dozens of structures, each of one contains around 50 parameters. So do anybody knows of a good pattern to follow for such a problem ?


title: How can I have a shell script log into a remote server and execute imqcmd there?

text: I want to write a shell script to connect to the remote server and execute a command (any linux command). I am using linux and want to prepare a shell script which can login to the virtual directory server and execute a given command. I.e. if I want to execute the `imqcmd` command, how can I do this?


title: The best way to implement authorization for a REST API

text: We develop social-based applications for mobile. Every application consumes RESTful API web-services. When I implement login I usually store the username and password somewhere on device. Then I send them and as a response I get access to my profile. But I also know there's another way to do this. One somehow generates a token with a particular algorithm, and then send it instead of the username and password to gain access. How should I implement that? Should I send this token along with every other request than login?


title: Scenario to illustrate how unit testing leads to better design

text: For an internal training session, I'm trying to come up with a simple scenario that illustrates how unit testing leads to better design, by forcing you to think about things like coupling before you start coding. The idea is that I get the participants to code something first, without considering unit testing, then we do it again, but considering unit testing. Hopefully the code produced second time round should be more decoupled and maintainable. I'm struggling to come up with a scenario that can be coded quickly, yet can still demonstrate how unit testing can lead to better overall design.


title: Understanding Backtracking in C++

text: I have a good basic understanding of the fundamentals of C++, I also have an understanding of how recursion works too. I came across certain problems like the classic eight queens problem and solving a Sudoku with Backtracking. I realize that I'm quite lost when it comes to this, I can't seem to be able to get my mind around the concept of going back in the recursion stack and starting again in order to solve the problem. It seems easy with a pen and paper but when it comes to writing code for this, I'm confused on how to begin attacking these problems. It would be helpful if there were a tutorial aimed at beginners to backtracking or if there were a good book where this was covered. If somebody can shed light on this topic or give me some links to decent references, I'd be really grateful. And yes I do know that it would be easier in functional languages but I'd like to understand the implementation in imperative languages too.


title: How deep should we dive into testing different layers

text: We use Drupal 7 as our base CMS tool. For one specific product, something like an ERP, we've created sort of a non- drupal layer, to keep our specific business code in. It would be something like this:               -------------     |  Business | -> This would be our business specific code layer     -------------     |    Glue   | -> This is where we connect with the basic Drupal API as we need     -------------     |   Drupal  | -> This is Drupal API     -------------      We have the concept of `Repository`, which is a basic class that retrieves something from the database in the form of an `Entity` or a `ArrayObject` of `Entities`. This layer is connected to Drupal, since it needs access to the `db_query()` method, from the Drupal 7 API. Our whole `Business` layer is tested using `PHPUnit`, with 100% coverage. Now we are trying to test the `Glue` layer as well, the unit of the `Repositories`, their return values and parameters. In order to do that, we came to the conclusion that we would need to mock the `Drupal` database access API. But to do that, what would be the correct or best approach?   * Wrap the `db_query` function from `Drupal` into a class that could be mocked in the tests?   * Not test the `Repositories` at all?


title: How can I write byte[] to socket outputstream and specify the end of file?

text: I've googled 2 days straight and I can't find how to do this. I have an open stream between client and server, and client will send a JSON string (encrypted to bytes) to the server each 3 to 5 seconds. How can I write to the `Socket` `OutputStream` so that I can read each JSON string in the server. I'm guessing I need to specify some kind of end of file or something, but can't find any info on how to achieve this.


title: Why is a software development life-cycle so inefficient?

text: Currently the software development lifecycle followed in the IT company I work at is:   * The "Business" works with a solution manager to build a Business Requirement document   * The solution manager works with the Program manager to build a Functional Spec   * The PM works with the engineering lead to develop a release plan and with the engineering team to develop technical specifications   * If there are any clarifications required, developers contact the PM who contacts the solution manager who contacts the business and all the way back introducing a latency of nearly 24 hours and massive email chains for any clarifications   * By the time the tech spec is made, nearly 1 month has passed in back and forth   * Now, 2 weeks go to development while the test writes test cases   * Code is dropped formally to test, test starts raising bugs. Even if there is 1 root cause for 10 different issues, and its an easily fixed one, developers are not allowed to give fresh code to test for the next 1 week. After 2-3 such drops to test the code is given to the ops team as a "golden drop" ( 2 months passed from the beginning)   * Ops team will now deploy the code in a staging environment. If it runs stable for a week, it will be promoted to UAT and after 2 weeks of that it will be promoted to prod. If there are any bugs found here, well, applying for a visa requires less paperwork This entire process is followed even if a single SSRS report is to be released. How do other companies process such requirements? I'm wondering why, the business cannot just drop the requirements to developers, developers build and deploy to UAT themselves, expose it to the business who raise functional bugs and after fixing those promote to prod. (even for more complex stuff)


title: What parts of Java do I need to learn for specific software projects?

text: I'm starting a 12 week Java course next month through my local junior college. I'm starting from square 1. I have a basic understanding of OO and Java will be my first OO language. My Google-Fu returns way too much and I can't tell which is good, bad, etc. As far as learning the language, is it best to use a plain editor, I use JEdit currently, or an IDE like Eclipse or Netbeans? I don't have experience with either IDE. Is there other IDEs I should consider? My project goals are:   * GUI programs to control different radios and test equipment, which means I/O via USB, sound card, and networking across *NIX, Windows, and Mac OS.   * Programming for Android devices, both phone and tablets. Database backed apps for logging data. Quite possibly accessing radio/test gear over WiFi.   * JBoss environment.  How should I setup a testing environment for different platforms?


title: Building an executable

text: I am an Electronics engineer so forgive my newbieity. Ok I want to build an `exe` file for multiple steps to be done on a windows when someone press on that file. the steps are:   * Install a media center,   * Change some data in the files of the media center,   * Install some plug ins to the media center,   * Change some setting in this media center,   * Make this media center work as shell on windows booting. The file should include:   * The media center installation files,   * The data which will be changed,   * The plug ins. I prefer to add like a unique password for every media center so it will work on this specific one only and only used for installation. Is this possible?


title: If I own an open source project why would I not host it on Github?

text: I've noticed that one rather well-known open source project (which I won't name so that noone focuses too much on that specific project) offers sources for download as a .zip via FTP instead of having them on GitHub. To me looks like GitHub would be more convenient.   1. It's free for open source projects   2. It has change history and many other perks of a version control system   3. If I want to change something I can just fork-change and then make a pull request instead of writing a long email explaining what to change in which file That's just what I could think of in one minute. Now what problems are there with Github that would make me prefer shipping sources as an archive via FTP?


title: Copyright law with regard to MIDI tracks in games

text: I'm trying to understand what the law says about the use of MIDI or otherwise synthesized representations of songs under copyright within computer games, be they online or installed. I have read opinions, which make some sense to me, which state that a played back MIDI file counts as an unauthorized performance, albeit by a soundcard, and thus falls under standard copyright law. Is this the case? Does it make any difference at all whether all or part of the representation is performed by a human being, and whether, for example, vocals are replaced by a synth line? Does it make a difference if only a core motif from the song is used as opposed to the full track? And does it make any difference how realistic the sound is - for example, is a bleepy 8 bit rendition any less a violation of copyright than a MIDI file rendered down to a wave file using top-notch orchestral VSTs? I'm well aware that the digital world is awash with blatant copyright violations and that often it comes down to whether it is worth the copyright holder's effort to enforce the law. But I'm interested to learn exactly what the law is, because this seems like a vague area.


title: Threading and async intterupting on same process and thread, along with related

text: So, I'm trying to understand threads. I realize they are a mix of hardware and OS decisions. I also know that a thread, or process, has a set of register/stack variables and functions. In each thread, they get duplicated when forked, "packed up" when not running and "unpacked" back into the registers when they start again. I can use them fairly decently, but there are a few things I do not know: What happens when you interrupt the same thread? Eg, I'm on the main thread, bug a SIGCHLD is called or any interrupt, which interrupts the main thread in order to run this one function, then goes back. How do the stack variables "pack up", if they even do? (basically, same thread is interrupted, what happens to stack vars and function stack) A game loop, or event loop is continuous. I've started to accept the idea that, halfway into any function, it could just stop and switch to another thread "context". I also know that after every loop, it may or may not say "I'm waiting for a timer/event, sleep for a few ms on me", so will it try to run its interrupts there or just at any random time? How do I tell my own loops to stop and wait if I want to keep a certain pace? - I realize this might be in a book on OS's, just don't know what part. (Basically, how do threads sleep? Are they really interrupted halfway into a task?) (the above is surprising to me because I always thought of a program as a continuous set of things, it's like I have to change my mindset completely to understand how it really works) As far as I'm aware, sync-ing ensures that a variable is the same across all registers. So with my first Q, is the register and stack the same when the main thread is interrupted? Must I sync anything? If they are different threads, does it wake up the others just to sync the variables, or do the threads stay "asleep"? I'm betting they all point to the same heap vars, but where could differences arise besides pointers pointing to old addresses? I realize if I knew where to read, maybe I could infer more than half of this. I apologize if they sound basic, I've been reading but a lot of this, I just don't get but would like to. I use GCD a lot which hides the details, so I know to sync, gate, but I have absolutely no idea where my threaded variables are going and when/how. I learned about this from some sockets programming and an OS book I was reading, but obviously I'm missing some critical details. Thank you. Stephen


title: SPA: outsourcing client-side development

text: Given a SPA-based web site (with a client developed using any JS MVC framework and the server providing a REST API), does anyone have any experience in outsourcing the development of the client side and parallel development of the server-side? What were the problems you encountered? Was it really beneficial?


title: How early is too early to be involved in new feature development?

text: I develop an internal business application that our engineers use to test and debug the company's product. The engineering manager has been pushing to get the software developers involved when the engineers are in their design phase. He says that he wants to give us an idea of what's coming down the pipe, and give us the opportunity to provide feedback on their designs (we rarely have feedback). The engineering manager wants the developers and engineers to implement new features simultaneously, so that by the time the engineers have implemented their end, they can use the software to test them. The feature designs tend to be volatile until they are fully implemented by the engineers, making it difficult to draw up requirements. He thinks the engineers and developers can do all of our debugging side-by-side, at integration time. It all seems inefficient and backwards to me.


title: Who should set the goal for a retrospective?

text: I am the SM of a team and would like to know who should set the goal for the retrospectives


title: How to cure the "can not deliver"/ "cannot deliver on time syndrome"

text: I am an above average programmer (I take interest in the development of languages, frameworks and technology in general and have a good grasp of systems), but I constantly find my self not being able to deliver things (on time). This does not affect my day to day work as it has good control process (bite sized tasks with shame driven development) But it definitely hurts me in my personal projects. Some of the reasons that I think are at play. -I make things more complicated than they need to be. Often a lot more than I admit to my self. -I am not very good at making the tasks smaller at times. -I wander off into obscure corners when I encounter them instead of keeping a laser focus. The result is often that I don't deliver. Now I may know at the back of my head that what I need to do, but I would appreciate your strategy on how to be the guy who "delivers".


title: Single Page Web Application Web Service Scalability

text: I am trying to build a single page web application that will call multiple web services (both SOAP and RESTful) and aggregate the data in the UI. Initially I though I could do it all client-side, with ajax requests, but I realize that   * If there are many requests, and they are fired per user, the data can take a long time to load.   * If there are a lot of users, then I can easily reach my limit of API calls. So now I'm thinking that I will have to have some kind of server-side process that runs every hour (or whatever), retrieves the items, and inserts/updates them in a database. Is this the right approach? Are there any other pitfalls I need to avoid?


title: Any good tips for a PHP Programmer for starting on Iphone and ipad apps? (have pc only)

text: I am trying to learn creating apps for IPhone and IPad, apps like database oriented websites where user can save their data. I am a normal php programmer and use only Windows PC. Any good tips that you guys can suggest me to begin with would be highly appreciated. Thanks!


title: Should static data be stored in a database or somewhere else?

text: I'm working on some software at them moment and I'm not sure which route to take with this. I have some data to store somewhere on a mobile device. The data will never change, and has a hierarchical relationship, and will be used to populate the display. There is a reasonably amount of this data. I have the following options:   1. A set of enums/objects   2. An XML file   3. The embedded SQLite database In this particular case I think that the enums option is the least work, but I get a smell from the data being embedded in the code like that. The XML file makes the most sense I think, but parsing it will be a resource hit that seems like a waste since it will 'never' change. The database should provide less of a performance hit, but seems like overkill for static data. Which is the correct design path here? **Note:** By 'Never' change I mean that it will rarely change. The data in question is a model of a set of government standards, so they may well change at some point in the future but its not going to be regularly and its not going to automatically update our software either as a change in the standards could well trigger a change in our requirements.


title: web content management system

text: Quite a few of my friends want to have their own personal website to showcase their talents. However, they don't want to deal with such technical things as writing html and managing web server. Neither do I. It would be nice that we go to our URL and view our pages and we edit and update our information when logging in. So basically the content displayed will be what we provide and at the same time we can choose from some provided templates for page layout and style. It seems a typical content management system to me. If it is, I'd like to build a simple one myself because I'd like to have the experience of building a simple CMS. Since I have no previous experience for this, I need some help figuring out what is all I need for it. And, what are the most appropriate tools and technologies? So far, I have **html** , **css** , **JSP** , **Tomcat** , **SQLite** in my mind. Is that enough? Are they the best combination? Also, I have no idea how to approach the authorization and security aspects of building the system. (PS: I'm not sure what tags are proper for my question. Feel free to edit them for me)


title: When to use RCP?

text: I like to write small GUI applications using Java and Swing, something like a client for the social website Tumblr Should I use Eclipse RCP or the Netbeans platform? And what benefits do I get from using either one over using plain swing/SWT? Do RCP applications require more dependencies than those developed using Swing or SWT?


title: Please share experience on how to make the source code easy for other to follow?

text: I can write source code in a period of time, but after a while of not touching the project, it takes me time to be familiar with the source code again. Also, other people need some time to study the program... How do you make source code more easy for others to follow?


title: Is there a typical way of having a view that is a dependent on another?

text: I am working on a program with two views, html and ajax (which will be html transmitted via json). The HTML view is the standard, and by default the ajax should look the same. However, the ajax view is also meant to have options configurable on the client side for which components of the page should be displayed. I'm having trouble wrapping my head around making an elegant way to handle this requirement. Is there a standard way to handle related views like this?


title: Modelling project structure for Management

text: The project I am putted in is running awful. :-) Main Problem is a missing architecture and a missing guidline how to organize projects. In this case I have done a sample project architecture with UML class and component diagrams and layer diagrams. The main problem is, that I have to present this architecture to the management. But the management is not familiar with UML or Layer Diagrams and for most of them its not possible to understand the logic behind it. In that case I want to present the management a visualized project structure with easy understanding. I've searched for some ressources and examples with easy understanding visualizations, but was not able to find one. So my question is how you would visualize your software architecture to the management, which techniques do you use? Little Note: its a very big sharepoint project with more than 50 sub projects.


title: What's a generation in Software Development?

text: I've heard about software and apps going into Generation 1.2 or 2.6, is there an actual methodology behind this? or it's more of a marketing thing? Currently we are using Scrum as our methodology in agile software development and it's based on sprints, but I haven't been able to find any information detailing what's actually a generation in software development (neither on Agile based methodologies and non-agile). http://en.wikipedia.org/wiki/Sprint_%28scrum%29#Sprint


title: When does it become mandatory to sign up with the Bluetooth Special Interest Group (SIG)?

text: My company is looking to add Bluetooth functionality to our hardware, so that we can integrate connectivity to our products with various tablet devices. To do this, we are looking to purchase an all-in-one chip that we can integrate into our boards. Everyone within the development team is new to Bluetooth integration and as I am doing my research, I am finding a lot of references and material that points me back to Bluetooth.org and mention becoming a Special Interest Group (SIG) member. This has raised various questions regarding the necessity for us as a company to join the SIG. We would rather not have to go through that process because that would involve paying various fees and dragging corporate lawyers into the process. We've already had to jump through a few legal hoops ( _ahem_ , MFi anyone?) and would prefer not to have to go through any of that again for the sake of development time. If we want to integrate simple Bluetooth connectivity into our devices, do we have to go through the process of joining the Bluetooth SIG or are we covered and allowed to promote our devices as Bluetooth enabled since the all-in-one chips we will be integrating will becoming from a major manufacturer who has already become a SIG member and has had there chipset certified by the SIG?


title: Passing a Scala function to a Java 8 method

text: The following Scala code works and can be passed to a Java method expecting a function. Is there a cleaner way to do this? Here's my first pass:               val plusOne = new java.util.function.Function[Int,Int] {       override def apply(t:Int):Int = t + 1            override def andThen[V](after:function.Function[_ >: Int, _ <: V]):         function.Function[Int, V] = ???            override def compose[V](before:function.Function[_ >: V, _ <: Int]):         function.Function[V, Int] = ???     }      Here's my second pass - it uses a generic wrapper for the Java-8 Function interface to make the Scala syntax simpler:               // Note: Function1 is Scala's functional interface,     // Function (without the 1) is Java 8's.     case class JavaFunction1[U,V](f:Function1[U,V]) extends Function[U,V] {       override def apply(t: U): V = f(t)       override def compose[T](before:Function[_ >: T, _ <: U]):         Function[T, V] = ???       override def andThen[W](after:Function[_ >: V, _ <: W]):         Function[U, W] = ???     }          val plusOne = JavaFunction1((x:Int) => x + 1)     val minusOne = JavaFunction1((x:Int) => x - 1)      Can we do better? As a follow-up, is there any chance that Scala will someday use the invoke- dynamic op-code as Java 8 does for its first-class function application? Will that make everything magically work, or will there still need to be a syntactic conversion?


title: Naming convention: field starting with "m" or "s"

text: I saw lot of code (for example some Android source code) where fields name start with a "m" while static fields start with "s" Example (taken from Android View class source):               private SparseArray<Object> mKeyedTags;          private static int sNextAccessibilityViewId;      I was wondering what "m" and "s" stand for... maybe is "m" mutable and "s" static? Since it seems that is a largely adopted pattern do you know if there some literature about this kind of naming convention?


title: should I extend or create instance of the class

text: I have two classes Class A and Class B in Class A, i have three methods that perform the save, delete and select operation based upon the object I pass them. in Class B I perform the logic operations, such as modification to the property of the object before being passed to the methods of Class A, My problem is in Class B, should it extend Class A, and call the methods of class A , by parent::methodName or create instance of class A and then call Class A does not includes any property just methods.               class A{       public function save($obj){              //code here         }             public function delete($obj){              //code here         }              public function select($obj){              //code here         }      }      //Should I extend class A, and call the method by parent::methodName($obj) or create an instance of class A, call the method $instanceOfA->methodName($obj);                class B extends A{              public function checkIfHasSaved($obj){              if($obj->saved == 'Yes'){                       parent::save($obj);   //**should I call the method like this**                      $instanceOFA = new A();   //**or create instance of class A and call without extending class A**                       instanceOFA->save($obj);                 }                  //other logic operations here           }           }


title: Would you make use of "Google 20%" time if your employer encouraged and funded it?

text: We know about Google's 20% projects, whereby a developer can spend up to 20% of their time on a personal project which interests them. If your employer let you spend 20% of your time on a project that wasn't part of your day-to-day work, would you make use of it? I can think of a couple of reasons why not:   * It would make your normal work take 20% longer (extended deadline)   * You might want to keep your personal idea "personal."


title: What are the most common ways used to migrate a Delphi application incrementally to .NET?

text: If you have several million lines of Delphi code and want to incrementally migrate to .NET/C#, what strategy would you use?


title: Exception Handling Frequency/Log Detail

text: I am working on a fairly complex .NET application that interacts with another application. Many single-line statements are possible culprits for throwing an Exception and there is often nothing I can do to check the state before executing them to prevent these Exceptions. The question is, based on best practices and seasoned experience, how frequently should I lace my code with try/catch blocks? I've listed three examples below, but I'm open to any advice. I'm really hoping to get some pros/cons of various approaches. I can certainly come up with some of my own (greater log granularity for the O-C approach, better performance for the Monolithic approach), so I'm looking for _experience_ over opinion. * * * **EDIT:** I should add that this application is a batch program. The only "recovery" necessary in most cases is to log the error, clean up gracefully, and quit. So this could be seen to be as much a question of log granularity as exception handling. In my mind's eye I can imagine good reasons for both, so I'm looking for some general advice to help me find an appropriate balance. * * * ## Monolitich Approach               class Program{         public static void Main(){             try{                 Step1();                 Step2();                 Step3();             } catch (Exception e) {                 Log(e);             } finally {                 CleanUp();             }         }              public static void Step1(){             ExternalApp.Dangerous1();             ExternalApp.Dangerous2();         }              public static void Step2(){             ExternalApp.Dangerous3();             ExternalApp.Dangerous4();         }              public static void Step3(){             ExternalApp.Dangerous5();             ExternalApp.Dangerous6();         }     }      ## Delegated Approach               class Program{         public static void Main(){             try{                 Step1();                 Step2();                 Step3();             } finally {                 CleanUp();             }         }              public static void Step1(){             try{                 ExternalApp.Dangerous1();                 ExternalApp.Dangerous2();             } catch (Exception e) {                 Log(e);                 throw;             }         }              public static void Step2(){             try{                 ExternalApp.Dangerous3();                 ExternalApp.Dangerous4();             } catch (Exception e) {                 Log(e);                 throw;             }         }              public static void Step3(){             try{                 ExternalApp.Dangerous5();                 ExternalApp.Dangerous6();             } catch (Exception e) {                 Log(e);                 throw;             }         }     }      ## Obsessive-Compulsive Approach               class Program{         public static void Main(){             try{                 Step1();                 Step2();                 Step3();             } finally {                 CleanUp();             }         }              public static void Step1(){             try{                 ExternalApp.Dangerous1();             } catch (Exception e) {                 Log(e);                 throw;             }             try{                 ExternalApp.Dangerous2();             } catch (Exception e) {                 Log(e);                 throw;             }         }              public static void Step2(){             try{                 ExternalApp.Dangerous3();             } catch (Exception e) {                 Log(e);                 throw;             }             try{                 ExternalApp.Dangerous4();             } catch (Exception e) {                 Log(e);                 throw;             }         }              public static void Step3(){             try{                 ExternalApp.Dangerous5();             } catch (Exception e) {                 Log(e);                 throw;             }             try{                 ExternalApp.Dangerous6();             } catch (Exception e) {                 Log(e);                 throw;             }         }     }      **Other approaches welcomed and encouraged. Above are examples only.**


title: Updating Java SE and Java EE knowledge

text: I wonder how you guys are updating your tech knowledge on a daily basis. Definitely it will be from internet. But what are those sources? E.g. I didn't know about the DWR technology but knew if from my colleague and used it in my work. I like to know about technologies like this, to use in our Java SE and Java EE projects as soon as they are available to the community.


title: "Worker object pool" pattern?

text: In my application requests are processed by objects of `Processor`-derived classes, something like `CreateItemProcessor` or `MoveItemToGroupProcessor`. Base Processor class implements most of common processing logic, and derived ones make some specific business logic related tasks. An object of a certain processor type is created before request processing, and then wiped out afterward. Eventually it came to a situation, when creation of a single processor object was taking major part of request processing time. So now I'm thinking about creation of a pool of request processor objects, and reuse them instead of using create/delete approach. The problem here is that any single `Processor` object is not thread-safe, and actually shouldn't be tread-safe: it stores request-specific data inside. So my general approach to that is as follows:   * Try to acquire 'processor' from a pool;   * If there are no any available, wait;   * When we have processor available, mark that as 'working' and start processing;   * When job is done, "return" processor to the pool;   * Notify pool that free processor is available. Is there a kind of design pattern for that? Am I missing something from the existing GoF patterns? Any C#-related implementation details?


title: Why were Java collections implemented with "optional methods" in the interface?

text: During my first implementation extending the Java collection framework, I was quite surprised to see that the collection interface contains methods declared as optional. The implementer is expected to throw UnsupportedOperationExceptions if unsupported. This immediately struck me as a poor API design choice. After reading much of Joshua Bloch's excellent "Effective Java" book, and later learning he may be responsible for these decisions, it didn't seem to gel with the principles espoused in the book. I would think declaring two interfaces: Collection, and MutableCollection which extends Collection with the "optional" methods would have led to much more maintainable client code. There's an excellent summary of the issues here. Was there a good reason why optional methods were chosen instead of the two interfaces implementation?


title: In c++, difference between linking a class object and just including it.

text: this is my first time here. I'm a physics grad student and I've recently found a research group to work with. We study statistical mechanics using computer models, so there is a significant programming aspect to it. My first job has been to take the old data analysis code (written in java) and clean it up in c++. The guy before me who wrote the original program used the traditional physics method of using an enormous amount of spaghetti code and shoving it all in a constructor. This irked me quite a bit, so I divided it up into separate classes and now it has a reasonable class structure. In the past, whenever we had defined a class we would put its definitions and its methods in a header function, then to use it we would just include it. I know this breaks the rules of how to use .h and .cpp files, but is there any reason other than code etiquette to compile and link a class object rather than include it? Sorry for the long question.


title: Using mocks to set up object even if you will not be mocking any behavior or verifying any interaction with it?

text: When building a unit test, **is it appropriate to use a mocking tool to assist you in setting up an object** even if you will not be mocking any behavior or verifying any interaction with that object? Here is a simple example in pseudo-code:               //an object we actually want to mock     Object someMockedObject = Mock(Object.class);     EqualityChecker checker = new EqualityChecker(someMockedObject);          //an object we are mocking only to avoid figuring out how to instantiate or      //tying ourselves to some constructor that may be removed in the future     ComplicatedObject someObjectThatIsHardToInstantiate = Mock(ComplicatedObject.class);          //set the expectation on the mock     When(someMockedObject).equals(someObjectThatIsHardToInstantiate).return(false);     Assert(equalityChecker.check(someObjectThatIsHardToInstantiate)).isFalse();          //verify that the mock was interacted with properly     Verify(someMockedObject).equals(someObjectThatIsHardToInstantiate).oneTime();      Is it appropriate to mock ComplicatedObject in this scenario?


title: what is the technical term for this presentation model?

text: I have an application I've inherited that I'd call "proto-MVC", and I love the concept of MVC but am new to it. In my ideal dream of a lightweight application, all of the document's content is stored in an array:               <script>     var MVCDocument={         DOM:{            ...         },         listeners[           {..},           {..}         ]     }     </script>      That array defines the content and structure of the page, as well as what programming assets are present at the time. Next, I would have listeners or running processes that monitor the structure of the MVCDocument and react to any changes in it. These processes are the "brains". Ajax calls will modify or annotate the MVCDocument. Changes to the MVCDocument object might in turn modify the listeners/"Brains". CSS would function to style the presentation layer. The problem is that I don't know the right terms to look for examples of what I'm wanting to develop. I prefer NOT to re-invent the wheel. What are some good examples of aps that run based on this premise? and are there more components than just the bones (document array), brains (javascript coding), and clothing (css)?


title: Does not testing internals entail diligent refactoring and/or rely on developer talent?

text: I'm not asking here what the arguments are for/against testing internal methods (though I'll restate some, and don't mind hearing others). My questions relate to the implications of only testing public interface. Especially, whether I understand the extent of the "refactor" part of Red- Green-Refactor in by-the-book TDD, and if there are non TDD techniques TDD practitioners use that address the problems that make me want to test internals. My question is: If you write the most straightforward code possible to get the light green, and if you don't test internal methods, does it follow that from time to time you allow yourself to start off by writing a class that does far more than it should with a bunch of member variables you know will not survive refactoring? And wind up after refactoring with a bunch of methods that aren't explicitly tested? As I get familiar with TDD, it feels like anyone would at least be tempted to test internal methods. And many practitioners flatly say you shouldn't. E.g. (of about 23 million results): Item 2 here and it's comments and this StackOverflow post Given an implementation will involve more than one non-trivial problem, if you only test the public interface, there are two possibilities: 1) non-trivial logic winds up getting tested only indirectly, AND tested in the same calls as other non trivial logic. 2) you make methods public that you don't expect clients other than the SUT and the tests to call. I think what I hear from the advocates of by-the-book TDD is "1 is right. Yes, a lot of non trivial code is tested only indirectly, and that isn't a problem. After all, you don't want your tests to start failing when you improve the implementation. Even if they don't fail, it's not innocuous if tests keep passing when they're targetting a bunch of no-longer-used code, because the tests show how to use your class. You Should Only Test the Public Interface." And that sounds like a reasonable thing to say, but I haven't seen it said explicitly. But even though it sounds reasonable -- if I don't test internals I feel like I lose part of what helps keep the tests DRIVING the coding (maybe part of my difficulty applying the precepts is that I don't distinguish between coding and developing). If there's some internal logic that has to turn a String to a valid int32, int64 or decimal value depending on what's in the string and the type of some other object, I want to test that little bit of logic, not just find out that the whole method failed. I want one test to pinpoint those few lines of code and exercise what should fail. The thinking in the doubly downvoted answer here seems so obviously attractive that I have to wonder if the by-the-book fellows are neglecting to mention some instrumentation/tracing/logging code they use in addition to TDD, or if they watch it work in a symbolic debugger. Or do they just recognize that as a failure point and write a test with input that will cause a failure pinpointing those few lines of code? If they do that it's testing the implementation though. It seems so natural to want to test that code in isolation, and verify it fails where it should, even though it's an implementation detail. I suppose that with talent and experience you can classify bigger chunks of code as "non-trivial" but I haven't seen anyone bluntly saying or condescendingly implying that that's why they don't have to test implementation details. Lots of time it makes perfect sense to me to test the public interface, lots of methods really are like what you see in TDD examples. But for the feel of where I wonder if purists are doing something more than writing tests on a public member: Say you want to put data from an ISAM file into a database. There is one public method to the envisioned consumer of the code: public void LoadIt(SqlConnection c). "Loadit" has a bunch of other dependencies that will be resolved using configuration files and environment variables: some code has to determine that it can find the name of the folder where the ISAMs live; to find, load and parse the schema file for the isams using the ISAM vendor's DDL library; so forth+so on. But none of that is of any interest to any envisioned calling code. My only reason for moving the dependency resolvers out of the Loadit class would be so I could test them OR to make the code easier to understand/maintain. Moving to another class to make them testable is Doing It Wrong -- they're really just implementation details of LoadIt. And in my first implementation, I am just trying to write enough code to get the light to turn green. So I won't write anything with reasonable maintainability if it's easier to just manhandle a bunch of variables in a big method or two. I won't write helper classes. Instead, I'll get the light green and then do the Refactor part diligently. Even when I clean it up, any classes introduced keep "internal/friend" accessibility, and only get tested via the call to LoadIt. Thanks for reading this far; as a reminder, my question is in the second paragraph.


title: How suitable is D2 for numerical work

text: I'm interested in working with the D programming language for simulating physics. How suitable is it? Is DMD's floating point code generation mature enough to compete with compilers available for c++ and fortran? Have fast matrix libraries been ported to D (or are they accessible from D)? Is there anything in the language itself that would inhibit/improve the floating point performance of the language? I love programming in the language, however I'm worried that the compilers/libraries might not be suitable yet for numerical work.


title: How to deploy a heterogeneous server application to customers?

text: We have a bigger application server which customers would like to have deployed locally. It consists of an MySQL server database, a REDIS database, multiple Web servers for sub parts, a NGINX reverse proxy so that these web servers are reachable from Port 80 and a homegrown C++ server. All sub parts (DB, Webservers, ...) have to be configured to be accessible by each other. At the moment (for in house use) deployment and configuration is done by hand; but in order to roll it out to customers, we would like to have a Out-of-the- Box-Solution which gets assembled by some build script. What would you suggest?   1. Maintaining a VM which just gets configured and then deployed?   2. Maintaining some installation script or package   3. Something else? Usually we would prefer 2. as it seems the more natural way and let the customer decide whether he wants to use a real server or a VM. Also sounds automatic creation of VMs rather time-expensive. The Problems we face are the usually not-to-be-embedded-components like MySQL and NGINX. NGINX configuration is stored in /etc/nginx/. I don't think that .DEB-packages are allowed to overwrite foreign NGINX configuration nor is it a good practice. The same with MySQL. It is also possible to embed MySQL/NGINX/Redis but this is not a trivial task.


title: What about ALM systems, ERPs, and embedded products?

text: We are working on getting a new application lifecycle management (ALM) system, including a bug tracker, a documentation system, project management, etc. The concern is that we deal with quite complex embedded systems and we would like to have the best possible integration of the different services (project management, issue/task tracking, documentation, etc.). If it was software only, I'd just buy something like JIRA, but the fact that we would hope to manage software, firmware (no big problem there), and hardware in the same system makes me doubt a little bit. I'm looking for advice regarding these points:   * What about managing "bugs" with embedded products? In software, you have the versions of the affected module(s). In embedded products, you have different software driving often times different firmware operating sometimes different hardware. Is it good in practice to simply consider hardware parts as if they were software modules in a software-intended system? I tend to believe it will add many custom fields to the bug tracking interface and consequently won't promote its systematic use.   * Some would like to push integration to the level where you have hardware inventory integrated to the rest. This means that a project in the ALM (think JIRA) would have to reserve its hardware components based on the sub-components. It would also mean that, for example, the ALM in question would have to be able to manage part providers and offer facilities to easy purchase order creation, sending, and management in general. I'm wondering, at that point, if everything in an embedded project management process can be integrated in one management system, or if a line has to be drawn between 1) bug/task tracking (possibly software and hardware) and project management and 2) high level project management, inventory tracking, sale/buy orders, etc. What is ultimately wished for seems to be nothing less than an integrated JIRA and ERP. Or is it possible to do proper ALM in an existing ERP or have a decent ERP in an ALM system already? My personal opinion, from what I know right now, would be to split issues and project management (ALM + documentation + ...) from the ERP. The problem with that is that there's documentation about a project both in the ERP and in the project management of the ALM (which would be used for software, firmware, hardware, ...). What's funny in this is that some things might seem very unrelated at first, like the time sheets (ERP) and an issue (bug tracker in ALM), but in the end, it might very well be interesting, wanted, or even required to know how much time was spend on a bug, or a project altogether (bugs, issues, features, other tasks). This gives a point toward total unification of ERP/ALM... At this point, you should get a feel of my questioning. Any helpful input is greatly appreciated. Thanks!


title: LINQPad still being used much out there?

text: I'm trying to guage how popular and how used LINQPad is today. I'm just wondering if it's still a useful tool or not as VS and other tools have gotten better. Furthermore, I am coding over LLBGen by working with LINQ to SQL. I see there is a plug-in for LLBGen and LINQPad. Still I wonder if LINQPad is really worth it or what benefits it can give me or if it's still highly suggested out there for ORMs, etc.


title: What language is the CLR written in?

text: Just out of curiosity, what language is the CLR written in? I read on the Java Virtual Machine wikipedia entry that it is programmed in C++; is this the same for the CLR? Sorry if this is off-topic, I didn't feel that this question was technical enough to go on Stack Overflow. Thanks! :)


title: Why is an interface in Java not allowed to have state?

text: There must be a good reason why Java designers didn't allow any state to be defined in interfaces . Can you please throw some light on this aspect of design decision ?


title: When not to use Google Web Toolkit?

text: I'm considering use of GWT on a major in-house web app development project, namely it's major advantage in my eyes is the cross-compilation to Javascript which would (at least theoretically) help my team reduce the size of tech stack by one. However, having been burnt before (like most devs), I would like to hear from programmers who did actually use it on any problems with GWT which would hamper, or limit, it's use within a certain problem domain. What are the arguments against using GWT, and why?


title: CakePHP: Automation triggers after save - best done as component or behavior?

text: Folks, first time on CodeReview - just looking for some input in creating some automation in CakePHP, wondering if this is best used a component or a behavior. It's model driven but involves logic and processing. Here's the scoop: The app I'm creating requires the user to be notified when a model meets certain conditions - additionally data in the affected model or a related model might need to be changed. For example, if a customer model is saved with a certain state/province, assign that customer to a sales rep (by changing a relational field) and notify them through a Growl or an Email. So it's data driven, for sure, suggesting behavior, presumably afterSave() But it also requires logic and other utilities not typically used in the model or behavior (email, for example and Session/system configuration/user preferences) - functionality typically found in a controller/component and not readily available to a model or behavior. So is this best developed as a behavior or a component? Any tips on how to approach by Cake Guru's this would be much appreciated. Thanks in advance.


title: When using int's as boolean values, is it in poor form to use 0's and 1' directly?

text: Is it better to do this               #define INT_TRUE 1     #define INT_FALSE 0          int someFunctionalityIsEnabled = INT_TRUE;      or this?               int someFunctionalityIsEnabled = 1;      It can be safely assumed that false will always be zero and true will be non- zero.


title: If you could only have one programming related book on your bookshelf what would it be and why?

text: One per answer please. I'll add my favourite as an answer.


title: Is local "User" rights enough or do developers need Local Administrator or Power User while coding?

text: We have an offshore development crew who has a bad habit of installing nonsense software on corporate desktops (which has nothing to do with their job function) and so are considering removing their local administrator rights. Is Local Administrator, or local Power User a requirement with VS2010? How do you run without elevated rights? What issues will you run into?


title: Established antipattern name? Only getting data ducks in a row right before you need them

text: This one's all over our codebase but I'm not sure I've ever heard a name put to it. We have C# and Java (and Rails but we don't have to touch it very often) so I'll speak more generally. It's like the data concerns never get fully established until you're literally right in a view controller preparing to drop it on the page (note: we're way past the actual SQL queries in most cases here). For instance, we have data for a certain product type coming in from CRMs, from scans done with our mobile app, and pulled up from inventory in DBs and yet somehow it's not until we get to the spot where we're literally about to drop it on the page that we suddenly discover that there's business logic to attend to. Our actions and view controllers are GIGANTIC. We're asking all kinds of questions of every object and branching on them, whether it isThis or hasThat, data sources, customer preferences and sometimes stuff so seemingly arbitrary it might as well be phase of the moon, migration habits of species I've never even heard of, most-googled film stars... And it doesn't always stop at the controller. The Java in particular is notorious for letting it all spill out into the JSP and then even onto the client-side in the JS. This phenomenon has to have a name, but I've never heard it. What is it?


title: Regaining my spark on a project

text: So I'm in a little bit of a pickle. I suppose some people have gotten in my situation at some point, I know but at least as many have kept going for various reasons. To put the problem shortly; I am stuck in a project which I have after several attempts of "new fresh attitude" ended up drained out of energy and creativity and been less productive than I wish I were. The scenario is this; I had earlier been handed a, in my opinion, half done project made in Drupal. At first it had really terrible code, but I managed to get them to clean it up a bit first. Needless to say, a poorly constructed house full of used clothes and thrash is still a poorly constructed house even without the used clothes and the thrash. My hope currently is to regain that spark I have for all of my other projects that lets me work effeciently and mainly gets things done. In this case, I have little to none interest in working with this project. Here are some reason:   * The code have quite some room for improvements. The only things that I find acceptable are the things contributed from Drupal, which are simply implemented into this project. Most custom things made in it is nothing I cherish.   * I can't push myself to endure it, because I know this project will be something I'm forced to work with in the long term. In the same way I can't push myself to run the last mile of a marathon faster if I know I have to walk the entire way home afterwards.   * I've read up quite a bit regarding people's opinion upon Drupal, and have came to the conclusion that Drupal is great if you have the right mindset for it. I don't have that mindset.   I prefer to create as much as possible myself and simply let a framework such as CodeIgniter worry about the process. It helps me be more confident with my code and less dependent on a module fetched from somewhere.   * I generally don't believe in the project. It already takes silly long time to load, weird bugs appears from time to time that I can't even solve through google effeciently. It feels like the best thing I can do with the project is to patch it up, but I strive to do great websites, not make bad ones less bad.   * Drupal has a long learning process, and I've been put in the middle of a half made project and am supposed to implemented more advanced features. Usually I have no problem to add these things in my other projects, but in Drupal it feels close to impossible often. Apart from this, I might add that I'm currently economicly independent and don't fear loosing my job for that reason. I generally have nice colleagues but I work alone as a developer and would prefer to have at least someone whom I could discuss technical solutions with. This project isn't something that will go away from my understanding, I've sat down with my boss, explaining how I feel regarding this project but all I get in reply is "We've spend too much time and money on this project. It needs to get completed." From my point of view, we're currently throwing money into a pit, hoping that the money will reach the surface sooner of later. **Question:**   How can I regain the spark for this project? The creativity simply isn't there for me. This project won't give me much knowledge that I will have use of in the future (I have maintained lots and lots of code for 3 years) and it doesn't lead me towards my goal; to create "the perfect website". If I can't regain the spark, what other alternatives should I consider? **Note:**   I am aware that this question can seem too localized, but I think my main question can help many in a similiar position. I'm sorry if I sound like a spoiled developer who only wants to take on specific tasks, but I work _so_ much better with project I'm comfortable with and I also like being productive.


title: Is there any situation in which it would be appropriate to use unless... else?

text: This construction is considered wrong               unless       #..     else       #..     end      This is for the general reason of double-negative confusions. It translates to:               if not        #..     if not not       #..     end      _We all agree this is confusing._ * * * Is there any situation (include semantic) that the `unless..else` construction would be more appropriate?


title: How do you ask or get asked to speak at a software conference?

text: This is in my TODO.txt. How would you go about achieving this goal?


title: How should I include third-party models in my domain model?

text: I'm currently trying to design a little application using Domain Driven Design but I'm afraid I don't really get the concept yet. Let me try to explain this as clearly as possible.               public interface IMyDomainRepository     {         void Add(IAnInterfaceFromAThirdParty element);     }      The interface above is defined in my domain model and this will be used in a different project called `ThirdPartyImplementionVersionX`. Now `IAnInterfaceFromAThirdParty` is not defined in my domain model but comes from my third party library. I could create a class/interface in my domain model which implements the same properties and methods as the interface `IAnInterfaceFromAThirdParty` but this interface has 20 methods defined thus making it a difficult task to implement the same logic. Is this the way to go or am I missing something?


title: Managing re-usable code in user-centric agile stories?

text: I work on an agile team at the moment where our stories are written primarily from the user perspective as well as testing. So, for example, we may have a request for a date picker. The story would go something like:               User goes to page x and clicks on date to launch a native date picker      All fine and good, but the problem is how to communicate what that is from a development POV. For example, the issues we'd want to address:   * we have to support multiple devices   * even though the user sees a 'native' widget, we're often having to build emulated versions in JS   * we'd want to be using said widget on many other pages than just x and would want to incorporate variations needed on page y and z into this one component. We're struggling in figuring out how to best handle this to enable the dev team. One option seems to be for our dev team to build our own component and pattern libraries. We'd then take the user stories and use that data to enhance our own component/pattern library. Have you ran into this problem and, if so, have you found a way to consolidate the discrepancies between user stories and the concept of reusable component code for the dev team?


title: Charles Barkley syndrome

text: Charles Barkley was an excellent basketball player, a hall of fame, and a dream team member. He played for the 76ers, Suns, and Rockets. Yet he never won an NBA championship. Some might argue this was because he was never surrounded by other players of his caliber, and in the NBA, you can't win on your own. So what does this have to do with programming? How many of you out there feel like Sir Charles? Leading your team in every category, KLOCs, bugs fixed, systems configured... Always the one pushing for improvements, upgrading systems, negotiating with customers... Feeling like you are carrying the team. Anger just under the surface. Only to retire eventually, without "the ring"1. * * * 1: Keep in mind, Charles never blamed his team. He just performed at his best.


title: Understanding my dvcs workflow

text: We are going to be building a new project using Mercurial as our version control system. I'm still trying to fully understand what my workflow should look like, so I've listed below a case that I need some help undertanding. A single application with multiple modules (Each module being hosted in its own repository) Multiple developers need to make changes to the same module. How should this be managed?   * Should a hg pull be done and all changes be made on the local developers machine. Once those changes have been made the changes are pushed to dev.   * Should each feature/bug fix get a new repository or branch on the server and the developer pushes his changes from his local hg to the remote hg. Once the feature is completed that repo/branch is merged back into dev.   * Or a combinatiom of both. Small changes go straight into dev, and a feature that could take some time gets its own branch/repo.   * Or any other strategies that you think are better suited.


title: How valuable are programming conferences?

text: Inspired by this, just how useful are programming conferences of various types? What do they offer that you can't get from just reading and researching subject online?


title: Are any companies moving from DVCSs to CVCSs?

text: Are there any actual business cases that have made any company move from a DVCS to a CVCS (regardless of whether they were on a CVCS originally)?. Other than having a closed mind and rejecting the paradigm shift altogether (for the particular case of companies coming from a CVCS) I cannot think of any cause for this happening. Double chocolate cookie for anyone with empiric evidence.


title: Constant values in the interface

text: Some time ago I have read two different books and each of them gives totally different answer for the question if it is a good pattern to define constant values in the interface (in java). So I am curious of your opinions with some reasonable arguments. Is it a good habit/ pattern to define constant values in interfaces in java? Is it generally good, generally bad or it depends?


title: How do you safely work around broken code?

text: Once in a while, a co-worker will check-in bad code which blocks my application from initializing properly. To get around this problem quickly, I comment out the offending code. I then forget to uncomment the offending code at the time of my check-in, so I want to prevent this from happening again. Do you have any suggestions on how to:   1. Disable bad code that stop you from working    2. Prevent yourself from checking in unwanted changes? I'm currently using Visual Studio as my IDE and TFS as my source code repo.


title: Unindented elses

text: Been writing code since about 18 years now. Lately, I've got into the habit of not indenting elses and when I look at the code it does worry me a bit mostly that someone who might look at the code might cry foul. The snippet below explains the need for the style               if(condition) {        ...     } //1      if(condition) { // Don't want this second block to be entered unnecessarily        ...     }      So I put an else where the comment labelled 1 is               if(condition) {        ...     } else     if(condition) {         ...     }      Putting an else there helps maintain readability especially when forgetting to put one there doesn't necessarily break anything. What I'm uneasy with is that it doesn't strictly follow conventions (Sun's in this case) in two different ways - 1) proper indentation 2) having an open brace after the else I guess what I'm trying to do is prevent having massive indents which really makes a difference in blocks that have a lot of conditions - 5 or more although only three are showcased below.               if(condition) {        ...     } else {        if(condition) {            ...        } else {           if(condition) {               ...           } else {              ...           }        }     }      I find it a lot neater to have the else unindented and without a brace following. What are your thoughts?


title: How can I implement a database TableView like thing in C++?

text: How can I implement a TableView like thing in C++? I want to emulating a tiny relation database like thing in C++. I have data tables, and I want to transform it somehow, so I need a TableView like class. I want filtering, sorting, freely add and remove items and transforming (ex. view as UPPERCASE and so on). The whole thing is inside a GUI application, so datatables and views are attached to a GUI (or HTML or something). So how can I identify an item in the view? How can I signal it when the table is changed? Is there some design pattern for this? Here is a simple table, and a simple data item:               #include <string>     #include <boost/multi_index_container.hpp>     #include <boost/multi_index/member.hpp>     #include <boost/multi_index/ordered_index.hpp>     #include <boost/multi_index/random_access_index.hpp>          using boost::multi_index_container;     using namespace boost::multi_index;          struct Data     {       Data() {}       int id;       std::string name;     };          struct row{};     struct id{};     struct name{};          typedef boost::multi_index_container<       Data,       indexed_by<         random_access<tag<row> >,         ordered_unique<tag<id>, member<Data, int, &Data::id> >,         ordered_unique<tag<name>, member<Data, std::string, &Data::name> >       >     > TDataTable;          class DataTable     {     public:       typedef Data item_type;       typedef TDataTable::value_type value_type;       typedef TDataTable::const_reference const_reference;       typedef TDataTable::index<row>::type TRowIndex;       typedef TDataTable::index<id>::type TIdIndex;       typedef TDataTable::index<name>::type TNameIndex;       typedef TRowIndex::iterator iterator;            DataTable() :         row_index(rule_table.get<row>()),         id_index(rule_table.get<id>()),         name_index(rule_table.get<name>()),         row_index_writeable(rule_table.get<row>())       {       }            TDataTable::const_reference operator[](TDataTable::size_type n) const       { return rule_table[n]; }            std::pair<iterator,bool> push_back(const value_type& x)       { return row_index_writeable.push_back(x); }            iterator erase(iterator position)       { return row_index_writeable.erase(position); }            bool replace(iterator position,const value_type& x)       { return row_index_writeable.replace(position, x); }            template<typename InputIterator> void rearrange(InputIterator first)       { return row_index_writeable.rearrange(first); }            void print_table() const;            unsigned size() const       { return row_index.size(); }            TDataTable rule_table;       const TRowIndex& row_index;       const TIdIndex& id_index;       const TNameIndex& name_index;     private:       TRowIndex& row_index_writeable;     };          class DataTableView     {       DataTableView(const DataTable& source_table) {}       // How can I implement this?       // I want filtering, sorting, signaling upper GUI layer, and sorting, and ...     };          int main()     {       Data data1;       data1.id = 1;       data1.name = "name1";       Data data2;       data2.id = 2;       data2.name = "name2";            DataTable table;       table.push_back(data1);       DataTable::iterator it1 = table.row_index.iterator_to(table[0]);       table.erase(it1);       table.push_back(data1);       Data new_data(table[0]);       new_data.name = "new_name";       table.replace(table.row_index.iterator_to(table[0]), new_data);       for (unsigned i = 0; i < table.size(); ++i)         std::cout << table[i].name << std::endl;          #if 0       // using scenarios:       DataTableView table_view(table);       table_view.fill_from_source(); // synchronization with source       table_view.remove(data_item1); // remove item from view       table_view.add(data_item2); // add item from source table       table_view.filter(filterfunc); // filtering       table_view.sort(sortfunc); // sorting            // modifying from source_able, hot to signal the table_view?       // FYI: Table view is atteched to a GUI item       table.erase(data);       table.replace(data);     #endif            return 0;     }


title: XDIME for Mobile Applications

text: I'm involved in a project that requires to mobile-enable some previously developed Portlets. The Portlets are deployed in WebSphere Portal, and the container offers a technology called IBM Mobile Portal Accelerator that uses XDIME to render mobile pages according to the device. I'm trying to document myself in the technology and I'm having a bad time: Google only shows some outdated sites from IBM and even older posts from Volantis, another company involved in the technology (Amazon shows no related books). So... what's the current status of that technology actually? Is has some decent level of adoption?


title: What javadoc equivalents do you use in .net?

text: Java developers use Javadoc in order to write inline documentation in their comments. What are the alternatives for .net - specifically c# and VB.net that people actually use in real world projects?


title: Randomized Hash function with no collisions

text: Related to the question Which hashing algorithm is best for uniqueness and speed? Is there a way to create a hash function, or find one, whose hash length depends completely on the input length, has an adjustable hash character set (Since it must be 1-to-1 function the input must comply to this character set constraint as well). Moreover the most important part is that the hash function generates as **random** as possible strings. So for example it would be possible to get the following two different results.               Hash(aaaa)->blue // for character set a-z      and               Hash(aaaz)->pink  // for character set a-z      More examples:               Hash(aa@12a)->dakj@4   // for character set a-z, @, 0-9      and               Hash(a2#46Ww)->@3#0Pdw // for character set a-z A-Z, !-), 0-9      **Notice** the character length between input and output and the character sets. What I thought so far was a probability distribution function, there are random distribution functions but I am not sure how to get there. http://en.wikipedia.org/wiki/Probability_distribution http://en.wikipedia.org/wiki/Normal_distribution


title: Why are interfaces more helpful than superclasses in achieving loose coupling?

text: ( _For the purpose of this question, when I say 'interface' **I mean the language construct`interface`**, and not an 'interface' in the other sense of the word, i.e. the public methods a class offers the outside world in order to communicate with and manipulate it._) Loose coupling can be achieved by having an object depend on an abstraction instead of a concrete type. This allows for loose coupling for two main reasons: **1-** abstractions are less likely to change than concrete types, which means the dependent code is less likely to break. **2-** different concrete types can be used at runtime, because they all fit the abstraction. New concrete types can also be added later with no need to alter the existing dependent code. For example, consider a class `Car` and two subclasses `Volvo` and `Mazda`. If your code depends on a `Car`, it can use either a `Volvo` or a `Mazda` during runtime. Also later on additional subclasses could be added with no need to change the dependent code. Also, `Car` \- which is an abstraction - is less likely to change than `Volvo` or `Mazda`. Cars have been generally the same for quite some time, but Volvos and Mazdas are far more likely to change. I.e. abstractions are more stable than concrete types. All of this was to show that I understand what loose coupling is and how it is achieved by depending on abstractions and not on concretions. (If I wrote something inaccurate please say so). **What I don't understand is this:** **Abstractions can be superclasses or interfaces.** **If so, why are interfaces specifically praised for their ability to allow loose coupling? I don't see how it's different than using a superclass.** The only differences I see are: 1- Interfaces aren't limited by single inheritance, but that doesn't have much to do with the topic of loose coupling. 2- Interfaces are more 'abstract' since they have no implementation logic at all. But still, I don't see why that makes such a big difference. **Please explain to me why interfaces are said to be great in allowing loose coupling, while simple superclasses are not.**


title: How do Traits in Scala avoid the "diamond error"?

text: _(Note: I used 'error' instead of 'problem' in the title for obvious reasons.. ;) )._ I did some basic reading on Traits in Scala. They're similar to Interfaces in Java or C#, but they do allow for default implementation of a method. I was wondering: can't this cause a case of the "diamond problem", which is why many languages avoid multiple inheritance in the first place? If so, how does Scala handle this?


title: One controller per page or many pages in one controller?

text: I just wanted some advice regarding the MVC way of doing things. I am using codeigniter and I was wondering if it's better to have one controller per page for a _website_ or to have one controller for all the pages? Let's say I have a simple website where you can visit the homepage, login, create an account and contact the admin.   1. Would it be better to have these controllers: frontend(index), login, account, contact OR having one controller called frontend or whatever with the actions such login, createAccount, contact?   2. When do you know if its better to use one controller in a situation?


title: What is the difference between Acceptance Test-Driven Planning and Acceptance Test-Driven Development?

text: What is the difference between Acceptance Test--Driven Planning and Acceptance Test--Driven Development? Are they the same?


title: Enterprise VS Regular corporate developer

text: Ok, I " _almost_ " lost a job offer because I " ** _didn't have enough experience as an enterprise software engineer_** ". I've been a programmer for over 16 years, and the last 12-14 professionally, at companies big and small. So this made me think of this question: What's the difference between a software engineer and an enterprise software engineer? Is there really a difference between software architecture and enterprise architecture? BTW: I try to do what every other GOOD software programmer does, like architecture, tdd, SDLC, etc.


title: One-week release cycle: how do I make this feasible?

text: At my company (3-yr-old web industry startup), we have frequent problems with the product team saying "aaaah this is a crisis patch it now!" (doesn't everybody?) This has an impact on the productivity (and morale) of engineering staff, self included. Management has spent some time thinking about how to reduce the frequency of these same-day requests and has come up with the solution that we are going to have a release every week. (Previously we'd been doing one every two weeks, which usually slipped by a couple of days or so.) There are 13 developers and 6 local / 9 offshore testers; the theory is that only 4 developers (and all testers) will work on even-numbered releases, unless a piece of work comes up that really requires some specific expertise from one of the other devs. Each cycle will contain two days of dev work and two days of QA work (plus 1 day of scoping / triage / ...). My questions are: (a) Does anyone have experience with this length of release cycle? (b) Has anyone heard of this length of release cycle even being attempted? (c) If (a) or (b), how on Earth do you make it work? (Any pitfalls to avoid, etc., are also appreciated.) (d) How can we minimize the damage if this effort fails?


title: Python : how can I impress people coming from Ruby/Java?

text: I am preparing a presentation about Python for my company, and would like to show Python's awesomeness to developers using Java or Ruby ! I guess it will be very simple to write shorter and cleaner looking stuff than in Java, however I've never coded in Ruby (well only a few stuff with rails, but I don't know the language) ! **PLEASE NOTE** : This topic **IS NOT** about which language is the best. I just want to convince people that don't know Python at all, or even -for some- think that it is weird, that it is worthy of interest as well (as much as Ruby, Java, etc... are). And for this, I need input from people that know Ruby (or Java) and Python ... I'm looking for an easy to understand code snippet or application that would shows where Python shines. I was thinking of a couple of list comprehensions, because I think it is really great. Some operator overriding, because that looks dead simple in Python, maybe some metaclass programming, and/or why not a doctest/sphinx example ... Any other/better suggestions ? PS : the people are backend web developers


title: "To code quickly, you must quit coding"

text: First off, not my phrase: http://www.whattofix.com/blog/archives/2010/11/to- code-quickly.php Props to Mr. Markham. BUT, it got me to thinking about a lot of questions I have seen about being able to get things done. The approach advocated (setting a timer for a set period, in this case 50 minutes, but I've seen people talk about breaking procrastination by setting times as short as five minutes on tasks that you just cannot bring yourself to do, and then taking a short break) seems to be common sense, but lots of people advocate getting into the "zone" and staying there as long as possible, maybe many hours, rather than break their groove. I keep trying different approaches and find that each has its own strengths and weaknesses. What kind of technique do you use to be more EFFECTIVE (i.e., getting work done to the quality level demanded by your client / boss / etc. in the time frame allowed) in your software development and not just to spend more time at the keyboard?


title: Should curly braces appear on their own line?

text: Should curly braces be on their own line or not? What do you think about it?               if (you.hasAnswer()) {         you.postAnswer();     } else {         you.doSomething();     }      or should it be               if (you.hasAnswer())     {         you.postAnswer();     }     else     {         you.doSomething();     }      or even               if (you.hasAnswer())         you.postAnswer();     else         you.doSomething();      Please be constructive! Explain why, share experiences, back it up with facts and references.


title: Good practice and terminology of braces

text: > **Possible Duplicate:**   >  Should curly braces appear on their own line? I've come across two methods of using braces with if/for/switch/while/function blocks in Java, JS, C++, and PHP (any language that uses braces for creating scopeblocks) One of them is like this:                If(...){         ...      }else{       ...      }      I've always used this, it's become an unbreakable habit for me. This leads to compact code, but many people who look at my code get confused because they don't realise that there is an opening brace. I personally call this method 'bouncing braces' (don't know why) The other method is this:                If(...)      {         ...      }      else      {       ...      }      This is less compact, but is clearer. This is what most people seem to expect (from what I've seen--and I've not seen much). If they don't see the opening brace below the if, they think its missing. So I have two questions:   * What are these two practices, (if they have names) called?   * Which one is better practice?


title: Web versus desktop development - is web development worse?

text: As a longtime desktop developer looking at doing our first large-scale web application, what are the pros and cons of doing web development? Is developing a web application much worse than developing a desktop app? E.g., is it more tedious or annoying? Is the time to market much worse? Is the web platform excessively limiting? If the answer to any of these is yes, then why? (And how does developing a Flash or Silverlight app compare?)


title: When is it appropriate to do calculations in front-end?

text: My team is developing a WEB based finance application and there was a bit of an argument with a colleague where to keep the calculations - purely in back- end or keep some in front-end too? Brief explanation: We are using Java (ZK, Spring) for front-end and Progress 4gl for back-end. Calculations that involve some hardcore math & data from database are kept in back-end, so I'm not talking about them. I'm talking about the situation where the user enters value X, it is then added to the value Y (shown in screen) and the result is shown in the field Z. Pure and simple jQuery-ish operations, I mean. So what would be the best practice here: 1) Add values with JavaScript that saves from going to the back-end and back and then validate them at the back-end "on save"? 2) Keep all the business logic in the same place - therefore bring the values to the back-end and do the calculations there? 3) Do the calculations in the front-end; then send data to the back-end, validate them there, do the calculations again and only if the results are valid and equal, display them to the user? 4) Something else? Note: We do some basic validation in Java but most of it is still in the back- end as all the other business logic. Increase of data that would be sent by recalculating everything in a back-end wouldn't be a problem (small XML size; servers and bandwidth would withstand the increased amount of operations done by users).


title: How come many project-hosting sites don't have a forum feature?

text: I'm considering starting an open-source project, so I shopped around some popular project hosting sites. What I find surprising is that many (see here for a nice feature table) of the popular project hosting sites (e.g. GitHub, BitBucket) don't have a forum feature, i.e. a place where users can talk to the devs, ask questions, raise ideas, etc.   IMHO an active forum is an important factor in creating a user community around a project, so I would expect that most project owners would be interested in such a feature. I've also noticed that some projects _do_ have support forums (or mailing lists) hosted elsewhere - e.g. Ruby on Rails is hosted on GitHub but has a Google Groups support group, and TortoiseHG is hosted on BitBucket but has a mailing list on SourceForge - so it's not like this feature is unneeded. So how come many project hosting sites don't have a forum feature?


I'm currently researching the options which I have, to build an 'Online Help System'. This system should offer the user information about dialogs - which consists mainly out of forms. So my main question is: Is there any taxonomy/language to describe user interfaces? I have searched a lot on this subject matter, but end up with things like XUL. Which is not what I'm looking for. I'm looking for a structure / language / taxonomy to describe the user interface (of the dialogs). However, I'm not sure of its existence. Since I'm not, I would also be pleased with any (search) terms which are worth investigating in this case. Besides this, I'm also looking for languages / taxonomies which are used for regular Online Help systems. The things I came across were: DocBook, DITA and MAML. Are there any other big players in this 'market'?


title: Cloud Newbie ... what should I know while creating my App

text: I never developed for the Cloud, and to tell you the truth I am not fully 100% sure of what Cloud is when coming down to servers and services. I am starting to develop an App where I will need to be able to scale as needed. The App has a lot of User entries as well as file uploads. Think is as a "forum" (this is the closest model that I can think that applies to my App). User will be able to register, create "threads", create "polls", answer, and vote. They can also upload images, videos, and audio files. The person that previously created the website used 'Auto-increment" fields to keep track of the user ids. while rebuilding the page I was thinking to drop that part and use UUID() for all the users entries, this, I believe might solve the concurrency of entries at the same millisecond or weird locks or duplicate ids or possible other problems... but... other than that, I do not have a clue of what the "cloud" would do. Those are my questions:   * I will use MySQL as DB, will I have to connect to different DBs to write to alleviate the stress or I should not even worry about that because the "cloud" will take care of that? (I will have replication for the reads)   * When accessing files, will I have to know on what server the files where uploaded to be able to serve them, or will the "cloud" magically do that ?   * If I increase the "cloud" space by adding a new server, what should I know about it? simply deploy it and everything is up and running or will I need to do something to my code to tell "hey, there is another instance, now do this and that differently" Thank you and I hope you understood what I meant.


title: Can I legally publish my Fortran 90 wrappers to Nvidias' CUFFT library (from the CUDA SDK)?

text: From a legal standpoint (licensing issues), can I legally, in agreement with the license, publish Fortran 90 wrappers (bindings) to the CUFFT library from Nvidia CUDA Toolkit, under some open source license (either CC0, that is, public domain, or some kind of permissive license like BSD)? Nvidia provides only C bindings with their CUDA SDK. Header files contain the following text.               /*      * Copyright 1993-2011 NVIDIA Corporation.  All rights reserved.      *      * NOTICE TO LICENSEE:      *      * This source code and/or documentation ("Licensed Deliverables") are      * subject to NVIDIA intellectual property rights under U.S. and      * international Copyright laws.      *      * These Licensed Deliverables contained herein is PROPRIETARY and      * CONFIDENTIAL to NVIDIA and is being provided under the terms and      * conditions of a form of NVIDIA software license agreement by and      * between NVIDIA and Licensee ("License Agreement") or electronically      * accepted by Licensee.  Notwithstanding any terms or conditions to      * the contrary in the License Agreement, reproduction or disclosure      * of the Licensed Deliverables to any third party without the express      * written consent of NVIDIA is prohibited.      The `License.txt` file includes the following fragment > Source Code: Developer shall have the right to modify and create derivative > works with the Source Code. Developer shall own any derivative works > ("Derivatives") it creates to the Source Code, provided that Developer uses > the Materials in accordance with the terms and conditions of this Agreement. > Developer may distribute the Derivatives, provided that all NVIDIA copyright > notices and trademarks are propagated and used properly and the Derivatives > include the following statement: "This software contains source code > provided by NVIDIA Corporation."


title: At what point in the process do you create the visual design?

text: I like to do a wireframe before I start coding and work from there. But when should I start worrying about the visual design? When should I consider the colours, the font, whether corners should be round or sharp, icon design, etc? Is that the last thing to do before launch? Or is there any reason to work on it while you're still in the coding phase, or testing and debugging phase?


title: What is the role of QA in a BDD-driven project?

text: If running a project using BDD with 100% coverage of user stories with automated acceptance tests, what would be the role of a tester / quality assurance person? I guess I am imagining that developers would write the acceptance tests in conjunction with the product owner, let me know if that seems like a foolish assumption.


title: How does requirements management work in the long term with Agile projects?

text: Requirements Management in the short term for Agile projects seems like a solved problem to me. From the Scrum angle new requirements or changes to existing requirements are delivered through User Stories. And User Stories grouped under an Epic or Feature facilitate the delivery of larger more complex requirements. Of course, a User Story isn't technically a requirements document. It is a manageable grouping of work which maps to what is often called a _Vertical Slice_ of functionality. And the scope of these stories can be defined unambiguously through the use of Acceptance Criteria (AC). So, although User Stories aren't formal requirements, browsing through them can give you a pretty clear idea of their underlying requirements. In the short term. I say in the short term because, as a project progresses, the number of User Stories increases. Thus, browsing through an ever increasing list of Stories to find a Requirement becomes less and less efficient over time. This problem is compounded when you consider User Stories that expand on, supersede, or even negate previous Stories. Now, imagine a 2 year gap between development iterations on a project (stable in production). The original team is gone and so is all their knowledge. If the original team knew this was going to happen (eg, it's the nature of the business), then what measures could they take to help subsequent teams? Sure, the backlog will provide some information, but it's hardly in an easily browsable form. So, what can be done to help subsequent teams understand the state of the project, including _why_ and _how_ it got there? In my experience, the following things don't work:   * **Backlog grooming** to delete or update previous User Stories so that the Backlog can be read as a requirements document.   * **Documentation Sprints** where team members are tasked with documenting the current state of the system.   * **Documentation through Behaviour Tests**. This approach is the only one I have seen come close to working. Unfortunately, Coded Behaviour tests are victims the Naming Problem. Although the tests might properly document the system, getting a fluctuating team of developers to write their tests following the same Domain terminology, wording, and style is almost impossible. So, to reiterate: How does one manage Agile project Requirements in the long term?


title: Tweaking a ranking algorithm from a few variables

text: I'm going to have a mySQL table with elements in it and would like to rank them in the same manner than Reddit but not quite. I'd like to know how to add or remove importance to a variable in my ranking algorithm. For instance, what I have is a time (a timestamp, so a huge value) and a number of upvotes (a smallish value, under 50). How do I give more importance to the upvotes and less to the time?