title: Forgetting basic language functions due to use of IDE, over reliance?

text: > **Possible Duplicate:**   >  Should newbies use IDE autocomplete (Intellisense)?   >  Is it wrong or bad to use autocomplete? Having used an IDE for the last 3-4 years, the other day a few of my coworkers and I came to a fairly sad realization that we had forgotten some basic Java methods/functions because we always relied on our IDE (Eclipse/STS/IntelliJ) to complete them for us (such as what a function takes in terms of parameters), is this a sign that our skills are deteriorating, that we're over relying on IDEs? (This whole discussion came about us talking about taking the Oracle Java 7 EE certification test and looking over a few practice questions, questions such as, what parameters does function X take, etc) If so, how do you guys fight off this sort of thing? Just re-read books and stuff? I myself can't imagine not coding with an IDE because in all honesty, it does make me code a lot faster with things such as auto complete, etc while some of my co-workers suggested we code sans IDE for a few months. I do realize that sometimes one doesn't need to know everything about a function, but I do remember a college professor telling us that IDEs are terrible because when the time comes that you need some sort of function, you'll have to waste time looking it up instead of just banging out the code from rote memory.


title: Is there any evidence that Intellisense reduces productivity?

text: > **Possible Duplicate:**   >  Should newbies use IDE autocomplete (Intellisense)? I was having a conversation with another developer the other night about the pros and cons of Visual Studio. He was of the opinion that Intellisense reduces productivity. Of course I thought that was insane but I could be wrong. Is there any evidence to support the idea that Intellisense reduces productivity?


title: Does relying on intellisense and documentation a lot while coding makes you a bad programmer?

text: Is a programmer required to learn and memorize all syntax, or is it ok to keep handy some documentation? Would it affect the way that managers look at coders? What are the downside of depending on intellisense and auto-complete technologies and pdf documentation?


title: Do programmers (using an IDE) need to know namespaces?

text: I got into a discussion with a coworker over an interview question that was asked of a potential employee. "Name some namespaces/what do they do/what namespace is involved with x". I'm of the opinion that programmers don't really need to know that kind of stuff, especially with the use of an IDE and extremely accessible documentation. He feels that a programmer with experience should be able to name namespaces. This is valid, I suppose, especially if you're looking to hire someone into a more experienced position. They don't particularly need to memorize namespaces, but anyone that has experience should be able to rattle off some namespaces and what their purpose is. What are your thoughts on this?


title: Is it a good idea to generate code with the help of your IDE?

text: > **Possible Duplicate:**   >  Should newbies use IDE autocomplete (Intellisense)? Since I moved on to actual IDEs for C++, Java and Python, I noticed they automatically try to complete my code. For example if I write `System.out.pr[...]` I am automatically offered a list from which I can select the item I want to use. As a beginner I avoided using this feature as I thought I should learn the syntax by typing. Was I correct in thinking that? From a more experienced programmer's point of view, I'd see no harm in using this feature.


title: What should I learn in Java SE before proceeding to Java EE?

text: Currently, I've learned the following in Java SE:   * Logical Operations   * Loops   * Inheritance   * Polymorphism   * Abstract Classes   * Interface I'm currently learning Strings, Characters and Regular Expressions. What are things that I should learn before proceeding to Java EE?


title: Academic programming languages?

text: Back in the day, there were a lot of academic programming languages (okay, maybe not a _lot_ , but it seems like there were more than today). I distinctly remember spending time in both high school and college learning languages like Basic, Ada, Pascal, Prolog, Haskell, Scheme, and Turing. While it's unfair to call all those languages solely academic, it's also unfair to say they are industrially equivalent to an enterprise language like Java (or even C or Smalltalk back in the day). My question is, what academic languages are still in use (and still taught today)? It seems like there's a lot of Java schools, and a rising number of Python schools, and even some that teach languages like C as the first programming language - but what would be the modern equivalent to something like Pascal?


title: What can I gain from examining others code?

text: I recently downloaded some large code bases and have had light reads through them, but what can I gain from this? How can I be sure what the author is doing is the right way to go about things? (One of the the code bases was the Zeus Trojan source code ;D)


title: What do employers look for in self-taught applicants?

text: I'm a self-taught programmer about to enter the job market. What I want to know is what is the best way to show my experience to employers? What do employers want to know about my programming experience? Do employers want to look at code I wrote or could they want to see the software in action? Or do they only care how much my software is being used/how much it has created revenue? Should I write about my design and programming style? My background: I recently graduated from a university where I studied foreign languages, and it was during this time when I found out that programming is the thing I really want to do. Currently I'm a garage programmer, developing a software for a client for commercial use while continuing to self-teach myself, but my aim is to start a "proper" employment and career. As an added twist I live in Finland at the moment, but I'm looking for employment in China or Japan (I learned both languages while studying abroad). Any help is greatly appreciated!


title: Kind of project for pair programming interview

text: As discussed in the SO question Pair Programming for a job interview, there are mixed feelings on the usefulness of this approach. For those that have used this approach, what kind of projects are useful? From my limited experience with this as an interviewee, a key seems to be a well chosen task that the candidate can understand quickly and be able to contribute to (and the latter may depend somewhat on the candidate's background). I've gone through a couple days of pairing interviews and found some periods to seem like a few hours were wasted: one because the developer wasn't working on something that lent itself to pairing (messy code that the developer wasn't very familiar with and was already interacting with someone about) and involved a tech I wasn't very familiar with. Another case was because an unexpected build issue prevented much useful work for a long while. One shop trying this approach wasn't sure if they should have someone outside the company work on a customer's project - any thoughts on this? They also worried that explaining the domain and system would take too long, though without that the candidate may not be able to contribute much. So they chose an open source project the employee was working on, though that's likely not an option for everyone. Recently, there have been a lot of folks working on _coding katas_ for various things. I'm wondering if this would be a useful thing to use. Some sites even have them in multiple languages and multiple skill levels (e.g. http://codingkata.org), which could be useful for candidates and/or employees with different backgrounds. [I guess coding katas could be used even for coding exercises in non-pairing interviews - I'll ask a separate question on that: What coding katas are good for interview exercises]


title: Reading SICP with F#?

text: I've been meaning to read the SICP book for a while, and am finally about to get around to it (now that I can read it on Kindle :) I'd like to learn a functional language, and I use C# at work so thought it might be a good idea to go through the book with F# in my mind rather than Scheme. (That is, do the exercises in F#.) I wonder though, will there be much mental disjoint between Scheme and F#? Maybe it's better to go through with Scheme on the first pass?


title: Should a .NET, JavaScript and SQL Web App developer learn Perl?

text: I'm a front and backend .NET web developer (most solutions use MS SQL Server) and I won't be using any non-MS solutions for a while. Will Perl be useful for situations that require scripting in an MS product environment?


title: We have a custom program that generates all the stored procs and classes for the Data Tier. Where will I put the generated classes?

text: This is more of an architectural question regarding MVC and Data Access: We have a custom program that generates all the stored procs and classes for the Data Tier from the MS SQL database. It's pretty nice as it generates a base class with the basic CRUD operations which includes ForeignKey reads. It also generates the plural version of the class to return the collections of objects. For the next phase of our application we are planning on using MVC but we were hoping to continue using this great tool. Where will I put the generated classes in my new MVC application? I have seen people create an Infrastructure folder for their data access logic. Is it a good idea to continue using this tool or should we be converting to the Entity Framework? Also if the DAL is returning my objects and lists of objects what will I put in my Model layer?


title: Principles of an extensible data proxy

text: There is a growing industry now with more than 30 companies playing in the Backend-As-A-Service (BaaS) market. The principle is simple: give companies a secure way of exposing data housed on premises and behind the firewall publicly. This can include database data, as well as Legacy PC data through established connectors; SAP for example provides a connector for transacting with their legacy systems. Early attempts were fixed providers for specific systems like SAP, IBM or Oracle, but the new breed is extensible, allowing Channel Partners and Consultants to build robust integration applications that can consume whatever data sources the client wants to expose. I just happen to be close to finishing a Cloud Based HTML5 application platform that provides robust integration services, and I would like to break ground on an extensible data proxy to complete the system. From what I can gather, I need to provide either an installable web service of some kind, or a Cloud service which the client can configure with VPN for interactions. Then I can build in connectors, which can be activated with a service account, and expose those transactions via web services of some kind (JSON, SOAP, etc). I can also provide a framework that allows people to build in their own connectors, and use some kind of schema to hook those connectors into the proxy. The end result is some kind of public facing web service that could securely be consumed by applications to show data through HTML5 on any device. My gut is, this isn't as hard as it sounds. Almost all of the 30+ companies (With more popping up almost weekly) have all come into existence in the last 18 months or so, which tells me either the root technology, or the skillset to create the technology is in abundance right now. Where should I start on this? Are there some open source projects I can leverage? A specific group of developers I can hire? I'm confident someone here can set me on the right path and save me some time. You don't see this many companies spring up this rapidly if they are all starting from scratch with proprietary technology. The Register: WTF is BaaS One Minute Video from Kony on their BaaS


title: How do you test a data load?

