Real world pitfalls of introducing F# into a large codebase and engineering team

I'm CTO of a software firm with a large existing codebase (all C#) and a sizable engineering team. I can see how certain parts of the code would be far easier to write in F#, resulting in faster development time, fewer bugs, easier parallel implementations, etc., basically overall productivity gains for my team. However, I can also see several productivity pitfalls of introducing F#, namely: 1) Everyone has to learn F#, and it's not as trivial as switching from, say, Java to C#. Team members that have not learned F# will be unable to work on F# parts of the codebase. 2) The pool of hireable F# programmers, as of now (Dec 2010) is non-existent. Search various software engineer resume databases for "F#", way less than 1% of resumes contain the keyword. 3) Community support as of now (Dec 2010) is less available. You can google almost any problem in C# and find someone that has already dealt with it, not so with F#. Third party tool support (NUnit, Resharper etc) is also sketchy. I realize that this is a bit Catch-22, i.e. if people like me don't use F# then the community and tools will never materialize, etc. But, I've got a company to run, and I can be cutting edge but not bleeding edge. Any other pitfalls I'm not considering? Or anyone care to rebut the pitfalls I've mentioned? I think this is an important discussion and would love to hear your counter-arguments in this public forum that may do a lot to increase F# adoption by industry. Thanks.


Why do programming books have such wacky cover art?

All the O'reilly titles, and numerous other programming books usually have a typified icon for their covert art. Sometimes it's minstrels, or medieval figures, and sometimes its camels and strange animals. This is, however, a consistent phenomenon. Why do you think programming books have such weird (interesting) motifs for cover art?


Interpreter or virtual machine that does not execute bytecode

The developers of the Dart language tell that there is a virtual machine that executes statements written in Dart language. What is the difference between an interpreter and a virtual machine that executes a language? Until now the virtual machines that I knew, like Java Virtual Machine, Common Language Runtime, and Dalvik all execute bytecode that has been previously compiled from a programming language. How does it work a virual machine that executes directly a programming language?


How to manage github issues for (priority, etc)?

I'm new to github, and am looking for advice on how to manage issues. I'm used to having priority and other ordering options but see that none exist. How do others manages issues during the lifecycle of a bug/feature? Thanks in advance.


Should a one person team use a process model?

I am about to start work on my biggest project yet (about 6 months full time work). For previous projects as they were only short I never intentionally used a model, I may have done but I didn't set out to do it. So... Before I start this project would it be advised to try and use some model? And if it is then what do you think would be useful to a 1 person team?


Webcam software for both Windows and Linux – possible?

my visually impaired sister uses a webcam with DIY stand as a digital magnifier to read printed texts. We wanted to initiate a project to create a software - in fact only a modified webcam viewer (like Cheese in Linux). Is it possible to have one SW for both platforms (Windows and Linux) = almost the same code, same filters and GUI, and just use the video stream using some standard protocol? Because most people use Win, but we would like to support Linux primarily. I am not sure if this is possible in windows. We need the software to take the video stream and apply some color and other effects like those described in this article. The idea is to maintain only one application (best would be open-source) with a small differences for both platforms. For the GUI, the GTK seems to be optimal as it is accessible for ScreenReader SW. Such app would not only help the visually impaired but also the elderly people. So, is this possible or is this idea really stupid? thanks :-D


Is using nested try-catch blocks an anti-pattern?

