How to design an application that read files using MVC pattern?

I am going to write an application that reads data from a csv file, and display that data to the user. I intend to apply an MVC design pattern to create this application. A user will interact with this application through a console. Hence the view is a console. There will be a Main.java that is responsible for :   * Presenting a menu that a user can choose in the console.   * Able to handle event in the console, e.g.: a user choose an option to read two csvfiles and ask the application to display differences between the two csv files.   * Execute appropriate business logic for selected events. To do this the Main.java will have a Main method that displays menu to a user in a console. I am considering to make the Main.java as a Controller, because this class is responsible for taking the user input, and figure out what to do with the input. To do this, The Main.java will call a class called FileService.java, which is a service class. FileService.java is responsible for:   * Read a csv file.   * Display the content of the text file sorted according to some rule.   * Display differences content of 2 csv files. The FileService will parse the csv file using a csv parser, and stores the content of the files on a disk using MapDB. The intention of using MapDB is to allow user read huge file (e.g.: 5 GB), and perform operations to the content of the file. Once the file has been read, Main.java could display the content of the file, or display the differences between the 2 text files, when a user select the option in the console. The FileService is intended to be the Model part in this application. And, the FileService is completely decoupled from the view and the controller, which is the Main.java. Does this simple design achieve separation of concern addressed by MVC ? **Response to @tgkprog:** _where is the view? if main is the controller and FileService the model/ business part then you need a view class too._ **Response** : When I built a web application, a view would be, but not limited to, a JSP, or an HTML page. In the context of the CSV file reader application, what would be the equivalent of a HTML or a JSP page ? This is some thing that I am not sure. The menu displayed in the console can be simply achieved inside the main method of the Main.java. _if the files are 5mb then i think a console app will be quite inadequate to display differences unless there are very few?_ **Response** : I could dump the difference in a text file, and let user view the text file. This would be more helpful for them I think. Thank you for pointing this out.


How necessary is it to learn JavaScript before jQuery?

In my opinion, when I looked at JavaScript, it looked like not my cup of tea. When I came across jQuery, I loved it. I sat and watched Nettuts+ 15 days of jQuery screencasts, 1 year later and now I'm fairly confident I wouldn't develop a website without including jQuery's library. I have never felt this has held me back but my question is, will this come back and bite me in the ass one day, the fact that I didn't have a solid JavaScript foundation before jumping feet first into one of its best (if not the best) frameworks? Did anyone else take this approach?


What is the difference between 'layer of abstraction' and 'level of indirection'?

I am not sure if both terms can be used interchangeably. Maybe there is some academic distinction in computer science which is not relevant for day-to-day programming? Or can I use both term interchangeably without being wrong? Maybe it depends on the context in which I use both terms? Edit: On reason why I find both terms possibly interchangeable is a Wikipedia entry about Abstraction layer. There you can find David Wheelers quote 'All problems in computer science can be solved by another level of indirection.'


Are algorithm questions good interview questions?

I've had an argument recently with a fellow programmer. He was interviewing for a new position and was asked this question: > Give a sequence of numbers starting at X and ending in Y but with one > element missing so N is Y-X-1, find the missing element in O(N) or better. Now, the answer is irrelevant here (but interesting). This started a discussion on whether this was even a good question to ask during an interview. One side: Algorithms are an inherit part of programming and a candidates ability to answer this question supports that this candidate will be a good programmer and be able to solve larger problems and can handle most programming tasks which are ultimately easy to understand and answer. Other side: Writing algorithms from scratch is rarely used in modern programming and therefore is irrelevant in the bigger question of whether the person will be a good programmer. A person could successfully answer this question yet still not be able to do more common programmings tasks. Your thoughts? Good interview question or not?


Software Manual - Where to start

Are there any software packages out there for generating a nice looking users manual for small projects? I'm not talking about source documentation. I want to create an end users manual that doesn't look like I spent 20 mins in Microsoft Word.


Is it fine to skip MVC?

I am building a pair of components that communicates in a one-way fashion:               [ JButton ] --> data...process...process...out --> [ JTextField ]      The JButton allows the user to select a file and the JButton's ActionListener picks up the click and pulls out the file name and directory. I then need that information to be displayed by the JTextField. Such functionality is so basic, it need not ever change. Someone suggested a way to relay the message here, but I am asking another question: **should I skip the MVC?**               [ JButton ]  --> [ JTextField ]      Simple is best, right? That's the simplest and clearest way I can think of of relaying the message. I mean, just modify the the JTextField by JButton's ActionListener. So should I go with this simpler approach or try to apply MVC anyway?


What is the convention for the star location in reference variables?

I have been learning Objective-C, noting that different books and examples use differing conventions for the location of the star (`*`) when naming reference variables:               MyType* x;     MyType *y;     MyType*z; // this also works      I see the first two used interchangeably, and sometimes in the same code I've seen differing uses of both. Is one format easier to read, easier to maintain, or less error prone than the other formats, or is it simply a matter of personal preference?


When did developers start making normalized relational databases?

I work on a pretty old application which was converted from DOS and flat files for storing information to Paradox tables using the BDE then to MySQL relational database. The older devs say that the reason they have no idea how to properly create a table in 3nf is because their code predates relational databases and they never learned about them in school. So, within actual programs, when did a majority of programmers adopt a decent method for creating tables in their databases? If you look at the databases in open source CMS's, those tables look well normalized - are successful ones initiated that way or do they get normalized over time (or denormalized for pragmatic reasons)?


When do you use subquery in SQL?

When do you use subquery in SQL, and what type of request is subquery useful for? I am practicing SQL and need to know how to spot a subquery problem immediately


What should we do to make Morning Standup meetting better and effective

Well , Here in my Office, we made it a practice to come before 9 AM (in any condition as decided by Management) and start with a Standup Meeting. Here we start with Discusiing with issues of previous day, Any updates from Manager (by leads) and the work plan for today. This meeting may sound good and process oriented , but some times if there is a show down then it ruins the morning mood or if there is a difference in opinion then again it is not a good thing to start with. So, HR and Management decides that initially we will discuss personal matters for 10 to 15mins and then we will jump to technical and official discussion.For 15 minutes everyday, are you serious , I don't get a topic to discuss for 15mins every day with my lead who is much older than me and never discussed anything in personal till now and you want to start with it just like that!!! So it is back to square one. Every one (Amazingly in all the teams) is discussing aagain technical aspects only in the moring /stand up meeting. So here it comes, today I have a Lunch with Management and the Topic for Discussion is :               "How to make Nice Day(Morning/Standup) meetings effective?"      Any Suggestions please.


How Do I interview Front-End Web Developers?

For the first time I'm in the position where I'm helping interview potential front-end developers. The other interviewer is more business & PM-focused, although he is a former developer. I probe for knowledge and background in CSS, Javascript, and other related technologies, but those questions are really just testing for lingo. I feel that it would be unfair to ask very specific questions about CSS when we're not in front of a computer. I've also been given websites that these web developers have written. Is that enough to go on for interviewing front-ends? We're also looking for general aptitude, rather than a databank of knowledge.


Ruby on Rails - guide to learning milestones?

Is there a guide of some sort to important milestones while learning Ruby on Rails? I'm self-taught so I don't have a mentor to tell me these things. I've been learning Rails for 11 months, and think I'm making good progress, but I would like some informed feedback on whether I'm progressing nicely or if I need to ramp up my efforts, so I'm searching to see if such a guide exists online. Maybe someone wrote an appendix to a book they wrote on Rails, or a blog post? Something along those lines...


How do you keep track of latest software trends along with a demanding job?

> **Possible Duplicate:**   >  Where do you find the time? I am sure there are lots of us in this very common situation. You have a job that's demanding. In other words you need to put in 50+ hours/week and yet you are expected to keep up with what's happening on the bleeding edge technology and open source end. Any suggestions folks how you do it? Reading blogs or papers on C++ or ruby is hardly an option during office unless of course you want to give up on lunch. Also, what would you want to read? There are way too many C++ tools and ruby gems that are relevant to my work -- can't read them all, right?


Automatically delete files after they expire

I've got this idea for some time and I was wondering if anyone has seen such a feature/app in any operating system and if you haven't, what do you think about it. Where do you think I should begin? The idea is simple. I think we all have those files that are made and probably used for a few days and then are left on our disk and we never delete them or even check to see if we need them again. It'd be cool if you could right click on a file and click on "Expire in.. 3 days" for example. And the file gets deleted after 3 days. I have a great need for this and maybe **some** people will find it useful. I was thinking of writing a script and use the Nautilus Action project in GNOME for a start.


Who was the first programmer?

Is there some consensus among historians on who was the first programmer ever? If so, who was it and what were they programming on? I find it more interesting to know more about the pioneers of programming, regardless if they programmed on a programmable machine or if they've designed the machine themselves to do some computing task.


Can I rename a portion of code released under Apache 2.0?

Is it possible to rename a portion of code extracted from a Apache 2.0 licensed software, releasing it as a new repository under a new name?


What is the functional-programming alternative to an interface?

