title: Confusing project dependencies

text: I have a project for my main application and some projects for modules that are used by this application. Following I will reduce it to the main project and one module project. Both projects share some dependencies, but the module project is also a dependency of the main project. I thought that it would be best to create a parent pom that includes all shared dependencies. Additionally I wanted to create Project Aggregation as described on http://maven.apache.org/guides/introduction/introduction-to-the- pom.html, to build everything in one step. But I would also have to declare the module project as a dependency of the main project. I don't think that this is a good approach and I am getting confused because the projects are referenced at many places. Do you have any solutions for creating a clean structure?


title: Sprint item takes longer then expected to be completed. What should we do?

text: What should we do if a item in scrum takes longer then expected? i am asking this because i have been noticing items that developers is struggling to complete as it is much tougher then initially thought. In such situation should we   * remove the item from sprint back to product catalog so that we can meet the sprint timeline?   * move to easier sprint item and leave problematic sprint till the end of timeline   * justify at sprint review why the item cant be completed at current sprint to stakeholders? How can we avoid such situation in future? Is it due to lack of upfront planning or we did not make an effort to break down the sprint item into smaller item?


title: How to properly conduct a feature development meeting?

text: I am a Product Manager, under me I have about 10 developers, UX designers and marketers. Marketers research about the demands of features, UX designers providing UI mockups, and develkopers write code. Now, we want to do our feature development monthly meeting (sprint) in a more structured manner ( previously, feature priority is decided in a somewhat adhoc manner, we want to change this). The goals of the meeting are   1. To set the priority ( urgent, important, normal, not important) of each feature   2. To make sure that everyone knows what to do for this coming milestone after the meeting is over. But given that we have 10 people on the team and usually, we have more than 50 features to discussed, I afraid that the whole meeting will drag on for a long time. Also, for the second step, I would need to allow time for everyone to check their schedule, as not everyone is fully available to work on the features ( some would need to fix bugs, provide technical supports etc), so if I ask them to do this in the meeting, then there will be some lull time and disrupt the flow of the meeting. Is there any well-established meeting procedure that is fitting to my situation above?


title: Two libraries connecting to the database, leading to code smell?