text: I'm working on a project that involves loading batches of 3000+ files to several dozen tables. There is no user interface, and the tables are simply available for querying. What are the best practices for testing this type of process?   * Loading a small set of data and validating each and every member?   * Loading all the data and validating a subset?   * Loading all the data and validating counts, averages, and other metrics? Are there other types of testing that can be done, or is some combination best?


title: Diagram that could explain a state machine's code?

text: We have a lot of concepts in making diagrams like UML and flowcharting or just making up whatever boxes-and-arrows combination works at the time, but I'm looking at doing a visual diagram on something that's actually _really_ complex. State machines like those that parse HTML or regular expressions tend to be very long and complicated bits of code. For example, this is the stateLoop for FireFox 9 beta. It's actually generated by another file, but this is the code that runs. How can I diagram something with the complexity of this in a way that explains flow of the code without taking it to a level where I draw every single line- of-code into it's own box on a flowchart? I don't want to draw "Invoke loop, then return" but I don't want to explain every last detail. What kind of graph is suitable to do this? Is there already something out there similar to this? Just an example of how to do this without going overboard in complexity or too-high-level is really what I want. * * * If you don't feel like looking at the code, basically it's 70 different state flags that could occur, inside an infinite loop that exists to a label based on some conditions, each flag has it's own infinite loop that exists to a label somewhere, and each of those loops has checks for different types of chars, which then runs off into various other methods.


title: Algorithm to reduce calls to mapping API

text: A random distribution of points lies on a map. This data lies behind an API, and I want to grab the complete set of points within a given bounding box. I can query the API with the bounding box and the API will return the set of points that fall within that box. The problem is that the API will limit the result set to 10 items, with no pagination and no indication if there are more points that have been omitted. So I made a recursive algorithm that takes a bounding box and requests the points that lie within it. If the result set is exactly 10 items, then I split the bounding box into four quadrants and recurse. It works fine but my question is this: if want to minimize the number of API calls, what is the optimal way to split the bounding box? Splitting it into quadrants was just an arbitrary decision. When there are a lot of points on the map, I have to drill down many levels before I start getting meaningful results. So I imagine it might be faster to split the box into, say, 9, 16, or more sections. But if I do that, then I eventually get to a point where a lot of requests are returning 0 results which isn't so efficient. Also, does the size of the limit on the results set affect the answer? (This is all assuming that I have no prior knowledge of nominal point density in the bounding box)


title: Should XmlDocument.xml be Included in Source Control

text: In a Web API 2 project, in the project properties, I have enabled the output of an XML documentation file. By default, Visual Studio 2013 wants to check this into TFS. I'm pretty sure that I'm going to exclude it, but wondered what the general opinion is on this?


title: Confused about modifying the sprint backlog during a sprint

text: I've been reading a lot about scrum lately, and I've found what seem to me to be conflicting information about whether or not it's ok to change the sprint backlog during a sprint. The Wikipedia article on scrum says it's not ok, and various other articles say this as well. Also my Software Development professor taught the same thing during an overview of scrum. However, I read Scrum and XP from the Trenches and that describes a section for unplanned items on the taskboard. So then I looked up the Scrum Guide and it says that during the sprint "No changes are made that would affect the Sprint Goal" and in the discussion of the Sprint Goal "If the work turns out to be different than the Development Team expected, then they collaborate with the Product Owner to negotiate the scope of Sprint Backlog within the Sprint." It goes on to say in the discussion of the Sprint Backlog: > The Sprint Backlog is a plan with enough detail that changes in progress can > be understood in the Daily Scrum. The Development Team modifies Sprint > Backlog throughout the Sprint, and the Sprint Backlog emerges during the > Sprint. This emergence occurs as the Development Team works through the plan > and learns more about the work needed to achieve the Sprint Goal. > > As new work is required, the Development Team adds it to the Sprint Backlog. > As work is performed or completed, the estimated remaining work is updated. > When elements of the plan are deemed unnecessary, they are removed. Only the > Development Team can change its Sprint Backlog during a Sprint. The Sprint > Backlog is a highly visible, real-time picture of the work that the > Development Team plans to accomplish during the Sprint, and it belongs > solely to the Development Team. So at this point I'm altogether confused. Thinking about it, it makes more sense to me to take the second approach. The individual, specific items in the backlog don't seem to me to be the most important thing, but rather the sprint goal, so not changing the sprint goal but being able to change the backlog makes sense. For instance if both the product owner and the team thought they were on the same page about a story, but as the sprint progressed they figured out there was a misunderstanding, it seems like it makes sense to change the tasks that make up that story accordingly. Or if there was some story or task that was forgotten about, but is required to reach the sprint goal, I would think it would be best to add the story or task to the backlog during the sprint. However, there are a lot of people who seem quite adamant that any change to the sprint backlog is not ok. Am I misunderstanding that position somehow? Are those folks defining the sprint backlog differently somehow? My understanding of the sprint backlog is that it consists of both the stories and the tasks they're broken down into. Anyway I would really appreciate input on this issue. I'm trying to figure out both what the idealistic scrum approach is to changing the sprint backlog during a sprint, and whether people who use scrum successfully for development allow changing the sprint backlog during a sprint.


title: Why can't we get anything done?

text: I work on a small team, in a medium-sized company, most of which isn't involved in software development. I'm the newest and least-experienced developer and had no professional or academic background in software before starting, but I'm quite pleased with how respected my input is and am grateful for being taken seriously at such an early stage in my career. Still, I feel like I should be doing more with this generous amount of airtime. As a team, we seem to have trouble getting things done. I'd like to be able to suggest something to improve the situation, and I think I'd be listened to if it was a good idea, but I'm at a loss for what to suggest. Things I can identify as being issues include:   * Specification of the tasks at hand is sparse. This is partly because management is a bottleneck and we don't have the money or people to commit to working out detailed requirements as much as we'd like. It's also partly because the software we're developing is investigative and the precise method isn't clear until it's demonstrated and used to determine its effectiveness.   * The Lead Dev is very fond of what he calls 'prototyping' to the point that he's lately started insisting that everything is 'prototyped', which to the rest of us looks like writing bad code and giving it to the modellers to play with. It isn't clear what he expects to come out of this exercise in many cases. The 'actual' implementation then suffers because of his insistence that good practice takes too much time from the prototyping. I haven't even begun to be able to untangle this twisted logic and I'm not sure I want to try.   * The modellers are expected to tell us everything about the desired methodology in precise detail, and it's taken on absolute trust that what they come out with is theoretically flawless. This is hardly ever true, but no action is taken to rectify this situation. Nobody on the modelling side raises any concerns in a structured way that is likely to be acted upon, nor do they seek guidance in applying best practices. Nothing is done about their passivity either.   * I've tried to push TDD in the team before, but found it difficult as it's new to me and while those with oversight of my work were willing to tolerate it, no enthusiasm has been forthcoming from anyone else. I can't justify the amount of time I spend wallowing and not finishing features, so the idea has - for the moment - been abandoned. I'm concerned it won't be picked up again, because nobody likes to be told how to do their job.   * We now have a continuous integration server, but it's mostly only being used to run multiple-hour regression tests. It's been left open that it ought to be running full-coverage unit and integration tests as well, but at the moment nobody writes them.   * Every time I raise the issue of quality with the lead dev, I get an answer to the effect of 'Testing feature A is straightforward, feature B is much more important to the user but too difficult to test, therefore we shouldn't test feature A'. Once again I've made no headway in trying to untangle this logic.  ....phew. When I phrase it like that, it looks much worse than I thought. I suppose, as it turns out, this is a cry for help.


What visualization method would you recommend for event driven programs? Are there industry standard diagrams, such as flowcharts?


title: How to properly understand django framework?

text: I have decent knowledge of php, i.e., I can take a framework, read its code and if the docs are adequate, understand what its doing. Main reason for that is that php is actually a very easy language which is literally made for web- dev.   I have been trying to learn django for a week now, can knock up a basic app with it, but there are just too many things which go over my head, i.e, look like magic, reason for that , i think is that the whole interaction with the server thing is part of django, which is all handled by your server in php, I want to read more about this part, i.e. what all topics should i cover to 'get' this. please suggest some books too


title: Identifying languages used by particular industries

text: > **Possible Duplicate:**   >  What technologies are used for Game development now days? I am new to programming and I don't know the differences between the major languages. I desperately want to get into the gaming industry because I have so many stories I want to tell and so many experiences I want to create. I currently do 3D modeling/animation, so any similarities would be helpful. What steps should I take to investigate an industry (gaming) and the companies within that industry? How do I identify what programming languages they use, so I can study them?


title: Beginner programmer wants to work his way up to game development

text: I've taken a course in computer science that covered basics about java and programming from conditionals and loops to inheritance and interfaces. I also got Head First Java from a friend who didn't write in it. After I finish that book, what should I do before I head into developing games? Also, I've been just making command line games and math programs for now. Is that good practice? I'm just worried that I will only be repeating things that I already know, and that I won't be learning anything new.


title: How relevant is UTF-7 when it comes to parsing emails?

