code-reuse

Re-use business logic from MVC Application (DLL) in Reporting Services

I have a business object that compiles into a DLL that handles all calculations for my system for concepts such as eligibility, etc. The object also handles the connectivity to the DB via some wrappers around it. Is there anyway to take this .NET DLL and use it as a datasource for a reporting services report (SSRS)? We don't want to...

What Code is a Candidate for Re-use?

Imagine you work for a small lean software company. You know the future competitiveness of the company is in having a good reusable code base to draw upon. It’s going to be very important to manage the company’s re-use policy to ensure you deliver today, at the same time as providing a back-bone for the future. In my mind there are two ...

How to reuse code in SQL stored procedures?

We use SQL Server 2005. All our data access is done through stored procedures. Our selection stored procedures always return multiple result sets. For instance: CREATE PROCEDURE hd_invoice_select(@id INT) AS SELECT * FROM Invoice WHERE InvoiceID = @id SELECT * FROM InvoiceItem WHERE InvoiceID = @id SELECT * FROM InvoiceComments WHE...

Overcoming bad habit of "fixing it later"

When I start writing code from scratch, I have a bad habit of quickly writing everything in one function, the whole time thinking "I'll make it more modular later". Then when later comes along, I have a working product and any attempts to fix it would mean creating functions and having to figure out what I need to pass. It gets worst b...

How to reuse my VB6 application?

First of all, as I am using VB6, please confine your kind suggestions to techniques applied to VB6. I have a set of controls related to each other as the above figure shows. It includes several treeviews, a split bar, a listview, a subform( a usercontrol), and etc. When I click or change the treeview nodes in the left, the right cont...

Very simple map implemention in C (for caching purpose) ?

I have a program that read urls in a file and does a gethostbyname() on each URL host. This call is quite consuming. I want to cache them. Is there a very simple map-base code snippet in C out there that I could use to do the caching? (I just don't want to reinvent the wheel). It has to have the following points : Open-source with ...

Re-using a single file with basic ruby tested code in rails?

I got this code in a single file snippet.rb and it runs as expected. This script if from dzone snippet that fetches the thumbnail of the URL at the current time. Now I wan to integrate this functionality with Rails and here I'm stuck how to begin. Should I put this in some ruby file inside lib directory or make it modules??? I'm not muc...

ASP.NET MVC - Reusing Action Behaviors

This question pertains primarily to good design. Suppose I have a controller action like DeletePage that can be invoked in two separate views of the same controller. Assuming the delete logic is not contained in the action itself, but rather some conditional checks and the like that call the correct business logic, it doesn't make sense...

What is the best way to reuse code in PHP?

Code: if ( $_GET['tab'] == 'newest' ) { // Go through each question foreach( array_reverse( $end_array, true ) as $tags_and_Qid['question_id'] => $titles_and_Qid['title'] ) { // Grab the title for the first array $title = $titles [ $tags_and_Qid['question_id'] ] ['title']; // Grab the tags ...

How do I create and maintain a code reuse library?

I am trying to setup a repository of reusable code. I was thinking about having each reusable code module have a certain “Maturity Level” rating. The rating would be defined as the level at which a reusable code lies within a certain set of requirements. The highest maturity level will be the highest degree of standard across a predef...

How to reuse a rails app

Hi, I developed a rails app for a school alumni site. Now another school wants me to develop a similar site for them. I want to reuse the app. Data structure will be same but the actual data will be different. Design layout will be similar but design itself will be different. One option is that I just copy the app and modify it. But i...

Best Place to Put SelectListItem Generators in ASP.NET MVC Application

In my first venture into ASP.NET MVC, I am coming across a few situations where I have dropdown lists that are limited in their purpose to a single view. A good example is that I have a signup form where a user has to put in their gender and birthdate. Once entered, nowhere in the application is it changed. For the gender, I build out...

In-House Propriety vs. Open Source

Is there a reason not to use wordpress and develop your own blogging system? Same goes with Durpal and our own CMS. I am wondering since my marketing women disagrees with me that we should develop our own in house solutions because there are better solutions. She also says that we might even loose time and money on it since it is our ...

Malicious Code Examples/Snippets

What is the best way to prevent introduction of malicious code when using snippets, skins, etc.? Obviously this is less of a problem with sites like StackOverflow; however, how often have you run into Malicious Code Snippets? I don't just mean careless or wrong. I mean actively malicious. For example, I have used Wordpress a lot late...

How do you ensure code is reused correctly?

Frequently when we introduce a new feature into an application we may produce artifacts, such as useful methods or classes that could be reused in other areas of our applications. These artifacts are not necessarily documented as functional requirements as they are usually a side-effect of our implementation choices. Since we often devel...

Java: Finding matches between Strings

Given 2 strings, I want to find the first match of at least four characters. This is the code I currently have to do it. It works correctly, but I'm thinking there may be a better way to do this. Are there any screaming inefficiencies or bad practices in what I'm doing? Are there common libraries, like Apache Commons, that I should be t...

Html reuse without code

I am creating some static html pages outside a .net and outside a ruby-on-rails environment. I created a menu I want to share between several pages, but I'm wondering how this is done using regular html constructs (i.e. without .net's master pages and without rail's layouts) Is there a way to do this without cutting and pasting? ...

Do good tests enable sloppy coding?

Let's say you're coding, and you come across an opportunity for simple code resuse (e.g. pulling a common piece of code out to an accessible place like a Utility class or base class). You might find yourself thinking, "I know it's good to do this, but I have to get this done now, and if I need to make a change to this code, and forget ...

Common Libraries at a Company

I've noticed in pretty much every company I've worked that they have a common library that is generally shared across a number of projects. More often than not this has been a single companyx-commons project that ends up as a dumping ground for common programs including: Command Line Parsers File Utilities Framework Helpers etc... S...

How do I apply the DRY principle to iterators in C++? (iterator, const_iterator, reverse_iterator, const_reverse_iterator)

OK, so I have two (completely unrelated, different project) classes using iterators now. One has iterator and reverse_iterator working as intended, and the other, current one has iterator and a semi-broken const_iterator (specifically, because const_iterator derives from iterator, the code LinkedList<int>::iterator i = const_list.begin()...