title: Could developers learn anything from studying malware?

text: Malware uses interesting techniques for hiding themselves from anti-malware software and more. They can "polymorph" themselves: practically change the code while it continuing to mean pretty much the same to the executing machine, making antivirus definitions invalid etc. I wonder if there is anything (non-malicious) developers could learn from studying the source of such, or reversing them and studying whatever you get from that process if the source isn't available, that could be useful outside this (dark?) realm. **I am _not_ interested in writing malware.** (at least not for non- educational purposes) This question isn't meant to be a question about how to write malware or such, but what you could learn from already written malware. Also, maybe a bit unethical (I hope not), would there be any gains from writing your own piece of malware, just for better understanding of vulnerabilities/exploits/security, or the underlying operating system?


title: Comparing features in a asp.net web application using different database methodologies

text: I have a webstore which sells components (it is a academic project) which looks like this. I have developed the same web application using following database methodologies:   1. MS Sql Server with Stored procedures and sql data reader   2. LINQ to Sql   3. DB4o using LINQ (Client/Server) What features can I compare apart from the technical and theoretical details between relational database and object oriented database ? It is my graduate/master's thesis final project. I want the features that i want to compare to be more practical and interesting so that I can draw some concrete and meaningful conclusions rather than abstract comparisons which don't create much interest and hard for inference. Please help me.


title: Private Repository Management for Potential Employers

text: I have some projects that I do not wish to be viewed publicly (some of them are school course work), but I want to show them to my potential employers. Ideally, I would be able to generate some bit.ly-like links that expire after certain period. I am guessing I can do this with Dropbox's public link where I put the link to the code on the resume and then I delete the folder after some time via `crontab`, but I am wondering if there are better options. I do have accounts on github and bitbucket.


title: Tips for a solo programmer's resume

text: **Short version:** I've been a solo programmer for 5 years, right out of school, and am looking to for resume tips as I aim to get a job with a larger, well structured company. **Long version:** I am a 26 year old who graduated in CS in 2007. I had an internship for a small company starting in 2006, and still work for them to this day. I'm looking to work for a larger company for reasons beyond the scope of this post. During this time I was the only programmer, and designed/coded/maintained four .NET applications for various industries. Those four projects kept me very busy. My applications have happy customers, they work well and look nice. I realize that being a solo developer has given me some strengths and some weaknesses compared to my peers.   * My strengths are that I can self educate well, and I've suffered the consequences of mistakes firsthand, so I can give VERY good reasons why I do things the way I do.   * My weaknesses are that I've lacked a mentor, and the missed opportunities to learn from him/her. I also lack team work with programming. I worked closely with other technical people, and had my own SVN/TFS servers, but never worked closely with other programmers, delegated orders, or really had a specific role other than "do everything." I realize that the teamwork is a crucial component of a mature developer. So now, some questions about a resume and/or interview:   1. Should I be up front about being on a lonely island of programming so long?   2. When listing my projects in a resume, since I was a solo dev should I describe the projects in great detail, and say that I did everything rather than say "I did xxx, yyy, zzz"?   3. My current employer has web pages with videos/screenshots of my software in action, should I link to them?   4. Do you think my strengths make up for my weaknesses and leave me > 0?   5. Any other tips?


title: When is it okay to reassign the model for a view in MVC?

text: Is it ever really acceptable to reassign the model for a view in MVC? (Or MV* where applicable.) In other words, for a single view instance, is it ever ok to reassign the view's model? That is, as opposed to using setters (mutators) on the model so that it does not have to be reassigned. Under what conditions (if any) is this acceptable MVC design? Here is an example in JavaScript, but the question is language-agnostic.               var Model = function (m) {         var message = m;         return {             getMessage: function () {                 return message;             },                  setMessage: function (m) {                 message = m;             }         };     };          var View = function (m) {         var model = m;         return {             render: function () {                 alert(model.getMessage());             },                  setModel: function (m) {                 model = m; // hmm, is this okay?             }         };     };          var model1 = new Model('hello world');     var view = new View(model1);     var model2 = new Model('hi there');     view.render();     view.setModel(model2); // reassign model     view.render();     model2.setMessage('hi again'); // mutate model via setter     view.render();      In the line `view.setModel(model2);`, the model is reassigned (the approach in question). In the line `model2.setMessage('hi again');`, the model is instead mutated via its own setter, which in my view seems generally preferred. One of the main drawbacks I can see to model reassignment is that it could complicate attempts to reuse the model elsewhere in the application. In some MVC applications a single shared model could be used to drive multiple views (e.g. list, editor, and display views of the same data), in which case model reassignment would be problematic -- it would at least require the added complexity of communicating the model reassignment to dependent views. Here I think the DRY principle trumps the no-mutators principle. (Open to argument here.) Can an even stronger case be made? To recap, under what circumstances might model assignment be acceptable, if any? Perhaps in certain languages, under extreme performance constraints...? Is _"do not reassign models"_ a good rule of thumb? A pointer to an authoritative source or real-world situation would be helpful.


title: What is the wireframe of a project?

text: What is the actual meaning of a wireframe of a project?


title: How can I design my classes to include calendar events stored in a database?

text: I'm developing a web calendar in php (using Symfony2) inspired by iCal for a project of mine. At this moment, I have two classes: a class "Calendar" and a class "CalendarCell". Here you are the two classes properties and method declarations.               class Calendar     {         private $month;         private $monthName;         private $year;         private $calendarCellList = array();         private $translator;              public function __construct($month, $year, $translator) {}                             public function getCalendarCellList() {}              public function getMonth() {}              public function getMonthName() {}              public function getNextMonth() {}              public function getNextYear() {}              public function getPreviousMonth() {}              public function getPreviousYear() {}              public function getYear() {}              private function calculateDaysPreviousMonth() {}              private function calculateNumericDayOfTheFirstDayOfTheWeek() {}              private function isCurrentDay(\DateTime $dateTime) {}              private function isDifferentMonth(\DateTime $dateTime) {}     }          class CalendarCell      {         private $day;         private $month;         private $dayNameAbbreviation;         private $numericDayOfTheWeek;         private $isCurrentDay;         private $isDifferentMonth;         private $translator;              public function __construct(array $parameters) {}              public function getDay() {}              public function getMonth() {}              public function getDayNameAbbreviation() {}              public function isCurrentDay() {}              public function isDifferentMonth() {}     }      Each calendar day can includes many calendar events (such as appointments or schedules) stored in a database. My question is: which is the best way to manage these calendar events in my classes? I think to add a eventList property in CalendarCell and populate it with an array of CalendarEvent objects fetched by the database. This kind of solution doesn't allow other coders to reuse the classes without db (because I should inject at least a repository services also) just to create and visualize a calendar... so maybe it could be better to extend CalendarCell (for instance in CalendarCellEvent) and add the database features? I feel like I'm missing some crucial design pattern! Any suggestion will be very appreciated!


title: What should take precedence: YAGNI or Good Design?

text: At which point should YAGNI take precedence against good coding practices and vice versa? I'm working on a project at work and want to slowly introduce good code standards to my co-workers (currently there are none and everything is just kind of hacked together without rhyme or reason), but after creating a series of classes (we don't do TDD, or sadly any kind of unit testing at all) I took a step back and thought it's violating YAGNI because I pretty much know with certainty that we don't require the need to extend some of these classes. Here's a concrete example of what I mean: I have a data access layer wrapping a set of stored procedures, which uses a rudimentary Repository-style pattern with basic CRUD functions. Since there are a handful of methods that all my repository classes need, I created a generic interface for my repositories, called `IRepository`. However, I then created a "marker" interface (i.e. interface that doesn't add any new functionality) for each type of repository (e.g. `ICustomerRepository`) and the concrete class implements that. I've done the same thing with a Factory implementation to build the business objects from DataReaders/DataSets returned by the Stored Procedure; the signature of my repository class tends to look something like this:               public class CustomerRepository : ICustomerRepository     {         ICustomerFactory factory = null;              public CustomerRepository() : this(new CustomerFactory() { }              public CustomerRepository(ICustomerFactory factory) {             this.factory = factory;         }                    public Customer Find(int customerID)         {             // data access stuff here             return factory.Build(ds.Tables[0].Rows[0]);         }     }      My concern here is that I'm violating YAGNI because I know with 99% certainty that there is never going to be a reason to give anything other than a concrete `CustomerFactory` to this repository; since we don't have unit tests I don't need a `MockCustomerFactory` or similar things, and having so many interfaces might confuse my co-workers. On the other hand, using a concrete implementation of the factory seems like a design smell. Is there a good way to come to a compromise between proper software design and not overarchitecting the solution? I'm questioning if I need to have all of the "single implemenation interfaces" or if I could sacrifice a bit of good design and just have, for example, the base interface and then the single concrete, and not worry about programming to the interface if the implementation is that will ever be used.


title: Effective team meetings

