Is there ever a reasonable time to have test fixtures test MVC3 controller construction?

I've recently started with a new firm and I'm trying to understand the mechanics behind something, so I'll anonymize the code and present but a sample:               [Test(Description = "Retreives the New view for XXXX.")]     public void New()     {       "~/XXXX/New".ShouldMapTo<XXXXController>(x => x.New());       "~/XXXX/New".WithMethod(HttpVerbs.Post).ShouldMapTo<XXXXController>(x => x.New(null));     }      and again:               [Test(Description = "Test the model injection into the New view.")]     public void New()     {       var @new = WXYZController.New();       @new.AssertViewRendered();            Assert.IsInstanceOf<WXYZSettingsModel>(@new.ViewData.Model, "Expected the data model to be of type WXYZSettingsModel, but the model was another type.");       var model = @new.ViewData.Model as WXYZSettingsModel;       if (model == null)         Assert.Fail("Failed to cast data model to type WXYZSettingsModel.");              Assert.IsNotNull(model.YYYY, "Expected an instantiated service message, but a null message was returned.");         Assert.AreEqual(model.YYYY.Status, WXYZ.Success, "Expected a success status code, but another code was returned.");         Assert.IsNotNull(model.Categories, "");         Assert.AreEqual(model.ZZZZ.Status, ABCD.Success, "Expected a success status code, but another code was returned.");     }      It seems to me this violates the purpose of unit-testing, as you should never unit-test the framework, but rather, your own code, right? Did someone just get carried away? Or am I missing some fundamental component of this code that is just obvious to someone who is more familiar with unit testing. Note that there are entire files (one of each of the above per controller) that never test a single line of internal code, but are filled with these tests. Even to the point of this is fairly boilerplate now that I've anonymized it. If we were instead testing like this (pseudocode now)               [Test(Description = "thingy tester, duh")]     public void ThingTest(){       var mock = new MyDataMock();       var finalMock = new MyFinalMock();       var controller = new thingController();            var test = controller.Thing(mock);       assert.AreNotEqual(test,mock,"It didn't change it");       assert.AreEqual(test,finalMock,"It worked!");     }      I would expect that to be what the unit tests I should see should look like, no?


Which Ext JS license should be acquired (when developing a Spring MVC/Hibernate/Ext JS web application)?

I am inquiring about a web app which uses _Spring MVC_ and hibernate on the server and _ExtJS 4_ (Sencha JavaScript framework) for the client framework (widgets). The app is cloud-hosted - it is not "distributed" to users. It is required that users of the app shall need to purchase a license from the vendor in order to use it. I am completely new to software licensing and am not sure which ExtJS license is required/preferable, i.e the commercial license or the GNU GPL license? I have a few questions to hopefully help clarify:   1. Is it possible to use the GPL license or similar allowing only part of the app's source to be distributable, e.g. the Extjs components, but not allow users to see other components of the system? i.e. the _Spring MVC_ , hibernate server components? Is it possible to restrict access to the _ExtJS_ source if using a GPL license? In general is it possible to restrict distribution of some aspects of the source when using GPL?   2. If the GPL license is acquired, is the source available only to users of the system or is it open to the whole general public?


Identity Design ASP.NET

I am trying to design a system with the below features, and am currently trying to figure out best way to handle Identity :   1. There will be multiple decoupled parts of the system, with same customers accessing various parts    2. I would like users organized by organizations/companies, i.e. user1 & user2 belong to ORG1   3. I would like additional info to be stored within a user profile, info will originate from various systems, as well as global info such as address, etc   4. For roles I haven't yet decided whether or not they will be handled by individual apps or globally and specialized in certain apps  My conundrum is whether to use the new MVC Identity released in ASP.NET Beta currently out, or use WIF or Active Directory. I am assuming that a centralized application handling users & their associated admin tasks and then federating to other applications is best. If I understand correctly any of the 3 are able to do that. What I am wondering is which to use to be most flexible. Basically something that can be expanded later and doesn't have a huge learning curve, possibly to mobile & api use. I don't know enough about WIF or AD as I have never really used them, and ASP.NET Identity is still in beta and not really 100% documented. My experience with authentication systems is working with ones out of the box. I've never really had to deal with SSO or federation One thing I wanted to add is there is no need for outside registration. Registration will be handled purely by admins, not sure if this ties in at all, but thought it may be of importance


How to calculate throughput if there is network traffic

I came across this question in a textbook, but there are no solutions and I'm not sure how to solve this. The question is: Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has three links of rates R1=500Kb/s, R2=2Mb/s and R3=1Mb/s. Assuming that there is another busy flow that travels through the same set of links (say from Host C to Host D), what will be the throughput for this file transfer? I know that the throughput for no traffic would be the min(R1, R2, R3), so would the throughput with traffic be the max(R1, R2, R3)?


Random Cache Expiry

I've been experimenting with random cache expiry times to avoid situations where an individual request forces multiple things to update at once. For example, a web page might include five different components. If each is set to time out in 30 minutes, the user will have a long wait time every 30 minutes. So instead, you set them all to a random time between 15 and 45 minutes to make it likely at most only one component will reload for any given page load. I'm trying to find any research or guidelines on this topic, e.g. optimal variance parameters. I do recall seeing one article about how Google (?) uses this technique, but can't locate it, and there doesn't seem to be much written about the topic.


Difference between event loop and system calls/interrupts

When you create programs (like a socket server) that are designed to run on an operating system, such as Ubuntu, frameworks like Qt for C++ use something called a main event loop:               app = new QCoreApplication(argc, argv);     int rc = app->exec()      Now programming language like C or C++ enable a program to make system calls through built-in functions, like fork() or pthread_create() and use software interrupts to change kernel mode. For example, the program can request use of the kernel by means of a system call in order to perform privileged instructions, such as process creation or input/output operations. Other examples are open, read, write, close, wait, execve, fork, exit, and kill. All this can be achieved within C/C++ directly without an event loop. So what's the purpose of the event loop?


Merits of Namepsaces/Packages

Some programming languages (e.g. Java and C++) have language features called "packages" or "namespaces". How useful is it really to have namespaces? It is possible to mark functions and classes as belonging to some particular library without using such a language feature, like the SDL does (e.g. `SDL_BlitSurface()`). Are namespaces not helpful enough to be worth having? Are they useful in libraries but not in applications? Are they useful everywhere except for in small projects? Thoughts?


Javascript Form Validation

When validating a JavaScript form, would it be better to process each input field individually, or, where possible check collectively? e.g.               validate()     {          noblanks()          fieldOne()          fieldTwo()     }      or               validate()     {          fieldOne()          fieldTwo()


What is the use of Association, Aggregation and Composition (Encapsulation) in Classes

I have gone through lots of theories about what is encapsulation and the three techniques of implementing it, which are Association, Aggregation and Composition. What i found is, ## Encapsulation Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding. Encapsulation can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface. The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this feature Encapsulation gives maintainability, flexibility and extensibility to our code. ## Association Association is a relationship where all object have their own lifecycle and there is no owner. Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently. ## Aggregation Aggregation is a specialize form of Association where all object have their own lifecycle but there is ownership and child object can not belongs to another parent object. Let’s take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about “has-a” relationship. ## Composition Composition is again specialize form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object dose not have their lifecycle and if parent object deletes all child object will also be deleted. Let’s take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete. **The question is:** Now these all are real world examples. I am looking for some description about how to use these techniques in actual class code. I mean _what is the point for using three different techniques for encapsulation_ , _How these techniques could be implemented_ and _How to choose which technique is applicable at time._


Before you develop a web app, how much of a spec do you need?

If you were to accept a role as a full time web app developer responsible for creating a new application from scratch, how much of a defined specification and design would need and/or expect to start development? What tools/software is even used for this (for web apps built with something like RoR)? I would expect a mockup/wireframe to be required, but what else is done in the design stage? What is the best method or process to convey the functionality of the application so that developers know what to translate into code. I'm interested to hear from web app developers who have thought: "If I only had <this>, I could develop this so much quicker/easier/cleaner", or "I have no idea what this customer wants unless they document it in <thing>." I'm not trying to start a philosophical debate, I am curious from the developers' perspective what is the "right" way to design web apps from scratch. There is probably a book somewhere that someone can tell me to RTFM, but I've only been able to find resources on learning actual coding and development, not the design phase.


Advantages of Hudson and Sonar over manual process or homegrown scripts

My coworker and I recently got into a debate over a proposed plan at our workplace. We've more or less finished transitioning our Java codebase into one managed and built with Maven. Now, I'd like for us to integrate with Hudson and Sonar or something similar. My reasons for this are that it'll provide a 'zero-click' build step to provide testers with new experimental builds, that it will let us deploy applications to a server more easily, that tools such as Sonar will provide us with well-needed metrics on code coverage, Javadoc, package dependencies and the like. He thinks that the overhead of getting up to speed with two new frameworks is unacceptable, and that we should simply double down on documentation and create our own scripts for deployment. Since we plan on some aggressive rewrites to pay down the technical debt previous developers incurred (gratuitous use of Java's Serializable interface as a file storage mechanism that has predictably bit us in the ass) he argues that we can document as we go, and that we'll end up changing a large swath of code in the process anyways. I contend that having accurate metrics that Sonar (or fill in your favorite similar tool) provide gives us a good place to start for any refactoring efforts, not to mention general maintenance -- after all, knowing which classes are the most poorly documented, even if it's just a starting point, is better than seat-of-the-pants guessing. Am I wrong, and trying to introduce more overhead than we really need? Some more background: an alumni of our company is working at a Navy research lab now and suggested these two tools in particular as one they've had great success with using. My coworker and I have also had our share of friendly disagreements before -- he's more of the "CLI for all, compiles Gentoo in his spare time and uses Git" and I'm more of a "Give me an intuitive GUI, plays with XNA and is fine with SVN" type, so there's definitely _some_ element of culture clash here.


