Can removing unnecessary file from a repo be considered part of refactoring?

We're using Git as our DVCS and we're about to start to do a clean up (never done before in this team) of files that are not necessary (not part of the sources) from our products. This is done in two ways:   * removing the `product` files from the repo and adding them to the ignore list.    * deleting dead code According to Wikipedia: > Code refactoring is the process of restructuring existing computer code > without changing its external behavior. Refactoring improves nonfunctional > attributes of the software. Advantages include improved code readability and > reduced complexity to improve source code maintainability, and create a more > expressive internal architecture or object model to improve extensibility. and from Martin Fowler's entry: > Refactoring is a very specific technique, founded on using small behavior- > preserving transformations (themselves called refactorings). I haven't read anywhere that removing dead code or removing files from your repo are considered refactoring techniques but I see them both as techniques that _"improve source code maintainability"_ by removing irrelevant code that may distract us later on. Do you think it's reasonable to call those two activities "Refactoring"?


How can I reduce the amount of time it takes to fully regression test an application ready for release?

An app I work on is being developed with a modified version of scrum. If you are not familiar with scrum, it's just an alternative approach to a more traditional watefall model, where a series of features are worked on for a set amount of time known as a sprint. The app is written in C# and makes use of WPF. We use Visual C# 2010 Express edition as an IDE. If we work on a sprint and add in a few new features, but do not plan to release until a further sprint is complete, then regression testing is not an issue as such. We just test the new features and give the app a good once over. However, if a release is planned that our customers can download - a full regression test is factored in. In the past this wasn't a big deal, it took 3 or 4 days and the devs simply fix up any bugs found in the regression phase, but now, as the app is getting larger and larger and incorporating more and more features, the regression is spanning out for weeks. I am interested in any methods that people know of or use that can decrease this time. At the moment the only ideas I have are to either start writing Unit Tests, which I have never fully tried out in a commercial environment, or to research the possibilty of any UI Automation API's or tools that would allow me to write a program to perform a series of batch tests. I know literally nothing about the possibilities of UI automation so any information would be valuable. I don't know that much about Unit testing either, how complicated can the tests be? Is it possible to get Unit tests to use the UI? Are there any other methods I should consider? Thanks for reading, and for any advice in advance. Edit: Thanks for the information. Does anybody know of any alternatives to what has been mentioned so far (NUnit, RhinoMocks and CodedUI)?


Why not annotate function parameters?

To make this question answerable, let's assume that the cost of ambiguity in the mind of a programmer is much more expensive then a few extra keystrokes. Given that, why would I allow my teammates to get away with _not_ annotating their function parameters? Take the following code as an example of what could be a far more complex piece of code:               let foo x y = x + y      Now, a quick examination of the tooltip will show you that F# has determined you meant for x and y to be ints. If that's what you intended, then all is well. But _I_ don't know if that's what you intended. What if you had created this code to concatenate two strings together? Or what if I think you probably meant to add doubles? Or what if I just don't want to have to hover the mouse over every single function parameter to determine its type? Now take this as an example:               let foo x y = "result: " + x + y      F# now assumes you've probably intended to concatenate strings, so x and y are defined as strings. However, as the poor schmuck who's maintaining your code, I might look at this and wonder if perhaps you had intended to add x and y (ints) together and then append the result to a string for UI purposes. Certainly for such simple examples one could let it go, but why not enforce a policy of explicit type annotation?               let foo (x:string) (y:string) = "result: " + x + y      What harm is there in being unambiguous? Sure, a programmer could choose the wrong types for what they are trying to do, but at least I know they intended it, that it wasn't just an oversight. This is a serious question... I am still very new to F# and am blazing the trail for my company. The standards I adopt will likely be the basis for all future F# coding, embedded in the endless copy-pasting that I am sure will permeate the culture for years to come. So... is there something special about F#'s type inference that makes it a valuable feature to hold onto, annotating only when necessary? Or do expert F#-ers make a habit of annotating their parameters for non-trivial applications?


observer class as instance

Sometimes I read in oberver-pattern descriptions, to make the constructor of a observer base class protected so the class will be abstract. but by making the constructor public (if even one is neccessary), I could use the observer as an instance and not only as base-class. Is there any disadvantage of doing so i'm not mentioned yet?


What does 'Nightly Builds' mean?

I have been using open source projects for a while and been developing upon the open source applications and every so often I come across the words 'Nightly Build' and I have always been curious as to what it actually means. Does it literally mean the projects are done purely as side projects (usually at night after everyone has finished their day jobs) and there's no true contributor/dedicated development team or is it more complex than that?


Webkit as GUI in .Net/Mono

I want to make a cross platform application, which will also have a website where the desktop applications (Windows, iOS, Linux) will talk to the server and keep the users data in sync. So far the options I see are:   * Write a native GUI for each of the 3 OS, so I would have 3 GUI codebases (and a single backend system)   * Use something like GTK so I can use one system with support in all the mention platforms. But the third which I have not been able to find much info on (maybe I'm not searching for the right terms as I'm still new to C# and .Net), is to have a window with an embedded WebKit instance built in, which would allow me to use the same GUI system that I would use for the website. Which would make the client app and the website look as close as possible to each other so the users are familiar with the interface. Is this last option with WebKit plausible? I already know JavaScript/HTML well and if I can use that knowledge to make the interface, that would be great. Also would be a great way to allow users to customize the interface with plugins and they could keep in sync any UI preferences from local to web.


Is it a good idea to put all assembly: WebResource in the same cs file?

I have a .NET library, with some WebControls. These webControls have Embed Resources.   And we declare them like it, in all webcontrols for each cs file: Something like this:                [assembly: WebResource("IO.Css.MyCSS.css", "text/css")]         namespace MyNamespace.MyClass         {              [ParseChildren(true)]              [PersistChildren(false)]              [Designer(typeof(MyNamespace.MyClassDesigner))]              public class QuickTip : Control, INamingContainer              {             //My code...               }         }      Would it be a good idea to create a cs file and include all WebResource declarations there? Example a cs file with just:                    [assembly: WebResource("IO.Css.MyCSS.css", "text/css")]          [assembly: WebResource("IO.Image.MyImage.png", "image/png")]     //And many other WebResources of all WebControls of the Assembly


Omitting inheritance in programming languages

I am developing my own programming language. It's a general purpose language (think staticlly typed Python for the desktop, i.e. `int x = 1;` ) not intended for the cloud. Do you think it's okay not to allow inheritance or Mixins? (given that the user would at least have interfaces) For example: Google Go, A systems language that shocked the programming community by not allowing inheritance.


How to create view models - Constructor, Factory Method, ...?

I'm trying to lead a charge for re factoring our rather bloated controllers. We currently have a BaseModel from which all our other models inherit. The BaseModel contains things common to all pages, such as the page title, css files needed, current user. Each constructor has a private method to construct a particular ViewModel (essentially a factory method) BaseModel.cs               Class BaseModel {         public string title {get; set;}         public List<String> cssFiles {get;set;}         // More Properties     }      HomeModel.cs               Class HomeModel : BaseModel {         public List<News> LatestNews {get;set;}     }      ExtendedHomeModel.cs               Class ExtendedHomeModel : HomeModel {         public List<RSSItem> Twitter {get;set;}     }      HomeController.cs               public ActionResult Index(int userid) {         return View(MakeExtendedHomeModel(userid));     }          private ExtendedHomeModel MakeExtendedHomeModel(int userid) {         var model = new ExtendedHomeModel();              InitialiseBaseModel(model, userid);         InitialiseExtendedBaseModel(model);              model.Twitter = DomainModel.Twitter.GetLatestItems();     }          private HomeModel MakeHomeModel() {         var model = new HomeModel();         InitialiseBaseModel(model);         InitialiseHomeModel(model);     }          private void InitialiseHomeModel(HomeModel model) {         model.LatestItems = DomainModel.GetLatestItems;     }          private void InitialiseBaseModel(BaseModel model, int userid) {         model.PageTitle = "Home"         model.UserId = userid     }      So, my question is: what is the best way of initialising these kind of base models? As far as I can tell what the constructor essentially does is the factory method, and at the very least it should be moved out of the constructor. However, I'm convinced there is a more elegant way of doing this. The main problem that I see is that the code is thoroughly depended on you calling the initialise methods in the correct order. One idea I've had is to use constructors, passing necessary parameters down the chain as necessary. Are there any pitfalls to this approach I havent seen? (Bearing in mind I've only started asp mvc six months ago). Are there any better ways? Thanks for reading


How to organize repository branches?

I am trying to find a way to organize the branches in my repository in a sensible way. I would like the main branch to contain only "clean" commits: features that are (mostly) complete, no superfluous code that has no role in the current version of the application, etc. I thought that for each feature I should have a separate development branch, and once that feature is complete, it should be merged into the main branch. It this a valid way to organize your repository? Can you recommend a good naming scheme for the development branches? What other ways to organize your repo can you recommend?


When to used static visibility?

I can't attain the primary used of Static Visibility. My question is why they used static method & properties in this code?               class PassHash {              // blowfish         private static $algo = '$2a';         // cost parameter         private static $cost = '$10';              // mainly for internal use         public static function unique_salt() {             return substr(sha1(mt_rand()), 0, 22);         }              // this will be used to generate a hash         public static function hash($password) {                  return crypt($password, self::$algo .                     self::$cost .                     '$' . self::unique_salt());         }              // this will be used to compare a password against a hash         public static function check_password($hash, $password) {             $full_salt = substr($hash, 0, 29);             $new_hash = crypt($password, $full_salt);             return ($hash == $new_hash);         }          }


OO PHP static keyword, should I use it?

I'm writing script for fb and I have 3 objects that I'll be using through all classes. I'm wondering if there is any advantage in using the `static` keyword except I don't have to create an instance every time I need to use a method/object? Which way should I go, with static or without it? I know this is basic, but I'm new to OOP and I want to learn to use it in a proper manner.


What is the biggest trouble developers encounter when debugging?

I just wonder what is the biggest trouble developers encounter when debugging? I can think of three answers but I am not sure whether they are correct:   1. **Trouble in locating the bug?** But most of the times the crash stack traces can provide enough info in locating the bug.   2. **Trouble in figuring out the reason and fixing the bug?** But if you can locate the bug, then probably you got the rough idea of how to fix it.   3. **Trouble in applying the fix?** Probably, some tricky bugs force developers to make changes in a lot of places, thus breaking the structure/design of the original program. But I'm not sure whether this is a trouble.  This question may be too general, but I'll be happy if I can get some feedbacks from you guys. Also, if you have other troubles in debugging please point out. Thank you a lot!


Managing non-domain application behaviour in CQRS

Here's a scenario. I am building _QueueUnderflow_ , a community-edited Q&A site for people who haven't yet grasped the basics of data structures. My users don't like it when people edit their posts so, because I want to encourage as much conflict as possible, I want to send email notifications whenever a user's post is edited so he can log in and insult the editor. I am experimenting with CQRS. I'm not using event sourcing and have a single data store but I _am_ using event handlers to deal with the persistence of any state changes. In a normal N-Tier/CRUD app this might be triggered by an application facade or service layer. In my CQRS architecture, I can see a few options:   1. **The event handler:** I like this idea because it seems that sending a notification email is a concern that could well lie with an independent part of the system that wants to listen for an appropriate time to send an email and then send it, transparent to the rest of the system. I dislike this idea because Greg Young (reasonably) points out in his videos that if I _were_ to introduce event sourcing, this would result in the same notification emails being sent out potentially many times.   2. **The command handler:** This is a more explicit approach that still makes sense to me; however, it seems that the general consensus is that command handlers should just be for coordinating domain objects and not directly performing behaviour.   3. **The domain:** This seems plain wrong. The sending of notification emails is a concern of the application, not so much the domain which is concerned primarily with business logic.   4. **The presentation layer** (or potentially some intermediate application facade that simply hands a command off to its handler and performs other application-specific actions such as sending notifications). The question is - what part of my architecture is responsible for sending emails?


Problems Calculating Big-O Complexity

I'm a complete beginner to Java, only in my second quarter of classes. I'm having trouble understanding our current chapter about calculating big-O for methods. So I thought I was right in saying that the big-O for these two methods is simply O(N), since there is only one loop that loops through the entire list, but apparently they're either O(NlogN) or O(logN). I really can't see why. Can anyone help me understand? 1)               public static int[] mystery1(int[] list) {         int[] result = new int[2 * list.length];         for (int i = 0; i < list.length; i++) {             result[2 * i] = list[i] / 2 + list[i] % 2;             result[2 * i + 1] = list[i] / 2;         }         return result;     }      2)               public static void mystery2(int[] list) {         for (int i = 0; i < list.length / 2; i++) {             int j = list.length – 1 – i;             int temp = list[i];             list[i] = list[j];             list[j] = temp;         }     }      These aren't homework problems, they were on a test I just took and miserably failed since there were only 4 questions and these two were wrong. I just want to understand why these two aren't O(N) complexity (professor won't give out the answers since someone hasn't done the test yet). These questions were taken straight from the book for the test... which is why I was confident I was right since I had done them already. It was a multiple choice test, and the only options were `a)O(1) b)O(N) c)O(logN) d)O(NlogN)`.


