title: How to design extension mechanism for java app

text: I have an application where I have a set of core features.   1. The application itself HAS to work in core only mode.   2. I would also want to make the application extensible such that, when certain jar/plugin files exist in the classpath/installation location, additional features would be available, things would just be there. This is OPTIONAL. The way I would do it is using the factory pattern with a modification. In the core package, I have an extension point (implemented by either a public static variable or a singleton, or other extension point model from my framework - Eclipse RCP). The extension jars/plugins get this extension point and registers its factory object to this extension point. (This is best done with RCP plugin/feature activation mechanism, or it can just be anything that causes a load of the extension jar/plugin factory class) When the application runs, the core factory would produce objects from the extension factory if one has been registered or use its core factory otherwise. This is how the application goes from core mode to extension mode if an extension jar exists. I wonder if this is a decent way to do what I wanted to do or this is just a hack, anti-pattern, etc... Please propose a better solution if you can. Thanks.


title: Methodologies of a high class development team

text: I've recently been tasked with increasing standards and efficiency within a development team. I've read similar posts about the makings of a good development team but these often discuss the human elements such as "passion for learning", "being a team player" etc. These are all of course important but I'm particularly interested in ideas surrounding practical methodologies. Some are just plain obvious, for example, my first implementations are:   * Implementation of Source Control - well, do I have to even explain why?   * A structured method of deploying builds that everybody adheres to - makes deployment easier for all involved   * Coding standards - ensures everybody is working in the same way and (hopefully) reduces technical debt   * Encouragement to make use of the developer community e.g. StackOverFlow and the like - keeps us in the loop with the big bad world and brings in ideas from outside our office walls What practical methodology does your team employ that you feel makes a tremendous difference to the productivity and overall "goodness" of a development team?


title: object model and data model

text: I have heard/read mixed things on whether to start with an object model or a data model. And more people say to starting with an object model as it will ease your data modelling. My question is, Shouldn't an object model always drive the design of data model? Why and When would a data model design be different than an object model? If we have a good object model, shouldn't the classes we come up with translate into tables? And class associations as table relationships?


title: For instance methods, would always returning self or this, instead of using a void return type, be a clean coding style?

text: I just came across this article, and in particular, this answer. Essentially they're talking about returning `self` from instance methods to allow for method chaining. That being said, one of the first thoughts that came to mind was, _Why not always take instance methods with`void` return types and make them return `this` or `self` instead?_ The next thought, which came to mind immediately, was, _There's probably a reason this isn't more common._ So what could be the harm in it? It seems like there honestly wouldn't be any. The reason is that nothing about the mere existence of a return value implies or even seems to imply the need to use that return value. If the method is a specialized getter or file reader or something, that's one thing, but if people aren't looking to use the return value, they naturally won't pay one any attention. Furthermore it shouldn't be too confusing, because `return this;` is pretty trivial; at most, somebody would probably think it's irrelevant. It certainly seems like it wouldn't hurt anything, and it's generally better to have too much than too little.


title: How to evaluate the quality of Rails code?

text: **In a code review, what do you look for to assess a developer's expertise?** Given an opportunity to look at a developer's work on a real-world project, what tell-tale signs are a tip-off to carelessness or lack of experience? Conversely, where do you look in the code to find evidence of a developer's skill or knowledge of best practices? For example, if I'm looking at a typical Rails app, I would be happy to see the developer is using RSpec (showing a commitment to using test-driven development and knowledge that RSpec is currently more popular than the default TestUnit). But in examining the specs for a Rails model, I see that the developer is testing associations, which might indicate a lack of real understanding of Rails testing requirements (since such tests are redundant given that they only test what's already implemented and tested in ActiveRecord). More generally, I might look to see if developers are writing their own implementations versus using widely available gems or if they are cleaning up code versus leaving lots of commented-out "leftovers." What helps you determine the skill of a Rails developer? What's your code quality checklist?


title: Top down or bottom up approach?

text: I'm an interface designer and now I'm working with a team of programmers to develop a new CMS for a heavy media site. As I've started developing a specification list for a prototype it turned out a very big one. I do realize now that the client-side will be JS heavy, with lots of DnD and other "cool designer stuff". The CMS will even include a small project management system for its users, nothing big like Basecamp, but with a live feed of comments etc. The problem is the the team has now separated. Someone is proposing the existing backend solution used in other CMS, someone is proposing to rewrite everything from scratch. The point to keep the code is that it is faster, the point to rewrite is to make it better for the proposed design (include Node.js and other stuff I don't actually get). The question is — can the UI specs influence back-end? The guys that propose to use the existing solution did everything with the Yii framework (as far as I know), and they say that everything on server is not affected by this "interface coolness". Others say that it does, that even autosave can't work without server load.


title: Writing a bootloader with no bootloader

text: I have a question that I really can't find a straight answer to. Let me start by saying I'm not asking for a step by step tutorial, or even plan on doing anything. I'm just curious. I've been reading up all day on the development of operating systems, and how they're built from scratch. I have a pretty firm grip on the theory of it. However, there is one step I can't seem to find an answer for. Before the existence of a full on, tool filled operating system, how would one even write a simple boot loader for a computer that doesn't any have a boot loader, or anything for that matter, in its boot sector? What would the very first step be after acquiring a computer with the bare minimal? (I.e., screen, keyboard, processor, ram, hdd, floppy)


title: I have to use Visual Studio 2005. What are good alternatives to using LINQ?

