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

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


title: Technical manager (not lead architect) of development team

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


title: Are dynamic languages at disadvantage for agile development?

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


title: Agile Retrospective Ideas

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


title: What does "windowed streaming" stand for?

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


title: Front controller in PHP

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


title: How to manage multiple database credentials across multiple projects

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


title: Class as first-class object

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


title: How much should Developers interact with Clients?

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


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

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


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

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


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

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


title: Question about Cyclomatic Complexity

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


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

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


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


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

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


title: Are XML Schemas bad for constantly evolving file formats?

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


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

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


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

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


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

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


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

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


title: Recording unstructured suggestions and feedback in an issue tracker?

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


title: Confused about the different terminology with .NET

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


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

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


title: Should a domain object wrap/contain a DTO interface?

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


title: How to deal with multiple output modes of multiple types?

text: _Note: The business domain being a bit complicated to explain, I replaced the names of actual classes by more illustrative examples._ I'm writing an application in which the business layer returns a set of `Pet`s: either a `Cat` or a `Dog`:               class Pet(metaclass=ABCMeta): # Pet is abstract.         ...         getName(self):         ...          class Dog(Pet):         ...          class Cat(Pet):         ...      I want to display those pets using a given format which is determined by the user. For example, the user may ask to show only the name of each pet, or obtain a JSON representation, or have a rich representation which is biased towards cats, i.e. it _displays much more information about cats than about dogs_. In the presentation layer, I have an abstract class `Output` with an abstract method which outputs the pets, and then I have concrete implementations of every type of output: a `class NameOutput(Output)`, a `class JsonOutput(Output)`, or a `class RichOutput(Output)`. The first two ones are easy: they just use the abstract `Pet` class, and don't care if it's a dog or a cat. The problem is the last class, since the logic is different for a dog than for a cat.               class Output(metaclass=ABCMeta): # Output is abstract.         generateOutput(self):             for pet in self.pets:                 yield self.processPet(pet)              @abstractmethod         processPet(self, pet):             pass          class NameOutput(Output):         ...          class JsonOutput(Output):         ...          class RichOutput(Output):         ...         processCat():             ...         processDog():             ...      Determining the type of pet during the execution and calling different methods for each pet feels ugly. Also, when a maintainer would need to add `class Hamster(Pet)`, he will learn the hard way that he also should create an additional method in `RichOutput(Output)`. On the other hand, moving the output logic to the pets themselves doesn't look right either: what if I need to create an additional display format? What are my options? How is this problem usually solved?


title: Should I group all of my .js files into one large bundle?

text: One of the difficulties I'm running into with my current project is that the previous developer spaghetti'd the javascript code in lots of different files. We have modal dialogs that are reused in different places and I find that the same .js file is often loaded twice. My thinking is that I'd like to just load all of the .js files in _Layout.cshtml, and that way I know it's loaded once and only once. Also, the client should only have to download this file once as well. It should be cached and therefore shouldn't really be a performance hit, except for the first page load. I should probably note that I am using ASP.Net bundling as well and loading most of the jQuery/bootstrap/etc from CDN's. Is there anything else that I'm not thinking of that would cause problems here? Should I bundle everything into a single file?


title: How did they count the number of lines of code executed at runtime?

text: There was a PC game released in 2001 called Black & White by Lionhead studios in which there was a lengthy statistics page which updated in real-time. There were stats such as how many people killed, how much money you've earned, etc... but the really puzzling one was Total lines of code executed, which was into the billions and counting. How would they have known this, how would they have calculated this at runtime? Did they make it up?


title: Tracking hours on a project

text: Other than the following, are there any helpful (to programmers) reasons to track hours/time on a project down to the "accurate number of hours per week" level? Reasons:   * Beneficial to see how estimates vs. actuals came out (to improve estimation)   * Management said so (for contractual or business reasons) This is a bit tongue in cheek, but my personal preference has always been to track at an abstracted level. For example: a person is either "full time" (defined as either 40hrs/week or a less intense 32hrs/week) or part time, or they spend a few hours here and there on the project. It seems (as a manager) that chasing any kind of accurate number for actual hours is much like measuring the length of a coastline. The more accurate you try to get, the more confounding it is. That said, I'd appreciate any insights on benefits to programmers. thanks!


title: What is the advantage of learning about and understanding compiler construction?

text: I'm a undergraduate in my 3rd year of a Software Engineering degree. From this year on, my university has introduced a new course called 'Compiler Constructions', which teaches you the basics of the theory of building a compiler. What would be the real world advantage for a Software Engineer of learning about compiler construction?


title: What is the equivalent of functions and methods in SQL?

text: In language like C or Java, there are things like functions/methods to modularize and abstract stuff. What is there in SQL, specifically for Oracle? I've seen people talking about using views to reduce the complexity in various blogs but there is only so much that can be done with a view. (For example, a bind variable cannot be passed as a runtime parameter to a view). In tools like Oracle Reports the query sometimes gets very awkward running several hundreds of lines. I was wondering what sort of techniques people use to manage the complexity of their SQL? What are the equivalents of functions and methods in SQL to keep SQL from becoming extremely complex?


title: How to specify WIP limits in Kanban?

text: Consider a typical Kanban board: Input, Analysis, Dev Ready, Development, Build Ready, Test, Release Ready How to specify WIP limits for each column? any formula?


title: Is there a common denominator of all Smalltalk implementations?

text: In most languages, there is standard libraries. And this is foundation, common denominator of them. Applications can be written with guarantee of the denominator. What's the core of Smalltalk?


title: Are there any FOSS operating systems available that conform to NASA's JPL coding standards?

text: I, like many others, have been completely enamored with the recent successful landing of Mar's Curiosity rover. After reading a couple of articles, and following a few links, I've found a couple C based coding standards that NASA JPL uses to formalize their code and protect it from error. (See here and here.) This has me curious. Are there any open-source operating systems available that adhere to these coding standards that are available for common architecture, such as x86, x64 or possibly ARM?


title: Provide multiple SendCompleted callbacks to SmtpClient

text: I have an `Email` class that has a `Send` method that optionally takes an `SmtpClient` and sends an email asynchronously using `SendAsync`. If no `SmtpClient` is supplied to this method, it instantiates a default `SmtpClient` and uses that to send the email. Inside the `Send` function, I provide a `SendCompleted` callback which disposes of the `MailMessage` and the default `SmtpClient` if one was not supplied to the method. **So when I am supplying the`SmtpClient`, how do I go about disposing it?** I can't dispose of it inside `Send` because it may be used for sending other emails, plus I figure it's the responsibility of the thing that instantiated the passed in `SmtpClient` to dispose of it again. Is it possible to add multiple `SendCompleted` callbacks to the `SmtpClient` that run after each other?


title: Except garbage collector, what else makes Java a non real time programming language

text: Except the garbage collector, what are some other features in Java that make it unsuitable for real time programming? On the net, whenever Java vs C++ is discussed with regards to real time programming, it is always the garbage collector that is mentioned. Is there anything else?


title: PayPal proof of payment - is there a need to store it at our server?

text: I am developing an iPhone app, which I am integrating with PayPal. I did it successfully using PayPal library. I am testing it on sandbox mode. When I transfer money from one account to the other account, it displays a message "send to server for verification". Is there a real need to store this PayPal transaction id and other details on our server?


