outsourcing code review/refactoring

I have a small project (3000 lines in Python) that I wrote myself; it has no known bugs and has some decent parts, but is largely a mess because of my lack of time. Unfortunately, I have to be the one who continues writing and maintaining the code. Is it a good idea to hire a highly experienced developer, explain to them the requirements (verbally, since I don't have them documented), and let them review the code and refactor it (in close discussion with me)? I am concerned that: (a) this work is so annoying that highly experienced developers wouldn't want to do it. (b) I would spend so much time explaining the requirements and what my current code does that it would be faster for me to do the actual work myself.


Integrating into a new team

I've just joined a new company where a lot of the developers have been working for more than ten years. How do I integrate into the team without stepping on too many toes?


Programmer Ethics: Can I fork a project from one code host to another?

Say I find this great snippet of code on Bitbucket. I really, really like it but there's a small bug I want to fix. On the other hand, I have all of my code on GitHub. Is it ok to start a new repo on Github and refer to the original by a comment or on the wiki?


Why were concepts (generic programming) conceived when we already had classes and interfaces?

_Also on stackoverflow.com:_ I understand that STL concepts had to exist, and that it would be silly to call them "classes" or "interfaces" when in fact they're only documented (human) concepts and couldn't be translated into C++ code at the time, but when given the opportunity to extend the language to accomodate concepts, why didn't they simply modify the capabilities of classes and/or introduced interfaces? Isn't a concept very similar to an interface (100% abstract class with no data)? By looking at it, it seems to me interfaces only lack support for axioms, but maybe axioms could be introduced into C++'s interfaces (considering an hypothetical adoption of interfaces in C++ to take over concepts), couldn't them? I think even auto concepts could easily be added to such a C++ interface (auto interface LessThanComparable, anyone?). Isn't a concept_map very similar to the Adapter pattern? If all the methods are inline, the adapter essentially doesn't exist beyond compile time; the compiler simply replaces calls to the interface with the inlined versions, calling the target object directly during runtime. I've heard of something called Static Object-Oriented Programming, which essentially means effectively reusing the concepts of object-orientation in generic programming, thus permitting usage of most of OOP's power without incurring execution overhead. Why wasn't this idea further considered? I hope this is clear enough. I can rewrite this if you think I was not; just let me know.


Why if statements do not introduce scope in ruby 1.9?

if statements do not introduce scope in Ruby 1.9, what is the rationale behind this change from ruby 1.8?


Ruby freelancing: realistic expectations?

I'm in a situation where I only need $100 to live at a place. How is this relevant to programming? Well, I would like to hear the opinions of those on this site if it is at all realistic to expect a Ruby noobie to be able to make $100 freelancing by a month from now, assuming a great deal of effort and enthusiasm o_O I'm a noob, learning Ruby before Rails.


What is the difference between distributed and non-distributed version control?

What are the internal structural differences between distributed (e.g Git & Mercurial) and non distributed (Subversion) version control? The question came from a discussion group where a tool was interacting with CVS and it was argued whether it would be easily ported to other systems or not.


Methods to share memory or state across JVMs?

This is long question I know. I have a few options for what I want. I don't want to know "this is obviously the best," but maybe any pros or cons I may be missing about the options, as well as any options I'm unaware of. We have a java application seperately run as multuple daemons, each a seperate JVM. Right now SQL is used to store data and effecticvely our 'shared memory', but luckily not much is dynamic once in memory. We will soon be dynamically creating and destroying connections and that will mean dynamic changes happening semi-fast and need something better then a SQL database. We _think_ all the dynamic stuff will happen in only one daemon, but we aren't certain. We will need a faster method of saving and loading this state data, going to disk each time is just too slow. The current database needs an overhaul for this change anyways, so we're open to modification or tossing of it as well. We can re-learn all the state we keep in memory; but it's a slow process. Persisting some or all of the data to a DB between runs to save time learning state at bootup is nice, if we can be certain it gets persisted right. Ability to easily query a 'database' to see current state for debugging is a major plus. The solutions I have considered, and some of the pros & cons are: 1) some sort of hibernate solution combined with an in-memory sql database. I haven't used hibernate yet (really want to!), but I think it can address persistance and avoid stale objects between JVM's for us and sql will still be close to the speed of other options if in memory? I don't know how much the overhead for this is or how it scales to multuple JVM's and possible (semi?) fast changes to data. Presumable this is slower then all the other options, but think it's fast enough for our needs? 2) Have each JVM store it's own internal state without any shared system. Use reliable intercommunication (probably JVM) to try to keep state consistent. Most important state is in one daemon, so there won't be that much sharing of dynamic state, but still need to address inconsistent state and dataraces when it does occure. I'm uncertain of how we would want to record persistant state to allow fast reboot even if daemon dies unexpectedly. Also, this solution would require implementing some quick messages to allow fetching a description of memory state to help debugging. It would offer the highest performance once we get it right, but probably the most time consuming to implement (I anticipate obscure bugs due to data-race and inconsistent data?). 3) Use a system to allow some shared memory between JVMs. Quick research suggested MappedByteBuffer and Ecache as possible options, there could be more. Only looked into this a little so far so don't fully know pro's and cons yet. Slightly afraid of creating a single point of failure if our memory is all shared. 4) Some sort of alternative I don't know about or possible merging of two of these idea.


What makes a hashing algorithm "secure"?

After reading this interesting question, I felt like I had a good idea of which insecure hashing algorithm I'd use if I needed one, but no idea why I might use a secure algorithm instead. So what is the distinction? Isn't the output just a random number representing the hashed thing? What makes some hashing algorithms secure?


Rotate, Scale and Transform in video games

IF a 3 dot vector and a 3x3 matrix can rotate, scale and transform things in a virtual 3D space, could you use a 3x3x3 matrix and a 3.3.3 vector to do something to the games sense of time?


One man company looking to expand already built in PHP. Is now the time to switch to Ruby?

I'm a website owner and I develop in Yii so in short, I think I'm working with more or less the "best" PHP has to offer (e.g. PDO, OOP...etc). My primary website (which is not built in any framework just native PHP) of 2.5 years is finally making enough money I can hire my first employee who I want to be a developer to convert it over to Yii. I've also started a new site which is just four weeks into development built with Yii but instead of building anything this week I'm going through RubyKoans because I keep wrestling with the idea that now there is no better time to convert to using Ruby on Rails... I go through Yii and a lot of the most awesome stuff is ported from Rails (e.g. scopes). A lot of really great websites are built in rails (e.g. Twitter, GitHub, Hulu). Rails developers are "more" expensive but if you hire one are you not guaranteed a certain level of quality where as with PHP there's a lot of crummy devs out there? If I ever do make the switch, is it not better to do it now when it will be less painful? If I want to create a company that attracts talented developers, why not work in ruby so my company stands out? At the same time PHP is fast, reliable, and when you're working with the "best" (e.g. Yii, Symfony2) I think it's a pretty nice and maintainable language. A lot of big sites are built in it too (Facebook, Digg, Craigslist, Hootsuite) plus all the porn sites which we all must admit deal with tons of traffic. Also there is way more PHP devs out there so as long as I use good interview practices will it not be easier to find some good PHP devs? Or would it be easier knowing every dev who came in for an interview already used ruby? Also a big part of me just wants to get started and not spend six months wading through ruby till I'm confident enough I want to port my existing projects over to it. Any thoughts?


What would be the best way to store movements on a game to allow a rollback?

I'm developing a board game that has a game class that controls the game flow, and players attached to the game class. The board is just a visual class, but the control of the movements is all by the game.   The player can try to make false movements that lead to the game telling the player that this kind of movement is not allowed (and tell the reason behind it). But in some cases, the player can just make a movement and realize it's not the best move, or just miss click the board, or just want to try another approach.   The game can be saved and loaded, so an approach could be storing all the data before the movement and not allow a rollback, but allow the user to load the last autosaved turn. This looks like a nice approach, but involves user interaction, and the redrawing of the board could be tedious to the user. Is there a better way to do this kind of things or the architecture really matters on this thing? The game class and player class are not complicate so it's cloning the classes a good idea, or separate the game data from the game rules a better approach, or the saving/loading (even automatic on an asked rollback) is ok? UPDATE: how this game works: It has a main board where you make moves (simple moves) and a player board that react on the moves makes on the main board. It also has reaction moves according to other player moves and on yourself moves.You can also react when is not your turn, doing things on your board. Maybe I can't undo every move, but I like the undo/redo idea floating in one of the current answers.


What's the best release strategy for an Android application?

I'm close to the completion of a first set of features for a free application I'm developing on the Android platform and I'm starting to wonder about the best time to release it to the market. On one side I'm fond of the "ship as early as possible" model though considering that users can vote for applications I don't want to release too soon an application in beta and with a limited set of features as I won't get high ratings. I could explain that it is a beta version but will non technical users understand or care ? I don't think so. On the other side, if I go for a waterfall model and I wait until the application is feature complete I will have a more competitive application in terms of features but the downside is that as the application grows bigger so the number of problems users are likely to experience. I know I can test my application but I don't think that's enough considering that some applications have slightly different behavious on different devices. I work at this app part-time so I fear I won't have the time to fix in a short time the issues that will eventually pop up and this will lead again to negative ratings. I want to know from developers that have already gone through this dilemma, is it best to release an incomplete, beta quality product early or waiting until it's feature complete and then deal with the bugs all at once ? Please provide answers specific to the Android platform and market.