Is this an antipattern? It is an acceptable practice?                   try {             //do something         } catch (Exception e) {              try {                 //do something in the same line, but being less ambitious             } catch (Exception ex) {                 try {                     //Do the minimum acceptable                 } catch (Exception e1) {                     //More try catches?                 }             }         }


Tool for large scale graph analysis

What are the best tools / frameworks / libraries available to implement and run algorithms on graphs? In particular I need a tool that can load a set of nodes, edges and values assigned to these edges and then allows me to perform operations on them. I already found R but I'm wondering if there is a more "programmer friendly" tool available?


A free game-development language?

So, I'm trying to teach my much younger cousin a little bit about programming. My initial thought was something like Scratch or Alice, but there were a few downsides to that.   * Everyone seems to be really in to game programming and developing video games (because everyone loves playing video games, and as far as playing video games goes, playing your own can be the most rewarding) - but neither Alice nor Scratch seem to cater to game development   * Alice and Scratch seem too childish, while I'm sure my cousin would enjoy dabbling in it, I think he'd quickly bore of it   * I want a language that can be used to develop really cool stuff that will impress his friends. I remember writing BASIC back in the day and inviting all my friends over and showing off my creation, and I just feel like Alice and Scratch just don't appeal in the same way   * I want a language that requires my cousin to write code. Now, this isn't just because I think typing code out is good preparation for other programming languages, but it's because it gives him an opportunity to actually practice typing, and maybe get used to some of the slightly more esoteric characters on the keyboard Now, that's why I don't want to choose Alice or Scratch. I also don't want to pick a language like C or Java, or even Python or Ruby for that matter. My cousin has already imparted to me that he enjoys playing video games and wants to make his own, and that he enjoys using computers. In my opinion, even a simple language like Python or Ruby simply takes too long to build cool stuff. Ideally, he'd sit down, spend around a day or two (or maybe even up to a week, but hopefully less than that) and have a working, 2-dimensional game. I'm not saying you can't do it in Python or Ruby, but I'm just saying it would be difficult for a first-time programmer. Plus, I don't want to bog him down with all the computer science stuff, as that can come later. I just want to help him create the spark, and then let him carry on with the rest of the fire. I've looked at languages like Lua, and while it seems common in game programming, I'm not sure if it's the best pick - but if you guys think otherwise, please let me know. I've also looked at a language like Blitz and it looks really promising (plus, I tried it out a few years ago, and it was really quite nice). The downside is that I have to pay, something I'm definitively against. I've looked at SmallBasic, which seems promising and I'll continue looking at. But I haven't done much (in fact, I'm running the installer as I type this, so I'll report my thoughts on it shortly). UPDATE: I gave SmallBasic a quick try and it seems intriguing, but it also seems quite different compared to some other languages - that's not a bad thing, but it just is an unusual. Out of the things I've looked at, Blitz is still my favorite, but I refuse to go there because of the cost. But basically, what do you guys think of what I've said so far, and the languages I've looked at and do you know of any other, good alternatives? * * * UPDATE: Here's what I've chosen to do... I've realized that while I would love to help my cousin, I can't be with him all the time, and I can't help him every time he needs help. So, I wanted to choose something that has a good documentation, a good community, and a good book he can follow. Anyways, I've chosen Python and Pygame. Python is a language I'm fairly familiar with, plus I know there is a pretty good (and pretty large) community around Python. Furthermore, I know that the Python documentation is fairly complete and easy to navigate. Pygame also has an excellent documentation and set of tutorials. I'm also having him use/follow _Invent Your Own Computer Games with Python_ , which seems like a very good book, I bought him a hard copy as a Christmas present, plus I know that his monitor isn't huge, and it would be inconvenient to constantly swap back between the text and the editor. I think it should go well! EDIT: I don't want to imply that my choice is final or that it is correct. I just think it's the best fit for this situation. I think each person looking to teach someone younger should browse the selection and find the best solution for the individual person, considering things like age, skill level, and interest.


Dynamically change of UI on value changes in list box

I have a list box with several elements, let it be web servers (tomcat, iis etc). For each list box value, UI must have different views. For example, if we choose IIS, user name and password fields appear. If we choose tomcat, some additional fields appear depending on user OS - IP and port for linux and path for windows. My current approach is the following: \- I created two enums. The first one for different OS (windows, linux, mac os x. The second one for servers: iis, nginx, tomcat etc. \- I have a method that returns the OS enum value. \- When user makes a choice, I determine it and basing on this choice I check user's OS. And after it I determine what UI elements to hide/add. Here's some sort of pseudo-code for what I have:               //OS enum     public enum OS {         WINDOWS, LINUX, MAC_OS_X;     }          //Servers enum     public enum SERVERS {         TOMCAT, IIS, NGINX;     }          //Server Listbox Handler     private void chooseServer() {             //...get value from list box             switch(server) {                 case TOMCAT:                     changeUI(getOS()); //getOS() returns OS enum value                     break;                 case IIS:                     //IIS is for windows only                     changeUI(OS.WINDOWS);                      break;                 case NGNIX:                     //Temporary support only linux                     changeUI(OS.LINUX);                     break;             }         }          //UI changes here     private void changeUI(OS os) {             switch (os) {                 case WINDOWS:                     userNameField.setEnabled(true);                     userPasswordField.setEnabled(true);                     ipField.setVisible(false);                     portField.setVisible(false);                     serverPathField.setVisible(true);                     break;                 case LINUX:                     userNameField.setEnabled(true);                     userPasswordField.setEnabled(true);                     ipField.setVisible(true);                     portField.setVisible(true);                     serverPathField.setVisible(false);                     break;                 case MAC_OS_X:                     userNameField.setEnabled(false);                     userPasswordField.setEnabled(false);                     ipField.setVisible(false);                     portField.setVisible(false);                     serverPathField.setVisible(false);                     break;             }         }      I don't like the moment when other OS or new servers will be added. These switch operators will grow more and become more complicated, I don't speak about maintainability of this code. Are there any standard approaches (patterns) for such tasks that help to avoid switch/if...else grow and to make code more generic, expandable, readable and supportable? * * * I tried to implement Adapter pattern suggested by Neil and ran at some obscure moment. Here's some pseudo-code:               public abstract class EditorAdapter {         protected boolean firstInit = true;         public abstract void adapt(Panel panel);     }          //--------          public class IISWindowsEditorAdapter extends EditorAdapter {         @Override         public void adapt(Panel panel) {             if(firstInit) {                 firstInit = false;                      panel.add(userNameField);                 //add other elements             }         }     }          //--------          public class TomcatEditorAdapter extends EditorAdapter {         private OS os = getOS();              @Override         public void adapt(Panel panel) {             if(firstInit) {                 firstInit = false;                      if(OS == OS.LINUX) {                     panel.add(userNameField);                     //add other elements                 } else if (OS == OS.WINDOWS) {                     //add elements                 } //... else if             }         }     }          //--------          public class Editor extends DialogEditor { //extends Dialog with protected Panel field (subPanel)         public Editor() {             initialize();         }              public void initialize() {             //...             main.add(createPanel()); //protected VerticalPanel main;             //...         }              public void createPanel() {             //listBox initialization             commonPanel.add(listBox); //panel with common elements             listBox.addClickHandler(new ChangeHandler() {                 @Override                 public void onChange(ChangeEvent event) {                     selectServer();                 });             }             //... add other common elements         }              private void selectServer() {             //... get selection             switch(server) {                 //Here something should be done in order to control different layouts.                 //At the moment, each choice adds more elements in addition to existing ones                 //As a variant, one can create class fields for each adapter and manipulate with them using lazy initialization                 case IIS:                     new WindowsEditorAdapter().adapt(subpanel);                     break;                 case TOMCAT:                     new TomcatEditorAdapter().adapt(subpanel);                     break;             }         }     }      The problem is that I have several tables/panels in my Editor that at the end are added to main panel. In general, it looks like:   * we open a dialog   * choose web-server   * some elements change inside the dialog according to our choice (and some choices are affected with OS user is using). That's why first UI initialization with adapter doesn't work here. At least I didn't catch how to implement this adapter for logic above.


Question on refactoring and code design

Suppose, I have a class with a constant static final field. Then I want in certain situations that field to be different. It still can be final, because it should be initialized in constructor. My question is, what strategy I should use:   1. add this field value into the constructor   2. create 2 subclasses, replace original field usage with some protected method and override it in subclasses   3. Or create some composite class that will held instance of my class inside and somehow change that value? Which approach should I use and why?


Best (worst) logically impossible task assigned to you?

What was a project or spec that got put on your desk that could not possibly be done? How did you explain the dilemma to the "requester"? More importantly, did they understand after you explained the fundamental issue?


Central Exception Handler

Recently I've been thinking about a general ExceptionHandler, that I could initialize once in my app context and inject it everywhere. The idea that it will have quite simple interface with just `public void handle(Exception ex)`, and then according to exception type it should decide what to do, maybe just log it, or show an alert message to the user, or maybe kill the whole app. The question is, what is the prettiest way to write such handler without lots of `instanceof`s? Unfortunately googling gives me only the default exception handler for `RuntimeException` that was introduced in Java 5. My first idea is to create an enum, that will have Class field for exception type and it will return the appropriate execution point, for example a concrete exception handler that also implements the interface `public void handle(Exception ex)`, but with the required casting already. **UPD** @alex I thought about this option and there was a reason I didn't felt ok with it. Suppouse we have code that uses jcifs to acces a file. Simple copy to local storage will require three exception wraps: _SMBException_ , _MalformedUrlException_ and _IOException_. If I don't use Java 7 catching them may result in repeating three times _CenralExceptionHandler.handle(e);_ which is not that readable. Anyway, when I think about it, it's my fault that I can't use Java 7, so maybe your suggestion is the best. But I'm still in doubts.


Generating random math expression

I have this idea running around in my head, to generate and evaluate random mathematical expressions. So, I decided to give it a shot and elaborate an algorithm, before coding it to test it. ## Example: Here are some example expressions I want to generate randomly:               4 + 2                           [easy]     3 * 6 - 7 + 2                   [medium]     6 * 2 + (5 - 3) * 3 - 8         [hard]     (3 + 4) + 7 * 2 - 1 - 9         [hard]     5 - 2 + 4 * (8 - (5 + 1)) + 9   [harder]     (8 - 1 + 3) * 6 - ((3 + 7) * 2) [harder]      The _easy_ and _medium_ ones are pretty straight-forward. Random `int`s separated by random operators, nothing crazy here. But I'm having some trouble getting started with something that could create one of the _hard_ and _harder_ examples. I'm not even sure a single algorithm could give me the last two. ## What I am considering: I can't say I _tried_ those ideas, because I didn't really want to waste much time going in a direction that had no chance of working in the first place. But still, I thought of a couple solutions:   * Using trees   * Using regular expressions   * Using a crazy "for-type" loop (surely the worst) ## What I'm looking for: I'd like to know which way you believe is the best to go, between the solutions I considered, and your own ideas. If you see a good way to start, I'd appreciate a lead in the right direction, e.g. with the beginning of the algorithm, or a general structure of it. Also note that I will have to evaluate those expressions. This can be done either after the expression is generated, or during its creation. If you take that in consideration in your answer, that's great. I'm not looking for anything language-related, but for the record, I'm thinking of implementing it in Objective-C, as that's the language I'm most working with recently. Those examples did not include the `:` operator, as I only want to manipulate `int`s, and this operator adds many verifications. If your answer gives a solution handling this one, that's great. If my question needs any clarification, please ask in the comments. Thanks for your help.


Which questions a Software Developer/Sr. Software Developer (non-DBA, non-Database Enigneer) should be able to answer about databases?

I am a Java developer and most of my experience is on Java. But sometimes I have face some database related questions in the interviews. Hence I wanted to ask that from the interview point of view, which questions a Software Developer/Sr. Software Developer (non-DBA, non-Database Enigneer) should be able to answer about databases? I know that this is a very subjective question with no definite answer. But I have come across a similar question about J2EE with some really great answers. Hence some constructive suggestions like specific topics, areas, questions, even links to resources will be greatly appreciated.


What are some effective ways of making scrum more dynamic earlier in a sprint?

My team does 2-week sprints, and the trend we've identified (which we want to move away from) is that our daily standup scrums are relatively straightforward early in the sprint, but then transform into a more frantic scramble toward the end. The first week developers are heads down in coding, analysts are developing test plans and answering developer questions, and testers are refining existing tests and identifying areas to test (but not necessarily testing just yet since there isn't as much out there actually ready to test). Blockers and scope creep tend to emerge into the second week, and then as we see how close we're getting to the end, we force ourselves to make tough choices and be more communicative. How can we "spread the wealth" and increase the overall "tempo" (I guess?) of our scrums from the beginning of the sprint to the end?


What to search/research to learn more about this way of coding Java?

What should I search/research if I'm looking for how to get started with translating database tables to Java code? For instance, if I have a one-many relationship in the database and I want to translate that to java code...what is that process called? I'm really looking for just plain Java code example and not any tools at the moment.


How to list open source license owner

I am releasing software developed in a university under the Apache 2.0 license. I would like advice on who to list as the license owner. Would I list only my boss who co-authored the software and maintains the code base, or both my boss and the institution, or just the institution? I'm inclined to put my bosses name and institution, but I wanted to find out of that was an acceptable practice. Also do you know if multiple individuals are ever listed as license owners?


Relearning programming - how is my approach?

I want to preface this question by saying that I've read a ton of questions on Programmers leading up to this one. I was/am particularly affected by the assertion that PHP as a language suffers because of poor coding and the leeway it provides. I have been coding PHP for a long time - I learned a lot as an apprentice to a senior, but have been mostly restricted to web development. I have enough knowledge to quickly respond to challenges and to provide web-based solutions that are secure. I am getting slightly more familiar with MVC and OOP in general, but it isn't a strong point for me. My fear is that I fall into the category of people that give PHP a bad rep - not for vanity purposes, but because I'd really like to be the best programmer/developer possible. I have a penchant for learning and I think it is time to "graduate" to a more in depth understanding of programming and development in general, so I can improve my skills and _become a better programmer._ I think this starts with learning a new language and building a hobby project with some expertise found in literature - books like Code Complete, Clean Code, and references on algorithms. I'd like to integrate their best practices and advice. There are some community college courses as well, but my concern is that I may be beyond some of the classes - they are very introductory. I'm looking for suggestions and tips to attain my goal. I would love to get feedback from the community so I can learn more and (hopefully) be great. Edit: I'm considering Python or Ruby to dive into, but I _think_ a non- scripting language would help me out more. If you have a suggestion there, please include it in your answer :)


Versioning Strategy for Service Interfaces JAR