title: Thoughts on type aliases/synonyms?

text: I'm going to try my best to frame this question in a way that doesn't result in a language war or list, because I think there could be a good, technical answer to this question. Different languages support type aliases to varying degrees. C# allows type aliases to be declared at the beginning of each code file, and they're valid only throughout that file. Languages like ML/Haskell use type aliases probably as much as they use type definitions. C/C++ are sort of a Wild West, with `typedef` and `#define` often being used seemingly interchangeably to alias types. The upsides of type aliasing don't invoke too much dispute:   * It makes it convenient to define composite types that are described naturally by the language, e.g. `type Coordinate = float * float` or `type String = [Char]`.   * Long names can be shortened: `using DSBA = System.Diagnostics.DebuggerStepBoundaryAttribute`.   * In languages like ML or Haskell, where function parameters often don't have names, type aliases provide a semblance of self-documentation. The downside is a bit more iffy: aliases can proliferate, making it difficult to read and understand code or to learn a platform. The Win32 API is a good example, with its `DWORD = int` and its `HINSTANCE = HANDLE = void*` and its `LPHANDLE = HANDLE FAR*` and such. In all of these cases it hardly makes any sense to distinguish between a HANDLE and a void pointer or a DWORD and an integer etc.. Setting aside the philosophical debate of whether a king should give complete freedom to their subjects and let them be responsible for themselves or whether they should have all of their questionable actions intervened, could there be a happy medium that would allow the benefits of type aliasing while mitigating the risk of its abuse? As an example, the issue of long names can be solved by good autocomplete features. Visual Studio 2010 for instance will alllow you to type DSBA in order to refer Intellisense to System.Diagnostics.DebuggerStepBoundaryAttribute. Could there be other features that would provide the other benefits of type aliasing more safely?


title: How to stay focused on learning a language with so many other possibilites?

text: What do you do to stay focused when learning a new language with so many other interesting languages out there?


title: Best source control system for busy web development team

text: Having had a number of instances of merge problems and other difficulties with a large Subversion repository and a team of 10+ developers I'm considering whether SVN is the right tool and what else to consider? Primary system being managed is a large PHP web application with release cycles averaging 2-3 weeks apart and 4+ concurrent projects in active development at any time. Is subversion the right system or should we adopt Git, Mercurial or something else?


title: MVC sending information from view to controller

text: I am using the MVC pattern. Lets say I want to create a new object and add it to my database. Where is it better to create the new object: View:               Boo boo = new Boo("awesomness");     Controller.AddDB(boo);      Controller:               public void AddDB(string name)     {        Boo boo = new Boo(name);        addtodb(boo);     }


title: Controller JSP - no view

