title: Identifying Domain Services & Application Services when doing DDD

text: -I'm trying to figure out how to identify Application Services in my application. I think I can identify a Domain service by 2 things:   1. It acts as a facade to the repository.   2. It holds business logic that can't be encapsulated in a single entity. So I thought about this simple use case that I'm currently working on: An admin should be able to ban a certain user. The operation must be logged and an email must be sent to the banned user. I have a `UserRepository` which has a function `getUserById()`. I have a `User` entity which has a `ban()` function.   I'll create a `UserService` like this:               class UserService{         static void banUser(int userId){               User user= UserRepository.getUserById(userId);               user.ban();               UserRepository.update(user);         }     }      The `userId` is a `POST` variable that I'll be receiving in my `Controller` from a web form. Now where does the logging go? I need to log the ban process twice before and after the operation ex:               Logger.log("Attempting to ban user with id:"+userId);     //user gets banned      Logger.log("user banned successfully.");      Second, I need to send a mail to the user. where should the call go? I thought about putting the logging and email is the `UserService` class itself, but I think there are better solutions. Third, where do Application Services fit in all of this?


title: Understanding stack frame of function call in C/C++?

text: I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations performed within a function. For example, if the function was supposed to just increment a passed-in int value by 1 (similar to ++ operator) and return it, it would put all the parameters of the function and local variables into registers. I'm wondering which registers are used for returned or pass by value parameters. How are references returned? How does the compiler choose between eax, ebx,ecx and edx? What do I need to know to understand how registers, stack and heap references are used, built and destroyed during function calls?


title: Methods for testing a very large application

text: I have a PHP app which is very large. There are usually 2-3 developers working on it full time and we are getting to the point where we are making changes and creating bugs (cough features!). The software isn't complex per say, just there is a lot going on (35~ controllers, about the same models, etc). Even being careful it's easy for a change in this view (tweaking an id on an element) to wreck an ajax query happening under some special condition (logged out while standing on one foot). Unit tests are the first things which spring to mind, but we tried these on another app, and it's so easy to forget them / or spend more time writing tests then doing tests. We do have a staging environment where code gets checked over before pushing live. Maybe we need a part time Q/A person? Anyone have any suggestions/thoughts.


title: New Starter Introduction and Induction Process