text: I recently implemented incoming emails for an application and boy, did I open the gates of hell? Since then every other day an email arrives that makes the app fail in a different way. One of those things is emails encoded as UTF-7. Most emails come as ASCII, some of the Latin encodings, or thankfully, UTF-8. Hotmail error messages (like email address doesn't exist or quota exceeded) seem to come as UTF-7. Unfortunately, UTF-7 is not an encoding Ruby understands:               > "hello world".encode("utf-8", "utf-7")     Encoding::ConverterNotFoundError: code converter not found (UTF-7 to UTF-8)          > Encoding::UTF_7      => #<Encoding:UTF-7 (dummy)>       My application doesn't crash, it actually handles the email quite well, but it does send me a notification about the potential error. I spent some time googling and I can't find anyone that implemented the conversion, at least not as a Ruby 1.9.3 Encoding::Converter. So, my question is, since I never got an email with actual content, from an actual person, in UTF-7, how relevant is that encoding? can I safely ignore it?


title: Is using a bigger buffer useful?

text: I use buffer for quite a long time when I need to copy a stream or read a file. And every time I set my buffer size to 2048 or 1024, but from my point of view a buffer is like a "bucket" which carries my "sand" (stream) from one part of my land (memory) to an other part. So, increase my bucket capacity will in theory allow me to do less travel? Is this a good things to do in programming?


title: Are all languages basically the same?

text: Recently, i had to understand the design of a small program written in a language i had no idea about (ABAP, if you must know). I could figure it out without too much difficulty. I realize that mastering a new language is a completely different ball game, but purely understanding the intent of code (specifically production standard code, which is not necessarily complex) in any language is straight forward, if you already know a couple of languages (preferably one procedural/OO and one functional). Is this generally true? Are all programming languages made up of similar constructs like loops, conditional statements and message passing between functions? Are there non-esoteric languages that a typical Java/Ruby/Haskell programmer would not be able to make sense of? Do all languages have a common origin?


title: How to correctly write an installation or setup document

text: I just joined a small start-up as a software engineer after graduation. The start-up is 4 year old, and I am working with the CEO and the COO, even if there are some people abroad. Basically they both used to do almost everything. I am currently on some kind of training phase. I have at my disposition architecture, setup and installation internal documentation. Architecture documentation is like a bible and should contain complete information. The rest are used to give directions in different processes. The issue is that these documents are more or less dated, as they just didn't have the time to change them. I will be in charge of training the next hires, and updating these documents is part of my training. In some there is a lot of hard-coded information like:                Install this_module_which_still_exists          cd this_dir_name_changed          cp this_file_name_changed other_dir_name_changed          ./config_script.sh           ./execute_script.sh      The issues i have faced :   * Either the module installation is completely different (for instance now there is an rpm, or a different OS)   * Either names changed, and i need to switch old names by new names   * Description of the purpose of the current step missing.   * Information about a whole topic is missing Fortunately these guys are around and I get all the information I want and all the explanations I need. I want to bring a design to the next documents so in the future people don't feel like they are completely rewriting a document each time they are updating it. Do you have suggestions? If there is a lightweight design methodology available online you can point me to it's nice too. One thing I will do for sure is set up a versioning repository for the documents alone. There is already one for the source code so I don't know why internal documents deserve a different treatment.


title: What are the difference between: agent, actor, dataflow based programming?

text: What are the difference between the following terms?   * agent-based programming   * agent-based programming with microagents   * actor-based programming   * actor-based programming with lightweight actors   * dataflow based programming It is hard to find comparing articles and they are very similar. Afaik they have different constraints and they are implemented on a different abstraction level, but I need some reassurance...


title: PHP - Repository matrix pattern?

text: I'm trying really hard to refactor some of my legacy code in the project using best practices and design patterns + DDD so I'd love some feedback on an issue I'm currently having. Let's assume that I have two entity classes:               class Dog     {         protected $name;              function __construct($name)         {             $this->name = $name;         }              /**          * @return mixed          */         public function getName()         {             return $this->name;         }              function bark()         {             echo 'Rawr';         }     }          class Husky extends Dog     {         /**          * @var Sledge          */         protected $sledge;              function __construct($name, Sledge $slegde)         {             parent::__construct($name);             $this->sledge = $slegde;         }              function pull()         {             echo $this->sledge->pull();         }     }      `Dog` is my regular entity and his only responsibility is to map database fields. `Husky` on the other hand has same responsibilities as dog but also delegates `Sledge` pulling. Normally, both entities would have different repositories (should they? Since one inherits from one another) to call for, however business requirement implies that client does not have to specify dog's type (so it can either be a "basic" `Dog` or special `Husky`), just its name `http://localhost/animal/fluffy`. What is more, currently they both reside in the same database table (recognized by `type` field) and right now there are no technical plans to change that (performance and time reasons). What is the best way to do it?   * Should I create some `AnimalRepository`, pull the data and treat it as DTO, detect it's type and then create appropriate class?   * Should I create some kind of higher abstraction level mapper? How should it look like?


title: What are the advantages and disadvantages of splitting teams by architecture tier rather than by product?

text: As the title states; what are the advantages and disadvantages of splitting teams by architecture tier rather than by product? **_For example:_** **Organization A** has three teams:   * Team Web and Front End   * Team APIs, Web-Services and Data Stuffs   * Team Embedded Stuffs _Organization A_ teams, over time, have become more specialized in their work rather than being truly full-stack developers. **Organization B** has three teams:   * Team Product Alpha   * Team Product Beta   * Team Product Charlie _Organization B_ has fostered an environment of full-stack developers that are all fairly interchangeable among one-another. What will **Organization A** be able to do better (and not so better) than **Organization B** , and vice versa? You don't necessarily need to take the examples to heart, as they were just to get the point of my question across.


title: What does "because IL offers no instructions to manipulate registers, it is easy for people to create new languages" mean?

text: I am reading CLR via C# and came across this sentence in the first chapter and I did not understand what exactly it meant. Full line here: > because IL offers no instructions to manipulate registers, it is easy for > people to create new languages and compilers that produce code targeting the > CLR. What does it mean? I ventured a guess that it means IL is a bit low level, but not too low so that it is easy to create languages on top of it.


title: Creating alien symbols or signs that look natural

text: I was reading some Cthulhu Mythos stuff and started to think about those various signs and symbols that are used in the texts. Of course those are made by humans but point is that they look natural to human eyes. So, what kind of algorithm would be needed to create natural looking symbols and signs? How this problem could be approached? I guess Golden ratio and Fibonacci numbers are in key role.


title: What is the best approach for deploying apps to companies

text: What is the best approach for the following scenario: 1) A publicly available app (available in app stores) which is used by end users to make use of services offered by multiple companies. 2) These companies maintain their services also using a mobile app. I'm not sure on how to solve the second part. Having one app for both enduser and admin functionality, secured by username/password doesn't sound like a good idea. This would leave the only option of developing a separate admin application for the companies. What is the best approach to deploy "admin" like mobile apps to companies only, for Android, iOS and Windows Phone? Some additional information: > Public App ----> Servers -----> Multiple Company Apps The public app shows all companies offering their services. An end user uses the public app to order something from a specific company. The order is sent to our servers. Our servers send the order to the associated company. This order is displayed on the company's admin app and given the option to accept the order.


title: What do you think about the Joel Test?

text: The Joel Test is a well known test for determining how good your team is. What do you think about the points? Do you disagree with any of them? Is there anything that you would add?


title: Good approaches for packaging PHP web applications for Debian

text: Many PHP web applications follow this model for installation and upgrade:   1. Un-tar a source tar ball.   2. Point Apache at the source.   3. Navigate a web browser to the home page.   4. Go through several web pages of set-up (e.g., checks for existence of libraries, asks for database connection information, creates or updates database schema, etc.).   5. User renames an `install/` directory to something else so that application knows it has been installed. I don't see any (simple) way to create a Debian package out of this without making the user installing the package go through many of the above manual steps. Note that I am not a developer on the application so I am not in a position to make direct change to how the application installation works. What is the typical approach to packaging such an application?


title: Variable declaration versus assignment syntax

text: Working on a statically typed language with type inference and streamlined syntax, and need to make final decision about syntax for variable declaration versus assignment. Specifically I'm trying to choose between:               // Option 1. Create new local variable with :=, assign with =     foo := 1     foo = 2          // Option 2. Create new local variable with =, assign with :=     foo = 1     foo := 2      Creating functions will use `=` regardless:               // Indentation delimits blocks     square x =         x * x      And assignment to compound objects will do likewise:               sky.color = blue     a[i] = 0      Which of options 1 or 2 would people find most convenient/least surprising/otherwise best?


title: Assigning development work effectively to enable parallel development

text: I am currently doing my 1st accademic project where we have to work in groups of 4 to develop an application (java ...). Anyways, how might work be assigned so that there is less dependencies on each other and we can work separately instead of waiting on one another? I suggested 1 person develop 1 layer: Model, View, Controller, Data Access. I am working on Data Access but I find I need Model classes: For example My `EventsDataAccess` has a `findEventByName(String name)` that returns an `Event`, which is developed by another person. How should I proceed? Here `Event` is a very small class so it shouldn't take long, but suppose its big, it might be a long wait? How is work usually split up for developers in a small to medium sized team? Its so much easier to work in say a very small familiar team with, say 2 persons only


