In functional programming, does having most of the data structures immutable require more memory usage?

In functional programming since almost all data structure are immutable, when the state has to change a new structure is created. Does this mean a lot more memory usage? I know the object oriented programming paradigm well, now I'm trying to learn about the functional programming paradigm. The concept of everything being immutable confuses me. It would seem like the a program using immutable structures would require much more memory than a program with mutable structures. Am I even looking at this in the right way?


How do you encourage your organization to move from Java to Scala?

Has anybody's organization started the migration from Java to Scala? If yes, how do you do that? What can I do to encourage my colleagues to do the same?


Is this actually good OO design?

## Context I have `Specification` class with several properties including: StartDate, EndDate, DaysToComplete, DateToComplete. A specification contains a list of required courses (i.e. a company requires employees to take training... perhaps a technical, diversity, or an ethics class). Based on a specification, courses will be mandated to employees. ## Validation Concerns StartDate and EndDate refer to the window of time in which a company can mandate a class to a user. DaysToComplete is how many days the employee has to compete training from the time it's mandated to them, whereas DateToComplete is the last day they have to complete the course.   * StartDate must always be specified   * DaysToComplete and DateToComplete are mutually exclusive... one and only one must be specified.   * If EndDate is not specified, then DaysToComplete must be used   * If StartDate = EndDate, then DateToComplete must be used And there are other obvious validation rules such as the fact that you wouldn't have an EndDate greater than the DateToComplete since you wouldn't mandate a course after it already had to be completed. ## The Problem It seems as though there is a case here for having a base class and 4 derived classes with the following properties (i.e. this is how I was instructed to and did design the objects):   * SpecificationBase: StartDate   * PerpetualSpecification: DaysToComplete   * OneTimeSpecification*: DateToComplete   * FixedSpecification: EndDate, CompletionDate   * SlidingSpecification: EndDate, DaysToComplete *When a user enters an EndDate that equals the StartDate they must use DateToComplete. In this case the EndDate is not actually saved though. So we're using inheritance to do two things here: encapsulate validation rules and not expose properties that don't exist for particular scenarios. As far as validation goes, from my perspective, the rules are always the same for all scenarios. Yes, certain properties don't apply in all scenarios but for the ones that do the validation logic really doesn't change. The argument, however, is that it is easier to comprehend the validation logic this way because putting it in all in the base class would be too complicated (writing a factory method to choose the right type based on user input and create it with reflection was, by comparison, considered not a big deal at all). And as for hiding unused properties (or as my team lead insists: not exposing properties that don't exist), the argument started out as being an OO design principle that data and behavior should be coupled... until I pointed out that it would still be coupled in the base class without the derived classes (not to mention the data isn't decoupled in the database either). I highly respect my team lead and from a purely philosophical/idealistic point of view this design seems great, but in practice it seems to create more problems than it solves:   * Had to create a factory method since we just get input from users without making them specify the type   * 3rd party tools that rely on reflection can't work with a list of different types with different properties so I have to create a proxy (or cheat and just put the data into an anonymous type and hope I'm never asked to provide a way to update the data from a grid control)   * Because consuming code only uses the factory method, it doesn't know what specific type it has or which properties are on it. This means if/then statements to test for what type I'm working with before trying to access a property that might not exist. I'm sorry for the incredibly long essay, but I just wanted to provide ample context and background before asking my question: Is this 'really' good OO design? I feel like good OO design should make life easier... not harder. What am I missing here? ## Edit: More Info I realize now I left out a an important detail. My team lead is very, very big on requiring all data needed to initialize a proper type to be passed into its constructor (and not allowing a default constructor), and putting validation logic in the properties' set accessors. He feels this is the best way to prevent bad data from getting into the database. I don't particularly like this approach, however he's worked at some places where lack of good validation caused serious, serious problems. So that's why I use a factory method... but the drawback of that is that type casting is required when the extended properties have to be worked with. Another drawback is that if I make the properties virtual then now, because of our validation approach, I have to call virtual properties from the constructor. Actually I ended up doing just that of necessity and practicality, but I'm didn't mention it in the beginning because doing so was a 'work around' to the actual design that I wanted to ask about.


Windows Console App vs Service

## My Situation I work for a company that builds software for many other companies. When I learned installers weren't built-in with VS2012, I was curious how to deploy. So far, I have just been dropping .exes on our clients servers using PowerShell scripts. Now I need a full-blown Windows service. I have seen many example of how to run services via a console application: http://stackoverflow.com/questions/7764088/net-console-application-as-windows- service I could easily use `sc.exe` to create a service based on a console application like this. I have no idea how Windows would handle Start/Stop/Restart, though. ## The Question This has made me curious what the relationship between console applications and services is in the Window's world. Are services just console applications with hooks to allow the OS to call start and stop? Or are services completely different? A long time ago, I thought WinForms and console applications were completely different. After messing around in Win32, I realized they were the same thing. ## My Hopes I am hoping services are just console apps, like WinForms, and that I can tap into the Start/Stop capabilities directly in .NET. The built-in installer projects were pretty awful, so I don't feel too bad for copying .exes to the server.


What does Dependency Injection mean by saying it can inject on runtime?

I understand that the dependency injection is something done by coding and its all done at compile time. And that Dependency injection coding is easily done now by helper tools like Ninject. However this is at compile time that the dependency injection occurs. Then what does it mean that dependency injection also occurs at Runtime? This is straight from wiki about Dependency Injection > Dependency injection is a software design pattern that allows the removal of > hard-coded dependencies and makes it possible to change them, whether at > run-time or compile-time. I mean I thought about it and came up with the idea that it may refer to multiple interfaces to a single class when a Delegate calls a metho from one of the interfaces, dependency injection decides something like this at runtime, but when I went deeper into it and even discussed it with my boss it sounded like its not that simple as that. And that then, how does the dependency injection makes this decision and assume it the correct one? Anyone can help me clear out this question?


Transitioning to asynchronous programming model

our team is mantaining and developing a .NET web service written in C#. We have stress tested the web service's farm and we have evidence that the actual architecture doesn't scale well, as the number of request are constantly increasing. We analyzed Martin Fowler's conclusion in this article, and our team feels that migrating to an asynchronous programming model such as the one described could be the right direction to point to for our service too. My question is: do you think that this "switch" needs a complete rewrite of the application? Has been someone of you been able to adopt APM without rewriting everything and has some insight to share? Thank you in advance


What are some important guidelines when starting a software cooperative?

We are a group of people who are about to start a software cooperative, which means all of us (and other future workers) will be the owners of the 'company' rather than having bosses and employees. We do this from ideological reasons but also because we believe this allows many advantages - power of democracy (see SE..) , motivation, creativity, good work relations and atmosphere and more. We do face some questions about how exactly ownership of our products should be split, should we give different percentage for different people which put in a different amount of work hours or brings expert knowledge. We want people to feel they get what they deserve, not more, not less, and we're not sure just splitting it even will give this feeling. What are some good guidelines for solving these questions in a cooperative?


Etiquette using code found on GitHub and using Code beyond included Libraries

I've been trying to find what I'm supposed to do when I want to use code I find on GitHub. I think this post had some good information but I'm still somewhat confused. I want to use code found in this repository https://github.com/wcdolphin/python-bcrypt So according to the answer given the post, I'm to take the content in the LICENSE file of that repository and add it to the LICENSE in my project? I understand that I should give acknowledgement to the creator, how do I do that? Do I create a .txt file in the directory that holds the module that is their code and say something like "Created by wcdolphin, found at https://github.com/wcdolphin/python-bcrypt"? Also, I haven't used used libraries beyond what is included with the Python library before. I see installation instructions there, but that would only work on my machine right? Can I download and add these files into my project directory and use them as modules? I found this post but I'm not sure if I can custom install stuff on Google App Engine. I intend on hosting my project up there(I'm not going to try to homebrew encrypt super sensitive information, it's more of a demonstration) and I think, with my limited knowledge, uploading the source with my source would be the best way. Thanks


How can I make refactoring a priority for my team?

The codebase I work with daily has no automated tests, inconsistent naming and tons of comments like "Why is this here?", "Not sure if this is needed" or "This method isn't named right" and the code is littered with "Changelogs" despite the fact we use source control. Suffice it to say, our codebase could use refactoring. We always have tasks to fix bugs or add new features, so no time is put aside to refactor code to be better and more modular, and it doesn't seem to be a high priority. How can I demonstrate the value of refactoring such that it gets added to our task lists? Is it worth it to just refactor as I go, asking for forgiveness rather than permission?


How best to implement a Dashboard from data in HDFS/Hadoop

We have a bunch of data (several TB) in Hadoop HDFS and it's growing. We want to create a dashboard that reports on the contents in there e.g counts of different types of objects, trends over time etc. Our first thought was to use something like Oracle Tableau or d3.js and to use Hive queries. But Hive is just too darn slow for these "precanned" queries. Now we're thinking of using Hive to extract data regularly from HDFS and store the output in a "more real time" database e.g. HBase or an RDBMS (e.g. MySQL). That'll work but I'm worried we're missing a simpler / easier solution (if there is one) that requires less ETL / extracts and duplicate data storage mechanisms (HDFS + something else)


What are the worst false economies in software development?

What are the worst false economies (that is ways of saving money that ultimately cost more than they save) prevalent in the software industry and how do you combat them?


English to French translation of computing terminology