text: I'm a team leader of a team of 8 programmers in a company of about 20 technical people. They're working on a range of projects, these projects also involve people from other teams that are outside of my control. My organisation is not doing proper agile development, and they're somewhat resistant to change, but I've been holding daily stand up meetings within my team and we've all been finding them useful and everyone is engaged and we're done within 10-15 minutes. I also have weekly individual catch ups with every team member where we discuss various general topics (both technical and non- technical) in more detail, as well as various ad-hoc topical meetings. What I've been struggling with, however, is my weekly team meeting. It is losing steam and I have not been able to keep people interested. I still want to hold a longer meeting, even if it has to be fortnightly or monthly. The purpose was to discuss various topics that cannot be done during a stand up meeting because they require more time. Updates from me include a summary on every current project that they're working on (whether it is on schedule, various delays, etc), any changes in direction, future projects, changes to development process, etc. However, it ends up being a lecture from me, and at least 2 people are obviously zoned out and the rest are at most mildly interested. I tried getting people to be more engaged by getting them to talk about their week, but with 8 people it takes a long time and (partly because a lot of their work does not cross over all that much), most of the rest team does not care what their co-workers have been working on in more detail (they get a high level overview during stand ups). So, during these meetings, at least some people are very bored, and it is almost embarrassing for me to keep holding these. It is a stark contrast to our energised morning stand up meetings. Any advice on what I can do to keep people more engaged and more interested? And how can I get them to present things on their or start discussions that involve everyone instead of it being a monologue from me?


title: Notation for the average time complexity of an algorithm

text: What notation do you use for the **average** time complexity of an algorithm? It occurs to me that the proper way would be to use big-theta to refer to a set of results (even when a specific try may differ). For example, average array search would be Θ(n+1)/2. Is this right? Explanation of average search time being Θ(n+1)/2: Given that the access time sum for the n first integers is n(n+1)/2, the average time for a large number of random access to the array will be (n(n+1)/2)/n = (n+1)/2. In this case I would say that Θ(n+1)/2 will be the average access time. It makes sense (to me) but since I'm new to asymptotic notation (and programming in general), I'd like to know if this is common practice. I'm asking because I'm confused to see big-O being used for everywhere in pages like http://bigocheatsheet.com. eg: average case of array search O(n).


title: How can a server initiate request in SIP protocol?

text: Either a client or a server can initiate request in SIP. How is it possible? How will the server know about the client?


title: What is the value of checking in failing unit tests?

text: While there are ways of keeping unit tests from being executed, what is the value of checking in failing unit tests? I will use a simple example: Case Sensitivity. The current code is case sensitive. A valid input into the method is "Cat" and it would return an enum of Animal.Cat. However, the desired functionality of the method should not be case sensitive. So if the method described was passed "cat" it could possibly return something like Animal.Null instead of Animal.Cat and the unit test would fail. Though a simple code change would make this work, a more complex issue may take weeks to fix, but identifying the bug with a unit test could be a less complex task. The application currently being analyzed has 4 years of code that "works". However, recent discussions regarding unit tests have found flaws in the code. Some just need explicit implementation documentation (ex. case sensitive or not), or code that does not execute the bug based on how it is currently called. But unit tests can be created executing specific scenarios that will cause the bug to be seen and are valid inputs. > What is the value of checking in unit tests that exercise the bug until > someone can get around to fixing the code? Should this unit test be flagged with ignore, priority, category etc, to determine whether a build was successful based on tests executed? Eventually the unit test should be created to execute the code once someone fixes it. On one hand it shows that identified bugs have not been fixed. On the other, there could be hundreds of failed unit tests showing up in the logs and weeding through the ones that should fail vs. failures due to a code check-in would be difficult to find.


Does a web application have to live in a browser to be called a web application? Or is a thin client that uses a web service for most of it's functionality a web applicaiton?


title: Is OAuth suitable for this scenario?

text: I need to create a simple web application for track expenses, with some basic actions (user must be able to create an account and log in, list expenses, edit them, etc) with a REST API for each one, and the trick is that I need to be able to pass credentials to both the webpage and the API. So, after some research I've found some examples using Digest Authentication and HMAC Authentication but lot of posts also mentioned OAuth as an alternative approach, so my question is, given this scenario, would be proper to use OAuth? I mean, as far as I understand OAuth is suitable when you want to share resources with other application, which I'm not doing for this project; besides that, when you try to access the shared resource it appears a page requesting permission for the foreign application, would that page appear at some point in my application? (maybe after the login?) In case OAuth wouldn't be suitable, is there any other option besides Digest authentication and HMAC authentication?


title: What parameters to use to compare GUI frameworks / toolkits?

text: I'm doing some research on the best GUI toolkit to use for future products at the company. We're talking about a fairly large organizations with quite a bit of code and a complete rewrite project in planning. Don't ask. Anyway, I'm trying to create a list relevant parameters to judge the toolkits. What would you use to drive the comparison? Here's what I've got so far:   * Maturity   * Ease of development   * Ease of prototyping   * Ease of maintenance   * Size of hiring pool   * Available knowledge at the company   * Training costs   * Community size   * Community level of expertise (how hard to find good answers to complex problems)   * Amount of expert-level books available   * Ability to interface to other technologies   * Deployment considerations   * Visual aesthetics   * Ability to access OS resources   * Multiple monitor support (something that might come in handy in our particular application)


title: the future of commercial products

text: I'm seeing that the open source solutions are growing rapidly & many companies use them now. What do you think the future for commercial products or solutions will be?


title: Style and recommendations of commenting code

text: I want to hear from you any advice and experience of writing comments in your code. How do you write them in the most easy and informative way? What habits do you have when commenting parts of code? Maybe some exotic recommendations? I hope this question will collect the most interesting advices and recommendations forcommenting, something useful that everyone can learn from. OK, I will start.   1. Usually, I don't use `/* */` comments even when I need to comment many lines. **Advantages** : code visually looks better than when you mix such syntax with one-line comments. Most of IDEs have an ability to comment selected text and they usually do it with one-line syntax. **Disadvantages** : Hard to edit such code without IDE.   2. Place "dot" in the end of any finished comment. For example:              //Recognize wallpaper style. Here I wanted to add additional details     int style = int.Parse(styleValue);     //Apply style to image.     Apply(style);      **Advantages** : Place "dot" only in comments that you finished. Sometimes you can write temporal information, so lack of "dot" will tell you that you wanted to return and add some additional text to this comment.   3. Align text in the enumerations, commenting parameters etc. For example:              public enum WallpaperStyle     {         Fill = 100,     //WallpaperStyle = "10"; TileWallpaper = "0".         SizeToFit = 60, //WallpaperStyle = "6";  TileWallpaper = "0".         Stretch = 20,   //WallpaperStyle = "2";  TileWallpaper = "0".         Tile = 1,       //WallpaperStyle = "0";  TileWallpaper = "1".         Center = 0      //WallpaperStyle = "0";  TileWallpaper = "0".     };      **Advantages** : Just looks better and visually more easy to find what you need. **Disadvantages** : Spending time to align and harder to edit.   4. Write text in comment that you can't obtain by analyzing code. For example, stupid comment:              //Apply style.     Apply(style);      **Advantages** : You will have clear and small code with only useful information in comments.


title: Right mix of planning and programming on a new project

text: I am about to start a new project (a game, but thats unimportant). The basic idea is in my head but not all the details. I don't want to start programming without planning, but I am seriously fighting my urge to just do it. I want some planning before to prevent refactoring the whole app just because a new feature I could think of requires it. On the other hand, I don't want to plan multiple months (spare time) and start that because I have some fear that I will lose my motivation in this time. What I am looking for is a way of combining both without one dominating the other. Should I realize the project in the way of scrum? Should I creating user stories and then realize them? Should I work feature driven? (I have some experience in scrum and the classic "specification to code" way.) **Update** : How about starting with a "click dummy" and implementing the functionality later?


title: What is the recommended learning path for PHP and Javascript?

text: For a couple of months now I have been wanting to learn Javascript and PHP but the lack of time didn't give me that opportunity. I'm in a position that have enough time to learn only one language and practice it or both in a row without doing any practice for about 1-2 months except the code in the books. I have a bit of Java programming background and have built 3 applications in Java , so I'm not totaly new when it comes to programming, but I can't say I'm at an intermediate level. I also have some experience with jQuery, which by the way I recently realised it was a mistake to learn jQuery before Javascript and XHTML/CSS. These are the recources that I am planning to read for both of them: Javascript:   1. Getting Good with JavaScript   2. Professional JavaScript for Web Developers 3rd Edition   3. JavaScript 24-Hour Trainer   4. Javascript Patterns   5. JavaScript: The Good Parts PHP:   1. PHP Solutions Dynamic Web Design Made Easy 2nd.Edition   2. PHP and MySQL Web Development 4th Edition   3. Oreilly PHP Cookbook 2nd Edition These were the resources that were recommended to me by a friend to fully grasp these two technologies exactly in that order and these are the ones I plan to read in the time that I have in the summer. If there is anything you would like to add please feel free to tell me. I am committed to learning them both to their full potential. So what I want to ask if it is appropriate to try and learn PHP immediately after learning Javascript or should I stick just to one of them until I learn it better and move to the other after?


title: How to do documentation for code and why is software (often) poorly documented?