title: Multiple burndown charts on TFS project page

text: we work with Scrum in TFS2013, with one main project and multiple teams. What I want to do is make the homepage for the project display each teams burndown chart, so management can easily see all teams progress. Currently it rolls up all the burndown charts into a single burndown, and if I create charts I can only get line / bar / pie charts that are far less effective at displaying the same information. Is it possible to pin burn down charts to home pages? Thanks.


title: Functional document from code

text: I am a Sr java Developer and have recently joined a new team. Here I have been asked to create a functional document looking at the code of a legacy application. This application was written about 8-10 years back, which is currently running in live environment but due to lack of documentation it is difficult to be setup and run on local development box. I consulted some of the old team members who support it, but none was able to run it on their dev boxes. Now I have to create a functional document out of it (with running it only looking at the code) which will act as a base to re-write this application with new technology and some enhancements. Kindly suggest what would be the best way to move forward? I tried to find out from testers and found that there is no tester currently allocated to this application as it's an old running app on live. There are not much enhancements or bugs coming up. Ans as this re-write project is already queued up, the management is looking into aligning any coming bugs to this new app.


title: C++ : Association, Aggregation and Composition

text: I'm beginning to study OOAD and I'm having difficulty finding a `C++` code example that'd illustrate how `Association`, `Aggregation` and `Composition` are implemented programmatically. (There are several posts everywhere but they relate to C# or java). I did find an example or two, but they all conflict with my instructor's instructions and I'm confused. My understanding is that in:   * **Association:** Foo has a pointer to Bar object as a data member    * **Aggregation:** Foo has a pointer to Bar object and data of Bar is deep copied in that pointer.    * **Composition:** Foo has a Bar object as data member. And this is how I've implemented it:               //ASSOCIATION     class Bar     {         Baz baz;     };     class Foo     {         Bar* bar;         void setBar(Bar* _bar)         {             bar=_bar;         }     };          //AGGREGATION     class Bar     {         Baz baz;     };     class Foo     {         Bar* bar;         void setBar(Bar* _bar)         {             bar = new Bar;             bar->baz=_bar->baz;         }     };               //COMPOSTION     class Bar     {         Baz baz;     };     class Foo     {         Bar bar;         Foo(Baz baz)         {             bar.baz=baz;         }     };      Is this correct? If not, then how should it be done instead? It'd be appreciated if you also give me a reference of a code from a book (so that I can discuss with my instructor)


title: Entity design for a blackjack game - should I make Card an entity?

text: I am creating a simple blackjack game backed by database In my Card is               public class Card{      private Face face;      private Suit suit;           //setters.. getters     }      where `face` and `suit` are enums I have an entity `Bet` with the following               @Entity     public class Bet{        private Player player;        private String cards;        //...     }      Currently when I'm dealing cards I parse the suit and face to string and concatenate them in the cards field and then parse the cards if I want to calculate the score. I find this cumbersome so I want to change my field "cards" to List in the Bet Entity. Now, if that's the case I would have to make the Card class an entity as well. But my `cardService`, which is where I get my cards, does not rely on the database, it just creates random cards so it does not make sense to make card an entity - am I right?


title: How secure (or insecure) is it to install Node packages globally?

text: Should I be concerned with security when installing Node packages globally? Why or why not?


title: Javascript Ternary Operator vs. ||

text: I was taking a look at some node.js code earlier, and I noticed that the guy who wrote it seemed to favour the following syntax:               var fn = function (param) {         var paramWithDefault = null == param ? 'Default Value' : param;     }      Over what I consider to be the more concise:               var fn = function (param) {         var paramWithDefault = param || 'Default Value';     }      I was wondering if the second form is actually more socially acceptable JavaScript syntax, I've seen it out in the wild more times than the ternary operator for this purpose. I note that in the first example he's using the double equals (not the triple equals) which means it will count "undefined" as null, which would reduce one impact that I could think of. However, I've read in numerous places that == is a rather evil operator in JavaScript (JSLint is very much against it, IIRC).


title: Is it unethical to track app usage through REST API calls?

text: I am building an app that communicates with my website with ASIHTTPRequest to a PHP-based REST API on the server side. Naturally, in my app I have different endpoints on the server side, and usually return JSON data. Is it unethical to log counters on how many times each endpoint was hit? I'd like to capture how the app was used capturing what endpoint was hit, the user agent, time of day, possibly their IP (to group visits etc). Should I ask permission to do this?


title: Why aren't VM languages compiled just once?

text: (First of all, I should make clear that compilers and virtual machines (aka) are a completely unknown field for me) As I understand it, every time a Java/C#/... application is run, a VM is invoked and translates intermediate code (bytecode, CIL, etc) to machine instructions. But why can't this operation done only once - at install time?


title: "Gödel, Escher, Bach" still valid today?

text: I have just completed a course on computability and logic which was an interesting course. The lecturer recommend a few books on his slides, which include "Gödel, Escher, Bach". I can see the book is quite famous, and looks very interesting. But I have a few questions to ask regarding its content.   1. Is the content still valid today? I guess most theoretical stuff doesn't change over night, but are there any major points which no longer hold today that I should be aware of?   2. I assume we actually HAVE made some progress in the last 30 years or so. Can any of you recommend a book on the subject which includes this progress (logic, AI, computability)? _Another question:_ Do I have to know about Escher and Bach?


title: iPad app architecture with very large files

text: I am working on an iPad app. It needs to contain some very large files. I could put them into the app, but they would push it well over 20MB, which means that it would not be downloadable over the air -- only via iTunes. Is there a way around this without too much pain for me? I don't have a server or anything like that.


title: Studentworker - being a superhero?

text: A couple of weeks ago I got a new job as a studentworker for a webagency. The job is 15-20 hours of week. Even though I am new in the company, I feel right at home and I enjoy working with my co-workers. To start of with, I was assigned to work on an internal tool in the company, in order to learn their systems and their development platform. The deadline for this project is this week, and I am right on time. But today (wednesday at noon) I received an email from my boss, asking me to do a new project that has a deadline at friday morning. The new assignment alone will be hard to finish on time, and on top of that I need to finish the other assignment on time. My question is: How do I handle my boss expecting me to be a superhero? **EDIT:** I will talk to my boss about delaying one of the projects. But another problem is that the new assignment will be hard to do on time (friday morning). I didn't have a say on the deadline - I just got a mail telling me the deadline. I am new in the company and want to stay, but I don't want to start off on the wrong foot with the boss.


title: Structuring the XML Response

text: I'm designing an XML response for a consuming application to take in, and I'm weighing two different designs. Currently I have a design as follows (where the Product element can repeat):               <Response>         <AccountType>         <ProductType>         <Products>            <Product>                <ProductID />                <ProductStatus />                <ProductName />            </Product>            <Product>                <ProductID />                <ProductStatus />                <ProductName />            </Product>         </Products>     </Response>      An alternate design is:               <Response>         <AccountType>         <ProductType>         <Product>             <ProductID />             <ProductStatus />             <ProductName />         </Product>         <Product>             <ProductID />             <ProductStatus />             <ProductName />         </Product>     </Response>      In the first design I have a master element called Products, under which each Product element exists and can repeat within Products. The second design is a little flatter - where Product exists under the main Response node. Which one of the two is more optimal for a consuming application to read from and process?


title: Why Object.clone() is able to "see" fields defined in subclasses?

text: I was wandering how can Object.Clone() access field fields that are actually defined in the subclasses, and not the actual implementation of this feature. What is bothering me is that I cannot see the logic to allow base class (even if it is "special") to access the fields defined in the subclasses - doesn't this breaks whole object inheritance concept? Consider this:               class Test implements Cloneable     {         private String test_field;              public Test()         {         }              public Test clone() throws CloneNotSupportedException         {            return (Test)super.clone();         }     }      Here, calling `Test.clone()` will copy the `test_field` also. Things are even getting weirder for me when it comes to the situation where `Test` is declared as an abstract class - calling `clone()` will allow me (in some way) to get the instance of the abstract class.


title: Using a DAO to abstract our ORM from the rest of the application

text: We're using MySQL with Sequelize.js as the ORM. What we're wondering is whether a DOA layer of abstraction is worthwhile. Here are our options:   1. To use the Sequelize models throughout the application.   2. To abstract Sequelize by building a layer that converts Sequelize models to Backbone models so that we're using Backbone throughout the rest of the application instead. Is abstraction important in this case or is it normal to use Models from the ORM throughout the other layers?


title: How to test a program in an efficient way?

text: I know that a writing test case is one of the way to do some programming level testing, but how to test some careless mistake? or how to reduce? For example, a `buttonA`, should perform `ActionA`, but sometime, just human mistake, the `buttonA` perform `ActionB`. And it requires the human test, it seems can't automatic the testing process, any hints to do so? Thanks.


title: Why is it you never get as much done as you'd planned?

text: I always start the day thinking "I'll easily get this done by the end of the day" and set what looks like a realistic target. So why do I never hit it? The task always ends up taking 3x longer due to unforeseen bugs, last minute changes etc. Is it just me? I don't seem to be getting any better predicting what can be done in a day.


title: Is there a canonical resource on ERP?

text: For a while I've been wanting to learn ERP. What I would like to do is set up a system, and then practice running a business doing things like generating invoices, raising purchase orders, producing monthly accounts, and keeping track of fixed assets. Then look at enhancing the system further by adding custom code. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on ERP? What about that book makes it special?


title: Tips for working fast

text: What are some tips for helping to design and construct applications faster?


title: Term for a Class with Multiple Interfaces

text: Say I have a class that implements multiple interfaces. I pass the same instance around using a different interface, depending on what the consumer is interested in. I am trying to remember what this is called. I know there is a fancy name for it - I thought it was "interface partitioning", but I'm not finding any hits. The official name and perhaps a link to a site explaining what it is would be handy. In case I haven't explained myself well enough, here is a real world example. I have a class, call it `ContextManager`, that is responsible for providing access to configuration settings, session variables, user information and other utilities. Instead of passing the object around as a `ContextManager`, I might pass it around as an `IConfigurationManager` in one spot and as a `IUserManager` in another. This prevents the client from accessing things they shouldn't care about and allows me to reuse code within the class. I just want to know what it is called?


title: What programming language is most suitable for handling unstructured data?

text: I'm trying to automate the application of metadata to huge amount of text, but I'm not sure what language would make this task easier (if there is one). What programming language is most suitable for handling unstructured text? Why? If the answer is "it depends", what are a few examples of why you would use one language over another?


title: How to store data in Gujarati language in SQLite?

text: I am developing an Android application for Gujarat's farmers. So this app should be in Gujarati also. Is there any way so that I can store my data in Gujarati in SQLite?


title: Do you estimate all user stories in iteration zero?

text: After our product backlog is created and prioritized, are we meant to briefly estimate all the stories in the product backlog? I assume they have to be in order to create a product burndown chart, however if you have a lot of stories this could take a long time initially. Additionally, should a user story have acceptance criteria when added to the backlog or are those criteria added when the story transfers from the product backlog to the sprint backlog? It would be harder to estimate without them.


title: Common to use linear programming?

text: I have read about linear programming and its content and I wonder if this way of programming is common to use in the market? I often hear about object oriented programming but not linear programming. I would like to hear a discussion about it.


title: adding data gathering to a utility app and publish it to partners?

text: I've been working on a utility app for a while, and when we're in the final phases the boss is asking for adding user behavior and location tracking and was explicit about publishing them to 3rd party developers to make use of them. He seems to have set his mind about it, is there anything I can/should do about it? Clarify: if you are an app developer who's asked to add data gathering of the app users and publishing it, is there anything you should say against it ?


title: Should I make public my implementation of a published algorithm?

text: My company has problem A, lets say, face recognition. We find a nice algorithm like this one. We implement it and go home happy. Problem is, once home I cant sleep because I wonder if we should make the implementation public. After all the algorithm was public. Someone did intensive research and did half ( or more ) the work for us. I feel like we should help back and make our efforts public too. But then our commercial product would not be very _commercial_ , just image our banner: > Hey customer please buy our grunt master 6000 software, its only $1,000.00 ! > Oh by and by the way, you can download the main algorithms here for free ! Is there some sort of licence of derivative work from these academic research papers ? Is it my duty to make my implementations public ? Or is it up to me ? Can I make money from the algorithm ?


title: What does "automated build" mean?

text: I'm trying to add Continuous Integration to a project. According to Wikipedia, one major piece of CI is automated builds. However, I'm confused about what, exactly, that means, as the CI and build automation articles seem to disagree. **Specific points of confusion: what does "automated build" mean _in the context of:_**   * a project using an interpreted language, such as Python or Perl?   * building from source on an end-user's machine?   * an application that has dependencies that cannot be simply pre-compiled and distributed, such as a database in an RDBMS local to the user's machine?


title: ResourceSerializable: an alternate to ORM and ActiveRecord

text: A few opinionated reasons I don't like the traditional ORM and ActiveRecord patterns:   * **They work only with a database.** Sometimes I'm dealing with objects from an API and other objects from a database. All the implementations I have seen don't allow for that. _Feel free to clue me in if I'm wrong on this._     * **They are brittle.** Changes in the database will likely break your implemenation. Some implementations can help reduce this, but a few of the ones I've seen don't.     * **Their very design is influenced by the database.** If I want to switch to using an API, I'll have to redesign the object to get it to work (likely).   * **It seems to violate the single-responsibility pattern.** They know what they are and how they act, but they also know how they are created, destroyed and saved? Seems a bit much. **What about an approach that is somewhat more familiar in PHP: implementing an interface?** In php 5.4, we'll have the `JsonSerializable` interface that defines the data to be `json_encode`d, so users will become accustomed to this type of thing. What if there was a `ResourceSerializable` interface? This is still an ORM by name, but certainly not by tradition.               interface ResourceSerializable {         /**          * Returns the id that identifies the resource.          */         function resourceId();              /**          * Returns the 'type' of the resource.          */         function resourceType();              /**          * Returns the data to be serialized.          */         function resourceSerialize();     }      _Things might be poorly named, I'll take suggestions._ **Notes:**   * **`ResourceId` will work for API's and databases.** As long as your primary key in the database is the same as the resource ID in the API, there is no conflict. All of the API's I've worked with have a unique ID for the resource, so I don't see any issues there.   * **`ResourceType` is the group or type associated with the resource.** You can use this to map the resource to an API call or a database table. If the `ResourceType` was `person`, it could map to `/api/1/person/{resourceId}` and the table `persons` (or `people`, if it's smart enough).   * **resourceSerialize() returns the data to be stored.** Keys would identify API parameters and database table columns.   * **This also seems easier to test than ActiveRecord / Orm implemenations.** I haven't done much automated testing on traditional ActiveRecord/ORM implemenations, so this is merely a guess. But it seems that I being able to create objects independently of the library helps me. I don't have to use `load()` to get an existing resource, I can simply create one and set all the right properties. This is not so easy in the ActiveRecord / Orm implemenations I've dealt with. **Downsides:**   * **You need another object to serialize it.** This also means you have more code in general as you have to use more objects.   * **You have to map resource types to API calls and database tables.** This is even more work, but some ORMs and ActiveRecord implementations require you to map objects to table names anyway. **Are there other downsides that you see?** **Does this seem feasible to you?** **How would you improve it?** _Note: I almost asked this on StackOverflow because it might be too vague for their standards, but I'm still not really familiar with programmers.stackexchange.com, so please help me improve my question if it doesn't shape up to standards here._