I work in France as a Java programmer, mainly in French, but am a native English speaker. My level of French is pretty good (French wife!), but one thing I have problems with is working out whether to use English terminology or a French equivalent. Examples:   * lock (as in a synchronisation lock) - do I use the verb "locker" or do I use verrouiller?   * shard (databases) - "un shard" or "un tesson" (which means a shard of glass) ...and so-on... So, what do people recommend? Can anyone point out some good websites for translating this kind of terminology? The usual online translation tools are a bit too everyday English/French, not the slightly more specialised version that I find myself needing.


Do high standards necessarily lead to frustration, and how to deal with it?

I consider myself a programming language enthusiast. When I find bad code, especially my own, it is hard to understand, hard to change, and hard to test. My coworkers don't know better, or don't care. I am frustrated that I can't raise the code quality by myself. Is it normal to feel frustrated when the code quality, and maintainability, is not up to my standards? If so, how do you deal with it?


Can SDK license influence an application license?

Let's say SDK is under specific license that is not compatible with some other licenses (like Flex SDK with GPLv2). Can I create an application by using for example Flex SDK, and license its distribution under GPLv2? Can my application be considered a derivative work? What is a relation between SDK license and application license that was build by using that SDK?


Is there an appropriate coding style for implementing an algorithm during an interview?

I failed an interview question in C years ago about converting hex to decimal by not exploiting the ASCII table `if (inputDigitByte > 9) hex = inputDigitByte - 'a'`. The rise of Unicode has made this question pretty silly, but the point was that the interviewer valued raw execution speed above readability and error handling. They tell you to review algorithms textbooks to prepare for these interviews, yet these same textbooks tend to favor the implementation with the fewest lines of code, even if it has to rely on magic numbers (like "infinity") and a slower, more memory-intensive implementation (like a linked list instead of an array) to do that. I don't know what is right. Coding an algorithm within the space of an interview has at least 3 constraints: time to code, elegance/readability, and efficiency of execution. What trade-offs are appropriate for interview code?   * How much do you follow the textbook definition of an algorithm? Is it better to eliminate recursion, unroll loops, and use arrays for efficiency? Or is it better to use recursion and special values like "infinity" or Integer.MAX_VALUE to reduce the number of lines of code needed to write the algorithm?   * Interface: Make a very self-contained, bullet-proof interface, or sloppy and fast? On the one extreme, the array to be sorted might be a public static variable. On the other extreme, it might need to be passed to each method, allowing methods to be called individually from different threads for different purposes.   * Is it appropriate to use a linked-list data structure for items that are traversed in one direction vs. using arrays and doubling the size when the array is full? Implementing a singly-linked list during the interview is often much faster to code and easier remember for recursive algorithms like MergeSort.   * Thread safety - just document that it's unsafe, or say so verbally? How much should the interviewee be looking for opportunities for parallel processing?   * Is bit shifting appropriate? `x / 2` or `x >> 1`   * Polymorphism, type safety, and generics?   * Comments?   * Variable and method names: `qs(a, p, q, r)` vs: `quickSort(theArray, minIdx, partIdx, maxIdx)`   * How much should you use existing APIs? Obviously you can't use a java.util.HashMap to implement a hash-table, but what about using a java.util.List to accumulate your sorted results? Are there any guiding principals that would answer these and other questions, or is the guiding principal to ask the interviewer? Or maybe this should be the basis of a discussion while writing the code? If an interviewer can't or won't answer one of these questions, are there any tips for coaxing the information out of them?


Will You Use an Online Technical Skills Test to Hire a Senior Developer?

There are online services such as IKM that offer skills tests in many areas, including programming. > Would you use these kind of tests when hiring for a senior developer > position? What about just for objectively benchmarking candidates before calling them for an interview? Would you use it as a step after short-listing candidates after interviews? Is this approach more suitable in some situations compared to others? Have you personally used this kind of service or know someone who has?


What software do you use to track time spent on a project?


Do social networks increase development productivity?

I am a developer a fairly large firm of programmers (100+). Since there are several departments and several teams within each department; communication is an issue regarding: sharing of ideas, availability of resources/tools, use of good/bad coding practices, awareness of existing utilities, etc. What social networks (Facebook/StackExchange) are out there that are used 'in- house' for work related communications? What business cases could be used to help senior management see the value of a resource like this for increased productivity?


Is it possible to create and boot a scratch-built Operating System for iTouch devices?

So, what would I need to write "Hello world" on the iPod Touch on boot? Make that the entire operating system? Which compiler would I use, how would the graphics be done...? Can this be done without too much effort? I know writing an Assembly boot loader isn't that hard...


The problem of dependencies management

Let's consider the next situation:   1. We have a module A which has a class Crt570 intended to interact with a device.   2. We have a module B which uses Crt570 in the class called M100Communicator.   3. We have two applications C and D and both of them wants to use module B.   4. Application D wants to use B, but doesn't want to use Crt570 and reference module A, therefore. "Module" here means dll. So we decided to extract an interface from Crt570 and called it ICrt570. But what to do with that now? It's just very strange to move ICrt570 into the domain module (let's call it module E) or somewhere else because after that Crt570 has to reference the module which will contain ICrt570! How to solve the puzzle? **UPDATE** In order to make the question more clear for readers in the future I'll add a bit more details. Module A is the dll which contains nothing but Crt570 class (with it's infrastructure). So this dll is dedicated to manage a device absolutely, nothing more. Module B is the dll which contains models specific for several applications in our domain. At least 3 applications want to use this module and they, of course, don't want to pull dll's they don't need. One of the models that C and D apps want to use is the M100Communicator model. And, in particular, this class (M100Communicator) depends on module A (Crt570 class). Module E which I mentioned is a domain module. It contains many classes and interfaces, so module A doesn't want to use it, apparently.


Are there any existing standard software design guidelines?

My team of about 70 programmers is developing C and C++ code for embedded, multiprocessor, image-processing project. We have a coding standard, and hold design and code reviews. The problem is that we don't have solid design review checklist. Currently we have scattered design checklists, but most of them are vague. For example, you might find statements like these:   * Component design should be extendable.   * Coupling should be reduced between modules. The problem of these statements is that they are totally subjective and not measurable. Extendable design for me might means something else for another one. Is there some kind of widely accepted or proven checklist or design rules that can serve as a basis for our design reviews, especially for our object- oriented C++ code base?


Is it acceptable to use lambda functions\methods in business software?

I've noticed posts on here demonstrating the use of delegates\lambda functions to solve the hole in the middle idea without a lot of repetition: http://www.markhneedham.com/blog/2009/04/04/functional-c-the-hole-in-the- middle-pattern/ The problem seems to be that junior developers and others don't necessarily understand what the function pointer\delegate\lambda function concept is, which seems to make reading (and possibly debugging) the code more difficult. Should we avoid or severely limit the use of this tool in writing business software, especially in small team or sole developer shops? Or is it acceptable to use it with appropriate comments and expect that when I'm no longer around that the next developer will understand or learn about lambda functions?


How do I properly add a reference from my Github project to someone elses in VS2013 on Windows 8?

I need to reference the latest version of Bouncy Castle in a project I intend to publish to Github. In my first posting of the code to Github, someone complained that I downloaded the entire Bouncy Castle library, added it as a project, and uploaded it. What is the correct way to link to the latest version of this Bouncy Castle DLL so that my references are properly maintained?


How much extra time is needed to add unit test in a development task?

My team is considering moving to test-driven development. Currently we have almost no unit testing, we have been only relying on the user acceptance test, and developer's own manual test. Not everyone have agreed with this proposal. In the team, no one really has an experience on unit testing, so it's hard to convince everyone the benefit of doing it. One of the objection is the time needed. My question is, how much extra time is usually needed to add unit test, relative to the task itself? Let's say if the coding of a task (excluding acceptance test) takes half a day, how much time will the unit test take, in average? This estimation is important for us to explain the relative benefit of doing unit test, and to adjust our planning. If it matters, we are mostly working with .NET desktop application (with a GUI and a database), and it is not safety-critical (I mean, it's not for a nuclear power plant or stuff like that). Also note that none of us have experience, so there will be a learning curve


Choosing a proper wording for referring compiler errors

Consider someone is writing a message (or a question at StackOverflow). The context is following: > In my code, I have the following line:   >  `int foo = Bar();` > > However, the compiler **returns** an error:   >  _line 42: Bar() is unknown function_ I'm puzzled to choose a proper verb instead of **"returns"**. I've seen people using various verbs for it, but I stuck every time I read it:   * "returns" can be confused with a function return value;   * "throws" is for exceptions;   * "prints" has a little sense as the compiler output is not always printed;   * "outs", "outputs", or "gives" do not sound professional;   * "the compiler complains" sounds a bit like personification of the compiler; What is the proper verb in this situation?


Common practice in handling bounce message

At now I mainly create a mail account separately (with different domain name eg.noreply@example.com) and i add this mail as one return path. So the bounce message will only go to that mailbox and i parse the mail message one by one to check the failure receipent and the error code, then i convert the error code to the actual error message. Finally, the error message and the fail receipent's mail are post to my system and let my system user check the bounce information. Is it a common practice? Since i am worry about the mail other from bounce message have sent to my mail box, that would be a disaster if i parse them without filter them out, but how can i filter out between bounce message and normal mail? Thank you for any kind of help.


What benefits does embedding resources into the source/binary provide?