text: There are some good examples of well-documented code out there, such as java api. But, a lot of code in public projects such as git and internal projects of companies is poorly documented and not very newcomer friendly. In all my software development stints, I have had to deal with poorly documented code. I noticed the following things -   1. Little or no comments in code.    2. Method and variable names are not self describing.    3. There is little or no documentation for how the code fits into the system or business processes.    4. Hiring bad developers or not mentoring the good ones . They can't write simple and clean code. Hence its difficult or impossible for anyone, including the developer to document the code. As a result, I have had to go through a lot of code and talk to many people to learn things. I feel this wastes everyone's time. It also creates the need for KT/Knowledge transfer sessions for newcomers to a project. I learned that documentation is not given the attention it deserves because of the following reasons:   1. Laziness.    2. Developers don't like to do anything but code.    3. Job security. (If no one can understand your code easily, then you might not be easily replaceable.)    4. Difficult deadlines leave little time to document.  So, I am wondering if there is a way to encourage and enforce good documentation practices in a company or project. What are the strategies to be used for creating decent documentation for the systems and code of any project, regardless of its complexity ? Are there any good examples of when minimal or no documentation is needed ? IMHO, I feel that we should have a documentation review after a project is delivered. If it is not simple, concise, illustrative and user friendly, the developer or technical documentation engineer own the responsibility for it and be made to fix it. I neither expect people to make reams of documentation, not hope that it will be user friendly like the head first books, but I expect it to eliminate the need for hours of analysis and wasteful KT sessions. Is there a way to end or alleviate this madness ? "Document driven development" perhaps ?


title: Understanding the stateless internet

text: I'm transitioning from being a desktop developer to a web developer, and I'm having trouble understanding why HTTP is stateless. What are the reasons for it? What are some ways a desktop developer like myself can make the transition to a stateless development environment?


title: As a Junior Software Engineer should I say that something has been done wrong if I feel so?

text: I recently joined a company and it is my first job. When reading the code base, I felt that the code was not well written. It seemed to me that the code had most of the problems mentioned here and also seemed to have an Anemic Domain Model. There are no unit tests and they don't employ any code quality checking tools like findbugs or pmd. The problem I have is that the code is very difficult to understand. Maybe my conclusions are wrong because I am not that experienced. I need advice on whether to communicate the above facts to a superior or not. If I am to communicate, to whom(Tech Lead, Architect, Product Manager) and how? And if I do communicate will they take it badly since I'm a Junior and has no experience?


title: Licensing question regarding no derivatives

text: I am working on a project where I'd like these licensing terms:   * Allow unmodified redistribution, with attribution to the author   * Disallow modified redistribution   * Non-commercial use Now the CC BY-NC-ND 4.0 license is perfect for this... however, it does not cover any software topics, and CC themselves say that you shouldn't really use the CC licenses for software projects. So what should you use in a case like this instead? LGPL comes close, but it does allow commercial use. Standard copyright, without a license, also comes close again, but allows commercial use while disallowing redistribution. BTW, I understand you guys aren't lawyers. But you might have experience with licensing to know what kind of license you should be looking for with my needs.


title: When using the Apache license, is there still a need for a Contributor License Agreement (CLA)?

text: I can certainly see the need for CLAs with a terser license like MIT or BSD, but the more verbose Apache seems to already have that type of verbiage in it. I would prefer to not add this level of complication an open source project if it is not necessary with the Apache 2.0 license. CLAs seem to primarily grant a copyright license and a patent license from the contributor to the project, both of which are already in the text of the Apache 2.0 license (sections 2 and 3). If I am using the Apache license, do I really need to also add the extra requirement for contributors to sign a CLA? I basically want to get the general benefits of a CLA (like the non-ambiguous right to relicense, though the contributor maintains ownership) without making contributors fill out a bunch of information and sign a contract in some third-party form. Doesn't the act of cloning a repository, modifying code, and sending a pull request indicate agreement to the terms of the associated license? Section 5 of the Apache 2.0 License explicitly states that contributions shall also be under Apache 2.0: > **Submission of Contributions** : Unless You explicitly state otherwise, any > Contribution intentionally submitted for inclusion in the Work by You to the > Licensor shall be under the terms and conditions of this License, without > any additional terms or conditions. Notwithstanding the above, nothing > herein shall supersede or modify the terms of any separate license agreement > you may have executed with Licensor regarding such Contributions. When combined with Sections 2 & 3 regarding grant of copyright license and patent license "...to reproduce, prepare Derivative Works of, sublicense..." it would seem that Apache 2.0 already covers the project's bases regarding submissions. Or am I misunderstanding a possible difference between a "sublicense" and actually changing the license of the project? (Since the Open Source Licensing Q&A site is still a just a proposal, I will accept IANAL answers here.)


title: Can the GitHub pull request process constitute an electronic signature of a CLA?

text: I appreciate the need for a Contributor License Agreement (CLA) in open source software projects and even understand that some tools are starting to make this process easier (like the low-friction CLAHub for GitHub and Project Harmony). However, rather than requiring a third-party form submission for an electronic signature, would adding an extra sentence and the CLA itself to CONTRIBUTING.md, which GitHub links to when a contributor files a pull request (displayed as "Please review the guideline for contributing to this repository"), allow for a valid electronic signature (e.g. "Submitting a pull request to this repository on GitHub with your name and email constitutes your agreement to and electronic signature of the following Contributor License Agreement...")? Perhaps that argument hinges on the definition of "electronic signature" (ESIGN, UETA, etc.): > **"Electronic signature"** means an electronic sound, symbol, or process > attached to or logically associated with a record and executed or adopted by > a person with the intent to sign the record. And I would like to propose that the GitHub pull request "process" is "logically associated" with the CONTRIBUTING.md/CLA "record" and that the contributor has the "intent to sign" by adopting the process... (Since the Open Source Licensing Q&A site is still a just a proposal, I will accept IANAL answers here.)


title: Apps for facilitating live code demos?

text: I really enjoy watching live code demos, especially when time is focused on what the code is doing instead of what the presenter is typing. Many seem to be using apps to manage their clipboard to paste code into the IDE. What apps are out there for skillfully managing your clipboard to seamlessly do a code demo? UPDATE: I found this app that Apple engineers use called _DemoMonkey_. It's actually an OS X app demo for, ironically enough, the clipboard and system services. The link includes the source so creating a PC equivalent would be easy, is there really nothing out there?


title: What is the ettiquite for releasing a Perl module based on someone else's module?

text: I have written a Perl module by starting with an existing Perl module of related functionality and modifying heavily. In fact, acccording to git blame I have changed (or created) every line of non-biolerplate code in the module. Of course, I have also changed the name of the module, so if I uploaded it to CPAN, it would not directly conflict with the original module. Anyway, despite my heavy modifications, the module is still conceptually based on its predecessor, and I would like to give credit to its authors. However, I can see how they might not appreciate having their names and emails slapped on what appears to be a new module without their knowing. So should I just put myself as the sole author and put the original module's authors in an "Acknowledgements" section? What is the best way to credit the original authors in my module?


title: What is "swarming"?

text: I've heard **swarming** mentioned in the context of Agile or Extreme Programming. It seems to be a complement to pairing. What exactly is it? When should it be applied? How do you do it well?


title: Is unconditional code considered a branch?

text: Having simple code like this:               int A=5;     object X=Console.ReadLine()     if(Condition)        DoSomething();     else        DoStuff();     DoSomethingElse();      Some sources say there are actually 4 branches: First unconditional, two for the IF and another unconditional after the IF statement. Some say there are only two branches. What would be correct? E.g. here: http://www.ruleworks.co.uk/testguide/BS7925-2-Annex-B7.asp


title: Where would I typically use a Deque in production software?

text: I'm fairly familiar with where to use Stacks, Queues, and Trees in software applications but I've never used a Deque (Double Ended Queue) before. Where would I typically encounter them in the wild? Would it be in the same places as a Queue but with extra gribbilies?


title: What is the Bible of Hashing?

text: Is there a Cormen-like reference on Hashes and Hashing? This particular structure has seen little attention in my CS education for some reason but I'd like to learn more as they seem to be everywhere. I know Cormen covers it but I'm looking for something more specialized and in-depth.


title: Why does the add() method of a Linkedlist return true in Java?

text: Why does the `add` method of a Linkedlist return true in Java? http://docs.oracle.com/javase/1.5.0/docs/api/java/util/LinkedList.html#add(E) Why not just make it a void method? I know it says "per the general contract of Collection.add", but why doesn't this contract/interface make `add` a void method?


title: Why do people consider Python a weak language?

text: I've been using Python for a little while now and I am enjoying it, but a few of my friends are telling me to start using a language like C# or Java instead and give these reasons:   1. Python is a scripting language   2. Python apps don't port well to people who don't have Python   3. It's hard to make good GUIs in Python since it's a scripting language I like the batteries included approach to Python and the ability to download and upload pre-built modules from PyPI is really useful to me. Is there any specific reason why Python is considered a weak language?


title: Naming a release

text: OS X 10.9 not just called 10.9 but also Mavericks. iOS7 is just called iOS7. Android releases are named after sweets. What is the rationale of giving a name to a release version?   What are the benefits if any? Most apps simply increment the number as they push new releases. Is naming a release (Mavericks, Kit kat etc...) just for marketing purpose?


title: Why .NET and C# are not available on Cloud Platforms?

text: I checked Google App Engine and Heroku but both don't support .NET/C# applications. Even though Google App Engine shows support for Windows Azure, but in the supported languages it doesn't show C# or VB. Is .NET not supported on Cloud Platform?


title: Show your customers your roadmap

text: I read a while ago an article about "Managing Expectations" and I ask myself, is it a good or bad idea to share your roadmap with your customers? In your experience, what are the pros and cons of doing this?