text: I have recently started a new job and am being forced to use VS 2005 and .NET 2. This has been quite painful for a number of reasons, but the one big change from VS 2005 to its successors was the introduction of LINQ and extension methods. A common pattern that I used to follow when using enumerations was the following:               foreach(var myObject in myObjects.Where(x => x.Property == someValue)     {         //Do some stuff     }      What I am having difficulty with is coming up with a succinct way of expressing the same statement in C# 2. The best I have come up with is the following:               foreach(MyObject myObject in myObjects)     {         if(myObject.Property == someValue)         {             //Do some stuff         }     }      Is there a more effective or efficient way of writing this code? How would you write C# 2 code so that it can most easily be transformed into C# 5 code (we will be upgrading to VS2012/.NET 4.5 after the next release)?


title: Interrupting Work Productivity: The Name?

text: Certainly it is a productivity killer when a developer is constantly interrupted by other workers, bosses, etc - but it is even worse when the developer is constantly interrupted by his or her own tools and equipment. For example, if a developer must wait 10 minutes for each build he makes - so that he can iteratively test code he is working on, the effect on productivity is devastating. Or perhaps the build is fast, but copying the bits to a test VM takes 3 minutes. Once again, the developer is being vexed by a lack of "responsiveness" in the tools and procedures being followed. I believe there is a name for an environmnent that is free of these problems, or perhaps a name that is plagued with these process and tool interruptions. I can't recall the name or industry "label" for this. Anyone recall?


Can you program Android Apps in a functional language? I meant is it possible to program for Android in a language that was designed from the ground up to be functional? I'm aware that you can use the functional components of an OO or a procedural language to program in a functional style, I was asking whether it would be applicable to use one of the "functional languages" on Android.


title: Object oriented design importance

text: I started studying Object Oriented Design and Modelling using the this book by James Rumbaugh. It uses a tool called Object Modeling Technique (OMT). I have certain newbie questions. I searched the net, but couldn't get answers   1. The book is pretty old. Don't know why the school told me to learn this. I know OMT is a predecessor of the Unified Modeling Language (UML). So its a waste?   2. Whether the concepts change very much when we move from OMT to UML? I know OMT has Object, Dynamic and Functional Model. Wikipedia says UML is compatible with OMT and UML is a model too.   3. As per wikipedia the UML models are Static and Dynamic and they are represented by different diagrams like class, object, activity, sequence..... I couldn't find the equivalence of this in OMT.   4. I read that there are many object oriented development methods like OMT, Booch,.... Which one is used by Industry ?   5. Where could I get a comparison of different Object oriented development methods?


title: Database development/admin - What exactly should I be trying to learn?

text: I've been a bit weary about approaching learning databases. I've dabbled into them before, and "DATA" in itself appeals to me a lot. Maintaining/searching/moving, everything about it in the abstract sense I love. (This isn't a career question, this is a learning question.) But as RDBMS's begin to be easier to maintain, and with tools that "anyone" can use to manage data I feared for the database admin jobs. (Yet I see jobs for SQL everywhere!). I know "No-SQL" was a big deal but it kinda has its niche. But that leaves me here... unsure of really "what" to study. What tools should I have in my tool belt? I'm sure RDBMS's will be around in both use and maintaining legacy code. But what else? Obviously data will always be around, but is this a secure field or a dying one? And what should I be concentrating on?


title: Can I legally use the icon of a different software?

text: Suppose I am including a feature in my image-viewing software, which opens an image in Photoshop ('Send to Photoshop'), using Photoshop's OLE automation framework. Am I allowed to use the icon of Photoshop.exe as the image of this 'Send to' button?


title: Am I experienced enough to learn and develop immediately using Ruby on Rails?

text: ### General Question I understand that discussions revolving around questions of this form run the risk of becoming too specific to help others. So, perhaps a better, general question would be: > What kind of experience, if any, translates easily to Ruby on Rails; and if > none, then what's the learning curve like, in comparison to other popular > languages? ### Background I have the opportunity to build a website using whatever technologies I wish to use. It's a fairly simple website, for   * listing products,   * taking payments,   * managing customer data,   * providing a back-end portal for employees to manage data,   * possibly hooking in flight information (the products are travel related),   * possibly integrating a blog and all the social-networking goodies. ### Specific Problem I have to let the client know by tonight whether I'm interested in taking up this project, before he talks to other potential developers, but I'm on the fence.   1. I already work a full-time C++ development job, so the money doesn't do it for me. It's the opportunity to (be paid to) learn some new technologies and to have a real, running product in the end.   2. I've heard and read great things about Ruby, and am really intrigued.   3. I zipped through some introductory Ruby tutorials, no sweat.   4. However I found the Rails tutorials a little overwhelming, especially not being able to try it out anywhere.   5. And researching Rails hosts like Heroku and EngineYard makes me think that maybe I don't know what I'm getting myself into. The ship's leaving port! I wish I had more time to learn, better yet _play_ with the language, but I have to decide soon! Should I venture or pass? ### Additional Details My experiences are in C/C++/Tcl/Perl/PHP/jQuery, and basic knowledge of Java/C#. I didn't study C.S. formally so I wasn't exposed to design principles, programming paradigms, etc., which is my greatest concern. Will my lack of understanding in this realm make RoR frustrating to learn? Will it be so incompatible with a C++ "way" of thinking that I'll wish I never started? Am I putting my client at risk by attempting this? If it helps, I'm quick to learn new things (self-taught so far) and care a great deal about correctness, using things for their intended purposes, and so on. I've read numerous recommendations of **Agile Development with Rails** and would love to read it (though perhaps, while developing in parallel, for shortness of time). Worse comes to worst, I'd give up and do the standard LAMP gig, of course, not charging the client for wasted time. But I'm hoping to avoid the project altogether if it's gonna come down to that! Thanks in advance for any tips, insights, votes of confidence, votes of discouragement (for the better), and such.


title: Does anyone use Ceiling and *not* immediately cast it to an integer?

text: I think every single time I've used `Math.Ceiling` or its language variant, I've _always_ had to cast it to an integer. I mean... that's the whole point, isn't it? To get a whole number. So why doesn't it just return an `int`?


title: What is the right level of site blocking for you as a developer?

text: Almost all developers who work for a large corporation find themselves on the wrong side of site blocking software. It can be both frustrating ( _"Just let me read that damn blog!"_ ) and helpful ( _"Woah! Dodged a bullet with that site"_ ). In your opinion, what is the right level of blocking to apply to developers and why?


title: Cookie Settings Storage Method

text: I've got an web app that needs to store some non-sensitive preferences for the user. Right now I'm storing their language preference and what mode they want a window opened in by default in two cookies:   * "lang" can be "en" or "de"   * "mode" can be "design" or "view" I might add a few more in the future. I'm not sure how many, but probably never more than a dozen. Language is parsed on every request, whereas the mode cookie is only used occasionally. I saw a recommendation that made sense I shouldn't try to do what I was originally planning to do and strongly type a user settings class deserialized on each request because of the overhead involved. I see three options here and I'm not sure which is the best overall.   * Keep things as they are, add a new cookie for each new setting   * Combine the cookies into a single settings cookie and add future values to it   * Change the mode cookie to settings (leaving language alone), add new user settings values to the settings cookie All would work obviously. I'm leaning toward option three, but I'm not sure if there's a best practice for this?


title: Can I link to a gpl library from a closed source application?

text: Ok, before everyone goes shouting about duplicate questions, yes, I've already seen several questions like this here. But none answer the question. If I link against a gpl'd library without modifying that library, do I need to release my source code? According to this question Can I use GPL software in a commercial application the answer is yes! But this answer is not satisfactory to me. The answer basically says that I cannot use gpl code in any way without making my code open source. But, here is the question I'm really interested in, if the previous is true then that would indicate that no person or organization could ever release any proprietary software on Linux ever. Which must be wrong. Simply because in order for any application to do anything useful, open files, write to the console, create tcp connections, the application must be linked to `libc` which is GPL'd. So my question is this, if the GPL states, as all the previous answers on the site say it does, that a program which links to another gpl program must be gpl itself, how is it possible to create/release/sell any proprietary application at all which runs on Linux? Since as I described above that application must be liked to gpl code just to run on Linux. A more practical example say I link to a shared library which is gpl'd in a non-gpl'd application, would that force the non-gpl'd application to become gpl'd? More specifically if I use a gpl library without modifying it, and then distribute that library as an `.so`so or `.dll` would that require my application be open source?


title: Why hasn't a faster, "better" language than C come out?

text: With all the new "modern" languages out today, how is it that C is still heralded as the fastest and "closest to the machine"? I don't really believe in there ever being only one correct way to do things, and C has been around for a really long time (since the 60's!). Have we really not come up with anything better than something written nearly 50 years ago? I am aware that modern languages are higher-level and take care of certain tasks like garbage collection and memory allocation and utilize libraries and such. I'm just asking why there has never been a true second option to C. Can it be that C is so perfect that no other way of operating a computer could be possible (developer-adoption aside)? **EDIT** Look, I'm not trying to knock C or whatever your favorite language is. I'm wondering why C has become the standard and why other alternatives never emerged and C was just "accepted".


title: How many developers on the same virtualized Windows Microsoft machine?

text: How many c# developers on the **same** virtualized Microsoft Windows edition is it sensible to have? If everyone uses their own documents and settings folder, should I expect it should be fine? Only Windows Server allows concurrent users if this option is enabled; How many concurrent users do you get out of the box?


title: Why isn't there a python compiler to native machine code?

text: As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in most cases), however I do not understand, why is not there an additional (and optional) compiler for python, which compiles the same way as traditional compilers. This would leave to the programmer to chose, which is more important to them; multiplatform executability or performance on native machine. In general; why are not there any languages which could be behave both as compiled and interpreted?


title: What is the correct pattern to use in this case?

text: I'm sure this scenario has arisen before, and I want to know what experience has taught to be the best solution. I have a number of classes that are all of a kind. Say all the objects are "Content". They may be "Article", or "Book" for example. The reason I want the "Content" abstraction is because I want to define a number of behaviours for all "Content" objects and not have to build a new DB Table and 10 classes of essentially the same code for each type of "Content". For example, to attach a "Tag" or a "Premise" to a content object would be much nicer if, say, I just had two columns one for ContentID and one for TagID. A solution I've played around with is to have a Content table with a unique ID, and then to have foreign key references on all the other tables (Book, Article, etc). This has actually proven quite solid, but I'm just not sure about it. Do you know how to call this described pattern?


title: Is this usage of extend relationship in a use case diagram correct?

text: On this picture: ![http://i.stack.imgur.com/hUoau.jpg](http://i.stack.imgur.com/DST87.jpg) Does updating grades extend a feature that shows grades? I am not sure if the notation is correct, so I am hoping you guys will know it.


title: Daily standups- yea or nay?

text: How valuable (or not) do you think daily stand-up meetings are? If you're not familiar with it, this refers to a daily meeting that is part of Scrum adherents (and some other agile methodologies). The idea is that you hold a daily meeting, timeboxed to 15 minutes, and in which everyone must stand (to encourage people to be to-the-point). In the meeting, you go around the room and each say: \- What you did yesterday \- What you plan to do today \- Any blockers or impediments to your progress. Do you think this practice has value? Has anyone worked at a place that's done it, and what did you think?


title: Frameworks for targetting multiple environments

text: What should drive the decision behind doing development upon one or more than one framework? For instance, an ERP is (mostly) run on a Windows station. It leverages full access to device's resources, like printers, barcode readers, fingerprint readers and the like. It's usually more responsive and easier do develop with. That being said, some parts of it must be accessed exclusively in self-service mode, by enterprise's customers, suppliers and partners. This could be accomplished with smartphones, tablets, or even desktops running a web browser. What are the economics behind that? Should two team be kept, each one doing work upon its own framework? Or the most permissive framework should be chosen? Should I care something other than HTML technologies? Should I consider native technology for each device?


title: CCtalk is it still a modern protocol or is it outdated?

text: I need to write some code to integrate a machine with a coin acceptor. This coin acceptor (euro's dollars etc), has several connection methods. The manufacturer wrote a C++ dll and a C# invoke example to use it with an usb connection. Its the only provided coding sample i could get my hands on so far. However also two other connectors are available One is yet to me unknown, seams some hardware io port. The other is a CC-talk connector. From what i've read about it, that's some kind of slow RS323 serial connection protocol that works in 2 ways and is commonly used in billing systems. I never heard about it before until now. SO I wonder if I should use it too. What I think of it is that it might be a pretty old protocol, but i am not sure. There is not much "CC-talk" on forums and only a few questions on stackoverflow. That might be a hint that it is old, or that it is something high secure and secret?. I'm looking for a bit guidance here, to decide where i put my energy. Might there be some programmers here perhaps who are familiar with CC-talk What is your opinion about it, is it an outdated protocol for old hardware these days mostly replaced by usb or tcp/ip networks. Or is there something very specific about it, and good about like well perhaps be able to create secure transactions and stuff like that. Just for the record my device and the coin machine are on a 1 meter distance, so i will not have problems with signal lose. (if that was good about cc-talk)


title: Are Java's public fields just a tragic historical design flaw at this point?

text: It seems to be Java orthodoxy at this point that one should basically never use public fields for object state. (I don't necessarily agree, but that's not relevant to my question.) Given that, would it be right to say that from where we are today, it's clear that Java's public fields were a mistake/flaw of the language design? Or is there a rational argument that they're a useful and important part of the language, even today? Thanks! **Update:** I know about the more elegant approaches, such as in C#, Python, Groovy, etc. I'm not directly looking for those examples. I'm really just wondering if there's still someone deep in a bunker, muttering about how wonderful public fields really are, and how the masses are all just sheep, etc. **Update 2:** Clearly static final public fields are the standard way to create public constants. I was referring more to using public fields for object state (even immutable state). I'm thinking that it does seem like a design flaw that one should use public fields for constants, but not for state… a language's rules should be enforced naturally, by syntax, not by guidelines.


title: Where should salt hash values come from?

text: When adding salt values to a hash value for something like a password that cannot be stored in plain text, what is the best place to get the salt values come from? For context, let us suppose this is for passwords on a webpage login.


title: How to extract the active code path from a complex algorithm

text: I have been puzzled lately by an intruiging idea. I wonder if there is a (known) method to extract the executed source code from a large complex algorithm. I will try to elaborate this question: Scenario: There is this complex algorithm where a large amount of people have worked on for many years. The algorithm creates measurement descriptions for a complex measurement device. The input for the algorithm is a large set of input parameters, lets call this the recipe. Based on this recipe, the algorithm is executed, and the recipe determines which functions, loops and if-then-else constructions are followed within the algorithm. When the algorithm is finished, a set of calculated measurement parameters will form the output. And with these output measurement parameters the device can perform it's measurement. Now, there is a problem. Since the algorithm has become so complex and large over time, it is very very difficult to find your way in the algorithm when you want to add new functionality for the recipes. Basically a person wants to modify only the functions and code blocks that are affected by its recipe, but he/she has to dig in the whole algorithm and analyze the code to see which code is relevant for his or her recipe, and only after that process new functionality can be added in the right place. Even for simple additions, people tend to get lost in the huge amount of complex code. Solution: Extract the active code path? I have been brainstorming on this problem, and I think it would be great if there was a way to process the algorithm with the input parameters (the recipe), and to only extract the active functions and codeblocks into a new set of source files or code structure. I'm actually talking about extracting real source code here. When the active code is extracted and isolated, this will result in a subset of source code that is only a fraction of the original source code structure, and it will be much easier for the person to analyze the code, understand the code, and make his or her modifications. Eventually the changes could be merged back to the original source code of the algorithm, or maybe the modified extracted source code can also be executed on it's own, as if it is a 'lite' version of the original algorithm. Extra information: We are talking about an algorithm with C and C++ code, about 200 files, and maybe 100K lines of code. The code is compiled and build with a custom Visual Studio based build environment. So...: I really don't know if this idea is just naive and stupid, or if it is feasible with the right amount of software engineering. I can imagine that there have been more similar situations in the world of software engineering, but I just don't know. I have quite some experience with software engineering, but definitely not on the level of designing large and complex systems. I would appreciate any kind of answer, suggestion or comment. Thanks in advance!


title: User stories as a contract definition?

text: I am often asked to write a requirements document for a new piece of work. I write requirements using user stories. The list of requirements is then used as a contract with the client denoting the functionality that will be delivered. The temptation them becomes to add more and more detail and more and more stories in an attempt to define a water-tight specification that rules out any expensive mistakes. The problem is user stories just don't seem well suited to this task. Can anyone offer any clarification on the role of user stories? For example, is the same user story appropriate for client, programmer and the author of a functional spec? Regressing a little, perhaps I'm also asking what is the best way to define a contract of what will and will not be delivered in a software project?


title: How do I decide whether to take a job I can't add to my portfolio?

text: I am a programmer, but since I've barely been in the professional market my portfolio is rather bare right now. Still, I started to try and get my website up and running to help a little bit, but what I really need right now is to be able to expand my portfolio. I have a guy who wants me to do a lot of work for him, and I'm willing to do it for a while at least until I can get better jobs. The real problem, though, is that he does not want me to tell anyone that I have been doing work for him. Naturally, since I'm both trying to earn money and expand my portfolio, this poses a problem. Part of the reason for doing an app was to prove I can develop one, but if I can't tell anyone I wrote it, then developing the app seems pointless; I may be better off creating my own app and eating the loss in profit because I can get more work out of it, but of course, at the same time, I'm in desperate need of cash. I do have jobs lined up elsewhere, but I'll likely get paid faster through doing this specific job. What factors should I be looking at when making a decision on whether or not I should take a job for money that I can't talk about?


title: Why do people rewrite some libraries to many programming languages?

text: There are some libraries, which are available in their versions written in many different programming languages, like for example Lucene, which is written in Java (as they say, 100% pure Java), but has also its versions in C++, C, Perl, Ruby, Lisp and some other languages. And I'm talking about _implementations_ in these languages, not just FFI interfaces. Why do people do that? I can see one obvious reason: deployment and distribution (and probably development as well) easier when a project has fewer dependencies. But is there anything else? In what situations is it worth it?


title: How to manage a developer with good knowledge of programming language but very poor analytical skills

text: I work as a team lead in a fast-growing services company. There is one developer in my team who's not performing well, and unable to solve even the simplest of the problems without being spoon-fed. I have held multiple meetings with him and even sat next to him while coding to understand the root cause of the problem. He has very good grip on Java, however he lacks the analytical skills and IQ to understand the problem at hand and arriving at a solution. When I sat with him while coding, I noticed that he has good domain knowledge, awarness about the code base, but he cannot think and get solution to the problems and was unable to fix the bugs. He's also a comp sci., graduate. He knows that he is not performing well and I have tried motivating him, punishing him etc. He does spend a lot of effort and he is also focused. But there is no improvement in his performance. Now, he's asking me for suggestions about what kind of job should he go for. He's very hard working and focused, it's just his inability to solve problems that is preventing him from performing. Should he be sent into software testing projects? Should we suggest him to go into technical support? What suits him the best based on the problem he is facing? Perhaps a technical writer job or something like that. Please let me know your opinions on this, so I can advise him appropriately.


title: why not use unmanaged safe code in c#

text: There is an option in c# to execute code unchecked. It's generally not advised to do so, as managed code is much safer and it overcomes a lot of problems. However I am wondering, if you're sure your code won't cause errors, and you know how to handle memory then why (if you like fast code) follow the general advice? I am wondering this since I wrote a program for a video camera, which required some extremely fast bitmap manipulation. I made some fast graphical algorithms myself, and they work excellent on the bitmaps using unmanaged code. Now I wonder in general, if you're sure you don't have memory leaks, or risks of crashes, why not use unmanaged code more often ? PS my background: I kinda rolled into this programming world and I work alone (I do so for a few years) and so I hope this software design question isn't that strange. I don't really have other people out there like a teacher to ask such things.


title: Get rid of long/Complex if..else statements using Chain of Responsibility?

text: I've an HttpHandler, which allows users to login to a system by passing in an encrypted code. Inside the `ProcessRequest` it performs quite a few steps.   1. Retrieve the encrypted code from request (could be in Form/X-Header/Query)   2. Decrypt it. (Results in an JSON string)   3. Deserialize to a dynamic type   4. Determine the type of request, could be login/register/activate   5. Validate request   6. Load user subscription   7. Load User entity   8. If Req.Type = Login -> Login using FormsAuth   9. If Req.Type = Register -> Create user   10. If Req.Type = Register -> Send Activation email This goes on. Currently this is something like a long if/else statement which I'm trying to refactor. I'm thinking of using the Chain Of Responsibility pattern to convert these steps in if/else to a chain which executes sequentially. However, this will be different from original CoR as only last few steps will actually "handle" the request, first steps will just do some pre-processing and make stage for last steps to perform it's job. My main problem is, different steps in the chain will work on different input data. First few steps (Decryption, Deserialization, etc) will work on strings while latter half should ideally work on deserialized dynamic object. I don't like the way it sounds. Am I trying to fit a round lid to an square bottle? Is this not a scenario where CoR can/should be applied? Are there any other patterns/strategies I could use to solve such scenarios. I thought of using the decorator pattern as well, but that doesn't suite me very well, as I'd like to be able to switch certain steps in and out (ex: email activation) for some scenarios. NOTE: I've seen this question as well, but not sure if it answers my question.


title: Correct way to inject dependencies in Business logic service?

text: Currently the structure of my application is as below Web App --> WCF Service (just a facade) --> Business Logic Services --> Repository -> Entity Framework Datacontext Now each of my Business logic service is dependent on more than 5 repositories ( I have interfaces defined for all the repos) and I am doing a Constructor injection right now(poor mans DI instead of using a proper IOC as it was determined that it would be a overkill for our project). Repositories have references to EF datacontexts. Now some of the methods in the Business logic service require only one of the 5 repositories, so If I need to call that method I would end up instantiating a Service which will instatiate all 5 repositories which is a waste. An example:               public class SomeService : ISomeService     {        public(IFirstRepository repo1, ISecondRepository repo2, IThirdRepository repo3)        {}             // My DoSomething method depends only on repo1 and doesn't use repo2 and repo3        public DoSomething()        {             //uses repo1 to do some stuff, doesn't use repo2 and repo3        }                public DoSomething2()        {          //uses repo2 and repo3 to do something, doesn't require repo1        }             public DoSomething3()        {          //uses repo3 to do something, doesn't require repo1 and repo2        }     }      Now if my I have to use `DoSomething` method on `SomeService` I end up creating both IFirstRepository,ISecondRepository and IThirdRepository but using only IFirstRepository, now this is bugging me, I can seem to accept that I am un-necessarily creating repositories and not using them. Is this a correct design? Are there any better alternatives? Should I be looking at Lazy instantiation `Lazy<T>` ?


title: Is there any benefit by switching from C# to Java?

text: I've been a .NET developer for about six years. In those six years, I've worked at exactly **one** .NET shop that followed any kind of actual design pattern or industry best practice. That realization has frustrated me where I'm at the point of considering making a switch to Java and leveraging my C# experience because the Java community seems to have a larger handle on proper software engineering than the .NET community, which seems more focused on RAD techniques and quasi-procedural code and don't want to improve at all. For example, the average Java shop is probably using an MVC framework like Spring, Seam or venerable old Struts, is using Hibernate, is probably writing unit tests, knows how to use source control properly, and while there's the danger of the architecture astronaut is more than likely applying design patterns and following good practices like the SOLID principles. In contrast, the average .NET shop uses untyped DataSets, writes all the code to solve a problem in event handlers of WebForms, thinks testing means loading up the built-in web server and playing with the application, if they use source control at all use something like Visual SourceSafe and think it's great, and has no idea what the single responsibility principle even means or why it's a _good thing_. Attempts at introducing things like ORMs, design patterns, unit testing is usually met with a blank stare or outright rejection due to not even understanding why those things are better than the debugger or writing code in an event handler of a widget - it's like talking to a brick wall. I am aware of "ALT.NET" (I follow it myself), but I am finding an environment that knows about that, let alone follows it, and it seems to be like finding needle in a haystack, and trying to change an organization to use it has always ended badly for me, to the point where I've actually been shown the door and let go for wanting to do things better than the company had been doing before I joined. Would there be **any** benefit at all to my trying to leverage C# skills and make a transition to Java? I'm running out of options trying to find a .NET shop that actually follows real software engineering concepts instead of just throwing out code, and I'm starting to think my chances of finding that kind of place will greatly increase if I'm not using a technology stack that pushes the opposite as the right way.


title: How do you get the usernames/passwords onto a STUN or TURN server for long-term credential authentication?

text: The STUN and TURN specifications allow for client authentication using usernames and passwords, and call this authentication via long-term credentials. In fact, TURN requires that clients authenticate by this means. However, I would assume that almost all deployments run their STUN or TURN servers separately from their database server. For example, for a VOIP application that uses TURN servers, presumably all of the user data would be stored in a database, user account management might be primarily handled by a web server, while the clients would still need to be able to authenticate into a separate TURN server. What's the best practice for the STUN/TURN server to access the usernames and passwords from the database to authenticate clients? If most deployments or your solution relies upon a particular STUN/TURN server implementation that supports specific features, any recommendations as to STUN/TURN servers would be appreciated as well.


title: Can I get a job in the aerospace industry as a software developer if I'm self-taught?

text: I'm an employed, self-taught application developer. Although I love development, I'm fairly bored. To offset this (and because I love to learn), I study advanced mathematics, physics, engineering and advanced topics in computer science, among other things. I'm grateful for the good job I have, it pays the bills and feeds my family, but I want to do more. I'm very interested in the aerospace industry, but lack an engineering or computer science degree. I would like to develop software that aids in the design of aircraft, or software that contributes to the functionality or operation of an aircraft. I feel like I can hold my own during discussions of these topics, and also feel like I possess enough knowledge at this point to make a foray into the field. I had a troubled youth. I'm married now with children, and have settled down, but I'm still fairly young. Again, I'm grateful to have a solid job where I can do what I love and get paid well, but I feel like the stupid decisions that I made during my youth, combined with my decision to actually learn computer programming instead of going to college have really smoked me, as far as career opportunities go. Recently, I've been working on a jet engine design suite and test simulator using Haskell. Maybe if I finish this, I can show it to someone and get a job despite my lack of degree and troubled past? I can't unrealistically assume it would be worth much to a giant like Lockheed, but maybe they will think it is cool or something. Is there anyone out there that can relate, and if so, were you able to miraculously able to finagle a way into this field, or another advanced field? What can I do to make it in this industry? Do I need to enroll in college, or is there some sort of hack I can employ? Are you an aerospace software engineer? What is this field like in reality? Need an intern?


title: Reasons for C++ Prototyping

text: I'm a beginning programmer, trying to get a grasp on everything, so pardon the probably mundane theoretical question: I see in a C++ tutorial that prototyping is needed to let the compiler know that a function(?) is coming up and not to throw up any errors. Why does it not search throughout a document to find the function it's looking for? Maybe the question I'm asking is; what is the purpose for prototyping? And can it be used in other languages?


title: Can the strategy pattern be overused?

text: Example: A file, representing a serialized version of an object, needs to be read and deserialized. It would simple to implement this if we only cared about a single serialization format, but many such formats exist (JSON, YAML, etc.). One way to handle this would be to create an abstract serializer type/interface with methods such as `deserializeToArray`, `deserializeToObject`, and so on, and pass this interface as a dependency in order to decouple any dependent classes from any concrete implementation. This could be further generalized by having the serialization methods actually be implementations of another interface, which we'll call `Transform`. So here we're effectively using the Strategy pattern once again, this time encapsulating a family of algorithms for transforming one kind of data into another desired object or array format. Is this perhaps an overuse of the Strategy pattern? Are there better ways to structure things here or patterns more fitting for this sort of problem? Are there disadvantages to using several nested Strategy patterns as in this example?


title: Eliminating tab characters in a new language

text: I'm working on a new programming language, which determines structure with indentation instead of braces in the manner of Python and CoffeeScript. Obviously placing lines indented with spaces next to lines indented with tabs will mess up that kind of syntax, so I'm disallowing that - any given source file must use one or the other, not both. I'm wondering whether it would be better to mandate one or the other across the board just to eliminate the possibility of time wasted on argument? Spaces seem to be slightly more popular than tabs, so if I were going to do that, I suppose I would mandate indenting with spaces (despite the fact that I personally prefer to use tabs). Are there any situations where eliminating the possibility of indenting with tabs, would cause a problem?


title: Designing persistence schema for BigTable on AppEngine

text: I have tried to design the datastore schema for a very small application. That schema would have been very simple, if not trivial, using a relational database with foreign keys, many-to-many relations, joins, etc. But the problem was that my application was targeted for Google App Engine and I had to design for a database that was not relational. At the end I gave up. Is there a book or an article that describes design principles for applications that are meant for such databases? The books that I have found are about programming for App Engine and they don't spend many words about database design principles.


title: Git workflow for small teams

text: I'm working on a git workflow to implement in a small team. The core ideas in the workflow:   * there is a shared project master that all team members can write to   * all development is done exclusively on feature branches   * feature branches are code reviewed by a team member other than the branch author   * the feature branch is eventually merged into the shared master and the cycle starts again The article explains the steps in this cycle in detail: https://github.com/janosgyerik/git-workflows-book/blob/small-team- workflow/chapter05.md Does this make sense or am I missing something?


title: Is making webpage basing on ajax and modal a good idea?

text: Hello I'm new to web development and I'm making simple webpage for managing parts. I came with idea of making something like "One page". Render layout once and later replace body content with ajax calls. Because of each "part" of the webpage like StorageList consists of views `like create,details,edit etc` I decided to show those pages in modal windows over the main page and get this: ![enter image description here](http://i.stack.imgur.com/Uh4rp.png) These modals are also loaded using ajax. As you can see "Ajax. Ajax everywhere" :) And now my question is my approach good or making this page basing on the ajax calls and dynamically loaded content will cause me any problems in future in maintaining?


title: What are some reasonable stylistic limits on type inference?

text: C++0x adds pretty darn comprehensive type inference support. I'm sorely tempted to use it everywhere possible to avoid undue repetition, but I'm wondering if removing explicit type information all over the place is such a good idea. Consider this rather contrived example: `Foo.h`:               #include <set>          class Foo {     private:              static std::set<Foo*> instances;          public:              Foo();         ~Foo();              // What does it return? Who cares! Just forward it!         static decltype(instances.begin()) begin() {             return instances.begin();         }              static decltype(instances.end()) end() {             return instances.end();         }          };      `Foo.cpp`:               #include <Foo.h>     #include <Bar.h>          // The type need only be specified in one location!     // But I do have to open the header to find out what it actually is.     decltype(Foo::instances) Foo::instances;          Foo() {              // What is the type of x?         auto x = Bar::get_something();              // What does do_something() return?         auto y = x.do_something(*this);              // Well, it's convertible to bool somehow...         if (!y) throw "a constant, old school";              instances.insert(this);          }          ~Foo() {         instances.erase(this);     }      Would you say this is reasonable, or is it completely ridiculous? After all, especially if you're used to developing in a dynamic language, you don't really _need_ to care all that much about the types of things, and can trust that the compiler will catch any egregious abuses of the type system. But for those of you that rely on editor support for method signatures, you're out of luck, so using this style in a library interface is probably really bad practice. I find that writing things with all possible types implicit actually makes my code a lot easier for me to follow, because it removes nearly all of the usual clutter of C++. Your mileage may, of course, vary, and that's what I'm interested in hearing about. What are the specific advantages and disadvantages to radical use of type inference?


title: Choice between 1-dimensional and 2-dimensional array

text: I'm implementing the Chessboard class to represent the chessboard. I've to implement the **transformations** (reflections and rotations) on the chess board possible. The possible transformations includes the combination of:                1. Vertical Reflection      2. Horizontal Reflection      3. Diagonal Reflection      Thus, we've **8** possible transformations for chess board. There are **64** squares on the Chessboard numbered **[0..63]**. Thus, to represent the total resulting values after the transformations is **8*64** (No.of Transformations * Chessboard_Size). There are two fundamental ways to represent the **transformed_board** using Arrays:               One-Dimensional Array with transformed_board[8*64]     Two-Dimensional Array with transformed_board[8][64]      **Questions** :   * Which approach is better?   * What are the pros and cons of each approach?   * How will effect the performance with respect to time factor?


title: How can a student programmer improve his teamwork skill?

text: I am a student right now. Recently, I am working in a project as a leader with three other students. Due to the lack of experience, our project is progressing slowly and our members are frustrated. They do not feel sense of accomplishment in the project. I am pressured and frustrated, too. But as a team leader, I think I need to push them. But I do not know how to do. Do I help them solve coding problem or just encouragement? But if I pay too much attention on it, it would slow down my own progress. It is a not technical question, but it is very common in software development. I hope veteran programmers would give me some suggestions. Thanks!


title: Why aren't Entities allowed to reference other entities inside an aggregate except the root?

text: I have read in several places this following rule concerning Aggregates: > Entities in one aggregate can hold references to any other Aggregate Root, > but never to an Entity or Value Object inside the other Aggregate. What can go wrong if an Entity was holding a direct reference to an entity in another Aggregate root? Can someone please explain why such rule is important? and preferably illustrate with an example, please?


title: Javascript Naming Convention

text: I've been using Javascript for quite a while, but I've always ignored the common naming conventions that I see online (camelCase). I know it all depends on the developer's preference, but why camel case for Javascript? I'm originally a PHP programmer and I kind of have my own naming convention and I use it everywhere I can, including Javascript. Well, I have to sacrifice my naming convention when it comes to Java though as the program flow depends on those names sometimes. Anyway, my convention goes like:               var variable_name = 'I always use underscores to separate words';     var another_variable = 'I also tend to use single quotes all the time';          function epic_name_here (some_paramaters ...)     {          // Curly brackets on separate lines         do_something();     }          if (x == y)     {         // Same goes here     }      I have taken this kind of code-writing style from working a lot with phpBB, their docs encourage people to use this style. Why do I see a lot of people writing Javascript in camelCase? And will it be a problem if I don't use it?


title: Several interdependent models, each with several data sources — how to avoid hell and nightmare

text: I'm currently working on a project that requires a complicated model structure and I'm struggling with picking the right architecture. First of all, there are several interdependent models. Change in one model can trigger changes in several other models. For example, user inputs a query, first model checks the database for type of the query and the second model requests its data depending on that query type. Secondly, each model can have several data sources. Data sources are used conditionally, dependent on system configuration. The app needs to function seamlessly, — for example, if one data source doesn't return required information, model must try and use another one. An important thing also is that the codebase will eventually be expanded with other models. So models, data sources etc. must be very modular. Currently there are several ways I can organise the model layer:   1. 'Dumb' models re-created by factory objects when input data (or a related model) changes. Model dependencies are resolved in an operation object, encapsulating the whole update routine. Operation object is configured and run by a domain model. I don't know where to inject a data source though.   2. 'Smart' models with update logic encapsulated in them. Each model queries a sort of a mapper/data-source-manager, which works as a proxy for different data sources. Models report their updates to a domain model. Dependencies are resolved by a model-controller or dependency manager object. Which architecture is more appropriate here? I'm leaning towards the first one as it is (to my mind) better to work with immutable models, updating the whole tree on change of input. This approach gives several benefits: for example it is easier to serialize as the presence of model equals to a finite state. But I'm really unsure about data sources...


title: Is Microsoft's Visual Studio Express 2012 for Windows Desktop no longer free? Or, why does it say product has expired?

text: I wanted to try this product when I heard there was a free version of Visual Studio. So I downloaded something from Microsoft called "Visual Studio Express 2012 for Windows Desktop" and I never really used it much. Now when I start it, for the first time in awhile, it says that the product has expired. I was under the impression that it was simply freeware, so is it true that there is no permanently free version of this IDE which anyone has the freedom to download without cost? My theory is that Microsoft's website is finicky about easily finding what you want there. So maybe I just downloaded the wrong thing. I went to this page: Microsoft Under some purple header text titled "Visual Studio Express 2012" and some sub-text that says "Visual Studio Express 2012 products provide free development tools for creating modern applications on the latest platforms." I feel like it has just got to be the right place to download the IDE. So I clicked for Windows Desktop, downloaded it, installed it. Product has expired. Conclusion? It is not free. I thought I would ask here if this is true so that I can be certain. I still think Microsoft is just finicky though. Maybe I should have downloaded 2010?


title: 1 Interface 2 Implementations and an EJB exception

text: In my JavaEE project I have an interface like this:               @Local     public interface DataAccess { ... }      And two stateless beans implementing it:               @Stateless     public class DataAccess_Online implements DataAccess { ... }          @Stateless     public class DataAccess_Offline implements DataAccess { ... }      And I get the exception: > Cannot resolve reference Local ejb-ref.... because there are 2 ejbs in the > application with interface ...DataAccess The problem is clear, there may only be one class implementing DataAccess. But it would be convenient if I could use two. In the client I want to work on the Interface DataAccess only, so I don´t have to distinguish between online/offline in my code, they both offer the same methods. In the client I have an dependency injection:               @EJB     DataAccess da;      And I see how this is a problem with two implementations for DataAccess, but what should I change to make it work? The client always starts with the online version of DataAccess, but after a while he could request the offline version, so the offline version only needs the same interface, if I need a DataAccess injection it will always be the online version. How can I use two implementations of an interface together with @EJB dependency injection?


title: Is there a major difference between JMF 1.0 and JMF 2.1.1

text: Alright, this question stems from the fact that there are very few online resources for learning JMF. The books that are available are quite old, some of them out of publication.   This question is an extension to my other question where asked I for the name of a book that I could use to learn JMF.   So, is there a major difference between JMF 1.0 and JMF 2.1.1?   Should I go ahead and buy a book that covers JMF 1.0?


title: Why did the web win the space of remote applications and X not?

text: The X Window System is 25 years old, it had it's birthday yesterday (on the 15'th). As you probably are aware of, one of it's most important features is the separation of the server side and the client side in a way that neither Microsoft's, Apples or Wayland's windowing systems have. Back in the days (sorry for the ambiguous phrasing) many believed X would dominate over other ways to make windows because of this separation of server and client, allowing the application to be ran on a server somewhere else while the user clicks and types on her own computer at home. This use obviously still exists, but is marginalized at best. When we write and use programs that run on a server we almost always use the web with it's html/css/js. Why did the web win, and X not? The technologies used for the web (said html/css/js) are a mess. Combined with all the back-end-frameworks (Rails, Django and all) it really is a jungle to navigate thru. Still the web thrives with creativity and progress, while remote X apps do not.


title: Reasons behind polymorphism related behaviour in java

text: I read this code somewhere               class Foo {         public int a;         public Foo() {             a = 3;         }         public void addFive() {             a += 5;         }         public int getA() {             System.out.println("we are here in base class!");             return  a;         }     }          public class Polymorphism extends Foo{        public int a;        public Poylmorphism() {            a = 5;        }        public void addFive() {            System.out.println("we are here !" + a);            a += 5;        }             public int getA() {             System.out.println("we are here in sub class!");             return  a;         }              public static void main(String [] main) {             Foo f = new Polymorphism();             f.addFive();             System.out.println(f.getA()); // SOP 1             System.out.println(f.a);      // SOP 2         }     }      For SOP1 we get answer 10 and for SOP2 we get answer 3. Reason for this is that you can't override variables whereas you can do so for methods. This happens because type of the reference variable is checked when a variable is accessed and type of the object is checked when a method is accessed. But I am wondering, just why is it that way? Can anyone explain me what is the reason for this behaviour


Tools like pc-lint or QAC can be used to perform static code analysis on a code base. In my experience the static analysis often yields a huge amount of noise, i.e. warnings on things that are not real bugs but somehow violate one of the rules in a given rule set. Turning off certain rules (either for good in the rule set or via special comments in the code) can be a real cumbersome process. What are the real benefits of static code analysis?


title: What is your advice for a new recruiter?

text: Next month a friend of mine is starting a job as a technical recruiter for a temp firm. He will be recruiting lower level temps for a Google/MS/Apple level company. As a largely non technical guy, what advice do you think would be most helpful for him to have? I have seen a number of horror stories about recruiters, so want to help him not to cause any of those in the future.


title: What is a good speed for a webscraper?

text: I'm currently working on a webscraper that is going to be processing about 2 million pages in total. But I'm not entirely sure how to benchmark it. Currently it processes about 100,000 pages in an hour at about 2mb/s. It isn't saturating the the bandwidth of the server but I've tried a lot of ways to make it quicker but to no avail. CPU is running 50% or so on average.


title: Why does Java MessageDigest.getInstance() have a String as a parameter?

text: I presume it's that way so it could be extended with custom algorithms, but wouldn't it be more convenient to apply, let's say, factory method pattern here and avoid the whole `NoSuchAlgorithmException` thing? Something like:               MessageDigest.getMD5Algorithm();      or               MessageDigest.getInstance(DigestAlgorithmFactory.getMD5Algorithm())      I'm guessing there's a bigger picture here, but I just can't see it.


title: Looking inside Microsoft's header files

text: When I open up the some of the often used header files like vector.h or cstdlib.h it just seems like a mess of #ifndefine #define #endif statements. Can anyone decode that mess and give me a glimpse into whats going on in there?


title: What is a 'Null Terminated String' ?

text: I have just started reading C++, and I came across a term "Null Terminated String", I read about it but couldn't understand what it actually stands for. I also want to know what is the difference between a c-string(also referred as "Null terminated String") and a c++ string.


title: Client Portal Review Software

text: Can anyone share any software/techniques they use when showing clients graphical elements, storyboards, elements, etc. for the web project being worked on? I would like to have a way that the client can log in and see updates to what is going on and see the elements that have been created over time of the project. This could be status updates, creative elements, links to prototypes, wireframes, etc. Thank you in advance for any ideas that have worked best for you.


title: Development processes, the use of version control, and unit-testing

text: ### Preface I've worked at quite a few "flat" organizations in my time. Most of the version control policy/process has been "only commit after it's been tested". We were constantly committing at each place to "trunk" (cvs/svn). The same was true with unit-testing - it's always been a "we need to do this" mentality but it never really materializes in a substantive form b/c there is no institutional knowledge base to do it - no mentorship. ### Version Control The emphasis for version control management at one place was a very strict protocol for commit messages (format & content). The other places let employees just do "whatever". The branching, tagging, committing, rolling back, and merging aspect of things was always ill defined and almost never used. This sort of seems to leave the version control system in the position of being a fancy file-storage mechanism with a meta-data component that never really gets accessed/utilized. (The same was true for unit testing and committing code to the source tree) ### Unit tests It seems there's a prevailing "we must/should do this" mentality in most places I've worked. As a policy or standard operating procedure it never gets implemented because there seems to be a very ill-defined understanding about what that means, what is going to be tested, and how to do it. ### Summary It seems most places I've been to think version control and unit testing is "important" b/c the trendy trade journals say it is but, if there's very little mentorship to use these tools or any real business policies, then the full power of version control/unit testing is never really expressed. So grunts, like myself, never really have a complete understanding of the point beyond that "it's a good thing" and "we should do it". ### Question I was wondering if there are blogs, books, white-papers, or online journals about what one could call the business process or "standard operating procedures" or uses cases for version control and unit testing? I want to know more than the trade journals tell me and get serious about doing these things. ### PS: @Henrik Hansen had a great comment about the lack of definition for the question. I'm not interested in a specific unit-testing/versioning product or methodology (like, XP) - my interest is more about work-flow at the individual team/developer level than evangelism. This is more-or-less a by product of the management situation I've operated under more than a lack of reading software engineering books or magazines about development processes. A lot of what I've seen/read is more marketing oriented material than any specifically enumerated description of "well, this is how our shop operates".


title: Virtual Machines And Unit/Integration Testing Web Application

text: I am in the process of adding unit testing to a project I am working on at work and a suggestion came up that I should use VMs to populate the database with good data. This was suggested as an alternative to what I usually do which is use yaml fixture file to load the data. While I think that using a VM for the unit testing database might have some benefits, overall I do not see it as a great solution. The first concern I have is the speed of running tests. I don't know how long it would take to bring up and tear down a new VM instance based on a snapshot but my guess is that it would be longer to the data insertions that the yaml data fixture files do. Unit tests should run as fast as possible because they should be executed at least once before any push to the version control repository and that can happen several times a day (even more when in bug fixing mode). The next concern is having the data in a known state for all tests. Sure, the first test that is executed on the VM's database is going to know what state the database is in however once a test modifies data, that could screw up the other tests. With the yaml fixture data files, each test is guaranteed to know what state the database is in. The last major concern is the complexity using a VM setup would probably entail (of course I could be wrong since I have never had a setup like this before). Obviously we can't just run phpunit with using VMs in the setup. First we would have to create a script that basically creates and deletes the VM. This would have to either work on all OSes or we would have to force everyone to work in a VM environment (and running a VM within a VM seems like it is really going to be even slower). The VM suggestion was to combat the issue of managing yaml fixture data files however to me it seem like managing yaml file would be the easier of the two options. Has anyone ever worked in an environment where developers would use VMs for the database that unit testing (or integration testing or whatever you want to call it) required and was is successful?


title: Hackathon and Scope

text: I enjoy going to hackathons as it gives numerous benefits (like free pizza), but I have never successfully navigated the projects through to a good ending. Most hackathons in my area are approximately 8 hours of actual coding. What is the best way to manage a project in such a short time period? From creating the idea to some sort of semi-working product. In such a short time, should a project have one feature and if it gets done, another feature can be started? Should everyone work on the same feature? How should leadership be formed? Should there be leadership or direct democracy? It always seems that either the scope of the project is too much, or major time will be lost on solving some sort of problem.


title: From console to GUI applications

text: I'm a beginner programmer and all I've worked with so far are console applications in C++. Coding wise, how is the graphical side of programs created? I understand the logic that I am using from console apps will be the same, but how do programmers create the graphics that this logic is then used in? I know this is sort of an ambiguous question but basically I am trying to understand how I would go about creating a program that is not a console application, such as a video game or an iPhone application.


title: Software licensing and Copyright of Open source

text: I have seen some source code containing Copyright notice in the beginning of the file. Most of them are either GNU General Public License or Apache License. If I want to develop any open source software what are the steps should I follow? Do I need licensing my software by registering somewhere, or I just add the text like described in Apache License 2.0. If I modify source code of another open source software then what should I do? Should I seek permission from them?


title: Should ORM data access methods be wrapped or used directly?

text: We're using an internally-built ORM. Each table is represented by a Model class, which inherits from a base model class that has a handful of methods like GetAll, GetWhere (to get rows with specified column values), GetFirstWhere, etc. to access data from the table. There's a question of whether these methods should be protected (so that any database access needs to call a public wrapper method for the exact query) or public methods (so that code anywhere can call GetAll, GetWhere, etc.) I see some pros and cons for both sides. Which style would be considered best practice and more maintainable? **Protected** _Pros:_ it's easy to see all queries against a table, just open the Model file. This could be useful for checking whether the table is indexed properly, etc. _Cons:_ extra work and cognitive overhead for every data access. I now have to check whether a query method already exists and create it if not; I have to look up method names, which tend to be specific like "GetThisThingByIDAndName"; also, if I want to change a query, I need to make sure nothing else was using that method or create a new method. Many of these queries are only ever going to be used once, and in practice there end up being tons of these methods whose names don't always clarify exactly what the method does. **Public** _Pros:_ the standardized data access interface allows developers to easily memorize the few data access methods and use them consistently across tables, which makes development faster and simpler. Also, they can make changes directly where the query is taking place without breaking something elsewhere in the codebase. _Cons:_ requires a search to find all queries against a table. If not careful, there could be some duplication.


title: How does a clicked event work at a low level?

text: Specifically in regard to a drag and drop operation, how does a button, text box or whatever know that it has been clicked (or vice versa how does the display manager know what it clicked). I read some about the COM way of dragging and dropping and I think I get the general idea: on mousedown, detect what was clicked. While mouse is still down and cursor position moves a certain amount store the data associated with the drag source. When the mouseup event fires, drop the data if the mouse cursor is over a drop target. If it is not a drop target then cancel the operation. You can expand this to the scenario where you click and drag to select multiple files.. how does the UI know what files it selected? Does the display manager have a calculated pixel range for every element and compare mouse position clicks to that? If so, how does the display manager know this? If the answer is too long or difficult to explain here, can you point me to some resources that I could read? I understand that you store data on a mouse click event, but that is a higher level "just call these API functions" view of it.


title: Mobile App Development Language Converter?

text: I was talking with a friend about developing a mobile app (android/iphone) but I've never messed around with mobile app development code before. My friend flippantly told me that I don't _"need to know mobile app code..."_ because _"there are converters out there that convert your code to mobile app code."_ My question is two-fold:   1. Is this true? Where can I find these fabled converters and are they any good?    2. I'm pretty handy with PHP/Javascript/Java (in order of skill level). Which mobile application language would be a good starting place? Or... which of my following code languages "convert the best" to mobile app language?


title: Does printing out numbers involve converting the numbers into characters?

text: In programming languages, when numbers (either integer, or real) are printed out, are they firstly converted to the codes of the readable characters that are meant to represent the numbers, and then the codes are then decoded into the readable characters? For example, in C, functions such as `printf` can print out the value of an integer variable `a` to screen or files. Suppose the value of `a` is 1. Does `printf` first convert the number `1` to the number `0x31` which is the ASCII code of character `1` and then decode `0x31` to character `1` in its output? Thanks and regards!


title: How to run C++ code in browser using asm.js?

text: An asm.js application is very fast (near native C++ speed): http://kripken.github.io/mloc_emscripten_talk/micro4b.png But how is it possible to write one in C++, convert it to LLVM code, then do some trick with emscripten/asm.js ? I haven't found any tutorial about it. And if I write the code in C++, then how to use the js API-s, for example XMLHttpRequest, WebSockets, Canvas or WebGL?


title: Do Windows Installers for internal business applications make sense?

text: I'm trying to build a general understanding for what's common in this situation so that I can decide if it makes sense to pursue it further.   1. Are installers welcome in a typical corporate environment with the following?      * Change control process     * Dev/QA/Production environments     * Designated deploy teams for various areas (firewall, database, windows, etc.).   2. Is there a "litmus test" that could be applied to an application to see if it is a good candidate for creating an installer? *      * Are installers simple enough that every application should have one?     * Are installers even the right tool?   3. Is it reasonable to expect developers to learn something like WiX to support installers?      * Maintainability in general is a concern, i.e., is creating an installer a niche skill? > ## * > > For example, I have a set of winform applications that are in a shared > directory on a production server. Specific groups can run the applications > from this directory but only system admins can modify the executables. The > current deploy process involves having an admin copy/paste the executables > and libraries to the shared directory. > > Since the applications are not installed on the individual users' machine, > does it make sense to create an installer for deploying new versions of > these applications to the shared directory? Edit-- I felt that the answers here gave some solid advice so I wanted to share what I came up with for my current project where I needed to build a large number of applications and deploy them to individual folders. I found a NuGet package called _PublishedApplications that mimics the behavior of _PublishedWebsites for web projects. The idea is you install the NuGet package to your projects and it adds a target that will copy the build artifacts to a _PublishedApplications directory in the output path. This behavior is activated by running MSBuild from the command line and specifying an `outdir` property:               msbuild /p:Configuration=Release /p:outdir=C:\path\to\outdir MySolution.sln      This will give you a directory structure similar to the following:   * C:\path\to\outdir      * _PublishedApplications\        * Project1\          * `dlls, exes, etc.`       * Project2\          * `...` From there, creating a zip that can be extracted in the various environments is fairly painless.


title: How should I structure modules in an Angular.js application?

text: I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS (controllers, directives, filters, services, etc.), but from here I am unsure which module(s) should contain which things.   * Should I have one module that contains all of the other objects in my application? This seems the easiest to set up, but this smells of the God Object Anti-Pattern to me.   * Should I divide modules up by types of objects? i.e. one module for controllers, one for directives, etc.?    * Should I divide them by use? So that all directives, services, and filters that are used for part of the application are together?   * some other strategy I haven't yet seen / thought of? Any help would be greatly appreciated.


title: Unit testing and coupling

text: As a developer I should strive for low coupling between classes. But low coupling doesn't mean "No coupling" so sometimes I have to allow some code flexibility and use "new" inside a domain model. (I'm sure everybody does this in real production code) If I use "new" inside a method to create an object and I have to unit test this method I got a problem. Because I can't mock the objects I can't test the method in isolation. I know I can use dependency injection or I can send objects as parameters but I'm not talking about this clear cases. Is this acceptable in practice?   Is there a better way? (I can't always inject)   Is this a unit test or an integration test? PHP example:               class Car {        protected $objDoor;        public function createComponents() {            $this->objDoor = new Door();        }     }


title: Is having functionality in DB a road block to scalability?

text: I may not be able to give the right title to the question. But here it is, We are developing financial portal for wealth management. We are expecting over 10000 clients to use the application. The portal calculates various performance analytics based on the the technical analysis of the stock market. We developed lot of the functionality through Stored procedures, user defined functions, triggers etc. through Database. We thought we can gain huge performance boost doing stuff directly in database than through C# code. And we actually did get a huge performance boost. When I tried to brag about the achievement to our CTO, he counter questioned my decision of having functionality implemented in database rather than code. According to him such applications suffer scalability problems. In his words "These days things are kept in memory/cache. Clustered data is hard to manage over time. Facebook, Google have nothing in database. It is the era of thin servers and thick clients. DB is used only to store plain data and functionality should be completely decoupled from the database." Can you guys please give me some suggestions as to whether what he says is right. How to go about architect such an application?


title: Need some clarity on the GPL

text: Suppose someone writes some code, and publishes it as open source under the GPL. Later they decide to close source their application and put it for sale. Is that in violation of the GPL? All code in the closed source app was written by the said author. Since he "owns" the code, I would think he can choose to re-license it however he wishes. Is that right?


title: How does Facebook strip html/apostrophes for XSS but also display it?

text: I'm not quite sure if this is a question for programmers.se rather than stackoverflow, but here goes. So Facebook [or any other large company] when given something like an apostrophe or html, can strip it of its malicious intent, but still display it properly. My current sanitizing function in PHP just strips those characters/makes them harmless via htmlentities() and such. So if I wrote an HTML tag, I would want it to be sanitized but also displayed on the website. How do I do this?


title: What's the deal with code reviews?

text: I've been wondering about code reviews recently, based on how many questions I've seen on here talking about them. Between my internships, contracts, and full time jobs, I've worked for six different companies, and only one of them has done code reviews. At the last two places I've worked, code was good (or at least good enough) if all the unit tests passed, and it got the stamp of approval from our tester. We were all compotent programmers, so if the code worked, we were happy. Now, there were a handful of times where something came up months or years down the line that might have been caught in a review, but they were so few and far between that I'm not sure it'd be useful. I guess my question is:   1. Do you consider reviews to be useful?   2. How often do you do them?   3. How much of your time is spent reviewing code?


title: Best practice to propagate preferences of application

text: What is your approach with propagation to all classes/windows of preferences/settings of your application? Do you share the preference_manager class to all classes/windows who need it or you make variables in each classes/windows and update them manually each time setting are changed? * * * Currently I have a `PreferencesInterface` class that hold all preferences and is responsible to default all values with a dedicated method called on create and when needed, all values are public, so non getters/setters, also it have virtual `SavePreferences`/`LoadPreferences` methods. Then I have `PreferencesManager` that extends from `PreferencesInterface` and is responsible for actually implementation of `SavePreferences`/`LoadPreferences`. I've made this basically for _cross- platform_ so that every platform can have a different implementation of actual storage (registry, ini, plist, xml, _whatever_ ).


title: Advice Needed: Developers blocked by waiting on code to merge from another branch using GitFlow

text: Our team just made the switch from FogBugz & Kiln/Mercurial to Jira & Stash/Git. We are using the Git Flow model for branching, adding subtask branches off of feature branches (relating to Jira subtasks of Jira features). We are using Stash to assign a reviewer when we create a pull request to merge back into the parent branch (usually develop but for subtasks back into the feature branch). The problem we're finding is that even with the best planning and breakdown of feature cases, when multiple developers are working together on the same feature, say on the front-end and back-end, if they are working on interdependent code that is in separate branches one developer ends up blocking the other. We've tried pulling between each others' branches as we develop. We've also tried creating local integration branches each developer can pull from multiple branches to test the integration as they develop. Finally, and this seems to work possibly the best for us so far, though with a bit more overhead, we have tried creating an integration branch off of the feature branch right off the bat. When a subtask branch (off of the feature branch) is ready for a pull request and code review, we also manually merge those change sets into this feature integration branch. Then all interested developers are able to pull from that integration branch into other dependent subtask branches. This prevents anyone from waiting for any branch they are dependent upon to pass code review. I know this isn't necessarily a Git issue - it has to do with working on interdependent code in multiple branches, mixed with our own work process and culture. If we didn't have the strict code-review policy for develop (true integration branch) then developer 1 could merge to develop for developer 2 to pull from. Another complication is that we are also required to do some preliminary testing as part of the code review process before handing the feature off to QA.This means that even if front-end developer 1 is pulling directly from back-end developer 2's branch as they go, if back-end developer 2 finishes and his/her pull request is sitting in code review for a week, then front-end developer 2 technically can't create his pull request/code review because his/her code reviewer can't test because back-end developer 2's code hasn't been merged into develop yet. Bottom line is we're finding ourselves in a much more serial rather than parallel approach in these instance, depending on which route we go, and would like to find a process to use to avoid this. Last thing I'll mention is we realize by sharing code across branches that haven't been code reviewed and finalized yet we are in essence using the beta code of others. To a certain extent I don't think we can avoid that and are willing to accept that to a degree. Anyway, any ideas, input, etc... greatly appreciated. Thanks!


title: Resources for understanding iOS architecture

text: I recently finished reading Randall Hyde's excellent book Write Great Code: Volume 1: Understanding the Machine, and I have a much better knowledge of what's going on under the hood now. I want to start making iPhone apps, and there are lots of guides for that. Embracing my inner Hyde, however, I want to first learn about the iOS system architecture. Apple has a really good overview here: iOS Technology Overview Before I start, I wanted to know if there were any other good resources for **understanding iOS architecture and using that knowledge for iPhone programming**. Thanks.


title: External modules security

text: I am developing some external modules for an application. These modules are BPL files and if present in the application folder the application loads them and uses whatever is available inside. How can I prevent the sharing of these modules by my clients? I need them to be authorized to use the modules (module by module). To have some sort of license, registration of the module, what is the best method? Thanks


title: Coding styles when using several disparate libraries

text: I am working on some C++ code that uses several libraries, including some C libraries, that all have different coding styles. It will be open sourced once it reaches a usable stage. Which would cause the least confusion for a short- term contributor who checks out the code to fix one bug or add one feature?   * Have one consistent coding style throughout the entire application, even if it occasionally doesn't match the typical coding style of the libraries used.   * When a library is heavily used in a certain module, conform to the typical coding style of that library (i.e. the coding style used in the library's own code and documentation) in that module. My thought is that the latter will make it easier for experts in that particular library to make one-off contributions, and make it easier to incorporate tutorial/example code during development. However, it also makes the coding style inconsistent throughout the application. What are the pros and cons of each approach?


title: Huge long addition overhead compared to Native call?

text: A run a simple test JDK 1.7.0_45 (Windows 7, 64bit): Test 1:                   long start = System.nanoTime();         for (int i=0; i < 1000000; i++) {             System.currentTimeMillis();         }         elapsed = System.nanoTime() - start;      Versus Test 2:                   long start = System.nanoTime();         long adjust = 313231;         for (int i=0; i < 1000000; i++) {             long result = System.currentTimeMillis() + adjust;         }         elapsed = System.nanoTime() - start;      On my system, first test ran at arund 28 nano/call. The second at around 1250 nano/call. That is a whopping 44x overhead. Can anyone explain such a huge difference?


title: Java web app, with plugin framework and ability to connect to source for updates

text: I've searched all around for some good sources, but either have been searching for the wrong keywords, or I'm just missing something. I'm looking to redevelop a web app I've been using for some time now. Many parts are out of date, and we're constantly throwing in little hacks to attempt to give it new life. So what I'd like to do is re-engineer it from the ground up, built on some sort of plug-in framework. Before I continue, I'm more or less an intermediate Java programmer. In some ways, I'm hoping to use this project as a big learning experience. I've read a lot about OSGi, and it seems that's the most complete framework. Ideally, I would like an end result web app which I can run one instance as my hosting environment, and other instances can connect to it to grab new and updated plug-ins. Eventually I'll want to lock down these plug-ins based on some undecided criteria of who can get them (basically some will simply be updates, others will provide new functionality and should be "purchased" through an external system). But that will probably be handled in a later phase. There should be an administration view for managing bundles in a hot environment (looking to avoid having to restart the server for an update). I know all these things are possible, I'm just trying to find some good resources for reference. All the OSGi tutorials I'm finding seem to be too simplistic. If anyone here can guide me in the right direction on any or all of the items I'm looking for, it would be much appreciated. Also, this is my first post, so I'll take any comments/criticisms about the content of my post. Thanks!


title: Why does Java not put the filename in args?

text: In C and C++, the main method holds the filename in the first position of the array at argv[0]. In Java, however, the filename is not included in the args string array. Is there a practical reason for this? I understand that this makes iterating through command line arguments 0-based instead of 1-based, but is there a benefit? Was the filename just deemed to be useless?


title: Question on System Requirement

text: I have a scenario where a specific webservice must be consumed based on the state to setup user info. For instance if the state is NY or NJ call service A , if state is WA call service B etc. But specifying what service must be called is I guess is "HOW" to setup a user info and not a "WHAT". So should I just have single requirement stating system must have the capbality to setup up user info based on state? EDIT: I would also like to add that the services implemented for different states might want different info to be provided in addition to basic details such as first name and last name. Should the services , input to the services , output from the service , what the program needs to do with the output etc be part of system requirements? I guess all these deal with "HOW" more than "WHAT" - hence is it in the requirements realm?


title: Fastest Functional Language

text: I've recently been delving into functional programming especially Haskell and F#, the prior more so. After some googling around I could not find a benchmark comparison of the more prominent functional languages (Scala,F# etc). I know it's not necessarily fair to some of the languages (Scala comes to mind) given that they are hybrids, but I just wanna know which outperforms which on what operations and overall.


title: Architecting an application with a single page javascript driven UI

text: I have a single page application where everything in the UI is javascript driven so any operation requiring data or updating of data is done via Ajax requests. The way things are setup right now is that my Ajax called are made to one ajax.php file which takes care of routing them to the proper service method. This works well but there's one problem. Whenever I have operations that require a user ID, I don't want to pass them as part of an ajax request so as to prevent tampering. Since I have a session running server-side, I have a Security service from which I can retrieve the user ID of the user currently logged in. The security does so by using a Session object that abstracts the access to the session (in my case, $_SESSION in PHP) implementing an interface. My security service gets injected into other services as needed, so for example, if I have a PostService->findUserPosts() method, that method uses the getUserId() method of the injected SecurityService object to figure out the user ID instead of having it passed as an argument. The problem is I suspect (and others seem to agree) that not passing in the user ID to the service is bad design. But how do I get around doing that without sending the user ID via ajax? I can think of a few options, none of which I really like or know of a good way to implement: 1) Add a controller layer on the server side, in which case I can call SecurityService->getUserId() in the controller and pass in a separate call to PostService->findUserPosts($userId); the problem with this approach is that it requires me to add a bunch of controllers that are for the most part pretty redundant. As it is, I already a PostService->findPosts() method that basically just calls PostGateway->findPosts(). I can live with that redundancy because there will be a lot of places where the service will need to do more. But adding a third layer with a controller with a findPosts() method, that seems too much of a pain. 2) Pass the user ID in the ajax request and come up with some kind of tampering mechanism to make sure the ajax request can't be altered. I could do that by hashing the URL string of my request and appending that as a parameter, and then on the server comparing the hash. This is more obfuscation than anything though, since the hash would need to be generated client side, which means somebody looking through the code could figure out how the hash is generated. 3) Keep things as they are, bearing in mind that my user ID is at least not hard coded and various implementations of the Session object could be used, that way the user ID can be retrieved in multiple ways, not tying me to the PHP $_SESSION object. 4) Use a hybrid method of #1 and the current setup where if I need to access session info I use a controller, otherwise I call the service directly. This could work, though it doesn't feel like a clean, unified approach. I tried to figure this out with two separate questions dealing with separate smaller problems, but I think the lack of context made it difficult to answer, so figured I'd formulate a question with the entire problem. Suggestions are welcome. Suggestions are welcome. Or should I say, much needed! **UPDATE:** maybe a valid compromise would be to have a PostService->findByUser($userId) method and then have a UserService->findPosts() method that gets the userId from SecurityService the same way PostService is doing now?


title: What to look at when deciding which technologies to use on a new project?

text: So, we are starting a new project soon, and there are a lot of decisions that must be made. The one I am most interested in is: **What all do you have to take into consideration when deciding what technologies to use?** There is always something that you miss and only half-way through the project do you realise, _"O yeah... I should have thought about that..."_ , and usually it's something that would have made you go with a different technology. I would like to hear what you guys think. Maybe get a nice comprehensive list up to help the architects everywhere to make more informed decisions.


title: Is the Java package name convention flawed?

text: We're all familiar with the Java package name convention of turning the domain name around. I.e. `www.evilcorp.com` would, by convention, chose to have their java packages `com.evilcorp.stuff`. Increasingly I'm getting fed up with this. As a commercial programmer, I encounter time and again that the software package name is completely irrelevant due to some rebrand, acquisition or similar. In the opensource world there's less name changes so there it makes sense. However it seems to me the shelf life of many pieces of (commercial/internal) software are much longer than that of the organisation making them. The problem is often made worse by software projects taking the marketing department's lead to use the name _du jour_ they use refer to a certain project. A name that will, without fail, change 3 months down the line to make the emperor's new clothes feel fresh and new. Because of this, I've mostly stopped using the reverse domain as package name. Granted, if this is done on a large scale, there's risk of name collisions, but surely this is mitigated by either using "unique" software names, avoiding generic words, or use the reverse domain for projects intended to be sold/released as libraries. Other thoughts?