I have 300-500 images and other files that my program uses. I realize I have two options:   1. Save them in a binary format such as BMP which is loaded dynamically.   2. Save them in a C source file such as XPM which allows it to be compiled into the program, but it also can be loaded dynamically. Assuming both are just as easy to implement and I don't require dynamic loading, what are benefits of each method? How would the loading/startup speed compare?


What should we provide to a dev team hired to complete a new project?

We are wanting to have developers build an in-house payroll and time sheet application using symfony2/doctrine2. We are simply at conceptual stage at this point and this will be our first time and getting developers to build an application for our company. Hence, it is very important to us that we provide the most valid and important information to what will be our new developer team. What documents or tools should we provide to the new team to maximize the odds of success with the project and help the developers be productive from day dot?


Using "public" vars or attributes in class calls, functional approach

I was always wondering about two things I tend to do in my little projects. Sometimes I will have this design:               class FooClass         ...         self.foo = "it's a bar"         self._do_some_stuff(self)              def _do_some_stuff(self):             print(self.foo)      And sometimes this one:               class FooClass2         ...         self.do_some_stuff(foo="it's a bar")              def do_some_stuff(self, foo):             print(foo)       Although I roughly understand the differences between functional and class approaches, I struggle with the design. For example, in `FooClass` the `self.foo` is always accessible as an attribute. If there are numerous calls to it, is that faster than making `foo` a local variable that is passed from method to method (like in `FooClass2`)? What happens in memory in both cases? If `FooClass2` is preferred (ie. I don't need to access `foo`) and other attributes inside do not change their states (the class is executed once only and returns the result), should the code then be written as a series of functions in a module?


What is the difference between Software Project Management Process and Software Development Process?

What is the difference between Software Project Management Process, and Software Development Process, or Software Life Cycle?


What common programming problems are best solved by using prototypes and closures?

As much as I understand both concepts, I can't see how can I take advantage of JavaScript's closures and prototypes _aside_ from using them for creating instantiable and/or encapsulated class-like blocks (which seems more of a workaround than an asset to me) Other JS features such as functions-as-values or logical evaluation of non- booleans are much easier to fall in love with... **What common programming problems are best solved by using propotypal inheritance and closures?**


How are minimum system requirements determined?

We've all seen countless examples of software that ships with "minimum system requirements" like the following:   * Windows XP/Vista/7   * 1GB RAM   * 200 MB Storage How are these generally determined? Obviously sometimes there are specific constraints (if the program takes 200 MB on disk then that is a hard requirement). Aside from those situations, many times for things like RAM or processor it turns out that more/faster is better with no hard constraint. How are these determined? Do developers just make up numbers that seem reasonable? Does QA go through some rigorous process testing various requirements until they find the lowest settings with acceptable performance? My instinct says it _should_ be the latter but is often the former in practice.


Do aggregate-oriented NoSQL databases have advantages for implementing Real Time BI?

I am reading a book called "NoSQL distilled" by Martin Fowler and he writes: > Aggregates can also be used to obtain analytics; for example, an aggregate > update may fill in information on which Orders have a given Product in them. > This denormalization of the data allows for fast access to the data we are > interested in and is the basis for Real Time BI or Real Time Analytics where > enterprises don’t have to rely on end-of-the-day batch runs to populate data > warehouse tables and generate analytics; now they can fill in this type of > data, for multiple types of requirements, when the order is placed by the > customer. But he doesn't explain why can't I do the same things with relational databases and how does the denormalization help to solve this task. Do aggregate and/or denormalization help in implementing Real Time BI and why? What does Fowler mean here? (By aggregates he means documents in databases like MongoDB or other records of data in other databases that have nested structure instead of atomic values and foreign keys)


Places to find free software projects who need developers/project managers?

While I have plenty of project management "booksmarts" and a handful of PM experience, I don't seem to have enough experience to get the sort of job I want. Since "I read another PM book/blog today" doesn't really count, I was thinking I could find some free/open source software (FOSS) projects who are looking for/hiring project managers or developers and see if there was anything I could volunteer for. Does anyone know of any FOSS employment sites where I might be able to find such projects? Something similar to careers.stackoverflow.com. I know I could just go to sourceforge/freshmeat and look around, but I was hoping to find some site that fills this need (and if any such sites exist, my google-fu is apparently VERY weak at finding them).


What to do when a sprint is finished early? At the moment our Scrum team works off stories from the backlog, if the sprint is finished early. What happens with stories taken from the backlog? Will the stories be added to the current Sprint ? If yes, what if these stories won't be finished in time. Is the Sprint failed then?


Link relation values and REL attribute - edited

1. In REST, do we **always** use _link relation values_ to convey semantics/role of a _linked resource_?   2. I assume _link relation value_ is always specified using `rel` attribute?    3. Should `rel` attribute only be specified within a **hypermedia control**?   4. I assume for _an element_ to be considered a **hypermedia control** it must provide a linking functionality and must also contain a `rel` attribute?


Should maven generate jaxb java code or just use java code from source control?

We're trying to plan how to mash together a build server for our shiny new java backend. We use a lot of jaxb XSD code generation and I was getting into a heated argument with whoever cared that the build server should   1. delete jaxb created structures that were checked in   2. generate the code from XSD's   3. use code generated from those XSD's Everyone else thought that it made more sense to just use the code they checked in (we check in the code generated from the XSD because Eclipse pretty much forces you to do this as far as I can tell). My only stale argument is in my reading of the Joel test is that making the build in one step means generating from the source code and the source code is not the java source, but the XSD's because if you're messing around with the generated code you're gonna get pinched eventually. So, given that we all agree (you may not agree) we should probably be checking in our generate java files, should we use them to generate our code or should we generate it using the XSD's?


Coding site with test harness for basic data structures like linked list,graph,strings etc

I just took an Amazon online test and I messed it up badly. I am out of practice and have low confidence in writing code. Are there any coding sites with test harnesses for basic data structures and with basic problems like arrays, strings, linked lists, graph adjacency lists etc, so that I can brush up on basic code like reversing linked list, checking if linked list is palindrome, sorting linked list, finding a substring in a string etc. This would make basic DS brushing fun. I know there are sites like codechef and topcoder, but from what I have seen, these don't have such basic list, graph conceptual DS questions and test harnesses.


PHP Code base design: Single "queries.php" file, or spread queries across different php files/classes?

When I create PHP projects, is it better to put all database (e.g. MySql) queries in a single file (i.e. "queries.php")? Or is it better to place the respective queries in any "model" classes (i.e. User.php) that I may be creating? Is it bad practice to put database queries anywhere in any PHP file? In the queries.php I would be placing functions for calling the queries.


Rate your programming language expertise by language concepts

I am looking for a good way to **rate the expertise** in a particular **programming language**. The idea arose when I found the following article: Taking falsely all the credits? You don't know JavaScript. It lists, in a comprehensive way, **language features and concepts** of JavaScript. I wish there would be a list for every programming language. In particular I would be interested about:   * Java   * C   * Python   * C# / .NET   * C++   * JavaScript Any other language or technology would be also interesting. In a similiar question What's a good way to rate your own code skills the Programmer Competency Matrix was suggested. I think it's a good approach, but I think it's too generic. Do you know any other summaries of language concepts which could help to rate the programming language expertise?


Is objective-C++ being phased out?

Is apple phasing out support for objective-c++? Note the following:   * In the Objective-C language manual, there used to be a section on mixing objective-c and c++. That section is now missing.   * Links to articles on objective-c++ on the apple developer website seem to be broken, and are now redirected, e.g. this one, which I found on this stackoverflow question.   * Searching for c++ on the apple dev website brings very little in the way of current information. Should I be concerned about using c++ for iOS development?


Most commonly used free-of-charge linux and SQL distributions

I'm looking to reduce the initial costs of starting a business. As much as I like Windows Server 2008 and SQL Server 2008, I think their per-processor sale model is very expensive. Plus, if the business were to grow, new web and database servers would depend on those, increasing expenses. What are the most popular (i.e. most widely used) free-of-charge linux distrubitions for commercial businesses? What are the most popular (i.e. most widely used) free-of-charge SQL databases for commercial businesses?


Does the JSON parser omit empty arrays?

I have a JSON like this:               {      "CODE" : [{            "FOO" : "BAR",            "SET" : []            },            {            "FOO" : "ABC",            "SET" : []            }       ]      }      Now, when I try to access CODE[0].SET, I get an error in my browser that "SET" does not exist. I use the json_parse library by Douglas Crockford to parse the above JSON: https://github.com/douglascrockford/JSON- js/blob/master/json_parse.js Sorry, in advance, If I have posted this question in the wrong forum.


Inheritance versus Composition in a business application

I have a training management and tracking system, with a high level structure as follows: We have a _Role_ 1, e.g. Manager, Shift-boss, miner, etc. and a _Candidate_ , training for that Role. The role has a list of courses and their subjects the candidate needs to complete to qualify for the role. _Candidate_ has a `TrainingHistory` attribute, containing the courses and subjects they have completed, their results, and the date completed. Now I see it as a _TrainingHistoryCourse_ **is-a** _Course_ , extended to add `DateCompleted` etc. but something is nagging at me to rather use something like a _TrainingHistoryRecord_ that **has-a** _Course_. How can I further analyse this to determine which pattern to use? Then, a _Role_ has a list of _RoleTask_ definitions that the Candidate must be observed practising, and a Candidate has a history of _RoleTaskObservation_ objects recording their performance at these tasks. This is very similar to the course/subject requirement and history pattern for the candidate, except for one less hierarchical level, but, a _RoleTaskObservation_ clearly does not have an **is-a** relationship with _RoleTask_ , unless I block my nose and rather use _ObservedRoleTask_. I would prefer to use the same pattern for both subject/course and task/observation structures, but I think that would force me to adopt a composition pattern for _TrainingHistoryCourse_. What is the wisdom here? Always inherit where possible and validated by a solid is-a association, or always favour composition wherever possible? 1 Client specified this to be called JobTitle, but he isn't writing the app, and a JobTitle is only one attribute of a Role. Authorization roles are handled by the DevExpress framework and its customization hooks, so there would be very little little confusion between a business Role in my domain objects and an authorization role in lower level, framework code.


How do you keep track of all your passwords?

I'm going to ask this question at the risk of someone exposing me their own personal algorithm, if that's what you do please don't post that! I'm interested in learning what software you use to manage your passwords on various sites. If you do use software, what is it? What features do you like/hate/want? The other day I discovered a vendor that offers a "Hosted Cloud" platform to manage your passwords. Would you consider such a thing? What would your requirements be?


Given the presentation model pattern, is the view, presentation model, or model responsible for adding child views to an existing view at runtime?

I am building a Flex 4 based application using the presentation model design pattern. This application will have several different components to it as shown in the image below. ![enter image description here](http://i.stack.imgur.com/jpFp8.png) The MainView and DashboardView will always be visible and they each have corresponding presentation models and models as necessary. These views are easily created by declaring their MXML in the application root.               <s:HGroup width="100%" height="100%">         <MainView width="75% height="100%"/>         <DashboardView width="25%" height="100%"/>     </s:HGroup>      There will also be many WidgetViewN views that can be added to the DashboardView by the user at runtime through a simple drop down list. This will need to be accomplished via ActionScript. The drop down list should always show what WidgetViewN has already been added to the DashboardView. Therefore some state about which WidgetViewN's have been created needs to be stored. Since the list of available WidgetViewN and which ones are added to the DashboardView also need to be accessible from other components in the system I think this needs to be stored in a Model object. My understanding of the presentation model design pattern is that the view is very lean. It contains as close to zero logic as is practical. The view communicates/binds to the presentation model which contains all the necessary view logic. The presentation model is effectively an abstract representation of the view which supports low coupling and eases testability. The presentation model may have one or more models injected in in order to display the necessary information. The models themselves contain no view logic whatsoever. So I have a several questions around this design.   1. Who should be responsible for creating the WidgetViewN components and adding these to the DashboardView? Is this the responsibility of the DashboardView, DashboardPresentationModel, DashboardModel or something else entirely? It seems like the DashboardPresentationModel would be responsible for creating/adding/removing any child views from it's display but how do you do this without passing in the DashboardView to the DashboardPresentationModel?   2. The list of available and visible WidgetViewN components needs to be accessible to a few other components as well. Is it okay for a reference to a WidgetViewN to be stored/referenced in a model?   3. Are there any good examples of the presentation model pattern online in Flex that also include creating child views at runtime?


A job role where connection with other developers along with writing code

Is there a position in companies (and which ones?) where the role is writing some code along with going on to the seminars to connect with other developers who maybe the clients of your/company's product? I'd like to get out of the cubicle writing code style. I am already a member of some meetups and go there regularly but would like to get into a job where the requirement is to connect and share. I am not sure what kind of companies have such a position and what are these called. I am a programmer with sufficient web development experience. Thanks.


How important it is to fix memory leaks?

I found by Valgring that some GTK+ programs leaks memory. How important it is to fix those leaks? I mean, often those programs works very well but on the other hand, one can never be sure if one wants to copy part of the leaking code to some other program. And I'm not sure if the idea of GTK+-programs is to work fast and therefore there are leaks. So if I sometimes find a memory leak in an open source program, should I fix it or are there for example efficiency issues and therefore programmers original idea was to write some small leaking code?


How do people doing TDD handle loss of work when doing major refactoring

For a while I have been trying to learn to write unit tests for my code. Initially I started out doing true TDD, where I wouldn't write any code until I'd written a failing test first. However, I recently had a thorny problem to solve which involved a lot of code. After spending a good couple of weeks writing tests and then code, I came to the unfortunate conclusion that my entire approach was not going to work, and I would have to throw out two weeks work and start again. This is a bad enough decision to come to when you've just written the code, but when you've also written several hundred unit tests it becomes even more emotionally difficult to just throw it all away. I can't help thinking that I've wasted 3 or 4 days of effort writing those tests when I could have just put the code together for proof of concept and then written the tests afterwards once I was happy with my approach. How do people who practice TDD properly handle such situations? Is there a case for bending the rules in some cases or do you always slavishly write the tests first, even when that code may turn out to be useless?


Are we always supposed to create a setup to deploy or application?

I have recently developed an application in C# which is supposed to run within the environment of the company i work for. I could technically generate a Setup or use ClickOnce to handle the deployment of the application, but I am considering basically copying the EXE file into a public directory and have everybody execute it from there. The program recovers data from a database, makes some computations and displays the results. I was wondering what the downfalls of this idea were. So far, I came up with the following:   * I have to make sure that the prerequisites are installed on each machine (for example, .Net Framework 4.0)   * I will not be able to "automatically" create a shortcut and the entries in the "Start Menu" (not a problem, user can do it manually). In particular, I was wondering if the fact that several user actually run the same application at the same time could result in a problem (cocurrency, efficiency)?


Unit testing multiple conditions in an IF statement

I have a chunk of code that looks something like this:               function bool PassesBusinessRules()     {         bool meetsBusinessRules = false;              if (PassesBusinessRule1               && PassesBusinessRule2              && PassesBusinessRule3)         {              meetsBusinessRules= true;         }              return meetsBusinessRules;     }      I believe there should be four unit tests for this particular function. Three to test each of the conditions in the if statement and ensure it returns false. And another test that makes sure the function returns true. **Question:** Should there actually be ten unit tests instead? Nine that checks each of the possible failure paths. IE:   * False False False    * False False True   * False True False And so on for each possible combination. I think that is overkill, but some of the other members on my team do not. The way I look at it is if BusinessRule1 fails then it should always return false, it doesn't matter if it was checked first or last.


Is an app that does nothing but link to a web site functional enough to meet Apple's iOS guidelines?

I don't hang out on Programmers enough to know whether this question is "ok", so my apologies if not. I tried to make the title obvious so at least it can be closed quickly :-) The question is simple. My employer wants "home screen presence" (or at least the possibility thereof) on iOS devices (also Android but I'm mostly interested in Apple at the moment). Our actual application will be a pure web- delivered mobile-friendly application, so what we want on the homescreen is basically something that just acts as a link to bring up Safari (or Chrome now I guess; not important). I'm presuming that that's more-or-less possible; if not then that would be interesting too. I know that the Apple guidelines are such that low-functionality apps are generally rejected out of hand. There are a lot of existing apps that seem (to me) less functional than a link to something useful, but I'm not Apple of course. Because this seems like a not-too-weird situation, I'm hoping that somebody knows it's either definitely OK (maybe because there are many such apps) or definitely not OK. Note that I know about things like PhoneGap and I don't want that, at least not at the moment.


How do I reuse a state machine in a slightly different way?

## Problem I have a big state machine. The design requirements of the project have changed such that I need to re-use this state machine in another place. All the states remain the same in this new place, but a few states run slightly different stuff. What design pattern allows me to reuse this state machine? ## Motivation I am building a video player. It is modeled by a state machine with these states: stopped, loading, playing, paused, crashed, and some more... This video player needs to be used on two web pages. When the player crashes on the first page, it should show an error message below. If the player crashes on the second page, the error message should appear in the center of the video and pulsate a few times.


How would you highlight code?

While the basic scenarios are white on black and black on white, most programmers find more varied syntax highlighting useful. What advantages do you find from a general setup? (E.g. "a dark background allows...") What specific tweaks do you find most helpful? (E.g. " _slightly_ off-white works to...", or "highlighting quote marks and escapes, like \n, differently shows...") One answer per person, please; list multiple points as part of your one response, if needed.


Learning on the Fly

I would like to know what other developers do when a situation arises to implement a couple of features in language unknown to you. You are familiar with Javascript, and you do not know jquery, how do you go by implementing some features in jquery assuming you have not much time.


What's the better way to charge for a cloud platform, simple but more expensive, or complicated but cheaper for most?

I'm working on a cloud platform, and was curious what people prefer in terms of paying for web services. There's the option of very simple pricing (tiers and such), which is easy to project costs on, easy to compare, but (possibly significantly) more expensive for the average user, because you're always either underpaying or overpaying. The other option is a complicated pricing structure with many different factors, a lot harder to project costs on, but you're literally paying only for what you use, so it comes out to a lower price for the average user. Which do you prefer?


What is the difference between requirements and specifications?

I've been tasked with developing requirements and specifications for a project our group is starting. I realized that I don't know the difference; a Google search just confused me more -- it seems some people say that specifications _are_ requirements, but at a lower level.


What is Continous Integration (CI) and how is it useful?

Can some one explain to me the concept of Continious Integration, how it works in an easy to understand way? And why should a company adopt CI in their code delivery workflow? I am a developer and my company (mainly the build team ) uses Team City. As a developer I always checkout, update and commit code to SVN but never really had to bother about TeamCity or CI in general. So I would like to understand what is the usefulness of CI? Is CI a part of Agile methodologies?


Is my use case diagram correct?

NOTE: I am self studying UML so I have nobody to verify my diagrams and hence I am posting here, so please bear with me. This is the problem I got from some PDF available on Google that simply had the following problem statement:      **Problem Statement** :   A library contains books and journals. The task is to develop a computer system for borrowing books. In order to borrow a book the borrower must be a member of the library. There is a limit on the number of books that can be borrowed by each member of the library. The library may have several copies of a given book. It is possible to reserve a book. Some books are for short term loans only. Other books may be borrowed for 3 weeks. Users can extend the loans.   1\. Draw a use case diagram for a library.   2\. Give a use case description for two use cases:   • Borrow copy of book   • Extend loan   **Diagram:**   ![enter image description here](http://i.stack.imgur.com/c4lXh.png) **Use case description:**   **1\. Borrow a copy of the book:** If the person wishes to borrow a book from Derpville Public Library, he/she must be a member of the library in which case they will be allowed to issue a certain number of books. If the person is not a member, the book will not be issued to them for taking away, rather they will have to sit and read in the library.   **2\. Extending loan:** Some books will be lent for 3 weeks while others will be lent for more than 3 weeks in which case the person borrowing has to come to the library and get the date extended. There is a limit on how much the user can extend the date of a particular book.


Are type and scope prefixes worthwhile naming conventions?

Recently starting my first job as a software developer, I was a little thrown to be told that I did not have to follow any naming conventions in my code. Code written by groups working on other, larger projects followed naming conventions, but since I was brought in to write a new, stand-alone, application, the feeling was that it did not especially matter. It was the last of my worries, so I just took that existing convention and ran with it.               int nTickCount         bool bConnected         object[] m_aItems         fSum += fWeight * fValue         class cManager         enum etSystemStates         etSystemStates eState          cManager.cs        But is it actually worthwhile? I find it hard to judge the net effect that following this kind of naming convention has on comprehension and detection of errors, but, _visually_ , it just looks kind of ugly. Plus, having every class and file in the project called cSomething seems pretty asinine. I'm not under the illusion that it's a remotely big deal when compared to things that make an obvious difference, like the algorithms and architectures that you employ. But any convention that affects every line of code that I write seems worth getting right. What do you find the most elegant and effective naming convention, if one need be used at all? Does it denote type and/or scope?


Should exceptions of a subclass extend the superclass exceptions or my own namespace?

Our library extends another (third-party) library. When we create a child class in our library, and want to throw exceptions, should those exceptions extend the exceptions from the parent class or from our own namespace? For example:               class Their_Exception extends Exception {}          class Their_Class {}     class Their_Class_Exception extends Their_Exception {}          class Our_Exception extends Exception {}          class Our_Class extends Their_Class {}     class Our_Class_Exception extends Our_Exception {} // or Their_Class_Exception?      Is it better to keep our code as above, and extend our own namespace? The way I see it, we have these alternatives:   1. Extend our own namespace, catching all possible `Their_Class_Exception` cases and throwing `Our_Class_Exceptions` in their place (complete encapsulation, but in general could be a fair amount of rework)   2. Extend our own namespace, but only don't catch `Their_Class_Exception` in `Our_Class` (probably means multiple catch blocks)   3. Extend `Their_Class_Exception` (seems counter-intuitive, could introduce bugs by catching the wrong exceptions) Which of these is the best approach in general, in order to keep our code consistent?


what's best platform for explaining pseudo-code to a developer who knows nothing about it?

I'm a scientific person needing to document complex Matlab code to hand to a developer for him/her to understand and program in a different language. In the past, I've used MS Word (explaining each program step as a new row in a table), and then Excel, but didn't find either particularly well suited to displaying my Matlab code and entering comments in a clear and concise way to document it. I'm wondering if there's any better technique to communicate pseudo-code to a developer. Any existing software (free?) or other platform (e.g. TextWrangler) particularly suited to providing code and some method for explaining it? Hoping to learn from others' experiences doing the same thing. Thanks in advance. After reading some comments, let me try to explain more... I assume all developers know pseudo-code, but I don't assume many know Matlab code. Thus, if I write in pseudo-code, I can ignore the Matlab code (or provide it for reference, etc.). But my question is really simpler... is there any software or platform people have used in the past to clearly communicate code to a developer? Something that enables the person creating the document to easily describe the code? For example, you can embed code that the software color codes (one color for comments, another for reserved words (if, then, else, for, etc.), etc.), and along one side there's room for me to enter explanations and references, etc. I tried do this using MS products, but thought since there's an industry of people needing to do the same thing, maybe someone has developed a system to make this easier.


Embedded Linux vs Windows Embedded Standard 7

Ok looking for some really subjective answers. My company has traditionally been a Linux shop, we manufacture and sell purpose built boxes for video security. We recently decided to build an Embedded Windows Standard 7 box because it shortened our development and time to market, and because of all the tools are available off the shelf for windows. What I am looking for are some solid answers as it relates to the security of WES7 vs. Linux? How stable is WES7, how prone is it to hack attempts, virus attacks etc. From a marketing point of view what could or should one say are the benefits of using WES7 over Linux? Are there any? What comparisons are there between the security of desktop Windows 7 and Embedded Windows Standard 7? Any responses would be greatly appreciated. Thanks


Use one or multiple files for graphics properties?

I'm creating a 2D game in plain ANSI-C using SDL2. I'm planning to let users create their own graphics. So, to achieve this, I'll use an information file which will hold some data such as Width, Height, X and Y position of each frame. But I have two views of this. One is to use a single file which will hold the information of all graphics. The other is to use one file for each graphic. Which one is faster and cleaner? Or it's just the same?


Best approach for tracking dependent state

Let's pretend I work on a project tracking application. The application is a database backed, server hosted, web application. In this application there are **Projects** which have many **Activities** which have many **Tasks**. A **Task** has two date fields an _originalDueDate_ and a _projectedDueDate_. In addition, there are dynamic fields on the **Activities** and the **Projects** which indicate whether the **Activity** or **Project** is behind schedule based on the projected due dates of the child tasks and various other variables such as remaining buffer time, etc. There are a number of things that can cause the _projectedDueDate_ to change. For example, an employee working on the project may (via a server request) enter in a shipping delay. Alternatively, a site may (via a server request) enter in an unexpected closure. When any of these things occur I need to not only update the _projectedDueDate_ of the **Task** but also trigger the corresponding **Project** and **Activity** to update as well. **_What is the best way to do this?_** I've thought of the **_observer_** pattern but I don't keep a single copy of all these objects in memory. When a request comes in, I query the **Task** in from the database, at that point there is no associated **Activity** in memory that would be a listener. I could remove the ability to query for **Tasks** and force the application to query first by **Project** , then by **Activity** (in context of **Project** ), then by task (in context of **Activity** ) adding the observer relationships at each step but I'm not sure if that is the best way. I could setup a **_database event listening_** system so when a **Task** modified event is dispatched I have a handler which queries for the **Activity** at that point. I could simply setup a **_two-way relationship_** between **Task** and **Activity** so that the **Task** knows about the parent **Activity** and when the **Task** updates his state the **Task** grabs his parent and updates state. Right now I'm stuck considering all the options and am wondering if any single approach (doesn't have to be a listed approach) is jumping out at others as the best approach.


Anyone read Apress C# series(wpf specifically)?

I am currently reading illustrated C# by Apress(on my first read through) and was thinking about moving on to illustrated WPF or Pro WPF after. I was wondering if anyone has read either and could tell me if pro WPF covers everything in illustrated WPF or should I get illustrated wpf then move to pro? Also, if anyone was thinking about getting illustrated C#, its not a bad book, it can get kind of confusing for someone who hasn't done any programming at all, but I find if you mix the structure of the book with some online videos it goes pretty well.


Algorithms that support parallelism?

Incoming 10th grader here. I recently posted about a science fair project idea and someone suggested that I do "The Effect of Parallelism on selected computational tasks." I'm having difficulty figuring out what I should do for those "selected computational tasks." I've got about a year and a half of c# experience. I asked on freenode's ##programming and someone suggested I do Ray Tracing (http://65.39.148.34/KB/graphics/Simple_Ray_Tracing_in_C_.aspx). Any ideas for other easy-medium difficulty tasks that I could use in my experiment? Thanks.


Agile,Waterfall and requirement changes

Has anyone had this issue of a project defined as 'Agile' being overrun by requirement changes ? I work on a development project which is run in 4 weeks Sprint but there are always changes in between these Sprints . Is it still defined as Agile then ? I feel it's sort of a sub Agile process - The requirements of an Agile process should be defined at the beginning of a sprint and reviewed towards its end. Am I right in this? Please let me know your experiences in this .


To what extent could Java be used over C++ for ultra high frequency systems?

Could Java ever match C++ with regards to programming ultra high frequency systems? Has the JVM improved enough to allow this? From a theoretical or practical point is it possible? Is C++ used in most UHF systems simply because out of habit? If you agree/disagree, what parts to Java/C++ is the basis for your viewpoint?


How to become an expert in Python, PHP and Javascript?

So I've been programming for about 9ish months now, and I've taught myself some Python, some PHP and some Javascript. I want to become better at these languages - I can hack something out, but a lot of things like OOP, using lists in the most effective ways, etc, is lost on me. What are the best ways to become an "expert" programmer? Does it depend on the nuances of the language, or is it more general? Is there any math I should be studying alongside it? Obviously a lot depends on what you want to do with it - so far I've mostly done small scale internal applications as well as web programming. How do I find out about good program design?


How do you solve large dependencies among files?

So basically I make several programs. Of course one program often used code from another. So I have my own personal "library" Well, I do write jerk codes. Then When I open a project, the project will require another file. I add that file and that file require another file, then I add that file and that file requires another file. Then, I ended up with so many files the program doesn't need. I ended up having to correct really really old codes that are no longer used on files I do not need. Why? Because I don't bother structure dependency. Well, subject for another question. What do you do to avoid this problem.


Comparison of route formats

I'm developing a new application and I'm trying to come up with a convention for defining routes. Ideally, I would like it to be simple, flexible, and reversible. Here are some from popular frameworks: ### Backbone               route                           matches     -----------------------------------------------------     help                            help     search/:query                   search/kiwis     search/:query/p:page            search/kiwis/p7     file/*path                      file/nested/folder/file.txt     docs/:section(/:subsection)     docs/faq, docs/faq/installing      ### Django Uses regexes, but comes with a complex regex reverser               route                                                           matches     -------------------------------------------------------------------------------------     ^articles/2003/$                                                /articles/2003/     ^articles/(\d{4})/(\d{2})/$                                     /articles/2005/03/     ^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$     /articles/2003/03/03/      ### Ruby on Rails               :controller/:action/:id/with_user/:user_id     books/*section/:title      ### ASP.NET / MVC 5               {controller}/{action}/{id}           /Products/show/beverages     {resource}.axd/{*pathInfo}           /WebResource.axd?d=...     {productId:int}/{productTitle}       /5/asp-net-mvc     books/{isbn?}                        /books, /books/1430210079      Django's is probably the most flexible, and it's already familiar to people that know regexes, but it's also the most difficult to read and reverse. Backbone, RoR and ASP.NET all allow optional and wildcard/splat parts, with various syntaxes. MVC 5 has some options for restricting the parameters inline ala `:int`. Where might these schemes fall short, and how could they be fixed?


Is Resharper still a significant improvement for Visual Studio 2012

I currently use Resharper with VS 2008 Pro. I find it almost a necessity to be as productive as I can be due to lack of some of the basic refactors/shortcuts in VS. However I was wondering if since VS 2008 improvements have been made that make it almost as good as Resharper?


Challenging Java questions for beginners

I am teaching an introduction to computer science lab session this semester. We are using Java. I am looking for some hard bonus questions for students to solve. They should be able to solve them in a relatively minimal amount of code (say 50-300 lines). So Far they know:   * input using Scanner   * Basic Math (including %)   * boolean logic   * Strings   * if statements   * while/for loops Later in the term they will know how to make methods and classes although this is getting towards the end of the class. I want to offer some short but challenging bonus questions. Does anyone have any good suggestions?


Is there a name for this functional programming construct/pattern?

I wrote a function and I'd like to find out if it is an implementation of some functional programming pattern or construct. I'd like to find out the name of this pattern or construct (if it exists)? I have a function which takes a list of functions and does this to them:                   wrap(fn1, fn2, fn3, fn4)         # returns         partial(fn4, partial(fn3, partial(fn2, fn1)))      There are strong similarities to compose, reduce, and other fp metaprogramming constructs, since the functions are being arranged together and returned as one function. It also has strong similarities to decorators and Python context managers since it provides a way to encapsulate pre and post execution behaviors in one function. Which was the impetus for writing this function. I wanted the ability that context managers provide, but I wanted to be able to have it defined in one function, and to be able to layer function after function on top. UPDATE: For clarity I've added the implementation:               _wrap = partial(reduce, lambda inner, outer: partial(outer, inner))     def wrap(fns):         fns = tuple(fns)         if len(fns)==1:             return fns[0]         return lambda *a, **kw: _wrap(iter(fns))(*a, **kw)      and an example:               def fn_one(fn, *a, **kw):       print "entered one"       response = fn(*a, **kw)       print "exited one"       return response          def fn_two(fn, *a, **kw):       print "entered two"       response = fn(*a, **kw)       print "exited two"       return response          def zero():       print "zero"          wrapped_zero = wrap((zero, fn_one, fn_two))     wrapped_zero() # returns entered two, entered one, zero, exited one, exited two


Should we always create web application scalable?

Fact that now a days everyone is moving to cloud due to ease in scalability, configuration and maintenance. But my question is should we develop all web application scalable event if it is not required? If an application is low budget with no such special requirements then why we should add efforts to make it support sclability? There are many factors to consider while making application scalable. If client has no specific requirement, small application contains 3-4 modules, client budget is low and is using on premises servers. To make application scalable, we have to make sure of session, IO files, caching etc...


To depend on source code or on binary?

We have two in-house projects, A and B, developed by different teams with B dependent on A. Since source code for both projects is stored in git, I've included project A as a submodule into project B and configured the build system to build both in right order. An alternative solution would be to consume A via a binary repository manager such as Artifactory or Nexus. I wonder about pros and cons of depending on source code vs depending on binary artifacts. When is one better than the other? So far I managed to come up with following factors, but I am really keen on hearing other opinions. Depending on source code is better   * if you don't have a binary repository manager   * if you need to depend on pre-release version of another project   * if you need to patch another project   * because it is easier to browse dependency source code in IDE Depending on binaries is better   * to minimize build time   * to avoid the hassle of setting up another project's build environment


Wondering if my computer books from 2002/2003 are still useful?

I found two books in my basement today and it was about Javascript and PHP/MySQL. Are they still useful? I hope it's still useful, since I don't want to buy a new one... 1.JavaScript - Comprehensive, Second Edition 2.PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide


What design pattern (in python) to use for properly seperate runtime infos with core code?

I am not sure if this is a clear question. I work on a python project that is based on terminal(console), for which I am planning to implement a GUI. I am not major in CS so I really have no idea about how to effectively design a message system such that:   1. in console, it provide nice look info when runtime.   2. in GUI, it is directed to a certain widget, let's say, a text label, or a bottom bar, or a hide-able frame. Do you have any suggestions? Currently, I am using `print` function to provide essential informations on `stdout` during runtime. So a lot of `print ....` are distributed here and there among the code. I am thinking to use macro-like variables such as 'FILE_NOT_EXTIS_MESSAGE' for printing, and define the variables in one file. Is this a standard way that people always do? How about I introduce a logging system? In sum, I am ask for a pattern that people are commonly using for handling of screen output information with high effectiveness and adaptivity.


What are the pros and cons of multiple inheritance?

What are the consequences of allowing multiple inheritance in a programming language? Why does multiple inheritance tend to violate the very essence of OOP? Is that what differentiates a pure OOP language like Java from an OOP language like C++? Explain and illustrate.


Self-documenting code vs Javadocs?

Recently I've been working on refactoring parts of the code base I'm currently dealing with - not only to understand it better myself, but also to make it easier for others who are working on the code. I tend to lean on the side of thinking that self-documenting code is nice. I just think it's cleaner and if the code speaks for itself, well... That's great. On the other hand we have documentation such as javadocs. I like this as well, but there's a certain risk that comments here gets outdated (as well as comments in general of course). However, if they are up-to-date they can be extremely useful of say, understanding a complex algorithm. **What are the best practices for this? Where do you draw the line between self-documenting code and javadocs?**


How to draw an E-R diagram?

I am learning DBMS in my college. Recently I was given an assignment to draw a E-R Model of a Bus Reservation system which handles Reservations, Ticketing and cancellations.   I understand the theory about E-R model when I study from a book, but it gets confusing when I try to draw one from scratch.   How should one proceed? There seem to be a lot of ways to model a E-R diagram for a particular requirement. It's really confusing.   Can anyone explain taking **Bus reservation System** as an example? Here is the model I made (But I am not confident with it because at every step, I could think of many more alternatives!) - > Entity_Set **Passenger** (passengerID,name,age,gender) > > Entity_Set **Ticket** (ticketID,status) > > //Status is either _WaitingList_ , _Confirmed_ or _Cancelled_ > > Entity_Set **Bus** (busID,MaxSeats,Type) > > //Type is Ac or Non-AC > > Entity_Set **Route** (routeID,ArrivalTime,DepartureTime,Source,Destination) And a Ternary relationship between **Passenger** , **Ticket** and **Bus** with attributes as passengerID, ticketID, busID .   Binary relationship between **Bus** and **Route** with attributes as busID, routeID . I have few doubts regarding -   1 . Should we take Time as a composite attribute with Arrival and Departure as its attributes (What's the difference if we take that way?)   2 . The same with Source and Destination. Should they be made into a composite attribute "Place" or something like "Location"?   3\. Are there any weak entity sets here? I have no idea at all what to take as a Weak entity set?