title: What is "lambda" code?

text: I have recently heard people talk about code being "lambda". I have never heard of this phrase before. What does it mean?


title: Where Are Multiple JUnit Test Methods Typically Placed in Code?

text: I've just read the Vogella JUnit tutorial and found it very helpful in understanding how to use JUnit. However, I'm a bit confused about what the convention is for placing multiple test methods in code. The tutorial only places one test method in a class, then describes how you can use a test suite to group multiple test classes together. Does this mean that it's common practice for each test class to only have one test method and then test suites are used to chain them together? Or was that just unintended and instead common practice is to put multiple test methods in a class?


title: Enterprise scalable vs internet scalable, what is the meaning & differences?

text: While reading about Java EE applications, somewhere I have seen people saying they're enterprise scalable, I am confused as to what that really mean? Are Java web applications mainly written & suitable for building enterprise management tools, not for the high traffic websites of today's world, that need to scaled to a large internet population?


title: How do you organize your MVC framework while supporting modules/plugins?

text: There are a two main codebase structures that I have seen when it comes to MVC frameworks. The problem is that they both seem to have an organisational bug that goes with them. **Standard MVC**               /controller     /model     /view      _Problem: No separation of related components (forum, blog, user, etc..)_ **Modular MVC**               /blog         /controller         /model         /view     /user         /controller         /model         /view     /forum         /controller         /model         /view      Picking the module-based system leaves you with a problem.   * Long names (Forum_Model_Forum = forum/model/forum.php) (Like Zend)   * File system searches using `is_file()` to find which folder has the forum model? (Like Kohana) **Are their any other MVC structures that work well when trying to separate different modules?** Are there benefits from these structures that I'm missing?


title: Do Python programmers find the whitespace issue inconvenient?

text: Many programmers, upon first encountering Python, are immediately put off by the significance of whitespace. I've heard a variety of reasons that this is inconvenient, but I've never heard a complaint from a Python programmer. Of course, I haven't met a lot of Python programmers, as I have spent my career in the Java world. So my question is for those of you that have participated in a large Python project (more than 3 months, with Python being the primary language used): Did you find the whitespace issue to be inconvenient and continually annoying? Or was it a non-issue once you got in the flow? I'm not asking the question because I'm for or against Python, or for or against its use of whitespace. I happen to like Python, but I've never used it for anything big. Please don't provide speculations if you are not experienced in Python.


title: Are design principles important, and if so, why don't more people use them?

text: I am a developer who works for an in-house information communications technology (ICT) department. I am usually quite critical when looking over code that I have not written as I find time and time again that it does not follow principles like SOLID (single responsibility etc). I used to assume that it was because I worked in an in-house ICT department rather than an outsourced ICT service. However, I am now trying to integrate an internally developed app with a few third party apps developed by large software vendors. However, again the code does not seem to be very well written e.g. there are no interfaces and every method is public. I see it time and time again were developers create a bunch of classes and that's it (i.e., everything related to Sales goes in the Sales class, etc.) I don't want to sound like I am whining; I just wondered whether other developers see design principles as important. I wonder if I am too narrow minded.


title: How do ORM'S manage CRUD operations in multi thread environment

text: Suppose I have code which retrieves an object and modifies it and submits it via any ORM from a web application. Below is the pseudo code: First request               var objCust = _dbContext.Customers.Where(c=>c.CustomerId == "ALFKI").SingleOrDefault();     objCust.Address ="test address 1";     //and add some orders     _dbContext.SubmitChanges();       Second simultaneous request               var objCategory = _dbContext.Categories.Where(c=>c.CategoryId == 1).SingleOrDefault();     objCategoryName = "test name";     _dbContext.SubmitChanges();      How does the first request only grasp the changes done to customers and submit the changes. Is there any mechanism inbuilt in ORM's to track changes to entities per thread or request.


title: Does this status show a green signal?