text: First day at work for a new programmer. Assuming that the company has covered all the usual corporate stuff (benefits, paperwork, health and safety and so on), **What are the things you should be talking a new developer through to get them up to speed and productive as soon as possible?** In additional what are the key things in making this process a success? What have you seen work particularly well? (Edit: Added a bounty. The current top answer is fine but I'm still thinking there is more that can be done to make a programmers first week as useful to them as possible. Really hoping for insights from good and bad starts to jobs people have had).


title: Pricing of a collaborative work

text: I suppose there's no straight answer to this, but what ideas come to mind for determining how much each programmer would get for participation in a collaborative project if it were to be sold?


title: Dealing with bilingual(spoken language) code?

text: So I've got to work with this set of code here for a re-write, and it's written by people who speak both English and French. Here's a snapshot of what I'm talking about (only, about 4000 lines of this)               function refreshDest(FormEnCours,dest,hotel,duration) {         var GateEnCours;         GateEnCours = FormEnCours.gateway_dep.options[FormEnCours.gateway_dep.selectedIndex].value;         if (GateEnCours == "") {               FormEnCours.dest_dep.length = 0           } else if (FormEnCours.dest_dep != null && FormEnCours.dest_dep.type && FormEnCours.dest_dep.value != "ALL") {           if (Destinations[GateEnCours] == null || Destinations[GateEnCours].length == 0) {                RetreiveDestinations(FormEnCours,GateEnCours,dest,hotel,duration);           } else { refreshDestSuite(FormEnCours,GateEnCours,dest,hotel,duration); }         }     }          function refreshDuration(FormEnCours,GateEnCours,DestEnCours,hotel,duration) {         // Refresh durations         var FlagMoinsDe5Jours = "";         var Flag5a10jours = "";         var Flag11a16jours = "";         var FlagPlusDe16Jours = "";     .......       Is there any approach that I, as a speaker of only one of these languages, can use to make this entire process a lot less painful for both figuring out what everything does, and then refactoring it?


title: Conceptually what does it mean when it is said that each thread gets its own stack?

text: I have been reading Java Concurrency in Practice by Brian Goetz and inside the section **Stack Confinement** it is mentioned that each thread gets its own stack and so local variables are intrinsically confined to the executing thread; they exist on the executing threads stack, which is not accessible to other threads. What does he mean that each thread has its own execution stack ?


title: At what point is asynchronous reading of disk I/O more efficient than synchronous?

text: Assuming there is some bit of code that reads files for multiple consumers, and the files are of any arbitrary size: **At what size does it become more efficient to read the file asynchronously? Or to put it another way, how small must a file be for it to be faster just to read it synchronously?** I've noticed (and perhaps I'm incorrect) that when reading very small files, it takes longer to read them asynchronously than synchronously (in particular with .NET). I'm assuming this has to do with set up time for things like I/O Completion Ports, threads, etc. Is there any rule of thumb to help out here? Or is it dependent on the system and the environment?


title: Reasonable commision for position

text: My situation is that I have been offered a job working on a product for a small company. I'm currently working for a large corporation for a respectable salary considering my experience. Long term I am interested in creating my own products and starting up my own company. I've been offered a job to develop a product that I would be primarily developing. I looked at the idea and I think it is a pretty good idea and has a reasonable chance of being successful. I told him that I would be interested in earning a commission from the sales of the product. Considering that I would be developing the product what percentage would be reasonable to ask?


title: What shoud I know or should be doing after six years of experience in software development?

text: Even after six years of experienece I am still doing the things which I was doing six years ago. Working on the same mundane CRUD stuff. Nothing has been real challenging. Since I am working in a small company, we dont even have a proper development process. We don't even do unit testing, for example. I am feeling like I am just not going to the next level in my career.


title: Function that requires many parameters

text: I have a problem related to this: Are there guidelines on how many parameters a function should accept? In my case, I have a function that describes a rounded rectangle. The caller specifies   * An integer which determines how the rectangle should be merged into previously created shapes   * An Anchor, which is a point that is used for alignment (right, left, top, bottom etc). (0,-1) means that position (next parameter) describes the top, middle point of the rectangle.   * The position of the rectangle   * Width and height   * Corner radius Should I use Parameter Object pattern in this case? It is hard to see how these parameters are related


title: IDE for visually impaired

text: A visually impaired colleague has asked me to recommend an IDE with easy-to- find and easy-to-use controls for:   1. font size   2. background and foreground colors   3. changing syntax color scheme   4. support for at least C/C++ and Java He would prefer an IDE that is either portable or that has similar versions for Linux, Windows and Mac. He prefers a dark background and light colored fonts and needs to sit very close to the display.


title: What is the justification of use .inc files to declare and implement code is some Delphi RTL units?

text: Starting with #Delphi #XE2 many of the new RTL units related to Vcl styles, OSX and so on, uses inc files to declare types, classes and implement code (just like the FPC does), what is the justification to do that? you can see what i mean if you inspect one of these folders (source\rtl\posix, source\rtl\posix\osx, source\rtl\sys )


title: What is the big-O cpu time of Euclid's Algorithm of "Greatest common divisor of two numbers"

text: Looking at Euclid's algorithm for the "Greatest common divisor of two numbers", I'm trying to divine the big-O cpu time for numbers K, and N. Can anybody help? This is the algorithm as I understand it.. Where:   * max(A,B) = the greater of A or B such that: min(10,3) = 10   * min(A,B) = the smaller of A or B such that: min(10,3) = 3   * modulus(A,B) = the remainder of A divided by B such that: modulus(10, 3) = 1 The algorithm is:   1. r = modulus(max(K,N), min(K,N))   2. if r = 0      * then GCD is max(K,N)     * else:        * max(K,N) = r       * go to step 1 It appears to me that due to the division occurring, it can't be a linear algorithm which is why it's useful as something more efficient than a naive implementation that just tries all the possibilities from 0 to min(K,N). But I can't quite figure out just what the runtime is. Any pointers would be very helpful!


title: Code Base with awful code conventions, follow them?

text: With no time to refactor, when you are working on legacy code, with the most awful conventions, what is the best practice? Will trying to follow _better_ coding style would improve readability or actually hurt it? For example, in java method names are usually camel cased: > myGoodNamedMethod But in the repository there are code with methods like this (not all, but the majority) > my_c_style_method_that_looks_off_in_java


title: Alternatives to type casting in your domain

text: In my Domain I have an entity `Activity` which has a list of `ITask`s. Each implementation of this task has it's own properties beside the implementation of `ITask` itself. Now each operation of the `Activity` entity (e.g. `Execute()`) only needs to loop over this list and call an ITask method (e.g. `ExecuteTask()`). Where I'm having trouble is when a specific tasks' properties needs to be updated, as in configuring the task (not as part of the execute method). How do I get an instance of that task? The options I see are:   * Get the Activity by Id and cast the task I need. This'll either sprinkle my code with:      * `Tasks.OfType<SpecificTask>().Single(t => t.Id == taskId)`     * or `Tasks.Single(t => t.Id == taskId) as SpecificTask`   * Make each task unique in the whole system (make each task an entity), and create a new repository for each ITask implementation I don't like either option, the first because I don't like casting: I'm using NHibernate and I'm sure this'll come back and bite me when I start using Lazy Loading (NHibernate currently uses proxies to implement this). I don't like the second option because there are/will be dozens of different kind of tasks. Which would mean I'd have to create as many repositories. Am I missing a third option here? Or are any of my objections to the two options not justified? How have you solved this problem in the past?


title: What drives the adoption, or not, of new programming languages?

text: I'd really like to focus on why some new programming languages are adopted in the mainstream, and others remain relatively niche. I'd like to know about things like specific use cases, backwards compatibility, or some new features, simple or complex implementation difficulty. Specific examples would be appreciated, but let's not get caught up on the exact definition of "mainstream" or "niche" here.


title: Business case for decentralized version control systems

text: I searched and couldn't find any _business_ reasons why git/mercurial/bazzr systems are better than centralized systems (subversion, perforce). If you were trying to sell a DVCS to a non-technical person what arguments would you provide for the DVCS **increasing profit**. I will shortly be pitching git to my manager, it will take some time converting out subversion repositories and some expense in buying smartgit licences. **Edit** I tried to make this question into a generic discussion on centralized vs decentralized, but inevitably it has turned into git vs subversion. Surely there are better centralized systems than subversion.


title: Why aren't Multi-Platform Programming Languages popular?

text: So I was talking to a friend and he mentioned > Using WAC I can write Javascript code that will compile and run in iOS, > Android, BB etc and there is this programming language that lets you write code that is _multi-platform_ : http://haxe.org/doc/intro I was wondering why these hasn't got that much attention yet because the idea is so good. So in a sense, what is probably wrong with these ideas in a real-world perspective(real deployable projects)? **EDIT:** So I have probably misused some terms so here are some clarifications. It goes something like, for example, I write code in one language, then I can run it in iOS and Android devices, both of which have their native programming languages. That means I have an app that I can run on both device without having to code any Java or Objective C That's the best I can do for clarifications because I myself am a little confused T_T


title: How do you handle regular latecomers at the stand-up meetings?

text: We have our daily stand-up meeting at **8:45** while the workday starts at **8:30**. Even with the 15 minutes slack people keep coming too late, on a regular basis. This results in our meetings being small, incomplete, inefficient and sometimes even completely useless. We have tried to have people bring fruit for the team on the next day, but this didn't work as we'd be having multiple breakfasts every day (and after a while they didn't even bother to bring any anymore). We have been thinking of imposing a fine, but we find solutions like that quite childish. How do you handle regular latecomers at stand up meetings? What worked - and what didn't?


title: How to represent compound elements within a database?

text: I need to design a database table that holds the data of programmers work hours. The problem is that I have a compound type - two pieces of data belong to a category. Specifically, the work hours are classified into categories: design, program, test, troubleshoot, etc... and each category is divided into two types: hours spent at work and hours spent at home. How can I design a compound type in the database side? ![enter image description here](http://i.stack.imgur.com/gXob9.jpg) I thought about storing the two types in one field like "6,2" but that creates more problems to resolve. I would now have to convert and split data along with worrying about localization issues, missing data, or if another location was added to the categories. * * * Clarification:   Asking my question a different way, it's relatively easy to design a table without compound types like this: ![enter image description here](http://i.stack.imgur.com/izuiu.jpg) But how to deal with it when each category is split into two types?


title: What to name a parent thread that just delegates to workers?

text: I have a program where one thread creates a work queue and a bunch of workers that pull from it, and occasionally does some cleanup work for the workers. If the workers are all instances of `FooWorker`, what would I name the other class? One idea I've had so far is a `FooManager`, but maybe there's a better one?


title: Calculations in Vector Register

text: How do vector registers work in terms of calculations and alloting data to them ? Is there a detailed reference available somewhere explaining how vector registers work and how data is fetched from them ?


title: Why don't I see many unit test projects that bring up and tear down a DB? (ASP.NET MVC)

text: I see all the examples that demonstrate unit testing code and mocking the calls to the DB since you are not suppose to touch the DB. But it seems to me having a set up tasks that uses the actually schema, loads the lookup tables and then populates it with data using the methods to be tested... This way it is more real world testing and all the stored procedures are tested as well.. But I never have seen any examples like this... Is there some reason I do not understand why using this technique is not as useful as it seems ? EDIT1: Sorry.. I shouldn't have called it unit test.. yes. I will have unit tests as well that are for testing code.. But beyond that it seems like a good idea to bring up and tear down and DB and have code that modifies that DB and does assertions.. But I don't want this to be UI testing.. I just want to perform a lot of CRUD functions and a lot of assertions .. :My question is #1 does this make sense.. #2 how do I automate this all within visual studio ? How do I tell VS 2012 to run a SQL script before running the tests? is there some special API for this ?


title: Why Python and not Lua?

text: Why has Python been backed by google and become so rapidly popular and Lua has not? Do you know why Lua has stayed in background?


title: Should all new web projects build their backend based on xml/json result sets?

text: If you were building a new Saas project, would it make sense to start with all of the backend services returning xml/json? Because these days you need to build for both the web and mobile devices, and having a backend that is build from the start to return xml and json, you are ready to go mobile (all services have the business logic, so you won't be repeating anything). Now the web would be MVC, so the controller would just be routing the request to your service backend, and converting the json or xml to html. The obviousl downside is that you have to build a backend, and then another web project that calls your backend. But this also goes to you favor as it forces you to seperate your concerns, and not leak business logic in your controller/view layer. Thoughts?


title: ACM student chapter event ideas?

text: I was recently elected president of the student chapter of ACM at my university, and am trying to come up with some ideas for events for the following year. The big one we do every year is practice matches and try outs for the ICPC. I am hoping to host one or two more events this year, and was wondering if anyone has some cool ideas or has some past experiences that worked well. One idea that we have had so far is to do a hackathon but it generally seems difficult to convince the underclassmen that they have the skill to participate in events like this.


title: The bad habits formed in the process of learning the C programming language

text: In the Cambridge University Computer Science curriculum booklet of 2012-13 under the module entitled 'Foundations of Computer Science' it states: > The main aim of this course is to present the basic principles of > programming. As the introductory course of the Computer Science Tripos, it > caters for students from all backgrounds. To those who have had no > programming experience, it will be comprehensible; to those experienced in > languages such as C, it will attempt to correct any bad habits that they > have learnt. They seem pretty sure that one who has learned a little C, has formed 'bad habits' in the process. I wish to learn C for I am interested in reading and writing Kernel source code. How do I learn C without forming 'bad habits'?


title: Representing a rule in a ruleset

text: How to represent rules for a rule engine as objects? A rule would be > if ( _booleanExpression(input)_ ) then _a chain of generic actions_ " else > _next rule_ ...where the generic actions might be e.g. passing the input to a different chain of rules, returning a conclusion (terminating analysis with result), or gathering additional data - though probably other actions might prove necessary too. Now the problem of parsing arbitrary boolean conditions aside (let's assume we have a fully working `booleanExpression` class available), how would such a Rule object look like, and specifically, how would the Ruleset object containing orderly, interconnected grid of these look like, in particular in a structure that will be possible to process by the actual engine. (if the data structures don't make it obvious how such engine should process them, maybe a hint about it too?) This will be written in C++ but a language-agnostic answer is most welcome too. * * * This is derivative of my question about Event Correlator, which seems to be unanswerable simply because it's too broad to tackle in one answer, so I'm trying to split the problem into smaller, bite-sized chunks.


title: Maintaining indices for location in a sorted list in database rows

text: I have a fairly simple data structure like this:               create table project (id int auto increment primary key, name text);          create table item (id int auto increment primary key, name text,         project_id int not null,          project_sort_index int not null,         sort_index int not null,         foreign key fk_project(project_id) references project(id));      A `project` can have many `item`s. Items have two different fields for maintaining sort order, `project_sort_index` and `sort_index`. These sort order fields apply in the following way. When I view all items belonging to a project, I need a sort order specific to each project for the items. When I view _all_ items globally, I need a sort order for them globally. I have a couple of questions as to how best to maintain and modify sort order for these items. Lets say that I have moved an item at index 4 to index 2. How do I propagate that change to my database efficiently? For example, how do I now update all index numbers >= 2 to move everything down, yet close the gap left in place 4? Is there a better way of sorting lists in SQL?


title: Is reverse debugging possible?

text: I know there are some products for reverse debugging. I am wondering that does reverse debugging mean going to one step back or starting over again up to one step back? I've found an explanation here.


title: Software license options

text: Is there a software license that allows free access to source code, but does not allow redistributing any binaries, either direct from the source code or modified source code for a limited time? The idea being much like a open source software patent; the original developer has the exclusive right to sell and distribute the product, and prevent others from copying the product for a limited time, and the source code would be disclosed to the public. Obviously the downside is enforcing this license, but larger companies (e.g. Microsoft) could possibly gain the benefits of open source projects but still keep their proprietary position.


title: Patterns and practices for Web Scraping in .Net (C#)

text: I will be putting together an application to automate an external web site/application. In some instances I will need to navigate the site as a user would (some links I need to follow cannot be predicted and must be parsed from a response) I am already using Html Agility Pack, and am aware of Tidy if that is needed. **Are there any other technologies I should be aware of?** **Are there any recommended patterns for being able to quickly adjust in the event that the external web app changes?** I’m envisioning encapsulating the validation of responses as some type of strategy or similar pattern that can be easily separated/plugged in as necessary, but any specific suggestions would be great.


title: Are Quines useful as anything more than a programming puzzle?

text: Quines, which are programs that generate their own code as part or all of their output are a neat idea for a programming puzzle. However, do they have any use beyond that?


title: Architecting multi-model multi-DB ASP.NET MVC solution

text: I have an ASP.NET MVC 4 solution that I'm putting together, leveraging IoC and the repository pattern using Entity Framework 5. I have a new requirement to be able to pull data from a second database (from another internal application) which I don't have control over. There is no API available unfortunately for the second application and the general pattern at my place of work is to go direct to the database. I want to maintain a consistent approach to modeling the domain and use entity framework to pull the data out, so thus far I have used Entity Framework's database first approach to generate a domain model and database context over the top of this. However, I've become a little stuck on how to include the second domain model in the application. I have a generic repository which I've now moved out to a common DataAccess project, but short of creating two distinct wrappers for the generic repository (so each can identify with a specific database context), I'm struggling to see how I can elegantly include multiple models?


title: Why does Java require a servlet container for simple RPC service?

text: I have a big database controller which is written in Java. The controller reads information from the database, and interprets it into data structures which are then displayed in a CLI. Java was chosen because writing code in it is fast and easy. Now I want to create an RPC server on top of the controller (XML-RPC or JSON-RPC for future AJAX calls), but it looks like I need a servlet container for my RPC service. I am confused because last year when I needed this kind of capability for another project in python, it took me less than 5 minutes to create the same functionality using the SimpleXMLRPCServer The same ease of creation applies also to C# as far as I recall. But in Java the story is different; now I need a servlet and therefore a servlet container (i.e Tomcat, Jetty) which means I need to install and maintain web servers. From what I can tell, JSON-RPC requires `Spring` framework in order to work. I have already spent around two hours in learning the design and sort-of how Tomcat works without writing even one line of code. I searched the web and found out that I have standalone options: I can use this library, but it doesn't seem maintained and it is also somewhat complex (I'm looking for something with decorators / annotations).   The other option I found is to use the so called "embedded" jetty and then trying to set it and configure it by code which also seems a tedious task. Why isn't there a **standalone** mechanism for such a popular interface? Am I missing out something here?


title: Attending my first software conference - any tips before I go?

text: My nice employer allowed me to visit a software conference in June (International PHP Conference, for those who care). Wanting to make the most of it, I would ask the more experienced conference goers in here to give me some tips on what I could do to maximize my learning experience on the conference, and to reduce beginner mistakes. Sorry that this question is a little ambiguous, but I think it's best to keep it a little bit more open, so I can get a wide range of Ideas, and it will be of more use to further people seeking for an answer.


title: Functional programming: Writing a small interpreter

text: I'm working on a small Unix shell, and am contemplating the idea of writing a script interpreter. While reading about the subject I inevitably hear of functional programming, lambda calculus, and find out about the whole fascination around Lisp. Before I jump into this I have some questions.   * Which language should I use? I am curious about functional programming, so that would be a great opportunity to start. I want my shell to have as little 3rd party dependencies as possible. I am wondering whether I should look for a compiled language. I would like being able to distribute it more easily. Is this a correct approach? if so, which language would you recommend?   * How do you embed an interpreter in your program? The way I see it is having the interpreter run in a second separate process. As far as I know, two processes communicating, are either listening to a pipe or sending signals to one another. Is this a realistic approach? Is there a particular language that handles this part? Are there other ways of embedding the interpreter?


title: What design patterns does every developer need to know

text: I was wondering what design patterns **every** developer, no mather what dev language, should know and why?


title: How would you go about looking for collaborators?

text: I seem to have a never ending stream of more-or-less original, more-or-less cool ideas for software/apps/stuff yet to be written on my mind. Sometimes, I decide to just start implementing my idea. Several hours later, I end up with a decent, more-or-less working prototype of what I'm trying to build. Then, my alarm clock goes ringing and I have to get back to the real world, tired as hell. In most cases, the stuff I started remains unfinished forever. Sometimes, that's okay. Other times, I honestly feel like that's a bummer. But I realize that there are sites like GitHub and there are many other coders out there. Is there a place where one can post ideas, proposals, concepts, or rough-around-the-edges-code in order to find people who are interested in collaborating on projects? **Edit:** I am aware of "the usual way" – keep developing on your own for some period of time, open-source the code, mention your project on dev blogs, IRC or wherever else you go; eventually attracts others. What I'm looking for is a place to connect with other devs (e.g. of different specializations) on the early stages of a project.


title: Can cross-platform development be speeded by really specific, complete pre-coding design?

text: I'm green at programming but not entirely noobish. I taught myself some Java about five years ago, and I learnt me some Objective-C recently. I was talking with a Unix guy a while back, and he said that if you do your object architecture and design very completely and correctly, cross-platform development becomes really easy. All you have to do is take the description of each element and implement it. Since your design is so complete, each individual element is composed of relatively simple tasks. I'd like to get some feedback on that concept. In theory it makes sense, but programming is about execution. And if you agree with the concept, can you point me to some material that would help me understand how to build those kind of complete, specific designs?


title: Why are software schedules so hard to define?

text: It seems that, in my experience, getting us engineers to accurately estimate and determine tasks to be completed is like pulling teeth. Rather than just giving a swag estimate of 2-3 weeks or 3-6 months... what is the simplest way to define software schedules so they are not so painful to define? For instance, customer A wants a feature by 02/01/2011. How do you schedule time to implement this feature knowing that other bug fixes may be needed along the way and take up additional engineering time?


title: WCF and object-oriented programming

text: I am building a program which would have WCF support. I am using the MVC pattern. For each controller there is a WCF service class. e.g. I have `CTRL.CTRLBooking`, `WCF.IWCFBooking` and `WCF.WCFBooking`. For each controller (total of 10) there is a WCF class and an endpoint. Is this a good approach or should I keep all the methods I provide in one single class e.g. `WCF.WCFService` (considering their count would be no more than 25-30)?


title: Examples of different architecture methodologies

text: Is there a resource or site which illustrates building the same application (desktop or web) using several different contrasting architectures? Such as MVP versus MVVM versus MVC, etc. It would be very helpful to see how they look side-by-side using real-world code instead of comparing written theory to written theory. I've often found that something can be _described_ well in a book, but when you go to _implement_ it, the subtleties and weaknesses of the theory become readily apparent.


title: CQRS and validations

text: I'm starting to introduce myself in CQRS concepts, but I get stucked with the following situation: Supouse you have an entity that must have an unique name. In order to verify that, prior to create the entity you must make a query, thus you are verifing against the query subsystem. But what happens if the syncronization has not been happened between the command system and the query system yet? Other client just had sent the same name before you. What happens in that case?


title: Best way to test a reimplemented web service

text: In my team, we are about to start the reimplement of a service. One of the important steps to do to accomplish this is how do we ensure that we are doing it in the right way and we are not introducing new bugs. So, what we have in mind is create a bunch of test to verify the following:   * The behavior. Both services should behave the same way (store data in the same places, send same, notificacions, etc...)   * Results. Object returned by the service's calls should be exactly the same. So, the things that we have thought is to do the following:   * Create a set of test that verifies the behavior and results of old service.   * Create the new service adding unit test, and whitebox integration test for the new service   * Create some kind of "Mirror test" that checks if the new service is working as the old one. Is there a way to do this? Thanks for any help. Note: None of the code of the previous version is reusable. There is no test for the older version of the service [Edited]replaced original word "migrate" with "reimplement"


title: How flexible can hardware get?

text: This subject is long time in the making for me and it particularly took off when I was researching bootloaders for computers and consumer electronics, which, I will note, differ drastically. I've learned how ancient and inflexible x86 hardware is and just how much the structure of software is constrained by it. Examples of what I am talking about:   * Bootloaders cannot have an arbitrary size.   * Specialized functions like memory-mapped hardware.   * An Intel processor's ties to a particular type of firmware. So I've wondered about systems that might be designed like this:   * Writing text to the screen handled pixel-by-pixel by an operating system instead of an intermediary microcontroller.   * Sectorless hard drives wherein a computer simply begins executing at the first address and the bootloader can be any size.   * Functionality of microcontrollers moved into the software. I understand that this would take away a lot of simplicity, but do systems like this exist? I am guessing this would be more prevalent in embedded systems. To better understand this question, imagine a device where there are no controllers or independent systems and everything is controlled by the CPU.


title: opensaml assertion signature validation

text: I have a SAML 2 response with one assertion which is signed and the response itself has signed again. I use below code to validate the signature profile of the response.               SAMLSignatureProfileValidator signatureProfileValidator = new SAMLSignatureProfileValidator();     signatureProfileValidator.validate(**response**.getSignature());      And below code block to validate signature.               SignatureValidator signatureValidator = new SignatureValidator(validatingCredential);     signatureValidator.validate(**response**.getSignature());      But I believe that these things validate the response signature and the response signature profile only. **Do I need to validate the assertion signature as well?** I have tried validating assertion signature using below code block. But it gives me the ValidationException which means it is not valid. But it should be.               SignatureValidator signatureValidator = new SignatureValidator(validatingCredential);     signatureValidator.validate(**assertion**.getSignature());


title: Developing with confidence without a real development environment

text: I've recently been hired for a project that involves working with and around several third-party "enterprise" systems. Due to what I imagine would be the astronomical cost and effort required to build a sufficiently faithful replica of the production environment, the prospect of having a real development environment seems vanishingly slim. This is of course not ideal. On the bright side, I imagine there must be people out there safely testing and deploying software into unreplicable environments like this, and I can probably follow in their footsteps. How those who effectively deal with these kinds of situations do it?


title: Has there really not been one thing in the past 20 years that provided huge software development gains?

text: In _No Silver Bullet_ , Fred Brooks makes a variety of predictions about the future of software engineering, best summed up by: > There is no single development, in either technology or in management > technique, that by itself promises even **one order-of-magnitude > improvement** in productivity, in reliability, in simplicity. His argument is very convincing. Brooks was writing in 1986: was he right? Do developers in 2014 produce software at a rate less than 10x faster than their counterparts in 1986? By some appropriate metric -- how large has the gain in productivity actually been?


title: Verifying a debit card online - What information is checked?

text: I am eager to know what information is checked by the online companies to confirm that the card is yours? If a programmer has to implement this functionality, how can he access information like address of the client which is not written on the debit card? Thanks


title: alerting that an object cannot be deleted (due to constraints)

text: Assume an application with a rich domain model with many classes (e.g `School`, `Classroom`, `Teacher`, `Student`, `Course`, `Exam`, `Submission`, ...) linking to each other. Model and links are mapped to the database which uses appropriate FKs and constraints (without cascade delete). In the admin panel the user has delete buttons next to each object. Attempting to delete an object has one of the following two outcomes:   * the object isn't being referenced from any other object, so it is deleted   * the object is being referenced by at least one other object so it cannot be deleted. An alert is shown to the user. I've got two ways to implement this:   1. prior to executing the sql delete, do whatever queries are necessary to discover whether this object can be deleted. If it cannot, then alert user.   2. go ahead and execute the sql delete and if that fails (due to the rdbms constraints) catch the sql exception and alert the user that it cannot be deleted. Both ways work well. The first way allows me to give the user a detailed reason why the object cannot be deleted (e.g it is being referenced by 2 `Course`s and 1 `Classroom`). The second way allows me to solve the whole problem by not writing any constraints checking code and rely on the solid (and existing) implementation of the db. Is there a reason why I should definitely choose one over the other?


title: lightweight document indexing to handle less than 250k potential records

text: Recently I've found myself chafing at the limitations of document indexing engines. I was developing a small website that needed some fairly robust searching capabilities but due to their hardware constraints I couldn't deploy a Lucene-ish solution (such as Solr or ElasticSearch, like I normally would) to handle this need. And even then, while I needed to serve up some complex data and calculations that were database-intensive, I didn't need to handle more than 250k potential records. Deploying an entire Solr or ES instance just to handle this seemed like a waste. After I thought about it, it seems like a fairly large problem. Most people handle search requirements solely with SQL. They just run SQL queries for their data and that's that. Their search capabilities also end up being terrible.   * Doing a blanket full-text wildcard search can be painfully slow on some systems (shared hosts in particular) and bog down your database, especially if you have complicated queries and lots of joins.   * You end up doing multiple queries on a single request from the user. You might get around this with ever-more-complicated queries, but see the previous point.   * Lack of features typically present in full-text engines. Databases had the same problem of needing to be deployed as a server and then SQLite came along and suddenly we could deploy a database that is self- contained in a single file. My Googling has produced nothing - wonder if something exist like this for full-text indexing/searching. What factors to take into account when deciding whether to implement lightweight document indexing (eg as explained in answers to another question) or keep using SQL for these situations?


title: WCF/webservice architecture question

text: I have a requirement to create a webservice to expose certain items from a CMS as a web service, and I need some suggestions - the structure of the items is as such:               item     - field 1     - field 2     - field 3     - field 4      So, one would think that the class for this will be:               public class MyItem     {       public string ItemName { get; set; }       public List<MyField> Fields { get; set; }     }          public class MyField     {       public string FieldName { get; set; }       public string FieldValue { get; set; } //they are always string (except - see below)     }      This works for when its always one level deep, but sometimes, one of the fields is actually a point to ANOTHER item (`MyItem`) or multiple `MyItem` (`List<MyItem>`), so I thought I would change the structure of `MyField` as follows, to make `FieldValue` as `object`;               public class MyField     {       public string FieldName { get; set; }       public object FieldValue { get; set; } //changed to object     }      So, now, I can put whatever I want in there. This is great in theory, but how will clients consume this? I suspect that when users make a reference to this web service, they won't know which object is being returned in that field? This seems like a not-so-good design. Is there a better approach to this?


title: Removing an element not currently in a list: ValueError?

text: This is something that's bothered me for a while, and I can't figure out _why_ anyone would ever want the language to act like this:               In [1]: foo = [1, 2, 3]          In [2]: foo.remove(2) ; foo  # okay     Out[2]: [1, 3]          In [3]: foo.remove(4) ; foo  # not okay?     ---------------------------------------------------------------------------     ValueError                                Traceback (most recent call last)          /home/izkata/<ipython console> in <module>()          ValueError: list.remove(x): x not in list      If the value is already not in the list, then I'd expect a silent success. Goal already achieved. Is there any real reason this was done this way? It forces awkward code that _should_ be much shorter:               for item in items_to_remove:        try:           thingamabob.remove(item)        except ValueError:           pass      Instead of simply:               for item in items_to_remove:        thingamabob.remove(item)      * * * As an aside, no, I can't just use `set(thingamabob).difference(items_to_remove)` because I _do_ have to retain both order and duplicates.


title: Designing a system with different business rules for different customers

text: My company is rewriting our proprietary business application. The current architecture is poorly done and inflexible. It is coded more procedural oriented as opposed to object oriented. It has become difficult to maintain. Our system is a web application written in .Net Webforms. I am considering ASP.Net MVC for the rewrite. We intend to rewrite it with a good, solid architecture with the goal of maintainability and reusable classes for some of our other systems and services. We would also like the system to be customizable for different customers in the event that we market the system. I am considering redesigning the system based on the layered architecture (Presentation, Business, Data Access layers) described in the Microsoft Patterns and Practices Application Architecture Guide. http://msdn.microsoft.com/en-us/library/ff650706.aspx Hopefully this isn't too open ended, but how would you recommend allowing for different business logic/rules for different customers? I'm aware of Windows Workflow Foundation, but from what I've read about it, it seems many business rules could be too complicated to handle there. Also, Can anyone point me to where I can download an example of a .net solution that is based on the Application Architecture Guide? I have already downloaded the Layered Architecture Solution Guidance and the Expense Sample on codeplex. I was looking for something a bit larger and more robust that I could step through the code and see how it works. If you feel there are better architectures to base our redesign on please feel free to share. I appreciate your help!


title: Is Domain Entity violating Single Responsibility Principle?

text: Single responsibility ( reason to change ) of an entity should be to uniquely identify itself, in other words, its responsibility is to be findable. Eric Evan's DDD book, pg. 93: > most basic responsibility of Entities is to establish continuity so that > behavior can be clear and predictable. They do this best if they are kept > spare. Rather than focusing on the attributes or even the behavior, strip > the Entity object's definition down to the most intrinsic characteristics, > particularly those that identify it or are commonly used to find or match > it. Add only behavior that is essential to the concept and attributes that > are required by that behavior. > > Beyond that, look to remove behavior and attributes into other objects > associated with the core Entity .Beyond identity issues, Entities tend to > fulfill their responsibilities by coordinating the operations of objects > they own. 1. > ... strip the ENTITY object's definition down to the most intrinsic > characteristics, particularly those that identify it or are commonly used to > find or match it. Add only behavior that is essential to the concept ... Once an _entity_ is assigned a _unique ID_ , its identity is established and so I would assume such an entity doesn't need any behavior to _maintain its identity_ or to _help it identify itself_. Thus, I don't understand what kind of behavior is author referring to ( besides `find` and `match` _operations_ ) with " _behavior that is essential to the concept_ "? 2. > ... strip the ENTITY object's definition down to the most intrinsic > characteristics, particularly those that identify it or are commonly used to > find or match it. ... Beyond that, look to remove behavior and attributes > into other objects associated with the core ENTITY. So any behavior that doesn't help identify the entity, but we'd still characterize that behavior as being an _intrinsic characteristic_ of that entity ( i.e. barking is intrinsic to dogs, flying is intrinsic to airplanes, laying eggs is intrinsic to birds ... ), should be put into other objects associated with that entity ( example: we should put barking behavior into an object associated with a dog entity )? 3. > Beyond that, look to remove behavior and attributes into other objects > associated with the core ENTITY. a) `MyEntity` delegates responsibilities `A_resp` and `B_resp` to objects `a` and `b`, respectively. Even though most of `A_resp` and `B_resp` work is done by `a` and `b` instances, clients are still served `A_resp` and `B_resp` through `MyEntity`, which means that from the client's perspective the two responsibilities belong to `MyEntity`. Thus, doesn't that mean `MyEntity` also has `A_resp` and `B_resp` responsibilities and as such is violating **SRP**? b) Even if we assume that `A_resp` and `B_resp` don't belong to `MyEntity`, `MyEntity` still has a responsibility `AB_resp` of coordinating the operations of objects `a` and `b`. So doesn't `MyEntity` violate **SRP** since at minimum it has _two responsibilities_ – to uniquely identify itself and also `AB_resp`?               class MyEntity     {         private A a = ...         private B b = ...                   public A GetA()         { ... }              public B GetB()         { ... }              /* coordinates operations of objects a and b */         public int AworkB()         { ... }     }          /* A encapsulates a single responsibility resp_A*/     /* A is value object */     class A     { ... }          /* B encapsulates a single responsibility resp_B*/     /* B is value object */     class B     { ... }      **UPDATE:** 1. > Behavior in this context is refering to semantic behavior. For example, a > Property on a class (i.e. attribute on a domain object) that is used to > uniquely identify it has a behavior. While this is not represented in code > directly. The expected behavior is that there will not be any duplicate > values for that property. So in code we would almost never need to actually implement a behavior ( i.e. an operation ) that would somehow maintain entity's identity, since as you explained such a behavior only exist as a concept in a domain model ( in the form of a ID attribute of an entity), but when we translate this ID attribute into code, part of its semantics is lost ( i.e. the part which implicitly makes sure the ID value is unique is lost )? 2. > Furthmore, a property such as Age has no context outside of a Person Entity, > and as such, makes no sense to move into a different object ... However that > information could easily be stored in a separate location that the unique > identifier, hence the confusing reference to behavior. Age could be a lazy > loaded value. a) If `Age` property is lazy loaded, then we may call it a behavior, even though semantically `Age` is just an attribute? 3. > You could easily have operations specific to Address such as verification > that it is a valid address. You may not know that at design time, but this > whole concept is to break down objects into their smallest parts While I agree that we'd lose context by moving `Age` into different object, the context wouldn't be lost if we moved `DateOfBirth` property into a different object, but we usually don't move it. What is the main reason that we'd move `Address` into another object, but not `DateOfBirth`? Because `DateOfBirth` is more intrinsic to `Person` entity or because there are less chances that somewhere in the future we may need to define operations specific to `DateOfBirth`? 4\. I must say I still don't know whether `MyEntity` also has `A_resp` and `B_resp` responsibilities and why `MyEntity` also having `AB_resp` isn't considered a violation of **SRP** **EULERFX** 1) > The behaviors that the author is referring to are behaviors associated with > the entity. These are the behaviors that modify the state of the entity a) If I understand you correctly, you're saying that _entity_ should only contain those _behaviors_ that modify its _attributes_ ( i.e. its _state_ )? b) And what about the _behaviors_ that don't necessarily modify the _state of the entity_ , but are still considered as being an _intrinsic_ characteristic of that _entity_ ( example: _barking_ would be _intrinsic_ characteristic of a `Dog` entity, even if it didn't modify _Dog's state_ )? Should we include these behaviors in an _entity_ or should they be moved to other objects? 2) > As far as moving behavior to other objects, the author is referring to value > objects specifically. Though my quote doesn't include it, but author does mention in the same paragraph that in some cases _behaviors_ ( and _attributes_ ) will also get moved into _other entities_ ( though I understand the benefits of moving _behaviors_ to VOs ) 3) Assuming `MyEntity` ( see question **3.** in my original post ) doesn't violate SRP, would we say that a _responsibility_ of `MyEntity` is among other things also comprised of: a. `A_resp` **+** `B_resp` **+** `AB_resp` ( `AB_resp` coordinates objects `a` and `b` ) or b. `AB_resp` **+** delegating `A_resp` and `B_resp` to objects ( `a` and `b` ) associated with `MyEntity`? 4) Eric Evan's DDD book, pg. 94: > CustomerID is the one and only identifier of the Customer ENTITY ( figure > 5.5 ), but phone number and address would often be used to find or match a > Customer. The name does not define a person's identity, but it is often used > as part of the means of determining it. > > In this example, the phone and address attributes moved into Customer, but > on a real project, that choice would depend on how the domain's customers > are typically matched or distinguished. For example, if a Customer has many > contact phone numbers for different purposes, then the phone number is not > associated with identity and should stay with the Sales Contact. a) > CustomerID is the one and only identifier of the Customer ENTITY ( figure > 5.5 ), but phone number and address would often be used to find or match a > Customer. The name does not define a person's identity, but it is often used > as part of the means of determining it. Quote states that only _attributes_ associated with _identity_ should stay in an _entity_. I assume author means that _entity_ should contain only those _attributes_ that are often used to _find or match_ this _entity_ , while ALL other _attributes_ should be moved? b) But how/where should other _attributes_ be moved? For example ( assumption here is that _address attribute_ isn't used to _find or match_ `Customer` and thus we want to move _address attribute_ out of `Customer` ): if instead of having `Customer.Address` ( of type `string` ) we create a property `Customer.Address` of type `Address`, did we move the _address attribute_ into an associated VO object ( which is of type `Address` ) or would we say that `Customer` still contains _address attribute_? c) > In this example, the phone and address attributes moved into Customer, but > on a real project, that choice would depend on how the domain's customers > are typically matched or distinguished. For example, if a Customer has many > contact phone numbers for different purposes, then the phone number is not > associated with identity and should stay with the Sales Contact. Isn't author in the wrong here, since if we assume each of the many _contact phone numbers_ that `Customer` has only belong to that particular `Customer`, then I'd say these _phone numbers_ are associated with _identity_ just as much as when `Customer` only had _one phone number_? 5) > The reason the author suggests stripping the entity down is that when one > initially creates a Customer entity, there is a tendency to populate it with > any attribute that one can think of being associated with a customer. This > is a data-centric approach that overlooks behaviors ultimately leading to an > anemic domain model. Off topic, but I thought _anemic domain model_ results from moving _behavior_ out of an _entity_ , while your example is populating an _entity_ with lots of _attributes_ , which would result in `Customer` having too much _behavior_ ( since we'd probably also include in `Customer` the _behaviors_ which modify these additional _attributes_ ) and thus in violation of SRP? thanks