text: Most people say do not use JSPs. But what if I have a JSP that does not show anything, it only acts as a controller? Why would I do that? Because we do not need to redeploy complete webapp to make a small but significant change in a servlet -> instead can just put my new JSP in the JBoss _tmp_ folder till we do a full deploy. This controller JSP will of course include / redirect to other view JSPs for final rendering. Question what are the downsides of doing this? If we already have it in our application (it's been working for the last 8 years before I joined); should we keep it as it works or are there any compelling reasons to change it to a regular servlet? Note: the JSPs in question are not the only controller, rather they do some of the processing for certain use cases


title: How and why to decide between naming methods with "get" and "find" prefixes

text: I always have trouble figuring out if I should name a certain method starting with `getSomething` versus `findSomething`. The problem resides in creating _helpers_ for poorly designed APIs. This usually occurs when getting data from an object, which requires the object as a parameter. Here is a simple example:               public String getRevision( Item item ) {         service.load( item, "revision" );         // there is usually more work to do before getting the data..         try {             return item.get_revision();         }         catch( NotLoadedException exception ) {             log.error( "Property named 'property_name' was not loaded", exception );         }         return null;     }      How and why to decide between naming this method as `getRevision()` or `findRevision()`?


title: Referential integrity in a database where tuples are not physically deleted

text: Many modern Relational Database Management Systems automatically support referential integrity, i.e. when you try to delete a tuple which has a reference (in the form of foreign key, for example), the DBMS doesn't complete the operation and brings an error. Consider a database where every table has an attribute, which indicates if a tuple is deleted or not. So no data is actually deleted from the database, but is marked as deleted instead. If a tuple is marked as deleted, all its references need to be marked as deleted too or an error should occur. How can this be supported? Is performing additional checks (programmatically or with triggers) before deleting a tuple the only way to have referential integrity? Are there any accepted practices or algorithms? Edit: This flag is mostly used for statistics, and partially for data recovery after a long period of time. It is filter with a special meaning, and right now when queries are made, referential integrity is checked right in the query, which is extremely error prone and not reliable at all.


title: Why is binary search,which needs sorted data, considered better than linear search?

text: I have always heard that linear search is a naive approach and binary search is better than it in performance due to better asymptotic complexity. But I never understood why is it better than linear search when sorting is required before binary search? Linear search is `O(n)` and binary search is `O(log n)`. That seems to be the basis of saying that binary search is better. But binary search requires sorting which is `O(n log n)` for the best algorithms. So binary search shouldn't be actually faster **as** it requires sorting. I am reading CLRS in which the author implies that in insertion sort instead of using the naive linear search approach it is better to use binary search for finding the place where item has to be inserted. In this case this seems to be justified as at each loop iteration there is a sorted list over which the binary search can be applied. But in the general case where there is no guarantee about the data set in which we need to search isn't using binary search actually worse than linear search due to sorting requirements? Are there any practical considerations that I am overlooking which make binary search better than linear search? Or is binary search considered better than linear search without considering the computation time required for sorting?


title: Will Python 3.0's backwards-incompatibility affect adoption?

text: I visited Slashdot this morning to find out that Python 3.0 has been released. I know C# and Perl, but have wanted to learn Python for some time, especially after I saw its ease of use to create useful tools, not to mention its use in game scripting. My question is, how does the intentionally backwards-incompatible release of Python 3.0 affect adoption, and should I learn Python 2? Or should I take the dive and learn Python 3.0 first, and wait for the libraries to be ported?


title: How many bits' address is required for a computer with n bytes of memory?

text: How many bits of address is required (for the program counter for example) in a byte-addressed computer with 512 Mbyte RAM? What does the formula look like? How is this connected with the fact that 32 bits can address no more than 4 GB RAM?


title: Dealing with similar objects with different method signatures

text: I am fairly new to OO design and have problems with the design of some software and looking for a pattern or a combination of patterns that could help me solving my problem. I have a type that has a collection of different geometric shapes (say lines, rectangles, and cubes). I actually even have composites of these shapes. Each shape has one or more values. A value is a coordinate (between one-dimensional for lines and three-dimensional for cubes). All types of shapes have two methods that are essential. A method for adding values and a method for getting all values of a shape. E.g. `Cube.AddValue(new Value3D{X=4,Y=7,Z=11})` or `Line.AddValue(new Value1D{X=42})` respectively `Cube.GetValues()` would return a collection of `Value3D` and `Line.GetValues()` would return a collection of `Value1D`. Since these methods have fundamentally different signatures, I can't just derive from a single interface to store all of these different objects in one collection. Splitting the collection into multiple separate collections, one for each type would be possible, but not desirable since they belong together (domain wise). I've considered using three-dimensional values for all shapes and just ignoring Y/Z for lines/rectangles, but that isn't really nice and would actually violate the O and L in SOLID (a 4th dimension is possibly needed in the future). Another possibility would probably be to use a generic Interface like `IShape<T>` where `T` is Value*D. This interface would look like:               public interface IShape<T> {         public IEnumerable<T> GetValues();         public void AddValue(T value);     }      But this would require another, non-generic `interface INonGenericShape {}` because I can't use a generic interface without specifying the type. I would end up with something like this:               public class SomeShape{         private IList<INonGenericShape> _shapes = new List<INonGenericShape>();     }      But then I could as well use `System.Object`, since IShape does not provide any valuable information. So here I am, not knowing how to solve this (storing the objects in a single collection for consumers of that class). Can anyone provide some idea or insight?


title: How can you learn to design nice looking websites?

text: I am a moderately capable web developer. I can put stuff where I want it to go and put some JQuery stuff in there if I need to. However, if I am making my own website (which I am starting to do) I have no idea how to design it. If someone was to sit next to me a point to the screen and say "put this picture there, text there" I can do that quite easily. But designing my own site with my choice of colours and text will look like a toddler has invented it. Does anyone know any websites/books I can look at or has anyone got any tips on the basics of non-toddler web design?


title: Is there a difference between a component and a module

text: I have a little problem with the terms module and component. In my mind, a module are bundled classes, which are only accesable via a well defined interface. They hide all implementation details and are reusable. Modules define modules on which they depend. What is the difference to components? I looked it up in some books, but the description of components is very similar.


title: C project avoiding naming conflicts

text: I'm struggling to find pragmatic real-world advice on function naming conventions for a medium sized C library project. My library project is separated into a few modules and submodules with their own headers, and loosely follows an OO style (all functions take a certain struct as first argument, no globals etc). It's laid our something like:               MyLib       - Foo         - foo.h         - foo_internal.h         - some_foo_action.c         - another_foo_action.c         - Baz           - baz.h           - some_baz_action.c       - Bar         - bar.h         - bar_internal.h         - some_bar_action.c      Generally the functions are far too big to (for example) stick `some_foo_action` and `another_foo_action` in one `foo.c` implementation file, make most functions static, and call it a day. I can deal with stripping my internal ("module private") symbols when building the library to avoid conflicts for my users with their client programs, but the question is how to name symbols in my library? So far I've been doing:               struct MyLibFoo;     void MyLibFooSomeAction(MyLibFoo *foo, ...);          struct MyLibBar;     void MyLibBarAnAction(MyLibBar *bar, ...);          // Submodule     struct MyLibFooBaz;     void MyLibFooBazAnotherAction(MyLibFooBaz *baz, ...);      But I'm ending up with crazy long symbol names (much longer than the examples). If I don't prefix the names with a "fake namespace", modules' internal symbol names all clash. Note: I don't care about camelcase/Pascal case etc, just the names themselves.


title: White box testing with Google Test

text: I've been trying out using GoogleTest for my C++ hobby project, and I need to test the internals of a component (hence white box testing). At my previous work we just made the test classes friends of the class being tested. But with Google Test that doesn't work as each test is given its own unique class, derived from the fixture class if specified, and friend-ness doesn't transfer to derived classes. Initially I created a test proxy class that is friends with the tested class. It contains a pointer to an instance of the tested class and provides methods for the required, but hidden, members. This worked for a simple class, but now I'm up to testing a tree class with an internal private node class, of which I need to access and mess with. I'm just wondering if anyone using the GoogleTest library has done any white box testing and if they have any hints or helpful constructs that would make this easier. * * * Ok, I've found the FRIEND_TEST macro defined in the documentation, as well as some hints on how to test private code in the advanced guide. But apart from having a huge amount of friend declerations (i.e. one FRIEND_TEST for each test), is there an easier idion to use, or should I abandon using GoogleTest and move to a different test framework?


title: Are there two type of associations between objects or are there just different representations?

text: I've been spending some time on 're-tuning' some of my OOP understanding, and I've come up against a concept that is confusing me. Lets say I have two objects. A `user` object and an `account` object. Back to basics here, but each object has **state, behaviour and identity** (often referred to as an entity object). The `user` object manages behaviour purely associated with a user, for example we could have a `login(credentials)` method that returns if successfully logged in or throws exception if not. The `account` object manages behaviour purely associated with a users account. For example we could have a method checkActive() that checks if the account is active. The account object checks if the account has an up-to-date subscription, checks if there are any admin flags added which would make it inactive. It returns if checks pass, or throws exception if not. Now here lies my problem. There is clearly a relationship between `user` and `account`, but I feel that there are actually two TYPES of association to consider. One that is data driven (exists only in the data/state of the objects and the database) and one that is behaviour driven (represents an object call to methods of the associated object). ## Data Driven Association In the example I have presented, there is clearly a data association between `user` and `account`. In a database schema we could have the following table:               -----------------       USER_ACCOUNTS     -----------------      id      user_id      ----------------      When we instantiate the `account` and load the database data into it, there will be a class variable containing `user_id`. In essence, the `account` object holds an integer representation of `user` through `user_id` ## Behaviour Driven Association Behaviour driven associations are really the dependencies of an object. If object A calls methods on object B there is an association going from A to B. A holds an object representation of B. In my example case, neither the `user` object nor the `account` object depend on each other to perform their tasks i.e. neither object calls methods on the other object. There is therefore no behaviour driven association between the two and neither object holds an object reference to the other. ## Question Is the case I presented purely a case of entity representation? The association between `user` and `account` is always present, but its being represented in different ways? ie. the `user` entity has an identity that can be represented in different forms. It can be represented as an object (the instantiated `user` object) or as a unique integer from the users table in the databases. Is this a formalised way of recognising different implementations of associations or have I completely lost my mind? One thing that bugs me is how would I describe the differences in UML or similar? Or is it just an implementation detail?


title: Find bugs in Java programs, specially using the eclipse plug-in

text: Is it any good ? http://findbugs.sourceforge.net/ I had a go on the webstart/demo version and it did indeed look useful. Has anyone got any experience with it, is it a valuable tool ?


title: URL parameters in RESTful web services

text: I'm wondering about the appropriateness of URL parameters in RESTful resource creation. First, here's some context. I'm working on an API that will remotely update the software on embedded devices connected to an online device cloud. The basic workflow is:   1. Discover available updates   2. Apply desired updates   3. Monitor update progress The update discovery resource will allow users to POST a new update discovery.               POST /updateDiscovery?apikey=a1b2c3      The above URL will trigger update discovery for all devices. It is also useful to restrict which devices are targeted for updates. There are two identifiers used to restrict target devices:   1. a device id   2. a group id (which may reference many devices) This restriction can be communicated using either URL parameters or the request body. Using URL parameters:               POST /updateDiscovery?deviceIds=1,2,3&groupIds=2,3      Using the request body:               POST /updateDiscovery     Content-Type: application/json     {         targets: {              deviceIds: [1, 2, 3],              groupIds: [3, 4]          }     }      Either way, a new resource will be created with the following representation:               {         id: 1,        targets: {             deviceIds: [1, 2, 3],             groupIds: [3, 4]        },        status: 'pending',        ...     }      Which of the above methods best follows the RESTful design pattern and why?


title: Disk I/Os incurred by readLine () in Java

text: Does `readLine()` Java function used with `BufferedReader` cause one disk I/O per call? If yes, is there any way to read specific number of lines, say n, from a text file causing only one disk I/O? Here's the code:               String file;     BufferedReader br = new BufferedReader (new FileReader (file));     int n = 10;     for (int i = 0; i < n; i++)     {         String line = br.readLine ();         /* Do something */     }


title: Source code "prints" at release

text: Is there a best practice for how to document the source code you're releasing? Currently, we have a table of the versions of the software, what SVN tag it's labeled as, what SVN rev that tag was created at and the SVN URL. Then, our CM department wants us to include a file listing of all the source files we're including for the .zip that we provide them which is just a zip of the tag we're releasing. I'm more fishing for ideas to update our print template, hopefully with good arguments to remove the file listing.


title: Why is a tooltip's attribute labelled 'title='?

text: > HTML 4 supports a "title" attribute that can be inserted inside any HTML > tag. Inserting this attribute effectively gives the element a tooltip that > pops up when the mouse moves over it. It just seems like a bad word choice.. or am I missing something?


title: How fast should a Python factoring script be?

text: Just how efficient is "good enough" for all intents and purposes? I wrote a script to simply list off all numbers that divide into an input, x, as pairs (i, n//i) and was just curious how efficient I should be going for? what is the acceptable rate at which the script starts to lose its efficiency? This is my code (although advice is appreciated, I just want to give an idea as to how it works).               import time     print('''This program determines all basic factors of a given number, x, as ordered            pairs, (a, b) where ab=x.     Type "quit" to exit.''')          timer = input('Would you like a timer? (y/n) ')     while  1:         try:             x =(input('x = '))                                                            T0 = time.time()             b = []             n = int(x)**0.5             ran = list(range(1, int(n)+1))             if int(x) % 2 == 1:                                                           ran = ran[::2]             for i in ran:                 if int(x) % i == 0:                     m = (i, int(x)//i)                     b.append(m)             else:                 pass         except ValueError as error_1:             if x == 'quit':                 break             else:                 print(error_1)         except EOFError as error_2:             print(error_2)         except OverflowError as error_3:             print(error_3)         except MemoryError as error_4:             print(error_4)         T1 = time.time()         total = T1-T0         print(b)         print(str(len(b)) + ' pairs.')         if timer == 'y':         print("%.5f" % total + ' seconds.')      some of the results are:               x = 9     [(1, 9), (3, 3)]     2 pairs.     0.00000 seconds.          x = 8234324543     [(1, 8234324543)]     1 pairs.     0.07404 seconds.          x = 438756349875     [(1, 438756349875), (3, 146252116625), (5, 87751269975), (15, 29250423325), (25,         17550253995), (75, 5850084665), (125, 3510050799), (375, 1170016933), (557, 787713375),   (1671, 262571125), (2785, 157542675), (8355, 52514225), (13925, 31508535), (41775,   10502845), (69625, 6301707), (208875, 2100569)]     16 pairs.     0.88859 seconds.      So this program can be pretty quick, but then the speed drops rather rapidly once you get up to higher numbers. Anyways, ya, I was just wondering what is considered acceptable by todays standards?


title: Estimating tasks in Scrum

text: Our team using Scrum three iterations. We successfully estimate PBI in storypoints using poker-planning. But next we cannot do anything because we don't know   1. Who create tasks? PBI is created by everyone and approved by product owner, but what about task   2. Who estimates task?   3. What technique should be using for task estimating? Poker planning are good for PBI estimating


title: Alternatives to JDT Annotation - License issues

text: I have used the JDT Annotation library in my Java project as I am quite fond of what it offers. To be more exact, I used the `@Nullable` and `@NonNullByDefault` annotations as I can use the synergy with Eclipse to automatically analyse possible `null` values and what may lead to `NullPointerException` bugs. Unfortunately, JDT Annotation is licensed under EPL1 which, as far as I know, is incompatible with GPL2 due to the former being a weak copyleft license and choice of some clauses. As the project should be published under a GPL2 license, I am exploring different options but have yet to fine any that would offer the same, or nearly the same, functionality. I am not keen on adding null checks as they only clutter the code with what an annotation could have solved as well. But unfortunately it seems to be the only viable option? I am looking for some expertise regarding this matter. What I propose is to use Google's `Preconditions` to formulate preconditions such as:               Preconditions.checkArgument(providedArgument != null, "The provided argument must not be null!");      respectively:               Preconditions.checkState(invariantField != null, "The field may not be null!");      These will solve the problem of course and be more explicit, in my opinion, when it comes to documenting my contracts by code. I usually also report these with custom tags in my Javadoc, for example, `@pre providedArgument != null` or `@inv invariantField != null`. I would be thankful for all


title: Problem with OAuth2 authentication process and session persistance

text: We're using node-oauth2-provider as an authentication library for our service. The current process for a user to log in is:               POST /oauth2/access_token      Which creates and saves the access_token to the database. On subsequent requests we send the `access_token` which is pulled from the database to verify that it exists. From there the user is added to session manually by us in a similar fashion to their examples. After this happens, if a request comes in without the access token, the session still seems to be set. As if it's persisting across requests. Maybe I misunderstand how this is supposed to work... but shouldn't the access token be the indication that a user's requests are still valid? If so, do I need to clear the session manually? If not and it stores it in memory... possibly indicated by:               express.session({store: new MemoryStore({reapInterval: 5 * 60 * 1000}), secret: 'abracadabra'})      Then how does the server know that subsequent requests are valid?


title: Using words instead of numbers for versioning?

text: Would it be considered acceptable to use word compounds instead of numbers for version iterations? For example in a pattern: "[Adjective] [Noun]" The first version could be something like: "Auspicious Armadillo" Thus on each sequential release the noun would change to the next letter of the alphabet and the version could be along the lines of: "Auspicious Bear" Once the alphabet for the nouns runs out the Adjective gets changed and the Nouns can start over e.g: "Bewildered Armadillo" etc. This would give me around 676 possible different versions to iterate through. Assuming the project is small & short enough to fall within these 676 releases before a complete remake/overhaul, would such a versioning pattern be considered acceptable to use? Or would it just create needless confusion and chaos? I understand this might be somewhat opinion related, but I was hoping for some kind of a general consensus on whether this is an acceptable or terrible idea.


title: Can a recursive function have iterations/loops?

text: I've been studying about recursive functions, and apparently, they're functions that call themselves, and don't use iterations/loops (otherwise it wouldn't be a recursive function). However, while surfing the web for examples (the 8-queens-recursive problem), I found this function:               private boolean placeQueen(int rows, int queens, int n) {         boolean result = false;         if (row < n) {             while ((queens[row] < n - 1) && !result) {                 queens[row]++;                 if (verify(row,queens,n)) {                     ok = placeQueen(row + 1,queens,n);                 }             }             if (!result) {                 queens[row] = -1;             }         }else{             result = true;         }         return result;     }      There is a `while` loop involved. ... so I'm a bit lost now. Can I use loops or not?


title: In an online questionnaire, what is a best way to design a database for keeping track of users all attempts?

text: We have a web app where users can take online exams. Exam admin will create a questionnaire. A questionnaire can have many Questions. Each question is a multiple choice question (MCQ). Let's say an admin creates a questionnaire with 10 questions. Users attempt those questions. Now, unlike real exams users can attempt single questionnaire multiple times. And we have to keep track of his all attempts. e.g.                +-------+-----------------+------------+-------+------------+----------+      |User_id|Questionnaire_id |question_id |answer |attempt_date|attempt_no|      +-------+-----------------+------------+-------+------------+----------+      |1      |1                |1           |a      |1 June 2013 |1         |      |1      |1                |2           |b      |1 June 2013 |1         |      |1      |1                |1           |c      |2 June 2013 |2         |      |1      |1                |2           |d      |2 June 2013 |2         |      +-------+-----------------+------------+-------+------------+----------+      Now it can also happen that after user has attempted same questionnaire twice, admin can delete a question from same questionnaire, but users' attempt history should still have reference to that so that user can see his that question in his attempt history in spite of admin deleting that question. If user now attempts this changed questionnaire he should see only 1 question.                +-------+-----------------+------------+-------+------------+----------+      |User_id|Questionnaire_id |question_id |answer |attempt_date|attempt_no|      +-------+-----------------+------------+-------+------------+----------+      |1      |1                |1           |a      |3 June 2013 |3         |      +-------+-----------------+------------+-------+------------+----------+      Also, after this user modified some part of question, users attempt history should show question before modification while any new attempt should show the modified question. How do we manage this at database level? My first gut feeling was that, For deletes, do not do physical delete, just make a question inactive so that history can still keep track of users attempt. For modifications, create versions for questions and each new attempt refres to latest version of each question and history keeping reference to version of question at attempt time.


title: mercurial or tfs for codeplex?

text: I've been working on a .NET personal project for a little while now and it's almost ready to go open source. I've decided (arbitrarily) to host it on codeplex. Codeplex offers TFS or mercurial. I'm wondering which I should pick. Consider:   * I've only ever used subversion.   * I'm using VS 2010 express as my IDE.   * Tools must be free (so the mercurial client if I go that route).   * From what I've been hearing, mercurial sounds interesting but I know _very_ little about it so if there's a learning curve, then I don't want to add too many more learning objectives to the project.   * I don't expect any contributors. So I guess the actual question is, is mercurial easy enough to use with codeplex and does it add anything that the TFS option doesn't?


title: design a model for a system of dependent variables

text: I'm dealing with a modeling system (financial) that has dozens of variables. Some of the variables are independent, and function as inputs to the system; most of them are calculated from other variables (independent and calculated) in the system. What I'm looking for is a clean, elegant way to:   1. define the function of each dependent variable in the system   2. trigger a re-calculation, whenever a variable changes, of the variables that depend on it A naive way to do this would be to write a single class that implements `INotifyPropertyChanged`, and uses a massive case statement that lists out all the variable names x1, x2, ... xn on which others depend, and, whenever a variable `xi` changes, triggers a recalculation of each of that variable's dependencies. I feel that this naive approach is flawed, and that there must be a cleaner way. I started down the path of defining a `CalculationManager<TModel>` class, which would be used (in a simple example) something like as follows:               public class Model : INotifyPropertyChanged     {         private CalculationManager<Model> _calculationManager = new CalculationManager<Model>();               // each setter triggers a "PropertyChanged" event         public double? Height { get; set; }         public double? Weight { get; set; }         public double? BMI { get; set; }              public Model()         {             _calculationManager.DefineDependency<double?>(                 forProperty: model => model.BMI,                 usingCalculation: (height, weight) => weight / Math.Pow(height, 2),                 withInputs: model => model.Height, model.Weight);         }              // INotifyPropertyChanged implementation here     }      I won't reproduce `CalculationManager<TModel>` here, but the basic idea is that it sets up a dependency map, listens for `PropertyChanged` events, and updates dependent properties as needed. I still feel that I'm missing something major here, and that this isn't the right approach:   1. the (mis)use of `INotifyPropertyChanged` seems to me like a code smell   2. the `withInputs` parameter is defined as `params Expression<Func<TModel, T>>[] args`, which means that the argument list of `usingCalculation` is not checked at compile time   3. the argument list (weight, height) is redundantly defined in both `usingCalculation` and `withInputs` I am sure that this kind of system of dependent variables must be common in computational mathematics, physics, finance, and other fields. Does someone know of an established set of ideas that deal with what I'm grasping at here? Would this be a suitable application for a functional language like F#? * * * **Edit** More context: The model currently exists in an Excel spreadsheet, and is being migrated to a C# application. It is run on-demand, and the variables can be modified by the user from the application's UI. Its purpose is to retrieve variables that the business is interested in, given current inputs from the markets, and model parameters set by the business.


title: How to control work of programmers (outsourcers)

text: Some time ago I decided to outsource web development projects (php coding & design). I've opened small office abroad with manager and couple of programmers and designer. I just started but already have a problem controlling their work. Some programmers are fast, others work much slower. I pay them fixed salary, so it matters for me if they do their job on time. When they work from office, I at least have a person responsible for the project to tell if they really worked. But sometimes they work from home and in that case I have no way to know if they really spent that time working on some issue. Some of my ideas were: controlling amount of code done with svn, strict deadlines, everyday reporting.. But nothing seems perfect to me. It creates even more work from my side. Can anyone suggest a way of fair judgement on how much really time was spent on actual work? How to stimulate people to work? Maybe create some bonus system if work is done fast? Any idea/experience on this topic would be highly appreciated.


title: Does (/could) an LGPL-based license exist without clause 4d?

text: I've started writing a framework in C (you may have heard of it: Raphters). Someone contacted me to ask whether I could re-license it because it would be useful in embedded products, but clause 4d (the clause that says, and I'm paraphrasing, you must allow modified versions of the library to be re-linked against your executable) would make that difficult. I like LGPL because it prevents people making modifications and keeping them secret, but I don't want to prevent people using Raphters in their embedded products. What do you suggest?


title: What do you consider to be the prime cause of software defects (and how to minimize them)

text: I define **defect** as : > "something within the application design or code which prevents it > functioning as per requirements." I'm looking for ideas about the causes of defects, eg the human factor, lack of testing, lack of prototyping, and possible ideas to mitigate these.


title: Is a degree needed for low-level/embedded programming jobs?

text: I know that it is possible to get into software development without a degree in computer science, but is it possible (or rather, common) to be able to get an embedded programming job without the computer science degree (or any engineering degree as well)?


title: Fellow programmer used worst programming practices

text: I know it seems odd to say, but a fellow programmer at work deliberately used a couple of bad programming practices on purpose! I'll explain. First let me say that he's an intelligent guy and for the most part he writes intelligible code. He was asked to implement licensing on a web application project written in Java. Since it's Java, if one really wanted to, one could probably hack open the jars and read the names of the classes and methods written inside. His solution to this problem was to quite literally to awkwardly call variables and methods less-than-obvious names and plant them inside already congested classes rather than generating new classes. His justification was that if a hacker wanted to switch out certain classes in order to bypass licensing checks (and therefore get a free copy of the product), he'd have a far more difficult time of it if it weren't obvious which methods perform these particular tasks. Only after he had done it did I confront him about it, suggesting that we could perhaps buy some sort of obfuscator library to do it for us, while maintaining good programming practices. He claims to not have had the time or resources to search for that kind of solution. ..Which leaves me at a dilemma. Do I look for a obfuscator library in Java and fix his old code (which might be a little touchy about remodeling his code), or do I leave it as it, as much as that irks me to no end?


title: Program coded in .Net

text: What does it generally mean when a programmer says his program/application was "coded in .Net"? When I think of .Net I think of C# and Visual Basic. I don't usually think of any other language on this list: http://en.wikipedia.org/wiki/List_of_CLI_languages


title: how do you seperate from designing question to programming questions?

text: As i try to program a solution to a request arise. I can't separate the difference between implementation problems and design problems. How do you specifically express the design problem?


title: Avoiding wrapper objects in collections

text: I'm getting a little annoyed of having to wrap primitive types in wrapper objects to store them in collection data structures (sets, maps, lists, etc.) in languages like Java and Objective C. I'd really like to have, say, a Map data structure that works the same way whether I'm mapping NSNumbers to Strings or integers to doubles or integers to MyBigCustomObject*. My understanding is that the reason collection data structures in these languages require wrapping in an object is so it can just always assume that the number given is a pointer - I actually _can_ make a NSDictionary with [NSDictionary dictionaryWithObject: MyCustomObject forKey: 1], but it will treat the 1 as a pointer instead of an integer, try to access memory address 1 and segfault. But I don't see any reason why you couldn't make a collection data structure that keeps track of the _type_ of keys and values that wouldn't have this problem. Even a relatively inflexible data structure like a Map of specifically-ints to specifically-pointers-to-objects would be a decently common use case (I certainly could use one, I'm doing a lot of work recently that involves indexing objects by an integer ID). Is there a reason why this isn't a common paradigm in languages that have an Object/primitive type distinction?


title: Best resources for learning idiomatic PHP

text: My experience has primarily been in Java, but I'm working on a PHP project and conscious of my lack of knowledge of idiomatic PHP. What resources (online or print) will help me avoid making the mistakes that people with Java goggles normally make? First prize would be something that would give me short in- depth examinations of important PHP ideas, a la Joshua Bloch's Effective Java.


title: LINQ Style preference

text: I have come to use LINQ in my every day programming a lot. In fact, I rarely, if ever, use an explicit loop. I have, however, found that I don't use the SQL like syntax anymore. I just use the extension functions. So rather then saying:               from x in y select datatransform where filter       I use:               x.Where(c => filter).Select(c => datatransform)      Which style of LINQ do you prefer and what are others on your team are comfortable with?


title: Software technical and project specification: How to?

text: We have a project here in my company of developing a new CRM. It's, basically, a big CRUD, with sub-CRUDS, with various details, such as, some users can do that, others don't. We will develop the system in PHP with Symfony. Developing is easy, but we're having some difficulties in the analysis part of the job. We have to present the project specification, as well the tecnical specification of the project. We have to draw and explain how to system will work. And we're not sure on how to do this. We always just... did the system. Not planning with graphics or text, or explaining what we were doing. We already asked everyone and got suggestions, as well requirements. Apparently, we have to take that and explain the system. Any tips, guys? :)


title: Citing Borrowed Code

text: If you borrow code from some source, it is probably best to cite it (like "adapted from [source]"). However, if you take let's say you borrowed this function (example in C++):               void doWork()     {          cout << "Doing work!\n" << endl;     }      and now you editted it to be like this:               void doWork()     {          string name = "";               cout << "Starting work...\n" << endl;          cout << "Hello user. What is your name?" << endl;               cin >> name;          ...     }      Would you still have to say "adapted from [source]" or something like that? Or are you in the safe zone? **Note** : I am specifically wondering how this applies to copyrighted (and open source) code


title: What is the value in hiding the details through abstractions? Isn't there value in transparency?

text: ## Background I am not a big fan of abstraction. I will admit that one can benefit from adaptability, portability and re-usability of interfaces etc. There is real benefit there, and I don't wish to question that, so let's ignore it. There is the other major "benefit" of abstraction, which is to hide implementation logic and details from users of this abstraction. The argument is that you don't need to know the details, and that one should concentrate on their own logic at this point. Makes sense in theory. However, whenever I've been maintaining large enterprise applications, I always need to know more details. It becomes a huge hassle digging deeper and deeper into the abstraction at every turn just to find out exactly what something does; i.e. having to do "open declaration" about 12 times before finding the stored procedure used. This 'hide the details' mentality seems to just get in the way. I'm always wishing for more transparent interfaces and less abstraction. I can read high level source code and know what it does, but I'll never know how it does it, when how it does it, is what I really need to know. What's going on here? Has every system I've ever worked on just been badly designed (from this perspective at least)? # My philosophy When I develop software, I feel like I try to follow a philosophy I feel is closely related to the ArchLinux philosophy: > Arch Linux retains the inherent complexities of a GNU/Linux system, while > keeping them well organized and transparent. Arch Linux developers and users > believe that trying to hide the complexities of a system actually results in > an even more complex system, and is therefore to be avoided. And therefore, I never try to hide complexity of my software behind abstraction layers. I try to abuse abstraction, not become a slave to it. # Question at heart   1. Is there real value in hiding the details?   2. Aren't we sacrificing transparency?   3. Isn't this transparency valuable?


title: Can I use an LGPL-licenced library in my commercial app?

text: I want to use an LGPL-licensed library in my app for Microsoft's app marketplace. Is that OK?


title: Is it possible to integrate UDP file transfer into a .NET web application?

text: # Background I have recently been tasked with designing a rebuild of an existing .NET web application that _currently_ uses a third-party company to handle large file transfers (as big as 50Gb). Currently, the .NET app depends on a .JAR (Java Applet) provided by this third-party which is called up inside of an iFrame and exposes the appropriate file-system interaction for selecting entire directories for upload and so forth. I realize that so far all of this is possible using some combination of .NET networking classes (ftp) and Flash or Silverlight for client access. I have been told that the reason that the third-party plugin is so special is that it uses UDP protocol so that if an upload or download is interrupted, it can be resumed later right where it left off. I have also been told that the third-party tool suite allows the IT folks to throttle bandwith (I don't even know what that means) and do a couple of other cool things. # Question Assuming that we will use the latest version of C# and and the .NET framework (4.0), is it reasonably possible to replicate this UDP-based behavior? By reasonable, I mean could it be accomplished in less than, say, 240 dev hours. **Please note** that the rebuilt app will ideally use all Microsoft technologies (including Silverlight for client access) and will run on Azure.


title: Graphic demonstrating emphasis of front end in web apps

text: I remember stumbling across an amusing graphic a year or so ago which demonstrated the tiers of web development. The back-end was shown as a tiny box, but the front end was shown as a huge box crammed with lots of front-end technologies like AJAX, DHTML. This is all a vague recollection. Does anyone know where on the Intraweb this graphic might be? It was probably on a programming cartoon site, but I only view XKCD on a regular basis, and I couldn't find it on there. Although tagged as fun, my request does have a productive edge to it - it would be quite useful in driving home to my colleagues how UI top-heavy web application development has become.


title: Is it possible to develop an IOS application without a Mac?

text: I'm a postgraduated student and I had the idea to build an app for elementary school kids. My question after many days of searching is whether anyone here have ever tried and what was their experience of developing an IOS app on other platforms than Xcode such as Phonegap, Monotouch, flex or others?


title: Are Datasets Patentable

text: I'm working on a project that uses a dataset produced from software informally licensed as "non-commercial use only". I'm developing an application that uses that dataset as an input to another algorithm. Our own software has a permissive free software license in which we don't restrict commercial usage. Are there legal implications of using that dataset in our own software in the sense that we are violating a copyright? **Edit** : Thanks folks, the ask a lawyer thing is the way to go, but its helpful for me to hear some opinions bounce around.


title: How should I write new code when the old codebase and the environment uses lots of globals in PHP

text: I'm working in the Wordpress environment which itself heavily relies on globals and the codebase I'm maintaining introduces some more. I want this to change and so I'm trying to think how should I handle this. For the globals our code has introduced I think I will set them as dependencies in the constructor or in getter / setter so that I don't rely on them being globals and then refactor the old codebase little by little so that we have no globals. With Wordpress globals I was thinking to wrap all WP globals inside a Wrapper class and hide them in there. Like this               class WpGlobals {         public static function getDb() {             global $wpdb;             return $wpdb;         }     }      Would this be of any help? The idea is that I centralize all globals in one class and do not scatter them through the code, so that if Wordpress kills one of them I need to modify code only in one place. What would you do?


title: Is it possible for a browser to use peer-to-peer browsing?

text: I was recently asked this from my friend after explaining how µTorrent worked, he then went to ask me, "Could this be used for browsing the web?", (not a direct quote) but I found my self thinking about this for a while there after.   * Could someone be credited with making the first Peer-2-Peer browser?    * How could it send the correct data without it being modified?   * Would it be faster than normal browsers? (Referring to the way µTorrent works, I find when I use a torrent it's faster than a web download.)    * Can it save on server loads, prevent DDoS, more?


title: How can I reverse engineer a hash code?

text: I am building an application in C# that works with a Progress database. The passwords that are stored in this database are stored using a hash algorithm that Progress has not made public. However, I would like to authenticate using these hashes. Is it feasible to reverse engineer such a hash algorithm and how would I go about doing this? To be clear: I am not looking for a way to get the unhashed passwords from the hashes. I'm looking for the algorithm to get a hash from a password.


title: Why must a constructor's call to the superconstructor be the first call?

text: It is an error if you do anything in a constructor before calling the superconstructor. I remember that I had problems because of that. Yet, I do not see how this saves us from errors. It could save you from using uninitialized fields. But, the Java compiler that checks for using uninitalized variables does that and this stupid rule does not improve anything here. The only serious consideration argument I remember was that we need it for OOP, because objects in real life are constructed this way: you create a cucumber by first creating a vegetable and then add cucumber attributes. IMO, it is opposite. You first create a cucumber and, by duck is a duck principle, it becomes a vegetable. Another argument was that it improves safety. Not writing the code improves the dependability much better, so I do not consider this as argument. Creating more complex code when you need to workaround a stupid restriction, is what makes the program more error-prone. This rule creates a serious pain (at least for me). So, I want to hear the serious argument and serious example where it could be useful.


title: How to solve cyclic dependencies in a visitor pattern

text: When programming at work we now and then face a problem with visitors and module/project dependencies. Say you have a class A in a module X. And there are subclasses B and C in module Y. That means that module Y is dependent on module X. If we want to implement a visitor pattern to the class hierarchy, thus introducing an interface with the handle Operations and an abstract accept method in A, we get a dependency from module Y to module X, which we cannot allow for architectural reasons. What we do is, use a direct comparison of the types (i.e. `instanceof`, since we program in Java), which is not satisfying. My question(s) would be: Do you encounter this kind of problem in your daily work (or do we make poor architectural choices) and if so, how is your approach to solve this? Here is a minimal example in Java to illustrate my point. Package a has ClassA and the Visitor-Interface over the ClassA Hierarchy:               package pkg.a;       public abstract ClassA extends ClassA {           public abstract void accept(ClassAVisitor visitor);          /* other methods ... */        }           package pkg.a;       import pkg.b.ClassB;     import pkg.b.ClassC;     public interface ClassAVisitor {           public abstract void handle(ClassB visitee);         public abstract void handle(ClassC visitee);       }       Package b has the concrete classes that extend from ClassA:               package pkg.b;       import pkg.a.ClassAVisitor;     public ClassB extends ClassA {           public void accept(ClassAVisitor visitor) {               visitor.handle(this);           }        }           package pkg.b;     import pkg.a.ClassAVisitor;       public ClassC {           public void accept(ClassAVisitor visitor) {               visitor.handle(this);           }        }      Package a and b have a cyclic dependency.


title: AngularJS: structuring a web application with multiple ng-apps

text: The blogosphere has a number of articles on the topic of AngularJS app structuring guidelines such as these (and others):   * http://www.johnpapa.net/angular-app-structuring-guidelines/   * http://codingsmackdown.tv/blog/2013/04/19/angularjs-modules-for-great-justice/   * http://danorlando.com/angularjs-architecture-understanding-modules/   * http://henriquat.re/modularizing-angularjs/modularizing-angular-applications/modularizing-angular-applications.html However, one scenario I have yet to come across for guidelines and best practices is the case where you have a large web application containing multiple "mini-spa" apps, and the mini-spa apps all share a certain amount of code. I am not referring to the case of trying to have multiple `ng-app` declarations on the same page; rather, I mean different sections of a large site that have their own, unique `ng-app` declaration. As Scott Allen writes in his OdeToCode blog: > One scenario I haven't found addressed very well is the scenario where > multiple apps exist in the same greater web application and require some > shared code on the client. Are there any recommended approaches to take, pitfalls to avoid, or good sample structures of this scenario that you can point to?


title: How to use Subversion in conjunction with DTAP with several Scrum teams?

text: I've read _How Do You Pull Something from a Release?_ , but it doesn't solve our problems, as our case is more complex. Our situation is as follows. We're developing an application for an internal customer. We're doing Scrum with four more or less aligned teams (i.e. sprints end on the same day), one of which is off site. We have a basic DTAP street and we use Subversion for source control. We want to deploy to the TAP-end of the street from source control, as a preparation to use continuous integration later on. To be able to deploy from source control, we maintain branches that are in sync with each of the T, A, and P environments.   Our current setup is a clean trunk, which is in sync with Production, an acpt branch that was branched from trunk at some point in the past and which is in sync with Acceptance, and a branch for each sprint that branches from the acpt branch at the start of each sprint and merges back into it at the end. This sprint branch is in sync with the Test environment for the duration of the sprint. At the end of each sprint, issues that are done are merged into acpt. A new sprint branch is made and a new sprint begins. Meanwhile, the acpt branch is deployed to Acceptance and tested there. Of course, in an ideal world, we would complete all user stories during the sprint and during UAT there would be no defects found. But alas, this world is not perfect and problems _are_ found during UAT. _Of course not bugs_ , but we may have interpreted a request incorrectly. Or there may be some other reason for a user story to not be released (yet). So now we have to pull some stories from that branch. Since the changes were merged from sprint branch to acpt branch in one go, this is not a trivial task. **How can we adjust our method to allow for user stories to be pulled from the acpt branch?** * * * I've also read _Agile version control with multiple teams_ by Henrik Kniberg. That looks like a model that's better suited to our needs, but even then I have some questions about it. If we adopt his model, should we sync the trunk to Acceptance? That would give us opportunity to conduct UATs _during_ a sprint, and would effectively uncouple the sprint schedule from the release schedule. But Kniberg promotes a stricter adherence to Scrum than we currently follow, where user stories are done pretty much in sequence. **How could we adjust Kniberg's method to suit our needs?**


title: How to present domain model exceptions thrown through validation

text: In domain model of my web application I've an entity Foo which can be created only by a pojo FooBean: `Foo.newInstance(FooBean fooBean)` (Might have been better a Builder-pattern.) In the factory methode `newInstance()` the pojo FooBean is validated and throws NullPointerExceptions and IllegalArgumentExceptions if needed. The fields of the pojo are filled by a form on the presentation layer. That form does some validation on the user input and shows user friendly messages if needed. The exception message of the NullPointerExceptions and IllegalArgumentExceptions thrown in the `newInstance()` method are rather technical and shouldn't be displayed to the end user. What is a proper way to show user friendly error messages that are originated by the NullPointerException or the IllegalArgumentException?


title: Bitbucket and a small development house

text: I am in the process of finally rolling Mercurial as our version control system at work. This is a huge deal for everyone as, shockingly, they have never used a VCS. After months of putting the bug in management's ears, they finally saw the light and now realise how much better it is than working with a network of shared folders! In the process of rolling this out, I am thinking of different strategies to manage our stuff and I am leaning towards using Bitbucket as our "central" repository. The projects in Bitbucket will solely be private projects and everyone will push and pull from there. I am open to different suggestions, but has anyone got a similar setup? If so, what caveats have you encountered?


title: UI design for changing multiple records at once

text: I have a desktop application where the user has tabular views on some data records. Now we got the requirement to let the user select multiple of these records at the same time and let the him edit some properties of the selected records all at once in a separate edit dialog. The idea is   * to change only the properties the user really want change   * to keep all other properties unchanged Furthermore, when the user has selected the records and opens the edit dialog, the properties with equal values in all of the selected records are shown in the corresponding UI fields, the other properties should be shown as "undefined" as long as the user does not starts to enter something in there. After pressing "Ok", the changes are applied to the records. This kind of UI behaviour is not "rocket science", we already found this, for example, in graphical editors (where you can select multiple drawing elements at once and change their properties.) The problem is how to visualize the "undefined" state in an intuitive manner, especially for text properties. For boolean values, this is easy: we use just a tri-state check box. For number values, this is easy, too: the "undefined" state is displayed as an empty numeric UI field, and if there is actually a number in there, the state is "defined". But how shall one design this for text properties? An empty text box field is actually not an "undefined" state, since many of the text properties _can_ actually be empty. One could add a separate check box beside each text box to indicate the difference between "undefined" and "defined", but since our edit dialog contains already check boxes for boolean properties, this seems to be counterintuitive and confusing to the user. If this matters, we are using Winforms (but I think this problem is not specfic to the actual UI framework).


title: Which license retains copyright while allowing work to be shared and derived from?

text: I am working on an academic research project whose results and _some_ code we intend to publish. Research journals and conferences explicitly require that the authors have copyright over the work done in a paper. However, I would like to share the code with the community as it progresses using an open source license. Is there a license that explicitly retains copyright while allowing sharing, redistribution and derivative works based on the original work? Alternatively, which license would be suitable for such projects?


title: Most efficient data structure for implementing inheritance structure without classes

text: I have a number of types that all relate to each other in terms of them being 'derived' from one another. I'd need a way to do `is` relationships, which made me initially think of classes, but I realized that other than the `is` relationships, there would be no reason to use classes as each 'type' of data function the exact same way. I'd also thought of enums, but since there is no way to extend or inherit from enums it was a poor choice. For context (this being my specific example): I have a number of different kinds of resources that all are 'types' so that they can be used in conjunction with an int to denote how much of that resource is available. I have several different kinds of these resources, such as foods, metals, building materials etc. Within the food category would be something like wheat or corn; under metals would be copper, iron, gold etc. Since all of these are still just 'resources' and have no actual functionality other than typing, it seems pointless to use classes and OO inheritance. How would I implement this kind of data type without resorting to using classes?


title: What's the difference between lists constructed by quote and those constructed by cons in Scheme?

text: (define ls1 '((1 . 2) 1 . 2))     (set-car! (car ls1) 6)     ls1     (define ls2 (cons '(1 . 2) '(1 . 2)))     (set-car! (car ls2) 6)     ls2      After `set-car!`ing, ls1 will be `((6 . 2) 1 . 2)` and ls2 `((6 . 2) 6 . 2)`. It seems that `ls1` and `ls2` have different storage model, and what does it mean when someone says `x is bound to a list`? is x stand for a `starting address` or `location` like that a is the starting address of a[10] in C?


title: Organisation by business function vs technical function

text: I am designing a large application (a static code analyser) and I have a choice in how to organise the code into modules:   * One approach is by what I'd call by **technical function**. This is where you have a package for data objects, another for service functions, views, controllers, etc.   * Another approach is what I'd call by **business function**. This where you'd have a package for, say, stock control, another for product listings, customer orders, etc. Most frameworks tend to push me towards the first approach. Sometimes there are technical reasons for this, e.g. if the view is written in JavaScript and the rest in Python, you really need to keep it separate. But mostly it is just a matter of convention. Sometimes organising by technical function results in spreading related code across the application. If I have code to support a product, I end up with ProductModel, ProductService, ProductView, etc. Often I feel it would be neater to simply have a Product object that does all these. Organising by business function has issues too. Some classes are borderline and it's quite arbitrary which package you put them in. And there are some support objects that are used across all business functions. Which approach will be the most effective for making a scalable and maintainable application?


title: Disadvantages of vertical user stories

text: The **agile approach** is to structure the work into **vertical user stories** and deliver a focused but fully functioning piece of the application from **end-to-end**. Because this is the new approach to building software I read a lot of literature about why this is better than horizontal stories but I do not find much about the disadvantages to this approach. I already drank the agile cool-aid and I too agree that vertically slicing the cake has much advantages over horizontal slicing. Here is a short list of disadvantages that I could come up with:   * A developer might initially be slower at implementing a feature because s/he must understand all the technologies required to develop the story (UI + service layer + data access + networking, etc...)   * Overall architecture design (crating the backbone of the application) does not really fit this mantra (however some might argue that it is part of a user story to develop/change the overall architecture) **What are some more drawbacks of vertically slicing user stories?** _Note: The reason I am asking this question now is because I am going to attempt to convince a team to start writing stories the 'vertical way' and I want to be able to bring up the possible trade-offs ahead of time so they won't consider the approach a failure when they are faced with the drawbacks._


title: Efficient Copy While Sorting

text: I have an algorithms library called NDex. I am in the process of upgrading it to a new version. Part of this upgrade involves providing two versions of many algorithms: an in-place version and a version that copies the results to a destination list. I will be providing two sort variations: quick sort and merge sort. The merge sort is stable. I am curious whether quick sort is better than, say, heap sort when copying items to a new list. Merge sort uses a buffer internally. I am curious when doing a merge sort whether I can double up the destination as the buffer. I was hoping someone could give me some advice or point me to some useful material.