text: I have done this static code analysis with Code Analyzer. Is it a green signal or should I improve my coding standards? ![enter image description here](http://i.stack.imgur.com/UVXFb.jpg)


title: Git Project Dependencies on GitHub

text: I've written a PHP framework and a CMS on top of the framework. The CMS is dependent on the framework, but the framework exists as a self-contained folder within the CMS files. I'd like to maintain them as separate projects on GitHub, but I don't want to have the mess of updating the CMS project every time I update the framework. Ideally, I'd like to have the CMS somehow pull the framework files for inclusion into a predefined sub-directory rather than physically committing those files. Is this possible with Git/GitHub? If so, what do I need to know to make it work? Keep in mind that I'm at a very, very basic level of experience with Git - I can make repositories and commit using the Git plugin for Eclipse, connect to GitHub, and that's about it. I'm currently working solo on the projects, so I haven't had to learn much more about Git so far, but I'd like to open it up to others in the future and I want to make sure I have it right. Also, what should my ideal workflow be for projects with dependencies? Any tips on that subject would also greatly appreciated. If you need more info on my setup, just ask in the comments.


title: What follows after lexical analysis?

text: I'm working on a toy compiler (for some simple language like PL/0) and I have my lexer up and running. At this point I should start working on building the parse tree, but before I start I was wondering: How much information can one gather from just the string of tokens? Here's what I gathered so far:   1. One can already do syntax highlighting having only the list of tokens. Numbers and operators get coloured accordingly and keywords also.   2. Autoformatting (indenting) should also be possible. How? Specify for each token type how many white spaces or new line characters should follow it. Also when you print tokens modify an alignment variable (when the code printer reads "{" increment the alignment variable by 1, and decrement by 1 for "}". Whenever it starts printing on a new line the code printer will align according to this alignment variable)   3. In languages without nested subroutines one can get a complete list of subroutines and their signature. How? Just read what follows after the "procedure" or "function" keyword until you hit the first ")" (this should work fine in a Pascal language with no nested subroutines)   4. In languages like Pascal you can even determine local variables and their types, as they are declared in a special place (ok, you can't handle initialization as well, but you can parse sequences like: "var a, b, c: integer")   5. Detection of recursive functions may also be possible, or even a graph representation of which subroutine calls who. If one can identify the body of a function then one can also search if there are any mentions of other function's names.   6. Gathering statistics about the code, like number of lines, instructions, subroutines EDIT: I clarified why I think some processes are possible. As I read comments and responses I realise that the answer depends very much on the language that I'm parsing.


title: CSS vs codebehind, if I have to do part of the style in codebehind, should I do all of it there?

text: I'm working with ASP.Net and trying to style an ImageButton. I tried to do this via CSS only to discover that for some reason, .Net writes out an inline style setting the border width to 0 automatically. This overrides the border width from CSS, so I have to set it manually in the codebehind. My question is, should I do all the styling in the codebehind to keep it all in one place, or only do the border width there and do the rest in a style sheet? For clarification, I mean all the styling _for that object_ not for the whole site.


title: Creating and assigning console.log a new object

text: I have seen code like this in several places:               (function() {         var method;         var noop = function noop() {};         var methods = [             'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',             'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',             'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',             'timeStamp', 'trace', 'warn'         ];         var length = methods.length;         var console = (window.console = window.console || {});              while (length--) {             method = methods[length];                  // Only stub undefined methods.             if (!console[method]) {                 console[method] = noop;             }         }     }());      Specifically I am interested in this line of code               var console = (window.console = window.console || {});      Why are we creating a new `window.console` object if `window.console` is not defined ? So why are we setting `window.console={}`?


title: Are there decent entry-level tutorials on debugging?

text: In the tags I frequent on Stack Overflow, a big chunk of questions _should_ be answered with some basic knowledge about how to debug things - ie., teaching the OP to fish - instead of giving a fix for the piece of code presented. Are there any good debugging tutorials for newbies, especially   * Basic debugging techniques - understanding a piece of code, finding the problem by walking through it step by step instead of posting on SO and saying "it doesn't work"   * How to debug simple PHP scripts (For situations like "my POST variables aren't showing", etc.)   * How to debug Ajax scripts (How to use Firebug to see what gets sent, etc.) but also other languages and platforms?


title: Macbook pro for a C++ programmer?

text: I am a computer science student and I'm thinking of getting a new laptop. Is Macbook C++ programmer friendly? Does OSX have enough tools as in Linux for programming. Does working on a macbook hinter my growth as a C++ programmer. EDIT: I mainly use gedit, gdb, g++, meld, ddd (gdb front end), valgrind etc in Ubuntu Does OSX have equivalent softwares.


title: PHP as a scripting language

text: I have reasonable knowledge of PHP, Perl, and Bash. I use Perl for most text processing on my system (find, replace, filter output, etc). I use PHP for web development, allowing a user to view and interact with database data via the browser. I use Bash for quick and dirty scripts often to supplement the more complex Perl scripts. I'm a big believer of focusing on as few languages as possible (to get the job done) and becoming an expert in them. So the question is, why not use PHP for the common tasks that Perl (and Bash) are used? Are there good reasons (limitations or features) why PHP is mostly used for web development, while Perl and Bash are mostly used for "offline" "scripting"?


title: Limitations of using Hyper-V Virtual Machine as .NET Development enviroment

text: I've been thinking of using a Hyper-V Machine as instead of physical computer for installing my .NET / Azure / Xamarin / ASP.NET / Windows Phone development tools. That way I could easily move from my desktop to my laptop when I need to develop something on the go. Are there any limitations in this scenario that I should be aware of? Thanks, Adrian


title: how to check email address exist or not in php

text: I have tried a lot but could not find a way by which I will find if an email id exists or not. My problem is that I do not want to make visitor to email me with fake email Id. Is there any solution for this? I do not want to use smpt service as it send mail to solve this.


title: Which license for an open source project which may be, but is not intended to be, used as a bot in some apps?

text: I'm wondering if there is some license which I could put on my website on which I could publish an open-source application that potentially could be used for purposes of cheating in one game for smartphones. Now, I have to stress that the goal of the application is in no way cheating, so with this license I want to eliminate the possibility that the authors of the smartphone game (in which my bot could be used) could sue me if someone else starts using the application to get better at their game. I may be too paranoid, but with all the weird laws you just never know. I did a little research and came up with Creative Commons Attribution 3.0 (CC BY 3.0), but was wondering whether any of you guys were ever in a similar situation, and what you did in that case? By the way, I did read and consider the moral implications of the possible app appearing on my site, so now I just need some license as stated in the question.


title: Do I include association links for Objects that only have method scope in UML class diagrams

text: For example I have a utility Class which contains a few constants (GCMConstants), this class is used in one method in the application. However as it is not a member of the Class it should not be modeled via an association link. Should I continue as is and not include a link or should I include one? I've checked my UML books but none of them seem to cover stuff like this.


title: Do Windows mail clients actually care about the MIME type of binary attachments?

text: ...or, in other words: When sending a mail programmatically, do I really need to go through the hassle of setting the correct MIME type or can I just use `application/octet-stream`? The mail clients I tested all do "the right thing" based on the file extension, even if the MIME type is just the generic `application/octet- stream`, so why bother? I know that it is considered "good practice". I'm asking out of scientific curiosity, because I want to know if it makes a practical difference or not.


title: Purpose oriented user accounts on a single desktop?

text: # Starting point:   * I currently do development for Dynamics Ax, Android and an occasional dabble with Wordpress and Python.    * Soon, I'll start a project involving setting up WP on Google Apps Engine.    * Everything is, and should continue to, run from the same PC (running Linux Mint). # Issue: I'm afraid of botching/bogging down my setup due to tinkering/installing multiple runtimes/IDE's/SDK's/Services, so I was thinking of using multiple users, each purposed to handle the task at hand (web, Android etc) and making each user as inert as possible to one another. What I need to know is the following:   * Is this a good/feasible practice? The second closest thing to this using remote desktops connections, either to computers or to VM's, which I'd rather avoid.   * What about switching users? Can it be made seamless?   * Anything else I should know?  * * * # Update and clarification regarding VM's and whatnot: The reason I wish to avoid resorting to VM's is that I dislike the performance impact and sluggishness associated with it.   I also suspect it might add a layer of complexity I wish to avoid. This answer by Wyatt is interesting but I think it's only partly suited for requirements (web development for example). Also, in reference to the point made about system wide installs, there is a level compromise I should accept as experessed by this for example. This option suggested by 9000 is also enticing (more than VM's actually) and by no means do I intend to "Juggle" JVMs and whatnot, partly due to the reason mentioned before. Regarding complexity, I agree and would consider what was said, only from my experience I tend to pollute my work environment with SDKs and runtimes I tried and discarded, which would occasionally leave leftovers which cause issues throught the session. What I **really** want is a set of well defined, non virtualized sessions from which I can choose at my leisure and be mostly (to a reasonable extent) safe from affecting each session from the other. And what I'm really asking is if and how can this be done using user accounts.


title: Number of sites to build before trying to become a web developer?

text: Someone has asked me this question and I couldn't answer as I am not on the web part of development so I'm asking here. If one has just finished college and is trying to break through into web development/web-design a portfolio of already developed projects/sites seems to be essential to me for going to interviews. What would you say is a good number of individual sites to create for your portfolio before sending your CV and going to interviews, for a web developer position? Also what would be a good number of sites to design if you were aiming for a web designer position?


title: How is time calculation performed by a computer?

text: I need to add a certain feature to a module in a given project regarding time calculation. For this specific case I'm using Java and reading through the documentation of the Date class I found out the time is calculated in milliseconds starting from January 1, 1970, 00:00:00 GMT. I think it's safe to assume there is a similar "starting date" in other languages so I guess the specific implementation in Java doesn't matter. How is the time calculation performed by the computer? How does it know exactly how many milliseconds have passed from that given "starting date and time" to the current date and time?


title: Iteratively building a Test Framework

text: (Upfront, I'm not a test or agile expert, just trying to push us to be better. If I'm wrong on anything I'd love your guy's opinions). So I've been pushing for us to become a real agile shop and less of a "calling ad-hoc agile" shop. So I'm iteratively trying to improve our process. I've found that its been good to slowly build towards "doing it right": I can get buy in for small changes, or large changes on their own. So we've got slow iterations (about a month) that I've been using to slowly fold more and more in. My personal goal is to get us to a process that support continuous integration: at that point I think we can do things like speed up our iterations at much lower cost. The next bit that I've sold management on that we need to improve is our testing. We've never had a real solid test strategy, so I'd like to start to build up our capabilities there. We've already introduced "Test Driven Development", using Google Test (unit test) framework, which has brought us very far. But these unit tests are not enough to test the system as a whole. We're supplementing this with our old way of testing, ad-hoc system and functional tests that are really specific to the project, that are rewritten every time, and that are not automated. To make matters worse, our functional and system tests are often more similar to characterization tasks than pass- fail tasks: our system/functional test tools need to be able to support advanced plotting and number crunching, which mean a lot of them are in Matlab _shudder_. From what I can tell, a good automated test system has two parts: the Test Framework (something akin to the roboframework, ect) that figures out what tests to run, calls those tests, orgamizes the results, ect...the thing that actually does the automation. That uses the Test Tool(s), the fixture that actually performs your test. I may be viewing this wrong, but the Test Framework is like a huge batch file, and the Test Tools are the tests. So I see two possible ways to go with "what to do next".   1. Implement (could be writing our own, though I'd prefer to acquire/modify) a Test Framework. Leave our ad-hoc system tests, but let the framework take over automation. The goal would to have a way to hit "Test" and have all the tests run.   2. Figure out a way that we can use to make Test Tools more efficiently and effectively. I'm not sure what the best way to go is here, or if any of the following matter:   * We do both windows and linux development, though usually not at the same time   * While I want to focus on C++, C with CMake, we also do C# and Matlab development. The ideal framework would support all of these, even if it is different tools.   * The "testers", "test automators", and "developers" are all going to be pulled from the same group of highly-competent developers (for now.)   * I need to support command-line executable and libraries now, but would like to support GUIs (QT and .NET) in the future. The scope of 2 seems HUGE, though doing 1 first seems like putting the cart before the horse. Do I have a semi-accurate picture of whats going on? I've read a few things that use Google Test as their test framework, but doesn't better fit the definition of test tool? Am I biting off more than I can chew?


title: Why Have People Started Deeming it Necessary to Separate JS hooks from CSS hooks in HTML?

text: Edit: Point of clarificatioon, IDs and classes as separate hooks is just one form of the applied idea in question which is to never use the same hooks for CSS as you do in JS. I've also seen people want things like js-combo_box and css-combo_box as classes on the same element. This is one I've started running into more and more in recent years. People wanting to only use IDs for JS and classes for CSS. Or they don't want JS to touch classes and IDs at all and rely on things like HTML5 data-attributes hooks (which is and will probably remain the slowest way to actually find an element even in modern browsers). In 5+ years of occasionally heavy-duty/insane-environment client-side web development including one very large totally messed up e-commerce retail operation where HTML nobody was even working with would mutate because we had 200 offshore devs of varying levels code illiteracy (completely on the low end, not kidding) jumping up and down on the back end codebase with no source control, I've never run into an issue where JS and CSS targeting shared attributes in the HTML caused any kind of maintainability or ease of modification problem for me. I guess I'm wondering what is informing this perceived need and whether I'm missing something that comes up for a lot of people? Isn't HTML via selectors and the DOM API effectively the point of abstraction that ties everything together? Why would JS and CSS concerns sharing the same attributes there ever cause a problem?


title: Should I read a chapter about Memory management if now a days we mostly use ARC?

text: I'm reading a book on Objective C, and I was wondering about 2 things:   1. Should I take the time currently to read a whole chapter on memory management?   2. If you are doing a really good job on manual management, can you get to better performance than using ARC?


Where can I find fellow developers who are looking for help to create a startup? Are there any collaboration websites whereby people pitch ideas and a group of people 'join' the project in an effort to create some kind of prototype? **Edit:** @Vitor Braga - Seriously i'm not looking to make money, just finding developers who are interested in making a trivial little app with someone else. **Edit:** It may be worthy to explain that I live in a remote area of Australia.


title: Putting a programming language on your resume?

text: How much experience do you need in a language before you can put it on your resume? There is one language I'm in proficient in (Java) which I would definately put on the resume but say I took I couple of semester courses in college which involved extensive programming in C or selftaught myself C# but have written no meaningful projects in it, can I put those languages on the resume without having the employer laugh at it or percieve it as resume inflation?


title: Choosing between CL and Python for web development

text: I'm coming from a Java / PHP background and after I read this little essay by Paul Graham I started wondering about picking up a new language namely Common Lisp to speed up my work (I'm a web developer). I'm writing pet projects currently but I have some business plans for the future. Paul speaks about LISP in his essay as a "Secret weapon". I don't know if this statement is true after 10 years but I dipped my toes into a nice CL tutorial and it looks like that LISP may be superior for web development. Paul also mentions Python as a nice choice which I actually familiar with. My question is: which one should I choose for my future web projects? What I was thinking about:   * I'm not going to develop desktop applications so I can choose whatever language I prefer.   * python seems to have a very large community thus a mutch more libraries / frameworks compared to lisp   * I found out that lisp has some functionality (like macros) which cannot be found anywhere else   * I mostly work alone or with 1-2 other programmers but finding someone with lisp knowledge can be hard So what do you think?


title: Research on software defects

text: There is a chapter in _"Making Software: What really works and why we believe it"_ By Andy Oram and Greg Wilson about software defects, and what metrics can be used to predict them. To summarize (from what I can remember), they explained that they used a C codebase that was open source and had a published defect tracking history. They used a variety of well known metrics to see what was best at predicting the presence of defects. The first metric that they started with was lines of code (minus comments), which showed a correlation to defects (.i.e. as LOC increase so do defects). They did the same for a variety of other metrics (don't remember what off the top of my head) and ultimately concluded that more complex metrics were not significantly better at predicting defects than simple LOC count. It would be easy to infer from this that choosing a less verbose language (a dynamic language?) will result in less lines of code and thus less defects. But the research in _"Making Software"_ did not discuss the effect of language choice on defects, or on the class of defects. For example, perhaps a java program can be rewritten in clojure (or scala, or groovy, or...) resulting in more than 10x LOC savings. And you might infer 10x less defects because of that. But is it possible that the concise language, while less verbose, is more prone to programmer errors (relative to the more verbose language)? Or, that defects written in the less verbose language are 10x harder to find and fix? The research in _"Making Software"_ was a fine start, but it left me wanting more. Is there anything published on this topic?


title: Strategy for keeping up with (Python) language changes

text: ## Writing code that will still run years from now Programming languages change. Libraries change. Some code from 5, 10, or even 20 years ago might still run and produce expected results, whereas some code from 2 years might fail with a syntax error. This is partly inevitable, since languages evolve (at least, most do). Developers have a responsibility to maintain their code. But sometimes, stability is an important requirement in production code, and code should simply run for 10 years without the need for someone going through the code every year to adapt it for language changes. Or I might have small scripts, for example for scientific data analysis, that I need to revisit after not touching them for years. For example, at meteorological offices there is a lot of operational Fortran code even for non-speed-essential parts, and code stability is one of the reasons. I've heard fear for instability is one of the objects they have against moving to Python (apart from language inertia of course; it's only possible for new code not dependent on old code). Of course, one strategy for stable code is to freeze the entire operating system. But that is not always feasible. I'm using Python as on example, but the issue is not limited to Python in particular. ## Documents on Python compatibility issues In the case of Python, there are several documents outlining policy for backward-incompatible changes. ### PEP-5 According to PEP 5: > There must be at least a one-year transition period between the release of > the transitional version of Python and the release of the backwards > incompatible version. Users will have at least a year to test their programs > and migrate them from use of the deprecated construct to the alternative > one. Personally, I consider that one year is rather short. It means I might write some code, and 1½ years from now it won't run anymore. ### PEP 291 PEP 291 contains an incomplete lists of guidelines of things that should be avoided in order to maintain backward compatibility. However, it relates only to Python 2.x. As Python 2.7 is the final release in the 2.x series and Python 2.7 is bugfix-only, this PEP is now only of historical interest. ### PEP 387 There is also PEP 387 on backward-incompatible changes. PEP 387 is a draft and not official policy. In June 2009, this was discussed on the Python-ideas mailing-list. Part of the discussion focussed on how developers can write code that is robust against language changes. One post listed some advice on what _not_ to do: > Along with this there are several rules you can infer that are probably true > most of the time: don't call stuff starting with `"_"`, don't monkey- patch > anything, don't use dynamic class replacement on objects from classes other > than your own, don't depend on the depth of inheritance hierarchies (for > example, no `".__bases__[0].__bases__[0]"`), make sure your tests run > without producing any DeprecationWarnings, be mindful of potential namespace > conflicts when adding attributes to classes that inherit from other > libraries. I don't think all these things are written down in one place > though. In addition, there were some points about "mine fields" (new features likely to change) and "frozen areas" (very sold APIs virtually guaranteed not to change). Quoting Antoine Pitrou: > I think the "frozen area" should be defined positively (explicit public APIs > and explicitly guaranteed behaviour) rather than negatively (an explicit > "mine field"). Otherwise, we will forget to put some important things in the > minefield and get bitten later when we need to change those things in a > backwards-incompatible way. There doesn't seem to be any conclusion from this thread, but it gets pretty close to the core of what I'm looking for. The thread is almost four years old, so perhaps the situation has changed or improved. What kind of code is likely to survive, and what kind of code is more fragile? ### Porting guidelines In addition to the documents outlined above, each Python version comes with a porting guideline: porting to Python 3.2, porting to Python 3.3, etc. ### Useful compatibility PEP 3151 introduced me to the concept of _useful compatibility_. In my own words, this boils down to the idea that only if code is carefully written language developers need to be careful to maintain compatibility. It doesn't really define _useful compatibility_ , but I think it's similar to the ideas I quoted from the PEP 387 discussion above. ## From the programmers' point of view As a programmer, I know that Python will change in the future and that people — most notably myself — will try to run my code perhaps several years from now in a Python version that is one, two, or perhaps three minor versions up. Not everything will be compatible, and in fact it's easy to come up with code that will fail (I once encountered code stating `if sys.version[:3] != '2.3': print 'Wrong version, exiting'`). What I'm looking for is a set of guidelines on _what to do and what_ **not** _to do_ to enhance the chances that my code will still run unaltered in the future. Are there any such guidelines? **How do I write Python code that will still run in the future?** My question relates both to the Python core, to its standard library, but also to commonly used add-on libraries, in particular `numpy`, `scipy`, `matplotlib`. * * * **EDIT** : So far, two of the answers relate to python2 vs. python3. This is not what I mean. I know about tools to migrate from Python2 to Python3. My question relates to language changes _yet to come_. We can do better than a _crystal ball_ in finding coding guidelines that are more stable. For example:   * `import module` is more future-proof than `from module import *`, because the latter can break code if `module` grows one or more new functions/classes.   * Using undocumented methods may be less future-proof than using documented methods, as something being undocumented may be a sign of something being not stable yet. It's this kind of practical coding advices that I'm after. Since it's about present→future, we can limit ourselves to Python3, because Python2 is not going to change anymore.


title: How to determine the levels of abstraction

text: I was reading a book today called "Clean code" and I came across a paragraph were the author was talking about the levels of abstraction per a function, he classified some code as low/intermediate/high level of abstraction. My question is what is the criteria for determining the level of abstraction? I quote the paragraph from the book: > In order to make sure our functions are doing “one thing,” we need to make > sure that the statements within our function are all at the same level of > abstraction. It is easy to see how Listing 3-1 violates this rule. There are > concepts in there that are at a very high level of abstraction, such as > getHtml(); others that are at an intermediate level of abstraction, such as: > String pagePathName = PathParser.render(pagePath); and still others that are > remarkably low level, such as: .append("\n").


title: What are the advantages of prototype-based OOP over class-based OOP?

text: When I first started programming Javascript after primarily dealing with OOP in context of class-based languages, I was left confused as to why prototype- based OOP would ever be preferred to class-based OOP.   1. What are the structural advantages to using prototype-based OOP, if any? (e.g. Would we expect it to be faster or less memory intensive in certain applications?)   2. What are the advantages from a coder's perspective? (e.g. Is it easier to code certain applications or extend other people's code using prototyping?) Please don't look at this question as a question about Javascript in particular (which has had many faults over the years that are completely unrelated to prototyping). Instead, please look at it in context of the theoretical advantages of prototyping vs classes. Thank you.


title: Advice on App/Service Architecture

text: I'm starting a project that will have a web front end for the users coupled with a database. There will then be a stand-alone service running that will, on a specified interval, poll an API and update the database with the changes it found. What I need advice on is how the service should be setup. When a user creates an account on the site, I"ll need to create a "hook" in the service that will then go poll the API for that specific user. I looked at building the service using NodeJS because I could use the non- blocking structure of it along with callbacks then the API returns data that needs to be reflected in the database. I don't know how I will be able to create more monitors when a user creates an account since it's already running. Can NodeJS run in a continuous loop as as service? I am familiar with .Net and could use a Windows Service, but how would that scale with polling when the user numbers grow?


title: Text Editor Document Model

text: I am working on a text editor in javascript. I have created the front end and i need to prototype a backend. I need to model the structure of the document using this as hierarchy: Character , Word , Tag , Document I am trying to create objects based on this hierarchy. For example: Characters are represented a linked list. Word are pointers to the first and last characters. Tags are another linked list of words, and a document is a collection of words and tags. I am was wondering if anyone has a better suggestion to model these relationships as classes. I receive a character from the keyboard and i need to store this as an object in my document model. thanks


title: How do you get Business owners to buy off on properly requested product changes

text: I work for an in house IT shop. We use a scrum-like system. What we are struggling with now is getting the business owners to follow the process. They all like it in concept until they want something, then the process is for the other people. How do you convince them that following the process will give them more consistent results then just throwing a grenade over the fence and saying, "make it work".


title: How to deal with warnings in a legacy project

text: I work on a C++ project that generates bajillions of warnings. Most of the warnings appeared after the code was written:   * Initially the project used Visual C++ 8, soon switching to 9, but there is little difference in the generated warnings. Warnings were either fixed or silenced, so there were no warnings then.   * Then a 64-bit target was added. It generated a huge amount of warnings, mainly because of sloppy use of types (e.g. `unsigned` vs. `size_t`). No one bothered, or had time, to fix them once the code worked for the purpose.   * Then support for other platforms using GCC (4.5 and 4.6, some 4.4 initially) was added. GCC is much more picky, so it generated many more warnings. Again nobody bothered, or had time, to fix them. This was complicated by the fact that GCC didn't have a pragma to silence a warning in particular bit of code until 4.5, and according to the documentation it is still not what one would need.   * In the mean time some deprecated warnings popped up. So now we have a project generating thousands of warnings. And I can't even say from how many places, since even `.cpp` files are compiled several times by different compilers and warnings in headers get printed over and over. Is there a best practice for cleaning up something like that? Or at least some positive experience dealing with it?


title: How to build a web service to detect content change(s) at an external website?

text: I'm researching ways to build a web service to periodically traverse a predetermined list of web pages (of another external website) to detect if a page's content has changed from   1. editing of the page, and   2. deletion of the page. The end goal is to have this web service post push-notification events to mobile devices. FYI, I've searched and read "Questions with similar titles" here. Thank you for sharing your answers.


title: How to implement syntax sugar in OO

text: ### The Problem I regularly find myself writing the same code over and over again. For example if I want a value from a nested array structure I end up writing something like this:               $config = function_to_get_nested_array();     $node = $config;     foreach(array('vendor','product','config','leave') as $index => $key){         if(! isset($node[$key])){           //throw exception         }         $node = $node[$key];     }      I would prefer to have something like               $config = function_to_get_nested_array();     $node = get_node($config, 'vendor/product/config/leave');      But how do I implement it? ### Possible Solutions   1. I could implement a function as I did above. _BUT_ my packages heavily rely on autoloading and are purely OO. Right now I just have to clone an submodule in the right directory and everything works fine.   2. I could implement this where I need it. _BUT_ this means I have to implement it countless times in independent projects.   3. I could use a trait, if I was not stuck with PHP 5.3. Not an option for me.   4. I could implement a static service provider.  For various reasons static classes and methods are usually a bad choice, but I am tempted to do so in this case.               use vendor\product\helpers\ArrayTree as Tree     ...     $config = function_to_get_nested_array();     $node = Tree::getNode($config, 'vendor/product/config/leave');      Looks _very_ tempting, because it supports autoloading and namespaces. ### The Question Is there a better solution to implement this kind of helper functions?


title: Node.js app private modules. Where to put them?

text: The situation would be: I develop 2 projects in my Node.js development environment, P1 and P2. P1 required the development of two simple modules, mod1 and mod2, which are stored in `P1/lib`. Each one of this modules resolves find their external dependencies in `P1/node_modules`. Necessary dependencies for P1 have been installed in this folder via npm. Now image we want to reuse mod1 in the other proyect P2, here's were my doubts come up. I could...   * Just copy mod1 to `P2/lib`. Replication, so I don't even consider this option.   * From P2, reference mod1 from P1: `require($PROJECTS_DIR + '/P1/lib/mod1')`. Not a good option, this way P2 would depend on P1.    * Put mod1 into a higher level directory or using NODE_PATH, so that P1 and P2 can resolve it by just doint `require('mod1')`. However, when deploying, I should also deploy this higher level directory which seems a bit dirty.   * I would like to treat mod1 as a npm module, so it can be easily installed in any project or environment, However, in this particular case, I can't publish the module to npm cause is too project-specific. I could create a private npm repository and put mod1 inside. The gist of this would be to set it up in order to be accessed also from the production envirnoment. Is it worth it?   * What about putting it all together in `node_modules`? (external depencencies and my own libraries). That would be great since modules can be just required like `require('module'). But it also seems quite dirty.   * Not sure how `npm link` would work when deploying. It creates a symbolic link, which is not followed when commiting code via Git or SVN. If I run `npm install` in production, will it also install the linked module? None of the above quite satisfies me. I don't know if one of these is suitable, or you guys have other suggestions, but, are there any preferred ways to structure own **private** libraries so that they can be easily reused in other projects?


title: handling multiple interviews / offers

text: What's the best way to handle a situation where you have, or expect to have multiple offers? The ideal situation is that your several offers come in about the same time, and you make a choice. this is not how it happens though. You may have an offer, and several near-final interviews lined up for the following days or weeks. One way to handle it would be to ask for a longer time to decide on the first offers you receive. 2 weeks? This gives time to rush the rest of the things you have going through to an end. i question whether asking for 2 weeks to decide is reasonable though. My guess is that an employer would see through that and force your hand. Another way to handle it would be to accept the first offer, and ask for a reasonable period before your start date, then simply "quit" the first position before you ever start if something better comes along. On one hand, employment is at-will, and employers exercise this fact regularly. On the other hand, it seems morally the wrong thing, and has the potential to burn some bridges. And of course the last option is to simply evaluate each offer in isolation, and accept or reject within the given time frame. any thoughts?


title: SQL W/ hibernate vs in-memory solution

text: I recently posted a question here: Methods to share memory or state across JVMs? and appreciate the answers. However, as I read the code and learned the system better I learned I was over complicating the problem. Only one of the JVM's really care about the dynamic data so there is no need to pass dynamic data across memory boundries. However, we still have a problem that they are manually maintaining state between in-memory and sql; the manual code isn't perfect and doesn't protect against stale data, data races, etc etc and I want to remove it entirely one way or another so I can feel more secure about the overal stability. Since only one JVM cares about dynamic data, and the dynamic data can be regenerated at bootup each time (with a small time penalty to do so) my inclination is to remove all the dynamic data from sql and just store everything in memory; why over complicate anything? Howver, they liked the sql as a debugging tool. This system is developed agile, it's on a live system but bugs and errors do come up due to the agile nature. When that happens they ssh to the live system and debug it on the fly; often by viewing the database. The SQL allows them to see the actual routes and pathing that are being used. They can also see when a route looks wrong, change it, then restart the module so that the fixed path is loaded into memory and used from then on. They like this ability to quickly fix bad routes don't want to lose it. There is now talk of keeping the database but backing it with hybernate to avoid the nightmare of trying to keep JVM and sql sychronized manually. There are some minor other gaines, but this is primarily so they can keep the sql and try to use it as a debug tool. Something feels wrong about all of this, but I'm not entierly certain WHAT is so wrong about it. If we droped the dynamic sql data I could partially emulate what they want by adding messages to print out the graph as it is, or to modify a graph on the fly, but obviously each message takes a bit of time to write. Does keeping SQL rather then trying to write messages to allow changing of memory on the fly make sense? I think using hibernate may make it a little harder to write our objects we use for generating and maintaining paths, having to keep the structor similar to a SQL database and all. But I think my real issue is the idea of pushing changes to our in-memory state by changing our database. That just feels dangerous to me; in much the same way improper encapsulation feels wrong. I don't think I like the idea of fixing a broken route by just manually changing the route in sql feels safe. But I don't know how to articulate why this all feels wrong. Maybe I should be suggesting a better debugging solution? So, am i right to worry or is hibernate really the best approch?


title: IEC 62304 compliant Architecture definition

text: I am currently tasked with creating a software architecture for compliance with IEC 62304. These regulations are notoriously vague, and do not provide any real substance as to what is required for a "software architecture". The standard states > The manufacturer shall transform the requirements for the medical device > software into a documented architecture that describes the software's > structure and identifies software items. Now I went to an applied computer science school, so the vast majority of my teachings were around how to actually write code and working on projects, so as far as I can remember, we never covered anything involving creating software architecture diagrams. I've already basically written all of the software, but for regulatory submission purposes I need to create this documentation for the project. So in short my question is this: What exactly does a "software architecture" consist of?


title: How to debug through a swing based application effectively

text: I am trying to understand how a radio button is created in a Dynamic field by reading from an XML using Netbeans 7.0. I know the radio button is created because of the XML being read from database, but I cannot see **how** the radio button is created. Also, since I don't know where to place the break points, I can't see how I would debug the creation of components on the Dynamic Editor. Maybe I am trying a wrong approach or something, so how do I efficiently debug an application like this?


title: Are iframes a design smell?

text: We have some pretty old, clunky .Net 1.1 apps in our business that - rather than be forcably upgraded - just get an iFrame added so that new functions can be dropped in. It's become such a well-known option that many management staff who don't really have a great deal of technical knowledge or experience suggest just throwing an iframe on a page as if that would be the only way to solve the problem. I don't have an issue with the iframe element per se if it's absolutely necessary, but it does seem that it's a very convenient tool for something that might be better achieved with a little more thought and consideration for design. Are iframes the web design equivalent of a code smell?


title: Web Page Execution Internals

text: My question is what is the subject area that covers web page execution/loading. I am looking to purchase a book by subject area that covers when things execute or load in a web page, whether it's straight html, html and Javascript, or a PHP page. Is that topic covered by a detailed html book, or should I expect to find information like that in a JavaScript of PHP book? I understand that PHP and Perl execute on the server and that Javascript is client side, and I know there is a lot of on-line documentation describing `<html>, <head>, <body>`, and so on. I'm just wondering what subject area a book would be in to cover all that, not a discussion of the best book or someone's favorite book, but the subject area.


title: Windows driver signing

text: My company is developing driver for our hardware. Now I need to sign my driver for 32 and 64 bit platforms. Please tell, now I need to buy Authenticode certificate, right? What CA to use? DigiCert?   GlobalSign? ( http://www.sslshopper.com/microsoft-authenticode- certificates.html )   Symantec? ( http://www.symantec.com/verisign/code-signing/microsoft- authenticode ) What is the difference between this CA offers? I need to use tools from WDK?


title: How to locate source code that implemented a certain feature?

text: I was wondering what are some techniques to locate which code implemented a specific feature, on a desktop application. I am a junior developer, with only professional programming experience lying around web programming. In the Web it is easier to do that. For example, you "inspect" a button with the browser tools, and you can see what is being done when you click it. And then, presuming you have the full source code, you can drill down the hierarchy of the calls. But how do you do this in desktop applications? At least, without having to dive into the full codebase?


title: What norms/standards should I follow when writing a functional spec?

text: I would like to know what documents (ISO?) should I follow when I write a functional specification. Or what should designers follow when creating the system design? I was told that there was a progress in last years but was not told what the progress was in (college professor). Thank you EDIT: I do not speak about document content etc. but about standards for capturing requirements, for business analysis.


title: RESTful reference representations - semantic link vs uri

text: We're designing a RESTful API to open up our customer's account information. We have representations that contain references to other resources related to the current resource. This is from a number of best practices we were able to find in public APIs as well as published materials. The representations can be either XML or JSON. For example for an account resource we would have references to the account's addresses and for a paginated list resource, we would have references to the first, next, and previous pages. The API was first designed using semantic links `<link title="" rel="" href="" />` as described in an O'Reilly book and used in APIs by Netflix and Google. When it came time for our QA engineers to write the automation suite, they had problems deserializing the links. We've now suggested simpler uri string elements which have been used in APIs by Facebook and Twitter. Our QA enginners have since solved their deserialization issues, but I still have a concern of the ease of use of the current API spec with semantic links. Our API will primarily be consumed by our customers and some third-party partnerships and we've gone to REST because the previous XML-RPC API was too difficult for our consumers. tl;dr; Question:   ### Has anyone who has implemented a semantic link representation experienced consumer issues with the difficulty? * * * Update (6/21): I've decided to stay with semantic links and hope that the confusion was an edge case. I'll try to remember to answer the question with our experiences once the API is live with some consumers. * * * Edit: add examples Semantic Account JSON:               {         "username": "paul",         "links": [             {                 "title": "addresses",                 "rel": "related",                 "href": "http://example.com/account/paul/addresses"             },             {                 "title": "history",                 "rel": "related",                 "href": "http://example.com/account/paul/history"             }         ]     }      Semantic Account XML:               <account>         <username>paul</username>         <link title="addresses" rel="related" href="http://example.com/account/paul/addresses" />         <link title="history" rel="related" href="http://example.com/account/paul/history" />     </account>      Simple Account JSON:               {         "username": "paul",         "addresses": "http://example.com/account/paul/addresses"         "history": "http://example.com/account/paul/history"     }      Simple Account XML:               <account>         <username>paul</username>         <addresses>http://example.com/account/paul/addresses</addresses>         <history>http://example.com/account/paul/history</history>     </account>


title: Am I a total misfit for Programming or is it Corporate Drama?

text: My background: Computer Science Engineer with around 4 and half years of experience as a programmer. In the last one year I have changed 4 programming jobs and it includes companies of size both big and small and both product and service based and in the end I have quit all four jobs. The following are some common issues that I face and how can I improve my situation in the next job?   1. Experienced programmers are expected to get on board and start implementing features even when I haven't fully seen how many classes are in play. Of course I do understand being experienced I cant take a long time to get hold of the project but literally asked in the first few weeks to start giving status updates.   2. Project managers almost always say or at least claim that they have been coders from a different technology sending out 2 messages at the same time. One being that they too have done programming in the past and second one that they cannot really help me out with the current project's technical problems.   3. The big challenge the project is currently going through is directly thrown at the new comer. Although new comer is not expected to solve it straight off but at least is expected to give plausible solution which the original team is struggling with for I don't know how long.    4. Programming is treated as though people just have solutions right off the head and the fact that almost everything in software development needs lot of research is completely ignored.   5. One more major common observation is that every project is somehow complex in its design and the code is slightly messy to begin with . If it is pointed out that the project needs redesign and cannot continue like a POC, it is often perceived by managers as though I am an incapable resource when design change was a must for the survival of the software itself . Most managers are simply not interested in hearing No as an answer for anything and they just want some hacking done so that they can report progress to their senior management.    6. Overall I found that all the four jobs felt like the same sweat shop with different people with almost the same kind of complexity and stress. While talking to other team mates about the way I feel, they tell me that's just the way it is and we have to put up with it. I was looking forward for some suggestions on how I can improve my current situation and also if changing career path to management might help?


title: Getting and maintaining data from a large number of sources on the web

text: For the sake of an exercice I want to aggregate price listings with prices coming from a series of web sites in a structured form (XML, JSON...). If I have control on both sides how can I go about making price updates the most efficient possible? Edit: To clarify, I'm looking for a more efficient approach then having a script or application pull in price lists in their entirety from all sources for updates.


title: Separating data access in ASP.NET MVC

text: I want to make sure I'm following industry standards and best practices with my first real crack at MVC. In this case, it's ASP.NET MVC, using C#. I will be using Entity Framework 4.1 for my model, with code-first objects (the database already exists), so there will be a DBContext object for retrieving data from the database. In the demos I've gone through on the asp.net website, controllers have data access code in them. This doesn't seem right to me, especially when following the DRY (don't repeat yourself) practices. For example, let's say I am writing a web application to be used in a public library, and I have a controller for creating, updating, and deleting books in a catalog. Several of the actions may take an ISBN and need want to return a "Book" object (note this is probably not 100% valid code):               public class BookController : Controller     {         LibraryDBContext _db = new LibraryDBContext();              public ActionResult Details(String ISBNtoGet)         {             Book currentBook = _db.Books.Single(b => b.ISBN == ISBNtoGet);             return View(currentBook);         }              public ActionResult Edit(String ISBNtoGet)         {             Book currentBook = _db.Books.Single(b => b.ISBN == ISBNtoGet);             return View(currentBook);         }     }      Instead, _should_ I actually have a method in my db context object to return one Book? That seems like it is a better separation to me, and helps promote DRY, because I might need to get a Book object by ISBN somewhere else in my web application.               public partial class LibraryDBContext: DBContext     {         public Book GetBookByISBN(String ISBNtoGet)         {             return Books.Single(b => b.ISBN == ISBNtoGet);         }     }          public class BookController : Controller     {         LibraryDBContext _db = new LibraryDBContext();              public ActionResult Details(String ISBNtoGet)         {             return View(_db.GetBookByISBN(ISBNtoGet));         }              public ActionResult Edit(ByVal ISBNtoGet as String)         {             return View(_db.GetBookByISBN(ISBNtoGet));         }     }      Is this a valid set of rules to follow in the coding of my application? Or, I guess a more subjective question would be: "is this the right way to do it?"


title: Best approach for a database of long strings

text: I need to store questions and answers in a database. The questions will be one to two sentences, but the answers will be long, at least a paragraph, likely more. The only way I know about to do this right now is an SQL database. However, I don't feel like this is a good solution because as far as I've seen, these databases aren't used for data of this type or size. Is this the correct way to go or is there a better way to store this data? Is there a better way than storing raw strings?


title: Delphi Conversion to Prism?

text: At my office, we are about to embark on an epic journey of converting an old Delphi 5 application to something more modern. One of our options is to convert to Delphi Prism, but we want to see what options are available to help us. So far, all I've found is Oxidizer (last worked on 2 years ago). Are there any other options for helping us convert reasonably quickly to Prism? Thanks.


title: Design Pattern : Static Array/List in Class Object

text: I'm a CS alumni, but we didn't learn much by the way of OOP, or Design Patterns. I've heard the phrase C with iostreams and thought it fitting. Anyway that's besides the point. I am just curious about what I perceive would be a very simple design pattern. Have any of you played the game Starcraft? You know how you can select/deselect units? Back to that in a second. Suppose I have a Unit class, and I wanted it to keep track of all the units that were selected. I had the idea that I could create a static list/arrray inside the Unit class, and the units themselves could add or remove themselves from the array as they were selected/deselected. That's just one example, there could be other applications of this "pattern". Say you wanted to maintain a list of visible "tabs" in a web browser or w/e, you could have them add a reference to themselves in a a static array in the class. The idea is that you could just call Unit.GetSelected() and get a pointer/reference to all of the "selected" or "opened" units/tabs. I am aware that there are other maybe better ways of solving these problems, but that is also besides the point. What would this pattern be called?