handling rules applied to a set of checkboxes, radio buttons or form fields

I've been wondering about applications that have a set of checkboxes or radio buttons, even collections of form fields in their UI. At this moment I'm handling all the choices separately but of course this becomes a complete mess very quickly. There has to be an established way to deal with this that I don't know of. _If check box a is unchecked then check boxes d through e are enabled_ etc. etc. How should I be approaching this? Not in the UI of course, that's for sure. I would love to hear some insights and best practices as well as potential pitfalls. (BTW: I've tagged this "rules-engine" because I haven't got a clue what to tag this. Please feel free to edit the question, retag and remove this line.)


Feasibility of continuous delivery with a mixture of development platforms

What are the major obstacles (and potential solutions, if known) for implementing "continuous delivery" software development when an application relies on varied programming languages or modules... especially when the same version-control and/or automated testing packages do not exist for those disparate platforms? For example, a **Java web application** that is deployed and running on a **Linux** host, talking to a **DB2** database back-end via **JDBC** , with occasional calls to stored-procedures that wrap **RPG** or **COBOL** or **C** programs on that same back-end? What if the code for all of that cannot be contained in **the same version-control/source-control system**? **Is it possible to get to the illusive "push-botton release" in this situation? Or do you have to have EVERYTHING in the SAME VCS?** Additionally, how would one manage the creation/modification of database schema, and so- called soft-code control values in the database? **Is there a more-or-less "canonical" published work on this type of thing?**


System Requirements - Use of Conjunctions

I have come across many blogs and books where it is stated that it is bad for a system requirement to contain conjunctions like "and". However in reality I am often coming across scenario where a requirement is satisfied when a certain set of conditions are met. For instance, Shopkeeper should sell alcohol only if the buyer is older than 18 years, he has the necessary proof and he does not have any alcohol related problems. The requirement would not be complete if I break it down into multiple system requirements and I cannot complete the requirement without use of "and".


What happens during "loading" screens?

I'm from the AS3, JavaScript, and similar "web languages" where _loading_ means the code is being downloaded from the server, and can't run reliably until enough has been fetched to the user's computer. However, what happens during a _loading_ screen in software and games in which all the information already exists on the user's computer? (especially now that the information can be stored on a "quick to read and write" harddrive, rather than slow floppies or CDs) Does this differ from the _loading_ pauses that sometimes may occur in the middle of a game?


Will you consider a Software Team Lead position with previous employer

Say you left your previous employer about 3.5 years ago to pursue a growth opportunity, my primary motivation for moving. If a position currently opens up in that same company today for a Software Team Lead, would you:   1. Apply for this position, if you still have a lot of good relationships    2. If you would apply and can speak to the Engineering Director, who did all he could to keep you, would you call him to discuss about their needs and your interest? If not, how would you go about this? As the Engineering Director, would you consider this candidate for Software Team Lead who left you 3 years ago despite all you tried to do to keep him, knowing that this guy has a tendency to seek opportunities for growth every 3-5 years? Yes, this person meets all of the requirements and has the potential to be a good leader.


How to approach program design with respect to data strucutres and algorimths - is there an equivelant of the OO design process for d.s.'s + algs?