title: Is there a formal anti-pattern to describe the scenerio?

text: Some code is written to generate Excel Spreadsheets (Office Interop).   * The code performs very poorly.       * A subsystem is designed to generate the files at night. Performance isn't a concern at night.        * A function is created to pick the correct file from the 100 different files available depending on a chosen set of parameters.       * Because physical files exist, an archival system is added to backup these files (There is no reason to archive. These files should be generated on the fly).       * This system doesn't include a configuration file, instead it has a hard coded "server picker" function that simply reflects upon the server the code is running upon.       * A scheduled task is necessary to support and run this service. This boils down to a single problem. The original code performs far too poorly to run in a production environment. Had the performance problem been resolved, the subsystem and subsequently archiving system, "file picker factory function", hard coded failure point and the maintenance of the scheduled task and its added point of failure have no need to exist. This is a "cascading failure" if you will. The original problem led to more bad code, more bad solutions and unnecessary overhead. Is there a formal anti- pattern or general term to describe it?


title: Should i expect real world questions from interviewing agency ?

text: I started coding almost a year ago. By "coding" I mean HTML(5), CSS(3), and only few times I implemented some AJAX and JavaScript. I am interviewing for a position that expects me to know HTML, CSS, JS, JQuery, and AJAX. I feel confident in HTML5/CSS3 subject area and somewhat ok with javascript. Will agency expect from me to write some code during the interview? I do have a live website as an example which contains snapshots of past projects which were sent to them. I am little nervous, so any tips or recommendations are welcome.


title: Would PMP or CEH(Certified Ethical Hacker) course be more useful to a junior ASP.Net web developer?

text: Only recently i moved into doing Asp.net web development work, with quite a fair bit on Asp.net MVC. I'm thinking of taking up some courses to further build up my profile. I'm having a touch decision between taking PMP or CEH. Would course would benefit my current career more or maybe in the upcoming 1-2 years? Thanks.


title: How to handle hidden folders on deployed website

text: Our security team at work did a security scan of our soon-to-be-deployed website and one of the items that was found was "Hidden Directory Detected". It shows up for 3 different folders, aspnet_client, scripts, and content. The software recommends to throw a 404 instead of a 403, or to remove the folders completely. First, are the folders actually needed? How can I determine which folders in my visual studio project are actually needed in order for the site to actually run (without removing folders one-at-a-time and trying to access the site)? What is the proper way to handle this/resolve the security scan alert? Do I need to add special routing rules in the routeconfig.cs for when these paths are accessed? Edit, I should note that this is WebApi/REST service, not a regular MVC site. (Therefore, using the CustomErrors configuration section will not work)


title: How do you handle measuring Code Coverage in JavaScript

