instruction
stringlengths
34
19.9k
Are there any serious studies on how well an experienced programmer who knows language X can understand code written by a competent programmer using language Y, for a good range of widely used languages as X and Y? Of course the real world isn't so simple as a programmers knows just one language. What we'd like to kno...
What exactly does the "Model" part mean? Is it the same as the domain model? I've read that it's a map, but I'm having a hard time understanding the concept.
I am asking this from a purely hypothetical standpoint. According to the Sprint Planning Meeting section in the Scrum Guide: "The number of items selected from the Product Backlog for the Sprint is solely up to the Development Team. Only the Development Team can assess what it can accomplish over the upcoming Sprint."...
I recently upgraded versions of pylint, a popular Python style-checker. It has gone ballistic throughout my code, pointing out places where I import modules in the same package, without specifying the full package path. The new error message is W0403. W0403: Relative import %r, should be %r Used when an import rela...
Let's say we want to analyze running time of algorithms. Sometimes we say that we want to find the running time of an algorithm when the input size is n and for the worst possible case it is denote it by O(n). Sometimes though I see books/papers saying that we need to find the expected time of an algorithm. Also someti...
I am about to undertake a project for university, and given the project scope I have decided to use XP/agile methodology. I have began with developing a use case diagram; gathering user stories for the first couple features. I am in the process of helping the customer develop the acceptance test and my question is: ca...
Some time ago I was to learn iOS development at my work. I didn't manage to learn it because I was moved to more important task with another technology already familiar to me. But the short time I spent on iOS, I felt that I could do better if I spent a few hours at the workplace during which I could discuss some matt...
I was reading this question over on stackoverflow: https://stackoverflow.com/questions/104516/calling-php-functions-within-heredoc-strings and the accepted answer says to do plain PHP templates like this: template.php: <html> <head> <title><?=$title?></title> </head> <body> <?=getContent()?>...
Is it acceptable to distribute unmodified BSD-licensed software (pyglet) with GPL-licensed software I created? The BSD allows for sale of modified software, I know, but does it allow re-licensing of unmodified? Seems to defeat the purpose of having a license at all.
I have a simple question, and I'm not even sure it has an answer but let's try. I'm coding in C++, and using dependancy injection to avoid global state. This works quite well, and I don't run in unexpected/undefined behaviours very often. However I realise that, as my project grows I'm writing a lot of code which I c...
Just wondering on the pros and cons on TDD/automated unit testing and looking for the community's view on whether it's acceptable for professional developers to write applications without supporting unit tests?
I am working with data feeds from affiliate sites. The basic idea is to provide an interface where the user can paste a link to an XML datafeed (these are huge btw, around 60 mb) that would then be streamed, parsed into small chunks, and mined for the required data which would then be stored in the database. The proble...
Everyone knows that, at least in C, you use the printf family of functions to print a formatted string. And these functions use a percent sign (%) to indicate the beginning of a format specifier. For example, %d means to print an int, and %u means to print an unsigned int. If you're unfamiliar with how the printf funct...
I program mostly in statically typed languages, like C++ and Java. A common strategy employed in languages like these to handle dealing with collections of objects which are related, but which need to employ specific behaviors, is to use polymorphism and inheritance hierarchies. But Polymorphism only works when the B...
I am a relatively new developer in a small business (a team of 3 developers and an equally small QA branch) working on a medium-sized system. The current iteration is still under 100k lines of code (server & client combined), but I could imagine that, in the long term, the total size could be 200 kLOC or more. We are...
We have a central Git repo from which developers fetch and push changes. They make changes on the default master branch. Our Continuous Integration (CI) tool builds artifacts off this default master branch and is the entity responsible for promoting something we want to be tested to a "UAT" branch (this is in reality d...
In the Gang of Four's "Memento" design pattern, the Memento class looks like a useless wrapper that doesn't actually provide any value to me. What is it for? Is there any reason you can't just pass around the String object (in the Wikipedia example)?
Design patterns are useful for object oriented languages. But how can a non-object-oriented language such as C make of use them?
Context: We have an ASP.NET MVC3 codebase, hosted on CodePlex, currently in the "setup period". This codebase uses several NuGet packages (without changes or additions to the source, just "using" the packages directly), amongst others: jQuery (MIT or GPL) Modernizr (MIT or BSD) log4net (Apache License, version 2.0) Ni...
I am writing a shell script with a few variables that should be configured by the user. There will be an installer for downloading and configuring the script, possibly by asking a series of question. The script in question is aimed at other developers. This can be implemented in a number of ways: Use placeholders in t...
We have a project where UI code will be developed by the same team but in a different language (Python/Django) from the services layer (REST/Java). The code for each layer exits in different code repositories and which can follow different release cycles. I'm trying to come up with a process that will prevent/reduce br...
The Mars Curiosity rover has landed successfully, and one of the promo videos "7 minutes of terror" brags about there being 500,000 lines of code. It's a complicated problem, no doubt. But that is a lot of code, surely there was a pretty big programming effort behind it. Does anyone know anything about this project? I ...
Sometimes I use plugins and 3rd party libraries, and one thing that drives me crazy is when these libraries are not versioned. So, if I download it, make some mods to it, I am the only person in the world who can benefit from it... well, until I version it myself. My question is simple: if a library I find online has ...
I am using MPMoviePlayerController in a project. The loadState of the MPMoviePlayerController object is observed using NSNotificationCenter. Why did Apple choose NSNotificationCenter in this situation instead of using delegation?
We have a legacy system to bring up-to-date because: It uses an unpopular (amoung our users) non-sql database (Btrieve) Provides only a text interface Is written in Turbo Pascal (but compiled in free pascal) which is hard to recruit/retain developers to maintain it To give you an idea of the scale, the code base is 1...
Possible Duplicate: What is the Mars Curiosity Rover's software built in? I only recently came across an article that stated there was well over 500,000 lines of code in Curiosity and I was very much intrigued; which language did NASA use and what computer and CPU architecture has Curiosity got on-board; would they ...
Developing database-backed software, often one finds it convenient to store stuff in the database which one might traditionally express in code, but which is useful to store in the database (so that it can be changed without requiring a reload of the application). For instance, one might have processes which send autom...
When it comes to non memory managed languages such as C, C++ or Fortran (my case), it becomes increasingly difficult to keep track of memory allocation/deallocation, especially when ownership must be shared. I implemented refcounting for my objects, but this makes it even more complicated as there's no place where an o...
We are practicing collective code ownership. To my understanding this means that any developer can change any line of code to add functionality, to refactor, fix bugs or improve designs. But what about a complete rewriting of code from a developer who is still in the team? Should I ask him first? What is the best pract...
Short summary as introduction: We are a small Java web development team, creating applications using various frameworks and libraries like JSF, Hibernate, Seam, all together deployed in JBoss AS. Initially, the app was put together and some features added to form a showcase to show to potential customers. Some polishi...
Some JVMs would compile Java byte code into native machine code. We know that there are lots of optimizations we could apply for that. Recently, I also learn that a branch operation may block the CPU and affect the performance significantly, if a CPU makes a wrong prediction. Does anyone know if any JVM would generate...
I have created a scenario in which I have two functions, A and B, both are tested, but despite the tests I still injected a rather stupid bug and some data is not getting into the database. Note that there is no ORM present. I've written my CRUD operations directly, and I'm paying the price therefor. In this scenario...
Situation: I've some scripts that simulate user-activity on desktop. Therefore I've defined a few cases (workflows) and implemented them in Python. I've also written some classes for interacting with the users' software (e.g. web browser etc.). Problem: I'm a total beginner in software design / architecture (coding isn...
In podcast 73, Joel Spolsky and Jeff Atwood discuss, among other subjects, "five things everyone should hate about their favorite programming language": If you’re happy with your current tool chain, then there’s no reason you need to switch. However, if you can’t list five things you hate about your favorite programmi...
I am building a tool to access some data on a site (Fitocracy) and I would like to turn it into an unofficial partial API, as no official API exists. If you are not logged in, you cannot get access to any data, so my tool uses Ruby's mechanize to log in (with my account) and scrape some data from a page. How should I h...
In extreme programming methodology, what artifacts/ can be used to document the implementation? I have used an activity diagram to document the design steps for each activity. I have read that for XP, the implementation chapter is the code itself. I am developing an android application which consists of the GUI and jav...
As a fresh programmer, one of the first thing for me to learn was to learn language and its syntax. Now my next training issue is to design my code heirarchy in such a way it is simple to maintain over time. One example I just encountered is below. It is in VBA for Excel but the concept extends to other languages too. ...
I was going through "Object Oriented Modelling and Design" by James Rumbaugh et al and it said that in languages where multiple inheritance is not supported like Java three mechanisms can be used as workarounds Delegation using aggregation of roles Inherit the most important class and delegate the rest Nested General...
The Wikipedia article on Parrot VM includes this unreferenced claim: Core committers take turns producing releases in a revolving schedule, where no single committer is responsible for multiple releases in a row. This practice has improved the project's velocity and stability. Parrot's Release Manager role documenta...
I have a table with username and passwords that I want to input in Hotmail's username and password box. Is there a way to actually program this? Are you allowed to manipulate text boxes of someone else's webpage? Not for illegal purposes, just to make my job easier and to not have to input values manually one by one. H...
Am I within my rights to write and distribute software in compiled and source form using, in part, Microsoft's Visual Basic 2010 Express Edition? I have only the free, express version. If it has anything to do with this, the license I am using is the CC BY-NC-SA 3.0 license.
There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as: data ConsList a = Empty | ConsCell a (ConsList a) consmap f Empty = Empty consmap f (ConsCell a b) = ConsCell (f a) (consmap f b) l = ConsCell 1 (ConsCell 2 (ConsCell 3 Empty)...
There are several design patterns like Adaptor, Iterator implemented in STL. Does that mean STL is implemented with OO concepts? What is the relationship between OO and template parts of C++? I learned that virtual member function which justifys the OO is contradict with template, is this correct?
Isn't the whole point of an interface that multiple classes adhere to a set of rules and implementations?
I mean what are some of the ways other programmers deal with exception for example, when an error occurs when accessing a web service for say. If an example cant be given for windows phone, give the closest you could.
With iOS and Android soaring on mobile devices that become ever more pervasive, every other year being the 'year of Linux on the desktop' - which is somewhat snarky, but they are getting there -, OSX still holding its own, the time when one could simply say "it runs on Windows, and if you're not using Windows, well, su...
Wikipedia has a list of colors that I am using for a basis of color names. I want to find the nearest named color given an arbitrary RGB value. For example #5D8AA8 hex triplet is "Air Force Blue". This information will be stored in a database table (tbl_Color (HexTriplet,ColorName)) in my system Suppose I created a co...
I am reading 'The Standard C Library' by PJ Plauger which is really interesting. The book explains not only how to USE the library but also how it is implemented. I have finished reading the ctype.h section and in the header the functions are declared as both macros AND functions. For example int isdigit(int); but al...
Trying to seek design suggestion on a schema based request object for a CXF endpoint. I've created a CXF SOAP endpoint which takes the following object as an input. The request object will have required fields, non-mandatory fields as well as user-defined fields.Required fields are enforced through the schema. The tag ...
I would like to know what's the logic for setting the versions in an application that you're developing? I mean from 1.0 to 1.1 or 1.7 to 2.0
int i = 2*5/2; int j = 2*(5/2); printf("%d\n,%d\n",i,j); Variable Associativity: when I run this program, the first statement gives me i = 4; Shouldn't it give me 2, because according to BODMAS rule / is evaluated before *, so the variable should have been evaluated as (5/2)=2 and then 2*2=4? I know this is a noob ...
I think this is best described using an image. So it dawned on me that perhaps this isn't the best or most logical way to organise files. The way it is currently, as you can see is just a dumping ground. The only reason complexify has it's own folder is that it's a submodule in Git. So should I be using a /lib fold...
Possible Duplicate: What is enterprise software, exactly? What does “enterprise” means in relation to software architecture? What makes a component or product "enterprise" software vs non-enterprise ready? Is it difficult to use? Is it support contacts? Is it reputation? Is it a level of testing? Is it integration su...
Is it possible to force git to only merge remote tracking branches into the corresponding local branch? E.g. assume origin/X tracks X on origin and corresponds to local X and the same for origin/Y and Y. I want to prevent users to do git checkout Y; git merge origin/X. Is it possible? How? Edit: To make it clear: The w...
I'm not sure if "Ranged Foreign Key Relationship" is an actual term or if I just made it up, but this is what I am talking about: AgeGroup Table int MinAge { get; set; } int MaxAge { get; set; } string Description { get; set; } Customer Table public int CustomerID { get; set; } public string Name { get; set; }` public...
As x86 computers shifted from 32-bit to 64-bit, they also shifted from using 8259-style Programmable Interrupt Controllers with 8 interrupt lines. (Or two multiplexed PICs for a total of 15 interrupt lines.) Then, if you were to install 32-bit Windows for an operating system, Windows would implement 32 software IRQLs ...
For NASA's Interplanetary Network, what does a packet look like? It's obviously a form of redundant protocol, stored at the receiver and with built back up. Is there any documentation on the packet structure or the communication protocol, which has to span 14 minute communications?
I work for an IT company as a developer. We are currently working on a large software project, a multi-vendor automatic database clustering solution. We've upheld good coding standards and as a result our code is highly modular and reusable. Many of the modules we've developed could be of great benefit to the open-sour...
If you have a class which inherits from two distinct classes, does not this mean that your subclass automatically does (at least) 2 things, one from each superclass? I believe there is no difference if you have multiple interface inheritance. To be clear, I believe that if subclassing multiple classes violates SRP, the...
Microsoft (chiefly, Herb Sutter) recommends when using WinRT with C++/CX to keep WinRT at the boundaries of the application and keep the core of the application written in standard ISO C++. I've been writing an application which I would like to leave portable, so my core functionality was written in standard C++, and ...
I had a few days ago. I was having trouble with threads. Had lots of questions asked on StackOverflow and honestly for the first time I did not get the answer I was looking for. Finally, I decided to do a huge re-design of my system code and magically within a few hours I found a solution. So my question is, is it nor...
I'm confused about the nature of the jQuery project. It can be licensed under either the GPL or the MIT license, according to the comments in the project. However, the jQuery web site provides a list of team members, as if this were a commercial product. I have written some code to improve jQuery to work around a nas...
I constantly find myself thinking about code reuse when starting a new project. To what extent should I make my code reusable? Should I limit it to the application scope or should I make it reusable outside of the project? Sometimes, I feel like code reusability may stand in the way of a simple design. Please, share y...
Please stare at this structure for a second :) I should create such a thing all at run time. What are the values that we pass in at run time? the string values you see after "#" are passed in so for example AnimalBio, ClinBio, HumanGenome,etc... So I am thinking of declaring some methods like void AddDeclaration(stri...
A lot of my work is done with .csv extracts (reports) from databases. As I have been programming in Clojure, I've received comments that relying on vector indexes creates dependencies. I understand why, and concur. I am rewriting one of my programs to take advantage of the fact that each report's first row contain the...
In languages like c/c++ spacing and comments are ignored and only actual code gets into compiler. I'm interested if there is accepted way of naming these two things? comments & spacing everything else (actual code) Referring to comments & spacing as "comments & spacing" is quite annoying. Any ideas?
I, like many others, have been completely enamored with the recent successful landing of Mar's Curiosity rover. After reading a couple of articles, and following a few links, I've found a couple C based coding standards that NASA JPL uses to formalize their code and protect it from error. (See here and here.) This has...
I'm having trouble developing unit testing approaches to testing both if the "code does what I want it to do", and testing "does my code work". For example, I'm writing code to validate input that will be inserted into a database table, so I need to test if my code does what I want it to do - Good input is accepted, ba...
According to Herb Sutter one should prefer abstract interfaces (all pure virtual functions) to abstract classes in C++ to decouple the implementation as far as possible. While I personally find this rule very useful, I have recently joined a team with many Java programmers and in the Java code this guideline does not s...
Suppose I have a method public List<User> GetBatchOfUsers(IEnumerable<int> userIDs) { List<User> users = new List<User>(); // some database stuff return users; } I have read that it would be better to return an interface (either IList or IEnumerable) as opposed to returning a List. Some arguments I have...
I assume that my project is decoupled enough to allow for unit testing. But how big, exactly, in terms of clases and functions does my project need to be to make unit testing worthwhile? We all make mistakes and no one's perfect, but I consider myself a decent programmer to handle small projects' errors with stepping ...
So I'm reviewing a piece of code that is a perfect candidate to be abstracted away into a view helper. However at the moment, the piece of code uses two other view helpers to get the final display. Now my question is, if a new view helper is created, is it recommended to inject the two helpers being used already, into ...
I have been writing quite a lot of PHP for nearly two years. Now I am doing .NET (mainly c#) development. However, sometimes I go back and do some php. My main question is, is it wise for me to continue doing this or should I continue development in C#? Would this harm me in the long run (mind you my main goal is not t...
We're developping an application for 2D data processing and display. At the moment data is displayed by converting each point to a color depending on intensity, so in rather low level code. This works well. A new feature is displaying a grid and a bunch of lines that can be moved with the mouse on that image. As usual ...
I'm working for a client that has no version control system in place. I want to record changes to code without having to add all changes to a spreadsheet. I'm restricted to using Notepad++ so would a plugin or macro for this be another option?
When providing a business logic method to get a domain entity, should the parameter accept an object or an ID? For example, should we do this: public Foo GetItem(int id) {} or this: public Foo GetItem(Foo foo) {} I believe in passing objects around, in their entirety, but what about this case where we're getting an o...
I've created a pretty simple templating framework and have default implementations for some of my interfaces used for passing around information. I store these in MyFramework.Default namespace However, I am unsure of where to place example implementations, such as a template that creates a concrete class. This template...
Let's say I have artifacts "mylibrary-5.2.jar" and "mylibrary-5.3.jar" representing the 5.2 and 5.3 versions of a library that our project creates and publishes for one of our other projects. Does Artifactory support having multiple "versions" of each of these artifacts to represent the different builds that were perf...
I'm looking to create a comparison and ranking system which allows users to view 2 items, click on the one that they feel is the better one and then get presented with 2 more random items and continue to do this until they decide to stop. In the background, I want the system to use these wins and loses to rank each ite...
I would like to ask you, your opinion when it comes to implement a filtered search form. Let's imagine the following case: 1 Big table with lots of columns It might be important to say that this SQL Server You need to implement a form to search data in this table, and in this form you'll have several check boxes that...
I have pretty much completed work on a Winforms application, and would like to add a Help feature for users. I cannot send users to a website, and am thinking along the lines of the kind of help you get when you click on Help in IE (or hit F1). I believe this is compiled html or something, but am not sure what tools ...
I program in Java and it doesn't make sense to me to think about learning a Java library or a framework without knowing the actual language the thing is built with. Same goes for C. I always avoided JavaScript simply because I wasn't interested in the client side of things but that has changed now. I'm confused as to ...
I have an application built without any libraries using PHP, JavaScript, HTML5, CSS, and mySQL that will support major modern browsers - IE, Safari, FF, Opera, and Chrome. One thing I've noticed is that most web jobs 90%+ ask for library experience of some sort. About 10 % do not... they focus more on the language then...
I've been studying a bit of algorithms and have been looking at sites like SPOJ.pl TopCoder etc. I've seen that programmers prefer C or C++ usually for most algorithmic programming contests. Now I've been having some trouble lately. I know both a bit of C and Python and when trying to write a code I seem to prefer Pyt...
Imagine a discussion between four people - one a developer, one a manager, one a tester and one a deployment/operations type. The Manager is very angry as a system has fallen over after a new version of code was deployed into production. He is looking to point fingers. Operations person pleads ignorance - they followed...
I'm not a programmer by profession, but I do some coding and have used github some. I've run across what I find to be a surprising situation. I'm very familiar with git. There is a project which I found a (small) bug in that was affecting me. I spent an afternoon finding and fixing it. I forked the repository, comm...
I'm creating a project that I want to be able to distribute across platforms. I'm writing in Java and AWT which already gives me a pretty large range of devices, but I'm mostly interested in Windows and Linux (Debian/Ubuntu). I'm trying to determine where I should put config files. I have application-wide configuration...
I've been thinking for a while about defining several namespaces in one php file and so, having several classes inside this file. Suppose, I want to implement something like Doctrine\ORM\Query\Expr: Expr.php Expr |-- Andx.php |-- Base.php |-- Comparison.php |-- Composite.php |-- From.php |-- Func.php |-- GroupBy.php |-...
Our architecture consists of a front-end cache that most read only users obtain their data from directly. The front-end cache sits in front of a farm of webservers that serve pages written in PHP. We need to be able to detect certain conditions at the front-end cache level and pass those values through to the back-end ...
I am working on an application which spawns a new thread per request. Sometimes the number of threads active on the machine at one time is in the high hundreds. It's suspected that this is causing all sorts of problems. I would like to experiment with using thread pool instead to see if this improves work throughput. B...
The situation is this - we took an intern for a summer with a mind that if he will catch up during summer, we will keep him as a part time junior developer. We took him after his first year in university, so his knowledge was way too low to be involved into real projects(actually he programmed only in university), so m...
While I was programming in C++ some days ago, I made this mistake (that I have history of making it!). In one part of my code, I had 1/6 and I was expecting it be 0.16666666666 which is not the case. As you all know the result is 0 - C, C++, Java, Python, all behave the same. I post it on my Facebook page and now ther...
I know that Discrete Mathematics is a pretty broad topic that's used in a number of fields but I was just wondering what are some of the topics from it that you would expect an average computer science student to know? Here are the range of topics from the table of contents of a book titled "Discrete Mathematics and it...
I have a PHP app which is very large. There are usually 2-3 developers working on it full time and we are getting to the point where we are making changes and creating bugs (cough features!). The software isn't complex per say, just there is a lot going on (35~ controllers, about the same models, etc). Even being caref...
I suppose there's no straight answer to this, but what ideas come to mind for determining how much each programmer would get for participation in a collaborative project if it were to be sold?
Recently at my company we've had a bit of a debate about abstraction vs. simplicity. One school of thought I'd characterize as "DRY and abstraction can do no harm," and leads to code like this: def make_foo_binary(binaryName, objFiles, fooLibsToLinkAgainst) make_exe_task(binaryName, objFiles.ext('.o'), fooLibsToLi...
In Python luckily most of the times you don't have to write getters and setters to get access to class properties. That said sometimes you'll have to remember that a certain property is a list or whatnot and a property would save you there by abstracting the type and providing a setter to add something to such list for...
I am often asked to write a requirements document for a new piece of work. I write requirements using user stories. The list of requirements is then used as a contract with the client denoting the functionality that will be delivered. The temptation them becomes to add more and more detail and more and more stories in ...
Possible Duplicate: Best approach to learning web programming I am extremely interested in web development though I know very little about code. I did not read computer sciences in my college/university. Now I find myself very determined to learn the server side development and want to have a career in the field, wh...
Let's say I start and develop some project under open-source license, and accept some community contributions. How shaky is the ground I stand on if I decide to take the project commercial and closed-source (or split license)? This question doesn't directly address the issue of a project with community contributions, w...