instruction
stringlengths
34
19.9k
I know we have questions about comments in general but I'm specifically wondering about Java Doc style method documentation here. I've been pruning unnecessary comments as I refactor and I've noticed our code has painfully obvious descriptions of methods. /** * @name save * @desc Validates and saves submitted daily pl...
I know I can throw exception from constructor in PHP but should I do it? For example, if a parameter's value is not as I expected it. Or should I defer throwing an exception till a method is invoked. What are advantages and disadvantages in both cases?
Recently I had a discussion with a developer who mentioned that during program development, they routinely create and delete tables and columns on a regular basis while working on new features and justified things by saying that this is normal when using an agile development process. As most of my background is in a w...
My program uses the following define statements: #define LOWEST_PATIENT_ID 10000 #define HIGHEST_PATIENT_ID 99999 #define LOWEST_CRITICAL_STATUS 1 #define HIGHEST_CRITICAL_STATUS 100 used in this type of code: do{ scanf("%d", &c_status); }while((c_status<LOWEST_CRITICAL_STATUS) ||(c_status>HIGHEST_CRI...
Simply, If I use reflection to add methods or functionality to a class defined in a LGPL'd library I'm linking to, does that count as a modification to the existing library and would my reflective code have to be released under the LGPL?
In my job all developers that resolve a bug have to add a new unit test that warns about this type of bugs (in the case it occours again). If a unit test is not possible (for example, a webpage design issue), then QA department has to create a test case to manually check it. The idea behind this is that if a defect has...
Recently a senior developer that I work with made a case for requiring that developers get the latest version and compile as part of their project a major internal library. This stands in contrast the the counter argument that project teams should be working off a stable version that they get from an internal Maven rep...
I'm assuming there's a history to it, but why does the stack grow downward? It seems to me like buffer overflows would be a lot harder to exploit if the stack grew upward...
Just need a bit of advice here, if we embed Adobe Reader as an activex control, as well as have a fallback PDF viewer (in case the user doesn't have Adobe Reader installed) would it be wiser to put screenshots in the manual using whatever the latest version of Adobe Reader is, or using the fallback reader? I can see ...
I just want to make sure I'm using the right license for my open source API wrapper project for some social networks and also make sure I understand it. Could you just describe the basics of that license? What I can and can't do, etc? Does these things suit the GPLv2 license: Open Source'ness Ability to use it in your...
I am implementing RSA encryption on a Android App so that I can send SMS message securely, each phone will have its own public and private key generated by the App. But am stuck deciding the best way to store the keys, my options are: Create a keystore and hold the public and private key in the keystore. Save the pu...
I'm currently using decorators to apply various modifications to a template prior to rendering it. I'm unsure about my cache decorator, though, because it is currently able to break the chain of decorators and return a cached object as opposed to the original decorated object. class Cache : Decorator { public Strin...
I'm in search of good language or metaphors to discuss the maintainability of code with non-technical folks (PMs, business sponsors &c). In particular, I've recently created a few one-off, get-it-done-tonight, gets-the-job-done pieces of code. Everyone, including the internal sponsor, knew that we were saving a couple ...
I want to know how difficult/useful it is to keep a project log or diary. I'm worried that keeping track of what I did will eat up too much time...
I was reading up on design patterns, and I read that the prototype design pattern does away with excessive subclassing. Why is subclassing bad? What advantage would using a prototype bring about over subclassing?
I'm a 23-year-old novice game developer who just got his first job in the industry a year ago. Unlike most programmers I know, I started programming pretty late, during my second year in college, and I didn't work on any projects of my own until a couple of months ago. I feel like I'm doing quite well and picking thing...
I'm trying to store a directory structure, including files and their content, in MongoDB. The work is part of a synching app, and is using in Node/Mongoose. Now, I'm new to Mongo, and it's late here - is the idiomatic implementation as easy as it looks - ie, something like this? var FileStoreSchema = new Schema({ fu...
Recently I receive a request: users' emails are stored in the database, and as request of a user, the system will send an email on their behalves. To add more context, it's like sending an email from the vendor, to their customers' email addresses. But it's not a fixed email (it depends on which vendor ask the system)....
I am currently reading some material by Jeff Patton regarding Agile and UX. http://www.agileproductdesign.com/presentations/index.html I was interested to find out from the community what UX design and testing behaviors seemed MOST helpful to their scrum teams to create GREAT and delightful products. hallway usability...
This is more of a style question, but it is something I am currently pondering for a project of mine. Assume that you're creating an application which is modeling a school. So there are entities like Student, School, etc. Now this is all fine and intuitive until you get down to Class, as (in most languages) Class is a ...
What were some of the economic (and other historical) factors that led to object oriented programming languages becoming influential? I know that Simula started things off, but was the adoption of OOP languages due to the ever increasing needs of business? Or, was the adoption due more to the new things that could be d...
I would like to understand why do some people like open source and some others like closed source? Let me be more specific and make my question about web development. If I build my site using an open source server side language what are the benefits for me? and if I build it using a closed source server side language, ...
Is it worth testing the return type and value of a method call that is designed for chaining? It is conceivable that a fellow programmer could accidentally change the return type to void and remove the return while furiously refactoring some methods? This would potentially break a lot of code for an unsuspecting user. ...
Rule 9 in Object Calisthenics by Jeff Bay (RTF) is: Rule 9: No getters/setters/properties The last sentence of the previous rule leads almost directly to this rule. If your objects are now encapsulating the appropriate set of instance variables but the design is still awkward, it is time to examine some more direct vi...
I've been looking around for some articles regarding to requirements analysis, but I'm a bit confused with the term, because based on Wikipedia requirements analysis is a stage of requirements engineering. But once you search more, many of the websites use them interchangeably as in they mean the same, can you please ...
I have made a web application and now I would like to add a search option to it. Since it is a learning project, I can't afford to buy some Google license. That is why I consider creating my own search engine. From what I have read, there are two major ways to do it: using Apache Lucene or using Apache Solr. I have rea...
What kind of skills determine a person that is capable of debugging code with ease? Some time ago my friend carried out an interview with a relatively good programmer. The programmer got hired. He could write good code, understood the frameworks and design patterns. The thing he was missing was - debugging skills. He c...
I am trying to write some code to schedule a set of real life tasks that are input by the user. These tasks are stored in an SQLite database. And at the moment, the only parameters I am taking into consideration are the, The project to which a task belongs to --> p The name of the task itself --> t And the due date fo...
I had been tasked with managing a project which was outsourced to some Ukrainian developers. The company hired them through Elance at a fixed price. At that point my boss left me alone to handle them and get the work done. I created a detailed specification of the complete thing that needed to be done. The project invo...
I'm desiging a distributed application that will consist of REST services and a variety of clients (Silverlight, iOS, Windows Phone 7, etc). I was ready to decide that I would implement my REST services using WCF Data Services (OData) but now the the MVC 4 Web API has made me question that decision. What I liked about...
A little background: I work at a relatively small (<10 developers) tech company which basically produces a single product, which is constantly evolving and being added to. The product is an off-the-shelf client/server product, where we run the server and the clients are mobile apps running on a variety of platforms (An...
I'm starting to design a game that is going to have the following characteristics, and I'm trying to decide how I should program it. I'll also give a bit of my experience after, to help make the decision a bit better. The game should be able to support both Facebook integration, and a stand alone version. I don't want...
On personal projects (or work), if one gets stuck on a problem, or waiting to figure out a solution to the problem, if you jump to another section of your code, don't you think it will be a good reason your application will be buggy or worse yet never get completed? Assuming you are not using git and code each feature ...
I currently have a php script set up to do some xml parsing. Sometimes the script is set as an on page include and other times it is accessed via an ajax call. The problem is the load time for this particular page is very long. I started to think that the php I had written to find what I need in the XML was written poo...
To call yourself a competent Java programmer, what should you expect of yourself and what should others expect from you? Does anyone have ideas for a project or problem that would help measure someones "java-smarts"?
I can't remember what site I glanced over and picked up that tidbit, but someone suggested that you should keep PHP parsing to .PHP files, and not modify one's webserver's htaccess to include PHP parsing within .HTML files. Is this true? Is there any generally agreed upon reason as to doing it one way or the other?
I'm talking about something like layers in photoshop, except they apply directly to the source code. For example, in pseudo-code... inventing what some project might look like - say a computational fluid dynamics program: [base layer] cfdTime runTime(0); fieldVariable U; fieldVariable p; U.initialize(); p.initialize(...
Hopefully this won't be flagged for being too vague, but I'm really looking for suggestions from anyone with experience in this sort of situation. I work for a group that develops very specialized engineering calculations for Intel x86 platforms. We do not intend to continue using this existing x86 code. Instead, we w...
I have an upcoming technical interview with a former employer that will focus on PL/I, DB2, and ISPF. The job will be with systems that I architected and wrote myself 20 years ago. The few years of professional programming that I did since then was all assembly language. The problem is that I haven't programmed profe...
I'm looking for suggestions on the Visual Studio approach to take for a web application that is in the conceptual stage. My environment has a lot of tools: Windows Server 2008 R2 Standard 64bit Visual Studio 2010 Professional Edition Sharepoint 2010 Server Enterprise Edition SQL Server 2008 R2 Office 2010 Professional...
I'm a developer that creates Open Source code for a small language (LabVIEW), and am currently sharing this in several places. The vendor of LabVIEW has a certification process for Open Source libraries (mixed with commercial/closed libraries), but it's rather lengthy. I was wondering how more popular languages manage ...
I find very troubling amount of spelling mistakes I see everyday in our codebase, from which I will reproduce a very short but representative example: ArgumnetCount Timeount Gor message from queue Unfortunately this is in no way limited to one person. There is a lot of non-native English speakers in our team who cont...
"Extract Till You Drop" is someting I've read in Uncle Bob's blog, meaning that a method should do one thing alone be good at it. What is that one thing? When should you stop extracting methods? Let's say I have a login class with the following methods: public string getAssistantsPassword() public string getAdminist...
I recently read an article on the 37Signals blog and I'm left wondering how it is that they get the cache key. It's all well and good having a cache key that includes the object's timestamp (this means that when you update the object the cache will be invalidated); but how do you then use the cache key in a template wi...
I am about to start work on my biggest project yet (about 6 months full time work). For previous projects as they were only short I never intentionally used a model, I may have done but I didn't set out to do it. So... Before I start this project would it be advised to try and use some model? And if it is then what do ...
I am developing a web application in Java/J2EE, in which I have export functionality. I have used Jasper for the same. The issue is when trying to export a huge set of data it is consuming a lot of time. Is there any design approach for export functionality so that I can improve the performance? I had tried JExcel API...
This is the first time that I am working on a web application. I was going through the question What technical details should a programmer of a web application consider before making the site public? and noticed one thing that I knew nothing of: Make sure your database connection information is secured. I am confused...
I'm implementing some automatic functional tests in an environenment that has about 20 applications talking to eachother using queues and/or restful interfaces. The problem I'm facing is that I added some test to one of the application, lets call it Payments, and they all looked very nice and green. One of the changes ...
Currently in my Silverlight app I'm polling the database for changes to cached objects and am looking for advice on how to update the views that are displaying these lists. Example: I have a static class that has lists of objects (Areas, vehicles drivers etc.) that I will be using throughout the application. I have a ...
Possible Duplicate: Are certain problems solved more elegantly with AOP? I don't know much about aspect oriented programming (AOP) but I looked at a few examples and it seems to me more of a debugging tool or patching things. I looked over the examples and I can't think of anywhere I'd use them in -my- code. Assumin...
I have a team of skilled C# developers with vast experience in creating ASP.NET MVC applications. We will soon be starting a new big web site project based on the Drupal platform. My developers do not have any experience in Drupal or PHP and I want to make the transition as quickly and effective as possible. We decided...
I was discussing F# and Functional Programming with a friend last night and he brought up an interesting question to me. How would you do embedded software in functional? I mean this seems like a fairly natural fit in terms of stateless code but embedded also entails being very frugal with memory and I'm not sure of ...
I'm working on an MVC-ish app (I'm not very experienced with MVC, hence the "-ish"). My model and data access layer are hard to test because they're very tightly coupled, so I'm trying to uncouple them. What is the nature of the relationship between them? Should just the model know about the DAL? Should just the DAL ...
Have just looked at stackgeography and at soapi. I cannot see where the geo data comes from as it's not on the soapi. Can anybody shed some light on that? More info on the stackgeography
I've seen it commonly repeated the object-oriented programming is based on modeling the real world but is it? It seems to me that is not true of anything outside of the business layer. My GUI classes/data access classes aren't modeling anything in the real world. Even in my business layer, I've got classes like observe...
I frequently use a pattern where I using method chaining to setup an object, similar to a Builder or Prototype pattern, but not creating new objects with each method call, instead modifying the original object. Example: new Menu().withItem("Eggs").withItem("Hash Browns").withStyle("Diner"); Just wondering if there is ...
Background: there are several places in our app where we want to display date-oriented information on a calendar. The event_calendar gem looks nice and has lots of reviews, so it's what I'm planning to use. However, it's designed to work with a model. I'm not going to update our existing models to meet its needs, so wi...
I'm working on a largish webapp that was developed by several other programmers and I keep running into performance issues caused by poorly written SQL queries and queries that don't use an index. I'm working on fixing the problems by logging how long each query takes to complete and if it's using an index. I was wond...
I have this setup: A windows/x86 development box and a PandaBoard ES for testing with a linux on it. I would like to ask you for recommending a linux distribution that I would run in Hyper-V on my devbox that would be used only for compiling arm/linux binaries. After compiling these binaries I will copy them to an SD M...
Possible Duplicate: Is the ternary operator evil? Does using shorthand if else statments hurt readability? Compare: string name = street != null ? street.Owner : "Not known"; With: string name; if(street != null) { name = street.Owner; } else { name = "Not known"; } I have become familiar enough with the...
Over the years I've constantly heard horror stories, had people say "Real Programmers Dont Use VSS", and so on. BUT, then in the workplace I've worked at two companies, one, a very well known public facing high traffic website, and another high end Financial Services "Web-Based" hosted solution catering to some very la...
I was recently exposed to a desktop application that uses an publish/subscribe model to handle commands, events, etc. I can't seem to find any good examples of using this in a web application, so I wonder if I am off base in trying to use this for web based development (on the server side)? I'm using asp.net c#. My ma...
I already have a working implementation that adds scripting to an application. The application currently generates and compiles scripts from C# snippets (taken from different user provides configuration files) into assemblies using the CodeDOM. As it sounded like a good idea at first I ran into following issues: diffi...
I have been committing changes in git for a project over the last several months. I would like to start integrating Trac into my workflow. Generally, I have the 'git flow' style of git repository. I maintain a master and develop, and I branch features and bug-fixes from the develop branch. I see from answers in Which...
On the Google Apps Marketplace Vendor Listing page, Google says the following: Google charges a one-time fee of $100 for submitting your first listing. I've searched Google Groups and other forums, and I cannot seem to find the answer to the question of whether or not the one time $100 fee applies to only my individu...
I just realized that I can access shared members from instances of classes (probably this is not correct, but compile and run), and also learn/discover that, I can modify shared members, then create a new instance and access the new value of the shared member. My question is, what happens to the shared members, when it...
Suppose I create a domain object called UserAdministration, if i have a method called CreateUser how would i pass state to this method, would I create properties on the UserAdministration object and have a CreateUser method or would i pass all the info for CreateUser method in a poco? Also how do I identify my domain o...
I want to write my own compiler for my own language. Yes, it's going to be hard, and it will take long, but I think it will be worth it. I have looked into OSDev.org, and read about executable formats there, but they aren't much help. I am looking for information beyond what they have there. So, anything will help. Boo...
Are there any advantages to using a query builder, rather than using raw SQL? E.g. $q->select('*') ->from('posts') ->innerJoin('terms', 'post_id') ->where(...) vs: SELECT * FROM posts WHERE ... I see that many frameworks use these kind of abstraction layers, but I fail to understand the benefits.
I recently moved a service from BasicHttpBinding to WSHttpBinding (i.e. SOAP 1.1 -> SOAP 1.2). In WCF, using WSHttpBinding() makes it start using some default security settings. I presume the same default security settings are also used by the WCF Test Client since the client and server can continue talking after switc...
Probably, the basic situation is familiar to everyone. You have agreed on certain coding standards in your team and now it is time to make sure that everybody follows them. Some do it via heavy paired programming, others maintain a list of coding standards and do a manual review. Others even use the static code analysi...
People say Service Locators are bad because they expose the dependencies in some random method from the class (and not in the constructor's arguments like it should): class A{ function F(){ DB::query(...) } } instead of class A{ protected $db; function __construct(DB $db){ $this->db = $db; } function F(){ ...
I'm working on an online game, which I am seriously considering writing a Java Applet for it. The game is not overly complex on the features. I'm considering at some point having at least 3 versions of the game, which include a Java stand alone, applet, and Android game. I know from Design Patterns that the best way to...
I have been working on an open source project for about 2 years. I would like to create a web site, but I am on essentially a zero budget. I also need a logo. My question: How should an open source developer go about improving the project's "visual appeal" without spending a lot of money? Are there graphic designers wi...
I've got a file such as this: #ifndef STDINCLUDE #define STDINCLUDE #include <memory> #include <stdexcept> #endif I want this file to be included in every header file, because I use stuff from those headers so much. Is it preferable to include this via compiler options (-I stdinclude.hpp), or should I physically inc...
When you compile and distribute a client you are automatically protecting yourself from someone seeing and modifying your code. Can this be achieved on a Javascript client?
The Javadoc for ListIterator says: A ListIterator has no current element; its cursor position always lies between the element that would be returned by a call to previous() and the element that would be returned by a call to next(). Why was Java's ListIterator implemented to point between elements rather than a...
For every build of my software I run it through a series of tests that execute a number of commands on a command line and captures the results. Most of the time the output is a combination of: - Static information that is, and should be, the same between every run. - Dynamic information that is not easy to predict....
I'm building a public website where users share data and scripts to run over some data. The scripts are run serverside in some sort of sandbox without other interaction this cycle: my Perl program reads from a database a User made script, adds the data to be processed into the script ( ie: a JSON document) then calls t...
I've always read that LISP is well suited for Artificial Intelligence, but I never found out why.
Well these days JavaScript is main player in all web development technologies , on client side for making user interface better, client side logic, on some web servers as server side logic also Add to that the fact of people (at least some of them ) started moving in web game development from flash to javascript and H...
How do you handle yourself in a new team where you are the senior most developer and most others in the team are junior to you by several years. The task ahead of the team is something nobody else including you has accomplished in their career before. Management insists on higher productivity of the whole team, and as...
I believe learning C is one of the most important aspects for any programmer. It's a beautiful combination of a high and low level language. Some universities are moving to stop teaching C in the introductory stages and are using Python instead. Will this move to Python, from C, degrade the quality of CS students? If ...
What would be the best approach at unit testing a model that integrates into an application that is tightly coupled to database? The specific scenario here is a shopping cart - I'd like to be able to test the adding removing and retrieving of items from the cart as well as pricing logic etc. This in my mind all require...
Are there any guidelines for placing methods in API when the placement isn't obvious? Example: I have classes A and B and a method X. The work being carried out can be phrased in two ways: A does X with B B does X to A Given the two ways of phrasing this, it's unclear whether X belongs in A or B. Are there guideline...
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 ad...
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...
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?
I found this question and accepted answer on StackOverflow. It's related to the slow JSON parser in the standard Scala library. The consensus as it were, is that the build-in JSON library is slow, and, in the words of DMC: "it's like that, and that's the way it is" Maybe I'm just being naive here, but that sounds like...
When I work on some programming project (usually command line application in Python with many switches), I'm usually creating about 30 and more functions. Most of the functions are in one file (except some helpers that I utilize in more projects). Some of the functions are called on particular switch (like -p or --prin...
If developing web applications using ASP.NET MVC or Ruby on Rails make the application use the MVC design pattern, then if I build my application using only HTML5/Javascript + backend webservices (like WCF rest), then which design pattern will my application follow?
I wonder why java defines homogeneous methods in two distinct classes: java.util.regex.Pattern and java.util.regex.Matcher. For example split method defined in Pattern class and replaceAll method defined in Matcher class. I think these two methods are homogeneous, why are they not defined in the same class? Have I und...
In your experiences, what are some effective ways to introduce code kata practice into an organization or company? To be clear, I'm not concerned with the usefulness of code kata. I'm interested in methods to introduce this concept to a development team.
I'm using Eclipse and I will talk about it as an example but I am sure that this is the case in any other IDE. Eclipse has the CTRL-Shift-F command which automatically formats your code. Is it a good practice to use this kind of formatting? I'm asking in the context of a big project in which there may be many programme...
What are the similarities between MFC and WPF? Is it worthy to learn MFC before WPF?
My university has a module for software development with a real client. Some of my team members work in the computer lab all the time, which is an extremely noisy environment with lots of interruptions and distractions. There are about 30 people always talking. People always go on Facebook, YouTube, or tell jokes to ea...
I'm parsing a bespoke XML format into an object graph using .NET 4.0. My parser is using the System.XML namespace internally, I'm then interrogating the relevant properties of XmlNodes to create my object graph. I've got a first cut of the parser working on a basic input file and I want to put some unit tests around t...
I am quite new to source control and would like to know the differences between committing and patching? Also, how/when a patch is use and can it be used on a web application?
This is what I'm thinking about doing on a JEE Glassfish server using Jersey. @GET @Path("/{name}/{date}") public String getMessages(@PathParam("name") String name, @PathParam("date") Date date) I like the idea of being able to tell people consuming this RESTful webservice that "The date here is anything that works wi...
I was writing some code over the weekend and I found myself wanting to write a factory as a static method in a base class. My question is simply to know if this is a c# idomatic approach? My sense that it might not be comes from the fact that the base class has knowledge of the derived class. That said, I'm not sure ...