legacy-code

Cleaning up Legacy Code "header spaghetti"

Hi, Any recommended practices for cleaning up "header spaghetti" which is causing extremely slow compilation times (Linux/Unix)? Is there any equvalent to "#pragma once" with GCC? (found conflicting messages regarding this) Thanks. ...

How to work in untestable legacy code- in bug fixing

scenario: you have tightly coupled legacy code that you can not unit test. and you have to bug fix, what do you do to not get very depressed? I read working effectively... and refactoring.. by fowler, however in both book unit testing is indispensable. Refactoring is out of the question and a code rewrite is on the table however it will...

How best to integrate several systems?

Ok where I work we have a fairly substantial number of systems written over the last couple of decades that we maintain. The systems are diverse in that multiple operating systems (Linux, Solaris, Windows), Multiple Databases (Several Versions of oracle, sybase and mysql), and even multiple languages (C, C++, JSP, PHP, and a host of ot...

What can you do to a legacy codebase that will have the greatest impact on improving the quality?

As you work in a legacy codebase what will have the greatest impact over time that will improve the quality of the codebase? Remove unused code Remove duplicated code Add unit tests to improve test coverage where coverage is low Create consistent formatting across files Update 3rd party software Reduce warnings generated by static ana...

How to go about mocking a class with final methods?

Say I have class A with class A { final String foo() { // .. computing result, contacting database, whatever .. return "some computed value"; } // ... and a bazillion other methods, some of them final. } Now I have class B with class B { String methodIWantToTest(A a) { String output = a.foo(); // ... whate...

Generics in legacy code

We've got a fairly large amount of code that just made the jump to Java 5. We've been using generics in those components targeted at being released in the Java 5 version, but the remaining code is, of course, full of raw types. I've set the compiler to generate an error for raw types and started manually clearing them, but at the present...

Dead code detection in legacy C/C++ project

How would you go about dead code detection in C/C++ code? I have a pretty large code base to work with and at least 10-15% is dead code. Is there any Unix based tool to identify this areas? Some pieces of code still use a lot of preprocessor, can automated process handle that? ...

Build "exit" page using Classic ASP avoiding major Cross Site Scripting pitfalls

I'm working on updating a classic ASP web page used by a number of sub-sites maintained at the company I work for. The purpose of the page is to notify the user that they are leaving "our" site and going to another site. It's basically a disclaimer, but due to resource limitations and time limitations I can't add the disclaimer to every...

Best Language for Windows 2000-based Website

I've been contacted to see about updating an old legacy web application that was built using ASP and Access. The server is running Windows 2000 Advanced Server and I believe IIS 5.0 (I am trying to get confirmation on that, but the company isn't technical so I highly doubt Apache is running on the server). What languages would be viable...

How to host a WPF control in an MS Access VBA Form?

We have a large MS Access project that requires GUI functionality that is difficult / impossible to do in the VBA / access forms environment. Over time, we wish to re-write / migrate to a managed C# environment with WPF as the presentation layer. The only practical way for us to do this is over a longer period of time - converting som...

Have You Ever Worked On Code Older Than You Are?

Has anyone ever had the experience of maintaining code that was initially written on or before the date you were born? Personally the oldest code I ever worked on was first written in 1982, so it did not predate me. One of my best friends is a mainframe developer and he worked on code first written in the early 70s, but it did not pred...

Did isset work differently in older versions

Hey! I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])=="homepage") { ?> HtmlCode1 <?php } else { ?> HtmlCode2 <?php } ?> I don't know exactly why but this seems to be working. The htmlcode1 is loaded when I have ?pagina=homepage and the htmlcode2 is loaded when the pagina var doesn't exist or is something...

Dead languages

At which point should you (or your company) ditch the language used for many years, for which you have the workforce, simply because it became irrelevant or much better alternatives came into the marketplace? Edit:It is a tough proposition because for example, I know of companies that are stuck with PowerBuilder. They have so much inves...

Will Windows 7 support the VB6 runtime?

I can't seem to find a straight answer on this. It appears that Visual Studio 6 won't be supported, but I'm only concerned with the runtime. We have some legacy apps that we'd rather not rewrite, but our customers will expect them to run on Windows 7. If anyone can provide a link to something official from MS on the topic, that would be...

Search a codebase for references to table names

I have a directory full of legacy code from a VB6 application. I have been asked to provide a list of all the tables that this application uses, so we can assign a special SQL Server username to it. What is the best way to scan a codebase for references to table names? Some ideas I've had: Search for the following keywords: "FROM", ...

Getting your head around other people's code

I'm occasionally unfortunate enough to have to make alterations to very old, poorly not documented and poorly not designed code. It often takes a long time to make a simple change because there is not much structure to the existing code and I really have to read a lot of code before I have a feel for where things would be. What I think...

NHibernate on legacy DB.

I'm ashamed to say it, but I have to. I have not worked with ORM's. I'm really considering NHibernate as it seems to be the most mature product for .Net out there (please correct me if I'm wrong). Now, the thing is that we have a big e-commerce/booking system with an SqlServer as the main integration point, containing quite a lot of busi...

Inheriting applications at a new job...

When inheriting applications at a new job do you tend to stick to the original developers coding practices or do you start applying your own? I work in a small shop with no guidelines and always wondered what the rule was here. Some applications are written very well but do not follow the standards I use (variable names etc...) and I d...

Writing a replacement asp/html form for a legacy system

Quick question. There is a legacy website (that is not under my control and cannot be modified), that gives users a form to fill in data and then the user 'submits' the form for processing. There is virtually no error checking on this form, and very little help for the user (i.e. it was very poorly designed about 12 years ago and hasn't...

What ancient, old school code do you still have kicking around?

Having been bored out of my brains the last few days off work sick, I decided to try and dig up some old code. I could find some binary versions of some ancient Atari ST stuff I wrote, but I couldn't find any source. I did manage to dredge up an old ModeX library I wrote in ASM many moons ago from an archive of the legendary old x2ftp si...