My applogies for probably the worst written body of text I have produced in my life and many thanks to those willing to plough through it all. I was (and still am) not able to clearly express what I was asking for, since by the nature of my question I cannot be clear about what exactly it is I am after. Fundementally I strongly suspect something in my knowledge of software development is missing, but because "I don't know, what I don't know", I cannot specify what exactly I am looking for (and indeed can't be sure whether such a thing exists) - hence I suppose I am asking for some direction in this matter. I kind of thought if proffessional developers did not know of/ did not use such a thing in the process of desingin code - then there is nothing to know in this respect (and I can stop worrying). Essentially I fear something akin to having learned to program, but having remained unaware of the subject of proper OO software design. I have studied standard data strucutres and algorithms (to the extent of coverage found in typical undergraduate text books), but can't help feeling that there should be something more. I hence can't help feeling like I've learned the very basics, but not become aware of the data structures and algs. equivelant of OO design. In essence I sort of imagine there is some "process" to solution design (in the context of the d.s.s and algs. side of programming - like there is to the OO design side of coding software - I see them both as being part of the same whole in programming) that informs one about how to go about the task of writing "good" code (in the d.s. and algs aspect of the program code written). I fear in absence of knowledge of such a process/ subject, I would be incompetent as a graduate developer (rather like I would consider a new employee, if his code turned out to be uninformed by the OO design process/ principles). I would consider the code produduced by someone lacking in knowledge of OO design principles/ processes to be "bad code" - and hence him to be incompetent. At the moment I fear my knwolege with respect to the d.s. + algs. side of coding puts me in a similar position. Thus, can anyone tell me what I might yet need to be aware of in this respect? (Another way of putting my question might be if I were to say: "Object Oriented design principles and patterns, is to programming, what "...", is to data strucutres and algorithms". Could anyone tell me what one might complete this sentence with, or whether there is nothing to consider here)


Where is interface between button click and event raising defined

When I click on button, might be in windows apps, web apps, etc it has some animation to actually see it clicked and event is raised in background. I've knowledge of events and its attaching to button click events but I wanted to know how this mechanism works. I always assumed it is inbuilt in operating systems.


How do I license my software under a free license?

I wrote a number of NodeJS modules (some of which are actually good, in my modest opinion). I basically forgot to set a license for them. I would like to pick the AGPL (Affero GPL). How do I do that? Can I just get away with a LICENSE file in the project? Or do I need a license disclaimer in every single file in the project? What about CSS?


How can I get started writing code?

I am currently learning Java in college. I have noticed a problem I have when I am starting to code to solve problem. The problem is that I don't know exactly how to start. For instance, if I try to think about the question and a way of coding the solution then I always say to my self "what about this case.. and this case..." and don't know where to start. So my question for people with experience in programming, is how do you start?   * Do you think about a solution for all the cases first, then start to write the code?   * Or maybe first you try to write the steps in your own language and then go and write the code?    * Or maybe you go ahead from the start, start typing some code and at the same time think about all the options and fixing and changing what you wrote?


Why were magic methods implemented in C#?

In C#, I started seeing all these magic methods popping up, without being backed up by an interface. Why did Anders Hejlsbjerg (or whoever is in charge for C# development right now) choose this? Let me explain. Previously in C#, if an object implemented the `IEnumerable` interface, it would automatically be iterable by a `foreach` loop. That makes sense to me, since it's backed up by an interface, and if I were to have my own `Iterator` function inside the class being iterated through, I could do that without worrying that it would magically mean something else. Now, apparently, (not sure when), these interfaces are no longer required. It just needs to have the right naming conversions. Another example is making any object awaitable by having a method named _exactly_ `GetAwaiter` which has a few specific properties. Why not make an interface like they did with `IEnumerable` or `INotifyPropertyChanged` to back this "magic" up statically? More details on what I mean here: http://blog.nem.ec/2014/01/01/magic-methods-c-sharp/ What are the pros and cons of magic methods, and is there anywhere online where I can find anything on why these decisions were made?


Client will not pay after software project is complete

I've recently left university and this was one of my first freelance projects - the first one to become a nightmare. The project was to build a highly custom e-commerce system for a restaurant. However, being inexperienced, naive and stupid, we had a verbal contract, not a written one. The client is currently withholding pay on the grounds that I have not completed the project. The problem is, what we agreed to on the day the project began is now only a **shadow** of what the project has actually become. I've graciously added many modules and features to the system free of charge, and he will not stop adding features saying that the project is not complete (even though all the features from the beginning of the project are present and then some). I think his main rationale is that his original idea did not suit his business, so he wants to keep changing it and that it is my responsibility to make it work. To make matters worse, the client refused to give me a budget at the start of the project even after I asked several times to his face. So, stupidly I decided to give him a **massive** discount hoping that he would agree to it at the completion of the project as he would not talk about price at the beginning. However, when he received my invoice he said it was "too expensive", which shocked me and I couldn't sleep for several days. Btw this was just a few hundred bucks for a complex custom e-commerce system. Yes I know I was stupid, but do I have _any_ legal basis at all? Is there anything I can do in the court of law? Or is it in my best interest to cut the client loose, not do anything more for him and count my blessings?


Promoting ecology and/or sustainability as a programmer

A seemingly odd question, but here it goes. Say that a potential client asks that a certain level of ecology and sustainability is to be respected before they will consider your company for a web site project. How would you go about meeting this requirement?


Career in robotics

I need advice on how to get a job in Robotics. I got a rejection when I applied in IRobot or some company related to Robotics. I am a international student. I have a masters in Artificial Intelligence and Bachelors in Electrical and Electronics engineering. Master's thesis is based on using machine vision in solving marine science problem. I made few robots. Two of them are, Hexapod walker and fire rescue robot. I am comfortable with C, Prolog and MATLAB. Can someone suggest me where I am going wrong? I want to develop career in robotics.


Implementation of XML templates in asp.net mvc and asp.net applications?

Open Google blogger uses XML templates for blogs. I want to implement same kind functionality in my asp.net mvc and asp.net applications. We can use master pages and themes in asp.net applications but I need to use XML templates same like Google Blogger uses. This question is in continuation to my previous discussion : link text


When should you call yourself a senior developer?

> **Possible Duplicate:**   >  Whats the difference between Entry Level/Jr/Sr developers? I'm curious what senior developer means because apparently the definition doesn't mean what I thought it would. I keep seeing these teens at 22-23 years old who call themselves senior X developer or senior Y developer. To me, a senior must have 10 years or so experience in programming to call himself 'senior'. I've seen a lot of these teens here (hence the question). Am I wrong? Why?


What can a senior programmer do that a junior can't?

> **Possible Duplicate:**   >  When should you call yourself a senior developer? I often see offers for senior programmers and the rule of thumb seems to be that you need to have worked three years to become one. Duration doesn't mean much so what exactly is expected of a senior programmer? What should he be capable of doing? As an added question, when does a developer cease to be considered as a junior?


What's the difference between Entry Level/Jr/Sr developers?

Other than title and pay, what is the difference? What different responsibilities do they have, how knowledgeable/experienced are they? Basically what would you use to determine which one you (or someone else) should be?


What's the difference between junior, middle, and senior developers?

> **Possible Duplicate:**   >  Whats the difference between Entry Level/Jr/Sr developers? There seems to be three common java programmer qualification levels:   * Junior   * Middle   * Senior What makes a programmer "junior", "middle", or "senior"? Does it mean the the programmer has a specific amount of certifications or job expertise? How do IT companies decide what title to give to a programmer?


How long will an MS certification exam stay on my transcript?

I seem to remember reading/hearing that an exam will drop off your transcript after a year if you haven't taken further exams to complete a particular certificate. If it matters, the test in question is **70-536** : Microsoft .NET Framework - Application Development Foundation **Edit** : In case it isn't clear, The exam I've had drop off in the past was an older exam - for .Net 1.0 or 1.1. I now have the 70-536 exam on my transcript - just wanted to make sure I had plenty of time to find the motivation to finish up a cert.


Architecture suggestions

I'm writing a small application that will reset the entire “environment” consisting of various machines and applications. Machine names are added via config file - this is read, the appropriate services are stopped and log files deleted. My problem isn’t how to do this (its already working) a bit more elegantly, but due to my lack of experience, I'm curious of the proper architecture. Right now I feel it’s a mess, large blocks of code, in 5 different classes (delete, processes management, etc) and I would like to make this available for others to enhance. For example, Ive been thinking about breaking up the DeleteLog class into separate classes by machine, adding and interface and programming each of them to the interface (Strategy Pattern?). I've also contemplated using delegates (to which I'm very clueless, but it's always a good time to learn).


Best way to model a singleton in a relational database

When designing relational database schema for web applications, I often find a case where I end up creating a table just to contain one row, and only one row. It feels like that is the wrong way to design it, but I can't come up with anything significantly better, or that is obviously "the right way to do it." A recent example is a site that let the users manually control content on the home page. Well, there's only one home page. I created a table that had all the necessary fields to build the homepage, such as a text field for an area that contained descriptive text. A field to store the name of a big image file. Some foreign keys that point to articles that will be featured on the homepage, etc. It works, but it feels wrong to have a table with just one row. In the past I've tried many other designs, such as allowing multiple rows in the homepage table and selecting one at random. I've tried adding a boolean field named "active" and selecting one of the active homepages at random. I've tried forcing only one row to be active at any given time in the application logic. I've tried not even making a homepage table and having all the other items, such as articles, to have boolean fields with names like featured_on_homepage. In most cases I could build the homepage with a bunch of constants in a settings file. The main problem with the settings file is that it is under developer control. Because something like the contents of the homepage is something to be edited by the user, it has to go in the database. On many sites, I don't have this problem because I can build things like the homepage with a query such as selecting the five newest articles. But when I have pages that are manually curated with strict requirements, it becomes tricky to model it in the database. But imagine you've got a photo table and an article table. The requirement is that the homepage will display exactly five photos, exactly three articles, and two blocks of arbitrary text manually controlled by the user. How do you model that in the database the right way? Also, I have this modeling problem in many other cases besides just homepages. It's just the easiest and most generally applicable example I could come up with.


Reason to use mingw win32 headers and libs with LLVM/Clang

Is there any good reason (except "GCC is better") to use the MinGW win32api/headers/libs with LLVM/Clang. Suppose that in two to three years, Clang has matured enough (in C++0x and performance) that it's a competitor/replacement and has its advantages over MSVC like GCC does on some accounts. Why on earth would one want to avoid using the MS library and header implementations of the win32 API, which is freely available in the form of the Windows SDK?


Separating php and html code

What is the industrial practice on how to separate html and php code in a web project? Using echos to generate html is considered bad but what is the standard way to achieve the sought separation? Using template engines like twig?


Version Control on Windows Home Server

I'm a lone developer and am thinking about version control now. I don't particular want to pay for an online service if I don't have to, so I was thinking about using Windows Home Server as the location to manage versions. Has anyone done this before? Are there WHS plug-ins for this (I can find any based of searching the big G and big B)? If not, any recommendations for a super simple server side product that runs on x64 WinServer 2008? All I need is to commit changes about once per day right now, and maybe fall back to an earlier version about once a month. Eventually, I may bring on another developer who is remote, but would have access to WHS with credentials. Tools are VS 2010 and WHS Vail.


ASP.NET MVC 3 (C#) Software Architecture

I am starting on a relatively large and ambitious ASP.NET MVC 3 project and just thinking about the best way to organize my code. The project is basically going to be a general management system that will be capable of supporting any type management system whether it be a blogging system, cms, reservation system, wikis, forums, project management system, etc…, each of them being just a separate 'module'. You can read more about it on my blog posted here : http://www.ryanzec.com/index.php/blog/details/8 (forgive me, the style of the site kinda sucks). For those who don't want to read the long blog post the basic idea is that the core system itself is nothing more than a users system with an admin interface to manage the users system. Then you just add on module as you need them and the module I will be creating is a simple blog post to test it out before I move on to the big module which is a project management system. Now I am just trying to think of the best way to structure this so that it is easy for users to add in there own modules but easy for me to update to core system without worrying about the user modifying the core code. I think the ideal way would be to have a number of core projects that user is specifically told not to modify otherwise the system may become unstable and future updates would not work. When the user wants to add in there own modules, they would just add in a new project (or multiple projects). The thing is I am not sure that it is even possible to use multiple projects all with their own controllers, razor view template, css, javascript, etc... in one web application. Ideally each module would have some of it own razor view templates, css, javascript, image files and also need access to some of the core razor view templates, css, javascript, image files which would is in a separate project. It is possible to have 1 web application run off of controllers, razor view templates, css, javascript, image files that are store in multiple projects? Is there a better was to structure this to allow the user to easily add in module with having to modify the core code?


Can only integers be stored as register variables?

I am confused about this: what type of data can we store in register variables? I guess logically we can store any kind of data as register variables because they are variables, but really I am confused. I have tried to search on internet and in my book. I couldn't find the answer. By book I am referring to ANSI C's programming book.


How can I manage changes between a local config file and a remote config file in a mobile application?

I have an application with a configuration file that is stored in the application bundle. This config file stores the names of images on a remote server. Whenever the application is started, I download the configuration file from the server and see if there are any changes or updates. If there are changes, I iterate over the array of configuration settings and download the changed images to the user's iPhone I think that I will first list all of the name changes in an array, and after that start loading that changed images. However, I'm wondering if there is a better approach to solving this problem.


Basic design of a data access layer using the DataMapper pattern

I'm trying to understand the DataMapper pattern by implementing it myself for one of my domain objects. So far, I have:               class MyDomainObject       <attributes>       <business logic methods>          class MyDomainObjectMapper       save       update       delete       get      Now, I need get many `MyDomainObject`s. These could possibly be held cached in memory (saving many calls to the database). There could also be filter conditions. Where does this functionality go, according to the pattern? I'm not sure if I should add methods to `MyDomainObjectMapper` or create a new class.


How to handle status integers from database in object oriented code?

Consider a database table of Items that have a status flag represented by an integer. A few of the status might be:               0 - Past Storage;     1 - Current Inventory;     5 - Scrap;     6 - Rework;     15 - Processing;      Now, I would like to avoid passing and querying for 'magic numbers' in my code, and in the past I have used a Dictionary to accomplish this, but this approach seems less elegant than what I hope to accomplish. How are these types of status flags retrieved from a database handled in object oriented code? Is it with enums, and if so, how? Or is it better to create a separate table with the status flag as the primary key?


Referencing external javascript vs. hosting my own copy

Say I have a web app that uses jQuery. Is it better practice to host the necessary javascript files on my own servers along with my website files, or to reference them on jQuery's CDN (example: http://code.jquery.com/jquery-1.7.1.min.js)? I can see pros for both sides:   * If it's on my servers, that's one less external dependency; if jQuery went down or changed their hosting structure or something like that, then my app breaks. But I feel like that won't happen often; there must be lots of small-time sites doing this, and the jQuery team will want to avoid breaking them.   * If it's on my servers, that's one less external reference that someone could call a security issue   * If it's referenced externally, then I don't have to worry about the bandwidth to serve the files (though I know it's not that much).   * If it's referenced externally and I'm deploying this web site to lots of servers that need to have their own copies of all the files, then it's one less file I have to remember to copy/update.


Is Web application a Web service?

According to W3C: > Web service is a software system designed to support interoperable machine- > to-machine interaction over a network. It has an interface described in a > machine-processable format Web application conforms to this definition. Its interface is HTTP. So can web application be called web service?


Visual Studio 2012 - Express vs Professional

I'm having trouble finding a feature comparison between Visual Studio 2012 Express Edition and the professional edition. I'm using the trial Professional version at the moment, but it'll run out soon, so I need to make a decision whether to purchase the full version. Obviously, I can just try both initially and see if the Express edition is suitable, but the problem is that there are that many features in Visual Studio, there might be a really useful feature that was missing in the standard edition that I didn't even know existed! Or I didn't spot it was missing until later down the line. I could really do with a feature comparison list like the one for all non-Express editions here. It's a shame that page doesn't include the Express edition.


Which way is practical for improving your skills with pet project?

About your own project, in which way does it give you more improvement?   1. Read high quality code in the same domain, implement your own.   2. Write one project from scratch with your imagination. My point is that it is not practical to write something like networking lib or graphic engine without knowing what other people did in the same domain.


job interview question(s) for the interviewer(s) php and Oracle 9i

I have a job interview coming up at a small, 'family atmosphere' type of place running on php and Oracle 9i. I've prepared as best I could, but I'm struggling to come up with questions for 'them'. So far I got > How do you integrate a new developer into your work flow? Other than that I've got some canned questions courtesy of Google. Thanks in advance and my apologies if this is a duplicate question.


Mix three different licenses for an open-source software

I am currently working on a money tracking/invoice creation app that I intend to release for free. The app can be broken down to three parts:   * The Framework, a generic, all-purpose collection of classes (php/mySQL)   * The app itself (php/javascript)   * The design (images) I am trying to find licenses that fit three different purposes:   * I want to release the framework under a license that specifies that      * The framework is open-source, free, and cannot be sold     * However, the framework **can** be used in commercial products, as long as no author names are removed from the code and the framework's source is available (a link to my sourceforge in the about page will do...Even little, hidden in a subpage, or in the FAQ, as long as people really looking for it can find it).     * Code that uses my framework _doesn't_ have to be open-sourced. I don't want to stop people from releasing non open-source, commercial products. Too many times I have been blocked by this when working for a client, I don't want to inflict the same problems on the community. Furthermore, I will surely use my framework myself for closed-source projects for clients.   * I want to release the app part under an open-source, free license that disallows any attempt to sell it (but allows forks, as long as they stay open-source and free)   * I want to release the design (icons, backgrounds) under a free license for non-commercial projects only. Additionally, If it is possible (if such a license exists), I would like to remove all constraints, even for commercial products, as long as the project is led by a one-man (or a one-woman) team. In other words, I'd like freelancers to be able to fully enjoy complete freedom, but have some restrictions for companies. It might be worth mentioning that although the framework is totally custom code, the app will contain some third-party, namely jquery, and maybe some other javascript components. I am aware this is a very specific question that doesn't necessarily helps the coding community, just me, but I don't know where to turn to.


Open Source Client-Based Project Management?

For quite some time I've been searching for a web-based, open-source project management program that I can run on my rented space at Dreamhost to track client projects. dotProject seems nice, but I've never figured out how to create projects that only certain people can access. I'm usually working on two or three projects at a time for different clients, and would like to be able to allow access for each client to their project but not others. So, first of all, can anyone point me to how to do this in dotProject, and baring that, can anyone recommend an open-source solution to this problem?


Agile methods and Databases at the start of the project

New to agile and I'm not sure how to start. The idea is to create small parts of the project in sprints. However the project I'm working of requires a database and the database must be almost functional to do anything with the project. So how do Agile projects handle this, do you start by creating the database? How would you do so, for example if using Scrum how would you do the user stories and test the db. Would you rather do parts of the db in a story that also requires code. Say you have a story that is "As a user you must be able to register..." you would create the user table in the database as a part of this story? How can agile help you design the database?


Data services methods naming

When you work with ORM which implement UnitOfWork pattern (NHibernate's Session, Entity Framework's ObjectContext, etc.), there are two types of data services methods: those which save/commit changes and those which just modify model properties. In some time it becomes difficult to support this mess: when you call a method you are not sure, whether it will save changes or not (if it doesn't you need to do it in some of outer methods). How can I solve this problem? The only idea I have is a special naming. For example, AddCustomer for saving method and FillForAddCustomer for non-saving method. Any other ideas?


How do I respond to incoming network messages in a way that achieves loose coupling?

I'm working on a client-server sort of protocol right now in Ruby. I've hit a snag where I'm not entirely sure how to proceed. Currently, I have a class, `Remote` that signifies a remote connection (for use through EventMachine). When `Remote` receives a message (i.e, network packet), it sends it off to the `MessageDecoder`, which returns the decoded message in a hash, like so (pseudo-code ahead)               { source = <the_remote_connection>,       message_code = 1, // An operation code that indicates how to respond to this message       payload = {         packet_specific_key = packet_specific_value // provided by the decoder       }     }      So, when I get this back from `MessageDecoder`, the `Remote` ships it off to its `ConnectionListener`, which needs to decide how to distribute that message across the application. Here's the issue: Each message might require a different scope of variables. For example, one might require the instance of a `World` object that the `ConnectionListener` doesn't know about (and rightfully shouldn't - the network code should not be coupled to the rest of the program) So my question is: how can I implement a loosely-coupled system for distributing the reception of network-ignorant messages from a remote connection in my application that somehow magically retains scopes? EDIT: For comments, example. Let's assume I have a `World` object. The `World` knows about the entities within it - rocks, trees, you get the general idea. So, a command comes in from the `Remote` saying `:DestroyRock` \- which should invoke `World#destroy_rock`. The `World` should not know **where** the command to `:DestroyRock` comes from. It should just know that `World#destroy_rock` was invoked on it. The issue is, I need some way of finding a middle-man between `ConnectionListener` and `World#destroy_rock`. `ConnectionListener` **definitely** should not be aware of the `World` object, because if it is, that means I've now coupled my **network** code to my **gameplay** logic.. woops. That's pretty bad.


How do I handle merging code that hasn't been merged in ~3 years in an agile manner?

Our team has recently adopted agile practices and most of the team is new to agile. In our product, we use some code developed by another team and only they maintain that code. For the last 4-5 years, the previous developers have merged the code they intended to use and not all of that. Over time, the code in our branch was customized as well. Now for 3 years, these code bases have not been merged. We are expecting a lot of changes and manual conflict resolve process to perform a merge, as all of us are new to this code and also the code has been out of sync for long time. How should we approach this kind of task/story in Agile way? Is there any guidelines to approach such unclear task where uncertainty is very high and we do not know how many conflicts/bugs will come out? EDIT:1 please bear with me if question is not clear, let me know in comments and i will try to clarify as much as possible. So lets me try one more time. As a AGILE team what I (and team) has learn so far is, before 2 week sprint starts, we discuss requirements with PM, understand the work needs to be done, finalize the approach for any DB design if and then two week sprint starts. in the middle one day we also do another PBR session where any new concern's can be raised for current sprint or we just continue understanding new stories for next sprint. On the last Day of Sprint we do Sprint Demo, and next Day Sprint Retrospective. Recently I came to know word Spike. many AGILE teams use the Spike as a 2-3 days of period between sprints either at the end of sprint to finish up minor remaining task and do not need to carry the whole stories to next sprint. Or Sometimes in the beginning of sprint to finalize the design/approach or to flush out Proof of concept kind of thing. When I (team) saw this code merge task, we are like there is no way we will be able to break down this story to confined task as 90% of things are unknown. we do not have automate test around the code, we haven't merge this code before and again this is a Baseless merge on SQL side. what ever we estimate there are highly chances that we good amount of task may remain incomplete. now in retrospective this will become bad on team. and such task can disturb team velocity as well. **So My question is How other people include such task in there AGILE team. Does this really be executed as SPRINT? or this should be one time effort by team and not logged on AGILE board? In a way i am looking for guidance on how AGILE allows to execute such task. If not Sprint is there anything else ?**


Is is preferable to design top down or bottom up?

As I understand, top-down design is by refining the abstract high level concept into smaller concrete and comprehensible parts, until the smallest building block is defined. On the other hand, bottom up defines low level parts, then gradually build up higher level blocks until the whole system is formed. In practice, it is said best to combine the two methods: starts with high level specification to fully specify the domain knowledge, its relationship and constraints. Once the problem is well understood, smallest building blocks are created to build up the system. The process of:   * Creating requirement spec   * Create a design spec (with diagrams)   * Implement   * Deliver   * Repeat (in iterative development, rather than doing a whole chunk in each phase, we do a little bit each repeatedly, and got daily meeting to adapt to customer's dynamic requirement) looks perfectly normal to me (with specs as plans). It has its flaws but that's why we got iterative development: instead of spending time on one phase, says, requirement analysis to study every possible thing in domain knowledge which is subjected to changes (possibly daily), we do a little bit of analysis, a little bit of design and then implement it. Another way is that each iteration is a mini-waterfall fashion, where analysis is done in a few days (or a week). The same applies for design. The rest of time is spent for implementation. Is there something inherently wrong with top-down approach in combination with iterative development? In his essay Programming Bottom Up, Paul Graham seems to encourage build from bottom up completely, or program it from bottom up, but not the requirement analysis/design phase: > Experienced Lisp programmers divide up their programs differently. As well > as top-down design, they follow a principle which could be called bottom-up > design-- changing the language to suit the problem. As far as I get, what he meant is that Lisper still performs top-down design, but program bottom up, is that true? Another point he wrote: > It's worth emphasizing that bottom-up design doesn't mean just writing the > same program in a different order. When you work bottom-up, you usually end > up with a different program. Instead of a single, monolithic program, you > will get a larger language with more abstract operators, and a smaller > program written in it. Instead of a lintel, you'll get an arch. Does this means that during the period of writing a program in Lisp, you end up with a generic tool?


Mastering a programming language by not programming?

The computer scientist Peter Norvig argued in his essay Teach Yourself To Program in 10 Years that you need about 10,000 hours of practice. But Jeff Atwood argued in his post How To Become a Better Programmer by Not Programming that he believes _the only way to become a better programmer is by not programming._ These articles are in opposition. Is there a scientific evidence to prove the Jeff Atwood approach?


How to write a syntax checker

How is a syntax checker for a programming language written? I am guessing a grammar has to be written first. How to then proceed? **Motivation** I'm using a programming language (Apex for Salesforce) that is compiled in the cloud and a list of errors is sent back to the basic Eclipse editor. I'd like to skip the process for simple typing mistakes and just check for them locally.


Can anybody recomend a good SEO book?

Im currently developing a ASP MVC site. Is there any book out there for ASP MVC SEO or just SEO in general?


TDD Mock call verification - is it an anti-pattern?

I've been doing TDD for year now, I feel pretty good about it, I love my test suites and all. However I've noticed that lately I've been doing a lot of mock call verification. For example I'd have a Service that will have a Repository injected - in my unit test I'd pass a mock of the Repository and verify that it was called within the method that I'm testing. I'd then check if the results returned are correct (in another test). This definitely "feels" wrong, since my unit tests are now very coupled to the implementation details. I've heard that you should test "behavior", however in a lot of the situations that's ... emm - not possible ? If you have a `void` method for example, you usually test side-effects. I mean it's easy to go ahead and show some simple code-kata's where this can be demonstrated, but IMHO it doesn't reflect very well to the real world programs that we write. Is what I'm doing wrong? Is this type of testing sort of an anti-pattern? I'd appreciate your opinion on this, I'm still a bit of a newbie when it comes to TDD.


What is better: multiple sql entries or one sql entry with a list field?

Suppose that I have the following logical information: (tag_name, id). For example: (food, 1),(food, 2),(food, 3),(drink, 1),(drink, 2) I'm trying to decide what is the best way to store it in a database. I can simply use a (STRING, INTEGER) table like in the example, or a more compact (STRING, INTEGER_LIST), like so: (food, [1,2,3]),(drink, [1,2]). This method is definitely more compact, but the other method seems more trivially flexible (for example, I can do a join by tag_name or id with another table, and I don't need to parse the results of my SQL queries). Which method is better, and why? Is the redundancy of the first method overwhelmingly wasteful, or are SQL databases smart enough to figure out efficient storage for that? Is the post-query processing that the second method needs (like checking if an id is already associated with a tag before adding it) more expensive than putting this burden on the database in the first method?


> **Possible Duplicate:** > > What is enterprise software, exactly? > > What does “enterprise” means in relation to software architecture? What makes a component or product "enterprise" software vs non-enterprise ready? Is it difficult to use? Is it support contacts? Is it reputation? Is it a level of testing? Is it integration support? Is it marketing? Is it the focus on the customer of the product? What makes a piece of software "enterprise" software, rather than something that is for general consumption? For example, Derby DB is for developers, and small apps, but it's not an "enterprise database".


RESTFul: state changing actions

I'am planning to build RESTfull API but there are some architectural questions that are creating some problems in my head. Adding backend bussiness logic to clients is option that I would like to avoid since updating multiple client platforms is hard to maintain in real time when bussiness logic can rapidly change. Lets say we have article as a resource ( api/article ), how should we implement actions like publish, unpublish,activate or deactivate and so on but to try to keep it as simple as possible? 1) Should we use api/article/{id}/{action} since a lot of backend logic can happen there like pushing to remote locations or change of multiple properties. Probably the hardest thing here is that we need to send all article data back to API for updating and multiuser work could not be implemented. For instance editor could send 5 seconds older data and overwrite fix that some other journalist just did 2 seconds ago and there is no way that I could explain to clients this since those publishing an article is really not in any way connected to updating the content. 2) Creating new resource can also be an option, api/article-{action}/id , but then returned resource would not be article-{action} but article which I'am not sure if this is proper. Also in server side code article class is handling actuall work on both resource and I'm not sure if this goes against RESTfull thinking Any suggestions are welcomed..


What is the logic for setting the version numbers in an app?

I would like to know what's the logic for setting the versions in an application that you're developing? I mean from 1.0 to 1.1 or 1.7 to 2.0


Associativity in C

int i = 2*5/2;      int j = 2*(5/2);      printf("%d\n,%d\n",i,j);      **Variable Associativity** : when I run this program, the first statement gives me `i = 4;` Shouldn't it give me 2, because according to BODMAS rule `/` is evaluated before `*`, so the variable should have been evaluated as `(5/2)=2` and then `2*2=4`? I know this is a noob question, but this never fails to surprise me.


Solutions for iOS collaborative sync (iCloud CoreData, CouchDB)?

I'm developing an iOS app where one of the features will be allowing users to share and collaborate on data (e.g. lists). From everything I've read and based on the way that iCloud CoreData sync works I assume that it would not be a good fit for the following reasons, but I wanted to make sure I wasn't missing anything, as I'd prefer not to use a 3rd party syncing solution if at all possible:   * iCloud sync of any kind (CoreData, Document or Key / Value pairs) can only ever be between devices that use the same iCloud account, so it's designed for a single user syncing data over multiple devices. Any kind of collaborative sync (several people editing the same document / list) simultaneously would be limited to everyone have the same iCloud account. Cases of people sharing the same iCloud account is usually limited to, for example, husband and wife or similar close relationships for a small number of people.   * iCloud Core Data sync is for ensuring that each sync'd device has the same data. It doesn't seem to allow syncing just a subset of the data, so scenarios in which each user has their own documents and is only sharing / collaborating on a subset of them are not supported. And I'm not even mentioning the well document problems with iCloud CoreData syncing which may or may not have been resolved with iOS 7. Given the above, it would seem that CouchDB (with TouchDB) would be a better option, as it seems to support everything I need. What other options are there that people can recommend? **UPDATE:** Since posting this I've done more research and discovered that CouchDB as it stands would not be a good solution. Its filtered replication feature seems like it was made for syncing only a subset of data (e.g. data for one user) to a mobile device from a central server database that has all users' data on it. However, it's not a workable solution for both performance and security reasons. The guys at Couchbase are working on solutions for this, but they are all in early alpha stages. For a solution that doesn't involve creating your own backend, the options seem to boil down to Simperium, Parse or something like Windows Azure mobile services. Of these, the only one that supports real time push sync (no need to refresh or poll for new data) seems to be Simperium. The one downside to Simperium is that it doesn't support binary data (eg images).


How should I arrange my javascript files?

I think this is best described using an image.   ![enter image description here](http://i.stack.imgur.com/d48nw.png) So it dawned on me that perhaps this isn't the best or most logical way to organise files.   The way it is currently, as you can see is just a dumping ground. The only reason `complexify` has it's own folder is that it's a submodule in Git. So should I be using a `/lib` folder with `jquery` & `jqueryui` and perhaps a `/plugins` with all the plugins in? Where would my files live? Are there any accepted practises for file structure in this situation where you have a core library, a number of plugins and then some of your own code? _PS, I realised just now I have two copies of jQueryUI._


Is it bad practice to store user input in the same table where the admin stores data?

If in a web app, let's say an app that has a table with stored street address ( **Strings** ), the admin of the app will be adding data often to grow his archive. The table (MySQL) has a primary key with `AUTO_INC`. The web app allows the users to add addresses themselves. Once a user enters an address say **X** , ALL of the users of the application will be able to see the address **X** when searching for available addresses. What if, since address is a string, a user stores inappropriate content(like bad words, for example)? This might offend some users and push them to stop using the app. So I was thinking of what would be better:   * Storing user input in a separate table ("pending input"), until the admin approves them and then they're moved the official table?   * Or store the inputs in same table of the admin's inputs table, but put a temporary flag on each entered record (by the users) so that they are only visible to that user until the admin approves them? On a side note, is it logical to limit each user to have a specific amount of input addresses per day that they can add (some spammers might fill the table with thousands of useless records)?


Why are there so many competing filesystem designs?

Just a quick question, but why are there so many file systems still competing and in use today? (ntfs, fat32, ext3(ffs), etc) It seems that file system designers could agree upon the best aspects of each type of system and implement a "best" filesystem, no? Just a thought, since these filesystems have been around for a while now, and it should be at least somewhat apparent which ones have good qualities over others, and we could just combine the good in each and create an ultimate system that is much better


UML, Dependency, and Martin Fowler's Data Mapper Diagram

I'm trying to get a better understanding of Dependency. In Martin Fowler's explanation of the Data Mapper pattern, http://martinfowler.com/eaaCatalog/dataMapper.html, the UML diagram shows the Mapper being dependent on both the Domain Object and the Database. It seems to me, however, that _the Domain Object is dependent on the Mapper_. For example, if the interface of the Mapper changes, the Domain Object may need to change. I would have expected a dependency to be shown from the Domain to the Mapper. At another level, I can see that the Mapper is dependent on the Domain Objects. Domain Objects, of all classes, are likely to change, and sure, this is likely to cause changes in the Mapper. I guess I'd feel happier if the Domain/Mapper dependency was bi-directional. Am I missing something? Or do I just need to loosen up a bit? Perhaps Martin only shows the dependency in one direction because it is the overwhelmingly more important direction?


What to do when you find a security hole in your company's site

I have found a major security hole in one of my company's public facing site. This is our first public facing site that was converted from an intranet site. I brought this issue up to my boss and they essentially shrugged it off, saying that it would take a good deal of work to re-architecture the site to make it secure. This has really bothered me and I have thought about exploiting the hole to show the effects that this could happen if an actual hacker got to it. This is probably not the best idea as the effects could cost me my job if not something worse. What are some things I can do to show the magnitude of the situation to management?


I know the language but still can't code like other peers

I have moved to a new job and code base (been doing C#, .NET, Windows Forms, etc. for last four years) and I have been on this for three months until today. During these three months I caught up with parts of the language and syntax that I didn't know before (MVVM, Silverlight, some advanced stuff in .NET like Action, Func, Callbacks, etc.), so now I know those but still when I go in the code to fix a bug and see their code, I get disappointed, because I see some coding techniques that although I know the syntax and understand it but I think to myself "could I write this myself"? The answer is no. For example they create classes that have a member as "Action" and at run-time they assign actions to separate instances, or register - unregister events at some parts of the code, etc. Is it normal? and gets better by time? or I am just a stupid mediocre developer? and how can I make it better?


Developing a GPL replacement from public documentation. Any legal problems?

In a program I am developing, I need to use an improved ListView. The ObjectListView seems to satisfy my needs, except it is GPL and thus unusable in my commercial application. I believe, however, that we can develop our own replacement in-house, using the documentation from the site, without looking at the code. Is there any legal risk in doing so? Does our control need to be GPL or any other license restrictions?


How is software installed from an image?

I read an article a while back (forgot from where) that essentially stated that someone wrote a virus and inserted it into an image. The end result allowed the cracker to have his way with the system. How is this possible?


Is it common to use arrays everywhere with PHP?

I'm a fresh grad, and I just started workingin real world projects. I'm basically using PHP most of the time. I just figured out that most of the solutions I came out with for most of the problems, is involving using an array in somehow. What Am I doing wrong here? How could I unlearn this and always think of something else? Or is it the fault of the language?


CamelCase issue (PList or Plist)

Ok, I understand what CamelCase is. This question is relating to how to CamelCase the shortened version of Property List (PList). I am asking this because I am working on a PList parser in C# and knowing how everything in .NET is CamelCase, I am wondering, should it be `PList` or `Plist` (also why)?


I need practical answer of this question Why wait and notify is declared in Object class instead of Thread ? answer with example will appreciated.


Why declare a variable in one line, and assign to it in the next?

(I figured this question was already asked, and searched for it, but was unable to find a duplicate; if I missed something, please delete this one and accept my apologies!) I often see in C and C++ code the following convention:               some_type val;     val = something;          some_type *ptr = NULL     ptr = &something_else;      instead of               some_type val = something;     some_type *ptr = &something_else;      I initially assumed that this was a habit left over from the days when you had to declare all local variables at the top of the scope. But I've learned not to dismiss so quickly the habits of veteran developers. So, is there a good reason for declaring in one line, and assigning afterwards? **EDIT** : Some people are confused about my tagging of this question as both `c` and `c++`. So, to clarify, I was interested in the difference between how these will behave in both C and C++. There are a lot of instances where the same code will behave differently in C++ than in C. **EDIT 2** : Apologies for the poor wording: I probably shouldn't have used the words _declare_ and _define_ without making clear exactly what I meant by them, since they have very specific meanings in different contexts. I've changed the title to say “assign” instead.


Install Ubuntu on MacBook Pro without a CD

Trying to install Ubuntu server on my MacBook however the CD drive is not working. All the guides I have seen so far use the bootcamp process (same as for windows) to achieve this. I currently have a windows partition on my machine (it was installed with a CD when the drive was ok) which I'm going to remove before I do this. Is it possible to boot using the USB drive from the Mac bootloader using this method? I don't want to remove my Windows partition to find that I NEED a CD to do this. I would also prefer to have a separate partition as opposed to any sort of VM setup to do this.


Trends of Java and Javascript?

I see the graph from Google Trends: Javascript: ![Javascript](http://www.google.com/trends/viz?q=javascript&date=all&geo=all&graph=weekly_img&sort=0&sa=N) Why Javascript goes down? Isn't it the most popular script language in web? What maybe replace javascript in the future? And also Java (vs .net, c#): ![Java](http://www.google.com/trends/viz?q=java,.net,c%23&date=all&geo=all&graph=weekly_img&sort=0&sa=N) Well, both Java and .Net are going down, why? Are there some new wonderful languages better then Java coming out?


What kind of permission is this? (Groups+Roles)

I'm starting to need an access control for roles in my app. I don't know much of this, but I understand how vBulletin works:               I create groups, then give permissions to groups.      I think that what I need is the Role Bases Access Control (RBAC) , but i'm not sure, because I need groups to give permissions instead of single users (Maybe it's not that complicated to achieve). Example of what I'm thinking: Given a post:               Editor's Group has permission to view it before it's published.     Editor's Group has permission to edit its content.     Public Group (Default) has not permission to view it before it's published.     Admin Group has permission to delete the post.      So basically I wan't orientation about if RBAC is what I need. And also, how would it be good to store group membership in a user, for example, would be good to have: `ID NAME PASSWORD GROUPS (1, MyName, MyPassword, 1/2/3/4/5)` and explode it via PHP or one registry for every Group membership in a table named `permissions`, example: `USERID, USERGROUP values (1, 1), (1, 2)` Maybe should be the second way because of the formal norms but I didn't study yet Databases 1 at college.


Client Server System in .Net

I am not asking for code but rather design ideas. I am trying to develop a new system to learn more about client/server development. I would have 3 systems: `Client 1 : Client` `Server 1 : Server` `DB Server 1: DB Server` I would develop a server application as well as a client application What happens is that my idea would be to use DB authentication where the clients actually have different access rights which are stored in a DB table on the DB server. However, different access rights would get access to different features in the application. For example, a superuser would log in with his account by sending data from the client to the Server application running on Server 1, which would then check the superuser table in the DB to check if the account exists. My initial idea would be to send the account object back to the client in which the client application would check what type of account it belongs to and actually displays the corresponding form/User Interface to the user. However, this approach does not seem very feasible as it seems too flimsy and incorporates a lot of bad design. Perhaps someone could give me a better idea on how do i approach this problem. Summary : It would be just like a client server application but there would be different kinds of users being allowed different rights and different features.


Most Efficient Cache Replacement Algorithm

Wikipedia lists 11 cache replacement algorithms. Assuming I know almost nothing about the application I'm going to develop, **what should I use as a "default" cache replacement algorithm?** If I recall correctly from my OS course, LRU is the best general cache replacement algorithm. But maybe I'm mistaken. Also, this is a bit of an academic question, since, generally, main memory is cheap and abundant and I don't really need to worry about cache size too much.


Did the developers of Java consciously abandon RAII?

As a long-time C# programmer, I have recently come to learn more about the advantages of _Resource Acquisition Is Initialization_ (RAII). In particular, I have discovered that the C# idiom:               using (var dbConn = new DbConnection(connStr)) {         // do stuff with dbConn     }      has the C++ equivalent:               {         DbConnection dbConn(connStr);         // do stuff with dbConn     }      meaning that remembering to enclose the use of resources like `DbConnection` in a `using` block is unnecessary in C++ ! This seems to a major advantage of C++. This is even more convincing when you consider a class that has an instance member of type `DbConnection`, for example               class Foo {         DbConnection dbConn;              // ...     }      In C# I would need to have Foo implement `IDisposable` as such:               class Foo : IDisposable {         DbConnection dbConn;              public void Dispose()         {                    dbConn.Dispose();         }     }      and what's worse, every user of `Foo` would need to remember to enclose `Foo` in a `using` block, like:                  using (var foo = new Foo()) {            // do stuff with "foo"        }      Now looking at C# and its Java roots I am wondering... did the developers of Java fully appreciate what they were giving up when they abandoned the stack in favor of the heap, thus abandoning RAII? (Similarly, did Stroustrup fully appreciate the significance of RAII?)


Why is there no deterministic object destruction in Java?

I understand and enjoy the benefits of the Garbage Collection in Java. However I don't understand why there is no way in Java to explicitly (and quickly) destroy an object. Surely this could be useful in some cases, I assume performance-critical software. It's true that in Java the GC will delete an object with no existing reference to it, so if I want an object deleted I can set the reference to it to `null`. But if I understand correctly, it isn't ensured that the GC will indeed delete the object, at least not immediately. And that's out of the programmer's control. Why is there no way in Java to explicitly destroy objects? While I understand that Java was designed to be used as a high-level language, that abstracts away some of the technical details from the programmer to make things easier: Java has become one of the most widely used languages, and is used in huge projects. I assume that in huge projects, performance is often an issue. Since Java had grown to become what it is, why wasn't explicit object destruction added to the language?


Minimizing Dependencies For GUIs

I've been working on a project, and have been charged with designing the projects GUI front-end. I'm coding in Java and using the Swing toolkit. Usability-wise, the GUI front-end follows all of Nielsen's heuristics. Users can easily get to where they want to go through the click of a button / JComboBox. Essentially, in Swing terms, what happens is their actions drive the creation/deletion of custom panels. The GUI is coming along fine for the most part. However, I have to admit to being utterly dismayed at the tight web of dependencies my code is being smothered in. The main problem that I've encountered, that I haven't been able to fix as of yet, is how to keep a reference to the panels/buttons being changed. I'll give an example: Say there's a button A Say there's a panel B displaying picture C Say there's another picture D (not currently being displayed by panel B) When user clicks A, panel B should remove picture C and display picture D My question is, what's the best way of keeping track of panel B? Since I need a global point of access to panel B, my solution has so far been to just shoehorn it into a static variable, and access it through a series of static getters and setters. And this static variable is usually stored in the reference's original class. I.e. UserPanel has a static variable that stores a reference to itself. Is there an easy, tried-and-true way of dealing with these kinds of situations? Like my GUI works fine, but it is not modular and/or robust at all. To add to this, the dreaded 'cyclical dependencies' issue that's shunned by so many programmers is out here in full effect. I'm fairly new to development and just want to make sure that my code will be fairly extensible and won't cause much of a headache to the next person that decides to get a try at it. I know there's loads of books out there that probably have a nice elegant solution to this, but unfortunately I just don't have the time to leisure read right now. I need something that's quick and dirty. Thanks in advance


Minimal linux distro for compiling arm binaries

I have this setup: A windows/x86 development box and a PandaBoard ES for testing with a linux on it. I would like to ask you for recommending a linux distribution that I would run in Hyper-V on my devbox that would be used only for compiling arm/linux binaries. After compiling these binaries I will copy them to an SD Memory Card and test them on PandaBoard. Thanks!


programming practices starting

I have taken my major as computer science and Engineering and I am really confused at this moment. My first course was about learning C and C++ and I learned the basics of those. Now I am really confused what to do next. Some says I should practice algorithms and do contests in ACM-ICPC for now. Others tell me to start software development. But As I started digging its really a vast topic and there are many aspects of these, like web design, web- development, iOS-development, android... etc many things. And I am really confused about what should I do just now. Any advice for me to start with?


Ternary operator considered harmful?

For example, would you prefer this one-liner               int median(int a, int b, int c) {         return (a<b) ? (b<c) ? b : (a<c) ? c : a : (a<c) ? a : (b<c) ? c : b;     }      or an if/else solution involving multiple return statements? When is `?:` appropriate, and when is it not? Should it be taught to or hidden from beginners?


Can this word search algorithm be made faster?

Problem: Find a match of word **S** in text **T** Given: **S** and **T** are **part of spoken and written English**. Example: Match 'Math' in 'I love Mathematics' NOTE: Ignore CASES. My algorithm:               STEP 1) Convert S, T to char[]          STEP 2) for i=0, i < T.length , i++          STEP 3) for j=S.length-1, j>0 , j--      STEP 3 is the magic, instead of going about matching `M,A,T,H`, this matches `M, H, T` and finally `A`. This helps in eliminating a lot of possible partial matches. For example, if I go sequentially like `M A` as in Boyer Moore's method ... it can match `Matter, Mass, Matchstick` etc. using `M _ _ H` will bring down size of partial matches.               STEP 4) if S[j]!=T[i] -> break;             else if j==i -> PRINT MATCH


Can you help me understand this design pattern made by Java expert?

I inherited the project from a very experienced Java developer. The project is Android app and the guy who coded is is very experienced in coding regular Java apps. He introduced some file structures that I haven't come across before (I haven't coded Java apps outside Android area). I can follow the code with no problem and I actually have finished a few add-ons so far, but now I would like to know more of why he used such approach since it may help me myself write a better code. On the other hand, if his approach is not suitable for Android apps, I would like to know that as well so I don't use such structures. I will divide all questions into points.   1. When dealing with a database, he made 3 layers: entities, data_access and controllers. This is a kind of MVC structure. Is it advised to use it in Android apps?   2. In controller part, he made the following file structure: > >     controller/ >           async/ >                 AsyncAddObject.java >                 AsyncExecutorAdd.java >                 AsyncExecutorGetAll.java >               Entity1Controller.java >               Entity2Controller.java >               Entity3Controller.java >               IController.java >   All async files are the generics. Is this structure familiar to you? I remember executors used in Java, but have never used such approach in Android development. If this is a proper way, what is Executor used for? What about `IController.java` \- something usual in regular Java coding? +++++++++   Then when we want to add some entry into database, he uses the following code               Entity1 ent = new Entity1();     ent.setSomething(someParameter);          AsyncAddObject<Entity1> obj = new AsyncAddObject<Entity1>();     obj.setController(mEntity1Controller);     obj.setObj(ent);     new AsyncExecutorAdd<Entity1>().execute(obj);      Does this look confusing to you? I usually call some database method and pass object to it. For example, I would do it like this               Entity1 ent = new Entity1();     ent.setSomething(someParameter);          MyDatabaseClass.addEntity1(ent); //just an example, adding to database will be done on non-Main thread.       This is it. I apologize for a long post.


Web technologies on GUI apps

I developed many GUI applications for the Windows platform during my early professional career, and saw several GUI frameworks come, have whole magazines devoted to them, and then fade away. MFC is iconic. Tasked with writing yet another GUI application, I starter researching cross- platform frameworks like Qt and WxWindows. I found the same steep learning curves I knew from before, and tooling doesn't help much in building a functional and elegant user interface because its clumsy and complicated. But people are building beautiful and functional UIs on the Web all the time (look at this site!). The standards, the libraries, and the tools are certainly there. My thought and my question: Why not write a GUI in which most of the UI is handled by an embedded browser? I already know that the Qt widgets support a large part of CSS and JavaScript, and programmers with good knowledge about web development are relatively easy to find, ..., so... Have you done something like that before? What's your experience/advise? A browser widget will likely support a subset of the functionality of mainstream browsers, but enough to produce a rich user interface using web technologies. There's the added advantage of the enormous simplifications possible when the web-stuff doesn't have to talk to a server to service UI requests. My idea is not to embed a full-blown browser (yikes!). It is to enable the use of web technologies in GUI programming. **[Edit]** I haven't accepted an answer because the ones so far are suggestions about doing something else, and not about previous experience doing what I suggest. They're not even opinions or speculations about the pitfalls or benefits of doing it the suggested way, which is what I would expect in the unlikeliness that I'd be breaking new ground by using a browser widget to provide part of a GUIs interface. Think HTML, CSS, and limited JavaScript, with no Internet, no .Net or Java (or Air or Flex/Flash), no relational database; just executables, libraries, and templates that can be installed by copying them, and persistence to the user's home directory using the file system. ## Some Addtional Related Questions These are drawn from the answers so far:   1. User experience: Isn't the WebApp that runs StackExchange rich and intuitive enough?   2. User expectations: Hasn't the Web, and aren't portable gadgets (smartphones and tablets) moving the user experience away from the traditional GUI?   3. Could it be that there apps that must be GUI but benefit from being _webified_ while other's don't?


Revoking Open Source license, for specific individuals

I develop an open source Android application, which is licensed under GPL and freely available on Github.   It is currently under heavy development, therefore it isn't published in the Play Store yet.      What can I do, if someone decides to publish it in the Play Store,   * without modifying the code (just build it from my repo and upload it, same package name).   * with modifying the source code and publishing it on Github under same license.   * and modify the code but don't publish the code under the same license.


Flight framework, static or non-static?

I recently came across the **Flight micro-framework** , I want to use for a project because it seems lightweight, easily extensible and maintained. Most of the other micro-frameworks I looked into and liked were updated about 2 - 4 years ago (like Epiphany, Recess or Dingo) However, basically Flight is **based on static classes** , but you have the **opportunity to run it with an object instance** (as mentioned here: http://flightphp.com/learn#methods)   1. How would you run the framework? (static or non-static)   2. What do you think about this framework in general? Thank you!


MVC pattern synchronisation

I am facing a problem in synchronizing my model and view threads I have a view which is table. In it, user can select a few rows. I update the view as soon as the user clicks on any row since I don't want the UI to be slow. This updating is done by a logic which runs in the controller thread below. At the same time, the controller will update the model data too, which takes place in a different thread. i.e., controller puts the query in a queue, which is then executed by the model thread - which is a single-threaded interface. As soon as the query executes, controller will get a signal. Now, In order to keep the view and model synchronized, I will update the view again based on the return value of the query (the data returned by model) - even though I updated the view already for that user action. But, I am facing issues because, its taking a lot of time for the model to return the result, by that time user would have performed multiple clicks. So, as a result of updating the view again based on the information from model, the view sometimes goes back to the state in which the previous clicks were made (Suppose user clicks thrice on different rows. I update the view as soon as the click happens. Also, I update the view when I get data back from the model - which is supposed to be same as the already updated state of the view. Now, when the user clicks third time, I get data for the first click from model. As a result, view goes back to a state which is generated by the first click) Is there any way to handle such a synchronization issue?


What is the most egregious waste of money you have seen, and what did you do about it?

Often we as programmers see large organisations wasting huge sums of money on bloated and inefficient solutions to problems. This pains me greatly because I like organisations to benefit from best of breed solutions. However, my abilities as a programmer are limited when it comes to influencing the key decision makers and often my perspective on the matter is constrained to my own little technical world. So, my question is this. After encountering an egregious waste of money on some software and/or hardware that really got your goat, **what did you do about it to get it fixed** or were you doomed to bite the bullet and mutter forever under your breath? I'm interested in hearing your overall experiences **and especially what lessons you learned about how to tackle this sort of thing in the future**. Let's not name names, the experience of how to tackle the problem is more important than the actual offending product.


When should I write integration tests?

According to rules of TDD unit tests are written before production code, but what about Integration tests that exercises interaction between concrete (non mocks) wired objects?   Should they be written before unit tests or after production code just to test the "wiring" ?   Note that I'm not talking about Acceptance or functional tests but Lower level integration tests.


Assigned to a new WPF project, know nothing about it

I started as the analyst, talking to the client and jotting down requirements and all that jazz. Ended as the sole developer of the project. The schedule is OK, but not OK for someone that don't know nothing about how to develop a WPF application, IMHO. What can I do about it, tell program manager that she made a huge mistake by choosing someone with no skills(she had no choice, I was the only one not allocated), or slit my wrists? Do I have other choices? P.S.: Really trying to learn it, can't get how to structure the project MVVM, IoC, Logging. The concept count is too damn high.


What problems do configuration management tools solve?

My company is creating a service in an Amazon Virtual Private Cloud. Without getting too much into the details, there will be about 5 different types of servers, and each type will need to be replicated based on demand. A bit of reading gives me the impression that we're going to want to use a config management tool like Puppet or Chef. My bosses are receptive to the idea, but need convincing that it's actually worth the upfront cost of learning one of these tools. I have no experience with these tools, and can't really offer anything other than a few bullet points on what they do, and that wiser people on the internet seem to think it's a good idea. The benefits of a CM just seem like vague best practices at this point, since I haven't yet experienced the problems that they are meant to solve. What headaches can I expect if we don't use a config management tool?


Looking for good functional / oop / meta programming language with :

I want it will be   * native code generation // Able to compile with something like GHC   * cross-platform (win / linux)   * Functional and a bit object-oriented   * lambdas, pattern matching, tuples and other functional stuff   * Great metaprogramming support   * Indent and minimum borders   * static typing   * also I want Mixin support :)   * possibility to build web sites based on some frameworks is also good plus.   * so and yes, performance and stability matters. I started **Haskell** , but still being not sure about it, because there is OCaml. And I've got F# experience. But as far as I know **OCalm** is a bit OOP and sometimes even faster (not sure about it) I never tried it. There is also erlang, I know nothing about **erlang**. And maybe I'm missing something more..? **Python** , I have no idea about python here, it's functional and it's oop and it supports mixin and popular and fast, but I don'r really think that python is able for all the functional magic, I think it can not. I know that this thread/topic is a like a talking about nothing or like a language war, but I seriously and really want to hear your vision of it.


In simple words what are are the purposes of abstract classes and/or interfaces?

I have to explain to some students the use of abstract classes and interfaces, as I have a very tecnical background, I would like to know if you would help me to define an easy explanation for junior. Simple definition: **What are the purposes of abstract classes, interfaces, and what is the difference between the two ?** **When is it appropriate to use one instead of the other?** Thanks.


How to manage data flow between UI components?

I have been trying to use classes that implement ActionListener to respond to user input. I'm consistently noticing that for an action listener to communicate the event to other objects, it has to contain the object. Like, The object I want to get updated when action_src is clicked:               public class Display_Field {         JTextField display;              public Display_Field ( JButton action_src ) {             action_src.addActionListener( new Open_Dialog_Click( this ) );         }              public void setText( String text ) {             display.setText( text );         }     }      The ActionListener I plan to add to action_src:               public class Open_Dialog_Click implements ActionListener {         private Display_Field display;              public void actionPerformed( ActionEvent action ) {             JFileChooser chooser = new JFileChooser();             chooser.showOpenDialog( null );             display.setText( chooser.getSelectedFile().getName() );         }              public Open_Dialog_Click( Display_Field display ) {             this.display = display;         }     }      There is so many convolutions! Like, the display needs to be constructed with a button that adds an ActionListener that needs to be constructed with the display... **Is there a less convoluted way to allow data to flow between components?** I have considered making a central class that houses all the listeners, acting as wiring for any and all intercomponent communication, but that seems like the class is doing too much for its own good. ...or is that how it is done after all?


Programming language usage at Google

I have heard Google uses Python, Java and C++. But what I don't know is how is each of those programming language is used. I mean what is Python, Java and C++ is used for at Google. Why would they used upto 3 programming languages when 1 language is enough. Does anybody know?