Returning to programming/math after a years long inactivity; becoming a better professional; setting goals

I am in a somewhat, hopefully, common situation to many of my peers in NYC. I will be brutally honest here. I've graduated with CS degree (minor math) from a top 20 school, worked programming/qa jobs in software shops for 4 years, and then slowly moved to finance, taking jobs on Wall St (about 2+ years now). While I still do some programming, which is predominately in C/C++ (I kid you not). Most of the programming work revolves around maintaining a system or fixing minor bugs. And comparatively, I've been doing less and less of actual programming. And I've had almost no motivation to improve on that outside of the office. Bars, side hobbies, gym, women and most importantly LAZINESS are the essential culprits. To be fair, I feel that I've NOT learned anything new, been forgetting old, and lagging behind all the cool technologies, as well as NOT getting better at or building on what I had known. I don't take part in the community (in college I posted on news boards, subscribed to major publications,etc). My math has also suffered tremendously. I've also noticed that my notion of "programming" changed from cool/hacky to uncool/geeky/quick-route-to STOP gettting laid. This by itself is enough to explain why I've not evolved as a developer. In a nutshell, I feel that instead of becoming a better professional, and thereby improving my skills in relevant areas, I head south at an alarming rate. I'm 30 now, and I do NOT want to exacerbate my situation even further. Ironically, I am very well paid, and living it up. I admit it's all facade, and one day it will all come crushing, once _correction_ takes place. Very soon. This weekend, I started re-reading Effective C++ series (by Scott Meyers), listening to math/cs video lectures on www.khanacademy.org/ and http://see.stanford.edu/see/lecturelist.aspx?coll=11f4f422-5670-4b4c-889c-008262e09e4e I want to get back on track, but I don't have a definite goal and a plan, just ideas that I should (more like - MUST) to get my shit together. I would wholeheartedly appreciate some guidance, suggestions, recommendations. Please advise on what the best practices are. I need a plan. Thank you so much! Edit: _Guys (and girls) -- thanks so much for support, valuable feedback, encouragement thus far. I'm glad this post was taken seriously and not dismissed as another troll attempt or attention hoarding. You have no idea -- all this will pay off in million ways for me._


Converting between data and presentation types