I'm building a service oriented architecture composed (mostly) of Java-based services, each of which is a Maven project (in an individual repository) with two submodules: common, and server. The `common` module contains the service's interfaces that clients can include in their project to make service calls. The `server` submodule contains the code that actually powers the service. I'm now trying to figure out an appropriate versioning strategy for the interfaces, such that each interface change results in a new common jar, but changes to the server (so long as they don't impact the contract of the interfaces) receive the same common jar. I know this is pretty simple to do manually (simply increment the server version and don't touch the common one), but this project will be built and deployed by a CI server, and I'd like to come up with a strategy for automatically versioning these. The only thing I have been able to come up with so far is to have the CI server `md5` the service interfaces.


MVC Can the model know ANYTHING about the view?

I'm working on a game, and without getting into any details I am using MVC "patterns", "rules" or whatever you want to call it to make the game. The view includes everything needed to draw things on the screen, the controller passes input to the model. And the Model contains game logic. Here's my problem, the game is being made for mobile devices that vary in screen sizes. I feel my model needs to know the view size so it can appropriately adjust for it. I've thought about it for a while I could put all the adjustments in the view, but it just seems inefficient to translate the model positioning to the view's needed positioning every time. If the model knows the size it only needed to adjust itself once. So my question is can I pass the view size to the model without 'breaking' MVC? I feel personally they are still decoupled this way because a size is just a number, I could still change the view any time as long as it has a size. But I wanted to get a community response on this because I haven't seen many discussions of MVC being used in a game. (And to be clear I don't want an answer of why I shouldn't use it in a game, but do I break MVC by letting it know the view's size) EDIT - More details on the game's needs and why I wanted to pass the view. Some objects positions need to be set relative to the edge of the screen (such as UI elements) so that they appear relatively in the same place. Sprite sizes are not stretched if the window size is wider such as an IPhone 5 screen. They will just be placed relatively to the screen edge. .If I gave it to the view to handle this, I will need a flag saying that this element is positioned say x number of pixels from TOP BOTTOM RIGHT LEFT. Then allow the view to draw it with that information. Its acceptable, I just wanted to know if there was a better way while still being MVC because it seems this way will be repeating a logic over and over, where as if I knew the view size in the model, I could convert all the relative positions into absolute positions in one run, but with this I have to convert on every update to the screen.


How should I go about learning Python for website development?

I want to learn about developing websites with Python; how should I go about this? I am not new to programming, as I have knowledge in C#, ASP.NET, HTML, and CSS. What resources should I explore? I had a brief look at Python documentation and Dive Into Python a while ago, although the one I read was a newer version hosted at a .org website which appears to be down right now. Therefore I am aware of some Python syntax, operators, lists, etc. The main thing is that I want to learn about developing websites, and at the same time learn Python overall; I don't want to start back at the documentation or other stuff. **NOTE: You can assume I have zero knowledge in Python since what I know isn't that great.**


Finding all points that are located in one line in 2D coordinate system