title: How to negotiate with software vendors who do not follow HL7 standards

text: Take, for instance the "", I'd hope that anyone who has spent any time in dealing with HL7 messages knows that the "" signifies that something should be deleted. "" is not an empty string, it's not a filler etc... But occasionally, one may meet a vendor who persists in sending "" instead of just sending nothing at all. Since, I work for a small business and have an extremely flexible HL7 interface, I can ignore ""'s in received messages. But these things are adding up.   * Some vendors like to send custom formatted fields with psuedo-components that they leave others to interpret themselves.    * Some vendors send all their information in note segments and assume you're going to only show users the information they send in a monospace font.    * Some vendors even have the audacity to send Carriage Return Line Feeds at the end of each line of a file interface.    * Some vendors absolutely refuse to send decimal numbers and in-so-doing refuse to send any numbers. So, with all this crippling humanity against the simple plastic software man, how does one bend without breaking*? Or better yet, how does one fight back and still make money? *my answer is usually to create an interface for the interface and keep the HL7 processing pure, but I don't think this is the best solution


title: How can you tell good programmers from the average one?

text: > **Possible Duplicates:**   >  How do managers know if a person is a good or a bad programmer?   >  How to recognize a good programmer? For your record, I am a programmer myself, and I still do coding. We are not doing your-just-another-CRUD-app, instead we are working on CAD apps. The nature of software development makes it really hard to gauge a programmer's worth. How can you tell whether a programmer is good or not-so- good? All programmers who are working with me work on different parts of the applications, and how difficult it is to get those parts working is only known to the person who spend most time in it, in this case it's the programmers themselves; me as an outsider would not be able to fully appreciate the amount of sweat, ingenuity, effort they put in into solving those problems precisely because I don't have a chance to do the same job. This gives me a hard time when I evaluate them. How do I know programmer A is really great at solving the problem at hand and therefore I can throw him a bigger, harder task? And how do I know programmer B is just working hard, but not working smart? How can I evaluate and compensate programmers fairly?