Treating a 1D data structure as 2D grid

Hopefully this is a good question. I am working with a native class that represents a 2D image as a 1D array. If you want to change one pixel, for example, you need to now how to derive the index from the `x,y` coordinates. And I am trying to grok, in abstract terms, how to map a multidimensional object to its underlying unidimensional representation. So, let's say we have a 1D array `array1d` like this:               array1d = [ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y ]      In the context of our program, `array1d` represents a 2D grid:               a b c d e     f g h i j     k l m n o     p q r s t     u v w x y      And we want to perform operations on `array1d` such as:   * Get the value at `x,y` coordinates (in this example, `1,2` would give `l`)   * Get any sub-grid using `x,y,width,height` (`1,2,2,2` would give `[l, m, q, r]`)   * Set the value at any `x,y` coordinate (etc.) Is there a computer science-related or mathematical term for said operations, which map points/regions in 1D data to coordinates in 2D/3D/4D... objects? If so, what is it? Clearly all computers with displays solve this same issue, so what is this fundamental problem called and how is it conventionally solved?


For PL/SQL, do large companies prefer ANSI SQL joins or old Oracle joins?

I am interviewing for a PL/SQL position with a large corporation. I will have to write a multiple choice exam. I am wondering whether the exam will likely use old-style joins (joining happens in the 'WHERE' clause) or ANSI ones. My apologies if this is not the correct forum for this question.


Should I update this code or continue with current design

I am working with ASP.NET Application. The application is great and works fine but it a few flaws. To give you an example,   1. Every control uses an absolute position layout. This makes working with code very difficult in design mode. Absolute position has been used more than 700 times in the code.   2. There are different menus uses instead of one. And to stitch them together, again absolute position is used for each menu control   3. The application is role based. All the roles are implemented using Roles.IsUserInRole property. I would like to use proper permission for every role with page level permission.   4. There are a few security risk in the current code but that is easy fix in current program though.   5. There is no true admin. The top level role act as admin which is also a functional role, used by other members. Now that we are adding new functionality to this code and I mean adding some big functionality, what do you recommend. Should I rewrite this code or work in the existing. I would esp like to fix   1. The layout issues. Remove all fixed positions and make the code clean and easy to maintain.   2. Unfortunately to do so I have to rewrite the menu. Because I want to write one menu instead of 4 being used.   3. In order to achieve point 2 above, I have to crete new roles and provide proper security for the application. My question is **Should I work with the current code or rewrite the existing code keeping in mind that our company is growing and that it may take me 2-4 weeks to do rewrite up.** Would it be bad idea or a good one. I don't have a technical lead in my company.


Good design pattern for a c++ wrapper around a c object

I have written an extensible c++ wrapper around a very hard to use but also very useful c library. The goal is to have the convience of c++ for allocating the object, exposing its properties, deallocating the object, copy semantics etc... The problem is this: sometimes the c library wants the underlying object (a pointer to the object), and the class destructor should not destroy the underlying memory. While most of the time, the destructor should deallocate the underlying object. I have experimented with setting a `bool hasOwnership` flag in the class so that the destructor, assignment operator, etc... will know whether or not it should free the underlying memory or not. However, this is cumbersome for the user, and also, sometimes there is no way to know when another process will be using that memory. Currently, I have it setup where when the assignment comes from a pointer of the same type as the underlying type, then I set the hasOwnership flag. I do the same when the overloaded constructor is called using the pointer from the c library. Yet, this still does not handle the case when the user has created the object and passed it to one of my functions which calls the c_api and the library stores the pointer for later use. If they were to delete their object, then it would no doubt cause a segfault in the c library. Is there a design pattern that would simplify this process? Maybe some sort of reference counting?


Why would I use Control.Exception in Haskell?

I'm trying to really master Haskell error handling, and I've gotten to the point where I don't understand why I would use Control.Exception instead of Control.Monad.Error. The way I can see it, I can catch Control.Monad.Error exceptions in both pure and impure contexts. By contrast, exceptions defined in Control.Exception can be caught only in impure/IO contexts. Given that they provide two separate interfaces and semantics that I would need to memorize, under what circumstances would I need Control.Exception instead of Control.Monad.Error?


Offshoring: does it ever work?

I know there has been a fair amount of discussion on here about outsourcing/offshoring, and the general opinion seems to be that at best it is difficult, and at worst it fails. I have direct experience of offshoring myself; a previous company, where I was a development manager, wanted to send some development offshore, and we ran a pilot scheme to see how well it would work. Of course, it was a complete failure, although it is not completely clear to me whether this was down to the offshore developers being less talented, the process, or other factors (no doubt it was really a combination). I can see as a business how offshoring _looks_ attractive (much lower day rate), but as far as I can see, the only way it could _possibly_ work is if you do _exceptionally detailed_ design up front, with _incredibly detailed_ specifications; and by the time you have invested in producing that, you have probably spent as nearly as much as if you had written the actual code locally (which I think is an instance of No Silver Bullet). So, what I want to know is, does anyone here have any experience of offshoring actually working _ever_? Especially if there are any success stories of it working in a semi-agile way? I know there are developers here from all over the World; has anyone worked on an offshore project they consider successful?


How to work with new director with different ideals?

### Background Over the past 2 years, we have built us a decent team of developers. The CEO of the company and myself have been working closing to make sure we are moving done a good path. As our department as grown, I've been telling the owner we need a manager/director over us that understands technology, but can lead the company on more of the business aspects of running an interactive development shop. He's gone out and done just that, I didn't get to meet the man before his first day, but quickly got his CV. He had owned a company in the late 90's that was bought out and has been working as a consultant since then. Most of his knowledge was in large corporate systems. We build web applications and sites for medium sized companies. And that is where the issues are starting to crop up. He's brought up on several occasions our need to switch to Flash, Oracle and J++ for the sites and applications we are building. Versus the LAMP stack we are using now for 90% of our development. The new guy is very smart when it comes to the business side of technical projects, but he is trying to lead the technical direction. And he and I aren't seeing eye-to-eye for a couple of upcoming projects. ### Question Now, I don't want to go into the issues with those comments. I want to ask how I, as the Senior Developer, can work with our new Director to ensure the success of our department within this company. While also keeping our developers happy, and working with the technologies that we enjoy, and are comfortable with.


Usage of Pirated software at a company

I started to work at a company as an engineer a couple of months ago. It's a small company and what they basically do is answering service on phones. Now they are switching from normal phones to IP phones so that computers take more important place in the work. However, all the computers used by workers are equipped with pirated software, including their operating systems. Moreover, they didn't even buy one license to make copies for other computers. In other words, they did not spend any money for the software in office. I am not saying copying a licensed one is legit, but the situation is too much. There is one guy who installed the pirated software. He does not feel any sense of guilt and even justified when I asked about it. He is not even a specialist. He just searched on the internet to install pirated software. Our boss does not have any knowledge of computers, so he took the cheaper way. What do you think about this? Since I am still new to the company, I am not doing maintenance on those cracked computers. But I have to use those software daily. And later on I will be doing support, help desk kind of stuff. I really don't want to take responsibility for operating pirated software. From an aspect of developer and engineer, pirated software is not able to get legal support and it may work unexpectedly. So, I am thinking about changing jobs. Am I thinking too much? Should I wait until I have more credibility with the boss and try to change his policy? So far, the boss does not take any words from me. Any opinions are welcome. Thank you


Should APIs be in en_US or en_GB or both?

Should I write APIs in US spelling or British spelling? Or should I provide with mapping both of them to a single one and internally using anyone which I like so that both of them works ? At present most of the APIs are with US spelling. What is the solution for it? edit: Is there a way to standardize this. May be support both?


What do you suggest for cross platform apps, including web