I have an array of points. Each point has two members - x and y. I want to get any 3 points and check, are they located in single line in 2D coordinate system. For example - 1x2, 2x3, 5x6: ![Image](http://i.stack.imgur.com/CvUsI.png) If yes, I want to search for another point in my array which is located in that line (line has no start and no end). And so on, while I didn't check all remained points. Then, I want to check next combination of 3 points and repeat while all 3-points permutations are no checked. For every of that permutations I want to tell how many points are located in single line (0 - if these 3 points are no located in single line, 3 - if they are, 4 - if they are and that's other point which also is located in that line, etc.). Is there any effective algorithm that can do it in complexity equal or less than O(n3)?


Penalization of under performing employees, how to avoid this?

My company's management wants to deduct from the salary of under performing employees. I'm a member of the Core Strategy committee and they want my opinion also. I believe that the throughput from an employee depends on a lot of things such as the particular work assigned to them, other members of his/her team, other reasons etc. Such penalizations will be demoralizing to the people. How can I convince my management not to do so?


How can we distribute a client app to other non-US businesses?

I'm working on an app which acts as a client for our web service. We sell this service to businesses, and we want to distribute the app to their employees for free. The app will be customised for each client. If we were in the US, my understanding is that we'd ask them to enrol in the volume purchasing program, and submit a version of our app for each business, for enterprise distribution at the free price point However, the businesses aren't all in the US, so they can't enrol in the VPP. They have thousands of employees, so promo codes won't be sufficient. What are our alternatives?


How to call something that can be both a user and a usergroup?

My idea is, to create an abstract class / interface which can be extended into a user, and into a usergroup. There actually is a good reason for there being this interface connecting the groups with the users as the only differences between a user and a group is that you can login as a user and you can't as a group, and that a group can contain multiple users or groups. Permissions and stuff are handled without taking notice of it being a user or a group.


How can I design test cases to cover code based on random events?

For example, if the code generates a random int from 0-10, and takes a different branch on each outcome, how can one design a test suite to guarantee 100% statement coverage in such code? In Java, the code might be something like:               int i = new Random().nextInt(10);     switch(i)     {         //11 case statements     }


University teaches DOS-style C++, how to deal with it

I had been programming for many years but wanted a diploma to make myself more employable. Having already been through university once, I didn't choose a full 5 year computer science major but a shorter, more practically-oriented _software engineering_ program. I expected that it might focus more on concrete skills than on theory, but still had this idea that universities and professors like things to be correct, formal, academic. It's still science, right? Wrong - I was surprised by how sloppy many IT courses were. In an introductory course on C++ we were tested on clichés like "why are globals bad" and "why are constants good", after just writing 1-2 programs. Random anecdotes without proper context. Handouts contained `system(pause/cls)`, `getch` and headers like `conio.h` and `iodos.h`. One of the tasks was to print "ASCII characters" from 32 to **255** , with a screenshot showing such a table printed using the Windows-1252 code page, but without mentioning encoding at all. **Question** : when a university/professor seems to be using inferior and/or outdated tools and methods, and the content being taught is borderline incorrect, how do you deal with it constructively and respectfully, if at all? Some answers point out that you should look beyond the programming since it is just a tool for learning about topics such as data structures and algorithms. I agree with this idea, but in this case there wasn't really any such plan behind the poor style. Most courses would simply teach another "tool" without much background theory or any "big picture". It often felt like they were quickly put together just for the sake of offering such a course. * * * I stuck with it and finally graduated. Quality remained pretty low throughout (with a few great exceptions), and several other students have been complaining about it. As expected I have learned much more from personal projects and part-time jobs than from school, _however_ the process of finishing school and the label "software student" seem mysteriously useful in themselves!


Best way to load application settings

A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this value may be a number, string, date, etc..). C# uses a similar approach, but the text file must be named "App.config". In both cases, in source code you must initialize a specific class for reading settings: this class has a method that returns the value (as string) associated with the specified setting identifier.               // Java example     Properties config = new Properties();     config.load(...);     String valueStr = config.getProperty("listening-port");     // ...          // C# example     NameValueCollection setting = ConfigurationManager.AppSettings;     string valueStr = setting["listening-port"];     // ...      In both cases we should parse strings loaded from the configuration file and assign the converted values to the related typed objects (parsing errors could occur during this phase). After the parsing step, we must check that the setting values belong to a specific domain of validity: for example, the maximum size of a queue should be a positive value, some values may be related (example: min < max), and so on. Suppose that the application should load the settings as soon as it starts: in other words, the first operation performed by the application is to load the settings. Any invalid values for the settings must be replaced automatically with default values: if this happens to a group of related settings, those settings are all set with default values. The easiest way to perform these operations is to create a method that first parses all the settings, then checks the loaded values and finally sets any default values. However maintenance is difficult if you use this approach: as the number of settings increases while developing the application, it becomes increasingly difficult to update the code. In order to solve this problem, I had thought of using the _Template Method_ pattern, as follows.               public abstract class Setting     {         protected abstract bool TryParseValues();              protected abstract bool CheckValues();              public abstract void SetDefaultValues();              /// <summary>         /// Template Method         /// </summary>         public bool TrySetValuesOrDefault()         {             if (!TryParseValues() || !CheckValues())             {                 // parsing error or domain error                 SetDefaultValues();                 return false;             }             return true;         }     }          public class RangeSetting : Setting     {         private string minStr, maxStr;         private byte min, max;              public RangeSetting(string minStr, maxStr)         {             this.minStr = minStr;             this.maxStr = maxStr;         }              protected override bool TryParseValues()         {             return (byte.TryParse(minStr, out min)                 && byte.TryParse(maxStr, out max));         }              protected override bool CheckValues()         {             return (0 < min && min < max);         }              public override void SetDefaultValues()         {             min = 5;             max = 10;         }     }      The problem is that in this way we need to create a new class for each setting, even for a single value. Are there other solutions to this kind of problem? In summary:   1. Easy maintenance: for example, the addition of one or more parameters.   2. Extensibility: a first version of the application could read a single configuration file, but later versions may give the possibility of a multi-user setup (admin sets up a basic configuration, users can set only certain settings, etc..).   3. Object oriented design.


Abstract Base Class with Interfaces as Behaviors?

I need to design a class hierarchy for my C# project. Basically, class' functionalities are similar to WinForms classes so let's take WinForms toolkit as an example. (However, I can't use WinForms or WPF.) There are some core properties and functionalities that every class needs to provide. Dimensions, position, color, visibility (true/false), Draw method, etc. I need design advice I have used a design with an abstract base class and interfaces that are not really types but more like behaviors. Is this a good design? If not, what would be a better design. The code looks like this:               abstract class Control     {         public int Width { get; set; }              public int Height { get; set; }              public int BackColor { get; set; }              public int X { get; set; }              public int Y { get; set; }              public int BorderWidth { get; set; }              public int BorderColor { get; set; }              public bool Visible { get; set; }              public Rectangle ClipRectange { get; protected set; }              abstract public void Draw();     }      Some Controls can contain other Controls, some can be only contained (as children) so I'm thinking of making two interfaces for these functionalities:               interface IChild     {         IContainer Parent { get; set; }     }          internal interface IContainer     {         void AddChild<T>(T child) where T : IChild;         void RemoveChild<T>(T child) where T : IChild;         IChild GetChild(int index);     }      WinForms controls display text so this also goes into interface:               interface ITextHolder     {         string Text { get; set; }         int TextPositionX { get; set; }         int TextPositionY { get; set; }         int TextWidth { get; }         int TextHeight { get; }              void DrawText();     }      Some Controls can be docked inside their parent Control so:               enum Docking     {          None, Left, Right, Top, Bottom, Fill     }          interface IDockable     {         Docking Dock { get; set; }     }      ...and now let's create some concrete classes:               class Panel : Control, IDockable, IContainer, IChild {}     class Label : Control, IDockable, IChild, ITextHolder {}     class Button : Control, IChild, ITextHolder, IDockable {}     class Window : Control, IContainer, IDockable {}      The first "problem" I can think of here is that the interfaces are basically set in stone once they get published. But let's assume I will be able to make my interfaces good enough to avoid need of making changes to them in the future. Another issue I see in this design is that every of these classes would need to implement it's interfaces and duplication of code will quickly occur. For example in Label and Button the DrawText() method derives from the ITextHolder interface or in every class derived from IContainer management of children. My solution for this issue is to implement this "duplicated" functionalities in dedicated adapters and forward calls to them. So both Label and Button would have a TextHolderAdapter member that would be called inside methods inherited from the ITextHolder interface. I think this design should shield me from having to many common functionalities in the base class which could quickly get bloated with virtual methods and unnecessary "noise code". Changes of behavior would be accomplished by extending adapters and not Control-derived classes. I think this is called the "Strategy" pattern and although there are millions of questions and answers on that topic, I would like to ask you for your opinions as to what I take into consideration for this design and what flaws you can think of in my approach. I should add that there is an almost 100% chance that future requirements will call for new classes and new functionalities.


What issues lead people to use Japanese-specific encodings rather than Unicode?

At work I come across a lot of Japanese text files in Shift-JIS and other encodings. It causes many mojibake (unreadable character) problems for all computer users. Unicode was intended to solve this sort of problem by defining a single character set for all languages, and the UTF-8 serialization is recommended for use on the Internet. So why doesn't everybody switch from Japanese-specific encodings to UTF-8? What issues with or disadvantages of UTF-8 are holding people back? EDIT: The W3C lists some known problems with Unicode, could this be a reason too?


Where is the problem with the output of web forms?

Most of you already know that the output of ASP.NET web forms is quite ugly when you compare it to the output of ASP.NET MVC. My question is what could the problems of that ASP.NET web forms' output cause to the end users? Is it the slow of browsing and the load time?, but do you think that could be a problem in today's high speed connections? I want to choose an easy way to develop websites and I find ASP.NET web forms to be easier than ASP.NET MVC and I wonder if the problems of the output (ugly HTML, etc) can be a real problem for me?


Sun java Certification

> **Possible Duplicate:**   >  What are your thoughts on the Oracle Master (old Sun Certified Java > Developer) Examination? I am graduate student.I do not have any work experience so I was thinking about taking Sun **Java** certification to boost my profile.It costs around 200$ I think.So I was wondering if the certification is worth taking and does it add value. Thank you


application architecture with one or more PDFs

I am writing an iPad application. The main view of the application will be a PDF. I have made considerable progress in parsing out the contents of the PDF. The application will also have at least two "side views". These side views may or may not themselves be driven by PDF files. That is part of what I am trying to figure out. The main PDF will contain some hidden buttons which cause the side view to show certain things. For example, there might be a button over the name "Lincoln" that brings up a side view about Abe Lincoln, another one over the name "Washington" that brings up a side view about George Washington, and so on. The creation of these hidden buttons should be driven by data in the main PDF. I'm thinking this means annotations. Two questions: 1) Is there one type of annotation that I might prefer over another? Options I can see include actions, URIs, and maybe links -- but the last one could be complicated by the numerous internal links within the PDF. 2) Should I use PDFs for the side views? What are the arguments, pro and con? Considerations: A) Ease of moving the app to other platforms later   B) Pirating. I would prefer that someone who got my PDFs not be able to reproduce the app without some work. EDIT: answering the questions posed in an answer: By "action", I mean "PDF action". See section 12.6 of the [http://www.adobe.com/devnet/pdf/pdf_reference.html](PDF specification). The main view is a PDF because that's the format the content author is comfortable creating. But since this PDF will be embedded in the app, I have to assume that it could escape "into the wild".


Company moving away from IBM Rational solution… any good alternatives?

We are moving away from IBM Rational products due to really high costs. I am trying to find alternative solutions that will roughly cover all the functionalities from IBM Rational product line. I included a listing of all products currently in use:   1. IBM Rational ClearCase MultiSite   2. IBM Rational ClearQuest   3. IBM Rational Performance Tester   4. IBM Rational Requistite Pro   5. IBM Rational SoDA   6. IBM Rational Purify for Linux and UNIX So far, I was told SVN / Team Foundation Server / Serena PVCS are decent alternatives but I suspect I may need more tools to cover almost everything provided by IBM. Any recommendations / feedback would be greatly appreciated.


Dealing with Upgrade Lists

I'm curious to how others deal with upgrade lists and feature suggestions for developments (ie popular community driven websites) At the moment, when a user makes a suggestions for an upgrade/feature, we stick it on an 'unscheduled' list to be reviewed in the future when we start setting out the next set of schedule.


Is the structure used for these web pages a design pattern?

I want to know if the structure for an ASP.NET website I'm working on uses a design pattern for it's web pages. If it is a design pattern, what is it called? The web pages have the following structure: ![enter image description here](http://i.stack.imgur.com/yW8BF.png) UserDetails page (UserDetails.aspx) - includes UserDetailsController.ascx user control. UserDetailsController.ascx includes sub user controls like UserAccountDetails.ascx and UserLoginDetails.ascx etc Each sub user control contains a small amount of code/logic, the 'controller' user controls that host these sub user controls (i.e UserDetailsController.ascx) appear to call the business rules code and pass the data to the sub user controls. Is this a design pattern? What is it called?


B.A Computer Science Vs B.S Inf Tech?

Would a recruiter prefer a B.A in Comp Science from a more prestigious university or a B.S in Inf Tech from just an average university? Would it matter for someone already established in the field with plenty of experience? The only difference in the B.A and B.S is essentially the mathematics. The B.S is geared for those going on to master's programs, although one isn't excluded from going on to a masters program with a BA, many do require more mathematics. Just for those curious, the information tech degree is typically geared more to real-world problems then the computer science and the quality of it will vary widely. Some inf tech programs are as in-depth as an ABET C.S degree, the information tech from Drexel looks extremely strong. The Management Information Systems is generally provided via the business school and is more of a traditional business degree. I'm not sure really how well versed the recruiters/g.p are in the actual differences in all of these programs. Some non ABET BS Comp Science may only require 1 or 2 Calculus versus the ABET certified programs.


Is fixing bugs made by other people a good approach?

Let's assume the situation where a team of four developers is building an application. During the testing phase, bugs are reported by users. Who should fix them? The person who committed the erroneous code, or anyone who is free? What is preferred approach in agile development (scrum)?


Choosing the right programmer among a class of undergrads

I am a CS undergrad but I landed a programming job last year and I like it a lot. We are currently 3 programmer in the development section of the company and we have to work with pretty much anything were asked to do. We deal with many different languages and learn them as needed for some quick jobs etc etc. We want to hire a 4th programmer and I'm asked to suggest some students in my class, a year younger, since I failed a class. I don't really know any of these guys except my teammates which I wouldn't suggest. We don't really want to interview them all so I thought we could make a little challenge to help us choose who to interview. We're in need of someone who understand the business even though they're new to it, and likes to learn new stuff and code. Any idea on a programming challenge or a kind of letter saying why we should take them? TL;DR: We need a new undergrad programmer, we want the best to come to us without interviewing them all. Any challenge or test you could suggest?


Issue tracking system by function/method

I often feel that it would be more convenient if, within an issue tracking system, each issue were attributed to a certain function/method. Then, we can easily list all the issues related to a certain function/method. Many issues can be clearly attributed to a certain function/method. At times, we may want to look at issues sorted by the posted/edited time or by importance, be many other times, we want to look through only the issues related to a certain function/method. Of course, the system can be designed to be able to also display them mixed. And there are some issues that do not belong to a particular function/method, but they can be grouped together in some generic group.   1. Is there such issue tracking system out there?   2. Is there any problem with such system. If so, what are the problems?


What are the options for simple Ajax calls for a Java webapp?

I've got a very simple need and I don't know what are the options available. If I simplify, users see webpage like this server by a Java webapp server: > [-] red   >  [x] green   >  [-] blue   >  [-] yellow > > The selected color is green And then I want the user to be able to select the yellow color and have the part of the page containing the relevant text change to: > [-] red   >  [-] green   >  [-] blue   >  [x] yellow > > The selected color is yellow Basically I want something a bit more user friendly than simply using HTTP GET all the time. There shall be a lot of options the user can select from and this shall affect an (HTML formatted) text displayed on the page. And I want the user to see his change as soon as possible, without having the page to fully reload and without being redirected to another page. There shall be a client/server round-trip (the information to display depending on the options selected ain't available on the client-side so I cannot do it all in JavaScript in the browser). I'd like to use Ajax requests but I don't know which way to go:   * jQuery   * GWT   * something else What are my options and what would be the pros and cons of the various approach? P.S: I'm very familiar with Java (SCP since the last century and basically being a Java programmer for the last 12 years or so) but not familiar at all with JavaScript (though I did hack a few Ajaxy-calls years ago, way before great libraries existed).


What are good technical questions to ask to determine the analytical skill of a programmer?

I am a non-technical recruiter and I want to lay out some initial interview questions, one of which is to determine the analytic skill of a person. We will soon launch our hiring process for programmers and we are mapping out what would be the best questions. I have read quite a few posts here that suggested on how to interview programmers but I haven't come across on what technical question to ask that non-technical recruiters can easily comprehend if the answer is good or bad.


Is JSF really ready to deliver high performance web applications?

I have heard a lot of good about JSF but as far as I know people also had lots of serious complains with this technology in the past, not aware of how much the situation has improved. We are considering JSF as a probable technology for a social network project. But we are not aware of the performance scores of JSF neither we could really come across any existing high performance website that had been using JSF. People complain about its performance scalability issues. We are still not very sure if we are doing the right thing by choosing jsf, and thus would like to hear from you all about this and take your inputs into consideration. Is it possible to configure JSF to satisfy the high performance needs of social networking service ? Also till what extent is it possible to survive with the current problems in JSF. What exactly are its problems ? * * * I am **not** worried about the development complexities with JSF what others usually complain about because as per my personal experience I believe that's not at all true, but I am more concerned about what performance and scalability issues. And please don't just abuse it on its old issues linked to previous versions. I just care about the present state whatever had been its past.


Is it okay to just add a page or two PHP page to add some functionality to a Drupal site?

I'm not familiar with Drupal, really. I can dig around the admin interface and navigate the directories and find the files that I need to just fine as well. What I'm _really_ not familiar with is adding modules or extending modules. The site currently takes an order and sets up recurring payments through Ubercart and uses Authorize.net as a gateway. Right now, when a payment fails, a single e-mail gets sent out to the admin. We'd like to extend it to send an e-mail to the user and let them change their payment information through another page on the site. Authorize has a service called Silent Post URL that basically just posts a carbon copy in XML to whatever URL you give it. We'd like to accept that XML, deserialize it, parse the data, send a notice to the user and give them the page for updating their information. So, I guess it'll be two PHP pages. One for the XML API call from Authorize.net, and then one for the page for the users' to update their payment information. Could I just create two simple pages each handling their own tasks, or should I check out properly extending a module? If it's appropriate for me to write up the pages and not have to hook them into the module, what would be the best way to handle setting up what needs to get done? (The most experience I've had with extending a PHP site has been hacking away at someone else' poorly constructed, custom framework, so if anyone has any good resources perhaps on PHP best practices that they could share through a PM or a comment, I'd appreciate It) (Also, I'm still getting the hang of Stack Exchange, so if this isn't appropriate please let me know. I'll delete it.)


How strict are standard employer IP agreements about coding outside of work?

I'm in negotiations for a position with a large corporation and I'm reading their employment terms. In their IP/copyright section they state that anything that I do outside of work that is "similar" to what I perform on the job is also theirs. I understand that it's intentionally very vague to protect them, but I'm also a little nervous that it could be abused. The way I read it, anything I produce outside of work could be claimed as well, because it would fall under "programming". Is this relatively standard? Could I negotiate more specific terms (I have asked if I could get clarification)? Should I be worried that they could abuse this? I just don't want to be caught in a situation where come up with a (potentially) great idea outside of work and they swoop down and lay claim to it. **EDIT:** To help a bit, here is the parts in question: _"In the event any 'work' is held not to be a work for hire, I hereby assign and irrevocably agree to assign all right, title, and interest in and to such 'work' to 'company'"_ Where work is code, deliverables, designs, patents, etc. The next section does say: _"if in the judgment of the 'company', any such 'work' does not relate to the business efforts or research and development efforts in which, during the period of my employment, the 'company' actually is engaged or reasonably would be expected to become engaged, this Agreement does not obligate me to assign such items."_ which basically says that I can keep the rights to software that I don't create for them at their discretion. I'm basically looking to see if this is a fairly standard contract and if this is a sort of thing that could be used to bite me in the tail in the future.


How would you assess a programmer's Github profile?

Lots of people in the open source community say they strongly consider a candidate's Github profile when hiring. I'm active on Github, with a few projects of my own and some contributions to others. But looking at my own profile as if I were an employer, I see a lot of noise: projects I cloned but never contributed to, etc. The projects and patches I'm proud of don't stand out. If you assess people's Github profiles, how do you do it? And as a developer, should I do anything differently - for example, delete cloned repos I'm not actively working on?


What is the difference between Windows 8, WinRT, and Windows RT?

I just read that there will be two versions of Windows available: **Windows RT** and **Windows 8**. Could someone please describe what the differences between **Windows RT** and **Windows 8** are? And how these differences may affect developers creating apps for one or the other? Also, what is **WinRT**?


## Background The longer I work on a project, the less clear it becomes. It's like I cannot seperate various classes/objects anymore in my head. Everything starts mixing up, and it's extremely hard to take it all apart again. I start putting functions in classes where they really don't belong, and make silly mistakes such as writing code that I later find was 100% obsolete; things are no longer clearly mappable in my head. It isn't until I take a step back for several hours (or days sometimes!) that I can actually see what's going on again, and be productive. I usually try to fight through this, I am so passionate about coding that I wouldn't for the life of me know what else I could be doing. This is when stuff can get really weird, I get so up in my head that I sort of lose touch with reality (to some extent) in that various actions, such as pouring a glass of water, no longer happen on a concious level. It happens on auto pilot, during which pretty much all of my concious concentration (is that even a thing?) is devoted to borderline pointless problem solving (trying to seperate elements of code). It feels like a losing battle. So I took an IQ test a while ago (Wechsler Adult Intelligence Scale I believe it was) and it turned out my Spatial Aptitude was quite low. I still got a decent **total** score, just above average, so I won't have to poke things with a stick for a living, but I am a little worried that this is such a handicap when writing/engineering computer programs that I won't ever be able to do it seriously or professionally. ## Question I am very much interested in what other people think of this... **Could a low spatial aptitude be the cause of the above described problems?** **How is programming affected by spatial aptitude?** Maybe I should be looking more along the lines of ADD or something similar, because I did get diagnosed with ADD at the age of 17 (5 years ago) but the medicine I received didn't seem to affect me that much so I never took it all that serious. As far as I know people are born with low/med/high spatial aptitude, so I think it's interesting to find out if the more fortunate are better programmers by birth right.


How to transfer files to production?

We are a group that started working on a fairly big website with an existing codebase. We have a test and a production server. Our idea is to have a test repository with a number of devs having push access to; and a blessed repository that only a few can push to. The blessed repo is supposed to be always stable and represent the latest production version. How can I automate the process of transferring the files into production? Is it bad to have the production files under version control? That way, pushing to the blessed repository would mean deployment. But, what happens when there are merge conflicts? Will the production server break until it is resolved?


Are there any limitations to using WinRT instead of .Net?

From my understanding creating an application that runs on multiple architectures requires virtualization, and virtualization reduces performance since it creates a layer of abstraction. With Windows 8 supporting both Intel and ARM architectures should we expect slower performance with a WinRT app versus a .Net app running on an Intel device? Also, will WinRT support database connectivity and active directory access?


Page Not Found: 404 - the best content to put in this page

Do you let me know what kind of content I should put in the error-page like "404 page not found"? **Example:** "Unfortunately an error has occurred during the processing of your page request." "Page Not Found! Check the URL" "Sorry an error has occurred! Please Try again." "We're sorry, we couldn't find the page you requested." The content should be target user perspective. Means that target user should easily understand what's happening and what he should do?


Releasing an open source project without getting embarrassed

I've been working by myself on a fairly large open source project for quite a while and it's nearing the point where I'd like to release it. However, I'm self-taught and I don't really know anyone who could adequately review my project. A few years ago, I had released a small bit of code which pretty much got ripped apart (in a critical sense) on the forum where I released it. Even though the code worked, the criticism was accurate but brutal. It prompted me to begin searching for best practices for everything and in the end I feel that it made me a much better developer. I've gone over everything in my project so many times trying to make it perfect that I've lost count. I believe in my project and think it has the potential to help a lot of people and I feel like I've done some cool things in interesting ways with it. Still, because I'm self-taught, I can't help but wonder what gaps exist in my self- education. The way my code was ripped apart last time isn't something I'd like to repeat. I think my two biggest fears with releasing my project that I've poured countless hours into are being absolutely embarrassed because I missed some patently obvious things because of my self-education or, worse, releasing it to the sound of crickets. Is there anyone who has been in a similar situation? I'm not afraid of constructive criticism, so long as it is constructive and not just a rant on how I screwed up. I know there is a code review site on StackExchange, but it's not really set up for large projects and I didn't feel like the community there is large enough yet to get good feedback if I were to post parts of my project piecemeal (I tried with one file). What can I do to give my project at least some measure of success without getting embarrassed or devestated in the process?


Software Licensing Particulars

I have spent a lot of time examining the various (major) software licenses and ultimately have decided upon using the **MIT Licenses** for my open source projects, and the **Microsoft Reference License (MS-RSL)** for my proprietary projects. Not knowing much about IP law, I have three simple questions that I haven't been able to find answers to:   * At the top of each source file that I want to protect, I need to place a copy of the appropriate license (MIT/MS-RSL), yes?   * If so, then in this license notice, do I have to acknowledge that I am using the MIT or MS-RSL licenses? Or is it fine to just copy-n-paste the licenses in, as-is? In other words, do I need to say: `SOFTWARE LICENSE NOTICE - MIT LICENSE` or can I just write `SOFTWARE LICENSE NOTICE`?   * Is it "okay" (legally enforceable) to just place a link to a URL (where an EULA lives) instead of pasting in the same software license over and over again, at the top of every single source file? It would be nice to just have this: // SOFTWARE LICENSE NOTICE // This software and associated files is licensed. Please visit: // http://www.example.com/my-license/latest // for full details. That way, `http://www.example.com/my-license/latest` could always contain the latest license I want the source file(s) to be protected by. So if I switch from MIT to, say, APL, no code changes/rollouts are necessary. Is this legally-sound? Thanks in advance!


Deployment in development phase for Agile projects

I'd like to know the Agile stance on the following situation:   * A contractual, payable milestone states a working version must be installed and run at customer's location;   * Development is still ongoing, not all user stories and issues are addressed;   * A later deployment will be required My understanding was that the product owner would view the software in its development environment until final QA is done, and then (and not before) would it be deployed into the final production environment.


Ticket/Raffle DB schema

I'm working on a project that, when all boiled down, is essentially a raffle. The twist is that due to the way we've set the ticket value, a user may be casting 10,000+ tickets. Essentially, a user can chose to cast a certain number of tickets for any given raffle. At the end of a period of time, a winning ticket is chosen randomly. A users' likelihood of winning is proportional to the number of tickets he/she casts. My issue is that due to the volume of tickets, storing each ticket individually in the database seems out of the question, but in some way every ticket needs to be accounted for because it will affect the odds. My fallback option is storing "batches" of tickets per user, assuming that it's rare that a user casts a single ticket at once. What would be the best and most efficient solution for storing a high volume of tickets in the database?


MVVM - Master Detail interaction scenarios - Implementing when MasterVm has partial data, and Detail has to pull whole entity

I primarily work with .Net WPF MVVM applications. I've used several frameworks, MVVM Light, Prism, etc, and I've been able to break the implementation of CRUD MVVM into three scenarios. **Scenario 1:** A web service returns a paged collection of small objects with no navigation properties, I whirl through these wrapping them with DetailVM's, because of other needed logic, and I place it in a ListCollectionView. My DetailVM's implement IEditableObject, now every Crud operation I want to do can be done through ListCollectionView, and I can keep my ListView in the UI in sync with the current CRUD operation. That is to say, if the user adds an item, it is immediately added to the ListCollectionView and reflected in the UI, and if they cancel the edit, it is removed. If they save the added item it stays in the list and is persisted to the server. This can all be done with two simple view models, and some data templates, thanks to IEditableObject and ListCollectionView. **2 & 3: These are more complex, because the initial call to the web service returns a list of reference dto containing a few simple properties like Name & Id.** **Scenario 2:** In the MasterViewModel call to the web service and load quick models. When an item is selected, a second call is made to the web service to retrieve the actual object and its object graph. This is then mapped and messaged (pub/sub) over to a separate detail view model. **Scenario 3:** On the MasterViewModel have a DetailViewModel property. This couples the view models together, which seems alright as they really can't work without each other. Managing the list becomes easier as things are all in the same spot, no messaging... It's still hard to achieve what is so simple with a ListCollectionView, but I can do it without messaging between view models. \----- Summary ------ Scenario 1 = Easy to implement, works well requires minimal code. Scenario 2 & 3 = Harder to implement, becomes somewhat less clear where all the CRUD operations should be. Keeping items in the reference list in sync is harder. I only update the information in the list when an edit is successfully completed and saved back to the web service. Currently I keep all my crud operations in one view model. I have created a base view model for paged data, which I inherit into a CRUD view model base, and add in the commands for Add, Edit, Remove, & Cancel. So far this has been working well.


Best way to find whether a collection does or does not contain an element with a specific desired quality

It seems to be a very common thing to have to tell whether some list or set contains at least one object matching a given condition, yet my prior searching and reading have never found a satisfactory best practice or design pattern to speak of. In the situations I am thinking of, merely using "contains" is not sufficient, as the test we want to perform is not strictly based on the equals method of the class in question. Some things I have seen:               // for-each with break     private boolean doFoosHaveGoodQuality(List<Foo> candidates) {         boolean foundIt = false;         for (Foo item: candidates) {             if (<< item passes some test >>) {                 fountIt = true;                 break;             }         }         return foundIt;     }             // while-do with index counter     private boolean doFoosHaveGoodQuality(List<Foo> candidates) {         boolean foundIt = false;         int index = 0;         while(!fountIt && index < candidates.size() - 1) {             Foo item = candidates.get(index++);             if (<< item passes some test >>) {                 fountIt = true;             }         }         return foundIt;     }      Both of these get the job done and quit as soon as a success is found, possibly saving some time if we are lucky enough to have the desired item early in the list. However, both require looping the entire list in order to get a false result Another technique I've seen in some circumstances is that at the same time the original `List<Foo>` is generated (i.e. retrieved from database) to then simultaneously generate a `Map<FooKey, Foo>`. In this technique, `FooKey` is an additional (often inner) class holding only those attributes of a `Foo` that form the "desired quality" and overrides equals and hash code methods based on that. When you need to determine if there exists a desired Foo, you make a `new FooKey()` instance with exactly that you want, then call `hasKey()` on the map. Extra effort up front, but quick and easy at the moment you need it. I can't put a finger on it. Each idea works, yet each feels just a little hacky and inefficient.


How can I compensate for having gone to a JavaSchool?

In an earlier question, I asked for career advice for new software engineers who did well before and during college. But what about people who weren't fortunate enough to go to MIT or Yale, for whatever reason? What if you went to what Joel Spolsky calls a JavaSchool? What can/should JavaSchool alumni do to develop their skills and make up for the things they missed in college? (Or, was Joel wrong about those schools being disadvantageous?)


Property proper naming to represent string starting with number

Looking at some camera metadata on Windows `File Properties` there are (along with a few more) two `Properties` named _Focal length_ and _35mm focal length_. I'm developing software that will make use of these two `Properties`. So far I have created a `Property` named `FocalLength` for the first, but I cannot seem to find a proper name for the other one. I have thought of `_35MmFocalLength` or `ThirtyFiveMmFocalLength`, but I think there might be a better suggestion. Any ideas?


Should Repositories return IQueryable?

I have been seeing a lot of projects that have repositories that return instances of `IQueryable`. This allows additional filters and sorting can be performed on the `IQueryable` by other code, which translates to different SQL being generated. I am curious where this pattern came from and whether it is a good idea. My biggest concern is that an `IQueryable` is a promise to hit the database some time later, when it is enumerated. This means that an error would be thrown outside of the repository. This could mean an Entity Framework exception is thrown in a different layer of the application. I have also run into issues with Multiple Active Result Sets (MARS) in the past (especially when using transactions) and this approach sounds like it would lead to this happening more often. I have always called `AsEnumerable` or `ToArray` at the end of each of my LINQ expressions to make sure the database is hit before leaving the repository code. I am wondering if returning `IQueryable` could be useful as a building block for a data layer. I have seen some pretty extravagant code with one repository calling another repository to build an even bigger `IQueryable`.


Should our team order Javascript class methods/properties consistently? If so, how?

As our team is growing I've noticed that different developers put their class methods in different orders. For instance:               var Foo = Backbone.Model.extend({         someVar: {},              initialize: function() {...},              fetch: function() {...},         handleFetchRepsonse: function() {...},              getFoo: function() {...},              render: function() {...},         renderFoo: function() {...},     });      vs.               var Foo = Backbone.Model.extend({         fetch: function() {...},         getFoo: function() {...},         handleFetchResponse: function() {...},         initialize: function() {...},         render: function() {...},         renderFoo: function() {...},         someVar: {},     });      It seems like it'd be more convenient if everyone used roughly the same criteria when they order their methods (if for no other reason than to make it easier to find stuff). However, I'm wondering if: A) that is even possible/realistic (or should I simply accept the fact that everyone is going to have a different order)? B) if so, what sort of ordering should that be (the only really consistent one I can think of is alphabetical, but that seems less than ideal)?


B Tree compared to an R tree - Isn't it just a bunch of linked lists linked together?

I'm pretty familiar with a B Tree, mainly having to keep the databases well fed with electricity, air conditioning, and harddrive space. I associate with a double (doubl[ie,ey]?) linked list. Today, one of the developers at lunch mentioned a R tree. I hopped on Wikipedia and started reading. It sounded an awful like a taller B tree. Unfortunately, not having a deep math background makes it tough to understand what some of my coworkers are talking about. I was hoping if someone could clarify a few differences between a B tree and a R tree. I'll probably end up asking the guys anyways, but there is no guarantee that they will answer my question. More than likely they will start rambling about God knows what. . .


C++ users proposals

I believe I have some good suggestions to improve the C++ language. Who should I contact to discuss this? Do I have the chance to be heard, especially if I'm not a renowned expert?


Exposing a Disposing event

I'm implementing a .NET class which implements IDisposable. After being disposed, the object's state is invalid and so nobody should be accessing it, of course. There are some situations where two essentially independent systems have access to the same instance of this class. One essentially "owns" the object but the other is charged with interacting with the object in a persistent manner. If the "owner" opts to get rid of the object by calling Dispose on it, the other system needs to know about this because otherwise it may try to interact with an invalid object. It is not always convenient to have the owner inform the other system to stop using the object, because the owner itself may not know about this other system. I do have the class implementing an IsDisposed property, but there are situations where polling this would become impractical and it would be preferable for the "non-owner" to instead receive notification that the object is disposed. To this end I figured that implementing a Disposing event on the class would be a good solution, but this leads to some design questions:   * Is the instance considered to _already have been disposed_ at the time the event is raised? (My guess would be that it should be regarded as alive until the handlers finish.)   * How should the object react to further manipulation that occurs inside the event handlers? (My guess is react in the usual manner for a living object since it is still alive.)   * What if a handler itself calls Dispose on the object? (We could either explicitly ignore re-entrant calls or just assume that well-behaved handlers won't do this.)   * Should the Disposed event still be raised in the event of the object being finalized without having ever been explicitly disposed? (I can't think of a case off hand where such an event would actually be needed, and it definitely has the potential to cause problems.) I'm wondering if there is any established wisdom on how this pattern should be designed in general, or any examples I should be aware of where trouble is likely.


Best way to check for specific types

Normally I do this:               if (Animal is Dog)     {         Doc d = (Dog)Animal;         // d. etc..     }      else if (Animal is Cat)      {         Cat c = (Cat)Animal;         // c. ....     }      Is this a good way or are there better ways to implement this code above (performance, ...) ? Should it be like this?:               Dog d = Animal as Dog;          if (d != null;)     {         // d. etc..     }      else if (Animal is Cat)      {         Cat c = (Cat)Animal;         // c. ....     }      Or maybe like this?:               Dog d = Animal as Dog;     Cat c;          if (d != null;)     {         // d. etc..     }      else if ((c = Animal as Cat) != null)      {         // c. ....     }      Or maybe something else?


Perform operations in the entry-script, or create a class which just instantiates and calls methods?

I'm building a **perl** application which does the following operations:   1. Copy a bunch of files (class **fileFetcher** )   2. Parse each file (class **fileParser** )   3. Store some data from each file in a database (class **dbHelper** ) Now, should I, in my **main.pl** (entry point of the script), construct an instance of **each of these** and call the appropriate methods? or is it better practice to have a separate "Application" class that does all the instantiations and method calls, and let the main script just have a call like `Application.run(args)`? The class, would exist just to instantiate and call methods on things, and doesn't seem right.


Two applicants, two different responses, what one would be correct?

During an interview for a C++ programmer position at ACME, two candidates are asked to create **a program that takes asks the user to type in two integers, and then prints out their sum.**   * The first programmer solves the task in 10 lines of code.   * The second programmer ends up with 10,000 lines of code. * * * This is because #2 did not go straight for the task, but started creating a huge set of infrastructure for solving it. First of all, he created a `CObject` base class, then went on to a `IInput` interface class, derived a `CInputSTD` class, created a library wrapping STL functionality to convert strings to numbers and vice versa. And still on he went, creating an event dispatcher system to lower coupling of each of the modules, and adding about 20 macros to his code. But that still wasn't enough, so on he went on and constructed a `COutputFormatter`, `CArithmeticOperation` base, `CAddable` derived from `CObject` and finally the `CAdditionManager`. To put everything together, he added `CModuleManager`, `CProgram`, `CProgramCalculator` and `CProgramAdder` classes. After that, there were only about 5 helper classes and a 500 line-long API header left to write. His whole code was well-documented, namespaced and cross-platform compatible. * * * Now to my serious questions:   * What is the best way to explain what exactly Programmer #2 did?   * What is bad about it compared to Programmer #1 's solution?   * How do you know if you spend too much time abstracting instead of writing actual functionality?   * Which programmer, in a real company and with the solution of Programmer #2 made a bit more sane (less classes, lines), is more likely to get the job? (given that they are equal in all other aspects)


How do you create a software process for a project?

As I've written about in other questions here, the project that I'm working on now has no software process. That means no documentation (including hard copy requirements or specification), no source control, no bug database, bugs are "fixed" (hopefully) and new code is added at the same time, and no formal testers - we would fail the Joel Test so bad, it's not even funny. Yesterday, my manager asked me to write a document about how to begin to fix these shortcomings. Note that I'm just an intern, here for 6 months. I'll be leaving around Thanksgiving in November to return to school. However, I think that I can perhaps get this project moving in the right direction, but I'm not sure where to even begin. I'm currently using CiteSeer and Wikipedia to attempt to find some papers and such that describe software processes and implementing them, but any advice, personal experiences, or links to blogs, papers, wiki articles, or anything else would be greatly appreciated.


Theory about software communications mixing up with other software causing an Apocalypse?

I can remember a very Very long time ago (pre Y2K) , reading an article by some "expert" that theorized that software communicating over the internet, especially video games could get mixed up with Military communications meaning that a user could inadvertently mobilize a B52 nuclear bomber with a click of his mouse on a video game. This theory sounds ridiculous enough as it would be very unlikely that packets of data from different software going to different Hosts on different ports could get mixed up. PLus the recipient would have a hard time interpreting the data that may only be understandable by the application it was meant to be read by. However I digress, does anyone know about this theory and if it had a name, and has anything like this happened in software. Apologies if this seems like a Networking question but since its ultimately about Application data then I felt it would suit this Stack site. Thanks Any other info would be welcome on similar theories or ideas.


Restrictions Calling DLLs Across Technologies?

I want to call a DLL in my programming language of 'choice'. The documentation surrounding this clearly states that it must be a 32-bit DLL written in C, C++ or Delphi. _But I wanted to call a DLL written in C#._ It goes on to mention that the default calling mode is **cdecl**. So my question is: why would this be the case? Is there any way to make it _think_ a C# DLL was written in C, C++ or Delphi?


Quick and Good: ( Requirement -> Validation -> Design ) for self use?

How to casually do the required Software Engineering and designing? I am an inexperienced developer and face the following problem:   1. My company is a start up and has no fix Software engineering systems.   2. I am assigned tasks with not very clear and conflicting requirements.   3. I don't have to follow any designs or verify requirements officially. Problem:   1. I code all day and finally get stuck where requirement conflicts and I have to start over again.   2. I can-not spend a lot of time doing proper SRS or SDD. How should I:   1. **List out Requirements for myself. (Not an official document)**   2. **How to verify and validate the requirements?**   3. **How to visualize them?**   4. **How to design them with minimum effort? (As its going to be with me only)** I don't want to waste my time coding something that's gonna collapse according to requirement conflict or something! I don't want to compromise with quality but don't want to re-write everything on some change that I didn't expected. I imagine making a diagram for my thought process that will show me conflict in the diagram itself, then finally correcting the diagram - I decide my design and structure my code in terms of interfaces or something. And then finally start implementing my design. I am able to sense the lack of systematic approach, but don't know how to proceed! Update: > Please suggest me some tools that can ask me the questions and help me > aggregate important details. > > How can I have diagram that I talked about for requirement verification?


Usefull skills from a computer science degree

I did my degree in physics and moved later into programming. I have two and a half years experience under my belt and like to think I write good code. I am, however, concerned that not doing a compsci degree has left holes in my knowledge. I would like to fill those up now since I know I want to be doing programming for the rest of my career. What skills/techniques did you learn in your compsci degree that one wouldn't pick up from on-the-job programming?


Where can I find a legal "permission to work on open source" document?

One of the things I really like about my current job is that we developers are encouraged to make open source contributions. However, this encouragement has always been verbal. I've read some horror stories about developers having their open-source work legally claimed by their employer. I'd be more comfortable if we had something in writing from my employer saying that contributions are allowed and not owned by the company. Understanding that you are not lawyers, does anyone know where to find a boilerplate document to this effect?


Is having coupled hosting in one platform better than having decoupled hosting?

Recently I have been thinking of converting some ideas into apps with couple of like minded friends. Our app will have an module, where users must include an instant messaging. The requirement for the IM right now is pretty basic:   * Send/receive messages(No MIME).   * View user status available/offline.   * Sent/delivered messages status. First we thought GAE(Google App Engine) would be a good choice with what is provides on free quota and we could start with it. But, after researching and researching and brain storming for some time, I came to realize following (This is according to my understanding):   * XMPP implementation in GAE cannot maintain session to have available/offline status. This logic must be implemented on our side.   * XMPP implementation in GAE cannot maintain sent/delivered messages status. This logic must be implemented on our side. Maintaining such statuses on our own will consume more API calls and our app might soon be throttled. And as an user I wouldn't want my messages to be delayed. So after further research, I came down to Openfire for back-end but, Openfire wouldn't completely solve our mobile needs. And after more research I came to know about ejabberd. There are quite a lot advantage of ejabberd over Openfire but, the main would be that major IM players like whatsapp and nimbuzz uses ejabberd. I am sure they must have modified it to fit there need. Since, we are not trying to solve the IM problem, the main focus of our app is on something else. This requires communication with back-end, which means we also have to deploy our web services somewhere. Since GAE mentions that "Sockets are not supported on GAE", we cannot have our ejabberd service running over there. It must be in IaaS(Infrastructure as a service) provider like EC2. Ofcourse Google has their own but, AWS offers cheaper price. Now here are some confusions and problems we are trying to solve:   1. To decrease complications, we want both the IM and WS to use same user database. Users will be assigned a random password during signup. The authentication with IM server should be done transparently without user noticing it (This is because our app uses some thirdparty like oauth providers to signup/login users). Is there any other alternative for this?   2. Considering that we want scalability in the future and I am sure, transitioning from GAE to AWS(Amazon Web Services) wouldn't be that easy (if we want it). Is it better to have both WS and IM running on the same platform? And why is it better? Is there any better alternatives?


Is HTML 5 good enough for developers to switch from Flash?

Just curious, because many developers use Flash to do many things that HTML 4 (correct me if I'm wrong) or below cannot or had a hard time doing, like for example the rounded corners (Canvass) and that Video Thing and many more. I have not actually explored all of HTML5, so might as well learn it from you. thanks.


How can a software technologist best function in an engineering firm?

I am a recent Software Technologist community college graduate. I graduated with honors and I invest a lot of personal time studying computer science topics. I have been recently hired at an engineering firm. I am extremely interested in the company's area of work. It deals with a lot of level elements and I find it very rewarding. I am the only Software Technologist and I work directly with several Engineers that develop software. The company is very hierarchal and Engineers get big private desks and Technologists work in a separate smaller room and work very closely. I am the only Software Technologist in the group. I find it a bit strange that I am sitting beside technologist/technicians in fields other than software, but I am happy with my work and the Engineers stop by often to provide work or provide some background on the next big project. I am comfortable with this and I understand and respect the company structure. However, the company has done some reorganizing within the building and many people have been shifting around. People have been working where ever there is room. I have been temporarily moved into a room with the other software developers, all of whom are engineers. Today, an engineer (non software) popped in our office and pronounced that the company's boss had gone around and asked everyone where they were sitting. As the story goes the boss of the company asked one member where he was sitting and then laughed at him. The engineer proceeded to say "he [the member that was laughed at] says he has more experience, but we're engineers, not common folk". (Quoted as accurately as possible) He continued to boast a bit more. This was said in front of me and my peers. I vividly recall one Engineer laughing, I am not sure about the others. My boss was also in the room. I felt very degraded and I regret not saying anything. How would you take this situation? I really enjoy my work. As a software technologist, I feel extremely lucky to be working in an engineering environment. I feel betrayed by my software peers and my boss. Let me say first and foremost I understand that I am a junior employee and I will given a support role which includes jobs that senior developers do not want or have time for. I am very comfortable with this and I look at it as a great learning experience. However, I worry that if I stay with this company long enough they will eventually hire another engineer who will automatically trump me. If the engineers really feel that I am a "common folk", I do not want to work there. I recognize that they are Professional Engineers and they have put a lot of significant time into their degree, and I have a lot of respect for that. I have several questions:   1. What should I do about the overall disrespect and how should I handle it?   2. How do you feel knowing that your experience will mean very little to a company with respect to a newly minted engineer? (This is not an immediate concern but a long term concern. I am very interested in pursuing additional courses and education but I doubt I will be able to take time to upgrade to a degree.)   3. What should my long term goals be? (I really enjoy low level programming and working in instrumentation and electronics.) For clarification, an engineer has a Professional Engineering degree from a certified University. I am not sure about other Countries but in Canada you must be from a certified University to get a Engineering Degree. An Engineering degree ranges from Civil, Mechanical, Electrical-Software, etc. These people have a BEng (Bachelor of Engineering) opposed to a BA (Bachelor of Arts) or BSci (Bachelor of Science). A technologist is a graduate from a Community College which is a 3 year diploma program.


Is it possible to rate how predictable a program's behavior will be?

If so how, and what value would this rating have in understanding the code? For example, I would guess that programs using genetic or neutral algorithms would be less predictable than one calculating the sum of pi.


What are your thoughts on Periods/Full Stops in code comments?

I saw this asked in the SO Tavern, so I'm posting the question here. I thought it an interesting question. (Of course it doesn't belong on SO, but I think it's OK here.) Do you add periods (or, as the OP wrote, "full stops") in your code comments? To keep it relevant, _why_?


What is the correct way of training a fresher?

I am a freshman hired in an IT company in India. A lot of my friends have also been placed with different companies. Some of them have been trained online, Some in Classroom, and still some others (me included) are being trained 'on- the-job', This leaves me pretty confused as to what method should the companies follow so that the fresher is 'up-to-the-mark'? WHat advantages does all these methods have over one another? I would be delighted to hear from Industry people. P.S. Please(if you want) write if you are working in an IT company, and the post if possible. It will help me formulate my opinion. Nothing sinister in this request, I promise!


Is this high coupling?

# Question * * *    I'm currently working a on an assignment for school. The assignment is to create a puzzle/calculator program in which you learn how to work with different datastructures (such as Stacks). We have generate infix math strings suchs as "1 + 2 * 3 - 4" and then turn them in to postfix math strings such as "1 2 + 3 * 4 -".   In my book the author creates a special class for converting the infix notation to postfix. I was planning on using this but whilst I was about to implement it I was wondering if the following is what you would call "high coupling". I have read something about this (nothing that is taught in the book or anything) and was wondering about the aspect (since I still have to grasp it).      # Problem * * *    I have created a PuzzleGenerator class which generates the infix notation of the puzzle (or math string, whatever you want to call it) when it's instantiated. I was going to make a method getAnswer() in which I would instantiate the InToPost class (the class from the book) to convert the infix to postfox notation and then calculate the answer. But whilst doing this I thought: "Is using the InToPost class inside this method a form a high coupling, and would it be better to place this in a different method?" (such as a "convertPostfixToInfix" method, inside the PuzzleGenerator class) Thanks in advance.


Go/Obj-C style interfaces with ability to extend compiled objects after initial release

I have a conceptual model for an object system which involves combining Go/Obj-C interfaces/protocols with being able to add virtual methods from any unit, not just the one which defines a class. The idea of this is to allow Ruby-ish open classes so you can take a minimalist approach to library development, and attach on small pieces of functionality as is actually needed by the whole program. Implementation of this involves a table of methods marked virtual in an RTTI table, which system functions are allowed to add to during module initialization. Upon typecasting an object to an interface, a Go-style lookup is done to create a vtable for that particular mapping and pass it off so you can have comparable performance to C/C++. In this case, methods may be added /afterwards/ which were not previously known and these new methods allow newer interfaces to be satisfied; while I like this idea because it seems like it would be very flexible (disregarding the potential for spaghetti code, which can happen with just about any model you use regardless). By wrapping the system calls for binding methods up in a set of clean C-compatible calls, one would also be able to integrate code with shared libraries and retain a decent amount of performance (Go does not do shared linking, and Objective-C does a dynamic lookup on each call.) Is there a valid use-case for this model that would make it worth the extra background plumbing? As much as this Dylan-style extensibility would be nice to have access to, I can't quite bring myself to a use case that would justify the overhead other than "it could make some kinds of code more extensible in future scenarios."


Familiarizing with the Zend Framework in one week

You are conversant with the ZF? How would you go about getting familiar with it in one week? What would be your suggested schedule?


What is the difference between class level attributes, Class constants and singleton methods?

What the difference given they all exist 'once per class'.   When should I use one over another, i.e. for what purpose?   I use Ruby.


Moving dozens of existing standalone retail sites to one central inventory database: what should I know going in?

This will be the first project of this scale that I have attempted, and the first time I have run a website at all (much less dozens) using an off-site database. In particular, I'd like to know:   1. what sort of optimizations I should read up on to make this run as smoothly as possible?   2. any pitfalls/gotchas wiser, more experienced folk are aware of I should be on the lookout for, and   3. what damage-control and preventative measures I should take against the nightmare scenario of the main server (hosting the database) having an outage, grinding over 100 websites to a halt (because they have no access to the product data).


clone() only partially doable; how to react?

Suppose we have a class-hierarchy whose base class `B` requires a `clone()` method to be defined in its derivations. Whilst this works perfectly for most of them there is this one derivation `X` that holds an **optional** reference to a resource/object that can only be referenced from one instance of `X`. Whilst the rest of `X` can be cloned without problems this reference would have to be set to null/nil/nullptr. What is the correct way to handle this situation?   * `X::clone()` could throw an `UncloneableException`. Though this would be correct, it is not satisfying.    * Set the reference to null/nil/nullptr and leave no notice of it. The user of `X` has to know about `X`s "particularities".   * Require derivations of `B` to define `B::nearestClone()`: the user of `B` has to be aware that the return value might not be a 1:1 clone.   * Something else?