I'm quite new to stuff like DI, MVVM and WPF altogether, so it's fairly possible this reads like a giant _WTF_... I have defined an interface in my business layer, `ISomeEntity`; then in my data layer, I have a `public class SomeEntity : ISomeEntity` entity type. The thing to note here is that the business layer does not reference the data layer. In the presentation layer, I can list these items, given that my window's ViewModel has a `IEnumerable<ISomeEntity>` property (or should it be `IEnumerable<SomeEntityViewModel>`?). Now I wanted to be able to mark a list item as "to be deleted", and since I'm eventually going to have a whole bunch of such "deletable" types I created an `IDeletable` interface. The `SomeEntity` type in the data layer doesn't need to know about `IDeletable`, so I implemented the interface in a `SomeEntityViewModel : ISomeEntity, IDeletable` class, in the presentation layer (part of me is starting to think it should be defined in the business/domain layer instead). The problem I'm having, is that my model is spitting out `ISomeEntity`, which really is `SomeEntity` from the data layer: I need a way to convert from `SomeEntity` to `SomeEntityViewModel`, and given that `SomeEntityViewModel` is declared in the presentation layer, my only option seems to have my ViewModel class have a constructor like this:               public SomeEntityViewModel(ISomeEntity poco)     {         // set the properties from the POCO implementation     }      ...and then in the class that holds the presentation logic, I can bridge between the two implementations by doing something like this:               _viewModel.Items = _model.SelectThoseItems() // returns IEnumerable<SomeEntity>                              .Select(e => new SomeEntityViewModel(e))                              .ToList();      ...and it works, but somehow doesn't feel right... or does it? Given `ISomeEntity`, `SomeEntity`, `SomeEntityViewModel` and `IDeletable`, what would be the "common" or "normal" way of implementing this? Or do I have it all wrong?


Offline version of dynamic pages

Researching archiving systems like archive.org, found out main issue of such is the dynamic content. Initial analysis shows that content 'dynamicity' can be assigned to one of the following levels:   1. **Static html content** \- plain old web page which is represented only by html markup with auxiliary css-referred resources (usually images).   2. **Static html powered by javascirpt** – same as Level 1, but has javascript code, which only manipulates existing markup (such as expand/collapse).   3. **“Onload” page construction** – web page with javascript code, which makes a certain additional requests during page load phase. After loads phase page content is fully constructed.   4. **Dynamic client-side content** – UI elements are modified by javascript code on-the-go, as user traverses through interface. Usually these are modern SPA (single-page-applications, like gmail.com), “endless” lists (list tail is loaded when user scrolls down to the list bottom) , loading content on demand (smart expanders) and so on. So I assume that Levels 1 and 2 can be archived pretty easily. Could you please suggest how to handle Levels 3 and 4? Looks like it should involve page rendering, but some details would be helpful. _Update_ : To clarify the question: ideally offline version should be fully- functional, at least within the site level (ignoring external domains content). Also, if Level4 is too hard to automate fully - is there an approach involving human operator who makes hints to the system about content?


Do I need to care about 'Thread safety' in java web applications

I have general understanding that what thread safety means , but I don't know much about threads in context of a java webapplication. I am just curious to know that do I need to concern about thread safety while working with web application. Can their be chances that my web application will cause some problems if I have written codes without concerning about "Thread safety"? Do I need to think about that whether I am using a thread safe collection or not?


Have I created a Big Ball of Mud?

I'm working on a WPF application, trying to stay strict in separating View, ViewModel and Model. My application has a few different views in a relatively flat hierarchy. There is one view for editing something we call a substance, and one for classifications, where each substance has a number of classifications. My question is about the ViewModel classes for the substances and classifications, each is about 1000 lines! The thing is, the code is mostly consisting of get/set properties, with some inherent logic working against my model, as well as some commands and private functions. So I could easily divide the class into a bunch of smaller classes (like one per GroupBox in my view or whatever) with one class owning instances of the other, to get smaller classes. But this doesn't seem meaningful to me, it seems like solving a symptom, like doing it for its own sake. The size of the class clearly depends on the number of fields related to the substances and classifications, and I can't do anything about that. Do you think I'm in trouble here? Is it normal for WPF applications to be so dominated, size-wise, by the ViewModels? How serious should I be about limiting class sizes? I could reduce it significantly by changing the way I write braces, but I think it looks more clear now than with Egyptian brackets. My question isn't really about whether my code is muddy or not (some of it is), but rather if you can actually say that a ViewModel class is muddy just because it's large. To give some perspective, my substance view has 7 lists/datagrids/similar, 13 buttons, 9 comboboxes, 5 checkboxes, 9 textboxes and 3 radio buttons. All in all, that's about 26 rows per control. There are some cases where there's interaction going on between different controls, setting a value in one control will disable and nullify another one etc. Some code samples:               public RelayCommand AddSubstanceNumberCommand         {             get             {                 return new RelayCommand(                     (x) =>                     {                         var number = new SubstanceNumber();                         number.SubstanceID = Id;                         number.ModifiedBy = Main.op.LoginName;                         number.ModifiedDate = DateTime.Now;                         number.CreatedDate = DateTime.Now;                         number.Type = Converters.NumberTypeToStringConverter.translation.First(t => t.Value == SelectedNewSubstanceNumberType).Key;                         number.NumberText = Validator.Normalize(NewSubstanceNumber, SelectedNewSubstanceNumberType);                         var temp = NewSubstanceNumber.Replace("-", "");                         number.NumberValue = Int32.Parse(temp.Substring(0, temp.Length - 1));                         if (NewSubstanceNumber != null && !SubstanceNumbers.Any(sn => sn.NumberText.Replace(" ", "") == number.NumberText && sn.Type == number.Type))                             SubstanceNumbers.Add(number);                              NewSubstanceNumber = "";                     }, param => this.CanAddSubstanceNumber);             }         }                    public ObservableCollection<SubstanceGroup> SubstanceGroups         {             get             {                 return Substance.SubstanceGroups;             }             set             {                 Substance.SubstanceGroups = value;                 OnPropertyChanged("SubstanceGroups");             }         }                    public RelayCommand OpenAllClassificationsCommand         {             get             {                 return new RelayCommand(                 (x) =>                 {                     // Opening tabs for all classifications that don't already have a tab open                     var currentSubstanceTab = Main.SelectedTab;                     var classificationTabsNow = currentSubstanceTab.Tabs.Where(t => t.GetType() == typeof(ClassificationViewModel));                     var toOpen = Classifications.Where(c => !classificationTabsNow.Any(ctn => ctn.Id == c.SubstanceClassificationID));                     toOpen.ToList().ForEach(o => Main.SelectedTab.Tabs.Add(new ClassificationViewModel(Main, o.SubstanceID, o.SubstanceClassificationID, false, new Services.MessageBoxNotifyUserService())));                 });             }         }      And here's one that's particularly muddy, and repeated:               public OccupationalExposureLimitUnit OccupationalExposureLimitUnit5         {             get             {                 if (SubstHasOccExpLimits)                     return Substance.OccupationalExposureLimitUnit5;                 else if (GroupForLimits != null)                     return GroupForLimits.OccupationalExposureLimitUnit5;                 return null;             }             set             {                 bool hadValue = SubstHasOccExpLimits;                 if (value.Name_SV == "")                     OccupationalExposureLimitShortTerm2 = null;                 Substance.OccupationalExposureLimitUnit5 = value;                      if (!hadValue && SubstHasOccExpLimits)                     TransferLimitValuesFromGroupToSubstance();                 OnPropertyChanged("OccupationalExposureLimitUnit5");             }         }      This property includes some fallback-functionality for when the substance lacks a certain set of values, and some state changes for going to substance- has-values-state when the user starts editing one of the values. There is certainly room for improvement here, but even without it, the class would be a number of times larger than the 200 rows some recommend for class size.


Skills required for senior developer who knows C# and WPF

I have average level of knowledge in both C# and WPF. I want to move to next level. What are the skills needed for that means for Senior developer?


Is it advisable to disable the Microsoft enforced coding standards in VC# 2010?

Coming from eclipse I've developed my own coding standards which I got used to. In Visual C# 2010 however, it appears that some coding standards that MS recommends are enforced in the default configuration. E.g.: I'm used to write conditional statements like this:               if (somecondition) {         return true;     } else {         return false;     }      But the braces are forced to a newline in visual c#. Is it recommended to use that standard ?


Which software methodology works when you are in learning phase of a technology?

In my scenario, we have a team of experienced developers with 3+ years and they are not co-located. We are in a learning phase in terms of the domain and technology. I want some recommendations in regards to what software methodology we should adapt. I have thought of implementing waterfall, since we have to design upfront and we know all the design issues and technical challenges. Using agile on teams that are not co-located, we aren't sure how to estimate on per week bases when dont have a complete grasp on the technology.


Vagrant's Users: What are its drawbacks?

I've been studying http://www.vagrantup.com/ for several days and I'd like a feedback by people using it in a professional context or for personal projects. I think I get what positive things can bring Vagrant but I have questions about its drawbacks:   * I'm a php developer and I work in a small company. I'm wondering if Vagrant could be useful for me and newcomers in my company since it's forcing a total development environment. I mean, people often prefers to work on their OS (Linux/Mac/Windows). How do you deal with that, do you force everyone to use Linux for example?   * Doesn't it add complexity since you are entirely working on a Virtual Machine?   * Don't you fear your VM main file get corrupted one day and you wouldn't be able to use it again? I feel nervous about using VM because of that. Thank you.


Corporate vs Personal email for Corporate Sponsored OSS

In the absence of a written policy, what is the preferred email domain (corporate or personal) when contributing to an open source project that your employer sponsors? \--Edit--   I'm interested in the programmer's preference assuming the company doesn't care either way.


Google Blink (new WebKit fork): Meaning of "Moving DOM into Javascript"?

From the Blink Blog: > Finally we’d like to explore even larger ideas like moving the entire > Document Object Model (DOM) into JavaScript. What does this mean? Does it mean WebKit's DOM is currently _not_ coded in JavaScript but in some other language? Does it mean that they want to expose more public accessors to the DOM? Or what?


Best JavaScript Coding Structure Using Object Literal?

Object Literal has no doubt been established in recent years as one of the essential components to best JavaScript coding practices. However, I am not very sure about what is the best way to structure my codes using Object Literal. It has been suggested earlier before that Module Pattern might be a good technique to structure your codes [1] [2], but criticisms regarding Module Pattern have begun to surface as people spent more times exploring the extent of the technique. [3] [4] So, my question is: as of summer 2011, what is the acknowledged best way to structure your codes utilizing Object Literal? Is it still Module Pattern, or has some other technique emerged already as a yet better replacement?


Should I use HTTP search

I am working on a web api and I am curios about the `HTTP SEARCH` verb and how you should use it. My first approach was, well you could use it surely for a search. But asp.net WebApi doesn't support the `SEARCH` verb. My question is basically, should I use `SEARCH` or is it not important? PS: I found the `SEARCH` verb in fiddler2 from telerik.


Tablet development for a dedicated system

I need to make an architectural decision for developing (actually porting) my embedded solution on a tablet.   The choice comes down to Ubuntu or Android, so I have some specific questions to help me decide.   * On Android, is it possible to develop applications outside of Dalvik, using Python? If yes, can I access the hardware this way, without the API's provided by the Android SDK?   * On Android, can I control the process' `core_affinity` to bind a process to a single core? And can i use `isolcpus` to isolate other processes from that core making it a (almost) dedicated core for a process? This is possible in regular linux, not sure if it can be done in Android.   * On Ubuntu, how much control over the HW do I have outside Ubuntu SDK?


Functional problems due to localization

With localization come various UI issues such as untranslated or badly translated strings, clipped strings, incorrectly formatted dates or numbers, wrong sorting order and more. However are there any non display related issues that cause major loss of functionality? One such example might be storing in a DB a floating number in a comma separated format, and then parsing it in a culture invariant dot separated format. This is likely to crash the application or produce wrong calculations. Being a Test Manager in my organization, I am wondering what other non display issues have you encountered and are likely to happen in a localized environment. Specific examples are very welcomed.


Can one determine the creation date of an email account?

Is it possible to determine the creation date of the email supplied with the authentication process flow; Or at least determine that the email was/was not created the same day as signup (or specifically after confirmation)? A use case is to flag such accounts for closer scrutiny as part of a risk management system. What general considerations do you think come into play in approaching this problem? I imagine that solutions might be specific to different email providers but if I could determine this information for the major ones it's a good place to be. Would love specific answers in any language or pseudocode assuming this is solvable within ethical principles. _Disclaimer: I have asked this question on Stackoverflow. Some nice person said that email providers would not allow it for privacy reasons. Completely acceptable, but IMHO I think that the age of an email has little to do with personal privacy. Also there are too many smart people using the stack* forums for me to just lie down and die._


Real world T4 usage

How many of you have ever used (or even know of) the Visual Studio Text Templating Engine? I mean, T4 templates have been around for quite some years now. The where initially included in Visual Studio 2005 SDK, and they where moved to Visual Studio 2008 core just before releasing it. What I want to know is if this is really used out there. I mean, why doesn't the VS team invested in a descent minimal editor for the templates? It doesn't even have syntax couloring! I know there are a couple of good T4 editors out there, but as they don't come built in, I tend to think that this is an unknown feature for most developers. Have you ever used T4 templates in any of your projects? I'm really interested in answers that explain how they created their own T4 to accelerate, automate, or generate artifacts for your project.


Do you ever read language specs?

While trying to answer questions on SO site (particularly C++ questions) I find that most of the times one person or the other includes a quote from the standard. I myself have hardly read the language spec. Even when I try to read it, I can't get my head around the language used in the specs. So, my question to become a good developer in a particular language is it essential to read its spec and know all its dusty corners which invoke undefined/implementation defined behavior?


How do you spec out your project?

all. I'm wondering how do you spec./plan out your project? For example, for webiste you can use Wireframe. How about for desktop or add-ins such as MS Office add-ins? I want it as simple as possible and don't want spend all day using some sort of diagram software to sketch it out. Do I simply write down what features I want to build for the software then filter out what is possible and what is not possible? Any tips is appreciated.


How do I set up a source code control system for myself?

I program on my desktop in my office, but also sometimes at home in a different room on my laptop, and even away from home. What I need is a system that automatically or on-demand syncs my work from one to the other, at need. I do not have a home network setup, and although I guess I could do it, that would be a question for another board, perhaps. I've thought about some kind of system that would keep the source code in the cloud, but I don't know enough about this to get started. I need a kind of free or cheap way to do this. I work in .NET (Windows Phone 7, in fact).


Argument notation in Python documentation

I read the Python documentation a lot and sometimes I am baffled by this notation: > os.path.join( **path1[, path2[, ...]]** ) I somehow make that **[, path[,...]]** is a list but I would like to know if I am reading it correctly. Bear with me, this is coming from a Java developer who is trying out Python. X)


Alternatives to *documents* in the SDLC?

Since no one prints anything any more, the concept of actual project documents (meaning, a monolithic piece of formatted text) seems like it could be improved on. Problems with documents are things like Word version incompatibilities, endless messing around with templates, the fact people hate reading them... I'm wondering if there are alternatives, like websites that would help manage the content, imposing some structure, but allowing things like linking to individual bits. But I guess the site would have to be able to spit out a "document" for the times it's needed (filing, showing sponsors who ask, etc) For example, instead of a "project plan document", I'm imagining a project planning site where you can work on just the resourcing with relevant people, then you work on scheduling with other relevant people, and work packages with other relevant people. Instead of an SRS document, some site that lets you manage requirements, assigning priorities, phases etc...but that could ultimately generate an actual SRS document if you needed it. Thoughts? The context here is small, agile teams but with occasional need to produce documents to demonstrate progress. We're certainly not big enough to warrant anything like Rational or whatever they use these days in big companies.


Is developing for a niche tablet market worth it?

As an avid fan of tablets, I finally bought a Nook Color a while back. Since it's based on Android and I have Java experience, I'm intrigued by the possibility of developing for it. I've seen that it has an estimate of a few million units shipped (those stats were fairly recent), and the app market is rather small at this time (which I presume would be an advantage to a new app). What I'm wondering is, what are the advantages and disadvantages of developing for such a small, reading-based market - in terms of app popularity and use? Am I wrong in assuming the small app market is an advantage? Does developing for a niche tablet have any synergy with the larger phone market, in terms of cross-development or promotion?


How will we be able to produce websites without using cookies with the new law?

> **Possible Duplicate:**   >  How do I comply with the EU Cookie Directive? Under this new EU law we are not allowed to use any cookies without asking first, I for one need to use a cookie to register the user logged on, as if not with a cookie they can log on more than once and breach the license terms of the software. so i find myself asking what can we use instead of cookies to perform this task?


How can we plan projects realistically while accounting for support issues?

We're having a problem at work: we're trying to schedule work so that we can assess time scales and get deadline dates. The problem is that it's difficult to plan for a project without knowing everything that's going to happen. For instance, right now we've planned all our projects through the start of December, however in that time we will have various in house and external meetings, teleconferences and extra work. It's all well and good to say that a project will take three weeks, but if there is a week's worth of interruption in that time then the date of completion will be pushed back a week. The problem is 3 fold:   1. When we schedule projects the time scales are taken literally. If we estimate three weeks, the deadline is set for three week's time, the client is told, and there is no room for extension.   2. Interim work and such means that we lose productive time working on the project.   3. Sometimes clients don't have the time that we need to take to do the work, so they'll sometimes come to us and say they need a project done by the end of the month even when we think that the work will take two months - not to mention we already have work to be doing. We have a Gantt chart which we are trying to fill in with all the projects we have and we fill in timesheets, but they're not compared to the Gantt chart at all. This makes it difficult to say "Well, we scheduled 3 weeks for this project, but we've lost a week here so the deadline has to move back a week." It's also not professional to keep missing deadlines we've communicated to the client. How do other people deal with this type of situation? How do you manage the planning of projects? How much "extra" time do you schedule into a project to account for non-project work that occurs during a project? How do you deal with support issues and bugs and stuff? Things you can't account for during planning? **UPDATE** Lots of good answers thank you.


In a legacy codebase, how do I quickly find out what is being used and what isn't?

I've been asked to evaluate what appears to be a substantial legacy codebase, as a precursor to taking a contract maintaining that codebase. This isn't the first time I've been in this situation. In the present instance, the code is for a reasonably high-profile and fairly high-load multiplayer gaming site, supporting at least several thousand players online at once. As many such sites are, this one is a mix of front- and back-end technologies. The site structure as seen from the inside out, is a mess. There are folders suffixed "_OLD" and "_DELETE" lying all over the place. Many of the folders appear to serve no purpose, or have very cryptic names. There could be any number of old, unused scripts lying around even in legitimate-looking folders. Not only that, but there are undoubtedly many defunct code sections even in otherwise-operational scripts (a far less pressing concern). This is a handover from the incumbent maintainers, back to the original developers/maintainers of the site. As is understandably typical in these sorts of scenarios, the incumbent wants nothing to do with the handover other than what is contractually and legally required of them to push it off to the newly-elected maintainer. So extracting information on the existing site structure out of the incumbent is simply out of the question. The only approach that comes to mind to get into the codebase is to start at the site root and slowly but surely navigate through linked scripts... and there are likely hundreds in use, and hundreds more that are not. Given that a substantial portion of the site is in Flash, this is even less straightforward since, particularly in older Flash applications, links to other scripts may be embedded in binaries (.FLAs) rather than in text files (.AS/ActionScript). So I am wondering if anyone has better suggestions as to how to approach evaluating the codebase as a whole for maintainability. It would be wonderful if there were some way to look at a graph of access frequency to files on the webserver's OS (to which I have access), as this might offer some insight into which files are most critical, even though it wouldn't be able to eliminate those files that are never used (since some files could be used just once a year).


Does anyone work 10 hours shifts as a developer?

I would like to switch from a 5 day week to a 4 day, but maintain a 40 hour working week. Would the 10 hour days affect your ability to be productive? I hate our public transit system so if I could reduce my transportation by 20% I would be happy.   If other developers who work 10 hours shifts could be clear as the their experiences with it that would help me. I think my boss is flexible enough that he would be cool with it.


Using Scrum on small projects where Owner doesn't want to be involved

Recently I've been reading and learning quite a lot about scrum and I like it a lot. However, I do have a couple of likely scenarios in my head to which I don't know the solution. So let's say that I might want to organize an agile team of (for instance) four web developers (one of them UI/UX designer). This team would operate on scrum principles. Initially we would probably be working on projects like landing pages for ordinary people's small businesses, like renting apartments, selling cookies... Such customers simply can't be set with Product Owner role (IMHO), because they usually expect to hire a company, give them the overall project goal with some details, and then expect the job to be done (including a lot of decision making) with as little of their involvement as possible (in their opinion, they have more important things to do). Let's say I'd like to engage myself in a developer/scrum master role (I know that even that is debatable, being a team member and scrum master at once), so I simply shouldn't take the role of the product owner as well. So as for my questions: If I'm my company's business owner, do I simply need to be a product owner as well (do these roles include each other)? Can I employ a sales person which might have the product owner role? Would it be better if it is an experienced developer instead of a sales person? Is this even a smart move? Lastly, is there another agile approach that might better suit my position? * * * **EDIT:** Thank you everyone for good inputs. I added some comments, any aditional info will be greatly appreciated.


What's the title of someone who presents software for a living?

I'm wondering what the title of someone who's main job is to present software/products (basically do presentations) (internally or externally)? I'm not really talking about salespeople, but more on the side of people who go out there and make presentations as a key part of their job, while still having some parts of involvement with the development? A possible title: Product Evangelist. Is it only the program managers and VP's who go out and present to the "higher-ups" or the public?


Nested Classes: A useful tool or an encapsulation violation?

So I'm still on the fence as to whether or not I should be using these or not. I feel its an extreme violation of encapsulation, however I find that I am able to achieve some degree of encapsulation while gaining more flexibility in my code. Previous Java/Swing projects I had used nested classes to some degree, However now I have moved into other projects in C# and I am avoid their use. How do you feel about nested classes?


Where is a good place to start to learn about custom caching in .Net

I'm looking to make some performance enhancements to our site, but I'm not sure exactly where to begin. We have some custom object caching, but I think that we can do better. **Our Business** We aggregate news stories on a news type of web site. We get approximately 500-1000 new stories per week. We have index pages that show various lists of the items and details pages that show the individual stories. **Our Current Use case: Getting an Individual Story**   1. User makes a request   2. The Data Access Layer(DAL) checks to see if the item is in cache and if item is fresh (15 minutes).   3. If the item is not in cache or is not fresh, retrieve the item from SQL Server, save to cache and return to user. **Problems with this approach**   * The pull nature of caching means that users have to pay the waiting cost every time that the cache is refreshed. Once a story is published, it changes infrequently and I think that we should replace the pull model with something better. **My initial thoughts**   * My initial thought is that stories should ALL be stored locally in some type of dictionary. (Cache or is there another, better way?). If the story is not found, then make a trip to the database, update the local dictionary and send the item back.   * Since there may be occasional updates to stories, this should be an entirely process from the user.   * I watched a video by Brent Ozar, How StackOverflow Scales SQL Server, in which Brent states "the fastest database query is the one that you don't make".  **Where do I start?** At this point, I don't know exactly what the solution is. Is it caching? Is there a better way of using local storage? Do I use a Dictionary, OrderedDictionary, List ? It seems daunting and I'm just looking for some good starting points to learn more about how to do this type of optimization.


Why function returning by Address can not be a Lvalue?

Why it is not possible to make it LValue if a function return by address (while possible in case of reference)?               int* returnByAdress()     {         int x =20;         return &x;     }          int& returnByReference()     {         int x =30;         return x;     }          int main()     {         returnByReference() = 23; //possible         int x = 23;         returnByAdress() = &x;//not a lValue error          *returnByAdress() = 245;//possible              return 0;     }


Exceptions as asserts or as errors?

I'm a professional C programmer and a hobbyist Obj-C programmer (OS X). Recently I've been tempted to expand into C++, because of its very rich syntax. So far coding I haven't dealt much with exceptions. Objective-C has them, but Apple's policy is quite strict: > **Important** You should reserve the use of exceptions for programming or > unexpected runtime errors such as out-of-bounds collection access, attempts > to mutate immutable objects, sending an invalid message, and losing the > connection to the window server. C++ seems to prefer using exceptions more often. For example the wikipedia example on RAII throws an exception if a file can't be opened. Objective-C would `return nil` with an error sent by a out param. Notably, it seems std::ofstream can be set either way. Here on programmers I've found several answers either proclaiming to use exceptions instead of error codes or to not use exceptions at all. The former seem more prevalent. I haven't found anyone doing an objective study for C++. It seems to me that since pointers are rare, I'd have to go with internal error flags if I choose to avoid exceptions. Will it be too much bother to handle, or will it perhaps work even better than exceptions? A comparison of both cases would be the best answer. Edit: Though not completely relevant, I probably should clarify what `nil` is. Technically it's the same as `NULL`, but the thing is, it's ok to send a message to `nil`. So you can do something like               NSError *err = nil;     id obj = [NSFileHandle fileHandleForReadingFromURL:myurl error:&err];          [obj retain];      even if the first call returned `nil`. And as you never do `*obj` in Obj-C, there's no risk of a NULL pointer dereference.


Preserving version control commit history vs Refactoring and Documentation

It costs almost nothing to use the commit history maintained by the version control system. However, during a major project refactoring (or reorganization / cleanup) effort, functions and classes and even namespaces will be moved around; sometimes several files will be merged together and other files will be split. These changes often lead to the loss of the original commit history of a few files. In my personal opinion, the up-keeping of the organization of the project is more important than keeping the source code history. Good project organization allows new features to be added continuously with reasonable effort, while the value of source code history appears to be dubious. Furthermore, with the use of unit testing, regression issues are quickly identified. As long as the latest version continues to satisfy all of the software requirements, do we actually need to preserve the history of the source code? I understand that any _shipped_ source code must be preserved because of the need to provide support to the customers without requiring them to perform a major version upgrade. But aside from this, is there any value in keeping the history of source code commits? Does source code commit history play any role in the communications between team members? What if we abolish the commit history, but instead rely on "source code" + "unit testing code" for communication? Does the existence of commit history make one complacent about the long-term documentation of important information about the project, such as the major design/requirement changes and the streams of thought that drove those changes?


How to write "SMART" Objectives as an agile developer?

Like many corporations the company I work for is transitioning to a performance review system based on SMART objectives. My team is a high functioning agile development team employing practices from both SCRUM and Extreme Programming. To our great benefit our employment of agile practices has the full support of immediate and upper management. To accomplish work our team utilizes three week iterations. Beyond the immediate iteration we have a general plan laid out into quarters. Meaning that what we will have accomplished a few quarters from now is a lot hazier than what we will be accomplishing in the immediate quarter. We certainly have a general idea of where our project is headed, but the keyword here is general. Given our approach to project planning members of our team and myself are finding it difficult to write objectives which are specific, measurable, attainable, relevant, and time-bound. Two existing questions on Programmers.se do a good job of addressing some of our concerns:   * What is an example of a good SMART objective for a programmer?   * Are SMART goals useful for programmers? However, the questions elicited more general responses than specifics for dealing with SMART goals when working on an agile development team. As an agile developer how do you write five to seven, year long objectives which are specific, measurable, attainable, relevant, and time-bound?


Does domain specific languages use other programming languages?

Does a domain specific language use other languages like c++ or java, or is it standalone?


Is programming a profession not for a person with speech impairment?

My friend has 15 years of programming experience and Ph.D. in mathematics. He has also cerebral palsy with speech impairment. Because of his handicap, he chose to being a software developer after his Ph.D. As far as I can see, he is still an excellent c# developer. Nowadays, however, he has hard time to find a job for himself because most of developer jobs require good communication skills. Looking at him struggling so much, do I have to advise him software industry is not suitable for him any more? It will be extremely difficult for me to do that to the friend but I think it would be better than making him wasting his time. What do you think? **Update:** Thanks a lot for your excellent answers. I can see most answers recommend against my advice and I really really hope you guys are right. In reality, however, he has been rejected in 100 or so phone interviews. That's where I want to be a potential bad adviser rather than a politically right friend.


Is it an inefficient workflow to write out code and THEN go back and optimize?

I'm a newer enthusiast programmer. I've been doing small and big projects on and off for the past two or three years. I always hit small snags in my code that add up to big memory hogs or unnecessary lines of code down the road. My philosophy on big projects has always been to just 'get it out of my head' and write all the code into a working product, then going back and reducing the code to a simpler, more optimized form. However, this doesn't always work: when doing database structures, I tend to have to go back many times to add in features that come up spur-of-the-moment. Entire blocks of code have to be erased because of a spontaneous brainchild. My question to you is, **is it more efficient to write an entire program and THEN go back and optimize it, or should I optimize code as I write it?**


Code licensing question. Client stole my code

A client I did a project for accidentally ended up with the source code of said project. Stupid i know. The arrangement was that they would get the product, never the source code. However, obviously, they are now trying to pull a fast one and use the source code to create their own products for other clients. Now i don't want to make a huge deal out of it, but i am contemplating releasing the code as an open source project for anyone to use so that their 'unique' selling point (my code) is moot. What do you guys suggest i do / release the code under if they decide to be *ssholes about this?


Open source software with good code documentation to improve design skill

As I'm trying to get better at designing good software I'm wondering if there are out there good (as in well written) open source software with lot of code documentation that aims to explain details about why this or that design choice was made in the context of that specific problem set. I'm interested in OOP and I don't really care much about the language (php / java / c# are preferred tho :)) Example: Problem: X   Possible way to handle this problem: A, B, C.   We choose B because... (technical details about the implementation, pros and cons, code comments etc)


How should we draw the release burndown chart?

I have been in various Agile projects and seen many release burndown chart styles. Most of them were handled manually since somehow all the tools that I have run across don't produce really useful burndown charts. In reality, we may not be dealing with all stories estimated and we just keep burning down. Many times, the scope is added during the release. Currently, I am dealing with these problems with the burndown chart and have questions about the following things:   1. How do we represent added scope in the release burndown chart?   2. How do we deal with unestimated stories in release burndown chart assuming that there is high probability that we will do it but we just do not have time to estimate them yet?   3. How do you project the end of the release? The burndown chart below is from the fictional case study in the appendix of classic Mike Cohn's Estimating and Planing book. ![Mike Cohn's burndown](http://i.stack.imgur.com/MXQ5o.png)


Which layer does async code belong?

I am developing an application that consumes data from an external service. The application is being implemented following a typical layered architecture with UI, Presentation, Domain and Data layers. The service client resides within the Data layer. As is typically the case, I do not want the UI to 'lock-up' while waiting for calls from the external service to complete. However, implementing the service agents with asynchronous methods results in a complicate model chaining async methods up the layers so the UI can stay responsive. For example: In the ViewModel:               TheRepository.LoadDataAsync().ContinueWith(t => { _data = t.Result; });      In TheRepository:               public Task<TheData> LoadDataAsync()     {         return ServiceClient.GetDataFromServiceAsync();     }      (Note, this is a significant over-simplification meant to convey what I mean by task chaining.) Because the requirement is a UI requirement (prevent the UI from 'locking'), doesn't it make sense to keep the Domain and Data layers synchronous and leave it up to the Presentation layer to decide when it needs to perform some operation asynchronously? On the other hand, it is so easy and natural to implement the service client/proxy with async methods (VS will auto-generate them if needed) because this is what we think of when we think about the need for async. If the application was pulling data out of a database instead of making a service call, the layers wouldn't be any different and it shouldn't really change how the UI, Presentation or Domain layers have been implemented, right? In this case, we wouldn't think twice about having the data access be synchronous. Would it be a better design to model the Domain synchronously and leave it to the Presentation layer to address performance issues in the UI? Or, in the emerging async world, should we just accept async as the norm and make everything fit this model?


What is casting supposed to mean?

When coding in low level languages like C I find that casting sometimes means 'reinterpret these bytes as if it had always been of this other type' and at other times as 'convert this value intelligently into this other type'. What is the original meaning of the word and is there any consistency in when to expect a conversion and when to expect a raw reinterpretation?


Learning new programming languages and technologies

Some time ago I was to learn iOS development at my work. I didn't manage to learn it because I was moved to more important task with another technology already familiar to me. But the short time I spent on iOS, I felt that I could do better if I spent a few hours at the workplace during which I could discuss some matters concerning iOS with my colleagues who know it, and the rest of the time working at home. I think many developers would share my opinion and prefer to learn the new technology at home. Is there any accepted practice? Has any developer had an experience when the company encouraged the developers to choose where they feel more comfortable to learn new technologies?


How to structure template system using plain PHP?

I was reading this question over on stackoverflow: http://stackoverflow.com/questions/104516/calling-php-functions-within- heredoc-strings and the accepted answer says to do plain PHP templates like this: template.php:                                     <title><?=$title?></title>                               <?=getContent()?>               index.php:               <?php          $title = 'Demo Title';          function getContent() {         return '
Hello World!
';     }          include('template.php');          ?> To me the above isn't well structured in the sense that template.php depends on variables that are defined in other scripts. And you're using an include() to execute code when you do `include('template.php')`(as opposed to using include() to include a class or a function which isn't immediately executed). I feel like a better approach is to wrap your template inside a function: template.php:               <?php          function template($title, $content) {         ob_start(); ?>                                <title><?=$title?></title>                               <?=$content?>                            <?php return ob_get_clean();     }          ?> index.php:               <?php          require_once('template.php');          print template('Demo Title', '
Hello World!
');          ?> Is the second approach better? Is there an even better way to do it?


Is Agile a variant of RAD?

Wikipedia says that Agile is a type of "RAD" which I guess is incorrect. From what I know, Agile was developed becasue RAD itself was not that sucessfull in 90'S (too rigid for changes). Or am I wrong? A reference from a book Radical Project Management (Thomsett) > "..new development fad such as RAD, Agile, Object oriented..." CISA Certified Information System auditor: > ..aware of **two alternative** software dev. methods: Agile and Rapid > Application Development Agile management for Software: > Agile methods are mostly derived from lightweight approach of RAD. Software estimation best practices: > The major methods of sw. dev. can be summarized as follows:   >  1\. Waterfall ..   >  4\. RAD   >  5\. Agile The point of this question is:   **Is Agile type of RAD or standalone development approach?**


Making money from developing Open Source Software. How does that work?

> **Possible Duplicate:**   >  Making money with Open Source as a developer? I've been hearing recently that more and more developers contribute their efforts to many open-source products. Being a novice in many aspects of software development I've never thought about myself as being a member of a team that builds a product almost anybody can use for free. But this trend is getting more and more attention, and today it is almost considered that any self-respected software engineer should have at least one example when they participated in an open-source project. It gives you a few more credits on the interview, it's cool, it means something very good, especially if the product is popular and successful. However, it seems that it's not just cool, but somehow it is prosperous business today. Not just some students or passionate enthusiasts anymore, but well known developers quit their jobs and start spending most of their time in that sector, proprietary companies spend good amount of money to support them. I understand there are many different types of licensing and stuff. But I simply don't understand, how those developers get paid? How the companies make their revenue of it? I don't believe that behind all that is just people's altruistic nature, and they just happy to work for virtually nothing. Can you explain me taking any well known project as an example, the business model of it? How can somebody participate? What should you know first? How can you monetize your efforts? Is there any "guide to beginners" or "complete manual for idiots" to start with?


Is open-sourcing previously-commercial engines a smart move?

I saw that the Unreal Engine is going open-source on github (see link1 and link2) and that made me wonder: "is open-sourcing a previously commercial engine a smart move?" What's the benefit to Epic Games in open-sourcing their core code in this manner? How can they not be concerned about people stealing parts of it just because they put a copyright and license statement on the code? It seems like there has to be a catch. How does releasing their source code benefit Epic Games?


Does TDD's "Obvious Implementation" mean code first, test after?

My friend and I are relatively new TDD and have a dispute about the "Obvious Implementation" technique (from "TDD By Example" by Kent Beck). My friend says it means that if the implementation is obvious, you should go ahead and write it - **before** any test for that new behavior. And indeed the book says: > How do you implement simple operations? Just implement them. Also: > Sometimes you are sure you know how to implement an operation. Go ahead. I think what the author means is you should test first, and then "just implement" it - as opposed to the "Fake It ('Till You Make It)" and other techniques, which require smaller steps in the implementation stage. Also after these quotes the author talks about getting "red bars" (failing tests) when doing "Obvious Implementation" - how can you get a red bar without a test?. Yet I couldn't find any quote from the book saying "obvious" still means test first. What do you think? Should we test first or after when the implementation is "obvious" (according to TDD, of course)? Do you know a book or blog post saying just that?


Search multiple tables

I have developed a web application that is used mainly for archiving all sorts of textual material (documents, references to articles, books, magazines etc.). There can be any given number of archive tables in my system, each with its own schema. The schema can be changed by a moderator through the application (imagine something similar to a really dumbed down version of phpMyAdmin). Users can search for anything from all of the tables. By using FULLTEXT indexes together with substring searching (fields which do not support FULLTEXT indexing) the script inserts the results of a search to a single table and by ordering these results by the similarity measure I can fairly easily return the paginated results. However, this approach has a few problems:   * substring searching can only count exact results   * the 50% rule applies to all tables separately and thus, mysql may not return important matches or too naively discards common words.   * is quite expensive in terms of query numbers and execution time (not an issue right now as there's not a lot of data yet in the tables).   * normalized data is not even searched for (I have different tables for categories, languages and file attatchments). **My planned solution** Create a single table having columns similar to               id, table_id, row_id, data      Every time a new row is created/modified/deleted in any of the data tables this central table also gets updated with the `data` column containing a concatenation of all the fields in a row. I could then create a single index for Sphinx and use it for doing searches instead. Are there any more efficient solutions or best practises how to approach this? Thanks.


Understanding velocity update in Binary Particle Swarm Optimization

I am wondering how to interpret the velocity update in a _BinaryParticle Swarm Optimization_ (PSO). To recap the velocity update :               V(t+1) = V(t) + c1 * r1 * (XlocalBest  - X(t))                     + c2 * r2 * (XglobalBest - X(t))      I understand that the binary position vector maps to values in the discrete domain. However, the binary vector contains only `0` and `1`s, where the length of this vector is `n`-dimensional. What I don't get is that the `n` real valued velocity vector takes the `n` binary vector (position), and takes e.g the difference between the local best position at a given index and the current position. Is it correct that there's only `0`,`1` values that are subtracted for each `X` value in the update ? (So that e.g `c1 * r1` is only multiplied either with `0`, `1` or `-1`)? How can I use this information in relation to the sigmoid function that is often used in these PSOs? Should I update the velocities, and for example take a particles velocity vector where each element is in the domain `[0,1)`, and put this into the sigmoid function, and turn the corresponding bit positions on or off in the particle's binary vector such as `r < sigmoid(velocity value)`, where `r` is random in `[0,1)`? Does this sound about right, or did I get it wrong?


Io (Language) IDE/Compiler

Can you recommend a free compiler/IDE for writing some simple Io programs? I want to learn the language at home in my spare time.


Microsoft's current best practices for building a .NET data tier? And reality?

The development team I'm working with will be moving to .NET 4.0 soon, however, the data access class library we use still uses ADO.NET "classic", meaning SqlDataReader, DataTable, and the like. Meanwhile, it seems like Microsoft and probably the rest of the world is moving forward with Entity Framework and WCF Data Services. I didn't find anything on MSDN that indicated which of the data access technologies Microsoft considers best practices. Does Microsoft have a preference? What data access are most people using currently? Are there good reasons to stay with ADO.NET classic and not move to Entity Framework?


What was the first hierarchical file system?

"Directories containing directories and files" seems to have been around forever, but there must have been a first.


How to report the progress of my project (Agile) to my employer (who is not a programmer)?

I have a problem on reporting progress to my employer. I am a part-time programmer, handling a software project for my school's (non-technical) department. Contact person:   1\. The staff who actually uses the software and raises feature requests,   2\. My boss (non-programmer), and she is not the software's user. The project's nature:   It is a ready-made software, which has been bought from third-party. I have to modify or add feature/function to this software in order to cater for department's need. This is a software is need to use throughout the semester. Not all features needs to be used at the beginning. Hence we are using the Agile model: When the staff needs a certain feature, they raises a request, and I make the changes. By the end of the semester, I suppose all the required features will be raised and implemented. The problem:   Everytime my boss asked me how the progress, I can't answer, because I don't know how to answer. I don't have complete list of all the required features. Even though I have completed features which were raised last week, I still can't tell my boss I have "completed", because new features are coming in too, and I don't know how much. I can't tell "We have how many % completion" nor "We are going to complete it by xxx". Sometime out of 3 requests, I manage to complete 2, I would tell my boss "I have completed 2, but there is one feature not complete yet". After a long period of time, I sounds like "I always have something not finish, after so long". Being unable to report the progress makes me looks really bad. It's not about how much I've done, it's about how to let people know. If I were the manager, and my staff keep failing to report the progress to me for months, I will feel this guy is incapable too. Do you guys have any idea how to report, or answer question as simple as "what is the status / progress of the software modification"? **UPDATE** My boss doesn't involve in development task directly, so she doesn't have a clue on what I am doing, or how the program works. We don't meet regularly as she is busy, and I feel it will be waste of time because she is not the main user, she doesn't know the detail of the program. I meet regularly with the staff who uses and knows better about the software. I feel hard to explain the progress to my boss.


My code is given below. In the for loop I am getting unexpected output i.e.   before completing the execution of for loop by 1st thread the 2nd thread comes in for loop and shows incremented value.               public class ThreadSafe {         public static void main(String[] args) throws InterruptedException {             System.out.println("main()");                  B b=new B("1st Thread");             B b1=new B("2nd Thread");             B b2=new B("3rd Thread");             b.start();             b1.start();             b2.start();         }     }          class MyCounter {         private static int count;              public static int getCount(){             for(int m=0;m<2;m++){                 System.out.println(count+" "+Thread.currentThread().getName());             }                  return count++;         }              }          class B extends Thread{         public B(String tname) {             super(tname);         }          public void run() {         MyCounter.getCount();         }     }      The question is when 1st thread executes for loop then other threads executing return statement is this the reason of showing increment value or something else? How other thread can show the incremented value unless the 1st thread reaches the return statement?


How to architect a website's presentation layer?

I have been going back and forth in different approaches for designing the presentation layer for websites. Many people swear by one of the different CMS packages which is too constraining and inflexible. Many people suggest writing the HTML by hand which seems not to scale in the case of many pages. I have a new web application I am designing and I really want to have a "correct" and "elegant" and practical approach in how I architect it. Has anyone done this in a way in which they are happy with and can plug in various modules and libraries with no problems? Any tips or pitfalls I should watch for?


What is the best practice to develop a visual component in Flex Hero? I do it like this: I consider a component has 2 "parts", the declarative part (the visual sub-components) which I define in the skin (just mxml) and the code part (event handlers...) which I define in an action script class. I load the skin in the ctor of the action script class. I also define skin parts, states, and I bind event handlers in the partAdded function. I am having an argument about this; that I should define the component purely in an .mxml, with listeners in the script tag, and maybe attach a skin (but the skin should be loose - maybe for reuse :-?) I come from .NET and maybe I am biased with the code behind pattern, and I am wondering from your experience and Adobe's intent, what is the best practice to usually implement a visual component?


What skill set should an engineer have in order to build a large social networking site?

I am trying build a social media site, but I need a hands on senior engineer/architect to guide and assist me in the server-side development since I am a rookie. Technology (which I am familliar with) to be used includes Java, JAX-RS, Spring and Hibernate. Unfortunately, I dont know what other technology skills an engineer/architect should have besides those mentioned above? The SNS I am trying to build is like Facebook which can guide you in terms of features and functionalities.


Good references for End User documentation examples and advise

Our in house software has been used for many users and the training department asked us for any tips of end user documentation format. Does any know where can I find good examples of software end user documentation that a training department to use for inspiration or any sites with good advise? This is similar to this question however I am looking for end user documentation for use used by non-technical users.


Should user documentation include screenshots?

This question focuses on _user_ documentation, not on code documentation. I just finished my software project, and the people I work for are expecting me to write user documentation, describing everything the software does. All the documentation they had until now (about the rest of the software they use) is full of screenshots, and sometimes barely contains any text. I think it's awful. I've been struggling for hours to understand how screenshots were connected, and most of the time I had to ask for help from someone else. I wrote a Java desktop application, and its appearance is likely to depend on the current Windows theme and Java update. I don't think screenshots can form reliable, definitive reference. Taking hundreds of screenshots and annotating them will take forever, and I don't believe it will help more than accurate, plain text documentation. **How should I approach putting the user documentation together? What guidelines should I follow regarding the use of screenshots versus explaining in text with user documentation?**


I sold my source code to a client, can I now re-build similar code and sell to someone else?

So we built a website and software for a client, charged our fee and handed over the code. The client then got a request from another company about the software. The client passed on the request but said since they owned the code they would need to recieve money for it. I'm thinking there are 2 options here:   1. Work with the client as requested   2. We've actually re-built the software, made it much better and use it for other projects. Am i in my rights to sell that direct to the company that enquired about it instead of going through the client?  Any help on this would be much appreciated


Java - using single class or multiple class for each type?

I currently have a Java class called "node" which has a number of fields. Which fields in the class are used depends on a field called "type". There are close to 10 (this can grow) different types of "nodes". I was wondering if it is good to have a single class to handle all types or have different class for each type. What is the best programming practice in these cases? I would like to know (or a link to similar question/tutorials) how the performance will be affected (like memory etc.) if I use a single class?


Is it possible to release a library based on the ASIO SDK under the LGPLv3?

I'm wondering if it's possible to write and release a library based on the ASIO SDK under the LGPLv3. More specifically, the ASIO license says something I'm not sure how to interpret (2.2) : > The Licensee has no permission to [...]. This includes re-working this > specification, **or reverse-engineering any products based upon this > specification.** Which sounds like it could conflict with LGPL's: > You may convey a Combined Work under terms of your choice that, taken > together, effectively do not restrict modification of the portions of the > Library contained in the Combined Work and reverse engineering for debugging > such modifications Also, 5.a) is kind of bugging me : > Accompany the combined library with a copy of the same work based on the > Library, uncombined with any other library facilities The way I see it, my Library will have no use, point or effect on its own, when uncombined with the ASIO SDK. Will I still have to release an uncombined dummy piece of software to respect 5.a) if I choose LGPL?


is there a java library to create assisted wizard flow into your desktop application?

I am looking to create a step by step introduction/wizard guide to help users create a job on my application. For example, they will told what to click, and will be asked what actions they would like to take next etc. Framework or library that aides this? What do you call this wizard/step-by- step workflow in software? Found something: http://code.google.com/p/cjwizard/


NCurses, scrolling of multiline items, "current item" pointer and "selected items"

I am looking for hints/ideas for the best (most effective) way on how to scroll multi-line items as well as emphasizing of the "current item" and "selected items" such as:               1 FOO ITEM       1 Foo sub-item       2 Foo sub-item       3 Foo sub-item          2 BAR ITEM       1 Bar sub-item          3 BAZ ITEM       1 Baz sub-item       2 Baz sub-item          4 RAB ITEM          5 ZZZ ITEM       1 Zzz sub-item       2 Zzz sub-item       3 Zzz sub-item       4 Zzz sub-item      using _NCurses_ (some combination of windows, sub-windows, pads, copywin? Uff! In fact, the lines could exceed the `stdscr`'s width so that possibility to scroll left/right would be also nice - pads?)... The whole items (including the sub-items) are supposed to be emphasized as full-width window/pad areas. The "current item" (including it's set of lines) should be emphasized (i.e. using `A_BOLD`), selected set of items of choice (including the set of lines for each the selected item) should be emphasized in another way (i.e. using `A_REVERSE`). What would you choose to cope with it the most effective NCurses way? (The less redrawals/refreshes the better and terminal is supposed to have the ability to change it's size - such as XTerm running under "floating window" management.) Thank you for your ideas (or perhaps some piece of code where something similar is already solved - I was not able to find anything helpful on the Internet. I mean I am not going to copy/paste foreign code but programming NCurses _properly_ is still somehow difficult to me). P.S.: Would you suggest to "smooth-scroll" +1/-1 screen line or rather "jump- scroll" +lines/-lines of the items? (I personally prefer the latter one.) Sincerely, \-- mjf


Algorithm for detecting windows in a room

![enter image description here](http://i.stack.imgur.com/kvzbf.png) I am dealing with the following problem and i was looking to write a Pseudo- code for developing an algorithm that can be generic for such a problem. Here is what i have come up with thus far. **STEP 1** In this step i try to get the robot where it maybe placed to the top left corner.               Turn Left -> If no window or Wall detected keep going forward 1 unit..          if window or wall detected ->Turn right --> if no window or Wall detected keep going forward..          if window or wall detected then top left corner is reached.      **STEP 2** (We start counting windows after we get to this stage to avoid miscounting) I would like to declare a variable called **turns** as it will help me keep track if robot has gone around entire room.               Turns = 4;      Now we are facing north and placed on top left corner.               while(turns>0){          If window or wall detected (if window count++)           Turn Right          Turn--;          While(detection!=wall || detection!=window){          move 1 unit forward          Turn left (if window count++)          Turn right          }               }      I believe in doing so the robot will go around the entire room and count windows and it will stop once it has gone around the entire room as the turns get decremented. I don't feel this is the best solution and would appreciate suggestions on how i can improve my Pseudo-code. I am not looking for any code just a algorithm on solving such a problem and that is why i have not posted this in stack overflow. I apologize if my Pseudo-code is poorly written please make suggestions if i can improve that as i am new to this. Thanks.


Where to start for writing a simple java IDE?

I would like to start working on my own custom IDE. The biggest reason I want to work on the IDE is to help me gain an even greater, more intimate understanding of java (and other languages I add into it.) I don't want to do anything super fancy or revolutionary, I'd be happy if I could create something as compact as the BlueJ IDE I used in high school and be content. I have a few question on the specifics of the task that I hope I can get cleared up before I start investing time in this:   * Is there anything I should be aware of when writing the parser?   * Does anyone have any pointers that I should be aware of; pitfalls, brick walls or other constraints?


What is the proper name for this design pattern in Python?

In Python, is the proper name for the PersonXXX class below PersonProxy, PersonInterface, etc?               import rest          class  PersonXXX(object):              def __init__(self,db_url):             self.resource = rest.Resource(db_url)              def create(self,person):             self.resource.post(person.data())              def get(self):             pass              def update(self):             pass              def delete(self):             pass               class Person(object):              def __init__(self,name, age):             self.name = name             self.age = age              def data(self):             return dict(name=self.name,age=self.age)


iOS7 apps only using iPad only

I would like to develop iOS apps but due to budgetary issues I can only afford an iPad mini gen1 or iPod touch 5th gen. Is it possible for me to make apps for all iPhones and iPads/iPods using just a single device? Another question is how does the latest iOS7 work on ipad mini gen 1/iPod touch and what are the limitations when working with these devices when compared to an iPhone(My target apps are trivia and endless runner games). Thanks P.S. I do have a mac with xcode on it and I am developing a cocoa app right now and the question is if i can develop for all io7 devices using just one deceive for final testing.


Should I always encapsulate an internal data structure entirely?

Please consider this class:               class ClassA{              private Thing[] things; // stores data              // stuff omitted              public Thing[] getThings(){             return things;         }          }      This class exposes the array it uses to store data, to any client code interested. I did this in an app I'm working on. I had a `ChordProgression` class that stores a sequence of `Chord`s (and does some other things). It had a `Chord[] getChords()` method that returned the array of chords. When the data structure had to change (from an array to an ArrayList), all client code broke. This made me think - maybe the following approach is better:               class ClassA{              private Thing[] things; // stores data              // stuff omitted              public Thing[] getThing(int index){             return things[index];         }              public int getDataSize(){             return things.length;         }              public void setThing(int index, Thing thing){             things[index] = thing;         }          }      Instead of exposing the data structure itself, **all of the operations offered by the data structure are now offered directly by the class enclosing it, using public methods that delegate to the data structure.** When the data structure changes, only these methods have to change - but after they do, all client code still works. **Note that collections more complex than arrays might require the enclosing class to implement even more than three methods just to access the internal data structure.** * * * Is this approach common? What do you think of this? What downsides does it have other? Is it reasonable to have the enclosing class implement at least three public methods just to delegate to the inner data structure?


Why is the function called lseek(), not seek()?

The C function for seeking in a file is called lseek(). Why ins't it called just seek()?


Who owns the copyright in a patch file?

I'm trying to determine OSS compliance for a body of source code, part of which includes sections from OpenEmbedded, and contains a lot of patch files, as they (seem to) try to adapt various tools. In these patch files I find a range of copyright possibilities   * the patch file removes a hunk of code from an original, hence 90% of the patch file itself is the original code, so the patch file is "derived" and the original copyright still applies   * In betweenies   * the patch file contains just a few lines of actual patching (or is primarily additions), and has a large number of lines as comment explaining why it is needed. Seems fair to assign the copyright in that file to the patch author, not the original How should copyright be identified for the inbetweenies? What lines can be drawn? The tool I am using is insisting on attribution per file, so I have been assessing a "ratio of contribution" for original/patch authors and picking one. Is that a reasonable/fair/legal approach? Also: I have been applying the merger doctrine the context lines in a patch file (those lines around the actual change). Hence excluding them from "what ratio is original/patch?") and that tends to bias the ratio toward the patch author, not original author - is that fair?


In what types of programming environments is Reactive Management better than Proactive Management?

Most everyone seems to agree that Reactive Management is worse than Proactive Management; however, it seems that I am constantly seeing Reactive Management from development managers. Logic would suggest that there is some benefit to Reactive Management, since it is seen so often. I tend to see nothing but negative issues coming from this type of management, but I may be naive. In what sorts of programming environments/situations would Reactive Management be advantageous?


Collection interfaces in C#, coming from Java

In Java, I'm used to declaring collections using the most-abstract interface possible and then constructing them using the concrete implementation that makes sense at the time. It usually looks something like this:               public class MyStuff {         private Map<String, Address> customerAddresses;         private List<ToDoItem> tasks;         private Set<Person> people;              public MyStuff() {             customerAddresses = new HashMap<String, Address>();             tasks = new ArrayList<ToDoItem>();             people = new HashSet<Person>();         }     }      This allows me more flexibility to change a collection's implementation later when all I really depend on is the high-level interface (i.e. I need something to store key-value pairs, or something to store ordered data), and it's generally considered a standard "best practice" in Java. I'm just starting to program in C#, though, and I'm not sure if there's an equivalent practice for C#'s collections hierarchy. Collections in C# differ from collections in Java in several ways: `Collection` is a concrete type, the `ICollection` interface exposes similar methods to Java's `Set` while the `ISet` interface specifies a lot more features, and the key-set or value-set of a `Dictionary` is not an `ISet`, to name a few. Does it make sense to do something like this in C#?               public class MyStuff {         private IDictionary<String, Address> customerAddresses;         private IList<ToDoItem> tasks;         private ISet<Person> people;              public MyStuff() {             customerAddresses = new Dictionary<String, Address>();             tasks = new List<ToDoItem>();             people = new HashSet<Person>();         }     }      Or are there different "standard" interfaces and implementations to use for such collections? Should I be using `ICollection` and `Collection` in place of either the `Set` or the `List`? I'm tempted to use the C# classes and interfaces that "look closest" to the Java ones I'm used to, but I'd rather use the setup that better fits with C# paradigms and standards.


Why can't we program without compiling (using an IDE/debugger)?

I find it very interesting that even people who design a particular framework still have to rely on compiling to ensure the code is correct. I don't mean for 100s of lines of code, but 2-10 lines. I say this because they mention the code they wrote might not compile/work because it's untested. But why can't we write even the most basic code without relying on compiling? Is it because of the languages or the frameworks? Or is it because we have gotten used to using IDEs too much? I am not against doing this, but just wondering the reasons.


Good practices to implement mappers in a multi-tier application

When you are working with a multi-tier application very often you run into task of converting objects in one layer to objects in another layer. This could be converting database objects into domain objects, service objects into domain objects, domain object into view models, etc. I've seen it being done in multiple ways, those include:   1. In-line conversion   2. Creating a translator class with static helper methods   3. Using extension methods to simplify conversion   4. Overriding cast operators   5. Creating sepearate mapper classes for every possible translation   6. Utilizing solutions such as automapper What would be the "proper" way to handle it. The application I currently work with utilizes separate mapper class for every possible translation, and although it has benefits of testability we are using dependency injection and we have to pass all those mappers as dependencies in the constructor. Has anybody figured out a better way to do it? **UPDATE** I am using .NET stack here (EF +Business Layer + MVC)


Library design: provide a common header file or multiple headers

There are essentially two camps of library designers concerning the design of the final header file inclusion:   * Provide a single header file that includes every other header file that makes up the public API. For example, GTK+ dictates that only `gtk.h` shall be included. This does _not_ mean that everything is explicitly written into that common header file.   * Have the user include the header file whose functionality he is most interested in. The most prominent example would be the standard library where he has to include `stdio.h` for I/O, `string.h` for string manipulation etc., instead of a common `std.h` Is there a preferred way? libabc gives no advice on that matter, whereas an answer to a similar question suggests to keep them separated but does not specifies why.


Why does email sent from my site end up in SPAM folders?

I am developing a course registration website in Django. New users must confirm their email address by clicking on a link emailed to them. Unfortunately, this message is consistently ending up in people's spam folders. What steps can I take to prevent this from happening? Should I include an unsubscribe paragraph? Should I send less mass mail from my site (I occasionally send out a message to 500 emails.)?


Is there a correlation between the type of a company/industry and the software engineering rigor?

I would like the answer to explain what impact, if any, does the type of company/industry have on the rigor, depth and breadth with which software engineering is practiced. The best would be some links to support the answer with references. As a control point, let's declare an assumption that a company which follows the SWEBOK or CMMI (any level) is doing 100% (the best) whereas one which does not follow anything at all is 0% (worst). Would it be possible to find out what companies or what industries score highest, average, and lowest? **EDIT:** CMMI (any level) refers to any organization which is CMMI certified. **EDIT 2:** The middle paragraph specifies that a company which follows some rigorous software engineering standard should score higher than a company which doesn't. **EDIT 3:** The SWEBOK is not only organizing content. It does much more, i.e. the **SWEBOK characterizes the contents of software engineering body of knowledge**. The **SWEBOK promotes a consistent view of software engineering worldwide** which is the main point. It is aimed at both practitioners and academics, individuals and organizations. For example, see the CSDP and consider companies who hire them. These are the companies that follow the SWEBOK. **EDIT 4:** Note that the answer should tell us about industries or companies that follow some rigorous software engineering standard in the prescribed depth and breath, and those who don't. What is the correlation between the type of company/industry and their software engineering rigor? Throwing in a bunch of links for reference would be great.


Resources for small programming excercises

> **Possible Duplicate:**   >  Books or websites containing easy programming problems? Are there any resources that offer small programming exercises? I am looking for problems that are relatively small but taxing in some way or another. It would be nice if the problems focussed on specific areas of skill - i.e. algorithm, logic, problem solving, performance etc. So that they can be picked for purpose. I am looking for one program for every few days that I can use to better my programming skills. Also I am trying to learn tdd and these excesses will help me this too. I am struggling to think of problems every few days and would prefer exercises that are known to push specific programming skills forward.


Wrapping Primitives to Enable Returning null -- Bad Practice?

I am frequently tempted to wrap integers, etc, solely for the purpose of writing methods that can return `null`. Negative 1 can work in many cases, but too often (especially in sound) it's a valid return value. Often, to get around this, I am returning a reference to a larger object that contains the primitive in question and calling a getter. This seems less efficient than the wrapper, and in some cases less encapsulating. So, are there any penalties with wrapping for this reason? Does anybody do this? Does this smell?


Is Factory method subclass of Abstract factory in essence

Is it correct to say that factory method is essentially just a particular case of the abstract factory which produces the only one object not a group? I know that classic realizations assumes the architectural differences, but the point of a pattern is not only a concrete realization but a conceptual abstraction, isn't it?


Why can't the Factory Method pattern create a family of objects?

There are two main differences between the design patterns Factory Method and Abstract Factory. Difference 1 is that Factory Method is mainly based on inheritance. A class in a way uses it's subclass to create objects. The objects created depend on the subclass used. While Abstract Factory is based on inheritance but in a way also on composition - A client 'owns' an Abstract Factory instance to hold a concrete factory. Difference 2 is that Factory Method creates one object, while Abstract Factory creates a family of related objects. Difference 1 I understand (although I'm having trouble understanding why anyone would prefer to subclass a class that needs a factory instead of just 'giving' it a factory using composition [unless that class already has a subclass]). But difference 2 I don't understand. Why can't Factory Method create a family of products instead of one product? It can certainly return an array of products of the same family. All of these products share a common interface - the method can return an array of that type. Why is it said that this method only produces one product? Additionally, a factory method inside a concrete subclass of an abstract factory creates different products using different methods that are called by the client. Why can't a concrete factory in the Factory Method pattern do the same? Have different factory methods for different products?


Why we should build with the highest warning level in .NET?

I heard that we have to build with the highhest warning level. **Is it true? why?** And **how to change default .NET warning level?**