I have always preferred cross platform development over most other concepts as long as I can remember. Which is one of the reason I never got into .Net. Currently, I use php/javascript/python as my primary languages of choice for web development. Which I also have been using at work. But the need to learn c# has come up and one of the windows guys has been teaching me c#, so I am still very new. I have really liked the language. I have also been brainstorming on an app that I have been wanting to make for some time and have not determined the best way to build it. The main system will be online where users can log in and do everything. But I also want to make a desktop client that ties into and syncs the users content with the server (considering using couchdb for my particular use case for this app). They should be able to do everything the web app can. I would like to launch to linux, windows, and mac as well as make mobile versions. In learning c#, my co-worked recommended I look at Mono, so I can use .Net as a cross platform system and even possibly use asp.net for the main site. So I am hoping to get some insight on where I could go. It seems as if I used .net with mono, I could reuse a lot of code for web and mobile using monodroid/monotouch. But then how could this setup compare to using something like sencha touch for making a mobile version and node.js for the server side (am fairly proficient with JS and php already, I just need to learn c#/.net for work and would like to learn it more anyways). Or is there anything else I should consider? I'm not really asking which method is better, I just want to know what options I have, which I could then make a calculated decision based on my needs and further research. Such as what features would the .net/mono route have that I would not in sencha/node.js, and vice versa (node.js is awesome at real time uset to user interaction, for example) I am just looking for some insight and advice, and help woudl be greatly appreciated.


Inline functions in C++. What's the point?

According to what I read, the compiler is not obliged to substitute the function call of an inline function with its body, but will do so if it can. This got me thinking- why do we have the inline word if that is the case? Why not make all function inline functions by default and let the compiler figure out if it can substitute the calls with the function body or not?


What are the advantages and disadvantages of using Resharper Annotations?

A new colleague has mooted the idea of using **Resharper annotations** within our code base (we already are great fans and users of Resharper). My new colleague cites things like explicitly stating whether a parameter can be null or not null at coding time is a good thing so that consumers of that class can see warnings at coding time. My reservation is it adds noise to the code, is not runtime executed hence I favour Guard clauses. I am also concerned that like comments that they can go stale. I am also concerned about code readability and the overhead of writing them in the first place. Ultimately I am trying to keep development lean so don't want to add overhead for relatively little gain. Finally it feels wrong decorating code for one vendor's tooling support. What are your thoughts? Good/bad experiences?


What causes floating point rounding errors?

I am aware that floating point arithmetic has precision problems. I usually overcome them by switching to a fixed decimal representation of the number, or simply by neglecting the error. However, I do not know what are the causes of this inaccuracy. Why are there so many rounding issues with float numbers?


What's so bad about creative coding?

