Reducing Coupling in a Series of Tasks

I am working on some code right now that involves processing user requests. Each request requires going through an approval. When a request is made, one or more records are created on the database recording what the request entails. Then a ticket is created and placed on the approver's work queue. For a typical request, approving it involves these steps:   1. The request is processed (usually resulting in a table getting updated)   2. The changes are recorded to a history table (record auditing).   3. The request is marked as approved by the approver (approval auditing).   4. The ticket is removed from the work queue.   5. The original requester is sent an email telling them their request was approved. We have a single class that kicks off these steps sequentially within a transaction (http://martinfowler.com/eaaCatalog/transactionScript.html). For the most part, the sequence doesn't really matter and the email isn't really essential. The problem is each of these classes has at least 5+ dependencies (in reality, it's closer to 10+). I am stumped about how to reduce the number of dependencies when it comes to a workflow like this. I thought about grouping some of these items together, but there's no logical grouping. I don't see much of a point in creating an unnecessary layer like that, anyway. I also thought about doing some kind of observer pattern (.NET events). A class higher up could listen for the event, instantiate the needed classes and kick them off. However, that "higher-up class" would then be dependent on all of the classes again, so I'd be right back in the same situation. So, the only ways I've been able to think of reducing the number of dependencies is to either do artificial grouping of classes or to just make it the layer above's problem. Neither seem ideal and I wonder if I am missing something. If it helps, I am using Ninject with ASP.NET MVC. I have access to an IOC container (`DependencyResolver`). I am wondering if the solution is some sort of combination between using listeners/events and an IOC container.


How to become a passionate programmer?

I want to know how to be a `passionate programmer`? What are the things that `someone has to be focus to be a good programmer`?


Cloning existing software for commercial purposes - legal implications

I have been asked to clone some existing software for a company. Basically its an old 16 bit DOS console app, which was supplied free of charge in I believe the late 80's. Having replaced the machine that needs to run it with a box running Win7 x64 they can't get it to work. It crashes every couple of minutes under DOSbox. The company that supplied it appears to no longer exist - if they did the company asking me to do this would almost certainly know about it. Its undetermined whether they have gone entirely or are just trading under a different name. If the latter they seem to have withdrawn from the market related to this product (because again, niche area, we **should** know about everyone there). What is the status to this with regards to copyright etc.? The main concern for the company involved is they want an identical interface to what they already have so I would have to clone this entirely. Having no source code / indication of the underlying mechanisms these would be written from scratch. Is an interface covered by copyright? / Does that still hold 30 years later? What is the assumed license when none at all is provided? Under UK law would I be under any serious risk were I to take on the project? How would this pan out if I then decided to sell the software on to other companies? Thanks


Where does my database schema live in MVC?

I'm starting to check in the SQL files for creating/maintaining our database. Previously SQL files were kept totally separate from our codebase's version control. I'd like to pragmatically store my database construction/manipulation files with my other code. Do they make the most sense in a subdirectory of my Models or as a separate directory somewhere? For the most part the SQL statements _are_ the data my Models access, but some other stuff is maintenance scripts ect; stuff that doesn't pragmatically fit into my MVC folder structure.


Should I include dependencies for which I have the source as projects in my solution?

We have various projects in source control for web and desktop applications. Invariably, many of them use third-party open source projects or even common libraries within our organization as dependencies. Should we include the full projects of these dependencies in our various solutions? Or should we just include the .dll reference (or equivalent compiled binary) and maintain the source for said dependency elsewhere (say, for debugging purposes only)? I'm specifically thinking of .NET projects and solutions in Visual Studio, but feel free to replace those terms with JAR or whatever equivalent in other languages and frameworks. To further specify, I'm asking if a [fictional] Invoice Payments Web App solution tree should look like this:   * InvoicePaymentsWeb   * InvoicePaymentsDataModel   * InvoicePaymentsServices   * RickSoftUltraDataGrid   * MyCompanyCommonWebLib And you could individually compile (or change) the various dependencies since they exist entirely within your solution. As opposed to just having the first three projects, referencing the compiled DLLs of the other two, and having the source for the other two exist elsewhere on your machine (or elsewhere in source control). I'm wondering if this wouldn't potentially fracture the development and/or maintenance of the various dependencies since each solution could have its own specific changes to the source, unless the underlying source control handled sharing the projects internally. What other problems might exist? Would there be any benefit?


What's the worst question you were ever asked at interview?

It doesn't have to be programming or software development related, but just asked during an interview for an IT related job. I know some "left field" questions are meant to see how the candidate copes with unexpected and novel situations, but here I'm looking for a question that appeared to be completely unrelated to the job they were interviewing you for, or something that made you think "what useful information could they possibly get from my answer to _that_ question?".


Interface at the class or function level?

I have been falling into a pattern lately where I have been defining routines that rely on an interface defined by a function that is specified as a parameter to the routine. (The language is C#, but this can be applied to any language with first-class functions.) For example, I have an API that exposes CRUD operations against a backing store. In the case of a GET operation on a particular resource, I can generalize the routine into:   * get the resource we are looking for      * return a not found response if resource does not exist     * return the resource if found What I ended up doing is defining a routine that accepts a delegate function for finding the resource. It's this delegate that defines the interface contract. This happens to work well for my situation because the information required to locate the resource can vary. In my case, it's looking up data in a database by keys, but the type and number of keys can vary. I can capture these in a closure in the calling routine and satisfy the delegate function interface. For example:               // Locate a simple record that only has one key     public SimpleRecord GetSimpleRecord(int recordID) {        return getResource(repository => repository.SimpleRecords.Find(recordID));     }          // Locate a complex record that has many keys     public ComplexRecord GetComplexRecord(int recordID, int userID, string token) {        return getResource(repository => repository.ComplexRecords.Find(recordID, userID, token));     }      This work, but seems like is a mix of OOP and functional style programming. If I need more than one delegate passed, it starts to get a bit messy. Some routines that I need everywhere I ended up defining as abstract methods that all sub-classes need to implement. So I have a hybrid. Does this type of technique have a name or pattern that I'm missing? Should the delegates be implemented in a defined class interface that gets passed to the caller? **UPDATE** with more concrete example: I'm trying to adhere to the DRY principal. I'm talking about controllers in a C# Web API application. Each and every request has some commonality which I have implemented in a base controller class:   * Handle all exceptions by returning the correct HTTP status code, (404 for resources that are not found, 201 for created resources, etc.)   * Map database entities to-and-from data transport objects that the client deals with I want to express _what_ to do in this base class, and delegate _how_ to the concreate class. The _how_ ends up being implemented by delegate functions. I may need to get a person from the database, by first name and last name, or a purchase order, by an integer id. In both cases, if the resource is not found, a 404 must be returned. One returns a person, one a purchase order. How to look them up and how to map the data to a client object differs. The base function may look like this:               T getResource<T> (Func<IRepository, T> find) {         T data = find(getRepository());         if (data == null) {             throw new DataNotFoundException();         }         return data;     }      Now, in the person controller and purchase order controller, I don't have to repeat the logic of what do to when the resource is not found--just implement the find delegate. (This is a simple example without mapping, adding, removing or other details that differ resource to resource).               public Person Get(string first, string last) {        return getResource<Person>(repository => repository.People.Find(first, last));     }          public PurchaseOrder Get(int id) {        return getResource<PurchaseOrder>(repository => repository.POs.Find(id));     }      Note how the closures above neatly deal with varying number and types of parameters for finding things, but satisfy the interface defined by the delegate find function. Is this possible to do with standard class interfaces? (And this question is not about the repository. That is resolved with dependency injection and is implemented with Entity Framework.)


How can I make my PHP development environment more efficient?

I want to start a home-brew pet project in PHP. I've spent some time in my life developing in PHP and I've always felt it was hard to organize the development environment efficiently. In my previous PHP work, I've used a windows desktop machine and a linux server for development. This configuration had it's advantages: it's easy to configure Apache (and it's modules)/PHP/MySql on a linux box, and, at the time, this configuration was the same like on production server. However, I never successfully set up a debug connection between my Eclipse install and X-debug on server. Transferring files from my local workspace to the server was also very annoying (either ftp or Bazaar script moving files from repository to web root). For my new setup, I'm considering installing everything on my local machine. I'm afraid that it will slow down workstation performance (LAMP + Eclipse), and that compatibility problems will kick-in. What would you recommend? Should I develop using two separate machines? On one? Do you have experience using one of above configurations in your work?


Using default parameters for 404 error (PHP with mvc design)?

I have a custom made Framework (written in PHP). It all works very good, but i have some doubts about a certain thing. Right now when a user call this url for example:               http://host.com/user/edit/12      Which would resolve to:   * user = userController   * edit = editAction() in userController   * 12 = treated as a param But suppose the controller 'userController' doesn't exist. Then i could throw a 404. But on the other hand, the url could also be used as params for the indexController (which is the default controller). So in that case:   * controller = indexController   * user = could be an action in indexController, otherwise treated as a param   * edit = treated as a param   * 12 = treated as a param That is actually how it works right now in my framework. So basically, i never throw a 404. I could ofcourse say that only params can be given if the controller name is explicitly named in the URL. So if i want the above url:               http://host.com/user/edit/12      To be invoked by the indexController, in the indexAction. Then i specifically have to tell what controller and action it uses in the URL. So the URL should become:               http://host.com/index/index/user/edit/12        * index = indexController   * index (2nd one) = the action method   * user = treated as a param   * edit = treated as a param   * 12 = treated as a param That way, when a controller doesn't exist, i don't reroute everything as a param to the index controller and simply throw a 404 error. Now my question is, which one is more preffered? Should i allow both options to be configurable in a config file? Or should i always use one of them. Simply because that's the only and best way to do it?