title: How to recognize a good programmer?

text: Our company is looking for new programmers. And here comes the problem - there are many developers who look really great at the interview, seem to know the technology you need and have a good job background, but after two moths of work, you find out that they are not able to work in a team, writing some code takes them very long time, and moreover, the result is not as good as it should be. So, do you use any formalized tests (are there any?)? How do you recognize a good programmer - and a good person? Are there any simple 'good' questions that might reveal the future problems? ...or is it just about your 'feeling' about the person (ie., mainly your experience), and trying him out? Edit: According to Manoj's answer, here is the question related to the coding task at the job interview.


title: How to write efficient code despite heavy deadlines

text: I am working in an environment wherein we have many projects with strict deadlines on deliverables. We even talk directly to the clients so getting the jobs done and fast is a must. My issue is that i'd always write code for the first solution that comes to my mind, which of course I thought as best at that moment. It always ends up ugly though and i'd later realize that there are better ways to do it but can't afford to change due to time restrictions. Are there any tips by which I could make my code efficient yet deliver on time?


title: Allow threads (in c) to print messages without interfering with user input

text: I'm a writing a small webserver for personal use in c (not c++). I want to allow user input in the console like "shutdown server" or "restart server". In order to allow this kind of input the server is running in a seperate thread (pthreads), so the console isn't blocked. I also want this thread to print output in the console like "a new client connected" or "client requestet 'home.html'". > The problem is: If I'm typing something like "shutdown server" and at the > same time the thread prints something like "a new client connected" > everthing mixes up and I get something like "shuta new client connectedown > server" Is there an elegant way to print the output of the thread and at the same time allow the user to enter commands without both interfering? Or is this a stupid idea to begin with? If yes: Is there a standard way to handle things like that (i.e. to control server).


