instruction
stringlengths
34
19.9k
I just read the question what are callback frameworks?, where the asker cites the following from Effective Java: The disadvantages of wrapper classes are few. One caveat is that wrapper classes are not suited for use in callback frameworks, wherein objects pass selfreferences to other objects for subsequent invo...
For example, if the code generates a random int from 0-10, and takes a different branch on each outcome, how can one design a test suite to guarantee 100% statement coverage in such code? In Java, the code might be something like: int i = new Random().nextInt(10); switch(i) { //11 case statements }
I had been programming for many years but wanted a diploma to make myself more employable. Having already been through university once, I didn't choose a full 5 year computer science major but a shorter, more practically-oriented software engineering program. I expected that it might focus more on concrete skills than ...
In the movie theatre I go to they have ticket kiosks that allow you to select the seats you want; they also have a website that does the same (the website also has a countdown timer of like 30 secs in which you must choose a seat). While I understand things such as database transactions and other techniques for handli...
We are in the middle of a strange situation. We and a partner firm have to put up a web portal. They have a lot of functionality already done on their other portal and we are the managing firm on the project. But there are also some new development needed on their side which is designed by us. Strange thing is, we are ...
I have some instruments. Each instrument should have a name (string) and description (string). Each instrument can have some setups, which these setups are each a series of commands(string[] or List). I want this class to be flexible so I can easily add or remove a whole instrument, or add or remove setups for any ins...
I have created a desktop application(winfoms) using C#.net 3.5, the application is an SEO application, so it has to be connected to the internet, i implemented a simple licensing routine where every time the application is started it will query the web service on my server with the key and machine hash to validate. But...
I would probably consider it a code smell or even an anti-pattern to have a class that implements 23 interfaces. If it is indeed an anti-pattern, what would you call it? Or is it simply just not following the Single responsibility principle?
I do freelance web projects for a client. The client has been asking me to buy an iPad for testing purposes. Should I ask him to get me an iPad ? I otherwise don't have any need for the iPad. Is it ethical to ask for sponsorship when you are getting paid for the projects ? Should I try it out ?
When did these design patterns originate? Balking, Builder, Delegation, Facade, Memento. I have looked for days across the net, so if someone points me to a simple google search I may shoot myself. The real question I have is only which is the oldest and which is the youngest, so the specific dates for each are not imp...
In various languages (Java at least, think also C#?) you can do things like if( condition ) singleStatement; while( condition ) singleStatement; for( var; condition; increment ) singleStatement; So when I have just one statement, I don't need to add a new scope with { }. Why can't I do this with try-catc...
I need some advice to take the steps for TDD. How do we think in terms of interfaces for everything when we are writing code? Most of the testing books tell you how to write tests. But I want a book which tells whats the good way to write code in terms of TDD
I have a possible C# dev job lined up but before I can interview, I need to pass a test with the employment agency. Now even though I am a senior developer with over 10 years of programming experience and more than 3 of these years with c#, I am really not looking forward to this test and I think there is a good chanc...
I've been using Devise for a little while, and I've realized it's built on something else called Warden that handles authentication. What does Devise offer me outside of Warden, because I was considering removing devise and just using Warden.
First the history: I found out DateTime data types cannot be null (Yes they can be nullable using the ? nullable declaration). I was told this is because they are value types and placed on the stack (not on the heap). I can understand why the stack is quicker and why value types need to (mostly) be placed on the stac...
I'd admire the functions of sympy library, what it does is really awesome. The integration functions are really few guys intellectual work. But where exactly we use them practically on computers? If not sympy, do we really need such libraries? If we need them, what languages would satisfy our needs?
I've agreed to build an iPhone app for a client that was referred to me. I'm a full-time software engineer by day, but this is only my 2nd iPhone app and I agreed to do it without upfront funding as it would give me a project to further learn the API as well as increase my portfolio of iPhone apps. The client suggested...
The Actor concurrency model is clearly gaining favor. Is there a good book that presents the patterns and pitfalls of the model? I am thinking about something that would discuss, for instance, the problems of consistency and correctness in the context of hundreds or thousands of independent Actors. It would be okay if ...
I am a computer science student, and as a result, I was taught C++ as a better version of C with classes. I end up trying to reinvent the wheel whenever a solution to a complex problem is needed, only to find sometime after that, some language feature or some standard library routine could potentially have done that fo...
I am currently interested in job prospects outside of my own area of programming. Specifically, I'm a web developer but want to make the transition to desktop application programming. How should I tailor my resume to show that I am capable of this type of software development when I have had no prior experience with it...
Assume we have two projects and one or more teams (one team doing the projects in serial or two teams doing the projects in parallel). If Team A decides that a task is 8 story points and Team B decides that a task on their project is also 8 story points, does that say anything about the relationship between the two ta...
I'm interested in how browser layout engines like gecko, webkit and trident are architected from a high level. what are the key abstractions? how are they layered? what are the inputs/outputs for the different abstractions? Is there a diagram or article that explains this particularly well? I am sure the implementation...
If one views the CLR/.NET runtime and associated libraries as the future of windows, then the F# programming language could be seen in that light as the most native functional language. Meaning that it has support from the OS creator, presumably integrates best with their libraries, etc. Is there a similar logical cho...
So I have a couple of software/site in my portfolio. They make money but not a whole lot. So I decided to get some job experience, mainly applying to Java/PHP junior development positions. The problem is that I answer all the technical questions correctly and we schedule to do a coding "test", the final phase of the in...
Currently working on a complete front-end and back-end overhaul of our webapp. We did this because a lot of changes needed to be made to the database schema as well as the user experience. Now we are almost done with the overhaul and I'm thinking if we could have taken a more incremental approach? We started a new code...
In my team, people have tendency to develop a POC (which is very close to actual deliverable in terms of features) which takes good amount of time to be created. And then spend a significant time to refactor the POC so that it matches the design principles using all required design patterns, sometimes naming etc... On...
The guy who is in charge of our html emails is leaving and I have been asked to take over. We are an online retailer and send out an email once a week. An email will consist of a main image, a bit of an opening paragraph and then rows of product offers. As everyone knows html emails are painful to work with due to the ...
In the section When to Use Exception in The Pragmatic Programmer, the book writes that instead of: retcode = OK; if (socket.read(name) != OK) { retcode = BAD_READ; } else { processName(name); if (socket.read(address) != OK) { retcode = BAD_READ; } else { pro...
Let me demonstrate a simple example, Class Organization ID type Number, Name type String, HAS A -> Collection Class Facility ID type Number, Name type String, Location String , HAS A -> Organization I am demonstrating a simple circular reference between two objects of an anemic data model. Assuming they are...
I want to write an application that can be used to burn CDs (music). I know I should test it with real CDs anyway, but I don't want to do this every time I make a small change. But I do want to know and test if the right data will be burnt, so you don't get corrupted CDs. I am using a library which only exposes APIs to...
I am working on a PHP script that I plan to sell without giving the user the ability to distribute it to anyone else. I have heard about GPL being viral and I have quite a few libraries that are being used in my script that are under the GPL. (for example : jquery, phpthumb etc) Does this mean that if a user who has bo...
I'm developing a web application which I started on about 2 years ago. It is an AJAX-heavy single page design and prototype solved problems where I didn't want to reinvent the wheel. I am using a couple of third-party tools that depends on prototype, namely okonet modalbox, protofish tooltips, scriptaculous, My own use...
I have to design a database wherein I have to associate an audio_id with multiple tags(words). I am considering following approaches to select one from these: 1) To have multiple fields for multiple tags (columns: tag1, tag2, tag3.... tag10) corresponding to a single audio_id. The number of tags in my application will ...
I have an architectural question about a project that I am working on. Currently it is a simple .NET C# application that runs on several client machines, and communicates with a central MySQL server for data storage. There is not an application or service on the server at this time, just MySQL. I would like to add imag...
I am new to developing Chrome extensions and I used Stack Overflow to ask many questions and got great answers. I finally finished a beta version and uploaded it to Chrome store only for test users. Now I am not sure where to find test users so I decided to ask here. Is there a separate forum where people post their ap...
Among other things, .NET's Reactive Extensions simplify concurrency management. From what I've heard, .NET 4.5 will simplify concurrency management with things like the await keyword. My Question: Will .NET 4.5 make the Reactive Extensions obsolete? Or is Microsoft expected to pitch the .NET 4.5 additions as an altern...
For the bugs or issues, there are now many good issues trackers available which allows status and tracking issues and also allows you to organize it to manage specific releases. I am looking for test case tools should be able to support listing of functionality and test cases with possible linkage to them, allows test...
When QAs write automated selenium tests to test a multi-layered website (e.g. testing a web app which is on mvs design, spring and database) should the tests make use of existing classes and frameworks written by developers or should we write simplified classes to serve the test? The downside of relying of frameworks d...
I have built a few browser extensions that live in GMail. Since they are larger extensions, they incorporate jQuery 1.6.x. I am using jQuery as a content script which means it is injected into GMail then my scripts reference jQuery as they are loaded afterwards. I have found that when other extensions are installed al...
Subversion Re-education actually convinced me, but for now I'll stick to svn - mastering the use of a very popular tool can't be bad. To date I've not used branching/merges in production code, now I decided to give it a try in a small team environment. I'm afraid of suffering the same pain as the described in Spolsky's...
A lot of scripting languages like Perl, Awk, Bash, PHP, etc. use a $ sign before identifier names. I've tried to look up why but never had a satisfactory answer.
I work for a company where we build enterprise applications, and we maintain three environments: development (or dev), staging (or stage) and production (or prod). The meaning of dev is intuitive: it's the environment used during development of the application. What's the difference between staging and production envir...
I write enterprise Java applications and web services at work (Spring, Hibernate, Maven, RESTEasy) and PHP (CakePHP) and Python (Django) for my side projects. While I do see the value that Inversion of Control, Aspect Oriented Programming etc. that Spring brings in, I am not sure how massive web applications that are n...
A co-worker and myself have run into an issue that we have multiple opinions on. Currently we have a git repository that we are keeping all of our cronjobs in. There are about 20 crons and they are not really related except for the fact that they are all small python scripts and essential for some activity. We are us...
On the matter of Recursion: When you create a recursive function, you create a call stack. Ok, no problem; However, a comment on this page (look for comments by "LKM") triggered my curiosity (and google was no help): What is a local stack? Why would it be faster than a call stack? How would you actually implement it (...
I'm a java dev that is new to powershell. I know that it's built on the .Net Framework, but I don't have much knowledge with that framework. Is there a reference guide of some sort that shows what libraries are available in Powershell? I found a list of Powershell 2.0 commands, but I'm pretty lost as to what library...
I would really like to understand how an operating system works behind the scenes. However, I think that the kernel of most open-source OSs out there are too complex for learning purposes, even for a full-time programmer to learn. Are there any "simple" OSs made for learning purposes only out there?
If we refer to exceptions as bugs, why not just call it a bug in the first place instead of an exception? If in the code it's called exception and as soon as it occurs it's called a bug. Then why not call it a bug in the first place? Thank you for any answer or comment.
I recently forked a Git repository, and locally I created a project in my IDE to compile with. My IDE creates a variety of artifacts that I would like to keep saved somewhere. The obvious place would be in the VCS. If I add these files then they will be in the history for my fork. If i want send a pull request to merge...
I am a huge linux fan and have been ignoring .net, C#, and visual basic due to their relationship with Microsoft. Am I foredooming them just for their relationship? Is there any advantage to learning them, when you are mainly a linux user?
I'm considering using appledoc, a flavor of Doxygen for use in generating Objective-C code documentation, in order to create documentation for my company's iOS apps. The idea is that a server will generate the docs on a post-commit hook, then publish the documentation on an internal network. Right now we have very litt...
I am wondering if there are any benefits / risks of (not) putting a licence on test code which mostly consists of unit tests. What do you think? I am particularly interested in licensing under (L)GPL, Apache, MIT and BSD. EDIT: The assumption is that non-test code is already published under some licence, but test code ...
Feeling slightly witty the other day, I wrote an eachWithIndex: method in a NSArray category. It has a typedef like this: typedef void (^processItem)(id item, int index); and the method looks like this: - (void)eachWithIndex:(processItem)block { for (int i=0; i<self.count; i++) { id item = [self objectAtIn...
I have responsibility for a large Asp.Net based website. It is currently a website (not web application), some windows services and a number of class libraries. The data layer uses a mixture of LLBLGEN and Linq To LLBGen, as well as a number of instances of legacy inline SQL which have not been refactored. There are s...
During the course of writing the code guidelines for a company I found myself recommending using the Builder pattern from Effective Java, instead of telescopic constructors. However, after thinking about it a bit more, surely a more elegant solution is to just remove the builder class and the also remove the extra cons...
Some of my friends say that UNIX is beautiful and simple. But I really don't know what they mean. Why are they saying so? For me, UNIX is just a boring command prompt with different shells. How can I experience the beauty of UNIX? Can you share any experience?
My company is going to hire an external developer to write some simple PHP modules and some minor bugfixing in our software. We have never hired an external developer by the hour before. How can we measure external developer's productivity and coordinate with them? I thought about using a combination of http://worksna...
As server-side generated HTML is trivial (and it was the only way to make dynamic webpages before AJAX), server-side generated CSS is not. Actually, I've never seen it. There are CSS compilers, but they generate CSS files which can be used as static. Technically, it requires no special libraries, the HTML style tag sho...
Is it possible to develop one application that can be be run in both: metro and classic style in Windows 8? I mean, application with the same core and two separate UIs, adjusted to currently used mode.
Currently, I'm very comfortable with building tools/web apps in an ASP.NET environment. I'm not really looking to leave tbh, as I really like C#, ASP.NET, MVC 3, Visual Studio, etc. However, right now I know almost nothing about PHP and that seems like a deficiency that I'd like to rectify. Are there any books (or othe...
Possible Duplicate: Are design patterns really essential nowadays? Is it necessary have a knowledge and understanding of design patterns for someone to be a professional programmer? Why?
I am designing a game server which would be used for Android terminals. I've been searching for products or frameworks to use for two-way socket communication but haven't found anything worth mentioning. Simply, I want to implement the architecture below: In other words, one TCP connection from the client to the serve...
I have 30+ sources of data I scrape daily in various formats (xml, html, csv). Over the last three years Ive built 20 or so c# console applications that go out, download the data and re-format it into a database. But Im curious what other people are doing for this type of task. Are people building one tool that has a l...
I have some previous posts talking about how to use python to "do something" when a record is inserted or deleted into a postgres database. I finally decided on going with a message queue to handle the "jobs"(beanstalkd). I have everything setup and running with another python process that watches the queue and "does s...
Possible Duplicate: Etymology of “String” I was talking to my non-technical wife about my workday and she was confused as to why I was talking about strings. In her mind, a string is a piece of yarn or thread (I didn't tell her what I thought a thread was). So it got me wondering...why do we use the vernacular "Str...
Our development team is pretty new to the scrum process, so I would like to help refine our methods to make better use of it. In particular, I noticed that the correlation between story points and task hours is not very good. That is, we often have stories of lesser points decomposed into a total task hours greater tha...
I have detailed information on the latest developments in functional programming. I think haskell is quite an advanced and high level programming language. With coq and agda this gets even more complex and advanced. With "advanced" and "high level" I mean many distinct features, that can only be found in the respective...
My employer asked me to implement a feature that would require storing passwords in clear text in a database (or using an obscure encrypt/decrypt function stored in a binary, which is a bit better, but also insecure). I replied that I was willing to implement such a feature, provided that customers were acknowledged of...
I've always wondered how many different exception classes I should implement and throw for various pieces of my software. My particular development is usually C++/C#/Java related, but I believe this is a question for all languages. I want to understand what is a good number of different exceptions to throw, and what th...
I know very well that java is a portable language..and it is the byte-code that makes it portable.. However I've studied also that C is a portable language. "The programs written in C are portable i.e. programs written for one type of computer or operating system can be run on another type of computer or operating syst...
To the extent that I understand the Single Responsibility Principle, a SINGLE class must only have one responsibility. We use this so that we can reuse other functionalities in other classes and not affect the whole class. My question is: what if the entity has only one purpose that really interacts with the system, an...
Even though the name is similar my question is not a dupe of the very fine question here: Database in the cloud? I've got a webserver (Java/Tomcat) running a webapp (which I wrote) on a dedicated server (which I fully configured myself) and I'd like to have it now use a small persistent DB. I know how to install and co...
A lot of people smarter than me keep writing about when you learn Lisp it makes you a better programmer because you "get it". Maybe all I hear about Lisp(s) changing your life is just a big practical joke on the newbies, but I figure there's no harm in knowing more about the world, even if I find out I've been sent aft...
I work on a small team, in a medium-sized company, most of which isn't involved in software development. I'm the newest and least-experienced developer and had no professional or academic background in software before starting, but I'm quite pleased with how respected my input is and am grateful for being taken serious...
When dealing with an enterprise application, I often heard the requirement of "reporting function" "run reports", "generate reports", etc. What is it referring to?
"If you really want OO sugar - go use C++" -- was the immediate response I got from one of my friends when I asked this. I know two things are dead wrong here. First OO is NOT 'sugar', and second, C++ has NOT absorbed C. We need to write a server in C (the front-end to which will be in Python), and so I am exploring be...
I'm a huge fan of writing asserts, contracts or whatever type of checks available in the language I'm using. One thing that bothers me a bit is that I'm not sure what the common practice is for dealing with duplicate checks. Example situation: I first write the following function void DoSomething( object obj ) { Cont...
Wikipedia says: Not equal The symbol used to denote inequation — when items are not equal — is a slashed equals sign "≠" (Unicode 2260). Most programming languages, limiting themselves to the ASCII character set, use ~=, !=, /=, =/=, or <> to represent their boolean inequality operator. All of these operators can be ...
Most questions like this only seem to apply for big pieces of software for companies with money. I'm developing a small application targeted at individuals. Informally speaking, I want to sell the application to users, but allow them to fix and modify it(but not redistribute). Practically and legally speaking, how woul...
I’ve just watched this talk by Daniel Spiewak where he talks about the advantages of structural typing as compared to Scala’s ans Java’s nominal typing. One example for this difference would be the following Java code public interface Foo { public int length(); } public interface Bar { public int length(); } Foo f...
As a long-time C# programmer, I have recently come to learn more about the advantages of Resource Acquisition Is Initialization (RAII). In particular, I have discovered that the C# idiom: using (var dbConn = new DbConnection(connStr)) { // do stuff with dbConn } has the C++ equivalent: { DbConnection dbConn(c...
A bit of a background here - we are a small team (of 5) of RAD developers responsible for internal software development in a big non-software company. "Internal software" varies from a desktop .NET application using MSSQL server as a backend to Python scripts running on the background to MS Word documents and template...
I have a general repository for small utilities (which were deemed too small at the time to warrant their own repository. 'Nother problem of itself maybe), some of which are deprecated and likely to never serve again. But one rule where I work is to never throw anything away. Deleting from SVN means it's not really del...
I was double checking the URL for the CDN version of jQuery this morning, and noticed that there are three different locations now. Is having multiple networks hosting a product bad, or even self-defeating? I thought a primary advantage is that as more and more sites use a CDN version, that the odds the library being ...
I have very limited experience in software project management roles, and I was asked this question by another engineer and I was sort of stumped. How do I measure when a software project is complete? The part I'm struggling with is the "measure" part. I know there are measurements such as EVM, but they are more focused...
I know a few programming languages. The most marketable ones being Java, Javascript, as well as non-trival stored procedures. I also know some Python, Actionscript and a few dinosaurs language. I am starting up a toy project with Scala/lift. I enjoy each language for its own features and the paradigms they encourag...
Possible Duplicate: Colleague unwilling to use unit tests “as it's more to code” I've been trying in the last couple of months to convince one of my colleagues to start unit testing his code and drop the old "print, run, debug" way of doing things. I need clear and elaborated proofs that unit testing increases your ...
I have an ASP.Net application that is using a MySQL database. My queries are not executing as fast as I would like them too. Are there some standard ways to increase the speed of a MySQL database short of putting it on a faster PC. For example, (I'm not sure if these are true or not) using prepared statements over tran...
Business Analyst creates a requirement. Requirement implemented by developer. BA performs QA. Bug report includes various bugs that were never requirements. E.G. A requirement is made to display a report. The report is displayed. In QA, the analyst see's that a user can enter invalid data. The invalid data makes...
I'm wondering about functional or non-functional requirements. I have found lot of different definitions for those terms and I can't assign some of my requirement to proper category. I'm wondering about requirements that aren't connected with some action or have some additional conditions, for example: On the list of ...
A while ago, I decided to start programming. I really, just jumped into a language (Perl) and went from there. What I regret is that I just jumped in: I didn't learn the basics (if you would call them basics). I didn't learn about Computer Science. This issue, I believe, is holding me back from my true potential. Where...
Possible Duplicate: How can I learn to write idiomatic C++? Besides the obvious answers of "use g++ instead of gcc, and cout instead of printf", how can I ensure that my toy project is teaching me proper C++ paradigms and patterns? Backstory: I've never written a line of C++ beyond Hello World, and I've chosen wha...
In a couple of months a colleague will be moving on to a new project and I will be inheriting one of his projects. To prepare, I have already ordered Michael Feathers' Working Effectively with Legacy Code. But this books as well as most questions on legacy code I found so far are concerned with the case of inheriting c...
I'm making a group of two or three simple javascript games for fun. After someone finishes one game, they'll be presented with a harder or easier version of another game depending on whether the original game was won or lost. I have a high-level question about the design of things: So far I've created a class for one g...
I want to get into web stuff, and thought of going with PHP+MySQL. I have experience in C#, C++, desktop graphics, but no web stuff besides HTML, CSS which I started learning 2 months ago. On SO PHP-book question, the highest rated book is "PHP Objects, Patterns and Practice". However, I'm not sure if it's a book to st...
I have been playing around with C# for Windows and ASP.net MVC development for some time now. But I am still unclear on a few areas. I am trying to understand the basic difference between and performance issues with using and interchanging similar kinds of Generic Collection Interfaces. What is the basic difference be...
One programmer committed some work to the SVN repository, then went home. After he left, the Hudson automatic build failed. Another programmer saw this, and after looking through the code changes, detected that the problem was the absence of one library. He added this library to SVN and the next build completed success...
All of the projects that I've had to deal with so far have only required a single database on a single server. I'm interested in learning more about how projects that need to scale move to multiple databases and/or servers to help manage the load. I'm aware of High Scalability, but I'm particularly interested in some ...
My boss is currently attempting to apply some development standards to our team, so we had a meeting yesterday to discuss the standards which was mostly going well until she brought up: All DB tables will have a CreatedDate and LastUpdatedDate column, updated by triggers. At this point our team suffered an opinion sc...
While this may be a very subjective question I was wondering if there's a place (or many places) on the web where one can read up about good coding and performance tips for different languages and how they may compare with others? For example in AS3 it's faster to multiply rather than to divide, is this the same for JS...