What drawbacks does Java Swing GUI framework have?

I have used Java Swing for some desktop applications. But I haven't used other GUI frameworks that much so I can't compare them. There is definitely some things that I like with Swing and some that I don't like, but that is the situation with almost everything. What are the biggest drawbacks with the Java Swing GUI framework?


How to compute a signature of a matrix

We know some signature/checksum methods for text, like md5,sha. Now, I want to compute a checksum for a matrix, to represent the exact matrix. Say, two matrixes with different sizes, or with different values, have different checksum. And slightly different matrixes(same size) result in slightly different checksum. So, both layout and values should be considered. Although the most intuitive method is to compare two matrixes directly, however, sometimes it's inconvenient to get the two matrixes in the same environment. Maybe I should check the md5 algorithm, and adapt a similar method. Just post it here for better advices.


Is licensing required for public repositories?

I am planning to start the public repository on github. In this repository I will be sharing code which I will be posting in my blog. I have seen lot of repositories without any license. Is it required to have a license file? Can't I just say "You're free to use this code in whatever way you need"? Please advise


What is Object Oriented Programming ill-suited for?

In Martin Fowler's book Refactoring, Fowler speaks of how when developers learn something new, they don't consider when it's inappropriate for the job: > Ten years ago it was like that with objects. If someone asked me when not to > use objects, it was hard to answer. [...] It was just that I didn't know > what those limitations were, although I knew what the benefits were. Reading this, it occurred to me I don't know what the limitations or potential disadvantages of Object-Oriented Programming are. What are the limitations of Object Oriented Programming? When should one look at a project and think "OOP is not best suited for this"?


Does dealing with legacy code help one evolve as a programmer?

I'm a Java developer with a bit more than a year of experience which places me somewhere above a junior, but not among mid-level developers yet. Recently I was offered a long-term project which is about studying an existing banking application code for 4 months and then introducing changes when needed. As a not-so-experienced programmer I'm looking for ways to develop and I wonder what such a project might give. Would you consider dealing with a big and probably not-so-well written application a good practice for a beginner?


Embedded Linux Training

I have been working with an old `OS9`(not mac) operating system and I have been trying to get my organization to transition to an embedded `Linux` platform. We have money in the budget for training and I figure I would take advantage of it. A secondary impetus would be a good resume addition. What are some good vendors/bootcamps for Embedded Linux training?


Multiple entrance points in project

My question is related to C++ but it comes from Java actually. When I was programming Java I had multiple classes, which were derived from a base "Test" class. Their purpose was to test things - run tests (unit tests/not unit tests). In order to run a test, I had a `public static void main` in every class. So the matter of running such a test was to click run in _Eclipse/Netbeans_ , whatever good IDE. I know this question maybe IDE dependent, it actually boils down to a makefiles, but is it possible to maintain a similar structure in C++ IDEs? Actually my question is: **how do you deal with tests?** Do you put a huge main method with some switch/enum based statements to run the tests or make different build configurations for each test, or have different solution to this? I know this question won't get a straightforward answer, but I'm curious how to deal with it so I can choose something for myself.


User interfaces for C function completion

In method call syntax in many object-oriented languages, the receiver object goes to the left of the method name, e.g. `someObject.someMethod()`. This comes in handy when using an IDE with code completion/code assist/Intellisense; when the user types a method call expression, the receiver has already been typed, so the IDE can narrow down its method choices to apply to that receiver (at least in statically-typed languages). What I'm wondering is, what is the user interface for method/function completion like in languages where the method or function name goes _before_ its receiver and/or arguments, e.g. Lisp or C? Does the user have to trigger a hotkey, to which the IDE responds by asking for the receiver and/or arguments, and then once the value is typed in the IDE pops up a list of methods or functions that are applicable to that list?


Scrum - how to carry over a partially complete User Story to the next Sprint without skewing the backlog

We're using Scrum and occasionally find that we can't quite finish a User Story in the sprint in which it was planned. In true Scrum style, we ship the software anyway and consider including the User Story in the next sprint during the next Sprint Planning session. Given that the User Story we are carrying over is partially complete, how do we estimate for it correctly in the next Sprint Planning session? We have considered: a) Adjusting the number of Story Points down to reflect just the work which remains to complete the User Story. Unfortunately this will mess up reporting the Product Backlog. b) Close the partially-completed User Story and raise a new one to implement the remainder of that feature, which will have fewer Story Points. This will affect our ability to retrospectively see what we didn't complete in that sprint and seems a bit time consuming. c) Not bother with either a or b and continue to guess during Sprint Planning saying things like "Well that User Story may be X story points, but I know it's 95% finished so I'm sure we can fit it in."


Netbeans support for struts 2?

I have just started learning struts 2. I have purchased the book named Struts 2 in action. But I want to use an IDE for developing Struts 2 applications. I basically use netbeans. Please tell me how can i develop applications using netbeans. Also, it would be great if somebody can point out a few tutorials on the same. regards P.S. I haven't used eclipse. Is it advisable to switch to it for struts 2, (if it is better than netbeans in this case)?


Single statement non-braced ifs and code merges

I've seen code merges being used as an argument for bracing even single statement ifs. For example:               if (condition) {         do something;     }      Unfortunately I can't think of a change that would break a non-braced version during an automatic code merge. Could someone post an example?


I am tired of hearing people recommend that you should use only one thread per processor, while many programs use up to 100 per process! take for example some common programs               vb.net ide uses about 25 thread when not debugging     System uses about 100     chrome uses about 19     Avira uses more than about 50      Any time I post a thread related question, I am reminded almost every time that I should not use more that one thread per processor, and all the programs I mention above are ruining on my system with a single processor. What constitutes proper use of threads in programming? Please make general comment, but I'd prefer .NET framework thanks


Is the Glade GUI designer a good option for a beginner?

I am a student of Computer Science and I already have basic programming experience in Python 2.x, 3.x, C++, and HTML. I never made a program with a GUI. I have just programmed games, scripts/plugins, and console applications. First time developers in Ubuntu are recommended to use the GUI designer Glade, which creates GUIs for the GTK toolkit. They are also recommended to program in the Qt framework. I intend to create a cross-platform application (Linux/Windows/Android/iOS/OSX). Given my experience, is Glade a reasonable option for me to use in order to create a cross-platform application, especially in my first application that needs a GUI?


Static DataTable or DataSet in a class - bad idea?

I have several instances of a class. Each instance stores data in a common database. So, I thought "I'll make the `DataTable table` field static, that way every instance can just add/modify rows to its own `table` field, but all the data will actually be in one place!" However, apparently it's a bad idea to do use static fields, _especially_ if it's databases: Don't Use "Static" in C#? Is this a bad idea? Will I run into problems later on if I use it? This is a small project so I can accept no testing as a compromise if that is the only drawback. The benefit of using a static database is that there can be many objects of type `MyClass`, but only one table they all talk to, so a static field seems to be an implementation of exactly this, while keeping syntax concise. I don't see why I shouldn't use a static field (although I wouldn't really know) but if I had to, the best alternative I can think of is creating one `DataTable`, and passing a reference to it when creating each instance of `MyClass`, perhaps as a constructor parameter. But is this really an improvement? It seems less intuitive than a static field.


Use of interfaces to ease rapid development/prototypes

Recently I've started to put almost all of my data structures into interfaces, and many of the classes that contain pieces of logic code as well, depending on how much work they are. I find that this makes development of applications much easier because I can easily swap out parts of my code when they do not work as well as intended without changing the rest of the application and swap them back in when I have corrected them, or if I need something simpler for the time being. I was wondering if I'm developing a bad habit here. Is this a anti-pattern I'm using here, or is it okay to do this?


how can we have a person to allot and track tasks in agile development

I understand that Agile team should be self organized and self driven, but is there a provision that I can have someone who will allot tasks to developers and ensure that all user stories will be completed on time?? For example if there are two persons in an agile team who are not self motivated to take up tasks and they will work only when task is assigned to them with a deadline, how can we deal this in Agile? The problem I face is that no one is fixing the deadlines for the tasks and the team is under delivering for the last two sprints. It will be better if we can have someone who can fix deadlines. IS there a provision for this in Agile


Automated object creation from user input