If I want to program in a "functional" style, with what would I replace an interface?               interface IFace     {        string Name { get; set; }        int Id { get; }     }     class Foo : IFace { ... }      Maybe a `Tuple<>`?               Tuple<Func<string> /*get_Name*/, Action<String> /*set_Name*/, Func<int> /*get_Id*/> Foo;      The only reason I'm using an interface in the first place is because I want always want certain properties/methods available. * * * **Edit:** Some more detail about what I'm thinking/attempting. Say, I've got a method which takes three functions:               static class Blarf     {        public static void DoSomething(Func<string> getName, Action<string> setName, Func<int> getId);     }      With an instance of `Bar` I can use this method:               class Bar     {        public string GetName();        public void SetName(string value);             public int GetId();     }     ...     var bar = new Bar();     Blarf.DoSomething(bar.GetName, bar.SetName, bar.GetId);      But that's a bit of a pain as I have to mention `bar` three times in a single call. Plus, I don't really intend for callers to supply functions from different instances               Blarf.DoSomething(bar1.GetName, bar2.SetName, bar3.GetId); // NO!      In C#, an `interface` is one way to deal with this; but that seems like a very object-oriented approach. I'm wondering if there's a more functional solution: 1) pass the group of functions together, and 2) ensure the functions are properly related to each other.


Is it worth to try write foolproof data structures?

## The problem We need to store data in a table-like way, but we have very strict space constraints (~1Mb per table of 10k+ rows). We store data like this:               ID | reviews | factor | score | interval | etc.     ---+---------+--------+-------+----------+-----      1 |     244 |    2.4 |    10 |     4268 | ...      in a simple binary format (a one-dimensional array of bytes, where the index of each row can be calculated simply by knowing the length of each row, which is fixed). There is only one function that ever reads this data (gets a row by its index), and only one function that appends a new row (to the end). Removing items from the table will never be required (the table is append-only). Both functions are covered with a decent amount of unit tests. The problem is the following: we need to be able to quickly go through rows _ordered by different columns_. In other words, we need the data to be sorted by at least two columns. ## A simple solution To solve this problem, we would implement indexes that, again, would be chunks of binary data. Now I would intuitively do it by creating ordered data structures that only list the index of the row in the original table:               factor_index        score_index     ------------        -----------               6                  2               2                  1               3                  6               1                  4               .                  .      The function that appends a new row to the table would have to be updated to cause the indexes to be updated as well. **EXAMPLE:** To get the first item ordered by score, we just look up the first value in the index table for score (2) and get the corresponding row from the original table (the third row if we agree that the table is zero-indexed). However, I was suggested to take a different approach. ## A more complex but presumably safer version Instead of of only storing the indexes, we duplicate the ID fields in each index table:               factor_index | ID        score_index | ID     -------------+---        ------------+---               6  | 46                  2 |  8               2  |  8                  1 | 14               3  | 91                  6 | 46               1  | 14                  4 | 60               .  |  .                  . |  .      Then keep the original table sorted by ID, and use the indexes only as a starting position for a binary search in the original table. The function that appends a new record will now have to do a binary search by ID to find where to insert the new row, _and_ cause the indexes to be updated. **EXAMPLE:** To get the first item ordered by score, we look up the first row in the index table for score (2, 8), and use the index (2) as a starting position for a binary search in the table. If the data is valid, we don't even need to do a binary search, because at position 2 we will find the row with ID 8. If, however, we find that the record at position 2 has a different index, we continue with a binary search to find the right one, and log the error. The argument for this approach is that it will work even if the index points to the wrong row in the table. I find it hard to believe though that this approach is really better, for the following reasons:   * It requires a binary search, which can be a new source of bugs.   * It requires the table to be kept in order, which implies more complex insert (as opposed to a simple append).   * It does not guard against the main table being out of order: if that happens, the index could even fail to find the record via binary search.   * It requires writing (and testing) code that is never even meant to be run.   * It uses more data than what is necessary. ## The question It is very high priority for our application that the above piece of data is always valid. But does that justify writing more complex data structures and lookup mechanisms to guard against edge cases may or may not happen? Shouldn't the time and effort instead be put in writing more robust test cases for a simpler version?


How should I mark types in C and C++ programs?

In this answer of mine, I used `_t` at end of types, which ended at best, controversial. This is the practice I use in my current projects.               typedef struct {         int x;         int y;     } point_t;      This was intended to be consistent with C types from `stddef.h` like `size_t` or `ptrdiff_t`. However, according to certain comments in my questions, `_t` postfix appears to be reserved for POSIX. What should I use instead of `_t`? Or should I continue using `_t` anyway? This question is for both C and C++. If these languages have different conventions, feel free to answer so.


Advice/Wisdom for Programming Competitions. (Specifically the IOI)

I'm on the Irish team heading to the International Olympiad of Informatics in Bulgaria at the start of August, and from the great pools of wisdom of SA, I wish to ask a few questions of those of you who have competed in programming competitions (or indeed, the IOI) before. Mainly, what tidbits of advice can you give for those competing? What's the best way (in your eyes) to go about solving a problem? I've got my own methods, but I am interested to hear your point of view. How do you manage time? Is it worth loading troublesome code up in gdb to try to work out tricky bugs, or is it best to try to hack solutions? Is there even time to debug things properly? I have been memorizing some algorithms, such as graph search algorithms, brute force algorithms, recursive algorithms, etc. What other common algorithms do you think are useful? Thanks in advance.


How To Know When To Stop Testing?

I know this is a very very basic question. For some software applications there are a large almost infinitely high number of test cases for an application. It is not practical to test all those test cases. How do we decide when to stop testing? (other than "when money runs out").


Meaningful names in weakly typed language like JS

I've been learning java for about a year, but recently entered the world of javascript. I'm having trouble coming up with meaningful names in function parameters, so that I'll be able to tell and remember what is being passed in and act on it correctly. For example: In java, I could define `void method(Type name)` and always know that name is of object Type.               void printToConsole(String errorMessage) {         System.out.println(errorMessage); <--I know errorMessage is a string     }      In Javascript, I can only do `function method(name)`, and if I come back later, I forget what name is and have to go see where `method` was called and what was passed in. I have started naming the parameter like `nameType` but this seems too verbose. somewhere in code:               getBoxText($("input[type='text']")[0]);          function getBoxText(searchBox) {         //TODO: do something with searchBox;     }      In the second example, its not immediately clear that `searchBox` is an `element`, as opposed to a `nodeList`, XML DOM, or something else, so when I come back to write this method, I have to go find the call and remember what it is. I would be tempted to change the function declaration to:               function getBoxText(seachBoxElement) {      Even worse, later I might be tempted to call `getBoxText(somethingNotAnElement)`. Is there an accepted convention for this? Thoughts?


How to read Scala code with lots of implicits?