text: In order to measure Code Coverage for JavaScript unit tests, one needs to instrument the code, run the tests and then perform post-processing. My concern is that, as a result, you are unit testing code that will never be run in production. Since JavaScript isn't compiled, what you test should be precisely what you execute. So here's my question, how do you handle this? One thought I had was to run Unit Testing on the production code and use that for my pass fail. I would then create a shadow of my production code, with instrumentation and run my unit tests again; this would give me my code coverage stats. Has anyone come across a method that is a little more graceful than this? **EDIT** I don't want to use browser plugins, because I then need to use a browser in order to run my unit tests.


title: What's the real benefit of meta-modeling?

text: After reading several texts about meta-modeling I still do not really get the practical benefit. Sometimes I think it is only an interesting mind game but no useful tool. Sure it is wise to clarify your modeling vocabulary: some may say _class_ where others say _entity_ or _concept_ , but this is just simple documentation your modeling terminology. Meta-modeling, as I understand it, is more complex, as it tries to formalize and abstract modeling. Some good examples are Keet's formal comparison of conceptual data modeling languages (UML, ERM and ORM) from academia and the Meta Object Facility (MOF) from industry. To me MOF looks as impractical as CORBA, which was also created by OMG. In theory you could use meta-modeling to transform and integrate models in different modeling languages, but is anyone actually doing this?


title: Questions and Concerns About Using Java/Tomcat and Apache

text: I am having to use Java due to needing one backend library. Is it still considered good practice to set up Apache as the front-facing server and have Tomcat behind it? I am spending a lot of time configuring mod_jk. Also, what do people usually use for CMS or web-page templating in such a setup? I wanted to use Drupal, but was advised that since I'd have to set up mod_jk and jump through extra hoops configuring it, it might not be a good approach. Could you guys please suggest some common considerations or good approaches in this sort of a situation? Thanks, Alex


title: How to handle a 'bad code' interview?

text: A 'bad code' interview is one where the interviewee is shown a snippet of 'bad code' and asked to correct it or point out things that are wrong with it. I have trouble with these interviews because it takes me some time to read the code, figure out what its doing, and point out the flaws. In a situation where there's time pressure, I tend to freeze up and I see that the code 'should' work, even when it doesn't. What's a good way to handle this sort of interview, and, more generally, what are some good techniques to read and understand code _quickly_?


title: Clojure Web Application: EC2 or GAE?