I was watching Bob Ross paint some "happy trees" tonight, and I've figured out what's been stressing me out about my code lately. The community of folks here and on Stack Overflow seem to reject any whiff of imperfection. My goal is to write respectable (and therefore maintainable and functioning) code, by improving my skills. Yet, I code creatively. Let me explain what I mean by "coding creatively":   * My first steps in a project are often to sit down and bash out some code. For bigger things, I plan a bit out here and there, but mostly I just dive in.   * I don't diagram any of my classes, unless I'm working with others who are creating other pieces in the project. Even then, it certainly isn't the first thing I do. I don't typically work on huge projects, and I don't find the visual very useful.   * The first round of code I write will get rewritten many, many times as I test, simplify, redo, and transform the original hack into something reusable, logical, and efficient. During this process, I am always cleaning. I remove unused code, and comment anything that isn't obvious. I test constantly. **My process seems to go against the grain of what is acceptable in the professional developer community, and I would like to understand why.** I know that most of the griping about bad code is that someone got stuck with a former employee's mess, and it cost a lot of time and money to fix. That I understand. What I don't understand is how my process is wrong, given that the end result is similar to what you would get with planning everything from the start. (Or at least, that's what I have found.) My anxiety over the issue has been so bad lately that I have stopped coding until I know everything there is about every method for solving the particular problem I am working on. In other words, I have mostly stopped coding altogether. I sincerely appreciate your input, no matter what your opinions are on the issue. **Edit:** Thank you all for your answers. I have learned something from each of them. You have all been most helpful.


best hosting structure to sell your app on a website

I'm considering trying to sell a small desktop application (I would be considered a one-man mISV, I guess?) at a price of about $20-$30 USD. I would distribute to customers by download only. I get the sense the best and most intuitive way to do this is provide a download link from the application's website. What are the best ways to go about this? Should I create a website with a standard web hosting provider (like, e.g. DreamHost) and use that to allow customers to download it (it's 18MB or so in size)? I want to allow for the possibility that many people may attempt to download it at once (if I were able to get a write-up on some very widely-read sites), and I would not want my provider to not be able to handle that, since that would be THE crucial sales period. I'd also like to keep costs of hosting/serving as low as possible, since I'm not sure I am going to make any money selling this at all. I'd also like to keep things relatively simple.


Removing occurrences of characters in a string

I am reading this book, programming Interviews exposed by John Wiley and sons and in chapter 6 they are discussing removing all instances of characters in a src string using a removal string... so `removeChars(string str, string remove)` In there writeup they sey the steps to accomplish this are to have a boolean lookup array with all values initially set to false, then loop through each character in `remove` setting the corresponding value in the lookup array to true (note: this could also be a hash if the possible character set where huge like Unicode-16 or something like that or if str and remove are both relatively small... < 100 characters I suppose). You then iterate through the str with a source and destination index, copying each character only if its corresponding value in the lookup array is false... Which makes sense... I don't understand the code that they use however... They have               for(src = 0; src < len; ++src){        flags[r[src]] == true;     }      which is turning the flag value at the remove string indexed at src to true... so if you start out with `PLEASE HELP` as your str and `LEA` as your remove you will be setting in your flag table at `0,1,2... t|t|t` but after that you will get an out of bounds exception because r doesn't have have anything greater than 2 in it... even using there example you get an out of bounds exception... Am is there code example unworkable? **Entire function**               string removeChars( string str, string remove ){        char[] s = str.toCharArray();        char[] r = remove.toCharArray();        bool[] flags = new bool[128]; // assumes ASCII!        int len = s.Length;        int src, dst;        // Set flags for characters to be removed        for( src = 0; src < len; ++src ){           flags[r[src]] = true;         }             src = 0;        dst = 0;        // Now loop through all the characters,        // copying only if they aren’t flagged        while( src < len ){            if( !flags[ (int)s[src] ] ){            s[dst++] = s[src];        }        ++src;        }        return new string( s, 0, dst );     }      as you can see, r comes from the remove string. So in my example the remove string has only a size of 3 while my str string has a size of 11. len is equal to the length of the str string. So it would be 11. How can I loop through the r string since it is only size 3? I haven't compiled the code so I can loop through it, but just looking at it I know it won't work. I am thinking they wanted to loop through the r string... in other words they got the length of the wrong string here.


What are the biggest bottlenecks when developing large projects?

Let's say that my company was to develop a replica of MS Word (just as an example). What would be the bottleneck to the development process, assuming that one has infinite cash available and an organization like Microsoft? In other words, what are the most usual hindrances from developing such software fast? Let's assume that all specifications are in place and the organization is working perfectly, so we just focus on the software development until the product is ready to be shipped. Some alternatives might be: \- Writing the code \- Writing tests \- Manually testing the end product \- Rewriting the code due to poor design in the first place \- Designing the code \- Code review done by experienced developers \- Designing GUI \- Redesigning GUI based on alpha/beta-user feedback \- Processing feedback from users \- Waiting for alpha/beta-user feedback Please use references in your answer or state your experience on the subject.


Is there a known algorithm for scheduling tournament matchups?

Just wondering if there is a tournament scheduling algorithm already out there that I could use or even adapt slightly. Here are my requirements:   * A variable number of opponents belonging to a variable number of teams/clubs each must be paired with an opponent   * Two opponents cannot be from the same club   * If there are an odd number of players, 1 of them randomly is selected to get a bye Any algorithms related to this sort of requirement set would be appreciated. **EDIT:** I only need to run this a maximum of one time, creating matchups for the first 'round' of the tournament.


Being a good mentee - a protégé

The complement of the Being a good mentor question. I work with many very senior people that have vast amounts of knowledge and wisdom in Software, Engineering and our business domain. What are some tips for gaining as much knowledge from them? I don't want to take up too much of their time, but also want to take full advantage of this since it really could help develop my skills. What are some good questions to get the conversation rolling in a sit down mentor/mentee session? Some of the people providing mentorship have little experience in this area, so it would help to be able to lead some of these discussions.


Right options for the Creative Commons license for the theme

First I am not so much expert with the license terms and system but have some basic knowledge. I have been developing theme for one of the Open Source PHP script since two versions. It has been package included with GPLv3 till now. Currently, I am working on new version and now ready to release alpha version. But before I release it, I just want to change the license to Creative Commons. This is just to prevent a bit the copyright/credits notes. I want to allow user to modify, alter the theme and they can redistribute. But they must contains the original copyright and credit notes and the license. I am not sure either I can release new version under CC license and if yes what will be the best option for it. Also will just a logo (not with entire description) will consider the same rights?


How to store satellite data in C data structutres

I've been reading through Introduction To Algorithms 3rd Ed, and am really enjoying the material; however, I am having difficulty in implementing some practical situations. It's not the theory, or implementing the internals of the data structures themselves, but rather how to design a good interface that makes the data structures useful for storing real data (as opposed to just the keys). Specifically, I'm told that C has a very "trust the programmer" type philosophy. I just don't know how much trust is too much trust .. As an example, many data structures can be implemented as linked structures with similar nodes having a key, satellite data, and pointers to other nodes in the ds, ex:               typedef struct {         int key;         void *data;         node_t *prev;         node_t *next;     } node_t;      Q1. To what extent should I be encapsulating my implementations? For most structures, you have both: (a) a data structure type, and (b) a type that can be inserted/deleted from the data structure. Should they both be hidden? Clearly if I expose a some `node_t` with the intention someone only alters `key` and `*data`.. theres the possibility `prev` or `next` is altered, thus destroying the data structure. A similar risk exists if I expose the data structure type and someone messes around with the root.. Q2. How should the keys be stored/accessed/compared? Presumably, the keys depend on the satellite data, but if you go the approach as above, you've decoupled the key from the data itself. What would happen if a user updates the data but forgets to update the key (or worse, they update the key, but don't remove/reinsert it into the ds)? For something like a binary tree which uses only comparisons, I could design the interface to accept comparators that accept pointers to the satellite data? This makes the structure more generalized, but all the defreferencing has to have an impact on speed. Alternatively, (and would be needed for structures like hashes which need a concrete key), I could accept a pointer to a `int toKey(void *data)`function.. I'm relatively new to C (and designing software) and am unclear on how good software should be designed for use in the real world..


Visually and audibly unambiguous subset of the Latin alphabet?

Imagine you give someone a card with the code "5SBDO0" on it. In some fonts, the letter "S" is difficult to visually distinguish from the number five, (as with number zero and letter "O"). Reading the code out loud, it might be difficult to distinguish "B" from "D", necessitating saying "B as in boy," "D as in dog," or using a "phonetic alphabet" instead. What's the biggest subset of letters and numbers that will, in most cases, both look unambiguous visually and sound unambiguous when read aloud? * * * Background: We want to generate a short string that can encode as many values as possible while still being easy to communicate. Imagine you have a 6-character string, "123456". In base 10 this can encode **10** ^6 values. In hex "1B23DF" you can encode **16** ^6 values in the same number of characters, but this can sound ambiguous when read aloud. ("B" vs. "D") Likewise for any string of N characters, you get (size of alphabet)^N values. The string is limited to a length of about six characters, due to wanting to fit easily within the capacity of human working memory capacity. Thus to find the max number of values we can encode, we need to find that largest unambiguous set of letters/numbers. There's no reason we can't consider the letters G-Z, and some common punctuation, but I don't want to have to go manually pairwise compare "does G sound like A?", "does G sound like B?", "does G sound like C" myself. As we know this would be O(n^2) linguistic work to do =)...


Declarative programming vs. Imperative programming

I feel very comfortable with Imperative programming. I never have trouble expressing algorithmically what I want the computer to do once I figured out what is it that I want it to do. But when it comes to languages like SQL or I often get stuck because my head is too used to Imperative programming. For example, suppose you have the relations band(bandName, bandCountry), venue(venueName, venueCountry), plays(bandName, venueName), and I want to write a query that says: all venueNames such that for every bandCountry there's a band from that country that plays in venue of that name. **EDIT (due to answers): in other words, I want all the venueNames in which bands from _all_ countries (bandCountry) played. Also, by "relation" I mean an SQL table.** In my mind I immediately go "for each venueName iterate over all the bandCountries and for each bandCountry get the list of bands that come from it. If none of them play in venueName, go to next venueName. Else, at the end of the bandCountries iteration add venueName to the set of good venueNames". ...but you can't talk like that in SQL and I actually need to think about how to formulate this, with the intuitive Imperative solution constantly nagging in the back of my head. Did anybody else had this problem? How did you overcome this? Did you figured out a paradigm shift? Made a map from Imperative concepts to SQL concepts to translate Imperative solutions into Declarative ones? Read a good book? PS I'm not looking for a solution to the above query, I did solve it.


Programmer aptitude test

I have many friends that see what I do, find it interesting and ask me the question               Do you think I could be a programmer?      My response is               ...   ummm  ...  do you like math?      I'd like to have a helpful response, so I didn't know if anyone knew of a fairly decent aptitude test for someone that would be starting from square one, but has critical thinking and problem solving skills?


Vulnerabilities and employability

I am a web developer. If I find a vulnerability in a prospective employer's website and notify them of it at the same as I send my (unsolicited) application, am I more likely to get the job? Less likely? Why?


Ways to find a tutor for 1st year University student

I tried searching here (and SO) without much luck. I also stared at the yellow box to the right and think this question is relatively on topic and can be answered. A co-worker asked me if I had any suggestions for how to find a tutor for his son. In this specific case, it was for Eclipse and Java, but it got me thinking about good general strategies one could use in situations like this. He preferred a local 1-to-1, but I suppose online might be a reasonable (or perhaps more likely) alternative. Any suggested strategies?


How to handle growing QA reporting requirements?

**Some Background:** Our company is growing very quickly - in 3 years we've tripled in size and there are no signs of stopping any time soon. Our marketing department has expanded and our IT requirements have as well. When I first arrived everything was managed in Dreamweaver and Excel spreadsheets and we've worked hard to implement bug tracking, version control, continuous integration, and multi- stage deployment. It's been a long hard road, and now we need to get more organized. **The Problem at Hand:** Management would like to track, per-developer, who is generating the most issues at the QA stage (post unit testing, regression, and post-production issues specifically). This becomes a fine balance because many issues can't be reported granularly (e.g. per-url or per-"page") but yet that's how Management would like reporting to be broken down. Further, severity has to be taken into account. We have drafted standards for each of these areas specific to our environment. Developers don't want to be nicked for 100+ instances of an issue if it was a problem with an include or inheritance... I had a suggestion to "score" bugs based on severity... but nobody likes that. We can't enter issues for every individual module affected by a global issue. **[UPDATED] The Actual Questions:** How do medium sized businesses and code shops handle bug tracking, reporting, and providing useful metrics to management? What kinds of KPIs are better metrics for employee performance? What is the most common way to provide per- developer reporting as far as time-to-close, reopens, etc.? Do large enterprises ignore the efforts of the individuals and rather focus on the team? Some other questions:   * Is this too granular of reporting?   * Is this considered 'blame culture'?   * If you were the developer working in this environment, what would _you_ define as a measureable goal for this year to track your progress, with the reward of achieving the goal a bonus?


Does it make sense to compute cyclomatic complexity/lines of code ratio?

In general, maintainability index relies on many factors. For example, in Visual Studio, it rely on cyclomatic complexity, depth of inheritance, class coupling and lines of code; those four values must be as low as possible. At the same time, I've never seen, neither in code metrics tools, nor in books, the comparison between only cyclomatic complexity (CC) and lines of code (LC). Does it make sense to compute such ratio? What information does it give about the code? In other words, is it better to decrease more the CC than the LC to have a lower ratio? What I notice is that for small projects, the ratio CC/LC is low (⅓ and lower). In other words, LC is high, and CC is low. In large projects, CC/LC is in most cases bigger than ½. Why?


How Do You Test Your Software?

I'm currently working on 2 software projects:   1. A Social Networking Web Site for an NGO   2. A Patient Management System for a hospital Although I've been programming for 5 years, I can't just say that I'm very good at testing or Test Driven Designing an application. How would you arrange your Software Testing before coding phase, during coding and after you finished the coding phase for   * a. providing stakeholders with information about the quality of the product or service under test.   * b. providing an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.  and how do you understand that your program/application/product   * c. meets the business and technical requirements that guided its design and development   * d. works as expected p.s. please feel free to edit the question since my english is not very powerful.


How do I improve my skills as a Qt GUI programmer?

I'm a python & Qt programmer and my day job is create small GUI programs to ship with hardware devices. However, my job is pretty basic: read/write data to the device through a serial port using pyserial, and display and edit data using PyQt and PyQwt. Because of how basic this job is, I'm not confident there's a lot of job security here. What can I do to improve my skills in this area?


What is the most secure way to "Grandfather In" existing users of a paid iOS app that will go free?

The title pretty much says it all, but I can elaborate. I have a paid iOS app that has plenty of existing customers. I think i want to convert to a free app now, and allow full upgrade via in-app-purchase. The problem is, I don't want to make my existing customers buy the app again to use it, nor do I want to make it easy for hackers to just flip a switch and get the pro version. What is the **most secure** way to "Grandfather In" existing users of a paid iOS app that will go free?


How to resolve methods with the same name and parameter types?

In many cases, I want to write methods that have the same functionality for different types of inputs. This is easily accomplished by method overloading if the parameter types are different. But what's the best (most robust) way to go about resolving the case when the parameter types are the same (i.e. two different representations of the data with the same type)? An example of this would be an integer matrix which can naturally be stored as an `int[][]`. But what if you want to write a method which accepts the transpose of the matrix as well? The transpose is also an `int[][]` but a clearly different representation altogether. I can see a couple ways of doing this:   * Giving the methods different names   * Adding a flag to the method   * Wrapping each representations in different classes I think the third method is the most clear way of doing this. Unfortunately I'm working on some high performance libraries where that's not a feasible solution.


Is it called an instance in Javascript?

Say I have a function.               function foo(){         //do stuff     }      And then I create an object of that function.               var fooObj = new foo();      What is `fooObj` called? An instance, An object instance, or something else entirely? Pardon the newbie question, but I am rather new to prototype based programming(and all programming really).


Best way to convincingly evangelize front end best practices to colleagues?

I've had experiences in the past working with (traditionally back-end) developers, whose occasionally cross into the front end realm. The resulting code would typically involve:   * global namespace pollution (many many global functions included inline without flexibility or re-use in mind)   * many one-off implementations of functionality which is already supported, or may be more easily implemented with the assistance of an already-included library (raw JS implementations of AJAX/DOM-related functionality)   * mass groupings of inline styles As a (relatively) seasoned front end professional, I've had some success conveying best practices to colleagues who were interested in learning. However, that success was largely based on trust and open-mindedness. What one's options are when it comes to responding to questions asking to why some accepted "best" practices are genuinely better in a way which gains said trust and interest?


Programming methodologies at stackoverflow

I am in the middle of starting up a software company where we would use ASP.NET MVC and ASP.NET WebAPI extensively at shop. We will be a group of 4 and no more than 10 will work on any particular project at any point in time(these are ground rules). I would like to know, what programming methodologies best suit a small(guerilla) team. Specifically, I would also like to know which ones are being used at famous ASP.NET MVC shops like Stackoverflow. The ones I know are:   1. Scrum and   2. Waterfall(I know its bad).  But what's the recommended way of development for smaller, group of 9-10 team. Also, will Test Driven Development help such a team in producing quality software? Are there any other techniques the team will have to know to be good at producing quality software?


what is exactly an enterprise app store

My idea of an enterprise app store is that there is a page on the company's website where all the apps that that company developed for its employees are listed so they can use them. And access to this apps is restriceted to the employees of the company. As far as I know you can download an Android App from any website and install it on an Andoid phone, you don't have to use Android Market. However installing an App that does not come from the Android Market is not that straightforward. For Apple, you can only install an app from the Appstore, so how can you have an enterprise app store? Please tell me what exactly is an enterprise app store. I think I got it wrong, also I read a lot on the internet for this keywords.


Implementing a ILogger interface to log data

I have a need to write data to file in one of my classes. Obviously I will pass an interface into my class to decouple it. I was thinking this interface will be used for testing and also in other projects. This is my interface:               //This could be used by filesystem, webservice     public interface ILogger     {        List<string> PreviousLogRecords {get;set;}        void Log(string Data);     }          public interface IFileLogger : ILogger     {       string FilePath;       bool ValidFileName;     }          public class MyClassUnderTest     {       public MyClassUnderTest(IFileLogger logger) {....}     }          [Test]     public void TestLogger()     {        var mock = new Mock<IFileLogger>();        mock.Setup(x => x.Log(Is.Any<string>).AddsDataToList()); //Is this possible??             var myClass = new MyClassUnderTest(mock.Object);             myClass.DoSomethingThatWillSplitThisAndLog3Times("1,2,3");             Assert.AreEqual(3,mock.PreviousLogRecords.Count);          }      This won't work I don't believe as nothing is storing the items so is this possible using Moq and also what do you think of the design of the interface?


How do I determine which language/framework is best for our web-based project?

I'm in the early stages of development for a web application that has three developers (myself included) working on it. The project is, at its core, a web-based database that will be used by around 5,000 people. Its primary purpose is to track information about game characters while enforcing a set of rules and security. Meanwhile, it's supposed to be as usable as possible. While the main presentation will be over a networked desktop web browser, we're also hoping that   * certain features of the application will be usable while disconnected from the network and   * that we can develop a version of the frontend for mobile devices. Here is some basic background for the developers; I think it's fairly relevant to the question.   * Developer A maintains the system we are redesigning. It was built in PHP but there is very little actual code that we can keep. He also has veto power, though he takes suggestions readily.   * Developer B is familiar only with VB and SQL, though he has been studying AJAX and HTML/CSS lately.   * Developer C (me) has a degree in Software Engineering with experience in multiple (non MS) languages as well as with some general web/database development, but has only developed code in Ruby since graduating (2009). Dev C has experience in an older version of PHP and helped work on one project in the latest version of Rails back in 2008. The main tools we're considering are Ruby on Rails 3 and PHP 5. Developer A seems fairly opposed to learning Rails, but my guess is that he is assuming it is more difficult to learn than it actually is. I don't know that for sure, though. Regardless of which we choose, I want to use a MVC architecture. **What are some other notable concerns we should address in order to determine which language would best suit us?** Are any of the concerns listed below trivial? The main issues/points/concerns I _think_ I need to consider/address are:   * The learning hurdle for Rails - for developer A, mostly, but also if it would be harder to learn a bit just to help for developer B than it would be for him to learn a bit of PHP.   * The possibility that there will be performance issues with Rails.    * The lack of forced structure with PHP - should I expect difficulties enforcing an MVC   * Ease of AJAX integration in PHP vs. Rails.


How likely is it for a programmer to become a good designer?

I'm a programmer, and I'm pretty good at programming. I can easily pick up most technical topics such as Linux, Systems Administration, Databases and of course, new programming languages. I even dabbled with 3d modelling and wasn't horrible at it. However, I am awful at Graphic Design. I have no skill there whatsoever, and even after quite a few Photoshop tutorials I can't design a website (or anything else really). I'm wondering if I pour a whole bunch of time into it, if I can become a _good_ graphic designer. So what I'm looking for is anyone else who has done this, or advice, thoughts, etc.


Is a try and catch that does not throw an exception more efficient than a conditional?

I came across this example recently: > If 999 times out of 1,000 an exception will not be thrown then the exception > is only generated once. On the other hand a conditional would have been > called needlessly 999 times, therefore in this case the exception is > superior. In this instance it's C#, but generally speaking is this true? I had previously assumed try/catch statements had their own overhead that would equal the time spent handling a conditional. Granted, just throwing try/catch blocks anyplace a conditional would normally go would be a terrible way to code, but resource-wise does this statement hold up?


Type inference in Golang/Haskell

I've read that Go doesn't actually have true type inference in the sense that functional languages such as ML or Haskell have, but I haven't been able to find a simple to understand comparison of the two versions. Could someone explain in basic terms how type inference in Go differs from type inference in Haskell, and the pros/cons of each?


How would you create a program where two objects randomly move throughout the screen BUT never collide?

they are free to move anywhere on the screen weather in straight lines or curved ones just as long as they don't be at the same place at any given time. btw I'm not asking how to write it in code, but rather the logic if you will? 1- how would you make an object move randomly? (disregarding predefined functions or classes..etc) 2-how do you ensure they never hit?


Best data structure for representing English verb forms

I need to come up with a data structure to keep information about English verb forms. In most cases a verb can be in one of 4 forms: base, present participle, past participle and past simple, for example:   * take   * taking   * taken   * took It's seemingly easy to define 4 types for each form and be over with it. However there are few exceptions that ruin this simple idea.   1. Present single third person form, which is in our example would be "takes".   2. Copular verb "to be" has multiple irregular forms in the present tense: "am", "is", "are" and "was" and "were" in the past tense   3. Verbs like "may" that don't inflect in the present single third person form: "she may". What data structure would be efficient, accurate yet unambiguous for representing such information (with exceptional cases) given the following requirements have to be met:   * for an arbitrary form answer the question what conjugations the form represents   * for an arbitrary conjugation and a form answer the question whether the form represents the given conjugation or not?


Common phrases to know which resources are no longer available

I'm working on an script for tracking urls on a web page. This script runs daily to identify resources that are no longer available. If a page returns a `status code` like `404` I know the resource is not available anymore, but sometimes the page returns a `200` with a message like: > This resource has been moved to ...... Or > This resource is not available anymore.... I would like to know which `keywords` are used to say a resource is not longer available regardless the `status code`.


Where to learn graph theory applications

I am completely new to designing algorithms with graphs. I am following CLRS and other video lectures in Youtube, notably from IIT/MIT. They are pretty good, and I currently have decent idea about graph data structures, search, spanning-tree, etc. However, I am completely clueless as to how to identify a coding problem (the likes of which you see in Topcoder/Codechef) that requires a graph-based approach. In which problem, shall I need to use a minimum spanning tree? Where do I need to use Prim's Algorithm? Is there ay book/resource which covers lots of problems on graphs, explaining (well, kind of spoon feeding) how to identify that this problem requires a graph-based solution, and finally how to do it?


Strategy for keeping secret info such as API keys out of source control?

I'm working on a website that will allow users to log in using OAuth credentials from the likes of Twitter, Google, etc. To do this, I have to register with these various providers and get a super-secret API key that I have to protect with pledges against various body parts. If my key gets ganked, the part gets yanked. The API key has to travel with my source, as it is used at runtime to perform authentication requests. In my case, the key must exist within the application in a configuration file or within the code itself. That isn't a problem when I build and publish from a single machine. However, when we throw source control into the mix, things get more complicated. As I'm a cheap bastard, I'd much prefer to use free source control services such as TFS in the cloud or GitHub. This leaves me with a slight conundrum: **How can I keep my body intact when my API keys are in my code, and my code is available in a public repository?** I can think of a number of ways to handle this, but none of them are that satisfying.   * I could remove all private info from code, and edit it back in after deployment. This would be a severe pain to implement (I won't detail the many ways), and isn't an option.   * I could encrypt it. But as I have to decrypt it, anyone with the source could figure out how to do so. Pointless.   * I could pay for private source control. LOL j/k spend money? Please.   * I could use language features to segregate sensitive info from the rest of my source and therefore keep it from source control. This is what I'm doing now, but it could easily be screwed up by mistakenly checking in the secret file. I'm really looking for a guaranteed way to ensure I don't share my privates with the world (except on snapchat) that will work smoothly through development, debugging and deployment and be foolproof as well. This is completely unrealistic. **So what realistically can I do?** Technical details: VS2012, C# 4.5, source control is either going to be TF service or GitHub. Currently using a partial class to split the sensitive keys off in a separate .cs file that won't be added to source control. I think GitHub may have the advantage as .gitignore could be used to ensure that partial class file isn't checked in, but I've screwed that up before. Am hoping for a "oh, common issue, this is how you do it" but I may have to settle for "that doesn't suck as much as it could have", :/


Having a Starting Place for Coding a Site

This is more of preference question that I wanted to toss out to other developers to learn a bit more about others process when developing a site. Every time I start a site I feel I could save a lot of time if I had a better starting point to work from. I have a 'starter' folder that has a CSS folder, a JS folder, an index.html file, etc. that I use as a guide, but I make tweaks every time I build a site, so I feel like I end up working from the last site I built instead of the starter folder most of the time. I figured there has to be a better way to setup a starting place that gets you up and running programming a site more efficiently. What do you use handle this in your workflow? Where/how do you save code snippets to reuse from site to site, etc.?


I've learned so much about OO programming I have no idea how to write procedural code. What's a good way to learn?

When I learned to program, I learned Object Oriented Programming very early on. For a while, I blundered around with my beautiful hammer, trying to use it for _everything,_ partially because I had no idea how to solve problems any other way. As I read more, I began to realize you need to use the right tool for the right job, and I quickly realized I had no other tools because I'd never learned any other style! I'm working on functional programming, and there are plenty of good books and articles about it. But what's a good way to learn procedural programming **the right way?** I have a basic idea of how to make global variables and pass state to functions, but I want to delve deeper into procedural code. I know most of the time people have to learn the other way, and procedural code is often bashed around for being unmaintainable, but I want to learn it anyway so I have more ways of approaching a problem. OOP may often be a 'better' choice, but right know its the only thing I know, and I want to branch out. I know procedural code was virtually the only style available for programming for many years, so most books don't say "we're going to teach you procedural programming!" and instead just say they'll teach you how to program, and the procedural is assumed. Those people can just find books that have OOP in size 72 font on the cover and know that's what it teaches. But I'm trying to go the other direction and feel a little lost... How did you learn procedural programming? Which books/languages do you recommend? Are there any important tips to learning the **right** way to write procedural code so its as maintainable and beautiful as possible? What tips would you give an OO junky as to how to write awesome procedural code?


Programming A Function in Python

I am quite new to programming, and was wondering if someone might be able to help me get the following working in python: Define ![$\\Phi_mx\(mn+r\)=mx\(n\)+\\frac{r}{m}\(x\(n+1\)-x\(n\)\)$](http://i.imgur.com/ZQeqIvx.gif), where we consider x(0)=0, r is always positive and less than m, and all values of n are positive integers. ![$\\Phi_m$](http://i.imgur.com/JAncAHQ.gif) takes in a string of numbers and outputs another string. How might I program this?


Mentoring Millennials

I'm in the process of revamping our company's software development internship program and the area I'm most passionate on is implementing an enjoyable and effective student/intern mentoring program. We have quite a demographic variance among our software development groups, however, the vast majority would be considered Generation-Xers. **Over the years I've seen our younger Millennial-Generation students/interns/employees struggle when working with older developers.** Software architecture, Agile principles, the importance of TDD, design patterns, all of these are important and I'm looking for insight on communicating these things to interns/students/younger professionals. I would love to hear of any good tips regarding mentoring today's incoming Millennial-Generation software developers, especially students/interns. What's worked well for you, what hasn't? What observations have you made that taught you something about a younger software developer, how they think, what they value, etc. How can we make this an experience and industry that they're excited to be a part of? Thank you very much for any and all comments.


Entity framework separating entities for product and customer specific implementation

I am designing an application with intention into making it a product line. I would like to extend the functionality across all layers and first struggle is with domain models.   For example, core functionality would have entity named Invoice with few standard fields and then customer requirements will add some new fields to it, but I don't want to add to core Invoice class. For every customer I could use customer specific DbContext and injected correct context with dependency injection.   Also every customer will get they own deployment               public class Product.Domain.Invoice      {         public int InvoiceId { get; set; }         // Other fields     }      How to approach this problem? Solution 1 does not work since Entity Framework does not allow same simple name classes.               public class CustomerA.Domain.Invoice : Product.Domain.Invoice     {         public User ReviewedBy { get; set; }         public DateTime? ReviewedOn { get; set; }     }      Solution 2 Create separate table and link it to core domain table. Reusing services and controllers could be harder.               public class CustomerA.Domain.CustomerAInvoice      {         public Product.Domain.Invoice Invoice { get; set; }              public User ReviewedBy { get; set; }         public DateTime? ReviewedOn { get; set; }     }


Programming languages, positional languages and natural languages

Some programming languages are modeled on machine code, like assembly languages. Other languages are modeled on a natural language, the English language. Others are not modeled on either machine code or natural language. Languages such as PROLOG, for example, don't follow either model. I came across this Perl module Lingua::Romana::Perligata, that allows to write programs using a syntax that is very similar to Latin. Are there programming languages that have less positional syntax? Are there other languages or modules that allow you to write in syntaxes inspired by other natural languages, like French, Hebrew or Farsi? There is a very long list on Wikipedia, but most of those projects are dead. There is a related question on StackOverflow. The answer that was accepted is "Use Google".


Where to put profile test?

I have an application with multiple threads that may be run on different hardware. To assist with tuning on different hardware I would like to create a "profiler" that can automatically run a fixed amount of data through using different numbers of threads. I've thought of several ways of implementing this:   1. It's a test, so put it in with the unit tests   2. It's also a part of the app, so make it part of the top level class running the app   3. It's a helper, so create entirely new class `Profiler` I'm leaning toward option 2, because I think it is simplest to implement and seems to fit in well. Anyone have any other ideas or comments?


Why GRASP patterns are less known than GOF ones?

Design patterns help developers to improve the quality of their design, but only GOF patterns are very known, and paterns like GRASP that gives a good concepts like Information Expert,low coupling and high cohesion are less known. I think that GRASP patterns could be a good introduction to patterns for students and developers, they will master GOF patterns better if they knew GRASP patterns.


Understanding exceptional cases

I've been studying the use of exceptions in various php projects (such as Doctrine and Zend Framework). Exceptions seem to be thrown when unordinary input/state occurs. A perfect example is Doctrine throwing an exception when you try to use a invalid query string. I think the creators of the doctrine api understood that first, you can't query data by using an invalid DQL statement, and a developer should immediately be warned that an error has occurred, rather then letting execution continue with the possibility of an error code going un-checked. I also bet that this simplifies reading the code. I can't think of a situation where you would want to use an invalid DQL statement, except unit testing. Since this is true, it's better to avoid plaguing a bunch of code with null/error checks and use exceptions. I've read in books that exceptions shouldn't be thrown when validating dating user input. I've seen examples where of where the guideline is broken. One example is the Zend framework. If supplying an invalid controller or action name, an exception is thrown. Unlike doctrine, the user has more direct control over this sort of input. I know you can configure an error controller and set up a 404 message or what have you, but I'm curious why they have used an exception in this scenario? I guess you can argue the Zend Framework does not know how to continue processing the request. One last example Is I wrote a function to return some html based on a given resource type. This resource type is hard-coded and sent when a user interacts with a web site (such as clicking a button to display the form to input data). I don't _expect_ users to be mucking around with the request type. Under normal operating conditions, the resource type should be valid. To clean up some logic, I was going to throw an exception if a particular form wasn't found. This is mainly to find the correct form associated with a resource type so proper validation can occur. Does this sound like a valid use case for an exception? Right now it's pretty trivial, but I do plan to implement a restful consumer and re-using a function to map resources to their validation services would be very useful. I can then catch the exception and based on the consumer, return an error message suitable for the request type...


Is a tree with nodes that have reference to parent still a tree?

If we make reference to the parent for each node in a tree, do we still have a tree (by definition) anymore? Wikipedia definition is: > In computer science, a tree is a widely used abstract data type (ADT) or > data structure implementing this ADT that simulates a hierarchical tree > structure, with a root value and subtrees of children, represented as a set > of linked nodes. ![enter image description here](http://i.stack.imgur.com/SXgBW.png)


Should large or old Codebases be expected to be easy to navigate?

I'm an Undergraduate Computer Science Student currently on a placement year at a company that produces and supports a large enterprise web application. I'm loving the experience of seeing how software is produced in the real world, and feel very lucky to find a company that offers a chance to not only maintain and extend existing functionality but also develop entirely new features for the product. All that said, though, I'm very conscious that this is very, very unlikely to be a perfect example of how to develop correctly. Far from it, in fact. I feel I'm learning a massive amount from my experience here, and I don't want to learn the wrong things or pick up bad habits from colleagues that could be hard to shake off further down the road. Mostly it's easy to tell what's good and what's not - for example the Unit Test coverage here is practically non- existent for various reasons (mostly poor excuses mixed in with one or two valid points). Lately, though, I've been noticing a regular occurrence that I'm just not sure about. Whenever we start a new project, naturally we need to find any relevant code that needs to be extended, altered, or removed. It seems to me that, the vast majority of the time, anything not within the most commonly used sections of the application takes people an age to find within the codebase. There are one or two tech leads who know their section of the code well, but even they get stumped sometimes and have to spend a long time searching for what they require, or turn to someone who has been editing that part of the code recently (if anyone) for help. When I say a long time, I don't mean hours (usually) but it seems to me that a good codebase would be navigable to any point within a few minutes at worst, to anyone even vaguely familiar with the system. So, my question. Is the above problem due to poorly structured code? Alternatively, is it down to developers not having enough knowledge of the codebase? Or is it simply unavoiable in large applications, regardless of how much work goes into keeping the file structure clear? Or, indeed...am I just wasting my time on a topic that really doesn't matter?


Technical manager (not lead architect) of development team

Can you be a technical manager of a development team, without knowing the technology they work with? I'm very technical, having been a tech lead for a while, now I'm a manager, and the new team reports to me now, administratively and technically. Problem is, a big part of the technology being used is old and archaic (delphi). Is it possible for someone with 'zero' experience in that to lead that team? What are some of your experiences?


Are dynamic languages at disadvantage for agile development?

From what I've read agile development often involves refactoring or reverse engineering code into diagrams. Of course there is much more than that, but if we consider the practices that rely on these two methods, are dynamically typed languages at disadvantage? It seem staticly-typed languages would make refactoring and reverse engineering much easier. Is Refactoring or (automated) reverse engineering hard if not impossible in dynamically typed languages? What does real world projects tell about usage of dynamically typed languages for agile methodology?


Agile Retrospective Ideas

I am a Junior at workplace and i have been to a number of our retrospectives over the last year. I have been asked to facilitate a retrospective of my own. So far, we have done "hats (red, green, white etc)", "mad, sad, glad", "imagining going forward to end of next sprint, and discussing how it might have gone". I would like to try something new. If you practice agile in your workplace, what do you use and would you recommend trying it for a retrospective? Thanks, Kohan


What does "windowed streaming" stand for?

So I was asking around the Mercurial development mailing list about binary diffing and patch handling and I got the following examples:   * whole file approaches (classic diff, bsdiff, Mercurial's internal bdiff)   * windowed streaming approaches (rsync, xdelta, libxdiff) What does "windowed streaming" stand for in this context? (and in general)


Front controller in PHP

When you are reading about web application development, "front controller" and "single point of entry" are frequent words you are confronted with. To my understanding, the point is to provide a single location where you decide what to do in your program. That's all nice and well in theory, but I am confused as to how this would look in reality. In OOP, I suppose your "controller" would commonly be instantiated in the "index.php", or whatever file is your "entry point". But how to go from there and how does the controller class look like? Is it something along the lines of this:               //Dummy-code, it's just to make a point     class Controller {              //first function to be called         public function main() {             switch($appAction) {                 case "login": userLogin(); break;                 case "view" : viewArticle(); break;                 //...             }         }              protected function userLogin() {             //Sanitisation of user input             //making instances of necessary classes etc.         }              //...     }      or did I get the whole concept completely wrong? This is the only thing I can imagine to be the case, but I'm just not sure if there is a major mistake in approaching it this way or if I just misunderstood the purpose of a front controller.


How to manage multiple database credentials across multiple projects

We have 10 separate projects that all access the same database. Initially, all 10 projects had database credentials hardcoded into them. I decided to move the credentials into a utility method and have all of the projects call that instead. For example               public String getDBUser() {        return "username";     }      So instead of hardcoding it in 10 places, I hardcode it in one place. All was fine. Fast-forward some months and I run into a wall with this solution, because now there are different credentials depending on which database server we're trying to connect to. For context, I'm trying to set up properly separated testing/production environments, but the servers have different username and passwords. One solution is to simply change the credentials to make them the same, but I imagine this is sometimes not an option and if I run into such a situation I would like to be prepared. What is a good way to manage multiple database credentials across multiple applications?


Class as first-class object

Could a class be a first-class object? If yes, how would the implementation look? I mean, how could syntax for dynamically creating new classes look like? EDIT: I mean what example syntax could look like (I'm sorry, English is not my native language), but still I believe this question makes sense - how you give this functionality while keeping language consistent. For example how you create reference for new type. Do you make reference first-class object too and then use something like this:               Reference<newType> r = new Reference<newType>();     r.set(value);      Well this could get messy so you may just force user to use Object type references for dynamically created classes, but then you loose type-checking. I think creating concise syntax for this is interesting problem which solving could lead to better language design, maybe language which is metalanguage for itself (I wonder if this is possible).


How much should Developers interact with Clients?

A philosophical discussion has come up in my department that I'd like p.se's opinion on. We're a 6 person development department inside a 60 person IT shop. All other departments are growing FAST, and ours has been the same size (and not fully booked at that size) for a few years. My manager, and old-school mainframe guy, contends that developers should never ever have ANY client contact. That all interaction with the client should be mitigated by a Project Management layer. He asserts that this allows a coder the focus they need in order to CODE, and protects the business's relationship with the client from the autism-spectrum tendencies of Joe Average Code Monkey. (My words, not his.) His boss, the owner of the company, told him this morning that every single person in the company needs to think of themselves as an extension of the sales department, and needs to be listening all the time for upsell opportunities. To this end, he thinks clients ought to have more or less full access to developers directly, in part so that devs have the opportunity to hear sales opportunities. I'm somewhere in the middle, myself. I think it's nice to shield devs from clients to some extent, but in practice that will never be total. And yes, every single job in the company includes sales, but that doesn't necessarily mean that everyone has the same opportunity for it. EDIT: We're not an agile shop. Some of us (cough) would like to head that direction, but for now assume this is a traditional fixed-bid-contract shop. EDIT2: The autism joke wasn't funny. Got it. Entirely possible that autism jokes never are. That said: there are developers who have a capacity to represent themselves and their employers well and developers who don't (currently) have that capacity. My manager has a real concern about how the company would be represented if all developers were structurally empowered to be company representatives. It's also getting increasingly clear from reading your responses that the real push-and-pull here is between waterfall and agile.


Flexible development environments for creating a common code base targeting tablets (iPad/Android) and x86 PCs

Hopefully this won't be flagged for being too vague, but I'm really looking for suggestions from anyone with experience in this sort of situation. I work for a group that develops very specialized engineering calculations for Intel x86 platforms. We do not intend to continue using this existing x86 code. Instead, we would like to start a new code base capable of targeting both x86 PCs and iPad and/or Android tablets. Clearly the UI code will have to be maintained independently. But I suspect the backend engineering code, which we want to keep common, is possible to be shared among all platforms. I would like to know if there are any development environments or techniques for simplifying this multiple-platform development with a common backend code base, or will it be necessary to develop this backend code for each platform independently as well. Please let me know if you need any clarification! Thanks **EDIT** For example, we would need to write a large amount of code in C. Is it true both the iOS SDK's objective-C compiler can build native iOS code using the (relatively) same C code we would use to build native windows code using MSVC? Mind you, the code would not need to rely on _specialized_ OS-dependent facilities. Are there any tools for assisting in this sort of cross-platform development that may require multiple compilers? or perhaps any individual compilers that can target both platforms?


Why is Objective-C not widely used beyond Cocoa environments?

Objective-C features nice object orientation, simplicity, elegance, and (as a superset of C), low level ability. It could seem like the simple, modern alternative to C++ that many people look for and try to find in Go. But it is just used at Cocoa and post-NextSTEP environments, and even in this case is seen more as a burden for historical reasons than as an optimal choice. Why it's not more widely used then? What are its problems?


Why is the c family the standard CS study regiment for Mathematics/CS programs instead of the LISP family?

I have been familiarizing myself with LISP for self improvement purposes. One of the things I have noticed is that LISP is much more within the paradigm of Mathematics than say C. The syntax and design structure seems to echo directly the actual mathematical model of an algorithm. It doesn't make sense to me why even good Mathematics based CS programs study C instead of LISP. I think that LISP more directly employs higher mathematical concepts than C. I am not saying that you can't model mathematical structures in C. I am merely noticing that LISP seems to be hard-wired for mathematicians. I have read many of Joel Spolsky's rants on the JAVA schools and what not--and I agree with his assesment--, but my school didn't teach JAVA for that very reason. They were stringent in teaching fundamental concepts like pointers, algorithm design, recursion, and even assembly instructions. However, they did this all in C and c++. Does anyone know the reasons for this and/or its history?


Question about Cyclomatic Complexity

I am new to static analysis of code. My application has a Cyclomatic complexity of 17,754 lines of code. The application itself is only 37,672 lines of code. Is it valid to say that the complexity is high based of the lines of code? What exactly is the Cyclomatic complexity saying to me?


As a C# developer, would you learn Java to develop for Android or use MonoDroid instead?

I'd consider myself pretty well versed in C#. It's my language of choice at the moment, and it's where basically _all_ my professional experience lies. Still, I'm puzzled by the existence of the MonoDroid project. My understanding has always been that C# and Java are _very_ close. Like, if you know one, you can learn the other really quickly. So, as I've considered developing my first Android app, I just assumed I would familiarize myself with Java enough to get started and then just sort of learn as I go. Wouldn't this make more sense than using MonoDroid, which is likely to be less feature-rich than the Java Android SDK, and requires learning its own API (albeit a .NET API) anyway? I just feel like it would be better to learn a new language (and an extremely popular one at that) and get some experience in it—when it's so close to what you already know anyway—rather than stick with a technology you're experienced with, without gaining any more valuable skills. Maybe I'm grossly misrepresenting the average potential MonoDroid user. Maybe it's more for people who are experienced in Java and .NET and just prefer .NET. Or maybe (in fact it's likely) there are other factors I just haven't considered. I'm just wondering, why would you use MonoDroid instead of just developing for Android using Java?


From http://www.microsoft.com/download/en/details.aspx?id=28942 > ASP.NET MVC 4 also includes ASP.NET Web API, a framework for building and > consuming HTTP services that can reach a broad range of clients including > browsers, phones, and tablets. ASP.NET Web API is great for building > services that follow the REST architectural style, plus it supports RPC > patterns. If ASP.NET MVC 4 supports RPC style communication what does that mean for WCF? On what basis should we chose to use WCF or ASP.NET MVC Web API's RPC mechanism?


How do I learn linking compiling, makefile quickly? Any book recommendations?

I'm very good at programming in C++ but when it gets to linking and the other important stuffs I feel very ignorant. I want to learn allegro without wasting time. So please suggest a book or a resource to learn the concepts mentioned above. Thanks a lot in advance.


Are XML Schemas bad for constantly evolving file formats?

I'm struggling with a client-server project where I have Java apps out on the Internet that store data to a backend server. The format of this data is well- defined, but the project is constantly evolving, so the definition keeps changing! To cope with the change I defined a simple REST interface on the server that offers only key-value storage. Clients can store or retrieve a chunk of data by referencing a unique key. This is nice because I don't have to modify the server interface (or the backend database) when the data format changes. To the server, it's just a bunch of opaque blobs. Of course, the issue then becomes, "What goes inside the blob?" For that I wrote an XML Schema that defines the content of a blob. At first it was great, since the Schema gives a bunch of nice things "for free": A formal yet human- readable spec of the file format, automatic validation of its contents, marshalling/unmarshalling to a stream, and auto-generated Java classes for programmatic access to the data. But then change happened! The Schema had to be altered, and naturally I ran into forward- and backward-compatibility issues. To deal with the constantly changing Schema, I came up with a solution that embeds a version number into the XML namespace, and I apply a series of XSL Stylesheets to "upgrade" any given blob to the latest version. For example, I'm now on version 1.3 of my Schema, so when I unmarshal a blob, I run it through a 1.0-to-1.1 XSLT, then a 1.1-to-1.2 XSLT, and finally a 1.2-to-1.3 XSLT. This works, but it's not sustainable because the chain keeps getting longer, which lowers performance and sucks up memory, plus I have to keep writing new Stylesheets, which takes time and isn't fun. Now here's the funny thing... In addition to the Java clients, the project also has iOS apps as clients, and iOS has none of the nice enterprise-y features associated with XML Schemas. There's no validation of the stream, no auto-generation of Objective-C classes, etc., just a low-level event-driven XML parser. But ironically I'm finding this _so_ much easier! For example, if the XML gets a new element, I just add a new `if` clause. If an element goes away, I remove its clause. Basically, I do a "best effort" at interpreting the XML stream, silently ignoring any unrecognized elements. I don't need to think about what version the file format is or whether it's valid. Plus this is much faster because there's no XSLT chaining, and it saves a lot of my time because I don't have to write any XSLT code. So far this approach has worked out great, and I've not missed having an XML Schema on the iOS side. I'm now wondering if a Schema, despite its nice feature set, is totally the wrong technology for a file format that often changes. I'm thinking about ditching my XML Schema altogether and using the same "best effort" low-level approach in Java that I'm doing in iOS. So is my negative assessment of XML Schemas correct? Or is there something I've missed? Perhaps I need to rethink the server interface? Or maybe I shouldn't have been using XML in the first place? I'm open to all suggestions. Thanks for reading!


How to process payments for a software (activation code)?

I want to sell software online and I need an easy to implement payment processing system. What I'm actually going to be selling is an activation code (one per purchase) that would activate the trial version of a product. I was about to use this one but I just found out that people without a paid email account (not hotmail or yahoo) can't process their orders, which I'm sure would discourage many, if not most, of the possible buyers.


Website with test data files for specific algorithms/data structures?

Is there any website, like SPOJ and Project Euler, with the test data files available for specific algorithms/data structures? I know it's a fun challenge to solve those problems on your own, but I am looking for test data files where the algorithm/data structure to use are explicitly mentioned. "Implement a linked list and do this and that with the data to confirm!", "Implement a hash tree and do this and that with the data to confirm!" etc.


Should the test and the fix be written by different people?

There is a common practice in TDD to write a test before fix to avoid regression and simplify fixing. I just wonder what if the test and fix will be written by different people, total spent time will be almost the same but as now three people will think about possible failures (+tester) we increase probability that fix will cover all possible failure scenarios. Does this practice make sense or it will just waste additional time needed for one more person to familiarize with bug?


Is it poor form to use C features such as the size_t type instead of their c++, such as std::size_t?

I have recently been told that using `size_t` as declared in the global namespace is incorrect in C++, ostensibly because `size_t` is a C-feature. I looked this up and came across this question on Stack Overflow: http://stackoverflow.com/questions/5813700/difference-between-size-t-and- stdsize-t The top answer makes it pretty clear that there isn't any _real_ difference between `size_t` and `std::size_t`, but that leaves open the question of style and correctness. Since I'm programming in C++, is it "wrong" to use a C feature such as `size_t` in place of the slightly longer but no better C++-specific `std::size_t`?


Recording unstructured suggestions and feedback in an issue tracker?

I'd like to advocate the use of issue-tracking software within an organisation that currently does not use it. But there's one aspect of their situation for which I'm unsure of what to suggest: their projects frequently receive informal verbal feedback or casual comments in meetings or in passing from a wide group of interested parties, and all this information needs to be recorded. Most of these messages are noise, but they're vital to record and share with developers for two reasons:   1. Good suggestions often come out of this process.   2. It can be necessary to have evidence of clients' comments when they forget previous instructions or change their mind. Is this the sort of information that should be stored in an issue-tracking system, or kept apart in a separate solution? Can issue-tracking system have good support for this sort of unstructured information?


Confused about the different terminology with .NET

What is the difference between .net and asp.net? Which role does PHP more closely fill? If someone was developing a website using asp.net and C#, how would you communicate that idea to a colleague, i.e. what's the language you would use?


Can I include a modified GPL/Apache licensed font in my LGPL project?

I want to include a GPL & Apache duel-licensed font in my LGPL project, but didn't really find a clue if that's possible. There are two problems here:   1. I didn't find any clue about Apache license's "LGPL Compatibilty". I know both the licenses involved here are compatible with GPL, but I still prefer to release the work under LGPL.   2. It's kind of tricky since it's a font. It was GPL & Apache duel-licensed, but the LGPL terms are asking about "Library", its "Public API", "Linking" or something. I am not really sure what the operation belongs to if I just edit a .ttf file manually, not even sure about if that's counted as "source". Any help would be really appreciated!


Should a domain object wrap/contain a DTO interface?

Using .NET - I have an interface IPerson. This interface is implemented by classes in multiple, separate repositories, e.g. EF6 (EfPerson), custom SQL (SqlPerson), or even custom assembly connecting to a web service (WebPerson). Assuming rich domain model, my idea is that my lovely rich domain object 'Person' could have a private member variable _PersonDto of type IPerson, supplied via constructor. The members of Person would be the only way to access data from the _PersonDto. Q. Is there anything actually inherently wrong with that approach? (Assume I'm not lazy loading, and that I will possibly have a service layer for cross- cutting stuff). Please note I'm using DTO here to simply mean the anaemic objects I get back from my repositories.