Consider the following code fragment (adapted from http://stackoverflow.com/a/12265946/1333025):               // Using scalaz 6     import scalaz._, Scalaz._          object Example extends App {       case class Container(i: Int)            def compute(s: String): State[Container, Int] = state {         case Container(i) => (Container(i + 1), s.toInt + i)       }            val d = List("1", "2", "3")            type ContainerState[X] = State[Container, X]            println( d.traverse[ContainerState, Int](compute) ! Container(0) )     }      I understand what it does on high level. But I wanted to trace what exactly happens during the call to `d.traverse` at the end. Clearly, `List` doesn't have `traverse`, so it must be `implicit`ly converted to another type that does. Even though I spent a considerable amount of time trying to find out, I wasn't very successful. First I found that there is a method in `scalaz.Traversable`               traverse[F[_], A, B] (f: (A) => F[B], t: T[A])(implicit arg0: Applicative[F]): F[T[B]]      but clearly this is not it (although it's most likely that "my" `traverse` is implemented using this one). After a lot of searching, I grepped scalaz source codes and I found `scalaz.MA`'s method               traverse[F[_], B] (f: (A) => F[B])(implicit a: Applicative[F], t: Traverse[M]): F[M[B]]      which seems to be very close. Still I'm missing to what `List` is converted in my example and if it uses `MA.traverse` or something else. * * * **The question is: What procedure should I follow to find out what exactly is called at`d.traverse`?** Having even such a simple code that is so hard analyze seems to me like a big problem. Am I missing something very simple? How should I proceed when I want to understand such code that uses a lot of imported `implicit`s? Is there some way to ask the compiler what `implicit`s it used? Or is there something like Hoogle for Scala so that I can search for a method just by its name?


why compiler design/coding design considered the highest level activity in programming?

In some recent articles I have read I have found that in the programming ladder compiler design is always considered as highest level activity. Why is this so? Why not database design or network protocol architecture. Here is one such article.


Omit terminating semicolon in a tag - a good idea?

It's possible to omit the **terminating semicolon** in a tag. Example:
       Name	Email	       <? foreach ($receivers as $receiver): ?>
         <?= $receiver->name ?>	         <?= $recevier->email ?>
       <? endforeach ?>
      Note the `<? endforeach ?>` without a semicolon after `endforeach`. The PHP Documentation says: > The closing tag of a block of PHP code automatically implies a semicolon; > you do not need to have a semicolon terminating the last line of a PHP > block. **Why am I bringing up this subject?** Currently I and a friend of mine work in a proprietary PHP project with MVC (model-view-controller). For the view I evaluated some PHP template engines like Smarty, Moustache and even designed my own home-grown template engine. But when I read that PHP is a template engine in itself something went « _click_ » in my head. Why not just agree in the team to use a limited subset of PHP as a template engine? And having many code reviews to keep up the rules? And this subset could look like this:   * Use only short tags `<?`, `<?=` and `?>`   * Use only simple expressions without side effects, especially **don't assign variables**   * Use only `if`, `foreach`, and `include` for statements   * Use only the alternative syntax for control structures   * Have only **one** statement in a tag each This is the context where we are omitting the terminating semicolon, namely for `<? endforeach ?>`, `<? endif ?>` and `<? include("list-contents.php") ?>`. **However I read often that omitting terminating semicolons is a bad practice. Why? Is it a bad practice at all?** I am happy that PHP allows omitting the terminating semicolon because this minimizes the visual clutter in the template files. They should look mostly like HTML files with only tiny PHP fragments here and there. The example above is what I am striving for. What do you think about this? If you are against it: why? If you support it: Why would it be a good idea? What should I tell my partner if he is referring me some text against omitting the semicolon? Please back up your opinion with facts, references or your own experience.


C#, architecture and jobs

Do I need to have a knowledge of architecture along with C# to get a job using C#, or if I worked through some books (no architecture content) would that be sufficient for a graduate position? I finished university and have a Software Engineering degree, but can't recall any of the architectures and frameworks module content such as setting up an n-tier architecture.


How to handle "porting" software that's still in development

My company is building an iOS version of an Android app that our client is developing (but has not yet released). We have access to the latest builds and source, however since the software is frequently re-structured and refactored, we're doing a lot of unnecessary re-work. In addition, the due date on the contract will likely be passed before the client's application is even ready for release. In other words, we're supposed to build the iOS version before the original Android version is even complete. Luckily the client tossed out the original deadline, but now we may have to renegotiate pricing... never a fun situation. _Are we handling this incorrectly?_ How are "ports" (especially between mobile platforms) normally done? Is there a correct way to pipeline development for multiple platforms without so much re-work? Thanks in advance! :)


Why PHP doesn't support function overloading?

I am wondering if one of the key features of a programming language is to have the ability to overload functions via arguments. I think it is essential in- context of the Object oriented programming. Is it intentionally left behind and not allowed? Or is overloading not a good practice?


Learning about security and finding exploits

First things first: I have absolutely no interest in learning how to crack systems for personal enrichment, hurting other people or doing anything remotely malicious. I understand the basis of many exploits (XSS, SQL injection, use after free etc.), though I've never performed any myself. I even have some idea about how to guard web applications from common exploits (like the aforementioned XSS and SQL injection) Reading this question about the Internet Explorer zero-day vulnerability from the Security SE piqued my curiosity and made me wonder: how did someone even find out about this exploit? What tools did they use? How did they know what to look for? I'm wary about visiting hacker dens online for fear of getting my own system infected (the Defcon stories make me paranoid). So what's a good, safe place to start learning?


What happens when a project switches to a different license?

I've been reading a bit about software licenses, and I'm having trouble getting my head around the idea of what happens when one wants to change the license. I've read a couple of questions here on the topic and it clarifies things some, but there are still a couple of areas that are unclear to me. One example: Suppose I have a project hosted on github with no license specified. If someone contributes a patch to my code base and I merge it in, does that patch still belong to them? If so, would I need their permission to change the license on my project? Another example: Suppose I have my software under some permissive open source license. I understand that I am allowed to change the license on my software at will (barring conflicts with contributors), but does that effect existing copies of the software out there? If I decide to close source my project, do existing copies of the source with packaged OS license remain open source and distributable according to the previous license? I like the idea of working together with others on projects in a flexible manner, and unless a project actually starts to pick up it seems like unnecessary overhead to go about deciding on an appropriate license. It would be nice to be more aware of the potential conflicts that could crop up, though.


any issues with using git in a CI environment?

I work in a shop that lives by its CI process. We have traditionally used SVN and are considering moving to git (want to leverage its ease of branching, stashing, etc). Thinking in terms that a distributed source control system, by its very nature, seems to put the need for a central repository as a secondary concern, does git create any challenges for a CI process? As long as the developer performs a "commit" then "push", does the concept of a central repo as I would have known it with SVN still exist, making CI builds just a different config (pull from git rather than svn)? Any cultural issues (developers pushing to main repo less often and instead only committing locally perhaps)? Would love to hear success/failure stories from a group that uses CI with git.


What is best pratice for user stories containing two roles

I have a number of user stories where the same feature needs to be shared by multiple roles. I have started writing these stories like this: > As a Role-A or a Role-B   >  When I perform Action-X   >  Event-Y should occure. Is this the correct way to represent that concept in user stories, or should I break it up into one story for each role?


Convert list of 24-hour-precipitation values into total-by-hour

Let's say I have a list of precipitation values by hour, each showing how much rain happened in the prior 24 hours, ordered by date. For example:               {         '2012-05-24 12:00': 0.5, // .5" of rain from 5/23 12:00 - 5/24 11:59         '2012-05-24 11:00': 0.6, // .6" of rain from 5/23 11:00 - 5/24 10:59         '2012-05-24 10:00': 0.6, // .6" of rain from 5/23 10:00 - 5/24 09:59         ...         '2012-05-23 10:00': 0     }      Is there a strategy/algorithm to determine how much rain fell in each of the hours? I can't seem to wrap my head around this. I know that it's not as straightforward as just summing the diffs. **Visualization of Dataset**               P(N)    [.....======================]     P(N-1)  [....======================.]     P(N-2)  [...======================..]     P(N-3)  [..======================...]     I want  [..........................=]      Many thanks for any help.


Design: Sharing a class between multiple forms

This question relates to a question I asked earlier, which can be used for reference here: Is this the best way to approach this design? Is this an example of MVC? While coding, I came across a realization that I am not creating 'loose coupling'. The way I am trying to solve the problem right now is creating an instance of the **Log Collector Class** in **MAIN** and passing it around to each form classes constructor. Now, in theory, the **Log Collector Class** needs to be instantiated only once for the whole program run-time. I was thinking about using a Singleton Pattern for this class, ~~but than thought that if two forms need to update this class at the same time, there would be an issue.~~ What would be the best way to have the Log Collector Class be shared via multiple forms without instantiating a new version of the Log Collector Class each time? I've done some research before posting this question and have read some people say using a static class for this type of design. However, this doesn't seem like loose coupling to me. **Another Question** Would an Interface for the Log Collector Class be best used here for all forms wanting to communicate with it? For example:               public interface LogCollectorInterface     {         void SendLogMessage(string logMessage);     }      Now when all forms want to communicate with the **Log Collector Class** , this is the only function they really need to use, SendLogMessage. Would instantiating the interface rather than the **Log Collector Class** be the best way to go about it? FWIW, I am not sure if 'loose coupling' is the best direction is the way to go. It's one of those things I have caught on to while reading questions answered related to OOP. Being a new OOP programmer, it makes the most sense to me for both as an organizational standpoint and testing standpont. **Edit:** This will not be a multi-threading application so no two forms can update the log collector class at the same time.


Documenting Function That Takes Random Parameters?

What's the best approach to creating documentation (displaying the function prototype if you will) for functions that take a variety of different forms in terms of parameters. Let's say there are 10 different choices:               param(name);     param(name, type);     param(name, options);     param(name, type, options);     param(name, fn);     param(name, type, fn);     param(name, options, fn);     param(name, type, options, fn);     param(options);     param(options, fn);      How would one write a function prototype (documentation) for these types of methods (even ones that don't come to this extreme)? Some projects use function "overloading" in the documentation:               .on(event, fn, [capture])     .on(event, selector, fn, [capture])      But would the length be outweighed by the clarity or flexibility?


Advise how to write a simple test for this javascript snippet?

I'm trying to start unit testing (not using any testing frameworks) for my javascripts. Here's one example of it.               var obj = {};          obj.disableBtn = function ($btn, style) {       $btn.attr('disabled','disabled').addClass('disabled').removeClass(style);     };      The use case is as such:               obj.disableBtn($('.submit'), 'btn-blue');      What it does is simply add the `disabled` attribute, add the `disabled` class, and remove the `btn-blue` style. Please advise how would a typical test case look like in this case. I have a little knowledge on testing using `assert()`, but have no idea how to go about it when it involves verifying the result on HTML elements.


The right place to embed a parser : Server or the Client?

I'm writing a database management software. It has a client-server architecture where the server has the piece of code to store and retrieve. The client has to get the input from the user, connects to the server and queries it. Now I have a parser that can parse SQL like queries. My question is which is the best place to embed this parser? ### Option 1-Embedding it in the Server: Get the queries from the client, pass it untouched to the Server and then parse it and do the needful. (OR) ### Option 2-Embedding it in the Client: Get the queries from the Client, parse it then and there and then pass a command object that has specific fields set reflecting the queries to the server and the server acts upon the data in the command object. Which is the right way to do?


Can I borrow parts of an apache-licensed project for something not open-source?

If I want to make a card game app or android, could I legally borrow parts of the Apache-2.0-licensed Solitaire-for-Android? Would I be able to charge such a project? (I was unable to understand the legal jargon in the license here.)


Planning troubleshooting in a sprint

From time to time we face difficult problems which are hard to reproduce. Creating a planning for solving such an issue is (nearly) undoable. What we do at the moment is break these up in analyses/reproduction and solving the problem. As long as know nothing we plan a number of hours to investigate and book off these hours by effort and not by result. This does not feel like a true agile sprint. Do you guys have any suggestion how to improve this situation?


What is needed to deploy an application that uses Microsofts new LocalDB?

I'd like to know what microsoft components need to be installed for this new LocalDB to run on a users machine. > **Now in CTP3: SQL Server Express LocalDB** LocalDB is a new lightweight > deployment option for SQL Server Express Edition with fewer prerequisites > that installs very quickly. This makes it ideal for developers who need an > embedded SQL Server database for desktop applications or tools. LocalDB has > all of the same programmability features as SQL Express, but runs in-process > with applications and not as a service. It is available as part of the SQL > Server Code Name “Denali” CTP3 download. The above is from Microsofts website New in CPT3 This sounds like the perfect SQL database for small one-user desktop applications. I'm trying to find out what I need to include in an install. I want to use this as an embedded database but I don't know if I need to install any Microsoft components or make sure that any other Microsoft compenents have previously been installed. Does anyone know what Microsoft components need to be installed in order for this new LocalDB to run? Is there an installer out there that will automatically detect the presence of the necessary componets an install them? ### Moderator Help Needed: How do I migrate this question to http://dba.stackexchange.com?


asp .net development skills transferred to sharepoint?

Would a competent asp .net C# developer be disregarding a lot of their skills in order to have more concern with configuration and server-side coding when moving their career into the sharepoint 2010 arena? Or is asp .net C# in fact just a good base to begin the study of sharepoint on?


In my work the language used to write applications is Visual Basic .NET. I read on internet and almost all the examples and questions are about C#. Is there any comercial application written in Visual Basic .NET? Is there any field for a VB Net developer?


What are the legal considerations when forking a BSD-licensed project?

I'm interested in forking a project released under a two-clause BSD license: > Copyright (c) 2010 {copyright holder} All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > > (1) Redistributions of source code must retain the above copyright notice, > this list of conditions and the disclaimer at the end. Redistributions in > binary form must reproduce the above copyright notice, this list of > conditions and the following disclaimer in the documentation and/or other > materials provided with the distribution. > > (2) Neither the name of {copyright holder} nor the names of its contributors > may be used to endorse or promote products derived from this software > without specific prior written permission. > > DISCLAIMER > > THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" > AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE > LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF SUCH DAMAGE. I've never forked a project before, but this project is very similar to something that I need/want. However, I'm not sure how far I'll get, so my plan is to pull the latest from their repository and start working. Maybe, eventually, I'll get it to where I want it, and be able to release it. Is this the right approach? How, exactly, does this impact forking of the project? How do I track who owns what components or sections (what's copyright me, what's copyright the original creators, once I start stomping over their code base)? Can I fork this project? What must I do prior to releasing, and when/if I decide to release the software derived from this BSD-licensed work?


When an interpreter executes code: Is there a "chain of interpretations" down to the lowest level?

After doing some research and with the help of people on this site, I finally came to an understanding of what interpretation actually is. Essentially, what interpretation means is (correct me if I'm wrong):   1. Scan a piece of code.   2. Come up with a piece of code in another language, with the same meaning.   3. **Execute** that new piece of code. So for example, and interpreter written in Java that interprets code in C, and sees this line of code:`printf("hello world");` Will come up with this line of code: `System.out.println("hello world");` And will **execute** it (as opposed to a compiler, which will **store** it). **If all of this is true, then here is my question:** I think, that **every execution an interpreter carries out, actually creates a chain of interpretations down to the lowest level.** I'd like to know if this is true. Here is what I mean: When an interpreter **executes** a line of code (which is the new line it came up with, after scanning a line), **it actually tells the underlying platform to interpret it.** For example, as we know, an interpreter written in Java that interprets C code, sees `printf("hello")` and **executes** in reaction the new line of code `System.out.println("hello")`. But what does " **executes** `System.out.println("hello")`" actually mean? **It means to tell the underlying platform (in this case the JVM) to interpret this line.** And so, another interpretation begins: The (in this example) interpreter in the JVM receives the line `System.out.println()`, comes up with a new line of code with the same meaning in another language, and **executes** it. And when it **executes** the new line of code, again: It actually tells it's underlying platform to interpret it (in this example, the OS). And then another interpretation begins in the OS, which comes up with a new line of code with the same meaning in a different language, and tells an even lower level to interpret it. This continues down to the lowest level of the CPU. My question is: Is this true? **Is every execution an interpreter carries out, actually a call to the underlying platform to interpret?** (Thus creating a chain of interpretations down to the lowest level?) When people say that an interpreter **executes** code, do they actually mean that it tells it's underlying platform to interpret that code? (And so on?) _(Note: I might be not accurate about the function of the JVM specifically, I missed some steps there. But my question is more general, Java is just an example)._


Is it possible to get entry-level jobs and internships without devoting all your time to programming?

I'm majoring in computer science in college, and I'm currently in summer program for a business minor. With the schedule and all the outside group projects and studying its impossible for me to really program, and I'll only have a short time free before the start of Fall semester. To make matters worse, I've been told my education path—with my business focus—will start to downplay the importance of programming for the rest of my time at school, further atrophying my programming skills. I'd like to apply for software development internships over the summer, but it doesn't seem likely I'll be able to land any when other candidates have spent much more of their time programming. Am I overemphasizing the importance of knowing programming front-to-back for intern/entry level positions, or is it really necessary to focus most of my time to programming, at the expense of other things I want to do (like have a social life)?


License on papers published at universities?

I've done some searching around on how to interpret morse code inputted by a human. I haven't found any existing libraries or applications that do this, but I found some academic papers on how it can be done. Before embarking on the journey of trying to interpret the academic language and advanced topics I have to know if it is okay for me to use these papers? What kind of license do they have? One I'm thinking of specifically is "A Morse-code recognition system with LMS and matching algorithms for persons with disabilities." but also others floating around. The paper mentioned appears to cost money to read, but then what? Can it have been patented? What rules apply here?


Is a grid or p2p architecture a subset of a broker architecture? what are the key features that make these similar or distinct?


Is it possible to write a code without class methods, globals, and class variables?

I'm designing my own programming language for fun, and I'm thinking of making it fully Object-oriented (no statics, no globals, no class variables, no class methods), so I need to find a way to completely eliminate the needs of class methods, but, first, I need to make sure that I know all the problems that could only be solved by using class methods. So, usually, class methods is used for creating helpers, and named constructors, yes? (Anything else?). Currently, this is what I have to replace those with Object-oriented designs: For example: the File helpers, I'm thinking of designing it like this:               class File       def initialize(path)         @path = path       end            def copy(destination)         # Copy file from @path to destination         # Then open destination path by creating new file instance       end     end      _I'm actually using C, but I wrote the example in Ruby so it will be easier to understand._ No class methods, and you could chain it like this:               File.new("directory/file").copy("new_path").copy("other_path")      If its too long, I could just drop the "new" method like what Python do:               File("directory/file").copy("new_path").copy("other_path")      Math helpers can be replaced with mixins:               module Math       def pow(value)         @value = @value ** value       end     end          class Integer       include Math            def initialize(value)         @value = value       end     end      Call it like this:               Integer.new(100).pow(10).pow(10).pow(10)      In case you still need some helpers:               module Helpers       # Some block of codes     end          class Object       include Helpers     end      And now it's accessible everywhere. To add more helpers, just modify the Helpers module:               module Helpers       # Add more helpers     end      We can create factory class instead of named constructor:               class Lexer       def initialize(source)         @source = source       end     end          class LexerFactory       def create_from_file(file)         return Lexer.new(File.read(file))       end            def create_from_string(string)         return Lexer.new(string)       end     end          class Base       def initialize(lexer_factory)         @lexer_factory = lexer_factory       end            def lexer         @lexer_factory       end     end          lexer = Base.new(LexerFactory.new).lexer.create_from_file("directory/file")      So my questions is: What am I missing? What you can't do without class methods, and class variables? What problems that could only be solved by using those?


You've shipped, you get a rare seg fault. Pointer checking or let it go?

You've shipped, asserts are turned off, you receive a _rare_ crash report indicating that a null pointer violation occurred in your code. In a development environment, the problem would have been caught by an assert. All you have is a crash report, so reproducing the issue is near impossible. Following the backtrace doesn't give any clues as to why the crash happened in the first place. Options: \- Add pointer checking to prevent the crash. This will prevent the crash, but you probably won't even find out why it happened in the first place. \- let it fly, hope that it happens again with a repro scenario Let's say the application isn't intended for a guided missle or automatic braking system... Which would you choose?


Getting a job in the software industry coming from the games industry?

Is it even realistic to try and do enter the software industry coming from the game industry? I feel like I have pretty strong skills with regards to programming in general- I'm somewhat into Agile programming techniques and pay close attention to code quality, have some limited experience using SCRUM, and have a pretty strong knowledge of C# and to a lesser extent C++ however I don't have experience with any business technologies- only game technologies. Whenever I see any ads they are always heavy on technology experience so I'm not sure how I would have any chance.


How much effort goes into maintaining a build system?

In StackExchange Podcast #09 it is remarked: > Another study recently looked at how much effort goes into maintaining the > build system: 5 to 30% of all development effort is spent on maintaining the > build system. With the variations being huge even when working on similar > projects. What is the name of the study referenced, and where can it be found? The audio of the podcast contains no further details. Additionally, does anyone have any links to other studies covering the same topic.


Is repeating links to the same class in a single javadoc comment a bad practice?

I'm currently writing an API and its documentation. For example I have something like this:               public interface Event {     }          public interface Process {     }          public interface EventProcessor {         /**          * Starts to process the sepcified event asynchronously. The returned          * {@link Process} can be used to track progress on the processing. If the          * specified event causes more {@link Event events} to be processed in this          * system, then they are also tracked via the returned {@link Process}.          *           * @param event          *            to be started to process          * @return          */         Process startProcessing(Event event);     }      In the example above, the javadoc link to the interface `Process` is repeated. In the API I'm writing there are cases where I have several more references to the same class in a single javadoc comment. Should I always mark references to the class/method/etc. as javadoc links? Generally, I think having many links in a javadoc comment is a sign for high cohesion. But when it's often the same target, which is linked, I'm not sure if this is good.


How to protect yourself as DevLead from political management games

As a developer/DevLead you've got your focus on developing software and you may be quite good in it. Developers are, however, in my observation often not so good at playing political games. This concerns in particular about:   * Protecting yourself and to provide information correctly   * Keeping track about: Who has said what   * Who is to blame if anything goes wrong   * Etc. Management guys are much better in the game of looking good and blaming others. :) Are there common rules and techniques for software developers and DevLeads to protect themselves from political games and making life easier?


Software Architecture Modelling

I am a little confused at how best to visually model a space-based architecture (SBA) for presenting the system/software architecture design to a client. The goal of this modelling is to show:   * The major components of the system (e.g.: databases, server exposed API, client, server workers, client exposed API)   * Interactions between these major components   * Primary end-to-end workflows Currently I am thinking to use BPMN2 notation with swimlanes; and sequence & use-case diagrams in UML2 notation. Not sure if this approach is best, would be great to get some feedback :)


What could be a good team building activity to improve estimation skills?

I'm putting together a presentation to deliver to some of my teammates (all developers), and I'd like to include a short team building activity that focuses on improving estimation skills. Does anyone have any suggestions or know of any team building activities I could use?


Is SourceSafe really safe?

Having spent all morning trying to check something in - I now realise I've lost a couple of days worth of work. Its happened before - and is apparently common occurrence with SourceSafe. Can SourceSafe be used successfully, without problems, and if so, how?


What is considered to be a "modification" of sources under the BSD license?

I have a question about the 3-clause BSD license based on it's Wiki description. It states: > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > ... What is understood by "modification"? Specifically I am interested whether any/all of the following is considered as such modification:   1. Reading the original sources and then re-implementing a custom way.   2. Reading the original sources, waiting for a year and then re-implementing something based on whatever you could remember.   3. Direct and very significant "complete" refactoring of the original sources.


What is a good start for small web-design projects?

What are the most common templates, languages, web-design tools that you recommend for me to be able to start web-design? I do software but I have not not had web-design experience, I have been a Win32 developer with VB 6.0, Delphi, C#,etc.., not web-based. The type of web-design I have in mind is some simple web-sites, even static web sites, that the owner of some small business like a restaurant wants to have a web-site to show its services ..I know there are some stuff people start with like WordPress, Joomla, PHP CMSes, CSS frameworks,... I am looking for stuff like this that helps speeds up building a nice website...what are the things people mostly use these days? Thanks


Patterns for Maintaining Model State in Real Time

While some platform in some languages already address this issue, I would like to keep this semi-language agnostic and to focus on patterns associated with this issue. I have a data model that contains FirstName, MiddleName, and LastName (to keep things simple). First and Last names are required and may have other rules to ensure their validity. Middle name is optional. By default, the model is empty and thus, invalid. When a value changes, an event can be triggered to validate the field that changed. My question is what patterns can be used to best manage the state of the object since, based on the scenario, I'm doing field level validation. Should I move to model level validation on field change which would address the state issue or is there an alternate way?


How can I prototype my app better?

A few weeks ago I saw a story about a master app designer showing how he worked with good old pen and paper to do effective prototyping before writing code. I'm unable to dig up that story (and I think it was a video) but if you could recommend any other useful resources I'd appreciate them. I know roughly what I want to build, but want a useful framework for thinking about how the screens should flow together. The app I want to build is for the iOS platform, but I think the video might have been about creating a web app. Thanks!


Is there any formal research in FizzBuzz Question Effectiveness?

After seeing this question today on variation of the FizzBuzz interview question, as well as seeing other questions related to it around, I have to ask: is there any _formal_ research on how effective this is as an interview technique? There are plenty of folks who say that it filters out some crazy- sounding percentage of candidates (95%+ in some cases) but how good is it for finding good programmers/developers? There has been some research that shows that soft skills might be better indicators than hard skills for choosing a good candidate for a job role. As well, there might be some intermediate reasons for so many candidates failing this test (nervousness, thinking "it's a trick", etc). **EDIT:** Based on the comments so far, it looks like the idea behind FizzBuzz questions is to determine whether or not the person has good (enough) coding skills to be further considered. I'm not totally convinced FizzBuzz actually does this. Also, remember that FizzBuzz filters _a very large percentage_ of candidates _very early_ in the hiring process, which could mean that significant numbers of good candidates are being removed early on because they can't solve silly problems fast enough. Also, I'll point out that looking at FizzBuzz effectiveness is something that can completely be done in a quantitative manner. This is unlike looking at "fit" or "passion" which are highly variable and highly unscientific (but still quite important for new hiring decisions).


What is the benefit of not using Hungarian notation?

One of the things I struggle with is not using Hungarian notation. I _don't_ want to have to go to the variable definition just to see what type it is. When a project gets extensive, it's nice to be able to look at a variable prefixed by 'bool' and know that it's looking for **true/false** instead of a **0/1** value. I also do a lot of work in SQL Server. I prefix my stored procedures with 'sp' and my tables with 'tbl', not to mention all of my variables in the database respectively. I see everywhere that nobody really wants to use Hungarian notation, to the point where they avoid it. My question is, what is the benefit of _not_ using Hungarian notation, and why does the majority of developers avoid it like the plague?


Why do we need a Heap if everything can be done much more efficiently on the Stack?

This is actually somewhat related to the question I asked yesterday about why both a Stack _and_ a Heap are necessary in the applications we use today (and why we can't just go with a Heap instead of both, in order to have a simple & singular standard to go by). However, many of the responses indicated that a Stack is _irreplaceable_ due to the fact that is many hundreds (or thousands) of times faster than trying to allocate/reference the Heap. I know there is a problem with dynamic storage allocation if we do away with the Heap, but isn't there a way around this, or perhaps, a way to improve on the Stack so that it can handle dynamic memory allocation?


User stories are too high level and conceptual, management expects developers to fill in the blanks

I am employed in a very brilliant company with a true intention of doing XP. Communication is good and management is open to constructive discussion but due to pressing time constraints, some certain things are considered too RUP to be discussed. At the moment I'm a little troubled with the volume of change that becomes necessary while implementing the stories. I believe many of these discoveries (which take time and effort of course) are the responsibilities of the story writers (customers, end users and product owners) and not the developers. To put is short, user-stories are too conceptual and just convey the underlying intention but lack enough details (specially pre-conditions and post- conditions, relevance to other stories, dependencies and alike). The developer is expected to fill in the blanks at his own discretion by the virtue of XP developers being designers and analysts at the same time. The problem is many of these blanks are discovered after some wrong assumptions have made made their way into evaluation time and code since noticing added complexities emerge than initially anticipated. Even then finding the right thing to fill in takes time which is - to various degrees - considered as deviation from the initial estimations. I'm looking for a constructive way of conveying these implications to the management in a way that would not pose me as someone who is trying to unnecessarily complicate things. I'm new and as yet I have not established much credibility. You insights are most welcome. Closely related and somehow gives an answer : How much detail about a user story can a developer expect?


Is git-flow in the spirit of git?

The question is pretty self-explanatory. I've had some experience with git- flow, and not much more _true_ experience with plain git before that. (I was using it more as a backup-provider.) I'm confused as to what consensus is, given that I can safely assume that there are a large number of git users who miss 'the good old days' of formal, centralized version control, and just want a piece of it back (cf. rant article below) Related articles:   * The seminal   * an anti-git-flow rant * * * _"spirit of git"_ in the question title is, whatever it means to you. For me, I remember that it's a DVCS, not a CVS. git flow seems like it's imposing an organized branching model where one might not need to be there at all, where it would be essential in a centralized system such as SVN.


Why does JavaScript count array lengths by the last index?

JavaScript seems to calculate the array length property by the number of the last index in the array rather than counting the number of items in the array. Example:               var testArray = ['a', 'b', 'c'];     console.log(testArray.length); //3     testArray[8] = 'i';     console.log(testArray.length); //9      Normally I would use push() and wouldn't add a value to an array using bracket notation, but this was a bit of a surprise. Is there any reason for this implementation of assigning a value to Array.length? The only thing I can seem to come up with is that it just uses the last index as a performance optimization to avoid counting the array items.


How large should a Python module be?

I was browsing a github project and found **this module** which has more than 8 thousands lines. Is it good practice to have that much code in a single module? Shouldn't this be split over multiple modules? maybe one for each db engine? And what benefit does the developer get from making one huge module like this?


There has been a lot of media attention paid in recent months and years to the increase in CS majors and the possibility of a second tech bubble. Some news reports have suggested that as more people enter CS, the market could be flooded with CS professionals and jobs could be increasingly difficult to find. Is this a bad time to be majoring in computer science? Edit: I'm a non-trad student who allready has a Bachelor's degree in economics and will be pursuing a CS degree starting this upcoming summer semester at the Univ of Kansas. I've been programming for about two/three years and just need a more formal education to fill the holes in my head. I have an interest in CS, it's just that I am worries about the prospects for the future.


What is best practice for log level in PHP?

When programming in C, I often get the advice to turn on many or all warnings and not ignore warnings. Does the same hold in PHP, should I enable all warnings in the PHP log?


How much time/money should be spent on software QA/QC?

Any non-trivial commercial application/program/system/what-have-you requires testing (QA/QC). Not counting things like automated tests, how much time/money relative to the development investment in the project should be spent testing (e.g. with live people)? I know there's no magic percentage of time or budget, and individual projects will differ in size and scope of testing, but is there something that's considered good practice? An application may be perfect in every way, but still the only means of ensuring that is to test it. Basically my employer wants to cut down on testing of over-seas-developed software, but I have strong reservations against that (being in charge of QA and having worked with the vendor before, I don't think that our directive of telling them to "make fewer bugs" is exactly going to get us results, no matter what is stipulated in the contract). Is there any kind of best-practice or guideline that I can look to?


Good way to manage database test data?

Standard LAMP stack: CentOS, Apache, PHP, MySQL plus Java (via Google Web Tools), eclipse, mercurial Currently we have a manual integration step where a feature branch is pushed to a staging server where QA tests the feature by poking at it with the GUI. We use a shared dev database. We're running into the problem where feature branches require different database schema creating a bottleneck between feature branch development and acceptance testing. We'd like to start having separate dev databases but do not know how to handle populating the database with test data (the web app requires some base amount of data to be present to start up i.e. users) and keep that test data in sync with the merging of feature branches, etc. I read lots of suggestions and tools regarding database schema changes, but not managing database test data. We're only a two person shop so keeping things simple is important. We've thought of just maintaining scripts (SQL files or otherwise) to populate the test database. Does anyone have resources, success stories, or advice to share?


What is your favorite whiteboard interview problem?

Just as the title says, what is your favorite whiteboard interview problem, and why has it proven effective for you? Junior, senior, Java, C, Javascript, PHP, SQL, pseudo-code, etc.


Tracking progress via a burndown chart when sprints overlap

Our team has adopted some agile practices to help us develop and deliver our software to our client. We adopted practices as needed (as problems/challenges were identified) rather than jumping wholesale into the agile camp. The big ones for us are maintaining a product and sprint backlog and developing and delivering new versions in one month sprints. We do estimate the items in our sprint backlog to guesstimate what we can deliver within a sprint however we are not tracking progress very well so its difficult to know whether or not we are on target. The next step in our evolution appears improve our progress tracking ability. We are looking at using burn down charts to aid us. However, our sprints overlap significantly due to established and procedures for our software promotion schedule. We have the following established events:   1. **Development begins** on _Sprint 1_ and continues until _code freeze_. That said we do test our software throughout this phase with the development and test groups.   2. **Code freeze** stops development on _Sprint 1_ functionality. We have small window to finish or fix any issues before the next event _acceptance promotion 1_. In addition development begins on _Sprint 2_.    3. **Acceptance promotion 1** promotes the application to the client's acceptance environment where it is tested by our test group. Issues identified in testing may be fixed during a small window before _acceptance promotion 2_. Meanwhile _Sprint 2_ development continues.   4. **Acceptance promotion 2** promotes the application one last time to the client's acceptance environment to validate any issues identified during _acceptance promotion 1_. _Sprint 2_ development continues.   5. **Production promotion** promotes the application to production and it is tested by our test group and _Sprint 1_ is officially completed. This is when it is truly done. A visual depiction of this can be seen below. The average calendar time between **development begins** and **code freeze** is four weeks. The average time between **code freeze** and **production promotion** is two weeks. ![Overlapping sprints](http://i.stack.imgur.com/fKqke.png) larger resolution version This schedule of events is not within our control. Client policy dictates when application software is promoted from Test to Acceptance to Production. No application code may be modified beyond our second fix window. We do not perform the promotions. This is accomplished via '3rd' parties at the client's site, again, due to policy. In addition some tasks, like such data updates can and do happen outside of this schedule. Some data updates follow the code (for instance, when there is a schema dependency) but others such as data bugs or updates can and do occur outside of this schedule. This is due to fewer restrictions as to what may be modified on the clients environment. Only application code is restricted to these specific milestones. Data and configuration are exempt and technically may be modified as needed. We are considering tightening this up so that data updates follow the same schedule as the code. Given this scenario, overlapping sprints I have a several questions?   1. What is the proper way to create/handle a burn down chart when we burn development, testing, and data hours from the previous sprint while working also working towards the next one? I think we have 2 concurrent burn down charts on for each sprint.   2. Assuming we at most have two burn down charts how do we best display the cumulative burn down when the sprints overlap so as to understand our actual workload progress on each so as to best set us up for success?   3. If items are found in Sprint 1 after code freeze that need to be addressed in Sprint 2 how does that our Sprint 2 backlog and burn down? I assume that for critical items we need to bump out less critical Sprint 2 items to make room for the incomplete Sprint 1 items. Non critical items will be bumped to Sprint 3 or later.   4. What would be the proper start and end dates for the burn down chart?  It seems the best option would be to reflect reality. Sprint 1 is not truly done (including testing and data updates) until **production promotion** and its final testing. So the start date would be **development begins** and the end date be **production promotion** despite any overlap.   5. What else am I missing? What else could or will bite us?


Making a class pseudo-immutable by setting a flag

I have a java project that involves building some pretty complex objects. There are quite a lot (dozens) of different ones and some of them have a HUGE number of parameters. They also need to be immutable. So I was thinking the builder pattern would work, but it ends up require a lot of boilerplate. Another potential solution I thought of was to make a mutable class, but give it a "frozen" flag, a-la ruby. Here is a simple example:               public class EqualRule extends Rule {         private boolean frozen;         private int target;              public EqualRule() {             frozen = false;         }              public void setTarget(int i) {             if (frozen)                  throw new IllegalStateException(                     "Can't change frozen rule.");                  target = i;         }              public int getTarget() {             return target;         }              public void freeze() {             frozen = true;         }              @Override         public boolean checkRule(int i) {             return (target == i);         }     }      and "Rule" is just an abstract class that has an abstract "checkRule" method. This cuts way down on the number of objects I need to write, while also giving me an object that becomes immutable for all intents and purposes. This _kind of_ act like the object was its own Builder... But not quite. I'm not too excited, however, about having an immutable being disguised as a bean however. So I had two questions: 1\. Before I go too far down this path, are there any huge problems that anyone sees right off the bat? For what it's worth, it is planned that this behavior will be well documented... 2\. If so, is there a better solution? Thanks


Closest Point of Approach (CPA) mathematical formula in ship radar

I was recently searching for the mathematical formula to find closest point of approach (CPA) between one ship and another ship. I need to apply the formula in my radar ship program and I can't find the correct way to calculates it. Does anybody know what the correct formula (or pseudo-code) is instead of plotting it manually?


Is there really a choice of the best language for a specific project?

Programmers.SE has plenty of questions of beginner programmers asking if they must use a specific language or another one in their daily work, or if they must learn a language or another. Those questions are quickly closed, and when they receive answers, those answers are of type: > Use what is best for a specific project. There are languages that cannot be reasonably used for some sorts of projects. For example, it would be strange to use Assembly to create a dynamic website, or to use PHP to create a rich desktop Windows application or to use Ruby to create a video game with hardware acceleration. But in general, does the "Use what is best for a specific project" rule work?   * If I create a simple business desktop application, how can I say that for this business app, C# is not appropriate at all, while Java is the best choice?   * If I create an ordinary small or medium-scale website, how can I say that I must use C#/ASP.NET MVC over Ruby on Rails? **Comparing mainstream languages, they are all pretty similar**. I choose C# over Java because I don't know Java very well; I choose ASP.NET MVC over PHP because _in my opinion_ , PHP sucks; I choose PHP over ASP.NET MVC when my customers have a web server running Linux. In all cases, every time I have to to a choice, I consider:   * my skills in the languages to choose from,   * languages I personally want and enjoy to use,   * software and hardware requirements (i.e. difficulty to deploy Java or Ruby on Rails website on a server which has already a support for PHP),   * legacy and interoperability concerns. Does it mean that I lack broad knowledge in _several_   languages? What happens in other companies? **Is there a real choice, for every project, of the language which is the best one in a precise case?** How could such choice be made in a situation where the mainstream languages are so similar?


Data warehouse architecture for mutating schema

I am setting up an ETL process and small data warehouse for querying the data in a few different dimensions. One issue is that the schema for the objects can mutate over time - mainly that some fields will be added and some removed. What are some methodologies or approaches for handling this? (Note the source data is managed as EAV, which is hard to query and it's slow - hence the DW approach in the first place). What seems like a naive approach (which can often be the best) is to simply add columns over time to the destination shapes in the warehouse, and backfill existing objects with some query-valid placeholder data. This is a little outside my domain expertise though, so looking for input.


So I wanted to inherit from a `sealed class` in _csharp_ and got burned. There is just no way to unseal it unless you have access to the source. Then it got me thinking "why `sealed` even exists?". 4 months ago. I couldn't figure it out, despite reading many things about it, such as:   * Jon Skeet's wishes "classes were sealed by default in .NET."   * Prefer composition over inheritance?   * "You should not seal all classes (...)"   * How do you mock a Sealed class? I've tried to digest all that since then, but it's just too much for me. Eventually, yesterday I tried it again. I've scanned over all of them again, plus few more:   * Why should a class be anything other than "abstract" or "final/sealed"?   * In over 15 years programming, first time I've heard of SOLID, out of an answer from a question already linked and I obviously didn't read it all 4 months ago Finally, after lots of pondering, I decided to _heavily_ edit the original question based on the new title. The **old question** were too broad and subjective. It was basically asking:   1. In the old title: One good reason to use sealed   2. In the body: How to properly modify a sealed class? Forget about inheritance? Use composition? But now, _understanding_ (which I didn't yesterday) that **all`sealed` does is preventing inheritance**, and we can and should indeed use composition over inheritance, I realized what I needed was _practical_ examples. I guess my question here is (and in fact have always been) exactly what Mr.Mindor suggested me in a chat: _How can designing for inheritance cause extra cost?_


Entity to DTO Usage

Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using DTO objects from your DAO to Service layer through the use of some sort of mapper. The basic flow I foresee is as follows:   1. UI Model / Form --> Controller   2. Controller converts Model into Domain Object (Entity)   3. Domain Object --> Service Layer   4. Domain Object --> DAO   5. DAO --> Domain Object(s)   6. Service --> UI   7. UI converts Domain into UI models If DTO was followed DAO would pass back a DTO not the Entity. After doing some reading it seems like DTO has become slightly defunct since (at least in Java) entities have become annotated POJOs meaning their memory footprint has become very small. Is this the case, or should DTOs be used to completely encapsulate the domain objects within the DAO layer, and, if this is the case, what would the service layer pass to the DAO? Thanks a bunch!


Should an interviewer be prepared to answer any question he asks?

As I gain more professional experience, I've become a bit more skeptical about a lot of the politics of the interview process. In particular, I'm curious to know if y'all think it's ok to ask the interviewer the same questions you're asked. For instance, in an interview a few years back, I was asked: > Where do you see yourself in 5 years? I gave a decent answer, and then asked the interviewer: > Where do you see yourself in 5 years? He actually gave a fairly thoughtful answer. What about questions like:   * Why do you like working here?   * Tell me about a time you had a conflict with a coworker and how you resolved it.   * Answer this question. EDIT: I meant:   * Answer this [insert technical gotcha question here] question.


Using a flag in in-memory-repository to indicate update to entity

I'm about to write a lot of test for my application. While some of the tests check whether everything works if the user enters the right data, most of them deal with wrong/missing data. In these cases nothing should be updated and an exception should be thrown. At the moment, this leads to a lot of duplicated code, because every test has to make sure that not only the exception is thrown but that no data in my ( ~~mocked~~ in-memory) database is changed. My first idea was to move these tests into a function and to call this function in every test. Pro: I still can use very explicit tests. Contra: I have to remember changing the function and adding more tests whenever I add more functionality to the checked function. But I could as well add a property to my ~~mocked~~ in-memory-repository that indicates whether an entity was updated. Pro: I'll never have to worry about a forgotten check. Contra: The check is quite vague - When it fails I'll only knew that _something_ was changed. In order to find the error I'll have to debug step by step through the function. What is the better approach? Maybe there's an even better third solution?


Help putting together an Open Source Friendly contract but does not allow day job work to be Open Sourced

So I just was hired at a place that had only one Developer and that was the co owner. Their employee handbook had something to the effect of the following. > All IP, inventions or software you develop while at X company is the > property of the company. Additionally you will have to provide a list of all > prior inventions, software or IP developed prior to working for company x. This is an issue for me because I have both side projects and occasionally contribute to open source stuff and would like to continue to have the ability to to both. I talked about it with the owner and he agreed to making changes and asked me for an outline that is fair for both parties. He would take that to a lawyer and they would go over it and apply it. So with that I'm looking for some wording I could submit to that effect to helping me put this together in such a way that I and any other software developers are protected as well as company x and its software. That or a resource or guideline for this sort of thing. To clarify, the company's software isn't allowed to be made open but the employees will be allowed to work on side project both of an open-source and private nature as long as they don't come to compete with the company's best interest. If it helps we are in the USA.


How to explain bad software to non-technical people?

In discussing software development with non-technical people (customers, business owners, project sponsors, etc.), I often resort to analogies and metaphors. It's relatively easy and effective to use a "house" or other metaphor for describing the size and complexity of new development. However, we often inherit someone else's code or data, and this approach doesn't seem to hold up as well when trying to explain why we're gutting something that already seems to work. Of course we can point to cycle time and cost to be saved in the future but this generally means nothing to business folks. I know doctors can say "just take this pill," but I'm not sure that software devs have the same authority. Ideas? EDIT: Let me add a bit to the discussion. The specific project I'm talking about has customers that don't realize (or care) about specific aspects of the system we're retiring (i.e., they think it was just fine):   1. The system would save a NEW RECORD every time someone updated a field   2. The system contained tables for reference data. These tables had new records added every day, even though they were duplicates of previous records. And there was no way to tie the reference data used for a particular case at the time it was closed. This is like 99% of the data in the old system.   3. The field NAMES also have spaces, apostrophes and other inappropriate characters in them, making everything harder to work with.   4. In addition to the incredible amount of duplicate data, they have around 1000 XLS files with data they want added to the system. Previously, they would do a spreadsheet for each case in the database, IN ADDITION TO what they typed into the database. Getting rid of this old, unneeded information and piping in the XLS data comprises about 80% of the total project effort, and was not something we could accurately predict. I'm trying to find a concrete way to describe how bad this thing was, mostly so that the customer will understand why the migration process has been so time-consuming. The actual coding was done pretty quickly and the new system works fine, but without the old data they won't be happy. Sorry to get into the weeds, but most of the answers I've seen so far are pretty basic scope/schedule/cost things. I've been doing this for 15 years, so this really is more of a reflective, philosophical question - but without some of the details it can be difficult to really appreciate the awful beauty of this problem.


Should the usage of DI/IoC remove all occurrences of the "new" keyword?

Should the usage of Dependency Injection and an Inversion of Control container remove **all** occurrences of the "`new`" keyword from your code? In other words, should every object/dependency, no matter how simple or short- lived, be "registered" within your IoC container and injected into the method/class that needs to use them? If no, where do you draw the line between which dependencies/objects get registered in the IoC container, versus what gets created "in-line" as a concrete reference, via the `new` keyword ?


Entire webpage obfuscation

I want to obfuscate all the webpages of my website. I Googled through some free tools like HTML and Javascript obfuscation but don't know how effective they are. First of all, does it makes sense to obfuscate a webpage that could comprise of variety of codes like Javascript, PHP etc. Secondly, how effective is this method and please recommend some free nice tools.


On the effectiveness of unit testing

**EDIT:** I think that no one really understood the question. I think that this is partly my fault as well, so I hop it gets better now. The thing is, I am perfectly aware of the existence of mocking frameworks, and so on. This is not the problem. The problem is what happens when you change your method's implementation and it simply doesn't call the mock anymore, and you start seeing a bunch of red lights in your test stack, because your mocks aren't called the way the way they should? Unit or Integration test, something should be done here, right? Another one, if I start writing different mock methods for every test condition I like, what happens if I decide to change the signature of the class I'Ve mocked? All my tests go to the trash bin, right? Is this normal, can it be avoided? Is it a design problem? I hope I am not confusing you more, guys. How effective are unit tests in reality? I am under the impression that at some point unit tests turn into tests that test the dependency between the object under test and another object. Sure, one can always abstract dependencies using interfaces, but what happens when even the interfaces should be changed? What if the unit under test no longer relies on those dependencies? If our tests fail because of dependency issues, does it mean they are too coupled to our code? Also, do we have to change them every time when we change the dependencies? If it happens quite often, is this a sign that our design is wrong? I tended to believe that unit tests are an effective way to test ensure robustness, but if they are too coupled to the dependencies that our objects have with other objects (be they expressed as interfaces), it simply leads to more time wasted in fixing those tests to pass the new design. Am I wrong? NOTE: Someone mentioned that when we test the dependencies between two objects, it is no longer considered unit testing, but rather, integration testing. I don't know what to believe in, any longer


Creating a large quantity of types VS using mostly the ones provided by the language

There are several times where you're coding a method which has two parameters with the same type, lets say, integers, `NumberOfUnitA` and `NumberOfUnitB`. Given that we're coding in a language that doesn't support named parameters, why is that we don't see people creating types closer to the domain logic, in this case, `UnitA` and `UnitB`, but just raw integers? It seems much more expressive to me. And even in other situations, many times, we have to pass a bunch of flags, and they are just integers (even in cases where perfomance is not an issue), why we do this? Does it create unnecessary complications? What are the problems of this approach of creating many types?


What process do you normally use when attempting to debug a problem/issue/bug with your software?

Most people seem to treat debugging as an art, rather than a science. For those here which treat it as a science, rather than an art - what process(es) do you normally use when faced with a new issue/bug/problem?


tracking time for personal projects

Does everyone track time spent on personal projects? I feel that it is valuable to know how much time (and potential money) has been put into a hobby. I am currently using harvest to track time.


When is Singleton appropriate?

Some hold that the Singleton Pattern is always an anti-pattern. What do you think?


Singleton: Is Singleton an Anti-Pattern

Was reading an interesting blog post on Singleton design pattern which is so widely used. If it's stupid or as in some quora posts, its an anti-pattern why is it so widely used even in frameworks. For e.g., Spring framework (java) makes all the classes available through dependency injection as Singleton classes and adding prototype is optional.


When to use a Singleton and when to use a static class

I've searched about this here and on StackOverflow and found some differences between the two. But I'm still not sure _in what cases one would prefer a Singleton, and in what cases one would choose to use a static class_. (In languages which don't support 'static classes', like Java, I'm obviously referring to classes containing only static methods and fields). Please give me concrete examples of cases where you would pick each one, and explain why.


Singletons in C++, are they really necessary, used?

> **Possible Duplicate:**   >  When is Singleton appropriate? Ok, most people probably know what a singleton is, use them, and know all the drawbacks including race conditions and so on. But what I never really figured out, is why people still use them, and why they are so popular, when the implementation is actually usually error prone or complex. Double locked constructors and so on. Because it seems that even in large projects, it's not really that often when you have an object that should be created only once, and if there is, there seem to be easier ways to achieve it. Has anyone actually been a situation where singleton cruft made their lives easier for the rest of the project?


Is there is a case when there is no any reasonable replacement for singleton design pattern?

> **Possible Duplicate:**   >  When is Singleton appropriate? I've seen many explanations why is Singleton is evil. But is there really no such a case when Singleton is the only beautiful solution?


Is it OK to reoccupy my old GitHub username to protect repository redirections?

I'm considering changing my GitHub username from the old alias I was using as a kid to my real name. I'm concerned about my repository URLs. GitHub will redirect the old URLs, but if someone creates a new account using my old username and creates a repository with the same name as one of my repositories, the URL redirection will break and the URL will lead to their repository, not mine. Now, this is understandable, and GitHub recommends to not count on the redirect in the long term, and update all the remotes, but I'm concerned about some Vim plugins I'm hosting on GitHub. It's a common practice to manage Vim plugins with Git(either as separate repositories or as submodules), and if one of the plugins' remotes break you'll get error messages when you try to batch- update all your plugins(it happened to me once...). It's not **that** hard to solve, and the chances that'll happen are slim, but I would still like to avoid causing trouble to the users of my plugins... To prevent this, I think to create a new account with my old username. That way I can avoid the risk of someone else taking my old username and breaking the redirects of my old repositories. While researching this approach I've found GitHub's Name Squatting Policy. According to that policy, GitHub can delete or rename inactive accounts. To my understanding, they do this to prevent Cybersquatting, but surely this isn't the case with my fake account - I'm not holding someone else's name in an attempt to sell it to them, I'm merely occupying a name **I** was using to protect **my** old URLs... So, is it acceptable to go with this plan an create a fake account with my old username?


Should I help anonymity related projects?

Projects that increase online anonymity, such as Tor and bitcoin, allow personal freedom from government oppression but also allow crimes to go unpunished. As a developer, should I contribute to such projects? Is there a way to enforce that those technologies will not be used for money laundering and child pornography?


Is AOP widely used in the enterprise sector

I'm curious to here the opinions of people working in large enterprise organisation whether AOP is widely (or even modestly) used when they are developing? Is AOP something which is inherent in the design. Because from everything I managed to find on the Internet (including by reading the AspectJ in Action, 2nd ed. book) I was left with the impression that AOP is something which is more of a "niche" type of technology. My main point is whether there is a point in investing effort and time in learning to an acceptable level - e.g. the join-point mechanism, advices etc. Furthermore, do you design with AOP in mind or you use it to amend shortcomings in an existing design?


Company wants us to use escrow or provide SLA

We have a SaaS business (we host everything) where people, using our software, pay for various services offered by a few "vendors." We collect this money and every week we deposit the balance into the vendor's account. Our cut is a small piece from each of these service payments; so if nobody buys anything the vendor doesn't pay anything. This model has worked fine, but we're now in talks with a larger vendor (government) that was asking for escrow for our service. They asked the trigger (for the release of the code) to be bankruptcy, not providing the service at a reasonable level (can't remember the actual term used), or acquisition by a third party. We told them that we don't have a problem with the bankruptcy trigger, but the acquisition part we can not agree with because who would want to buy us if our customers have the option of just running our software for free. Are we rightfully concerned about this scenario? After we mentioned that a trigger cannot be acquisition by a separate company or if they think our software doesn't live up to some standard, they countered that in this case they would want some kind of SLA with "really high requirements" instead of the acquisition or service trigger -- but still have the escrow for bankruptcy. Doesn't SLA imply some kind of monthly or yearly service fee? We structured our model so that if a company does use our software they don't pay anything. We thought this would be preferred over a monthly/yearly fixed cost. Are we being unreasonable? Thoughts?


Is it fair to reduce OOP to mere hierarchical composition of data structures?

Meaning that OOP allows me to have data-trees, of arbitrary depth and breadth, with some leafs being functions (and those leafs would be called methods) ? Because everything else that people often put near "OOP" mark, just don't seem to have anything to do with it. (Inheritance, subtype polymorphism and encapsulation seem to be orthogonal to OOP). Am I right? Or I'm missing something ?


Are there best practices for checking for errors in business logic for DB refreshes?

I'm working for a company with very large databases which all refresh overnight, ready for users to interrogate in the morning. These over night loads essentially truncate all the tables, and reload again using pretty complicated business logic. This is all fine and good, but occasionally, rather than going through the proper routes, a quick fix is needed in the business logic, and changes will be made on the "Live" server to the business logic without too much testing. This has, as I'm sure you can imagine, resulted in subtle but significant mistakes being made. I basically want to now independently write logic (in T-SQL probably) which will try to spot any abnormal changes, so at least I'm ahead of the game, and can report them sooner. My question is, fairly obviously, does anyone have any advice on this? Is there any theory or general good practice which I could incorporate to hopefully limit the impact of future "quick and dirty" changes to business logic? Just so you know, we do use source control, and use Live, UAT, and Dev server environments, its just that sometimes, changes need to made immediately, rather than going through the stricter channels.


Is there an advantage to using WCF or WebAPI for mobile?

I'm looking at doing my first mobile development using Mono Touch and Mono for Android. I'd like them to communicate with an ASP.NET MVC 4 site I'm designing. I've worked with WCF and WebAPI in the past but I'm wondering if there are any **quantifiable** advantages to using one over the other in this context?


List of reserved words a username can't be?

> **Possible Duplicate:**   >  Is there a list of common usernames to reserve in a new system? I'm working on a site where users will have a custom URL e.g.: http://domain.com/username I want to avoid the situation where a user registers and creates a username that I later need, e.g. if I want a page at domain.com/about and someone's already named themselves 'about'. Does anyone have a list of generic words that could be added to a blacklist for this?


Algorithm to find if a set can be recreated

I'm finding it hard to solve the problem and was hoping that someone could help me with the solution or at least give me a search term to use for problems like this one. The generalized problem: I have a set of numbers (e.g. `[1,2,3]`) and a an array of sets (e.g. `[1,4,5],[4,2,3],[6,7,8],[2],[1,3]`). What I need to do is to find if I can create the first set from the others by taking 1 or 0 elements from them (e.g. taking 1 from the first, 2 from the second and 3 from the last). Order of the elements doesn't matter in any of the sets.


Which one is better?Change sprint dates or one team member is not attend sprint plans for 4 months

We have an agile team and nearly running 80. sprint.Our sprint starts wednesday and finish Tuesday 10 days after.One of our team member,developer, will attend to a university course every Wednesday during 4 months.Which one is better should we take sprint days Tuesday to Monday,total sprint day will not change still 10,or one member will not attend to sprint plans and team will give commitment for her.