title: Why is test driven development missing from Joel's Test?

text: I was reading this blog by Joel Spolsky about 12 steps to better code. The absence of _Test Driven Development_ really surprised me. So I want to throw the question to the Gurus. Is TDD not really worth the effort?


title: What methods were used for online payments before API's and Paypal, etc

text: What methods (in programming/web dev terms) were used to take payments online before such things as Paypal, Google Checkout and various gateways and API's. How were such transactions carried out?


title: Command pattern design

text: I have this old implementation of the Command pattern. It is kind of passing a Context through all the _DIOperation_ implementation, but I realized later on, in the process of learning and learning (that never stops), that is not optimal. I also think that the "visiting" here doesn't really fit and just confuses. I am actually thinking of refactoring my code, also because a Command should know nothing about the others and at the moment they all share the same key- value pairs. It is really hard to maintain which class owns which key-value, sometimes leading to duplicate variables. An Example of use case: let's say **_CommandB_** requires **_UserName_** which is set by **_CommandA_**. Should CommandA set the key **_UserNameForCommandB_** = _John_? Or should they share a common _UserName=John_ key-value? What if the UserName is used by a third Command? How can I improve this design? Thanks!               class DIParameters {     public:        /**         * Parameter setter.         */         virtual void setParameter(std::string key, std::string value) = 0;         /**         * Parameter getter.         */         virtual std::string getParameter(std::string key) const = 0;              virtual ~DIParameters() = 0;     };          class DIOperation {     public:         /**          * Visit before performing execution.          */         virtual void visitBefore(DIParameters& visitee) = 0;         /**          * Perform.          */         virtual int perform() = 0;         /**          * Visit after performing execution.          */         virtual void visitAfter(DIParameters& visitee) = 0;              virtual ~DIOperation() = 0;     };