text: I am developing a web application written in Clojure using the Compojure framework. My question is, should I deploy to Amazon EC2 or Google App Engine? I've read this article on running Clojure code on GAE, but I am still a bit concerned about the limitations on GAE. I am going to be running sandboxed Clojure code, which means I might end up needing to tinker with the JVM security policies. With EC2, I'll obviously have full control of everything. The downside is that this means more of an effort from a sys admin perspective. I'm not sure which option makes more fiscal sense. I am not expecting too much traffic initially, and suspect that I'll operate pretty close to the "free" tier/quotas on either service. I've had a lot of success working with EC2 in the past, but at the same time I'd love to get some experience with Google App Engine (which I've never used). So whats your vote: Amazon EC2 or Google App Engine?


title: Setting up a development standardization guide for in-house/vendor programmers

text: I was recently hired by a large multi-national corporation to head up mobile development for their sales operation/support team. In a company of close to 10,000 people I am, at least in the America's, the only mobile developer. They are testing the waters and phase 1 (temp-to-hire) went well enough for them. Now they are considering expanding to other developers for their other sales operations/support teams and I've been tasked with assisting/leading the writing of a standardization guide for iOS programming. I am a big believer in giving people the freedom to work in the manner they most feel comfortable in but at the same time, I have been the creator of and on the receiving ends of big balls of mud applications. Having learned through experience I have several standards that I follow religiously such as commenting, at times almost every line - just short things but enough to let someone else know what is going on and using #pragma mark - DESCRIPTION to block off like minded methods, indentation, naming classes with a prefix to avoid name space conflicts, etc. etc. So I guess what I am looking for is not to tell another programmer how they should iterate through an array but rather some basic standardization so anyone can jump into anyone else's project and find their way around with little learning curve. I'd love to see what other means people use to maintain control over a software development group.


title: Real world Agile practices and estimates

text: In a perfect world, we tell the client we follow an agile methodology where we allow the scope to increase/decrease as the requirements change and we bill per hour for each iteration. In reality, estimates need to be delivered before the project starts, and there is always pressure to hit that estimate number while being flexible with scope changes. I'm wondering what sort of real-word agile practices people have applied to the de-facto waterfall based billing/estimating that we sometimes get stuck in. Can you "break-in" a client to agile mid project, after you have acquired trust, or are there any other techniques to transition a client to agile. *side note: in my "real world" situation I run a recently founded development company that does not have the luxury of forcing clients to use our method and process. Many times we have to bend our backs to use theirs, but I see it as a burden all businesses face when starting. I'm wondering how best to deal with it.


title: Is it possible to use a "non-commercial" REST API in a for-pay app?

text: I am interested in integrating the results of 3rd-party news API's into my for-pay application. The APIs would be a very small part of the app (e. g. the app is not just reselling the APIs). I have found that many APIs such as Yahoo have "non-commercial" conditions like the following: > YOU SHALL NOT: Sell, lease, share, transfer, or sublicense the Yahoo! APIs > or access or access codes thereto or derive income from the use or provision > of the Yahoo! APIs, whether for direct commercial or monetary gain or > otherwise, unless the API Documents specifically permit otherwise or Yahoo! > gives prior, express, written permission... (from Yahoo Local Search API page) Does this prevent the API from being used as part of any app which costs money to use? For example, if I charge you to get into my site, and then display some content from this API, is that OK? If I let you see the content from the API for free, but then charge you to do something else on the site, is that OK? I'm obviously not expecting specific legal advice. Instead, I'd like to know about either: (1) a good reference on this topic that can answer my question (2) an "answer by example", i. e. an example of a real-world app that does something similar


title: Should a method do one thing and be good at it?

text: "Extract Till You Drop" is someting I've read in Uncle Bob's blog, meaning that a method should do one thing alone be good at it. **What is that one thing?** When should you stop extracting methods? Let's say I have a login class with the following methods:                public string getAssistantsPassword()      public string getAdministratorsPassword()      These retrieve the respective accounts password in the database. Then:                public bool isLogInOk()      The method compares the password that has been called or selected, and sees if the password the user provided is in the database. Is this an example of "Extract Till You Drop"? **When will you know when you are doing too much of extracting?**


title: Why are we supposed to use short functions to sectionalize our code?

text: I've seen an increasing trend in the programming world saying that it is good practice to separate code blocks into their own functions. Obviously, if that code block is reusable, you should do that. What I do not understand is this trend of using a function call as essentially a comment that you hide your code behind if the code is not reusable. That's what code folding is for. Personally, I also hate reading code like this because it feels like it has the same problem as the GOTO statement - it becomes spaghetti code where if I'm trying to follow the program's flow I'm constantly jumping around and can't logically follow the code. It is much easier to me to follow code that is linear but has a single comment over sections of code labeling what it does. With code folding, this is essentially the same exact thing, except the code stays in a nice linear fashion. When I try to explain this to my colleagues, they say comments are evil and clutter - how is a comment on top of a block of folded code any different from a function call that will never get called more than once? How is overusing functions different than overusing comments? How are frequent use of functions different from the problems with GOTO statements? Can someone please explain the value of the programming paradigm to me?


title: Is it OK to split long functions and methods into smaller ones even though they won't be called by anything else?

text: Lately I've been trying to split long methods into several short ones. **For example:** I have a `process_url()` function which splits URLs into components and then assigns them to some objects via their methods. Instead of implementing all this in one function, I only prepare the URL for splitting in `process_url()`, and then pass it over to `process_components()` function, which then passes the components to `assign_components()` function. At first, this seemed to improve readability, because instead of huge 'God' methods and functions I had smaller ones with more descriptive names. However, looking through some code I've written that way, I've found that I now have no idea whether these smaller functions are called by any other functions or methods. **Continuing previous example:** someone looking at the code might think that `process_components()` functionality is abstracted into a function because it's called by various methods and functions, when in fact it's only called by `process_url()`. This seems somewhat wrong. The alternative is to still write long methods and functions, but indicate their sections with comments. Is the function-splitting technique I described wrong? What is the preferred way of managing large functions and methods? **UPDATE:** My main concern is that abstracting code into a function might imply that it could be called by multiple other functions. **SEE ALSO:** discussions on reddit at /r/programming (provides a different perspective rather than most of the answers here) and /r/readablecode.


title: How to avoid peppering the code with IFs

text: I need to add a new payment type to an existing code base. That means that I'm going to have a few methods looking like this:               if (old payment type)         process old type of payment     else         process new type of payment      Now, if this could have been determined beforehand, I would have this method point to an interface implementing a common Pay method and then that interface would be implemented by one of two classes. Unfortunately, I only know which method the customer chooses at runtime, which means I need a way to determine which branch to use. Is there another way except for just having `if`s spread through the code?


title: Are too many if-else statements for validation bad?

text: From the book Professional Enterprise .Net, which has 5 star rating on Amazon that I am doubting after having a read through. Here is a Borrower class (In C# but it's pretty basic; anyone can understand it) that is part of a Mortgage application the authors built:                   public List<BrokenBusinessRule> GetBrokenRules()         {             List<BrokenBusinessRule> brokenRules = new List<BrokenBusinessRule>();                  if (Age < 18)                 brokenRules.Add(new BrokenBusinessRule("Age", "A borrower must be over 18 years of age"));                  if (String.IsNullOrEmpty(FirstName))                 brokenRules.Add(new BrokenBusinessRule("FirstName", "A borrower must have a first name"));                  if (String.IsNullOrEmpty(LastName))                 brokenRules.Add(new BrokenBusinessRule("LastName", "A borrower must have a last name"));                  if (CreditScore == null)                 brokenRules.Add(new BrokenBusinessRule("CreditScore", "A borrower must have a credit score"));             else if (CreditScore.GetBrokenRules().Count > 0)             {                 AddToBrokenRulesList(brokenRules, CreditScore.GetBrokenRules());             }                  if (BankAccount == null)                 brokenRules.Add(new BrokenBusinessRule("BankAccount", "A borrower must have a bank account defined"));             else if (BankAccount.GetBrokenRules().Count > 0)             {                 AddToBrokenRulesList(brokenRules, BankAccount.GetBrokenRules());             }             // ... more rules here ...             return brokenRules;         }      Full code listing on snipt.org . What is confusing me is that the book is supposed to be about professional enterprise design. Maybe I am a bit biased because the author confesses in chapter 1 that he didn't genuinely know what decoupling was, or what SOLID meant until the 8th year of his programming career (and I think he wrote the book in year 8.1) I am no expert but I don't feel comfortable with:   1. Too many if else statements.    2. The class both serves as an entity _and_ has validation. Isn't that a smelly design? (You might need to view the full class to get some context) Maybe I am wrong, but I don't want to pick up bad practices from a book which is supposed to be teaching an enterprise design. The book is full of similar code snippets and it is really bugging me now. If it _is_ bad design, how could you avoid using too many if else statements. I obviously do not expect you to rewrite the class, just provide a general idea of what could be done.


title: Style for control flow with validation checks

text: I find myself writing a lot of code like this:               int myFunction(Person* person) {       int personIsValid = !(person==NULL);       if (personIsValid) {          // do some stuff; might be lengthy          int myresult = whatever;          return myResult;       }       else {         return -1;       }     }      It can get pretty messy, especially if multiple checks are involved. In such cases, I've experimented with alternate styles, such as this one:               int netWorth(Person* person) {       if (Person==NULL) {         return -1;       }       if (!(person->isAlive))  {         return -1;       }       int assets = person->assets;       if (assets==-1)  {         return -1;       }       int liabilities = person->liabilities;       if (liabilities==-1) {         return -1;       }       return assets - liabilities;     }      I'm interested in comments about the stylistic choices here. [Don't worry too much about the details of individual statements; it's the overall control flow that interests me.]


title: Is it a good practice to write a method that gets something and checks the value?

text: Occassinally I have to write methods like this:               string GetReportOutputDirectoryAndMakeSureExist()     {         string path = Path.Combine ( ... ) //whatever logic          if(!Directory.Exists(path)) Directory.Create(path);         return path;     }      or               string GetAndVerifyExistenceOfReportConfigurationPath()     {         string path = Path.Combine ( ... ) //whatever logic to find the configuration         if(!File.Exists(path)) throw new Exception("Report configuration not found");         return path;     }      or               Customer GetCustomerAndVerifyActive(int id)     {         Customer customer = Db.GetCustomerById(id);         if(!customer.IsActive) throw new Exception("Customer is not active");         return customer;     }      Is it a good practice? I am told that it is normally not a good idea for a method to do more than one things, or for a method to have side-effects (like creating directory). But if I split, for example the last metod to GetCustomer(id) and VerifyActive(customer), I will have to do:               var customer = GetCustomer(id);     VerifyActive(customer);      consecutively at several places, and I think it counts as violation of DRY. Is this a good idea? Any idea how to help with the long method names?


title: How to do a clean refactoring of an If Else Code without leaving any free blocks?

text: if(condition1)     {        Statement1A;        Statement1B;     }     else if(condition2)     {       Statement2;     }     else if(condition3)     {       Statement3;     }     else      {        Statement1A;        Statement1B;     }             return;      I would like to refactor that code so that I do not duplicate Statements. I **always** need to check condition1 before any other condition. (So I cannot just change the order of the conditions). I also do not want to write `&&!condition1` after every other condition. I solved it like this               if(condition1)     {     }     else if(condition2)     {       Statement2;       return;     }     else if(condition3)     {       Statement3;       return;     }          Statement1A;     Statement1B;     return;      However I do not think an empty if condition will be easily understandable by others (even by me after a while). What is a better approach?


title: Until what point should I refactor?

text: What do you think until what point should a programmer refactor the code? Basically having               def method       do_something     end      Pieces of code would be handy, but they increase spaghetti code until the point where you have to remember the path of more than 8-10 methods. So wouldn't be easier to have no more than 3 methods spaghetti code, despite the fact that the method is longer than it suppose to be


title: Approaches to checking multiple conditions?

text: What is the best practice for checking multiple conditions, in no particular order? The example in question needs to check four distinct conditions, in any order, and fail showing the correct error message. The examples below use a C-like syntax. ## Option 1: Check all at once This method isn't preferred because the reasons why the condition failed aren't easy to discern.               if (A && B && C && D) {         // continue here...     } else {         return "A, B, C, or D failed";     }      ## Option 2: Nested Conditions In the past, I used to use nested conditional statements, like so. This can get really confusing.               if (A) {         if (B) {             if (C) {                 if (D) {                     // continue here...                 } else {                     return "D failed"                 }             } else {                 return "C failed";             }         } else {             return "B failed";         }     } else {         return "A failed";     }      ## Option 3: Fail-early This is the current method I use, which I like to call _fail-early_. As soon as a "bad" condition is hit, it returns.               if (!A) {         return "A failed";     }          if (!B) {         return "B failed";     }          if (!B) {         return "C failed";     }          if (!D) {         return "D failed";     }          // continue here...      # Option 4: Collect Errors One last approach I can think of is a sort of _collection_ of errors. If the conditions to test for are completely separate, one might want to use this approach.               String errors = "";     if (!A) {          errors += "A failed\n";     }          if (!B) {         errors += "B failed\n";     }          if (!C) {         errors += "C failed\n";     }          if (!D) {         errors += "D failed\n";     }          if (errors.isEmpty()) {         // continue here...     } else {         return errors;     }      What are the best practices for checking multiple conditions? In terms of expectations, it ideally behaves like example 4, where details of all the failures are returned.


title: Avoid Code Repetition in Condition Statements

text: I have been programming for over 15 years now. I consider myself a very good programmer, but I understand (like all of us) there are things that I need to work on. One of these things is code repetition when dealing with conditions. I will give a generic sample:               if(condition1)     {          //perform some logic          if(condition2)          {               //perform some logic               if(condition3)               {                    //Perform logic               }               else               {                    //MethodA(param)               }          }          else          {               //MethodA(param)          }     }     else     {          //MethodA()     }      Now, I cannot make it easy by doing the following:               if(condition1 && condition2)     {          }     else     {          }      I cannot do this since I need to perform some logic if condition1 is true and before I test condition2. Is there a way to structure if...else blocks to where if you need to call a method in each else blocks, you are not repeating yourself?


title: Eliminate duplicate code in nested IFs without creating a function

text: Let's say we have two ifs that depend on each other:               if var exists {         if var is array {             //Do stuff with var         } else {             //Resolve the problem         }     } else {         //Resolve the problem in the exact same way as above     }     //Continue execution with the assumption that var is in the appropriate state      How can I refactor this to remove the duplicated code without using gotos or functions/methods?


title: Refactoring into lots of methods - is this considered clean or not?

text: So, I watched as my colleague complained a bit about a project he has inherited from someone who is, shall we say, not very experienced as a programmer (intern left to his own devices on a project). At one point there was duplicate code, about 7-8 lines of code duplicated (so 14-16 lines total) in a method of say 70-80 lines of code. We were discussing the code, and he spotted a way to refactor this to remove the duplication by simply altering the structure a bit. I said great, and then we should also move the code out to a separate method so the large method gets a little more readable. He said 'no, I would never create a method for just 7-8 lines of code'. Performance issues aside, what are **your** input on this? Do you lean against using more methods (which in c# pads code with about 3 lines) or larger methods, when that particular code will probably not be used anywhere else? So it is purely a readability issue, not a code-reuse one. Cheers :)


title: How would you refactor nested IF Statements?

text: I was cruising around the programming blogosphere when I happened upon this post about GOTO's: http://giuliozambon.blogspot.com/2010/12/programmers-tabu.html Here the writer talks about how "one must come to the conclusion that there are situations where GOTOs make for more readable and more maintainable code" and then goes on to show an example similar to this:               if (Check#1)     {         CodeBlock#1         if (Check#2)         {             CodeBlock#2             if (Check#3)             {                 CodeBlock#3                 if (Check#4)                 {                     CodeBlock#4                     if (Check#5)                     {                         CodeBlock#5                         if (Check#6)                         {                             CodeBlock#6                             if (Check#7)                             {                                 CodeBlock#7                             }                             else                             {                                 rest - of - the - program                             }                         }                     }                 }             }         }     }      The writer then proposes that using GOTO's would make this code much easier to read and maintain. I personally can think of at least 3 different ways to flatten it out and make this code more readable without resorting to flow-breaking GOTO's. Here are my two favorites. 1 - Nested Small Functions. Take each if and its code block and turn it into a function. If the boolean check fails, just return. If it passes, then call the next function in the chain. (Boy, that sounds a lot like recursion, could you do it in a single loop with function pointers?) 2 - Sentinal Variable. To me this is the easyest. Just use a blnContinueProcessing variable and check to see if it is still true in your if check. Then if the check fails, set the variable to false. How many different ways can this type of coding problem be refactored to reduce nesting and increase maintainability?


title: Making some methods mostly contain method calls, while others doing "the lowest level" work

text: So I thought about this, and I don't know if it's included or not in any methodology. I think the advantages of this coding style is that, at the lowest level, the code is extremely testable, and then the integration tests should also be very easy to build. I also think this would make the code more readable and the UML would be understood faster. So here's my example:               class CoolObject{     var member1; //needed for instance in lifecycle events     var member2; //same comment             //This method could be for instance an event handler        //Notice this contains only assignments and method calls. No library calls or lower level stuff        [public] method high_level(params...){          var local_var1;         var local_var2;         local_var1 = call method lower_level1(param1,param2);         local_var2 = call method lower_level2(param1, local_var1);         member1 = call method lower_level3(local_var2);        }             //Notice this contains only library calls and lower level processing        [private] method lower_level1(param1, param2){         return param1 + param2 + libraryXXY123.function142(current_date);        }             //Notice this contains only library calls and lower level processing        [private] method lower_level2(param1, param2){          var return_value;          loop over param2{             if(condition){                add param1 to return_value;             }          }          return return_value + libraryASDF123.function3132(system_user);             }          }      Please note that this is not written in any specific language, as I only wanted to illustrate the concept. So do you know some methodologies that use this, or that warn against it? Please elaborate on the answer, as I think this would be a good idea, and would like this either confirmed, or the opposite.


title: How to tackle a 'branched' arrow head anti-pattern?

text: I recently read this question that features, the arrow anti-pattern. I have something similar in code I'm trying to refactor except that it branches. It looks a little something like this:               if(fooSuccess==true&&barSuccess!=true){         if(mooSuccess==true){                .....         }else if (mooSuccess!=true){                .....         }     }else if(fooSuccess!=true&&barSuccess==true){         if(mooSuccess==true){                .....         }else if (mooSuccess!=true){             if(cowSuccess==true){                         .....             }else if (cowSuccess!=true){                         .....             }         }     }     ......      In short it looks like this               if        if          if            if              do something            endif         else if          if            if              do something             endif         endif         else if          if            if              do something             endif         endif      endif      Outline borrowed from Coding Horror article on the subject And the code goes on through different permutations of true and false for various flags. These flags are set somewhere 'up' in the code elsewhere, either by user input or by the result of some method. How can I make this kind of code more readable? My intention is that eventually I will have a Bean-type object that contains all the choices the previous programmer tried to capture with this branching anti-pattern. For instance, if in the outline of the code above we really do only have three, I have an enum set inside that bean:               enum ProgramRouteEnum{         OPTION_ONE,OPTION_TWO,OPTION_THREE;              boolean choice;         void setChoice(boolean myChoice){             choice = myChoice;         }         boolean getChoice(){             return choice;         }     }      Is this an acceptable cure? Or is there a better one?


title: Using Functions for Never-Repeated Code

text: What are some best practices for using functions to break up large blocks of code into discrete chunks of logic when those functions are only ever going to be used once within the lifetime of a function? The canonical example for web development is the initialization of a home page. When the page loads, you might do something like check some credentials and authentication, make an API call to get some data, and parse that data. Naturally, this could all be written in a procedural format within a large function called initialize(). None of the logic will foreseeably be re-used anywhere else within the program. When I'm confronted with such scenarios, my initial instinct is to divide each piece of logic into a discrete function and simply call the functions from an initialize() function, with a few lines of code within initialize() performing some clean up and tear down duties. So I'd have something like an authenticate(), get_data(), and parse_data() function, as well as perhaps a few helper functions for the main functions. In my opinion, that makes the code easier to understand from a high level, makes unit tests more meaningful, and helps organize your thinking as you're writing your code. However, I recently clashed with a guy who essentially thinks the opposite. He feels too many functions lead to "annoying jumping around", functions should never be used if code is not going to be re-used, and that the over-use of functions/classes/modules/any kind of modularity amounts to over-engineering. I was put off by his argument and felt that it leads to the shitty procedural PHP that so often makes web development a nightmare, but perhaps there is some validity in what he's saying?


title: Should I repeat condition checking code or put it in a function?

text: I have a bunch of calls to a method that may or may not need to be made depending on whether certain features are enabled or not. As such, I've wrapped these calls in `if` blocks checking the enabled statuses. The arguments to the method in each of these calls use some long variable names, so I've broken them out into different lines for readability / to adhere to our line-length coding standard. These large method-call blocks, combined with the condition checks to see if they should be run (exacerbated by the mandate that we enclose all `if` blocks in braces), are quite noisy. So I have something like this:               if (FeatureSettings.FeatureXIsEnalbed)     {         this.TheMethodImCalling(             FeatureSettings.ReallyLongFeatureXSettingAName,             FeatureSettings.ReallyLongFeatureXSettingBName,             ...);     }          if (FeatureSettings.FeatureYIsEnalbed)     {         this.TheMethodImCalling(             FeatureSettings.ReallyLongFeatureYSettingAName,             FeatureSettings.ReallyLongFeatureYSettingBName,             ...);     }          if (FeatureSettings.FeatureZIsEnalbed)     {         this.TheMethodImCalling(             FeatureSettings.ReallyLongFeatureZSettingAName,             FeatureSettings.ReallyLongFeatureZSettingBName,             ...);     }      To reduce the noise and redundancy in this code I was thinking of taking the `if` block structure and putting it _inside_ `TheMethodImCalling`, then passing in the `...IsEnabled` value along with the rest of the arguments. This seems somewhat silly though as I would effectively be calling the method and telling it "Don't do anything." when a feature wasn't enabled. Now, I could probably make the code a bit more readable by assigning the long settings to shorter temporary variables or even fields of an `Arguments` class that I would then pass to the method, but those don't address the core question: **Should I repeat the condition checking code or put it in the function?** Or is there an alternative I should consider? (Both options seem somewhat smelly...)


title: Which is a better pattern (coding style) for validating arguments - hurdle (barrier) or fence?

text: I don't know if there are any accepted names for these patterns (or anti- patterns), but I like to call them what I call them here. Actually, that would be **Question 1:** What are accepted names for these patterns, if any? Suppose there is a method that accepts a bunch of parameters, and you need to check for invalid input before executing actual method code:               public static void myMethod (String param1, String param2, String param3)      ## Hurdle Style I call it so because it's like hurdles a track runner has to jump over to get to the finish line. You can also think of them as conditional barriers.               {         if (param1 == null || param1.equals("")) {             // some logging if necessary             return; // or throw some Exception or change to a default value         }              if (param2 == null || param2.equals("")) {             // I'll leave the comments out             return;         }              if (param3 == null || param3.equals("")) {             return;         }              // actual method code goes here.     }      When the checks are for a certain small section in a larger method (and the section cannot be moved to a smaller private method), labelled blocks with `break` statements can be used:               {         // method code before block              myLabel:         {             if (param1 ... // I'll leave out the rest for brevity                 break myLabel;             if (param2 ...                 break myLabel;             ...                  // code working on valid input goes here              } // 'break myLabel' will exit here              // method code after block     }      ## Fence Style This surrounds the code with a fence that has a conditional gate that must be opened before the code can be accessed. Nested fences would mean more gates to reach the code (like a Russian doll).               {         if (param1 != null && !param1.equals("")) {             if (param2 != null && !param2.equals("")) {                 if (param3 != null && !param3.equals("")) {                          // actual method code goes here.                      } else {                     // some logging here                 }             } else {                 // some logging here             }         } else {             // some logging here         }     }      It could be re-written as follows too. The logging statements are right beside the checks, rather than being after the actual method code.               {         if (param1 == null || param1.equals("")) {             // some logging here              } else if (param2 == null || param2.equals("")) {             // some logging here              } else if (param3 == null || param3.equals("")) {             // some logging here              } else {                  // actual method code goes here.              }     }      **Question 2:** Which style is better, and why? **Question 3:** Are there any other styles? > I personally prefer _hurdle style_ because it looks easier on the eyes and > does not keep indenting the code to the right every time there's a new > parameter. It allows intermittent code between checks, and it's neat, but > it's also a little difficult to maintain (several exit points). > > The first version of _fence style_ quickly gets really ugly when adding > parameters, but I suppose it's also easier to understand. While the second > version is better, it can be broken accidentally by a future coder, and does > not allow intermittent code between conditional checks.