C# return variables

In a debate regarding return variables, some members of the team prefer a method to return the result directly to the caller, whereas others prefer to declare a return variable that is then returned to the caller (see code examples below) The argument for the latter is that it allows a developer that is debugging the code to find the return value of the method before it returns to the caller thereby making the code easier to understand: This is especially true where method calls are daisy-chained. Are there any guidelines as to which is the most efficient and/or are there any other reasons why we should adopt one style over another? Thanks                   private bool Is2(int a)         {             return a == 2;         }              private bool Is3(int a)         {             var result = a == 3;             return result;         }


Why isn't literate programming mainstream?

Literate programming has good ideals. Why do you think that this isn't mainstream? It is because it has failed to deliver?


Measure of power other than Turing completeness

I originally tried asking this on StackOverflow, but it was too subjective :-(. I am interested in methods of defining the power of programming languages. Turing completeness is one, but it is almost universally satisfied. What would be nice is to define a measure of power that discriminates among programming languages that are actually in used. For example, can anyone propose a non-subjective method that would discriminate between assembly and Java? Turing completeness means that a language is maximally powerful in what it can output (which pretty much means it can do anything non-time based in the real world). So if we want to define a stronger measure of power, we need to take another approach. Shortness was suggested in the original question, but this is not easy to define at all. Does anyone have any other suggestions?


Client side web application architecture - best practice & patterns

I'm inheriting some code that takes a rather different approach to architecture than I'd have chosen myself. It consists of a HTML page, some javascript library imports and a single DIV tag. This DIV is populated entirely by handcrafted JQuery based javascript. My normal approach would be to scaffold the presentation part of the app using HTML and handle the interaction using javascript (or use templating), rather than build the entire DOM from scratch. I don't think there's anything inherently wrong with the way it's been tackled so far other than it makes picking apart the logic and the structure a bit of a pain in the a*se. For info, the app queries a SOLR endpoint for some odd looking stats data, displays this in tabbed tables, allows the user to facet their search, explore different categories of stats and dig down, etc etc. My question is around best practice here. Is there any best practice around this kind of thing? Are there design patterns and if so, what are they? I realise this could be considered opinion based, so I'm looking for formal approaches and examples in the wild rather than opinions. EDIT in response to the possible dupe: This isn't about a huge horrible mess, just about different approaches to client side architecture. It's not so much how to refactor (I've done enough work with legacy java web applications to know how horrible that can be) it's more what a client side java application should look like post-refactoring.


algorithmic problem - Combining overlapping ranges

I'm looking for an idea to efficiently solve following problem: I have a set of pairs of ranges (range = a pair of numbers), each range is unique (but has same size) e.g.               [      [(0,6),(34,40)],      [(1,7),(35,41)],      [(3,9),(12,18)],      [(2,8),(36,42)],      [(13,19),(22,28)],      [(23,29),(14,20)]        ]      Now I'd like to combine pairs of ranges, if ranges are overlapping e.g.               [(0,6),(34,40)] overlaps with [(1,7),(35,41)] -result-> [(0,7),(34,41)]      So as a result for above set I'd like to get (now each pair may have ranges of different size)               [      [(0,8),(34,42)],      [(3,9),(12,18)],      [(13,20),(22,29)]     ]      The set might be pretty big, I'd like to avoid quadratic complexity if possible. **EDIT:** My best idea so far (in Python) is below. I'd like to know if you know a better(faster) way. Also I'm not sure if my idea of removing already combined pairs is valid:               def ranges_overlap(range1, range2):         return range1[0] < range2[1] and range2[0] < range1[1]               def combine_pairs(pair1, pair2):         return [(min(r1[0], r2[0]), max(r1[1], r2[1])) for r1, r2 in zip(pair1, pair2)]               def combine_overlapping_pairs(pairs):         combined = []         while pairs:             pair1 = pairs.pop()             already_combined = []             for pair2 in pairs:                 for pair2_perm in itertools.permutations(pair2):                     does_overlap = True                     for range1, range2 in zip(pair1, pair2_perm):                         if not ranges_overlap(range1, range2):                             does_overlap = False                             break                          if does_overlap:                         pair1 = combine_pairs(pair1, pair2_perm)                         already_combined.append(pair2)                         break                  combined.append(pair1)             # Not sure if I can do that             for pair in already_combined:                 pairs.remove(pair)              return combined


What are the common mistakes in 'tailored Scrum approaches'?

I have seen this before. Management wants to be agile and be scrummified, but does not want to step out of the status quo. My latest observation is no different; here, the Scrum is 'tailored' to the organization; specifically into a weird many-people-process. ![Here](http://img684.imageshack.us/img684/6175/modifiedscrum.jpg)   **The diagram showing the different participants.** I am putting together a document listing why this will not work. Here are the obvious ones:   1\. There are _product owner agents_ (an obvious WTF), who report to the _product owner_ : causing dilution of decision making capability   2\. There is a role that looks similar to a manager in the traditional approach - _development manager_ : an obvious attempt at command-and-control model   3\. The _ScrumMaster_ 's role includes collecting _timesheets_ , which are used to track progress instead of _burndown charts_ : detrimental to agile's efforts to build teams with motivated individuals Leaving the question "how would you convince the management?", my question is more at, "what else do you see as failures in this/similar 'tailored Scrum approaches'? **EDIT** : The diagram might use a few more details   1\. The _development manager_ is not part of the development team, with not very clearly defined responsibilities, except: developer performance assessemnt, recruitment, etc.,   2\. There are more than two teams (with ScrumMaster+development manager+dev team) with the same product owner for all teams!


"Dedication of the Harvard Mark I computer, 1944 August 7"- Which text is Brooks referring to and where can I find it?

I am reading the epilogue of the _Anniversary Edition_ of the _Mythical Man Month_. The author, Frederic Brooks, says > Still vivid in my mind is the wonder and delight with which I - then 13 > years old - read the account of the August 7, 1944, dedication of the > Harvard Mark I computer... Which text is he referring to? I want to be filled with wonder and delight too. Where can get hold of this text so that I can read it too?


How to authenticate user on php and Node.js

I´m currently developing a little chat page. The main page and user management is written in php and also all the authentication stuff with sessions. Now I´m planning to run the messaging stuff on a separate Node.js server, so that I don´t have to use polling on client side. How can I now use the session to authenticate a user also on Node.js to prevent s.o. passing messages in the name of someone else to the messaging server? My idea was to generate a key on php side, pass it to the Node.js and also to the client. If the user sends a message, I would pass the key to the Node.js and compare it with the key I´ve send from the webserver. Is this a good approach? Which alternatives do I have?


Terminalogy "Controller" in MVC and "ViewController" in IOS

While studying IOS, i generally come across viewcontroller. That gives me, confusion, if this "ViewController" has to do something with controller ( in MVC ) ? But how come both "view" and "controller" are combined in this terminology. What does it actually mean ?


MVC framework seems to suggest creating possibly hundreds of .aspx or .cshtml pages. How do I avoid this?

So, I was playing around with MVC3. Correct me if I'm wrong but based on all examples I've seen, it is suggested that you pretty much have a page for every model and Action from the Controller. So for example create a pretty basic management portal for the aspnetdb database. **Models** UserModel   RoleModel **Actions** CreateUserAction   DeleteUserAction   ChangeUserAction   CreateRoleAction   DeleteRoleAction   UpdateRoleAction   AssignUserToRoleAction   AssignUsersToRoleAction   AssignUserToRoleAction   AssignUsersToRolesAction   DeleteUsersFromRoleAction   etc... **Pages** CreateUser.aspx or .cshtml   DeleteUser.aspx or .cshtml   ChangeUser.aspx or .cshtml   CreateRole.aspx or .cshtml   DeleteRole.aspx or .cshtml   UpdateRole.aspx or .cshtml   AssignUserToRole.aspx or .cshtml   AssignUsersToRole.aspx or .cshtml   AssignUserToRole.aspx or .cshtml   AssignUsersToRoles.aspx or .cshtml   DeleteUsersFromRole.aspx or .cshtml


Career guidance books for programmers

I am currently reading the recently published Being Geek by Michael "Rands" Lopp and I can't get enough of it. ![alt text](http://i.stack.imgur.com/rb36p.jpg) Is there any other career guidance books aimed directly or indirectly at programmers that are worth reading?


Social Analytics in your current data

By now everyone is aware of the massive boom in social-networking (Twitter, Facebook, LinkedIn) and obviously a big part of its business model revolves around being able to mine this data to create information that can be used to make money for someone. Gartner has identified 'Social Analytics' as one of the top 10 strategic technologies for 2011.   * **Has anyone looked at their existing data structures to determine if they could extract a social graph and then perform further data mining against this?**   * **How does it fit in with your other strategic development strategies?**   * **What information are you trying to extract from the data?** Take for example, a bank. They could conceivably determine a social graph through account relationships and transactions. Obviously there would be open edges on the graph where funds enter/leave the institute, but that shouldn't detract from the usefulness of the data. **I'm looking for actual examples with the answers, as well as why/how they did it. References to other sites will be greatly appreciated.** _Note: I'm not at all referring to mining data out of actual social networks._


What's your reason to learn Clojure?

I got a personal question for you guys out there: what's your reason for learning Clojure ? (For me, it's the same thing as it was with Java over C, it promises a better programming experience)


How to get audio spectrum analysis?

I need to find or create a tool that analyzes the audio spectrum of a sound file (like a .wav or .mp3). I need to output the "volume" or power of x number of frequency bands and output the data as text. This will be used to produce a visualization, a graphic equalizer like you'd see on a stereo. I am currently looking at python to do it. My question is are there some tools out there that would do this (signal processing), like math works or others? I don't have any experience with them so any advice would be appreciated.


Model-View-Controller (MVC) Which component handles save/load operations?

In a traditional MVC application, which component (model, view, or controller) is responsible for reading/writing the model to/from disk?


How can I make sure that people changes his IP or not

I want to check that people who registrates in my site and check in country box , for example, Argentina is really living in Argentina. How can I make sure that people is really living in that country and not access to my site via proxy or VPN?


What kind of copyright laws should I be aware of when creating software?

I'm trying to build a winform so I can play a web based game and have some other little utilities on the side. I do not plan on ever selling this or even distributing it to more than a handful of people. My question is, Would I be infringing on any copyright laws if I use images from the game in my client? I just want to be safe on the off chance the company does see it, I don't want to get sued. Edit: I took a screenshot from the game and cropped out the icons for each skill that I will use as a link to skill guides, calculators, etc. Also, I should note that I live in America and the company is based in the UK. I don't know if that affects anything or not.


Are RIA plugins a thing of the past?

In the not-so-distant past our department was touting Silverlight as the de facto standard for corporate intranet applications. A robust framework that allowed us to implement SOA while leveraging our experience in the .NET framework coupled with a rich user interface, all was great, until one day... Today HTML5 and advanced JavaScript libraries dominate the conversations of web application architects and developers, largely due to the cross device solution these technologies provide in the realm of mobile application development. We're living in a unique time in history right now where the capabilities of standard web development technologies (HTML5, CSS3, SVG, etc) have virtually caught up with those of proprietary plugins such as Silverlight and Flash. However, knowing how many years it took the W3C and WHATWG to get the latest version of HTML approved, can we really expect standard web development technologies to be robust and powerful enough to support the incredibly advanced and rich applications and user experiences that tomorrow's user is going to come to expect? Moreover, as processing power continues to increase and devices become more and more capable, will HTML and JavaScript be enough to deliver the goods and fully leverage the power of the next decades super devices and technologies (think holographic projections, social-commercial- industrial ubiquity, etc). Now don't get me wrong, I LOVE HTML5 and our team is doing some truly amazing things with jquery, knockout, underscore and jasmine. I'm very excited for the recent advances in the standard web development technologies and I fully embrace them. They're very powerful, cross device compatible, and fun! Is the death of RIA plugins inevitable?


Is jQuery an example of "god object" antipattern?

I want to ask – I am slowly learning jQuery. What I see is an **_exact example_** of a God Object anti-pattern. Basically, everything goes to the `$` function, whatever it is. Am I right and is jQuery really an example of this anti-pattern?


How QT Framework handles Events Coming from OS?

When we call QApplication::exec() at the end of our main() function, the application enters Qt's event loop. Conceptually, the event loop looks like this:                  while (!exit_was_called) {         while (!posted_event_queue_is_empty) {             process_next_posted_event();         }         while (!spontaneous_event_queue_is_empty) {             process_next_spontaneous_event();         }         while (!posted_event_queue_is_empty) {             process_next_posted_event();         }     }      First, the event loop processes any posted events until the queue is empty. Then, it processes the spontaneous events until there are none left. Finally, it processes any posted events that were generated during the processing of the spontaneous events. So A single thread (main() thread in Single threaded GUI application) can not handle program as well as Event loop(With Event Queue functionality). Is there any threads other than main created for handling Events in QT?


Which job should I choose

I have a two job offers currently one from a upcoming funded start up (I) and other from one of a large established software giant (A) I is paying me less than A but I has potential to pay me better as they are really well funded . What should I do


Maintaining C/C++/Java skills as a web developer

When I was in college I learned how to program in C, C++, and Java. Currently, I'm a web developer using front end and back end technologies (HTML/CSS/JS, PHP, MYSQL). While the sorting algorithms and OOP concepts that I learned in college can be applied to web development, I'm looking for ways to keep up my knowledge of all languages. I enjoy programming in C-Style (C/C++/Java) languages and front-end/back-end technologies. Unfortunately, there aren't many options to use C-style languages to build websites. However, I would like to keep up my knowledge and skills in the languages I learned in college as I know they will continue to help me with my growth. What resources are available to keep challenging myself in C-style languages that are relevant to web development? Would contract work for C-style languages be beneficial? Are there sites that offer algorithm challenges? Any help is appreciated. I'm also interested in how others that have asked themselves this have solved this problem.


Branching and CI Builds with Agile

We follow many agile processes, including automated tests, continuous integration, sprint reviews, etc... We're currently having a debate about how often we should branch release builds. We've been doing two-week sprints and trying to deploy to production at the end of each sprint. Some of us think we should be branching every sprint. Some of us think that's overkill. If a project encompasses three Visual Studio solutions, and we branch every sprint, then that's three branches, and three CI builds to create every two weeks. If we do this for six months, we'll end up with 36 branches and 36 CI builds. There is overhead involved in that. For those of us that think that branching every sprint is overkill, we don't have a very good alternative. On my last project, we deployed some solutions from the Main trunk. Yeah, that's not good, but it saved on some of the overhead. What's the right way to manage branching/releasing and CI builds, using agile, when we have such short (two-week) sprint cycles?


Compiler Jobs - How Much Education Is Needed

I was motivated by the Compiler Construction As A Subject question and thought I would ask this one. I have heard from a few people that they have a good "compiler team" (don't ask where I heard it, I can't remember), so that led me to wonder, how does one get a job on such a team? I know there are classes at in the Undergrad programs and such, but is that something that a graduate degree would be the minimum (such as a Masters at the least)? I am starting my Masters in Computer Science in two months and the school I am going to has two compiler classes, would that be enough to get a job doing compiler development or would more time need to be invested in it?


How is the development of languages like Python and Perl funded?

The title pretty much gives you the gist of the question, but allow me elaborate a bit nevertheless. Apart from Google's involvement on Python, and Activestate's on Perl development (Strawberry AFAIK doesn't make any money on its own product) I'm interested in what are the major sources of funding of such. Are there any texts that cover this? I tried searching, but found nothing apart from the "history of" and "it's opensource, everyone gives in" ...


Why C# doesn’t support multiple inheritance?

Even if it could be bad practices, I would say that there is time that it would fulfill its purpose.


What do you call different user roles in software design?

I'm just curious, I'm building a web app with a User model which has role- based permissions. I have the following roles:   * Visitor (anonymous user)   * ?? (logged-in user)   * Moderator   * Admin I'm having a hard time figuring out what to call a logged-in user. I want to just call them "users", but I find that having a role with the same name as the class creates confusing code sometimes. For instance: `if user.user? then...` If you've built software with roles for users, what do you call the basic, registered, no special permissions, user role? _EDIT:_ As a side consideration, this app has Subscribers and Non Subscribers. Whether or not a user is a subscriber is not the same as their role, but it affects the way I've been thinking about this. For instance, calling a regular user a "member" sounds a lot like what I would call a subscriber, so I haven't been too fond of that. I haven't ruled it out though.


Explanation of the definition of interface inheritance as described in GoF book

I am reading the first chapter of the Gof book. Section 1.6 discusses about class vs interface inheritance: **Class versus Interface Inheritance** > It's important to understand the difference between an object's class and > its type. An object's class defines how the object is implemented.The class > defines the object's internal state and the implementation of its > operations.In contrast,an object's type only refers to its interface--the > set of requests on which it can respond. An object can have many types, and > objects of different classes can have the same type. > > Of course, there's a close relationship between class and type. Because a > class defines the operations an object can perform, it also defines the > object's type . When we say that an object is an instance of a class, we > imply that the object supports the interface defined by the class. > > Languages like c++ and Eiffel use classes to specify both an object's type > and its implementation. Smalltalk programs do not declare the types of > variables; consequently,the compiler does not check that the types of > objects assigned to a variable are subtypes of the variable's type. Sending > a message requires checking that the class of the receiver implements the > message, but it doesn't require checking that the receiver is an instance of > a particular class. > > It's also important to understand the difference between class inheritance > and interface inheritance (or subtyping). Class inheritance defines an > object's implementation in terms of another object's implementation. In > short, it's a mechanism for code and representation sharing. In > contrast,interface inheritance(or subtyping) describes when an object can be > used in place of another. I am familiar with the Java and JavaScript programming language and not really familiar with either C++ or Smalltalk or Eiffel as mentioned here. So I am trying to map the concepts discussed here to Java's way of doing classes, inheritance and interfaces. This is how I think of of these concepts in Java: In Java a class is always a blueprint for the objects it produces and what interface(as in "set of all possible requests that the object can respond to") an object of that class possess is defined during compilation stage only because the class of the object would have implemented those interfaces. The requests that an object of that class can respond to is the set of all the methods that are in the class(including those implemented for the interfaces that this class implements). My specific questions are:   1. Am I right in saying that Java's way is more similar to C++ as described in the third paragraph.    2. I do not understand what is meant by _interface inheritance_ in the last paragraph. In Java interface inheritance is one interface extending from another interface. But I think the word _interface_ has some other overloaded meaning here. Can some one provide an example in Java of what is meant by interface inheritance here so that I understand it better?


Wikipedia confusion about ExtJS

I'm looking at the wiki on ExtJS, the wiki on List of rich Internet application frameworks, and the wiki on Comparison of web application frameworks. I'm confused. The first line of the ExtJS wiki page says: > Ext JS is a pure JavaScript application framework for building interactive > web applications[1] using techniques such as Ajax, DHTML and DOM scripting. So I assume it's a web app framework. But in the right hand side summary box it says: > Type: JavaScript library Is ExtJS a web app framework or a Javascript library or both? (Can it be both?) ExtJS is also missing from the web app framework lists...       Thanks for reading