title: Contributor's actions after rejected pull request

text: Imagine, there is an open-source project with a Maintainer and a Contributor. Both of them have theirs repos exported to some repository hosting (github, bitbucket, sourceforge --- whatever, but they are public). Imagine further, Contributor did several commits, pushed them into his repo and sent pull-request to the Maintainer. Maintainer did review, made several comments about commits (fix this, fix that, simplify there, blah-blah-blah) and **rejected** the pull-request. Note:   1. For Contributor it's obvious that it's better to just fix patches/commits than rewriting from scratch.    2. Please consider situation, when there are many commits and fixes have to be scattered between them. What should Contributor do in this situation before making next pull-request? Remove invalid repo, rewrite history and push new one? Make a fix commit into current one? May Maintainer demand, that incoming history should be clean? I.e. is it technically simple enough to do?


title: Listing dependencies in the package.json for a node.js app on Heroku

text: I previously had an issue with my node.js app on Heroku. I added the dependency into my package.json and now it is working. But, is this the best way to do it?               {       "name": "application-name",       "version": "0.0.1",       "private": true,       "scripts": {         "start": "node app.js"       },       "dependencies": {         "express": "3.4.4",         "jade": "*",         "stylus": "*",         "ejs": "0.8.5"       },       "engines": {         "node": "0.10.1",         "npm": "1.3.14"       }     }      I ask because the other dependencies have a "*" which were there by default in my express app. What exactly does that mean and am I fine with leaving this file the way it is?


title: What is meant by a step-by-step refactoring plan describing implementation of design

text: > What is meant by a step-by-step refactoring plan describing how to implement > a certain design? As little as I know about refactoring it regards improving a (UML) design model and has nothing to do with the implementation of it. Therefore I'm pretty much confused by what this question means. Does anyone know and willing to explain? EDIT: In the context the design corresponds to a UML diagram with classes, methods and underlying associations.


title: Java Compiler and VM Compatibility

text: A co-worker and I recently had a discussion about Java versions and the JVM. I use Java 7 but we use Java 6 for our client (while he says that some are still on 5). My immediate thought was, why can't we target those VMs too? The Java VM is somewhat different than a real machine in that it has a bunch of runtime features. Type checking, exception handling, garbage collection, etc. But it's still a virtual machine which has a bytecode. (Which is why we can have things like C to JVM compilers.) So why can't we target older VMs with newer version of Java? Why does the language and the runtime have to be tied together? Besides the obvious performance penalties, it seems like it should be completely possible to compile Java 7 code to the Java 6 JVM. (And considering how little changed from Java 6 to 7, I can't imagine the compiler changes being that extensive.)


title: How to describe framework/features of a java application for client presentation?

text: I have been asked to put down the architecture and features of our Java application (more from infrastructure/software point of view). It will go on a Powerpoint presentation, so I need to provide the list. Please let me know how do I go about this.


title: Can daily reports decrease a developer's productivity?

text: In another question, I asked about why developers might don't like **daily scrum**. We talked to developers and we decided to not hold daily scrum for a while (to give it a try and customized scrum in our first attempt). This is the output of consulting with developers directly. On the other hand, we don't want to lose good parts of daily scrum, like getting a chance to coordinate developers everyday, or watching the work progress like a Key Performance Indicator, to take actions early. As an alternative to daily scrum, we're thinking about asking developers to provide daily reports with the following conditions:   1. No need to follow any specific format. Each and every format is accepted.   2. Even if the work is not done, we want to hear the amount of progress.   3. There is no need to mention the time spent on each task.   4. Development obstacles and coordination requirements should be mentioned.   5. There is no need to be obsessed with daily reports. It's not taken that strict. Do you think that this can decrease their productivity? Have you had any daily report experience? Do you have any suggestion for us, so that we can get sure that we're not micromanaging?


title: Is there ever a situation where it's ok to initiate a Delete on a GET?

text: When building a simple web app with database delete functionality, you normally would take the following steps:   1. User initiates a GET request using a delete link   2. User confirms the deletion   3. Upon confirmation, browser initiates a POST request to the server to perform the deletion What are the reasons for this convention? I understand that it sets up a confirmation step which would prevent automated calling of the delete function (as with spiders and such) - are there other reasons?


title: Ur/Web new purely functional language for web programming?

text: I came across the Ur/Web project during my search for web frameworks for Haskell-like languages. It looks like a very interesting project done by one person. Basically, it is a domain-specific purely functional language for web programming, taking the best of ML and Haskell. The syntax is ML, but there are type classes and monad from Haskell, and it's strictly evaluated. Server- side is compiled to native code, client to Javascript. See the slides and FAQ page for other advertised advantages. Looking at the demos and their source code, I think the project is very promising. The latest version is something 20110123, so it seems to be under active development at this time. My question: Has anybody here had any further experience with it? Are there problems/annoyances compared to Haskell, apart from ML's slightly more verbose syntax? Even if it's not well known yet, I hope more people will know of it. OMG this looks very cool to me. I don't want this project to die!!


title: API design with references to root object