I am working on a command-line application that runs simulations. It has to be heavily configurable; the user should be able to provide a very large number (100+) of parameters, some mandatory and some optional. Obviously, these parameters will be used by a variety of classes in the application. I can see two approaches I can use; which one is a better design in the long run? **Approach 1** Have the (text) input file directly control object creation in the application. For example, user would provide the following input:               root=Simulation       time=50       local_species=Sentient         strength=3.5         intelligence=7.1       invading_species=Primitive         strength=5.1         sociability=2.6      The application would then recursively create objects of the class specified on the rhs of the equal sign, passing the class' constructor the arguments provided in the relevant sub-branch of the input file, if any. I'm using Python, which supports keyword arguments and default argument values when no argument is provided, but I hope the question isn't terribly language- specific. For example line 1 would tell the app to create an object of `class Simulation`, with three constructor arguments. The first constructor argument is `time=50`. The second argument is an instance of `class Sentient`, which is created by passing `Simulation`'s constructor arguments `strength=3.5`, `intelligence=7.1`. The third argument is an instance of `class Primitive`, which is created with by passing the constructor arguments `strength=5.1`, `sociability=2.6`. The whole object creation is handled automatically, with just a few lines of (recursive) code. The highest-level object (instance of `Simulation` in this case) would be passed to the visualization layer. **Approach 2** The input file still looks the same. However, the application's classes now have full control over how they interpret user input. The lhs and rhs values may or may not correspond to keyword parameters and classes. For example, the above input may result in the application creating an instance of `class InvasionSimulation` with arguments `strength_local=3.5`, `intelligence_local=7.1`, `strength_invading=5.1`, `sociability_invading=2.6`, and then calling its method `set_runtime(time=50)`, before passing the object to the visualization layer. * * * One obvious advantage of approach 2 is that the user's input can remain stable even as the application is completely redesigned internally. But I think there's nothing wrong with designating a subset of classes as "public API", and therefore ensuring that it doesn't change in the future, is there? On the other hand, if the application internally follows something quite similar to approach 1 anyway, it feels that approach 2 requires adding a lot of redundant code: instead of automatically interpreting user input, we now need to do it "by hand" for each class. Any additional considerations would be much appreciated. Are there any names for these approaches that I can search for?


What to do when a project is too difficult to continue developing?

As a developer, can you tell your project manager that an application is _unworkable_? Or, if you're a project manager, how would you need this presented to you in order to be compelled? This isn't about "how to work on a poor project", it's assuming you cannot. I can provide an example of the situation if anyone thinks it's important, but I'm trying to avoid proposed solutions to "plodding through".


Is there any point in writing a random tester for code that deals with inductive data structures?

Let's say we're writing a simple JSON parser and we've fully covered the code with unit tests:   * it can parse primitives `"0", "123", "-456", '""', '"asd"', true, false`   * it can parse arrays `"[]", "[1, 2, 3]"`   * it can parse nested arrays `"[[]]"`   * it can parse objects `"{}", '{ "a": 1, "b": 2 }'`   * it can parse nested objects `'{ "a": {} }'` Every possible JSON can be either a primitive or an array/object holding other primitives/arrays/objects - this is what I mean by inductive data structure (is 'recursive' a better term?). It seems to me that any JSON parsing can be reduced to these few cases and if the parser passes these tests then it is fully correct (unless it was explicitly hard-wired to break when you try to parse special numbers). Is there still any point in creating a random tester that generates random stringified JSON in hope that one of them will break this parser? Would this random tester find anything interesting? P.S. I chose JSON just as an example of an inductive data structure; I'm not interested in writing a JSON parser.


Can I be forced to continue project which is outside my job duties?

I am a DBA / Report Writer in client support for a software company. Starting in my spare time, I wrote a reporting web application with live reports. The ca 2001 IE only site was horrific. My application eventually became a huge success with clients and was subsequently swallowed by dev. I think it was assumed that I would fail and I was told it would never be part of dev; it will always be a support project. Naturally, after such success, they wanted it. They assumed control, demanded I stop working on improvements, and started giving me tasks to "stabilize" it. I went from architect / designer / sole developer to code monkey. I have zero input anymore. It was fun to do, but that fun has left the building. I want to continue working on it, but my way. My way is why they have it in the first place, so it must work. Now I'm stuck in an AGILE loop. I don't see them giving back control so I want to stop. I'm not a developer or even work in that department. Can they force me to continue?


Domino Solitaire Algorithm