text: In the current company that I work for there is a very large Utilities library. It was written a few years back (long before I joined) and has grown ergonomically over time to now do everything:   * Sending Emails   * Exporting Files in different formats, i.e. CSV, tab delimited   * Receiving data from 3rd party providers, i.e. Bloomberg, Facset   * Sending files to SFTP sites   * Generic database connection The list goes on and it is pretty ugly really. The original developer here used it in every application that he wrote for convenience sake and added to it as necessary. The utilities library itself has references to 3rd party API’s to do some data receiving from Bloomberg/Factset. Using these 3rd party API’s means that any project that wants to reference the large Utilities library also then needs to have the Bloomberg API’s and Facset API’s with it. The list is starting to grow too and it is becoming very unmaintainable and unnecessary to have all these 3rd party DLL’s accompanied with this large Utilities project but are required to compile it. I want to rewrite this entire library it to more manageable libraries. i.e:   * CompanyName.Email   * CompanyName.FileExporter   * CompanyName.Bloomberg Each project will then only reference the necessary projects it needs to get its job done. i.e. reference the CompanyName.Email to send emails. I have no issues doing that, but the complication facing me is that some of the new libraries will require their own database connection and queries. The example below is:               [HolidayChecker]     [HolidayChecker.DAL]      We store a list of holiday days in the database. What I would want the HolidayChecker project to do is expose a method (amongst others) to check if a particular date is a holiday.               public interface IHolidayChecker     {         bool IsHoliday(DateTime dateToCheck);     }     public class HolidayChecker : IHolidayChecker     {         public bool IsHoliday(DateTime dateToCheck)         {             //Query database for date logic...         }     }      Many applications will then reference this HolidayChecker project and use the IsHoliday method. These applications will also have their own connection and queries to the database to perform their own tasks.               [GenericApplication (References HolidayChecker)]     [GenericApplication.BusinessLogic]     [GenericApplication.DAL]      If the application and the HolidayChecker project both access the database and query the data, this comes across heavily as code smell. Is anyone aware of a tidier way of achieving this? Or is there? Is this something I will just have to live with? # EDIT: Thinking about this overnight, I don't think it is a bad as first thought. Projects like ELMAH are stand alone that also connect to the database and do their own queries. As @Allan pointed out, it is just a matter of designing my HolidayChecker project correctly.


title: How to work with large aggregate roots?

text: I'm learning DDD and yet I have more questions than answers. Let's consider a model of a directory containing enormous number of files.   Here is how I see it: Directory is an Aggregate root.   This entity should have the validation logic of checking file name uniqueness when it is added or just renamed. And File entity contains the 'SetName' logic, notifying Directory via Domain Event about name changes.   But how should Directory then work?   It is not always possible to load all files into memory. Should in this case Files repository have adhoc logic for checking name uniqueness? I suppose it is a viable decision.   However, what if some files have been already added or renamed withing current not yet commited transaction? (nothing prohibits that. Transaction boundaries are set externally in relation to business logic). Probably repository should take into account both in-memory and persisted states (merging these states can be nontrivial task.) So, when aggregate root with all its children fits in memory - everything is fine. And as soon as you can not materialize all entities there are troubles. I'd like to know what are the approaches for such situations. May be there is no problem at all and it is just because of my misunderstanding of the subject.


title: Unit testing - Database coupled app

text: What would be the best approach at unit testing a model that integrates into an application that is tightly coupled to database? The specific scenario here is a shopping cart - I'd like to be able to test the adding removing and retrieving of items from the cart as well as pricing logic etc. This in my mind all requires database access though I have read several times that database access should be avoided.


title: Strategy game, how do I calculate the parallel actions?

text: I am building a strategy game where multiple units(5 - 20) fighting each other. I have a game logic that calculate all the actions that been done on each turn, and send it to the game engine to animate. Those are the possible actions:   * perform attack   * perform taking damage   * perform moving   * perform missing   * perform removing your self(dying) ## How can I find what actions I can perform in parallel and what are not? Those are the limitations that I have:   * units can only perform one action at a time.   * each action may have different times, even if its the same action   * Unit can perform the action `attack`, only if the other unit performing the action `taking damage` or `removing your self`   * after unit performed the action: `removing your self`, he cannot perform any other action. **Edit:** Those are the situations that might happened:   * one unit is attacked by multiple units at once   * one unit taking damage while no units are attacking him   * all the units move at the same time   * all the units perform miss at the same time This question is not about game design, but a programmatic solution to how I can find those parallel tiles of actions? * * * Reply to **FrustratedWithFormsDesign** , answer Hi man, you took it to completely different direction, so I want to reply you here to clear things up. This questions is not about how to make units to move in parallel. I also don't think that your suggestion is a good idea. What you did with your own game this is actually, the right direction. It will be also wise to work in MVC and separate the view and game logics. So to implement a game engine I would use a game thread that will dispatch tick events, based on chosen frame rate. Only the views should be listening for that thread and implement they view logic based on it. In my game I am using **Adobe Air** framework with some native Java and Objective-C support for mobiles, but it's **Air** mostly. So all my animations are listening to onEnterFrameEvent, this would be tick in your example, and implement their animation logic. My game logic is using a different worker(air threads implementations, it's more like a process) to generate all the actions on particular turn. And than it sands it to the game engine to animate. I do not ask how to implement the animations, it's handled by **Air** apis, and it doesn't meter in here. Think about those problems: > unit a attacks unit b while unit b attacks unit c, while unit c is moving. This will resolute with a mess on the screen.   I want it to be: > unit a attack unit b, unit b waits for a to finish attacking him to start > attacking unit c, while unit c is moving. After a finish attacking unit b, > unit b attacks unit c. So the input of actions I received was:   * A attack   * B take damage   * B attack   * C take damage   * C move And the output was two sets of animations   * A attack, C move, B take damage   * B attack, C take damage This was a very simple example of how I would like to parallel my actions. I hope now it is more clear.


title: Are the over-usage of delegates a bad thing?

text:
Good day. I have been told that a good practice for writing methods is to make the method only responsible for doing one thing. It made sense to me now that I look back upon it in retrospect. There are a couple of reasons I like coding in such a way - to me they are:   1. Code is Manageable   2. Code is more human readable   3. Better understanding of what the method does is maintained But here comes the issue which concerns me. Sometimes performing a task requires more than 1 action to be performed. A lot of developers' code which I look at every day does 7 to 8 things per method, where it could have been broken up and assigned to a delegate to run the methods sequentially. Working on huge projects, what will the implications be of using a lot of delegates to run methods sequentially? Should I be concerned for using a lot of delegates in my code? Example-               private delegate void Factory();         Factory factory = null;         protected void Page_Load(object sender, EventArgs e)         {             try             {                 factory += SetCatalogClientProxy;                 factory += SetHelper;                 factory += GetAccessToken;                 //factory += GetCatalog;                 factory += GetToken;                 factory.Invoke();             }             catch (Exception ex)             {                 AddToResult(ex.Message + NEWLINE + ex.StackTrace.Replace(" at ", " at " + NEWLINE).Replace(" in ", " in " + NEWLINE));             }         }              #region Test Process Methods              private void SetCatalogClientProxy()         {             catalog = new JAM.CatalogClientProxy();             AddToResult("CatalogClientProxy Successfully initialized");         }              private void SetHelper()         {             helper = new JAM.HelperClass();             AddToResult("HelperClass Successfully Intialized");         }              private void GetAccessToken()         {             accessToken = JAM.CatalogClientProxy._accessToken;             if (string.IsNullOrEmpty(accessToken))             {                 catalog.GetACSClaim();                 accessToken = JAM.CatalogClientProxy._accessToken;             }             AddToResult("Accesstoken Retrieved." + NEWLINE + accessToken);         }              private void GetCatalog()         {             catalog.CallCatalogService("fullcatalog", utcTime, country, "2", false);             AddToResult(helper.Catalog(baseUrl, utcTime, page, country, accessToken));         }              private void GetToken()         {             var Fulfillment = new JAM.FulfillmentServiceProxy(Guid.NewGuid().ToString());             ClassImport.FulfillmentInfo result = Fulfillment.GetToken("ABC-11111", "123456", "ZA", "123456", "123456", JAM.CatalogClientProxy._accessToken);                  if (result != null)             {                 var output = "Products" + NEWLINE;                 foreach (var p in result.Products)                 {                     output += "    " + p.ProductName + "
";                     foreach (var l in p.Links)                     {                         output += "        " + l.Uri + "
";                     }                 }                 AddToResult(output);             }             else             {                 AddToResult("No products Found");             }         }         #endregion              #region Logging To Page              private void AddToResult(string text)         {             result.InnerHtml += String.Concat("[", DateTime.Now.ToString(), "] ", text, NEWLINE);         }              #endregion      This is from one of my test pages. There is only 1 delegate here, but on other projects I work on I sometimes have 5 or 6 delegates set up similarly to perform methods sequentially, where I try to keep the methods at 1 action each.


title: External id for every relational table

text: Should I add an external id for **every** table? For example if I have these tables :               Customer     =======================================     Id       Name      Gender     ---------------------------------------     1        John      M     2        Doe       M     ---------------------------------------          CustomerPurchase     ==========================================================================     Id       ExternalId      CustomerId            TotalQty     --------------------------------------------------------------------------     1        PO0313-0001     1                     10     --------------------------------------------------------------------------      In that example, I understand that ExternalId is required in CustomerPurchase table (for printing, etc). But I don't see any reason why Customer table should need one as well. FYI, the reason I asked this because a friend of mine said that SAP uses ExternalIds in their tables. Should I use ExternalId in every table? Am I missing any ExternalId's other usage besides for user's eye friendlier identification? Thanks!


title: Should arguments always be passed to an Action in a MVC controller

text: I have a number of controllers that take a 'site' as a parameter within their actions, like so:                   [AuthoriseSite]         public ActionResult Index(string site) {             var model = gvmFactory.CreateAnIndexViewModel(site);             return View("Index", model);         }      I have been passing the site as a parameter but I could also calculate it from a user's Membership profile, so my code could look like:                   [AuthoriseSite]         public ActionResult Index() {             string site = UserProfileService.GetUsersSite();                var model = gvmFactory.CreateAnIndexViewModel(sitename);             return View("Index", model);         }      The site parameter can vary according to the role a user is in. Users that are admins can choose many different sites, whilst non-admins can only use the one they belong to. **My question is, which is the better practice?** I favour the first, it feels more like MVC, although this could just be I've always tended to do this. The second has some advantages in that URLs can not be adjusted so as non-admins get to see sites they shouldn't. However, the filter [AuthoriseSite] prevents this.


title: What does using (vec col) or (vector arg1 & args) cost?

text: I am working through some Lisp exercises using Clojure. If I were to convert Lisp lists to Clojure vectors, solving some of the problems would be simpler, so here is my question: Does using `vec` or `vector` cost a lot in terms of time and/or processing? Does using either function cause a meta state change, or are the values converted and moved to a vector?


title: Is doing some work for credit worthwhile?

text: Not sure how to title this as it's not just about that. But suppose that there is a software like .NET BCL, and you notice some places where you can make things much faster. It's not a great example but imagine you made several types like `List<T>`, etc much faster, i.e. 10x to 200x for each operation separately. Let's say you told Microsoft about it, and asked if they would consider adding your changes. What would you do if they give you only one of these options from this list:   1. They will add the code, you will no credit or money.   2. They will add the code, and give you credit, no money.   3. They won't add the code, but try to make the same changes that you showed or explained or use your code as an "inspiration", but not credit or money.   4. They won't do anything and you will just publish your code as your own library somewhere. Considering this would be something you could use in your resume, would you consider any of these? Because if you say you helped Microsoft to optimize/improve X, Y, Z 100x, etc, it should help you in getting a job, right? I mean not solely but something that might not be found in almost no other resumes. If they offer #1 or #3, what does that tell you about the company? Should you go for #4 then? I mean #4 is fine but if .NET has 10 million users, you can maybe reach a couple thousands by publishing your stuff as 3rd party since most people don't download extra libraries I think. Also this thing I am describing is not a full-time thing but more like "along the way" effort to increase your value since you did the work anyway. So it's not like you are doing it for them. Or do you think companies can take this kind of stuff as hostile or offensive since you basically showed their software engineers, they can't write performant software with all their engineering degrees which you might not have. It's fair to assume they aren't trying to be loose on performance for .NET The reason I am asking about this is because some companies seem very hesitant on giving credit where credit is due. But credit is free, so why would they resist? If all it takes is typing your name somewhere, why would they refuse? Any ideas on this?


title: How to deal with the "programming blowhard"?

text: (Repost, I posted this in the wrong section before, sorry) So I'm sure everyone has run into this person at one point or another, someone catches wind of your project or idea and initially shows some interest. You get to talking about some of your methods and usually around this time they interject stating how you should use method X instead, or just use library Y. But not as a friendly suggestion, but bordering on a commandment. Often repeating the same advice over and over like a overzealous parrot. Personally, I like to reinvent the wheel when I'm learning, or even just for fun, even if it turns out worse than what's been done before. But this person apparently cannot fathom recreating ANY utility for such purposes, or possibly try something that doesn't strictly follow traditional OOP practices, and will settle for nothing except their sense of perfection, and thus naturally heave their criticism sludge down my ears full force. To top it off, they eventually start justifying their advice (retardation) by listing all the incredibly complex things they've coded single-handedly (usually along the lines of "trust me, I've made/used program X for a long time, blah blah blah"). Now, I'm far from being a programming master, I'm probably not even that good, and as such I value advice and critique, but I think advice/critique has a time and place. There is also a big difference between being helpful and being narcissistic. In the past I probably would have used a somewhat stronger George Carlin style dismissal, but I don't think burning bridges is the best approach anymore. Maybe I'm just an asshole, but do you have any advice on how to deal with this kind of verbal flogging?


title: What's the opposite of cohesive?

text: I was talking with my architect about some concerns with a particular approach that may result in very low level of cohesion in a set of classes. However, I couldn't think of the word that represents a low level of cohesion. I said something along the lines of "Obviously, we want cohesive classes not... uh ... not cohesive classes" What's the correct word I should have used?


title: How do programs generally get information from the OS?

text: In many languages there are libraries, either built into the language itself or built separately outside of the language, which allow information to be taken from the operating system at some level. Examples are metadata about a file, current memory usage and the OS version itself. How is this information generally accessed? At the moment the only way I can see it working is through executing command line functions and parsing the answer. For example, to list the files in a current directory on Linux your application would execute 'ls' at the specified directory and then parse the output to produce the required format. Is this the only way? This example assumes you are using no libraries which do it for you of course (or maybe you're building a library for this purpose.


title: Separating front end from back end - Tomcat

text: I'm currently working with a company that uses Java / Tomcat / Spring for the back end of our web applications. As a front-end developer, I'm feeling more and more strongly that the back end should be a separate project from the front end, for a few reasons: 1) **Building the project** \- many modern projects build with grunt and other front-end tools. The front-end build goals (concatenation, minification, front end tests, pre-processing CSS) are completely different from the back end goals (compiling java code, passing back end tests, deploying to a continuous integration server) 2) **Deployment:** When I commit a javascript or html file to our git repo, it doesn't make sense that our continuous deployment tool should rebuild and redeploy the whole project, but it has no way to tell the difference between a front-end commit and a back-end commit. So, **how would you restructure a project** that previously automatically deployed from a single war file, living in a single git repo, to make a separate back end and front end? Can I actually do this, given that we use Spring framework? Right now, my files live in a mixture of the `/webapp/WEB-INF` directory (for html pages / velocity templates) and the `/webapp/resources` directory for everything else (js, css, images). I'm slightly confused about how I should go about this when tomcat deploys a huge bulk of files to the `/target` directory, as well? If I keep a separate git repo for front end files, won't it be wiped out if I re-deploy the back end project? (Originally I come from an Apache background, where it seemed so nice and simple...)


title: Can defect containment metrics be readily applied at an organizational level when there is only a consistant organizational process framework?

text: Defect containment metrics, such as total defect containment effectiveness (TDCE) and phase containment effectiveness (PCE), can be used to give a good indicator of the quality of the process. TDCE captures the defects that are captured at some point between requirements and the release of a product into the field, indicating the overall effectiveness of the entire process to find and remove defects. PCE provides more detail at each phase of the software development life cycle and how the defect detection and removal techniques are working. Applying these metrics makes sense at a level where you have a well-defined process and methodology for product development, often a project. However, some organizations provide a process framework that is tailored at the project level. This process framework would include the necessary guidance for meeting certifications (ISO9001, CMMI), practices for incorporating known good techniques (agile methods, Lean, Six Sigma), and requirements for legal or regulatory reasons. However, the specific details of how to gather requirements, design the system, produce the software, conduct test, and release are left to the product development teams. Is there any effective way to apply defect containment metrics at an organizational level when only a process framework exists at the organizational level? If not, what might be some ideas for metrics that can be distilled from each project (each using a tailored process that fits into the organizational process framework) that captures defect containment metrics to discuss the ability of the process to find and remove defects? The end goal of such a metric would be to consolidate the defect containment practices of a large number of ongoing projects and report to management. The target audience would be people in roles such as the chief software engineer and the chief engineer (of all engineering disciplines) for the organization. Although project specific data would be available, the idea is to produce something that quantifies the general effectiveness of all tailored processes across all ongoing projects. I would suspect that this data would also be presented as part of CMMI, ISO, or similar audits to demonstrate process quality.


title: Which HTTP status codes are really OK?

text: I am writing an application to report to the user(devs) when their website _fails_. And what I mean by _fails_ which is unfunctional or needs to report the problem to devs.   I do understand that status code 2XX means 'Success' according to wiki. But does that really do? I have access my website once and returned 204 'No- Content', which is unfunctional to me. So the question is, what are the list of status codes return should It be considered "website is functional"?


title: How to evaluate CLR / C++ vs native C++?

text: How should I go about evaluating the performance or execution time of C++ with CLR versus native C++? My personal bias is that I believe C++ with CLR to be slower since it has to run on a virtual machine. I will also admit that I have never really been a fan of Visual C++ due to the syntax that has been added, so I wanted to know how to evaluate the performance of the two approaches and determine which is provably faster instead of relying only on my biases.


title: What shoud MainWindow of a WPF contains

text: I am making a WPF application following MVVM model. I have seen some approaches for applying MVVM. I am concerned about my MainWindow.xaml. In some tutorials I have seen that MainWindow is only hosting a ContentControl, and in some first main page of the application. I am making a wizard type application. There are multiple views with next and back buttons. There is one WelcomeView which is going to be the first view. So my question is that what approach should I use. My window should contain a ContentControl pointing towards MainView or I copy paste all UI elements from WelcomeView to my MainWindow and get rid of WelcomeView. Which is more suitable? What are Pros and Cons of each approach?


title: Teaching a course on intro to programming, in C++: Do I teach C-style casts?

text: I'm currently redesigning a college level first semester graduate course on Intro to Programming, in C++. Note the comma; the course is introduction to programming, and C++ just happens to be the vessel used to teach it. Note that I don't have any decision power at the moment over the language selection, so arguments about whether or not C++ is a good introductory language are moot. Over the past 3 years, I've taught this class as a intro to C++ course, which is how the course was taught previously. However, I have come to realize that teaching things like pointers, C-style strings and arrays, and etc. early in the course does a disservice to the students, who will very likely go on to program in other languages. This semester, I am leading with references, smart pointers, C++ strings, and vectors, and only covering raw pointers, C strings, and C arrays towards the end of the course as "advanced C++." The goal is to teach programming concepts first, not the intricacies of C/C++. However, I'm hung up on casting. Based on my previous statement, it would seem logical to dump C-style casts until the end of the semester (if at all, since Stroustrap has indicated they're to be avoided) and to introduce `static_cast` up front, `dynamic_cast` when we get to polymorphism, and `reinterpret_cast` when we're dealing with raw pointers. However, given that most C-derived languages such as C# and Java perform casting using syntax similar to C-style casts, am I preparing students to be confused when they try to work in another language? (Although, the C# `as` operator does do approximately the same thing as a C++ `dynamic_cast`.)


title: JavaScript's prompt, confirm and alert considered "old-fashioned"

text: Lately I've been developing a web-based management system for a gym. Their previous app was developed in Visual Basic. For the new app, all the front-end scripting uses jQuery, the server is running PHP & MySQL... you know, the typical el-cheapo linux based stack. Anyways, I was wondering why JavaScript's prompt, confirm and alert message dialogs are so underused nowadays. There a lot of jQuery plugins for modal windows and alert messages that try to mimic something that the language already offers and every browser is forced to support properly. Using hand-made or plugin-based solutions is ok for complex forms and special needs, but if you just need to ask for a single value or confirm the deletion of a record, why would you add such overhead to your web app? Furthermore, iOS and Android offer nicely adapted message dialogs when you use prompt, confirm and alert.


title: Why is it called a 'Here Document'?

text: (Let me know if this is the wrong SE for this) Why is a Here Document (or Heredoc) called that? Wikipedia didn't have anything to say on that particular subject. I did find unix docs describing a "Here is document", is that the original form?


title: Term for domain specific business object?

text: This question might be a little vague. I have seen an acronym referring to a business object in a software system. It's usually mentioned when discussing such design patterns as Java EE's DAO pattern.


title: Project estimates for unreal tasks

text: I'm a developer in large IT company that is centered around providing services to clients (by that I mean development department is <20 people and not a major part of organisation). I'm solving different tasks relevant to current problems, and everything is fine so far, but management somehow came up with idea to implement some application that replicates most of features in industry award-winning products like MS's Visio or Autodesk's AutoCad. They want to do that using available resources I've described above. My first answer was "that's impossible even in your most bold fantasies" because project of such measure is made by dozens of teams of developers/architects/testers, costs millions of dollars and develop-from- scratch period is at least 1,5-2 years. They consider that, but have few counterarguments such as we don't have any deadlines on this project (legislation behind subject area is not yet done and may not be adopted in next few years) nor detailed specification so each implemented functionality can be considered as minor release that will be delivered to client and tested "on the field". And of course, we don't need 1:1 copy of Autocad, just "few major features like 10% of whole product functionality". That arguments doesn't help in estimation at all, on the contrary it means we'll have a lot of uncertain requirement changes like "look at this feature of AutoCad and implement it" and test by customers and not professional QA department is (politically correct synonym for idiocy). Any ideas how to reason and estimate such task? Though some numbers would be helpful, but all development costs/details of large projects are unavailable, I can operate only with such ambiguous facts as average known salary say of Microsoft SDE and timeline of MS Office releases i.e. talking about Visio.


title: Unit Test passing conditions as well as failing conditions?

text: Should unit tests test passing all cases as well as all failing cases? For example, imagine I have a test `Widget_CannotActiveWidgetIfStateIsCancelled`. And let's say there are 25 possible states. Can I get away with testing only that I cannot activate my widget when State == Cancelled, or do I have to also test that I CAN activate it in each of the other 24 states?


title: When to use Advanced Message Queuing Protocol like RabbitMQ?

text: Can somebody explain me in what use-cases I should consider using AMQP like e.g. RabbitMQ? What are the pros and cons?


title: Dark themes in IDE with multiple monitors

text: There has been numerous posts about developers that prefer a dark color scheme in their IDE. Most of the themes at studiostyl.es are dark themes. Back when I had a single monitor, I did enjoy using a dark theme since it was easier on the eyes. But now that I utilize multiple monitors, I find dark themes actually hurt my eyes. Most of the time I have my IDE open on one monitor and a browser/email/documentation open on my other monitors. Only my IDE has a dark theme and most of websites/documentation have a white background. This forces my eyes to constantly adjust between my dark IDE and the white website, which puts strain on my eyes. I'm sure I'm not the only person who tries to use a dark theme for the IDE and have multiple monitors. How do other people deal with this issue?


title: Dependency analysis from C# code through to database tables/columns

text: I'm looking for a tool to do system wide dependency analysis in C# code and SQL Server databases. It's looking like the only tool available that does this might be CAST (CAST software), which is expensive and it does **lots** more besides that I don't really need. C# code through to database column dependency would be hugely useful for many reasons, including: \- determining effects of database changes throughout the system \- seeing hot spots in the database schema \- finding dead stored procedures, tables, etc. \- understanding the existing code base Do such tools exist?


title: What do you deliver in the first couple of iterations in Agile?

text: As I understand, the idea with Agile methodologies is that you deliver something functional and you deliver it often. The application gets into its final shape increment after increment. But in the early iterations you might build the framework or foundations on which the application will stand so it's something important but not visible to users. What gets delivered to the client in these first iterations? How do you show progress in the right direction when you build scaffolding code?


title: What is the appeal of Systems Hungarian?

text: In What naming guidelines do you follow?, the author says: > Also I prefer to code using hungarian notation from Charles Simonyi. I've run in to several programmers who still prefer to use Hungarian, mostly of the Petzold/Systems Hungarian flavor. Think `dwLength = strlen(lpszName)`. I've read Making Wrong Code Look Wrong, and I understand the rationale for Apps Hungarian, where domain-type information is included in the variable names. But I don't understand the value in attatching the compiler type to the name. Why do programmers still persist on using this style of notation? Is it just inertia? Are there any benefits that outweigh the decreased readability? Do people just learn to ignore the decorators when reading the code, and if so, how do they continue to add value? EDIT: A lot of answers are explaining the history, or why it is no longer relevant, both of which are covered in the article I cited. I'd really like to hear from anyone out there who still uses it. Why do you use it? Is it in your standard? Would you use it if it wasn't required? Would you use it on a new project? What do you see as the advantages?


title: How does one regrade a development team appropriately?

text: We have a team of 20+ developers, of mixed skills and varying levels of ability in each. Some are C#/MVC4/.Net 4.5 developers cutting new code, some are VB6-ers maintaining our critical legacy apps. For each, we have a 'Career Progression Framework' - an internally available list of what you need to do in order to move from Trainee Analyst Programmer Levels 1, 2, 3 and 4, to Analyst Programmer Levels 1, 2, 3 and 4, into Senior Analyst Programmer Levels 1, 2, 3 and 4. Admittedly, the CPF we use is well out of date and needs reworking, which is a straightforward process itself. With new technologies coming out in the .Net field all the time, this framework almost needs to be akin to walking up an escalator as in moves downward, as the newer stuff should be known to the top of the 'tree' before the trainee gets to it. One thing to bear in mind here, is that at each stage, the developer is given a small pay increase, as a reward for their efforts, but in most cases, this is the incentive to 'climb' the ladder in the first place; if they've received an increase for getting the new stage, HR might have issues with it being removed! I know developers should be keen on keeping their axes sharpened, but in reality, not all developers are like that, unfortunately, and they are what they are. The problem is I am trying to determine the best way to grade our developers based on their specific skills and framework knowledge and am wondering the flaws with my specified approach. **Please keep in mind that answers should be pertinent and exclusive to the unique challenges in grading software developers in the organization**. EDIT: On-site and off-site training is offered to developers.


title: Automated build platform for .NET portfolio - best choice?

text: I am involved with maintaining a fairly large portfolio of .NET applications. Also in the portfolio are legacy applications built on top of other platforms - native C++, ECLIPS Forms, etc. I have a complex build framework on top of NAnt right now that manages the builds for all of these applications. The build framework uses NAnt to do a number of different things:   * Pull code out of Subversion, as well as create tags in Subversion   * Build the code, using MSBuild for .NET or other compilers for other platforms   * Peek inside AssemblyInfo files to increment version numbers   * Do deletes of certain files that shouldn't be included in builds / releases   * Releases code to deployment folders   * Zips code up for backup purposes   * Deploy Windows services; start and stop them   * Etc. Most of those things can be done with just NAnt by itself, but we did build a couple of extension tasks for NAnt to do some things that were specific to our environment. Also, most of those processes above are genericized and reused across a lot of our different application build scripts, so that we don't repeat logic. So it is not simple NAnt code, and not simple build scripts. There are dozens of NAnt files that come together to execute a build. Lately I've been dissatisfied with NAnt for a couple reasons: (1) it's syntax is just awful - programming languages on top of XML are really horrific to maintain, (2) the project seems to have died on the vine; there haven't been a ton of updates lately and it seems like no one is really at the helm. Trying to get it working with .NET 4 has cause some pain points due to this lack of activity. So, with all of that background out of the way, here's my question. Given some of the things that I want to accomplish based on that list above, and given that I am primarily in a .NET shop, but I also need to build non-.NET projects, is there an alternative to NAnt that I should consider switching to? Things on my radar include Powershell (with or without psake), MSBuild by itself, and rake. These all have pros and cons. For example, is MSBuild powerful enough? I remember using it years ago and it didn't seem to have as much power as NAnt. Do I really want to have my team learn Ruby just to do builds using rake? Is psake really mature enough of a project to pin my portfolio to? Is Powershell "too close to the metal" and I'll end up having to write my own build library akin to psake to use it on its own? Are there other tools that I should consider? If you were involved with maintaining a .NET portfolio of significant complexity, what build tool would you be looking at? What does your team currently use?


title: Architecture(structure)-oriented vs. feature-oriented project structure

text: The project, I have involved, has an architecture-oriented project's file/folder structure:               Root     |____ Node1         |____ Event Handlers         |         |___ <all event handlers of project>         |____ Events         |         |___ <all events of project>         |____ Request Handlers           |         |___ <all request handlers of project>         |____ Requests         |         |___ <all requests of project>         |____ ...      It is a clear from the architectural point of view of system (has been proposed by development team). It is a feature-oriented structure has been proposed by designer team:               Root     |____ Feature #1         |____ Event Handlers         |         |___ <all event handlers of Feature #1>         |____ Events         |         |___ <all events of Feature #1>         |____ Request Handlers           |         |___ <all request handlers of Feature #1>         |____ Requests         |         |___ <all requests of Feature #1>         |____ ...      This variant is closer to designers and it describes clearly a feature to be implemented. Our teams have started a holy war: what is the best approach. Could somebody help us and explain cons and pros of the first and second ones. Maybe there is a third one that is more useful and beneficial for both of us. Thank you.


title: How to represent one special related record

text: I have two tables, `project` and `photo`. `photo` has `ID`,`projectID`,`path` : each `project` has multiple `photo`s. Now one of these `photo`s is the one that has to be displayed. The question is how to represent this in the database. Earlier, I used descending order of `ID` numbers and chose the latest one, but that failed and caused problems. Now I am not sure which way to go :   * Create a new table `projectPhotoDisplayed` that holds `project`.`ID` and `photo`.`ID`(those that are to be displayed only) numbers.   The bad : too much work, as well as replicating the information that `photo` table already has (`photo`s associated with `project`s ).   * Create a new binary field in the `photo` table. If true, then display, else not.   The bad : Structurally does not prevent multiple `photo`s being marked to display. I want radio button behavior   * Create a new field in the `project` table that stores the `photoID` of the `photo` to be displayed.   The bad : Does not ensure that the particular `photoID` is actually linked to this `project`. Also does this information belong here?   * Any approach with foreign keys so that referential integrity is maintained..? Using PHP and MySQL InnoDB database, though I'm sure it won't matter. Which is the best way to store this info?


title: Building a Java CMS - What Existing Product Should I Use?

text: I'm a Java developer and in need of a CMS. I've spent a lot of time reading about, and tinkering with Liferay but am concerned that it doesn't cover two of my **three major concerns**   * I need to have many sites with individual domains   * HTML/CSS designers need to be able to design the website templates, look and feel, and layouts in their own tools without having to worry about writing scripts   * Site and page building APIs must be understandable so that a custom builder interface can be created and harness the CMS as opposed to hacking it Liferay nails the first bullet point, but the second two appear to be unsolved. Does anyone have experience with a Java CMS that does all three? Or have any idea how to approach the problem if none exists? Has someone has used a Java CMS and has been able to add this functionality give some insight?


title: HTTP Session: A single object or multiple?

text: I tested two approaches to store session data:   * The classic: 1 key, 1 object (And every key as `static final String` in a class) > "user" --> UserObject > > "preferences" --> List > > ...   * An approach with only 1 object  > "sessionObject" --> SessionObject And my `SessionObject` contains `UserObject` and the list of preferences as attributes. This is a fairly simple example but imagine it with 20+ attributes. The advantage I see in the second approach is that :   * You only have to delete one key to ensure session is empty   * You don't have to create the bothersome set of `final static String` to create the keys   * You'll know what type of object to retrieve (Using key you have to `cast`) Do you see any problem I might went over? Or does anything go against best practices?


title: Is there a good resource to see clear language comparisons. E,g: Scope in C++ vs Javascript

text: When I am learning a new language, I often don't need much more then simple comparison to languages I already know. For example each language uses its own Scope rules and Dynamic vs Static typing etc... Is there a good way to keep track of it? Are there good organized resources for finding out this information? I find that going through 500 pages of a book when 10 pages would suffice is very inefficient.


title: Protect Database Design - SQL

text: Perhaps a bit of an odd question but I can't think of a way to achieve what I want. I produce a product which ends up installed on-site at clients premises. It is a business critical and high availability application, and has to handle processes very quickly. While obviously most of the work goes into the actual application (Windows Services) part of the reason why the product is so good is intelligent database design. Until recently I usually provided the servers and I was the only person to have access to the database and SQL Server instance. However more recently customers have asked to run the application on their production server, usually VMWare, and use their SQL Farm for the database. This is fine for the application, however I am worried about who will have access to the SQL server and if they would be able to have a poke around in my application's database. Is there anything I can do to prevent access to it? Or is it a case of if they're hosting it there is nothing I can do? Thanks EDIT: If I am hit by a bus, company folds etc. there is an escrow agreement which will give them the source code of everything they need. As to why I am worried I have seen examples in the past of people making changes to data tables and reports, and no they did not have the nous to do so. This meant that someone had to go in and fix everything, while of course we charge for this I was wondering if there was a way to avoid it all together, or at least minimise the risk.


title: Customizing configuration with Dependency Injection

text: I'm designing a small application infrastructure library, aiming to simplify development of ASP.NET MVC based applications. Main goal is to enforce convention over configuration. Hovewer, I still want to make some parts "configurable" by developpers. I'm leaning towards the following design:               public interface IConfiguration     {         SomeType SomeValue;     }          // this one won't get registered in container     protected class DefaultConfiguration : IConfiguration     {         public SomeType SomeValue { get { return SomeType.Default; } }     }          // declared inside 3rd party library, will get registered in container     protected class CustomConfiguration : IConfiguration     {         public SomeType SomeValue  { get { return SomeType.Custom; } }     }      And the "service" class :               public class Service     {         private IConfiguration conf = new DefaultConfiguration();              // optional dependency, if found, will be set to CustomConfiguration by DI container         public IConfiguration Conf { get { return conf; } set { conf = value; } }              public void Configure()         {             DoSomethingWith( Conf );         }     }      There, the "configuration" part is clearly a dependency of the service class, but it this an "overuse" of DI ?


title: How can we maximize our value and get paid?

text: I live in Hong Kong. I just heard one of my friend who studies English in university, just graduated and found a job of 20k HKD as a teacher for English. I started my career as a programmer with 10k HKD salary, and after a 1/2 year, it is raised to 11.5k HKD. I got my Computer Science degree. I don't understand why there is a gap so big between different types of jobs. I don't have any ideas about how to change my job and quit to be a programmer. My question is, can we maximum my value quickly so that my salary can be raised to a similar range, respective to other job such as: Teacher, Lawyer, Doctor?


title: Monitor aspect ratio; Does the difference matter?

text: So, I'm looking ordering myself a new development desktop soon and setting up a PROPER office environment by the end of this year. To boost productivity, I'm going to purchase three new monitors. I find that two just isn't enough when I'm debugging or doing something intensive. That said, I had something pointed out to me the other day that I never really noticed nor cared about before - _is the difference between a 16:10 and a 16:9 monitor noticeable when programming?_ Do you really miss those few extra lines, or is it something that you don't notice at all. I notice HP only seems to sell 16:9 monitors (as far as I have found). Is this becoming something of a new standard with the recent growth and cleaver marketing of of "HD 16:9"? **To summarize** : Has anybody made the switch from 16:10 to 16:9 (or vise- versa) and actually noticed the difference while programming?


title: reverse engineering js/html controls as part of development

text: I'm starting a project with a big client that has several websites across the world, and they want to integrate them into a single Sitecore codebase/structure. All good in principle, but there are certain navigation controls that we have to use but, due to organizational complexities, _we don't have the other sites sources available_ (not that they don't have it somewhere, just that our team will have a difficult time getting a hold on it). So we are left with the task of going site by site (each site is in a different language), looking at the navigation controls, and more or less copy html and js and use that. Something that doesn't sound impossible, but i've never tried to do this before and i feel somewhat confused about how to go about this task. **Edit** to reiterate, we aren't concerned about translations nor do we want to grab the display text from the other sites, what we are after is obtain the controls code so we can use it locally. And with code i mean html/css and js. The controls need to look exactly the same as those already on production Do you have any general or concise recomendations to offer?


title: What is the best practice for designing a system supporting many languages, 1 central dictionary for all languages or seperated dictionary?

text: I want to build a system which uses dictionary of many different language. There are 2 options: Build 1 central dictionary `Table` & each language is identified by `langType` (ex 1 for German & 0 for English):               CentralDict     word - meaning - langType     car  - ....    - 0     auto - ....    - 1      or 2 separated Tables               EngDict     word - meaning     car  - ....           GerDict     word - meaning     auto - ....      If the option is 2, then when do the coding               String DictTable="";     String locale=getLocale();     if ("gm".locale){        DictTable="GerDict";     }     else if("en".locale){        DictTable="EngDict";     }      Then when we query from               String sql="select * from "+DictTable;     //access data from table here      If option 1 is selected,                   int langType=0;         String locale=getLocale();         if ("gm".locale){            langType=1;         }         else if("en".locale){            langType=0;         }         String sql="select * from CentralDict where langType="+langType;         //access data from table here      I am guessing the 2 option is more elegant, but not sure I am right? With option 2 we can create a 1 to 1 relationship between 2 languages easily. Note: It is not the internationalization issue as my system can handle internationalization very well. While internalization deals with text of the Gui like the text of the button or the message info, it does not deal with the data that was pulled out from DB. My Dictionary System helps user to see the explanation terms such as "car", "phone".... for teaching purpose. Currently, it works fine in English language, but I want to support German & many be French or any other languages in the future. I don't know whether I should create a complete separated table for each language or I just need 1 centralized dictionary for all languages & has a `langType` field for identifying the language that need to be used based on the user requirement. Ex: WHen user enters `mydomain.com/locale=de` then the system will show the exact Gui ( as in English) but all the text of the Gui will be in German. Also when user searches for data , it should pull out the German data from DB. not English data.


title: Big project with many external libraries - source code organisation

text: I was wondering what is the best way to organize my source code. I was researching on SO and found http://stackoverflow.com/a/1398594/137261 but this source code layout is library specific and doesn't cover my situation. **My situation:**   * 10 own modules (100k lines of code)   * 15 external libraries (e.g. boost, sqlite, zlib, etc.)   * 2 critical modules have to be available for selected developers only (maybe separate git repos ?)   * project is multiplatform (Linux and Windows)   * Git as version control system   * cmake used to build project **Question:**   * does it make sense to incorporate all libraries into my project e.g. in _3rd_party_libs_ folder ?   * how to handle lib include paths in my modules (environmental variable, relative paths, git submodules, etc. ) ?   * should I always build external libs from source or just use their binaries ?


title: Setting up Clojure Project And Sub Projects

text: This is primarily a lein question about setting up a major project and its sub-projects, and is not intended to be a discussion question. Instead, I am interested in either a pointer to documentation or to a Clojure/lein best practices link. I have a municipal property assessments application that splits two master flies into different subset files, depending on whether a billing transfer is taking place or we want to batch update new accounts, rather than making our assessment department enter new accounts once in their system and then again in the tax collection system. My application is going to be large enough, that I can see a common library lein project with support functions, like splitting apart the files, and then individual lein projects that use the common library. Should the lein projects be set up at the same level and support included through the project.clj/core.clj files? Is there an advantage to creating `lein new` projects underneath a major project? Is there a problem with combing all functions in one project? I can probably make my one core.clj contain all flavors of the program, but coming from a C/C++ and Python background, I would prefer to have a lot of little projects.


title: Recommended ways for getting a good grasp of inherited software

text: So you've inherited a large codebase that you need to make substantial changes to and you wish to get a pretty complete understanding of the software before starting. Would you diagram it? If so, which tool do find most suited for a large codebase? Ideally I'd want expandable nodes representing major concepts in the flow that could be drilled down into for a sub-concepts, and sub-sub-concepts. Preferably UML based, but not essential. Are there decent automatic source diagramming tools, in particular, PHP->UML?


title: What is wrong with the Unlicense?

text: I have often heard that I should not use the Unlicense because of issues regarding putting things into the public domain. However, I do not understand why this would be an issue for the Unlicense. The Unlicense attempts to put whatever is being unlicensed into the public domain, and if that works, awesome! However, the author of the Unlicense understands that putting something into the public domain is not so simple, it may even be impossible, and therefore the Unlicense contains a backup clause (the 2nd paragraph) which clearly states that everyone is free to do whatever they want with the Unlicensed software. The Unlicense even includes a disclaimer containing the usual "this software is provided as-is blah blah" legalese. Is the Unlicense bad because it is short and doesn't define who the "unlicensor", the "unlicensee" and Santa Claus is? If yes, then what about the MIT/BSD-style licenses? They are generally considered to be valid, so why isn't the Unlicense? Is the opposition to public domain waivers with permissive license backup clauses, such as the Unlicense, and even the Creative Commons CC0, just FUD or are there really major legal issues with them? Here is the full text of the Unlicense: > This is free and unencumbered software released into the public domain. > > Anyone is free to copy, modify, publish, use, compile, sell, or distribute > this software, either in source code form or as a compiled binary, for any > purpose, commercial or non-commercial, and by any means. > > In jurisdictions that recognize copyright laws, the author or authors of > this software dedicate any and all copyright interest in the software to the > public domain. We make this dedication for the benefit of the public at > large and to the detriment of our heirs and successors. We intend this > dedication to be an overt act of relinquishment in perpetuity of all present > and future rights to this software under copyright law. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN > ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > > For more information, please refer to http://unlicense.org/


title: How to Gauge Junior Developer Knowledge

text: I've started mentoring a junior developer. I've read the community wiki on how to mentor and have been following many of the suggestions in there. The developer has a couple years experience, mostly with modifying existing programs or transitioning code from our legacy system to our new system (a lot of cut and paste). I'm teaching her about our infrastructure which has much more complex programming inside of it, eg: reflection, pointers, multi-threading, dynamic objects. Once I have explained to her what needs to be done she is able to write working code, usually copying similar code and modifying it. I'm concerned that she doesn't understand why or how the code is doing what it is doing. When I ask her to explain the code to me she usually paraphrases the requirements that I originally gave her. So my question is: how can I measure how well she actually understands the business logic and programming structures being used? What should I be asking, what should I be looking for?


title: Which approach to follow for developing applications targeting multiple platforms?

text: For applications targeting multiple platforms, I see mainly two development approaches-   * Go for some JAVA-like development platform. Have one code solution and let the intermediate runtime handle different platforms. If something goes wrong in any platform, tweak the code a bit. But keep it same for all.   * Make modular code separating core logic and UI. Develop separate UIs for respective platforms which will be calling same core libraries. Build the application separately for each of the target platforms. So, which one to follow? I know, the answer will start with " **It depends** ". But I want to hear your opinions on these approaches and the factors to be considered to choose any of them.


title: Are web designers programmers

text: > **Possible Duplicate:**   >  Is a Front-End Web Developer a "Programmer"? Is it accurate to classify web designers as programmers? Should they be classified as such?


title: What ever happened to the Google AJAX Search API

text: I am looking to query the main Google search however all references including stackoveflow point to the Google AJAX Search API. The odd thing is that it does not seem to exist any more not even a note to say it is depreciated? The old links point to main Google code site. If I look at the list of API's on that site the API it replaced is there Web Search API (Deprecated) which links back to same page but not the Google AJAX Search API. Further Google searching is not being helpful either, many blog posts pointing to the same Google site (http://code.google.com/apis/ajaxsearch/) that has no content and redirects to the same place? Just to prove it did exist I have found it on the way back machine however the last snapshot did not show any special unusual message.


title: Does it make sense to write tests for legacy code when there is no time for a complete refactoring?

text: I usually try to follow the advice of the book _Working Effectively with Legacy Code_. I break dependencies, move parts of the code to `@VisibleForTesting public static` methods and to new classes to make the code (or at least some part of it) testable. And I write tests to make sure that I don't break anything when I'm modifying or adding new functions. A colleague says that I shouldn't do this. His reasoning:   * The original code might not work properly in the first place. And writing tests for it makes future fixes and modifications harder since devs have to understand and modify the tests too.   * If it's GUI code with some logic (~12 lines, 2-3 if/else block, for example), a test isn't worth the trouble since the code is too trivial to begin with.   * Similar bad patterns could exist in other parts of the codebase, too (which I haven't seen yet, I'm rather new); it will be easier to clean them all up in one big refactoring. Extracting out logic could undermine this future possibility. Should I avoid extracting out testable parts and writing tests if we don't have time for complete refactoring? Is there any disadvantage to this that I should consider?


title: RESTful composition/inclusion of other resources

text: I have a few HTTP resources, and i'm wondering if including the models of one in the other is acceptable or if there is a cleaner method. In this example, we have a ton of "news" resources, and users can subscribe via a resource called "subscription":               ==>/news-items/{id}/     {         "id": 987,         "url": "http://example.com/foo/bar",         "title": "Wow! A Headline",     }      And               ==> /users/{user-id}/subscriptions/     [         {              "id" : 123              "keywords": "Mr Celebrity"         },         ...     ]      And then the endpoint that includes the models of both resources ...               ==> /users/{user-id}/my-news/     [         {             "id": 987,             "url": "http://example.com/foo/bar",             "title": "Wow! A Headline",             "matched_by": [                 {                     "id": 123,                     "keywords": "Wow",                 },                 ...             ]         },         ...     ]      The usecase is fairly self explanatory for this: A feed of news with 'matched by "Mr Celebrity"' next to it. It feels a bit weird to have an endpoint that consists only of nested/composite models from other endpoints ... Is this acceptable practice or problematic? The endpoint will be read-only, and the other options seem to be:   1. HATEOAS-style: "matched_by" and the news item are URLs pointing to a news item and subscription. Would require more HTTP requests.   2. Some kind of multi-payload response with a HATEOAS primary payload then 'related' payload of the referenced resources. Not seen this done before.   3. ??? some other options? If my approach is sound, great, but I want to hear what others would do if there is a better alternative. Thanks :)


title: Python - Importing modules and visibility

text: Consider the following code: a.py               import os          def print_rand():         print os.urandom()      And another module: b.py               from a import *      In this code, I end up with an `os` variable getting imported from `a`. I could prevent this with a small change: a.py               import os as _os          def print_rand():         print _os.urandom()      Since `from a import *` does not pick up on members beginning with an underscore, `b` wouldn't import the `os` module from `a`. I've thought about doing this in some of my code. I never use `import *`, but logically, it makes some sense anyway. (Not to mention I don't work alone on my code.) `os` is a member that `a` uses internally; it's not there to be exposed to the outside world. (Yes, I'm aware that it can be accessed anyway, but I just mean in the sense that the underscore conventionally means "private".) Is this something I should do? Would it be considered "Pythonic", or is it something I should particularly avoid doing? Does it even matter? (Should I have asked on StackOverflow? It seems too conceptual for there to me.)


title: How can I create my own software license?

text: I have seen numerous licenses for any kind of software such as the GNU GPL, BSD License, MIT License, and LGPL. What is the process for creating a new software license, such as "John Doe's generic license"?


title: Re-inventing system design for Scala

text: Many, many, moons ago, I did my masters in Object Orientated Software Engineering. I covered everything: project initiation, requirements, analysis, design, architecture, development, etc, etc. My favourite IT book of all time was Developing Object Oriented Software, an Experience Based Approach (IBM-1996). A book created by a group of true experts of their time. It describes a work product centric approach to object oriented analysis, design and development methods. I designed and developed and was happy and at the top of my game, but I started to feel a little dated: Agile movements became fashion of the day and re-branded some well known iterative and incremental approaches with new hip words. Suddenly inexperienced developers started frowning when I said "requirements" or "architecture" as if these things were superseded by magic. Design and development lost it's fun and I was about to leave the whole IT industry behind me. Then I discovered Scala. Oh, like soft rain on a dusty road. Everything just became clear, the air became sweet again and the little light of my hard-drive would flicker deep into the night, merrily keeping me company in my world of discovery. I like system design. I'm an architect at heart, more than a programmer. I love analyzing, designing, thinking, arguing, improving - I just love simple, clean and crisp designs. **How do we design pure Scala solutions?** Surely conventional sequence diagrams, interaction diagrams, object diagrams, etc, could all be replaced or improved for the goodness of blending imperative and functional object orientated systems. Surely there is an opening for something totally different! I'm not looking for bloated complexity - I'm looking for flexible simplicity. Much like Scala is actually simple and easy (albeit different), but can be extended to fit your requirement like a pair of Yoga pants. There must be a design system for this lovely language that will start simple, and can be extended to fit your requirements and your domain. Surely UML can not be it! So how do we design pure Scala systems? Imagine for a moment, you have the luxury to design a complete system from scratch, and know that you will only be using Scala - _How will your models look?_ What types of diagrams would you have to describe structure and behaviour? How would you model Options, matches, mixins, singleton Objects, etc. without being drawn into the complexity of extending existing modeling techniques rather than a fresh, light-weight, innovative tool-set. _Does such a design/process/solution exist_ , or **is it time to invent one?**


title: How to handle onsite interviews with multiple companies?

text: I currently live in Thailand now. I have done phone interviews with few companies in San Francisco and passed all of them. Now the problem is I have onsite interviews with 3 companies, and they are willing to pay for the flights and the hotels. I have no idea what to do right now. I don't want to fly back and forth between Thailand and San Francisco 3 times. I believe I have 2 choices:   1. Lie to the first company that I want to do sight-seeing for some days, and ask them to move the flight back a little bit further.   2. Tell the HR directly that I will have an interview with other companies as well, and ask the first company to pay for the flight to SF and the second company to pay for the flight back to Thailand. (The third company gets a free pass) The flight between Thailand and San Francisco should cost like 1,500 dollars. (round-trip) What should I do?


title: ternary operator usage within IF brackets

text: could you please help me understand this ternary operator               public static <E> void replace(List<E> list, E val, E newVal) {         for (ListIterator<E> it = list.listIterator(); it.hasNext(); )             if (val == null ? it.next() == null : val.equals(it.next()))                 it.set(newVal);     }      i thought the part after ? is just a regular statement, so how is == being used here?


title: Include ignored file in the git repository

text: Suppose I'm setting up a website, and there are loads of images. These images won't change. But I would like that when any members of the team clone the project, they get the images so that they run the website immediately. Does this mean that I should add track the images as well? I'm just taking an example, it could be a jar in a java project or something else.


title: What is each time through a loop called?

text: while ( true )     {         // what is each time through this loop called?     }


title: finding lowest cost path - dynamic

text: I have to write a dynamic algorithm for finding lowest cost path. So I have a points that I have to visit. I can jump only between points by distance - 5 I have an array of distance from 0-point for example (1 3 5 10 15 20 21 22). Each move cost me 1. So the best path will be to move 1->5->15->20->22 (3 and 21 I can skip). Can you guys give me so hints, how to program it dynamicly? I was thinking to make something like this: Find the solution for array[0] and array[1] (that's easy there is only one solution from to 1 (1->3)) then add array[2], and find the best solution(1->5 also there is a solution 1->3->5 but that's gonna cost me 2 moves) then for 4 points, 5 etc. But don't know how to start to make my algorithm to be written correct and dynamic. I know I can make greedy algorithm, but that's not the point of the task... Can you give me any hints? How to start? How to keep solutions? and find the best ones?


title: Windows Mobile Interview Question Categories

text: I need to set categories for interviewing candidates for Windows Mobile Development. Like for ASP.NET, we can have   1. OOPS    2. .NET Framework (CLR, BCL, MSIL etc)   3. Javascript, jQuery   4. Data Controls    5. ADO.NET   6. SQL Server For Windows Mobile, which are categories that should be included? Being specific to our current product, it has not UI and will run in background. Security is the first thing to take into account. It is a SPY kind of application that will keep track of user activity. It can be used by companies to monotor their employees.


title: Why does Microsoft have such a bad reputation with the people involved in open source?

text: Are there any particular incidents which are responsible for the low reputation Microsoft (and Bill Gates) has in the eyes of the open source community? Microsoft is clearly not the only proprietary company. Companies like Apple have done a lot worse when it comes to restrictions on software. Why does Microsoft get most of the hatred from the open source community?


title: Overloading Methods With Different Behavior - Style

text: I have a style question about overloading methods/constructors. I have a constructor which does something very simple, and then calls a method with some side effects. Sometimes however I don't want the side effects so I made a separate overloaded constructor. I show two versions here. Version 1 is simple: if I pass any bool then TrickyFunction won't be called. But maybe that's confusing, because the value of no_tricks does not affect the behavior (only that no_tricks exists). Version 2 actually does process no_tricks and makes a decision to run TrickyFunction based on that. Which version, or another version, is more stylistically "correct?"               public foo MyFunction(string a)     {         variable = a         TrickyFunction(a)     }          #Version 1     public foo MyFunction(string a, bool no_tricks)     {         variable = a     }          #Version 2     public foo MyFunction(string a, bool no_tricks)     {         variable = a         if (notricks == true)         {             TrickyFunction(a)         }     }


title: Should IoC container be part of portable library?

text: I am seeing the benefits of Portable Class Libraries for centralizing Models and ViewModels to a single code-base. Where should dependency injection management (IoC container) take place, though? My Models have dependencies that I believe would benefit from being supplied through injection. I'm not sure how to go about "bootstrapping" to set up the container in the portable library, and I also saw some suggestions that a portable library shouldn't have a dependency on a DI framework. Those points have me thinking maybe the DI should be set up in the applications that use my portable library. This seems rather backwards though, requiring someone using the library to add the bootstrapping portion to their application, as well as it would be duplicated in every app that uses the library. **Should the library or the application handle DI?** Some specifics on what my environment in question is like: c#, WPF application referencing PCL with Models, ViewModels and core logic. Considering using Autofac for my IoC container.


title: Programming conundrum - most efficient path

text: I have a non-language-specific problem which I'm having trouble finding a workable answer for. I have a 10x10 grid containing integer values from 1-10. Each value represents the cost of travelling across that square, moving north, east, south or west (cost is incurred while stepping off a square rather than onto it). I need to find a method to navigate the cheapest path from a starting square to an end point. I was using a recursive javascript function whereby each square could ask an adjacent square what the cost was if the journey went that way; the square asked would then ask its neighbours etc. until the cheapest route was found. However, as might be expected this takes far too long, even if each square was marked as busy so it couldn't be asked again (in order to prevent circular routes which might never end). I'm sure this must have been done before. Does anyone have a method they feel would work? Thanks for your help :)


title: Why is XML not called EML?

text: From Wikipedia > Extensible Markup Language (XML) is a set of rules for encoding documents in > machine-readable form. It is defined in the XML 1.0 Specification[4] > produced by the W3C, and several other related specifications, all gratis > open standards.[5] What are the historical reasons for calling the shorthand XML rather then the more natural EML?


title: How often do CPUs make calculation errors?

text: In Dijkstra's _Notes on Structured Programming_ he talks a lot about the provability of computer programs as abstract entities. As a corollary, he remarks how testing isn't enough. E.g., he points out the fact that it would be impossible to test a multiplication function f(x,y) = x*y for any large values of x and y across the entire ranges of x and y. My question concerns his misc. remarks on "lousy hardware". I know the essay was written in the 1970s when computer hardware was less reliable, but computers still aren't perfect, so they must make calculation mistakes _sometimes_. Does anybody know how often this happens or if there are any statistics on this?


title: Building a site with internalization support

text: When a user browses some page and then switches a language, then the following actions should occur:   * If there's a translation for a page he's browsing now, then do redirect to that page.   * If there's no translated version of that page, then do redirect to a home page. So for example, a user browses `/about-us` page then he switched to German language, then he should be redirected to `/uber-uns` if a translation of `/about-us` in german exists. Currently I have a structure like this,               CREATE TABLE `pages` (            `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT       `language` varchar(3),       `urlSegment` varchar(250),        `content` TEXT          ) DEFAULT CHARSET=UTF8;      What relationships/columns should be added to achieve that?


title: MVC & 3 tier architecture in game - What is the business layer

text: I am making a game and have been following examples which use the MVC architecture pattern. I am now trying to get my head around how this would fit in with a 3-tier architecture. From what I have gathered so far:   * MVC and 3-tier are separate ideas and are compatible   * MVC has a triangular communication structure, whereas 3-tier is a stack   * MVC can be used within the 3-tier structure, with the MVC parts contained in the UI layer as in the diagram:  ![MVC in 3-tier](http://i.stack.imgur.com/VsBMG.jpg) My Model for the game contains all the classes describing the abstract game world - all the items, characters, their positions and velocities in the world, the score, etc. But now what would constitute the business tier below this? As this is all the things I would normally associate with the business layer. Should the diagram in this case perhaps show the View and Controller in the UI layer, with the Model contained in the Business layer below them?


title: The fees/rates when hiring a company to assist you with programming

text: I work for a small development shop doing server and occasionally desktop apps for customers. We were thinking about developing a product and contacted two studios that have experience with what we like to do. One didnt get back to us. The other listed how many hours each features would take and at the end put a 15% fee for testing and 'unknown'. While this doesn't strike me as odd, their hourly rate is. They charge $150 USD. For 160 man hours we have a bill of 24k (USD). Some programmers make that amount in 6months, this company/person wants it for one month work. Now the programmers in my studio make about $35 an hour. If we put a guy on it, it MIGHT take us 4-5months which is roughly what our bill comes to be. But i still think its ridiculous. Is this standard? should i try to find another company? what should i do? What he is doing is specialized however the SDK required is well document and a microsoft product (so we have faith in the documentation, but its still specialized). The company is located in california. What are you thoughts?


title: Where to put variables needed across classes?

text: I have 3 classes: a JButton extension, FButton; a JTextField; and a JPanel extension, FPanel, that would contain one instance of both. The FButton is supposed to open a file, and make the file name and directory for the file available. The JTextField is meant to display the file name and directory provided by FButton. I figured FPanel should be the one containing the file name and directory. If I make FButton and JTextField private classes of FPanel, problem solved with public variables. How about if I want to separate them into a public FPanel class, a package visible FButton class, and a package visible JTextField class, within the same package? **How can I make the file variables available to all classes in the package?** Should I be doing it that way?


title: What Haskell interesting topics, tips, and examples I should not miss on my presentation?

text: I have to make a presentation about Haskell, and I'm looking for interesting Haskell examples, tips, and topics in general I should not miss in my presentation. The purpose of the presentation is to give a general idea about the language. I'm still writing what I'll say, but the following topics are already included:   * Lazy evaluation   * Ways of defining functions (pattern matching, lambda expressions, etc)   * Higher order functions and currying What do you think that **must** be explained when doing a talk about Haskell?


title: Will I be majorly disadvantaged learning Ruby with Rails version prior to 3?

text: I'm on a shared hosting account which runs cPanel, pretty standard unless you have your own VM. cPanel currently doesn't support Rails 3. My flat mate who has been working with ROR for the last year strongly suggests I set up my own development VM on my machine and learn ROR with Rails 3, and when it comes to putting stuff live on my hosting, work round any issues with Rails versions. I'm not 100% convinced by this, as I don't really want to maintain a local VM myself due to limited experience / time. I still haven't really started looking at ROR and have only done a few simple interactive on-line tutorials. What are your thoughts / feelings / suggestions on this? If I stick with my hosts version of Ruby and Rails, will I be at a major disadvantage when it comes to working in industry or should it not make a huge amount of difference? Background: I'm still a uni student.


title: Is there something like a polymorphic Singleton?

text: I have a resource loader object that loads objects from the disk or from a ZIP archive, depending on the platform. It has state (e.g. the path to the directory or the ZIP archive, and possibly some caching in the future), so it needs to be a single instance. So normally, a Singleton would do. But my problem is that this resource loader has multiple implementations, of which one is chosen at initialisation. So turning the resource loader into a Singleton won't do. All I can think of is to have a Singleton that holds a reference to the single resource loader. But isn't there a nicer pattern for this?


title: Resources for Novice Developer

text: I have a buddy who's expanding/overhauling a modestly successful web-based game that he runs. He's not exactly a newbie with the language it's written in, PHP -- he's been doing this for years. But he IS a novice when it comes to general software development principles. This is a one-man operation (so he doesn't have any superiors/co-workers to bounce ideas off of), and he's never had formal training or a day job as a developer. He'd like the overhaul to be more modular and use concepts like object- oriented programming (both to make the code base easier to maintain and because that stuff sounds really cool), but he's having some trouble with the basic concepts and how to apply them to his project. I'd like to help, but there's only so much one veteran nerd can do in his free time. What's the best on-line resource for something like this, a place where he could go to ask a lot of questions and get patient answers? StackOverflow.com is obviously not the best fit; he'll be asking a lot of questions that are, to a veteran, 101-level stuff, and having your questions closed/deleted as redundant/off-topic/not-a-real-question is discouraging as hell. If this guy was your friend, where would you send him?


title: Is there a rule of thumb for what a bing map's zoom setting should be based on how many miles you want to display?

text: If a map contains pushpins/waypoints that span only a couple of miles, the map should be zoomed way in and show a lot of detail. If the pushpins/waypoints instead cover vast areas, such as hundreds or even thousands of miles, it should be zoomed way out. That's clear. My question is: is there a general guideline for mapping (no pun intended) Bing Maps zoom levels to a particular number of miles that separate the furthest apart points? e.g., is there some chart that has something like: Zoom level N shows 2 square miles Zoom level N shows 5 square miles etc.?


title: Which industries use the most high-quality, measurable, reliable approach to software?

text: What sections of the software industry (i.e. healthcare, aerospace, games, etc) are most likely to practice software engineering with the engineering rigor + depth and breadth defined in the SWEBOK?


title: Is function overloading in general considered Evil?

text: Recently I found about two new programming languages(Vala and google's GO) which don't support method or function overloading and intend on not supporting them in the future ever! The creators of these languages say that overloading is evil and should not be used!(in system programming?) I was told that the creators of Go Language even say that ~~classes~~ inheritance are evil as well and Go doesn't support that! My question is: Are they really that bad that the new languages are omitting them? Or Is there a specific field of usage for that languages which makes them evil? What could be the disadvantage of using such facilities at all?


title: Ways to use your skills as a developer to give back to the community/charities

text: Recently I came upon a community event called GiveCamp. > GiveCamp is a weekend-long event where technology professionals from > designers, developers and database administrators to marketers and web > strategists donate their time to provide solutions for non-profit > organizations. Since its inception in 2007, the GiveCamp program has > provided benefits to over 150 charities, with a value of developer and > designer time exceeding $1,000,000 in services! Coming from a very rural part of the country where there is a huge opportunity for charity events like this, it got me wondering. Are there other large movements like GiveCamp that are out there? GiveCamp is sponsored by Microsoft, so of course most are run through .NET user groups. Are there other flavors of it? Different types? Java/Python/other open source charity movements? If not, how do you give back?


title: 'Other' Features in a programming language

text: Online (i cant remember where) i saw someone mention he wishes programming language has more built in features for tools like documentation and source control. Now i dont understand what needs to be built in for source control since tools like git (sorry but i dont have much experience with others) has everything i need and is very easy to use. Documentation i can understand, perhaps the ability to generate remote procedures calls from source to some kind of IDL would be cool. But really i dont understand what features a programming language can/should have that isnt tied with code generation and syntax (except the two i mention when it comes to libraries). What ideas do you guys have? What is your wishlist?


title: How to approach refactoring an existing web application?

text: I've been reading and thinking a lot lately, and I've come to the conclusion that I maybe I should rethink my web development strategy. I'm doing a lot of on-the-fly programming, and in the 2 years I've been working on a PHP web application, what might have begun as a little tool became quite the big project. But there is a ton of _legacy_ code from me and my predecessor, snippet of code that might have make sense at the time, but now I'm questioning the usefulness of said code in the form it is actually. Furthermore so such things like unit testing and Test-Driven Development wasn't in my scope until quite recently. So how would you approach refactoring the web application? What would be the things I should look for and in which order? What about browser game versus functional web app? Would there be then difference in the approach?


title: Where can I find good example of techniques to compact data in-memory?

text: I'm writing a Java framework to manipulate a large amount of data in-memory, where many "cells" that are near each other will have the same value. I'm looking for algorithms and/or techniques specially designed to eliminate those duplication _while maintaining fast in-memory read access speed_. That is, techniques that keeps an O(1) _read_ -access speed. My data is store in immutable objects, to allow fast multi-threading. The data itself can be anything, from 4 bits-per-cell to doubles to arrays of beans, etc.


title: Best approach for propagating errors in service access layer of a multiplatform mobile app

text: We've started working on a mobile app using Xamarin. There's a core library that is to be shared among Android and iOS apps. In the core library there will be several functions for communicating with a web service. I've had a discussion with my brother on what the best approach would be, we both have a different opinion, so we'd like to hear your views on the matter. And perhaps there's an even better approach we both didn't think of yet. The web service we talk to has some predefined HTTP status codes for certain errors. For example when performing verification of an account and information is incorrect, the web service could return a status code 400 and some other errors might result in a different status code. My approach was the following:               public async Task<string> VerifyAccountAsync (string email, string password) {             // prevent null values             email = email ?? "";             password = password ?? "";                  var queryString = String.Format ("/VerifyAccount?email={0}&password={1}", email, password);             var request = WebRequest.Create (_accountUrlString + queryString);             string result = null;                  try {                     using (var response = await request.GetResponseAsync ()) {                             using (var stream = response.GetResponseStream ()) {                                     using (var reader = new StreamReader (stream)) {                                             result = reader.ReadToEnd ();                                     }                             }                     }             } catch (WebException ex) {                     // a protocol exception means we got a response, but the status code implies some error occured.                     if (ex.Status == WebExceptionStatus.ProtocolError) {                             var httpResponse = (HttpWebResponse)ex.Response;                                  switch (httpResponse.StatusCode) {                             case HttpStatusCode.BadRequest: // 400                                     throw new DepotServiceException (httpResponse, "User could not be found.");                             case HttpStatusCode.InternalServerError: // 500                                     throw new DepotServiceException (httpResponse, "Some error");                             default: // TODO: use the response stream to set the error message.                                     throw new DepotServiceException (httpResponse, "Undefined error ...");                             }                                                                                } else {                             // some other exception occured, we'll just rethrow it (should not be ignored)                             throw ex;                     }             }                  return result;     }      My reasoning was the following:   * Since the web service uses some predefined status codes for certain errors, we should use a typed exception (DepotServiceException) to make it more clear for the consumer of the core library what's the origination of the error.   * Handling exceptions this way in the core library, will prevent having to use if/else constructions in the iPhone / Android visual layers. In the visual layer we won't have to check what the status code was, to show the appropriate error message. My brother's approach is the following:               public async Task<DepotServiceResult> RetrieveUrl(string url) {             DepotServiceResult serviceResult = new DepotServiceResult();             WebRequest request = WebRequest.Create(url);                  try {                     using (var response = await request.GetResponseAsync()) {                             var webresponse = (HttpWebResponse)response;                             using (var stream = response.GetResponseStream()) {                                     serviceResult.statuscode = webresponse.StatusCode;                                     using (var streamReader = new StreamReader(stream)) {                                             serviceResult.response = streamReader.ReadToEnd();                                     }                             }                     }             } catch (WebException ex) {                     serviceResult.errorDescription = ex.ToString();             }                  return serviceResult;     }               public async Task<DepotServiceResult> VerifyAccountAsync(string email, string password) {             var url = _urlBase + "api/account/VerifyAccount?email={0}&password={1}";             email = WebUtility.HtmlEncode (email);             password = WebUtility.HtmlEncode (password);                  url = String.Format (url, email, password);             return await RetrieveUrl(url);     }          public class DepotServiceResult {          public string errorDescription;          public HttpStatusCode statuscode;          public string response;     }      My brother prefers his approach because he doesn't want the core layer of the app to handle the error. He prefers to handle the error in the UI layer of the app. So for his approach he choose to create a `DepotServiceResult` object that contains the whole result of the operation, including errors if any occurred. Personally, I believe my approach is the best, though I have difficulty in explaining why it's the better approach. So if anyone would agree with me, could I get some solid reasons on why it's the better approach? Of course, my brother prefers his approach and if his approach is better, I certainly would like to hear good reasoning on why it's the better one. If there's an even better approach compared to our preferences, we'd like to hear it as well.


title: Website Planning Help

text: There are a lot of posts on this but I'm kinda looking for specific help, I've typed many different queries into Google but the majority of page returns seem to be dominated by beginner tutorials, planning, generators, and lots of other rubbish related information, It may have something to do with that fact that I'm rubbish at searching for content on search engines, but that's besides the point! I'm just about to endeavour on an adventure to create a pretty stylish looking, very functional, adaptable website. But I don't want to miss anything out. Its happened too many times where I've come up with an idea, planned, planned, designed, implemented, then realised I've missed something, or something's wrong and I've had to turn the website on its head in order to compensate. Im sure other people have had similar situations. My Question is: What is everything I need to consider before actually coding my website? I'm talking from coding standard, implementation, design aspect,abstract point of view. Currently, I have:   * designed the look of the website.   * Made storyboard like diagrams for every page, action, event.   * invented content.   * designed a style guide.   * mapped animation.   * modularised my functions.   * considered audience.   * considerend diversity (including cross-browser compatibility, screen resolution and font size)   * created a nice directory       AND FINALLY...   * have included my frameworks (css reset, jQuery, images, wordpress, etc) Is There anything else? What am I not considering? I just wanted to make sure I've covered every aspect before I sit down (with my brand new coffee machine) and code like a fairy on crack. If anybody has come across any worthy articles... Please share. But please, no "how to make a website" beginner articles. Purely in the context of the question. Personal preferences and responses are preferred! What planning/design steps do you take before embarking on a monster website mission? Thank you for reading this long ~~ASS~~ boring question Alex