text: [Normally I post on StackOverflow but as this is more a design/theory question rather than a code question I'll give it a shot here] Most of my applications currently use a core object model that I originally wrote 6 years ago and which has just grown as needed - as with most of my stuff, it was coded as is, without thinking up a design first. Part of it is too inflexible, part is poorly designed and yet more is clunky. So I decided to start again from scratch rather than trying to retrofit a new API on top of the existing one. And I also decided to actually map out the full API first upfront, then write the code for it. So far that approach is paying off I suppose and I have a nice little model brewing. However, I have one quandary in the new design. If you consider the automation models offered by things like Microsoft Word, most primary objects have a property named `Application` which points back to a core object. My existing object model follows pretty much the same principle and I am using that in the new one too. The current API however has a mix of approaches. Some objects store a reference to that root object. Others don't, and the property simply looks at a singleton "service" object, which at it's heart has a `ServiceContainer` to look up registered objects. Yes, a service locator. Some get it passed in through a constructor, others look it up _then_ store a reference. I normally like consistency, but this is a mess. My new design isn't changing this approach - objects still will have a property back the the root object with the idea being all the objects behave the same and I don't have to (manually) go hunting for an application when writing code for a given implementation. With that background information out of the way, here's my question. Should each object hold a reference to the root object, or should it not store a direct reference, but look it up somehow, ie from a singleton or a service locator. With the former approach, I'm going to use more memory - 4 bytes extra per object per object as I currently compiled everything as 32bit. While that doesn't sound a lot and I'm sure I'm not going to be creating many thousands of objects I sort of want the base API to be as efficient as possible as no doubt the apps I stick on top of it won't be! This approach also means I'm going to have to pass that object reference around in every single constructor, not much of a problem for real code but makes writing tests a bit more complicated. The latter approach means I save memory, but then I continue to use the bad practice of a service locator, and I supposed there's a at least the hint of a performance issue as having to lookup a reference isn't quite going to be as quick as returning a direct one. Or, is there another approach that large object models use that I haven't considered above? As mentioned I normally just dive in, make something that works then leave it alone until it breaks or I need it to do something else. I'm guessing the answer is going to be "just store the reference and stop complaining" but better to get a feel for other peoples opinions!


title: Development console commands registration

text: I have a DevelopmentConsole class. I am making functionality to register console commands for the subsystems. I don't want the console to know about them but also I don't want them to contain a debug code (like "Console.RegisterCommand..."). I think I should make an additional class hiearachy. For an example I have Player class.               IConsoleBuilder {          RegisterCommand(string command, Func<string[], string> action);      }          PlayerConsoleBuilderClient : ConsoleBuilderClient {          readonly Player _player =  ?inject?              public override void Visit(IConsoleBuilder builder) {              // builder.RegisterCommand("GetName", args => _player.Name) ;          }     }      Here I need to use Reflection to find all ConsoleBuilderClient subclasses. It's not a very good idea, is it? Can you suggest how to do it in a better way?


title: software developer designation related

text: What does designation "Associate software developer Grade 10" means? A company mention it in his offer letter. Here two words are confusing first "associate" and second "GRADE 10".


title: Replacing out parameters with struct

text: I'm encountering a lot of methods in my project that have a bunch of out parameters embedded in them and its making it cumbersome to call the methods as I have to start declaring the variables before calling the methods. As such, I would like to refactor the code to return a struct instead and was wondering if this is a good idea. One of the examples from an interface:               void CalculateFinancialReturnTotals(FinancialReturn fr, out decimal expenses, out decimal revenue, out decimal levyA, out decimal levyB, out decimal profit, out decimal turnover, out string message)      and if I was to refactor that, i would be putting all the out parameters in the struct such that the method signature is much simpler as below.               [structName] CalculateFinancialReturnTotals(FinancialReturn fr);      Please advise.


title: Can I use Apache Software License, Version 2.0 and GNU LGPL 3 licence plugins in my commercial web application?

text: I have two plug-ins. One has the GNU LGPL 3 license and the other has the Apache Software License, Version 2.0. Can I use them in my commercial app? And if yes, what precautions should I take?


title: What's the "normal" range for typing speed for developers?

text: Clearly, two finger typing is probably a sign the developer needs work to speed up his typing (or is lying about his experience as a developer), and 60+ WPM is more than sufficient. Has anyone studied this, though? How fast do developers type, on average, and what's the "normal" range of typing speeds?


title: How reduce the usage of Magic Strings?

text: In the application database there is a configuration table with this schema: Table: ReleaseProperty   1. ReleasePropertyID   2. ReleaseID   3. Name   4. Value Currently to retrieve a specific property I pass to the Repository class the arguments ReleaseID (that come from the current web page address) and a Name, that is basically hard coded E.g.               var property = ReleasePropertyRepository.Select(ReleaseID, "MyProperty");      I don't like to use hard coded strings around my code, and the only idea to improve the quality of this code is to use a container class for constants.               var property = ReleasePropertyRepository.Select(ReleaseID, Constants.MyProperty);      Is there any other way to develop a better code?


title: What could be a good thesis topic for software and business?

text: For my business studies, I need to explore the financial side of software engineering projects, but I am rather a technical person myself. What would be good place to start? What are the important financials (net-present-value does this make sense for software?) or performance-indicators of "good" software projects? What type of person in an organization I should contact? Thanks for any help.


title: Web-services REST security clarification

text: I'm newbie of web services programming and I have some problem to understand how to work authentication/security for REST WS pattern. I had read about OAuth but I haven't understand how it work in detail, however I think I don't need it because only my app use the API. I need authenticate the users that need to use the "privates" APIs, can you explain me the correct way for implement a REST WS authentication, or give me a good guide or flowchart?


title: In BDD, going from feature to user story how does it works?

text: My background is the book BDD in action. How one goes from Feature to Stories? More specifically I would like to understand the following: 1- When does one provide the decomposition into stories? Do you do it while spotting the examples that illustrate your feature ? 2 - If so how do you proceed in your development then: Do you first start to on work on the stories while leaving your feature pending ? Do you right the feature scenario first and then, move on the stories that comes out of it, while leaving the feature test pending ? The key here is the process, if i do a decomposition of a feature into stories, before writing my actual scenario that spot those stories, i might be writing stories that are not relevant to the feature isn't it? This though make me think that stories must be fleshed out in the same way as unit test/integration test are fleshed out of a user stories? However if one does that well it is difficult to plan a feature for scrum iteration. I understand that it is just a planning tool, but it would be interesting to understand how this planning is actually used in the context of dealing with a feature. I believe one should not do too much upfront planning, not commit to things without being sure, but in the mean time, it seem to me that the decomposition into the different process (stories) involve into the feature process requires some upfront planning. I would appreciate a clarification on that point.


title: What are graphs in laymen's terms

text: What are graphs, in computer science, and what are they used for? In laymen's terms preferably. I have read the definition on Wikipedia: > In computer science, a graph is an abstract data type that is meant to > implement the graph and hypergraph concepts from mathematics. > > A graph data structure consists of a finite (and possibly mutable) set of > ordered pairs, called edges or arcs, of certain entities called nodes or > vertices. As in mathematics, an edge (x,y) is said to point or go from x to > y. The nodes may be part of the graph structure, or may be external entities > represented by integer indices or references. but I'm looking for a less formal, easier to understand definition.


title: Best practices for logging user actions in production

text: I was planning on logging a lot of different stuff in my production environment, things like when a user:   * Logs In, Logs Off   * Change Profile   * Edit Account settings   * Change password ... etc Is this a good practice to do on a production enviornment? Also what is a good way to log all this. I am currently using the following code block to log to:               public void LogMessageToFile(string msg)             {                      System.IO.StreamWriter sw = System.IO.File.AppendText(                     GetTempPath() + @"MyLogFile.txt");                 try                 {                     string logLine = System.String.Format(                         "{0:G}: {1}.", System.DateTime.Now, msg);                     sw.WriteLine(logLine);                 }                 finally                 {                     sw.Close();                 }             }      Will this be ok for production? My application is very new so im not expecting millions of users right away or anything, looking for the best practices to keeping track of actions on a website or if its even best practice to.


title: How do I transition from a large enterprise to a small startup?

text: I am shortly going to move from a large, multinational, enterprise software house to a start up where I will be the only full time developer. I've worked in start ups and in companies where there have been only three or four devs before so I'm fairly happy with many of the differences in general company feel. But having never worked as a sole dev there a couple things I've got used to in a large company that I think will take more adjustment. And was wondering if there was any advice on how to manage them?


title: Books on improving JEE web application performance and responsiveness

text: Does anyone know of any good books on this topic? I did search on amazon but ones that I found are pretty old publications.


title: Best industry to work for as a developer

text: My contract has just ended and I'm wondering what possible jobs I might want to look at next. I've worked in banking and insurance industry for all my career (including one Fortune 500 company) and in my experience banking is the slowest (and most boring) industry to work for due to their strict business practices (which is fair enough). The upside is that they pay well. ### My questions are:   * What are the best and worst industries for developers to work in? That is, in the industries you have worked in, what was good and bad from a developer perspective (money, work, culture, benefits, colleagues, etc.)?    * How does working as a consultant affect your opinion of an industry?   * Seeing that I've mentioned boredom, which industry supports fast growth?


title: Tips/tricks to manage a new team with new code

text: How do you handle yourself in a new team where you are the senior most developer and most others in the team are junior to you by several years. The task ahead of the team is something nobody else including you has accomplished in their career before. Management insists on higher productivity of the whole team, and as senior developer you are responsible. Any tips for coming out trumps in a situation like this? Clearly, the entire team needs time to learn and let's not forget the team's new. However, deadlines are up ahead as well...


title: Best Usage of Multiple Computers For a Developer

text: I have two Macbook Pros - both are comparable in hardware. One is a 17" and the other a 15". The 17" has a slightly swifter CPU clock speed, but beyond that the differences are completely negligible. I tried a setup a while back where I had the 17" hooked up to an external monitor in the middle of my desk with the 15" laptop immediately to the right of it, and was using teleport to control the 15" from my 17". All development, terminal usage, etc. etc. was being done on the 17" and the 15" was primarily used for email / IM / IRC... or anything secondary to what I was working on. I have a MobileMe account so preferences were synced, but otherwise I didn't really use anything else to keep the computers in sync (I use dropbox/git but probably not optimally). For reasons I can't put my finger on, this setup never felt quite right. A few things that irked me was   * the 15" was way under-utlized and the 17" was overutilized    * having 2 laptops and a 21" monitor all on one desk actually took up lots of desk space and it felt like I had too much to look at. I reverted back to just using the 17" and the external monitor and keeping the 15" around the house (and using it _very_ sparingly). For those of you who are using multiple laptops (or just multiple machines for that matter), I'd like to see setups that work for you for when you have 2 or more machines that gives you optimal productivity and why. I'd like to give this one more shot but with a different approach than my previous - which was using the 15" as a machine for secondary things (communication, reading documentation, etc. etc).


title: Apple Dispatch Queue vs Threads

text: I've heard a lot about apple's famous dispatch queues and the **GCD** but today was the first time I decided to understand exactly what is going on, so I started reading Concurrency Programming Guide and this paragraph caught my eye. > If you have two tasks that access the same shared resource but run on > different threads, either thread could modify the resource first and you > would need to use a lock to ensure that both tasks did not modify that > resource at the same time. With dispatch queues, you could add both tasks to > a serial dispatch queue to ensure that only one task modified the resource > at any given time. This type of queue-based synchronization is more > efficient than locks because locks always require an expensive kernel trap > in both the contested and uncontested cases, whereas a dispatch queue works > primarily in your application’s process space and only calls down to the > kernel when absolutely necessary. What I understand is that they are suggesting executing two tasks serially to avoid use of locks, which can be done the same way in threads. For example in Java you can put two functions in your thread's runnable and the thread will execute them serially and you will not need locks in that case two. Now my question is that am I missing something ?


title: New to programming. How do I meet people to expand my programming knowledge and discourse?

text: I've been a tinkerer of tech and programming, but books and online resources only go so far. I want a community to engage in discussions about programming to take me beyond what books can give (also, often just to explain what the books are trying to convey). No one in my daily life is very tech-inclined in the slightest, so where do I go? Are online communities enough for you programmers out there? If not, where do you go, or recommend going? (specifically, I'm interested in C++, Linux, Python, & Objective-C, but that may not apply to the question)


title: Python is slowly replacing C in universities. Does this move degrade the quality of CS students?

text: I believe learning C is one of the most important aspects for any programmer. It's a beautiful combination of a high and low level language. Some universities are moving to stop teaching C in the introductory stages and are using Python instead. Will this move to Python, from C, degrade the quality of CS students? If you miss out on some of the aspects of a low level language, are you missing something important from you CS degree?


title: When to use identity comparison instead of equals?

text: I wonder why would anybody want to use identity comparison for fields in `equals`, like here (Java syntax):               class C {         private A a;              public boolean equals(Object other) {             // standard boring prelude             if (other==this) return true;             if (other==null) return false;             if (other.getClass() != this.getClass()) return false;             C c = (C) other;                  // the relevant part             if (c.a != this.a) return false;                  // more tests... and then             return true;         }              // getter, setters, hashCode, ...     }      Using `==` is a bit faster than `equals` and a bit shorter (due to no need for null tests), too, but in what cases (if any) you'd say it's really better **to use`==` for fields inside `equals`**?


title: How often is seq used in Haskell production code?

text: I have some experience writing small tools in Haskell and I find it very intuitive to use, especially for writing filters (using `interact`) that process their standard input and pipe it to standard output. Recently I tried to use one such filter on a file that was about 10 times larger than usual and I got a `Stack space overflow` error. After doing some reading (e.g. here and here) I have identified two guidelines to save stack space (experienced Haskellers, please correct me if I write something that is not correct):   1. Avoid recursive function calls that are not tail-recursive (this is valid for all functional languages that support tail-call optimization).   2. Introduce `seq` to force early evaluation of sub-expressions so that expressions do not grow too large before they are reduced (this is specific to Haskell, or at least to languages using lazy evaluation). After introducing five or six `seq` calls in my code my tool runs smoothly again (also on the larger data). However, I find the original code was a bit more readable. Since I am not an experienced Haskell programmer I wanted to ask if introducing `seq` in this way is a common practice, and how often one will normally see `seq` in Haskell production code. Or are there any techniques that allow to avoid using `seq` too often and still use little stack space?


title: What is the most efficient way to study multiple languages, frameworks, and APIs as a developer?

text: I know there are those out there who have read a slurry of books on a specific technology and only code in that one particular language, but this question is aimed at those who need bounce around between using multiple technologies and yet still manage to be productive. What is the most efficient way to study multiple languages, frameworks, and APIs as a developer without becoming a cheap swiss army knife? And how much time should one dedicate to a particular subject before moving to another?


title: Is it wrong to use Agile when clients' requirements don't change at all?

text: I have seen a lot of posts recently saying that one of the major reasons why Agile is used is because clients often change the requirements. However, let's say the clients **do not change the requirements often**. In fact, the clients have firm requirements though might be a bit vague (but nothing unreasonably vague), but I use Agile anyway. The reason why I employ Agile is because the software is complex enough that there are details, problems that I wouldn't recognize until I actually face them. I could do a full scale heavy planning approach like waterfall, but then it would take a few months to finalize all the high level design and low level coding signatures. There is a very specific, fixed architectural design for the system though. My question is: Would this be considered as bad, cowboy coding, anti-pattern, etc..? Must we employ waterfall and plan as much as possible in great details before we start coding **when requirements are stable** instead of this 'let's do it' mentality in Agile? EDIT: The major point here is that: we CANNOT blame the clients for changing requirements. Assume the clients pointed us to a very concrete problem, give us a wish list in very reasonable details and leave us alone (ie the clients have their own productive things to do, don't bug them any more. Only demo to them near the end when you have a minimum working prototype). Would it be wrong to use Agile in this scenario?


title: Using a Proxy as an ACL

text: I am building an MVC application in PHP, using Zend Framework. My model includes Domain Model and Mapper layers. I am trying to keep the domain model in pristine condition and have managed to keep it free from persistence-related code. Now I am trying to find a solution for ACL. I have 'general' ACL rules that can be easily enforced in a service layer, but I also have some very fine grained rules. The fine grained rules apply at the property level and affect whether the current user can alter a field, and if so, what the range of allowable values is. Currently I am thinking of using the proxy pattern, and that the proxy should extend the real object (to save me having to redirect 100% of calls). Does this sound reasonable? Is there a better option?


title: Getting help in programming while holding the reins tightly

text: I am starting an Internet business. Basically the most important part, the part that is making me actual money is still missing. I tried to deal with those issues several times but I always get distracted by other things. This is a typical example of not rising to a challenge. I thought about hiring a programmer to continue my coding but I came up with two problems:   1. When revealing my current code the programmer could just run the business on his own. How do I choose someone who won't do that?   2. Which way of payment is appropriate for the programmer in this situation? Per hour? How do I figure out the right amount? The code to be written will be in PHP + MySQL.


title: Is WCF strictly an asynchonous comms platform?

text: Since I last had to do any comms/network programming, the field has exploded with acronyms. In fact, networking almost feels like it is now described by a whole new language. The very name "Windows Communication Foundation" suggests it should be all things to all people... but I need to be sure I can program up some synchronous real-time* comms on a dedicated gigabit ethernet network. Can someone confirm that WCF is not a starter for this task... or if it is, which of the many confusing acronyms I should get familiar with? * By real-time, I mean I need to reduce latencies down to an acceptably low level. For our application, which involves transmitting results of video & audio analyses continuously every few milliseconds, I need to ensure 99% or better of those analyses are presented at the UI within (ideally) 0.5 seconds so that the user has time to respond before the originating network node deletes data out of its buffer to make way for subsequent analyses.


title: Combine Data from Two Tables-Help Needed

text: I have developed a web site with a mysql backend, but am not satisfied with how I am getting one set of data and do not know how to get another dataset. The page in question is at: http://whistclub.org/test/ajax.php?vichill/results/1 The results are shown through October so there is some data to use. I am pulling the results from two mysql tables (see below), but the code I have used is too ugly for me to tolerate. Yeah, it works, but I have some standards! Think calls to the database for each team. I think joins should be used, but I can't get it to work.   Ideally (I think) the result array would convert the teamIDs to team names and use names for the winner and loser VP columns. The standings table on the page is not working at all--what you see is hand coded just to show what is needed. The tables are:               teams:          id--autoincremented     teamID--Asssigned to each team as part of the game     teamName          games:          id--autoincremented     gameID--I suspect this is not needed since it duplicates id.     teamA     teamB      date     winner     IMPmargin     winnersVPs     losersVPS      The game is bridge and IMP and VP are scores. VPs are derived from IMPs and the loser often gets a few VPs. See the webpage for the details, but I do not think that is relevant to my issue. Here is some data from the games table:               id  gameID  teamA  teamB  date        winner  IMPmargin  winnersVPs  losersVPs     1   1       11     18     2013-09-25  18      12         20          10     2   2       12     17     2013-09-25  12      22         22          8     3   3       13     16     2013-09-25  13      20         21          9     4   4       14     15     2013-09-25  14      0          15          15     5   5       19     99     2013-09-25  NULL    NULL       NULL        NULL      Team 99 is a dummy for a bye week for a team. If the tables are designed too badly, let me know how to make them work better. Hopefully, that is enough for someone to point me in the right direction.