**Problem Statement -** ![Problem Statement](http://i.stack.imgur.com/F6HJC.png) Given a 2xN grid of numbers, the task is to find the most profitable tiling combination (each tile covers 2x1 cells; vertically or horizontally) covering all tiles. I thought of approaching it in the greedy way, enqueuing the max possible for any cell, but it has a fallback that a low-profit choice at i, could yield a greater profit at i+n tiles. So what should be the approach? EDIT - Test Data Range - N<=105 Source - INOI 2008 Q Paper **UPDATE** \- Working out the plausibility of a Dynamic programming Approach. **UPDATE 2** \- Worked out an answer using DP.


C++ Design: Functional Programming vs OOP

**Design Question** Recently, I've been doing more and more FP in C++, mostly in the form of function templates and lambdas, and heavy overloading of a single function name. I really like FP for some well-defined operations, but I've also noticed that as with OOP, one could easily fall into anti-patterns of spaghetti-code if one isn't careful (eg circular dependencies, which is a bigger issue for state-based code). _My question is, when thinking about adding new functionality, how do you decide between using a FP-paradigm or a OOP-paradigm?_ I'm sensing it may have to do with identifying the **invariants** in the problem or in the design, but I'm not sure. For example, without an OOP model/simplification of the real world, it may not be immediately obvious what a Dog or a Cat class is (what are its states? what are its methods?). Otoh, from a FP POV, a Eat() function simply allows an Animal to turn Food into Poop and Energy. It's harder to imagine Eat() being anything else (for me, at least). I'm looking more for C++ answers, but this question could apply to any sub- module in any language that can handle multiple paradigms.


Cumulative charts within Webdesign

A rather simple question here, With regards to web design and the paperwork behind it (Which I am sure many people/companies don't actually do). Would there be any reason for using a Cumulative Chart? Specifically a Cumulative Resource chart, although I am unsure what the resources could even be! More to the point, there are a few ideas I have been thinking of, unsure of whether they are valid or not I have come to the guys behind programming a website! tl;dr : If it is possible, what can I make a cumulative resource chart for in relation to a website?


In what situations do mutually dependent modules have an advantage?

Earlier today I created two mutually dependent, implicitly linked DLLs just to see if this was possible: http://i.imgur.com/GMACpnC.jpg I am just curious; in general, what advantages might this kind of mutual dependency have?


Is this interview question real or a communication skills test?

I've been to about 50 interviews in my life. Many of them I've done just to get experience, and keep doing. The question I keep hearing again and again is > Are you more a front-end or a back-end developer? I program mostly for the web, but 2-3 years ago I was database developer, and even wrote a desktop app. And if I remember correctly, I heard this question at interviews that had nothing to do with the web. I can't remember exactly what I was answering. IIRC, usually I would say: it's hard to tell and that I had programmed an application X, Y and Z, and W. Last time I started answering and then said _"Wait, how do **you** define backend?"_ Now, does this question, whether I'm better at frontend or backend programming, really make sense nowadays?   * a website has a front end, true. But it's backend is usually the admin website. There's little difference between them.   * if I write a DB driver for a Django-driven website, is it really a front end thing? I remember at some interview I asked what are front and back ends, and got an answer that front end is for clients and used or visited a lot, and back end is something for internal use. Well, it makes no big difference. Things must work and work efficiently on both sides. I also led a dozen of interviews myself, and have never made this question, because it makes no sense and doesn't come to my mind. Is this just a test whether I jump into the hoop and start speaking or if I try to clarify the question?


Is Ant still in the "mainstream" for Java builds?

We have been slowly replacing batch command files (windows .bat) which were simply jarring up the classes compiled in the developers IDE, with more comprehensive Ant builds (i.e. get from CVS, clean compile, jar, archive, email, etc.) I've spent a lot of time learning (and debugging issues) with Ant, so I'm most comfortable using it for these tasks. But I wonder if Ant is still in as wide usage as it was when I first started learning, or whether "the world has moved on" to something newer (and maybe slicker). (I've started to see more Maven build stuff distributed, which I've never used, for example.) The practical import of this question, is **whether I push new developers to learn Ant** , or whether they should be learning something else for builds? I'm never too on top of the trends, so it would be great to hear from other Java developers what they think is the best build tool, and what they think new developers should be learning.


Include all php files in one file and include that file in every page if we're using hiphop?

I understand that in normal php if we're including a file we're merging the source of it in the script and it would take longer for that page to be parsed/processed but if we're using HipHop shouldn't it be ok to just create one single php file and include every file in it (that contains some class) and every page which needs those classes (in separate file each) can just include one single php file? Would this be ok in presence of HipHop?


Is it a good idea to write an OS in a scripting language?

Is it a good idea to create an OS that's written in a scripting language? For example, how about creating an OS using Python?


Help me construct a list of best approaches for new C and C++ developers

Not specific code writing practices. Please also include reasoning. My start:   * use `GCC` or `Clang`     * gcc because it is unchallenged in the amount of static checking it can do (both against standards and general errors)     * clang cause it has such pretty and meaningful error messages   * when compiling C code using GCC use `-Wall -Wextra -Wwrite-strings -Werror`     * in 99,99% the warning is a valid error   * when compiling C++ code using GCC use `-Wall -Wextra -Weffc++ -Werror`     * you could skip `-Weffc++` (cause it can be confusing)   * always code against a standard C (C89, C99), C++ (C++98, C++0x)      * while compilers change, standards don't, coding against a standard gives at least some level of assurance that the code will also compile in the next version of the compiler or even a different compiler/platform   * make sure that the compiler checks your code against standard (`-std=c99 -pedantic` for C99, `-std=ansi -pedantic` for C++98 in GCC)      * cause automatic checking always good   * use `valgrind` or a similar tool to check for runtime errors (memory, threads, ...)      * free bug catching   * never duplicate functionality of the standard libraries (if there is a bug in your compiler, make a temporary patch, wrapper, ...)      * there is no chance that your code will be better then the code maintained by hundreds of people and tested by tenths of thousands   * make sure that you actually fix all bugs that are reported by automatic tools (GCC, valgrind)      * the errors might not cause your program to crash now, but they will   * never follow recommendations that include "never use feature X"      * such recommendations are usually outdated, exaggerated or oversimplified


How should I restart a career in software development after a 7 year gap?

I am a graduate in electronics, and I worked in the analog electronics field for around 4 years, but now I have a gap of about 7 years in my career. What are my options to restart my career? Can anyone suggest some refresher courses to enter the software field?


What should be on your "Going Live Day" checklist?

Aside from the technical specifics, what should be on your checklist for when you go live with a program? **Are there last minute things you can do to make a piece of software go into production smoothly?** (assuming you used sound principles in development and tested the average amount) More testing? Discussion with the client? Last minute optimizations?


Is it feasible and useful to auto-generate some code of unit tests?

Earlier today I have come up with an idea, based upon a particular real use case, which I would want to have checked for feasability and usefulness. This question will feature a fair chunk of Java code, but can be applied to all languages running inside a VM, and maybe even outside. While there is real code, it uses nothing language-specific, so please read it mostly as pseudo code. **The idea**   Make unit testing less cumbersome by adding in some ways to autogenerate code based on **human** interaction with the codebase. I understand this goes against the principle of TDD, but I don't think anyone ever proved that doing TDD is better over first creating code and then immediatly therafter the tests. This may even be adapted to be fit into TDD, but that is not my current goal. To show how it is intended to be used, I'll copy one of my classes here, for which I need to make unit tests.               public class PutMonsterOnFieldAction implements PlayerAction {         private final int handCardIndex;         private final int fieldMonsterIndex;              public PutMonsterOnFieldAction(final int handCardIndex, final int fieldMonsterIndex) {             this.handCardIndex = Arguments.requirePositiveOrZero(handCardIndex, "handCardIndex");             this.fieldMonsterIndex = Arguments.requirePositiveOrZero(fieldMonsterIndex, "fieldCardIndex");         }              @Override         public boolean isActionAllowed(final Player player) {             Objects.requireNonNull(player, "player");             Hand hand = player.getHand();             Field field = player.getField();             if (handCardIndex >= hand.getCapacity()) {                 return false;             }             if (fieldMonsterIndex >= field.getMonsterCapacity()) {                 return false;             }             if (field.hasMonster(fieldMonsterIndex)) {                 return false;             }             if (!(hand.get(handCardIndex) instanceof MonsterCard)) {                 return false;             }             return true;         }              @Override         public void performAction(final Player player) {             Objects.requireNonNull(player);             if (!isActionAllowed(player)) {                 throw new PlayerActionNotAllowedException();             }             Hand hand = player.getHand();             Field field = player.getField();             field.setMonster(fieldMonsterIndex, (MonsterCard)hand.play(handCardIndex));         }     }      We can observe the need for the following tests:   * Constructor test with valid input   * Constructor test with invalid inputs   * `isActionAllowed` test with valid input   * `isActionAllowed` test with invalid inputs   * `performAction` test with valid input   * `performAction` test with invalid inputs My idea mainly focuses on the `isActionAllowed` test with invalid inputs. Writing these tests is not fun, you need to ensure a number of conditions and you check whether it really returns `false`, this can be extended to `performAction`, where an exception needs to be thrown in that case. **The goal of my idea** is to generate those tests, by indicating (through GUI of IDE hopefully) that you want to generate tests based on a specific branch. **The implementation by example**   1. User clicks on "Generate code for branch `if (handCardIndex >= hand.getCapacity())`".   2. Now the tool needs to find a case where that holds. (I haven't added the relevant code as that may clutter the post ultimately)   3. To invalidate the branch, the tool needs to find a `handCardIndex` and `hand.getCapacity()` such that the condition `>=` holds.   4. It needs to construct a `Player` with a `Hand` that has a capacity of at least 1.   5. It notices that the `capacity` _private int_ of `Hand` needs to be at least 1.   6. It searches for ways to set it to 1. Fortunately it finds a constructor that takes the `capacity` as an argument. It uses 1 for this.   7. Some more work needs to be done to succesfully construct a `Player` instance, involving the creation of objects that have constraints that can be seen by inspecting the source code.   8. It has found the `hand` with the least capacity possible and is able to construct it.   9. Now to invalidate the test it will need to set `handCardIndex = 1`.   10. It constructs the test and asserts it to be false (the returned value of the branch) **What does the tool need to work?**   In order to function properly, it will need the ability to scan through all source code (including JDK code) to figure out all constraints. Optionally this could be done through the javadoc, but that is not always used to indicate all constraints. It could also do _some_ trial and error, but it pretty much stops if you cannot attach source code to compiled classes. Then it needs some basic knowledge of what the _primitive_ types are, including arrays. And it needs to be able to construct some form of "modification trees". The tool knows that it needs to change a certain variable to a different value in order to get the correct testcase. Hence it will need to list all possible ways to change it, without using reflection obviously. What this tool will not replace is the need to create tailored unit tests that tests all kinds of conditions when a certain method actually works. It is purely to be used to test methods when they invalidate constraints. **My questions** :   * Is creating such a tool _feasible_? Would it ever work, or are there some obvious problems?   * Would such a tool be _useful_? Is it even useful to automatically generate these testcases at all? Could it be extended to do even more useful things?   * Does, by chance, such a project already exist and would I be reinventing the wheel? If not proven useful, but still possible to make such thing, I will still consider it for fun. If it's considered useful, then I _might_ make an open source project for it depending on the time. For people searching more background information about the used `Player` and `Hand` classes in my example, please refer to this repository. At the time of writing the `PutMonsterOnFieldAction` has not been uploaded to the repo yet, but this will be done once I'm done with the unit tests.


What are the steps to grouping related classes into packages

What are the steps needed to be taken to group related classes into packages in Java? In my case, I have about a number of .java files that I'd like to group into 3 packages according to the MVC pattern. One package for Model classes, one package for View classes and one package for Controller classes. I've identified which belong in what package, but not sure of the next step. I want to know how to seperate them into packages, do I make 3 folders and place the .java files in the folder that represents the package they belong in?


How to unit test models in MVC / MVR app?

I'm building a node.js web app and am trying to do so for the first time in a test driven fashion. I'm using nodeunit for testing, which I find allows me to write tests quickly and painlessly. In this particular app, the heavy lifting primarily involves translating SQL data into complex Javascript object and serving them to the front-end via json. Likewise, the app also spends a great deal of code validating and translating complex, multidimensional Javascript objects it receives from the front-end into SQL rows. Hence I have used a fat model design for the app -- most of the real code resides in the models, where the data translation happens. What's the best approach to test such models with unit tests? I mean in particular the methods that have create javascript objects from the SQL rows and serve them to the front-end. Right now what I'm doing is making particular requests of my models with the unit tests and checking the returned data for all of the fields that should be there. However I have a suspicion that this is not the most robust kind of testing I could be doing. My current testing design also means I have to package my app code with some dummy data so that my tests can anticipate the kind of data that the app _should_ be returning when tests run. ## UPDATED QUESTION: Specific question: ### Does it make sense to inject a testing layer between my model and my database? Or would it be better to let the models work on a real database with pre-defined test data inserted into it? The second option I imagine will probably result in more accurate testing, but the first model seems more versatile in terms of granularity and makes the testing and development more portable (no db required)


Why must essential mutable derived data have an inverse function?

I was reading the paper Out of the Tar Pit authored by Ben Moseley and Peter Marks when I came across the following section on page 25 regarding essential mutable derived data: > ### Essential Derived Data — Mutable > > As with immutable essential derived data, this can be excluded (and the data > re-derived on demand) and hence corresponds to _accidental state_. > > Mutability of derived data makes sense only where the function (logic) used > to derive the data has an inverse (otherwise — given its mutability — the > data cannot be considered _derived_ on an ongoing basis, and it is > effectively _input_ ). An inverse often exists where the derived data > represents simple restructurings of the input data. In this situation > modifications to the data can simply be treated identically to the > corresponding modifications to the existing _essential state_. I don't understand why essential mutable derived data must have an inverse function. For example consider the following JavaScript code:               inputbox.onchange = function () {         outputbox.value = md5(inputbox.value);     };      Here `inputbox.value` is _input_ to the system and `outputbox.value` is the essential mutable derived data. It is derived from `inputbox.value` using the `md5` function. However the `md5` function doesn't have an inverse. Nevertheless `inputbox.value` is still essential, mutable and derived. So what do the authors actually mean when they say that "mutability of derived data makes sense only where the function (logic) used to derive the data has an inverse (otherwise — given its mutability — the data cannot be considered _derived_ on an ongoing basis, and it is effectively _input_ )"? Do you have any examples to elucidate their point?


How do I learn Python from zero to web development?

I am looking into learning Python for web development. Assuming I already have some basic web development experience with Java (JSP/Servlets), I'm already familiar with web design (HTML, CSS, JS), basic programming concepts and that I am completely new to Python, how do I go about learning Python in a structured manner that will eventually lead me to web development with Python and Django? I'm not in a hurry to make web applications in Python so I really want to learn it thoroughly so as not to leave any gaps in my knowledge of the technologies involving web development in Python. Are there any books, resource or techniques to help me in my endeavor? In what order should I do/read them? **UPDATE:** When I say learning in a structured manner, I mean starting out from the basics then learning the advanced stuff without leaving some of the important details/features that Python has to offer. I want to know how to apply the things that I already know in programming to Python.


What goes within the Architecture Overview of a Design Specification?

I have designed an management system for a medical practice and I am writing the design specification and I am kind of stumped by what to write for a section. It asks for me to write about the components of a system but I am perplexed. What exactly are components within a system? Is this generally considered as the features that a system has or does it mean something else altogether?


What does 'opinionated software' really mean?

I've seen a lot of other framework/library developers throw the phrase 'we write opinionated software' around, but in practical terms, what does that really mean? Does it mean that the author of the 'Opinionated Framework X' says that because they write code a certain way, you should be writing the same type of code that they write? Isn't that a bit pretentious?


These days is it required to test a desktop website for IE6 and IE7? Or is IE8 and IE9 enough? I heard that IE8 has replaced IE7.


Escaping strings in database layer

Can escaping functions (e.g. mysql_real_esacpe_string ) be moved down to the database layer where we would loop through all parameters passed for all queries and escape all strings. Would that be a good design?


In what area is LISP's macro better than Ruby's "ability" to create DSL

One of things that makes Ruby shine is the ability to create Domain Specific Languages better, like   * Sinatra   * Rspec   * Rake   * Ruby on Rails' ActiveRecord Though one can duplicate these libraries in LISP through macro, I think Ruby's implementation is more elegant. Nonetheless, I think there are cases that LISP's macro can be better than Ruby's, though I could not think of one. So, in what area is LISP's macro better than Ruby's "ability" to create DSL, if any? **update** I've asked this because modern programming languages are approaching the LISP singularity, like   * C got macro expansion preprocessor, though very primitive and prone to error   * C# has attributes, though this is a read-only, exposed through reflection   * Python added decorator, that can modify the behavior of the function (and class for v 3.0), though feels quite limited.   * Ruby TMTOWTDI that makes elegant DSL, if care is applied, but in Ruby way.  I was wondering if LISP's macro is only applicable to special cases and that the other programming language features are powerful enough to raise the abstraction to meet the challenges today in software development.


Javascript and SQL Lite (multi browser offline SQL/database query)

I'm in the elections division of my county and am trying to simplify a voter lookup method for our poll judges during election time. Currently we are using a clunky heavy application that the judges must install, and we only support Windows. My goal is to have an offline (client-side) browser based solution that will work on any browser for any operating system. I think, based on research that I've done through google searches and w3 forums, that I should be using JavaScript + SQL Lite. I have read that HTML5 has a good solution, but please keep in mind that election judges are typically elderly and don't upkeep their updates, or deviate from the preinstalled browser (typically IE), so HTML5 is not a plausible solution for our needs. I've done a days worth of research on the subject and just come up empty handed, because honestly I'm NOT certain what I should be looking for. But as I said, the JS/SQLlite combo seems to be the solution. Unfortunately I can't find any tutorials that will help me reconcile these two systems. Do you have any suggestions? Anything is helpful at this point. Thanks!!!!


Mission critical embedded language

Maybe the question sounds a bit strange, so I'll explain a the background a little bit. Currently I'm working on a project at y university, which will be a complete on-board software for an satellite. The system is programmed in C++ on top of a real-time operating system. However, some subsystems like the attitude control system and the fault detection and a space simulation are currently only implemented in Matlab/Simulink, to prototype the algorithms efficiently. After their verification, they will be translated into c++. The complete on-board software grew very complex, and only a handful people know the whole system. Furthermore, many of the students haven't program in C++ yet and the manual memory management of C++ makes it even more difficult to write mission critical software. Of course the main system has to be implemented in C++, but I asked myself if it's maybe possible to use an embedded language to implement the subsystem which are currently written in Matlab. This embedded language should feature:   * static/strong typing and compiler checks to minimize runtime errors   * small memory usage, and relative fast runtime   * attitude control algorithms are mainly numerical computations, so a good numeric support would be nice   * maybe some sort of functional programming feature, matlab/simulink encourage you to use it too I googled a bit, but only found Lua. It looks nice, but I would not use it in mission critical software. Have you ever encountered a situation like this, or do you know any language, which could satisfies the conditions? EDIT: To clarify some things: embedded means it should be able to embed the language into the existing C++ environment. So no compiled languages like Ada or Haskell


Decrease probability of picking a list's item based on its index

I have a list of sounds that are to be played when the user presses a button.   For now I just generate a random number within the range of the list and just pick the sound with that index. (I also prevent that sound from being played the next time the button is clicked. Since that is easy, I would like to concentrate _only_ on the selection algorithm and leave the exclusion behind.)   Since that makes it possible for a few sounds to be played repeatedly in a pattern, I would like to adjust my algorithm: Once a file is played it gets moved to the end of the list. Sounds from the beginning have a greater chance of being played than those at the end - therefore minimizing repetition.   Instead of assigning a weight to each index, I want to have one factor determining the probability falloff. For example, I would set this factor to be 1.2 which means that each index is 1.2 times as probable to be played as the following one. This hopefully produces a nice falloff in probability. The fastest solution seems to be a mathematical function that maps the random number to the range of indices. That way I do not have to set up intervals, but can directly calculate the result based on the random number. I just cannot figure out the math and implementiation behind this idea, so I need you to lay it out for me. The algorithm will be used in an Android app, so the programming language I am using is Java.


Javascript and web application data

I am pretty new to Web Application programming and so to **OOP** Javascript and the new **Client-Server** interactions. I am encountering some trouble wondering about how much **AJAX** I should use or how much data I have to save "locally" . Explainig it better: at the moment , to manage the data that I obtain from AJAX request , I push them in **Data Structure** like **Array's** and then I handle them helping myself rendering html through template. Now, was I wondering : is all this necessary? Do I really need to store all this data in Data Structures or I can make AJAX call for every action users do on my application? I apologize for the explanation but it's a difficult concept for me to explain in English. Thanks in advance


Do todays web pages use Web Semantics

Do todays web pages use Web Semantics? what is the potential in web semantics (i mean potential to enhance web)? web semantics is all about SEO?


Role based access to resources for a RESTful service

I'm still wrapping my head around REST, but I wonder if someone can help with any suggestions or approaches to role based access control for a RESTful service, particularly from the point of view of securing the data and how the URLs might look. It's probably best to consider an example: Say I have a REST service for Customers, and want to split the users of this REST service into Admin, Editor and Reader roles:   * Admins can change all attributes of a Customer resource    * Editors can change only some    * Readers can only view them. Access control rights are assigned to the Customers entities individually. So for example a user of the service might have admin rights to Customers 1,2 and 3 but Editor access to 4,5 and Reader access to 7,8,9. Now consider the user calling the service. What is a good way to seperate the list of Customers for the current User? **GET /Customer** \- this might get a list of all customers that the current user has Admin\Editor\Reader access to. But then on each Customer the consumer would need an indication of what role they have. Or would it be "better" having something like **GET /Customer/Admin** \- return all customers the current user has Admin access to. Just looking for some high level pointers or reading on a decent way to secure\filter the resources based on roles of the current user.


REST API Library Conventions

Most API libraries define one method for each endpoint. If there is an endpoint for getting user information, you might have a method like:               getUserInfo(userId);      That simple method is often a wrapper around another function that actually does the api call:               apiCall('/user/info', {userId: userId});      Another option I see less frequently is for the library to only contain the method that makes the API call. The first method only has the advantages of code discoverability, but it isn't that big of an issue for dynamic languages. Some say it also removes the need for the developer to read documentation for the APIs, but why would you ever want somebody using APIs without reading the documentation? The second method has three advantages that I see:   * The library is dramatically smaller   * Methods don't need to be updated if the API ever changes   * There is no need to maintain documentation for the library; the API documentation fulfills that purpose But I don't see the second method used very often, so perhaps I'm missing something. When is it appropriate or inappropriate to use either method of writing API libraries?


Difference between Singleton pattern and auto_ptr<> resp. unique_ptr<>

I'm maintaining some legacy code of a physical simulation. The calculation object is build as a singleton, to ensure there is only one instance. A co- worker told me, that singleton are completely out-of-date and I should instantiate it through a smartpointer. But I think it is not the same, because the initialization by a smartpointer doesn't garanties me, that there is only one instance of this object, right? If I wanna have one single instance of an object in my code, which way is preferable: To use the singleton pattern or the initialize the object through one of this smartpointers (`auto_ptr<>` or `unique_ptr<>`).


Sanity of design for my in-memory object representations of database rows

I've been trying to revise the structural design of the C#.NET-based system I'm currently working on. The new design involves a rather light-weight object-relational mapping framework (we're trying to stay away from ADO or linq2sql). Sorry, this came rather lengthy, but I cannot describe it shorter - it's a bit complex. The system has two primary functions:   1. Retrieve rows from an SQL relational disk-based database, then serve them up using `[DataContract]`-marked objects via ASP to a web-based client, as well as receive UPDATEs to those and reroute them to the database.   2. Read off and serve the same kinds of objects to server-side / distributed modules which work with these, generate some result, and push it back to the database.  The results (some might ask: "why're you storing generated data?") of module computation _do_ have to be stored in the database due to both size and length of computation required to obtain them, only to be retrieved in parts by the web-client through the (1) function. Currently, all row-representing objects are defined as separate C# classes with a common trend but little to no inheritance, and no common base class. I want to completely break this pattern, and instigate more extensive inheritance based on a tree of abstract classes and possibly interfaces. I've whipped up a "due-for-test" implementation in the past few days, but I'm concerned about the sanity of this design. Obviously, there is the object- relational impedance mismatch, which I deal with by only initializing the database-column-backed fields unless the other encapsulated objects are provided to the constructor. I'm not so concerned about that, and it's an issue for the old system design as well. Here's what I have so far: A `DatabaseColumnAttribute` class, which targets fields, and defines   * name of the column where the data for the field resides.    * database type (enum-backed locally) for this column. There's a fixed set of database types this system is designed to support, so be it.    * whether or not the column is nullable.   * read phrase(i.e. how do we represent this column in a SELECT query within an sql statement): this is generated automatically based on column type. There's a fixed number of types the data can be accessed in, so if there's a conversion involved when reading data from a column this will include it. Otherwise, just the column name.   * write wrapper (i.e. database function that converts the data sent into the column from C# to the appropriate representation) - also generated based on column type. All this is used within a `DatabaseFieldColumnWrapper` object, which contains all the methods required to transfer the data from the column to the field or vice-verse. The `DatabaseFieldColumnWrapper` is constructed for each location in the code where a `DatabaseColumnAttribute` is used, meaning it's not quite "static", but rather class-based, since it modifies fields of derived classes. The fields can back properties, there's a `BackedByFieldAttribute` class as well, I'll skip it for brevity. All of these are used within an abstract `DataElement` class, root of hierarchy. It defines the following abstract members: function that provides the backing-table's name for this class of objects, a read-only public Id property, a private function to set the Id (which corresponds to the primary key of the row in the table). It also provides a protected static helper function to retrieve the `DatabaseFieldColumnWrapper` objects for specific fields based on Linq Expressions (to avoid "magic strings"). This can be used in derived types to easily synch the database representation for specific fields/columns. It provides a `Delete()` method, which is (not a destructor, but a function) responsible for only deleting the database representation. The whole system is designed to allow asynchrony and multiple memory representations unless otherwise specified. Here is the "less sane" part: There is a `DataElementAttribute` class, which is designed to modify non- abstract derived types. It is _not_ fully constructed completely right away where it's defined, instead filled-in in a thread-safe manner upon the construction of the first object of a derived type. It not inherited, and contains only data specific to the _derived class_ required to speed up construction (i.e. construct all the necessary `DatabaseFieldColumnWrapper` objects before-hand and associate them with the fields). This basically _violates_ the C# OO model, since it's "static only with respect to current class in the hierarchy", not static to the whole chain. Basically, it makes the `DataElmentAttribute` object associate with a particular Type object. It's like a convenience structure, which is generated according to the rules specified in the base class _only_ , but initializes its members based on the fields marked as columns for each derived type. Each instance of that particular type has a reference to it. I don't know how to circumvent this issue, it seems to be best in terms of "code reuse", but it also seems like I'm violating a lot of things I shouldn't be when I do it. Any ideas, suggestions? In a more "question"-form: do you know of any better way to associate things with Types (without inheritance) and have these accessible from each instance of that Type, which conforms to the OO model? P.S. I'm not looking for a "you shouldn't" kind of answer, since that wouldn't allow us to reuse more code.


Modules already committed, client doesn't pay, what should I do?

So the story is simple, early stage EU portal hired me to do some extra modules. I got all the source code for local testing, did my job, committed new code. Now I am out of this project but client still haven't paid me yet and he is not even thinking about that. It has been couple of months and no contract was signed so I can't take any legal actions. What should I do with all the source code? Sell it? Run exact copy of that portal? Make all portal publicly available?


Why is WCF is called Windows

I'm wondering why it isn't called Microsoft Communication Foundation. Does it rely on Windows and will it rely on Windows in the foreseeable future?


Are there any good resources to learn how to write tech specs/design documents

> **Possible Duplicate:**   >  Writing a Software Requirement Specification   >  How to make a great functional specification I am starting to write more tech specs and design documents. However, I don't have a lot of time in school writing these, and don't have a lot of access to other people's examples. I have found a few good examples of how to structure these documents for example: Define the project goals Define the system architecture/infrastructure Define the user dialogs and the control flow Define the background tasks Define the database model Define the interfaces to other systems Define the non functional requirements (response times, security, ...) But I am looking for maybe a little more on best practices of actually writing the contents of these types of sections. I am not sure this is a dumb question or not since it is just documenting what is there but I get kind of a block with a blank canvas and start to just over think things


How to make a great functional specification

I am going to start a little side project very soon, but this time i want to do not just the little UML domain model and case diagrams i often do before programming, i thought about making a full functional specification. Is there anybody that has experience writing functional specifications that could recommend me what i need to add to it? How would be the best way to start preparing it? Here i will write down the topics that i think are more relevant:   * Purpose   * Functional Overview   * Context Diagram   * Critical Project Success Factors   * Scope (In & Out)   * Assumptions   * Actors (Data Sources, System Actors)   * Use Case Diagram   * Process Flow Diagram   * Activity Diagram   * Security Requirements   * Performance Requirements   * Special Requirements   * Business Rules   * Domain Model (Data model)   * Flow Scenarios (Success, alternate…)   * Time Schedule (Task Management)   * Goals   * System Requirements   * Expected Expenses ## What do you think about those topics? Shall i add something else? or maybe remove something? I rode every single answer, and i would like to thank all of you for the useful information. I am doing this side project for a company, and they spect from me a constant flow of communication and i will need to explain why i do every single thing, because i will have to administer the resources they will give to me. This will be my first func spec and as i said i want it to be useful, not just big and useless. I think this is something that has to be done, but i want to do it in the way that will be more useful for me and my team. Its bad that i we dont have a manager, so thats why i also need to take care about some administrative tasks... Regarding to the agile programming, i think this is 100% compatible with the agile aproach. I am an Agile programmer my self and i honestly fell more confident when someone already did the thinking for me. I still Junnior, but i worked before as a Tapestry web developer in other projects, were the organization was a total chaos. I dont agree i am doing a waterfall aproach, i think i am just trying to define some boundaries that will make the project being easier when the development starts.


Why do I have to keep my open source software license in the root?

Nearly all open source software licenses require (or at least lawyers generally suggest they require) users to include the full license in the root of the project that they are protecting. One lawyer I spoke to suggests this is a legacy of the CD age, when it was necessary that a full license be included in a jewel case. But today, we're living in the cloud age. Why can't I, for instance, simply host the full license at my website, and include the title + URL of that license in the header of my source files? **Bonus:** If it's generally agreed that established licenses must be kept intact in the root, why hasn't the OSI of FSF approved a license that you _can_ refer to by URL, and what is keeping someone from creating that license?


What are the memory-management capabilities of MySQL + JDBC (in light of autonomic computing)?

I'm interested in implementing some kind of autonomic-computing functionality using MySQL. By autonomic-computing I mean roughly some failsafe abilities, whereby the application appears to be at least slightly "intelligent" For reference, the main parts of autonomic computing we'd like are the "self- configuring" and "self-healing" features (the other two - "self-optimizing" and "self-protecting", are too abstract/futuristic for us, at this time). Sofor example, if we have a sample Java application that utilizes a MySQL database, we might want to automatically restart the MySQL database if we take up too much memory. Or maybe we want to have the ability to dynamiccally adjust the database memory as needed. So for example, when we start the application the database begins with a 56 Megabyte buffer; but then as we insert so many rows we want to have it automatically jump up to 512 MB, then to 1024, until a max of 4096 MB. Does all of the above suggest that MySQL is too "weak" for the task? Do you suggest using Oracle database? My professor believes that by using Java we can basically make up for any memory-management deficiencies that MySQL has in relation to Oracle DB. I'm new to MySQL , but have experience with Oracle. If all of the above sounds wishy-washy, it is because I'm still fleshing it out. thanks


Is my work on a developer test being taken advantage of?

I am looking for a job and have applied to a number of positions. One of them responded, I had a pretty lengthy phone interview (perhaps an hour +) and they then set me up with a developer test. I was told that this test is estimated to take between 6 and 8 hours and that, provided it met with their approval, I could be paid for my work on it. That gave me some pause, but I endeavored. The developer test took place on a VM accessed via RDP. The task was to implement a search page in a web project that requests data from the server, displays it on the screen in a table, has a pretty complicated search filtering scheme (there are about 15 statuses and when sending the search to the server you can search by these statuses) in addition to the string/field search. They want some SVG icons to change color on certain data values, they want some data to be represented differently than how it is in the database, etc. Loooong story short, this took one heck of a lot longer than 6-8 hours. Much of it was due to the very poor VM that I was running on (Visual Studio 2013 took 10 minutes to load, and another 15 minutes to open the 3 GB ginormous solution). After completing, I was told to commit my changes to source control... Hmm, OK. I get an email back that they thought that the SVGs could have their color changed differently, they found a bug in this edge-case, there was an occasional problem with this other thing that I never experienced, etc. So I am 13-14 hours into this thing now, and I have to do bug fixes. I do them, and they come back with some more. This is all apparently going into a production application. I noticed some anomalies in the code that was already in there where it looked like other people had coded all of one functionality and not anything else that I could find. Am I just being used for cheap labor? Even if they pay me the promised 50 dollars and hour for 6 hours, I have committed like 18 hours to this thing now. If I bug fix all of the stuff they keep coming up with, I will have worked at least 16 hours for free. I have taken a number of developer tests. I have never taken one where I worked on code that was destined for production. I have never taken one where I implemented a feature that was in the pipeline for development (it was planned for, and I implemented it through the course of the test). And I have never taken one that took 4 rounds and a total of 20+ hours. I get the impression that they are using their developer test to field some of the functionality, that they don't have time for in their normal team, on the cheap.


Should I use both WCF and ASP.NET Web API

We already have a WCF API with basichttpbinding. Some of the calls have complex objects in both the response and request. We need to add RESTful abilities to the API. at first I tried adding a webHttp endpoint, but I got               At most one body parameter can be serialized without wrapper elements      If I made it Wrapped it wasn't pure as I need it to be. I got to read this, and this (which states "ASP.NET Web API is the new way to build RESTful service on .NET"). So my question is, should I make 2 APIs(2 different projects)? one for SOAP with WCF and one RESTful with ASP.NET Web API? is there anything wrong architecturally speaking with this approach?


Virus source code

Recently I read an article on the bbc about encrypted viruses. I have no idea about how one would even start programming something like that. I would love to see the source code for that or something similar. Does anyone have any relevent material? (Disclaimer: I dont want to create a virus of my own. My interest is purely acedemic)


Modular Web App Network Architecture

Assuming that I am dealing with dedicated physical servers or VPSs, is it conceivable and does it make sense to have distinct servers setup with the following roles to host a web application?   1. Reverse Proxy   2. Web server   3. Application server   4. Database server ![cloud diagram](http://i.stack.imgur.com/ycKgq.png) Specific points of interest:   1. I am confused how to even separate the web and application servers. My understanding was that such 3-tier architectures were feasible.   2. It is unclear to me if the app server would reside directly between the web and database server, or if the web server could directly interact with the database as well. The app server could either do the computational heavy-lifting on behalf of the app server or it could do heavy-lifting _plus control all of the business logic_ (as implied in the diagram above, thus denying the web server of direct database access).   3. I am also unsure what role the reverse proxy (ex. nginx) could and should fulfill as a web server, given the above mentioned setup. I know that nginx has web server features. But I do not know if it makes sense to have the reverse proxy be its own VPS, given that the web server–in theory–would be separate from the app server.


How unique should a UUID identified object be?

I am working on a fairly large open source project (Drupal) and the next major version will begin to use UUIDs for a lot of things, including configuration objects. If we put UUIDs into the configuration we ship with and then various sites change their configuration then there will be many, many objects in the wild with the same UUID but different properties. Is this... OK? Or is it better practice to ship without UUIDs and generate them on install?


Construct your solution logic in syntax or in a faster and more efficient mental model?

I am a newbie, studying programming and I came across this question today: How can I make sure that I'm actually learning how to program rather than simply learning the details of a language? A commenter, ChaosPandion, had asked the question **if the programmer thinks in syntax or in a faster mental model**. I, while writing a solution will always think about the number of loops or condition to be used (for example). Am I doing it wrong? If so, how can I correct myself and what should I learn?


What is needed to implement a usable functional language

I've done some programming in a more-or-less functional style, but I've never really studied pure functional programming. What is the bare minimum needed to implement a functional language? As far as I can tell, you need:   * The ability to define a function   * The ability to call a function   * parameter substitution   * Some kind of "if" operation that can prevent recursion like "?:".   * Testing operators or functions like "Less than" or "Equals"   * A core library of fundamental functions and operators (+ -...) This implies that you do NOT need:   * Looping   * variables (except for parameters)   * sequential statements This is for a very simple mathematical usage--I probably won't even implement string manipulation. Would implementing a language like this significantly limit you in some way I'm not considering? Mostly I'm concerned about the lack of sequential statements and ability to define variables, can you really do without these "Normal" programming features?


How much technical detail is too much when talking to non-technical managers?

I have a boss that is not very technical. He can write some basic SQL, speak some dev lingo, but all in all not a pro dev. I get into trouble often, by giving him a lot of detail and asking him to make a decision as to which direction he wants to go. For example, recently he asked for a bunch of changes to go into a product. Then took 80% of the changes away saying he is not ready to release these yet. But then, I speak to our lead developer and he tells me to just push it all. This way we avoid having to manually merge code that we do want pushed vs code we do not want pushed (by push I mean move from dev to QA, forward merge). So, the lesson is...do what's easy. Don't tell the boss that you are pushing up all the stuff. This doesn't seem ethical to me, but this is what the solution turned out to be. So, where do I draw the line? Do you feel that hiding details is unethical or just a normal job function of a developer? I ask only highly experienced developers answer this question (10+ years). I know there's skilled guys with less experience, but I want experience to speak in this case, not just skills.


Can the DDD repository modify entity in the DB without an entity object?

Say I have an aggregate root `Entity` with some flags which are represented by an encapsulated object `EntityFlags`:               class Entity     {         /** @var EntityFlags */         private $flags;         ...     }      I have a repository for this entity. My goal is to modify flags in the DB. There are two ways I see:   1. Get entity from the repository, modify flags like `$entity->getFlags()->set($name, true)` and save it: `$repository->save($entity)`.   2. Create an additional method in the repository, e.g. `modifyFlags(EntityId $id, EntityFlags $flags)` I think the first way is redundant. But it also seems wrong to use repository for partial entity updates like in the 2nd way. Which way is the correct one? Maybe I missed something?


Are languages just syntax or do they include the framework too?

In building a language history for Pascal I noticed that at some point languages changed from a strong line between the language and its common libraries to more of a blurry one. In the first few versions of Turbo Pascal there was no capability for reusable modules until version 4 introduced units. Later versions of Pascal had a very powerful collection of common libraries. With the introduction of Delphi it came with the **RTL** and **VCL**. Especially for the RTL, it is often considered part of the language. For example, Exceptions are part of the language, but you need to use the `SysUtils` unit to get proper handling. Additionally there is the built in `System` unit that always gets used in all Delphi projects. Then with Java you have the Java language with the Java run-time and the Java platform. You can't use the Java language outside of the Java platform. Now with .NET we have VB.NET and C# which are languages that don't exist without their framework either, while Phyton, Ruby and others exist both within .NET and without. So my question is, is a Language just the syntax and compiler, or is the platform and framework part of the language too? Where is the line? Why or why not?


Should you charge clients hours spent on the wrong track?

I took up a small CSS challenge to solve for a client and I'm going to be paid on a hourly rate. I eventually solved it, it took 5 hours but I spent roughly 25% of the time in the wrong track, trying a CSS3 solution that only worked in recent browsers and finally discovering that no fallback is possible via JS (like I originally thought). Should I charge the client that 25%? More details: I didn't provide an estimate, I liked the challenge per se, so I started working on it before giving an estimate (but I have worked with him before, so I know he's not one of those people that have unrealistic expectations). At the very worst I will have spent 5 unpaid hours on an intriguing CSS challenge. And I will give the fairest possible estimate for both of us, since I will have already done the work. :) Edit: Thank you all, I wish I could accept more than one answer! I ended up not billing him for the extra hours (I billed him for 3 and a half), but I mentioned them, so that he knows I worked more on it than I billed him for. Maybe that's why he immediately accepted the "estimate" (which in that case wasn't an estimate, hence the quotes).


What is the general definition of something that can be included or excluded?

When an application presents a user with a list of items, it's pretty common that it permits the user to filter the items. Often a 'filter' feature is implemented as a set of _include_ or _exclude_ rules. For example:   * _include_ all emails from bob@example.com, and   * _exclude_ those emails without attachments I've seen this include/exclude pattern often; for example Maven and Google Analytics filter things this way. But now that I'm implementing something like this myself, I don't know what to call something that could be either _included_ or _excluded_. In specific terms:   1. If I have a database table of filter rules, each of which either _includes_ or _excludes_ matching items, what is an appropriate name of the field that stores `include` or `exclude`?   2. When displaying a list of filters to a user, what is a good way to label the `include` or `exclude` value? (as a bonus, can anyone recommend a good implementation of this kind of filtering for inspiration?) * * * ### Edit: My solution Thanks for your answers. I decided that to use **operation** to described an include or exclude. So the database fields and program variables are called operation. I like the name because it roughly aligns with the meaning of operation in set theory. As for how it's displayed to users, I fudged it by never labelling 'include' or 'exclude'. Instead it is always presented as part of a full sentence: ![Mockup](http://img824.imageshack.us/img824/3695/examplerestrictionslist.png) The only label used is 'Restrictions' which I think is more specific than 'Filters'. Our users are ususlly not very technically savvy, so — much as I like the word operation — I decided that displaying a label called 'operation' would be unclear for most of our users. Using full sentences might be a little slower to read, but avoids confusion.


Screen out software engineers with poor communication skills?

Personally, I try to speak and write impeccable English. I try to capitalize proper nouns, get punctuation correct, use parallel form, and employ precise verbiage. (I'm also a fan of the Oxford comma, can you tell?) As a programmer, I put an equivalent amount of effort in the code I write, as code is read many more times than it is written. I pay close attention to style guides, use direct clear idioms, and try to follow recognized best practices. If I were looking for others to work with, I'd be looking for the same. My question is: is careful usage of human language a trait that correlates with better code? If so, could human resource personnel use this to good effect to screen out applicants, or would they be reducing their qualified applicant pool arbitrarily?


Advantages of paid Java Application Servers?

What are the advantages of Weblogic or Websphere over Glassfish or JBoss, since they may reach costs of millions of dollars? Edit: Is there additional functionality? The all are Java EE Full Certified. **The question is about technology, not business or marketing. From the technological POV how are the servers different?**


How do I deal with classes that are only used once, say in only a single function?

I have a class that basically builds up a memory-efficient version of a structure to be used in a performance-critical section of code. The resulting structure is ugly but extremely fast, so not using it isn't really an option, but I also can't use it as the only representation of my structure because it has parts not relevant to the analysis stripped. Did I mention it's also very ugly? Let's call this class `Fast`. I also have the original, pretty representation, let's call it `Pretty`. I have a function called `Process()` which is supposed to take in an instance of `Pretty`, convert it to `Fast` and then do a few million calculations on it and spit out a result:               Pretty pretty;     // do stuff with pretty          // in another hpp:     double Process(const Pretty& pretty)     {       Fast fast(pretty); // create my fast object            // do some processing on fast            return result; // at this point fast dies     }      The instance of `Fast` is created and dies within `Process`, but unfortunately I can't declare a class within a function, so I have to declare it elsewhere. What I would _like_ to do is make the entire class accessible only to `Process`, and not even have it _seen_ by anyone else (just like I would conversely declare a function `private` if the class were the only object that should have access to it). But I can't declare a class private! Here's my current attempt:               class Process     {     public:       static double DoProcess(Pretty pretty); // this is the process function          private:       class Fast       {         // construct fast here (only Process can see this class!)       };     };      And then I just call `Process::DoProcess()`. This isn't really a critical issue so I didn't post it on SO, but it's a style question and I would really like to have a neat solution! I've never come across this issue before and was wondering how others have dealt with it, and if they came up with a nicer solution.


when to use a scaled/enterprise agile software development framework and when to let agile processes 'emerge'?

There are quite a few enterprise agile software development frameworks available:   * Scott Ambler: Disciplined Agile Delivery   * Dean Leffingwell: Scaled Agile Framework   * Alan Shalloway: Enterprise Agile Book   * Craig Larman: Scaling Lean and Agile   * Barry Boehm: Balancing Agility and Discipline   * Brian Wernham: Agile Project Management for Government - DSDM, Scrum and others I've also spoken with people that state that your enterprise agile processes should just 'emerge' and that you shouldn't need or use a framework because they constrain you. **Question 1:** When should one choose an enterprise agile software development framework, and when should one just let their agile processes 'emerge'. **Question 2:** If choosing an enterprise agile software development framework, how does one select the appropriate framework to use for their organisation? Please provide evidence of your experience or research when answering questions rather than just presenting opinions.


How do languages with Maybe types instead of nulls handle edge conditions?

Eric Lippert made a very interesting point in his discussion of why C# uses a `null` rather than a `Maybe<T>` type: > Consistency of the type system is important; can we always know that a non- > nullable reference is never under any circumstances observed to be invalid? > What about in the constructor of an object with a non-nullable field of > reference type? What about in the finalizer of such an object, where the > object is finalized because the code that was supposed to fill in the > reference threw an exception? A type system that lies to you about its > guarantees is dangerous. That was a bit of an eye-opener. The concepts involved interest me, and I've done some playing around with compilers and type systems, but I never thought about that scenario. How do languages that have a Maybe type instead of a null handle edge cases such as initialization and error recovery, in which a supposedly guaranteed non-null reference is not, in fact, in a valid state?


How do I quote a job with PHPUnit?

I've been doing website programming for 15 years and PHP for the last 5 years or so. I've always written solid code. HOWEVER, I have a client that is insisting on 80% of the code being unit tested. Since the client is ALWAYS RIGHT, I am planning on using PHP_CodeSniffer to make sure my code looks right and PHPUnit to do my unit testing. I'm hoping to learn something through this experience. Are these the right tools to use? How much time is involved in setting up PHPUnit and writing the additional code? It should take me around 8 weeks to write the webpages and self-test as I have done in the past. If I add 4 days additional (10%) for unit testing (PHPUnit), is that enough? Thoughts? Suggestions? Thanks.


How should a developer reject impossible requirements?

Here's the problem I'm facing: * * * **Quote From Project Manager:** Hey Spark, I'm assigning you the task of developing a framework that could be used for many different iOS applications. Here are the requirements:   * It should be able to detect the thickness of the thumb or fingers being used to manipulate the UI.   * With this information, all elements of the UI should be arranged & sized _automatically_.   * For a larger thumb, elements should be arranged nearer the center of the screen.   * For a smaller thumb, elements should be arranged nearer the corners of the screen.   * For a larger thumb, all fonts should be smaller. (We're assuming an adult in this case.)   * For a smaller thumb, all fonts should be larger. (We're assuming a younger person in this case.) **Summary:** This framework is required for creating user-friendly user interfaces programmatically. The framework should be developed in such a way that we can use for as many projects as needed, so it must also be very developer- friendly. * * * I am the developer given this task, so my questions are as follows:   * How can I explain that these requirements are a little ridiculous?   * How can I explain that it would be better to concentrate on developing actual projects?   * How can I explain that even if this were possible, I wouldn't recommended developing such a thing?   * How do I say NO to this project politely, gently, and respectfully?   * How can I explain that even for a developer with 3 years of experience, this might not be possible?


Do you need to know Java before trying Scala

I'm interested in learning Scala. I've been reading a lot about it, but a lot of people value it because it has an actor model which is better for concurrency, it handles xml in a much better way, solves the problem of first class functions. My question is do you need to know Java to understand/appreciate the way things work in Scala? Is it better to first take a stab at Java and then try Scala or you can start Scala with absolutely no java backround?


Anonymous function vs. separate named function for initialization in jquery

We just had some controversial discussion and I would like to see your opinions on the issue: Let's say we have some code that is used to initialize things when a page is loaded and it looks like this:               function initStuff() { ...}     ...     $(document).ready(initStuff);      The initStuff function is only called from the third line of the snippet. Never again. Now I would say: Usually people put this into an anonymous callback like that:               $(document).ready(function() {          //Body of initStuff     });      because having the function in a dedicated location in the code is not really helping with readability, because with the call on ready() makes it obvious, that this code is initialization stuff. Would you agree or disagree with that decision? And why? Thank you very much for your opinion!


How to manage a developer who has poor communication skills

I manage a small team of developers on an application which is in the mid- point of its lifecycle, within a big firm. This unfortunately means there is commonly a 30/70 split of Programming tasks to "other technical work". This work includes:   * Working with DBA / Unix / Network / Loadbalancer teams on various tasks   * Placing and managing orders for hardware or infrastructure in different regions   * Running tests that have not yet been migrated to CI   * Analysis   * Support / Investigation Its fair to say that the Developers would all prefer to be coding, rather than doing these more mundane tasks, so I try to hand out the fun programming jobs evenly amongst the team. Most of the team was hired because, though they may not have the elite programming skills to write their own compiler / game engine / high-frequency trading system etc., they are good communicators who "can get stuff done", work with other teams, and somewhat navigate the complex bureaucracy here. They are good developers, but they are also good all-round technical staff. However, one member of the team probably has above-average coding skills, but below-average communication skills. Traditionally, the previous Development Manager tended to give him the Programming tasks and not the more mundane tasks listed above. However, I don't feel that this is fair to the rest of the team, who have shown an aptitude for developing a well-rounded skillset that is commonly required in a big-business IT department. What should I do in this situation? If I continue to give him more programming work, I know that it will be done faster (and conversely, I would expect him to complete the other work slower). But it goes against my principles, and promotes the idea that you can carve out a "comfortable niche" for yourself simply by being bad at the tasks you don't like. **Update**   I've been impressed by the quality and insight of the answers I've received. Though most agree I should work to the individual team members strengths, there's been good debate back and forth. I want to clarify that I'm not trying to address this issue due to a grudge, or that I have a "chip on my shoulder" as was mentioned. I'm looking for advice on how to keep a well-rounded team, which is happy and motivated. By observing the variety of answers to this question, it seems like there are a lot of different opinions on how to achieve this.


What is the purpose of including header files in the solution in Visual Studio?

So I have including the files to my projects by simply : `#include "myheader.hpp"` and adding the headers into the solution explorer. But recently I have realized that I may omit the step of adding the headers to the solution explorer because it does not change anything. The only important fact is to define proper include directories in project properties. Am I missing something here ? Can someone clever explain this to me ?