legacy-code

Code refactoring on bad system design

依然范特西╮ 提交于 2019-11-30 01:41:51
I am a junior software engineer who've been given a task to take over a old system. This system has several problems, based on my preliminary assessment. spaghetti code repetitive code classes with 10k lines and above misuse and over-logging using log4j bad database table design Missing source control -> I have setup Subversion for this Missing documents -> I have no idea of the business rule, except to read the codes How should I go about it to enhance the quality of the system and resolve such issues? I can think of using static code analysis software to resolve any bad coding practice.

Calculating annual percentage rate (need some help with inherited code)

筅森魡賤 提交于 2019-11-30 00:09:00
问题 I'm making an application that gives clients and approximate loan offer (they are later calculated by other back-office systems). I have received some code from the financial firm that we are making the calculator for. My problem is that I do not understand the part of the code that calculates the annual percentage rate (including startup and monthly fees). It might be this method they are using, but I can't really tell: http://www.efunda.com/math/num_rootfinding/num_rootfinding.cfm#Newton

Method for finding memory leak in large Java heap dumps

给你一囗甜甜゛ 提交于 2019-11-29 19:47:11
I have to find a memory leak in a Java application. I have some experience with this but would like advice on a methodology/strategy for this. Any reference and advice is welcome. About our situation: Heap dumps are larger than 1 GB We have heap dumps from 5 occasions. We don't have any test case to provoke this. It only happens in the (massive) system test environment after at least a weeks usage. The system is built on a internally developed legacy framework with so many design flaws that they are impossible to count them all. Nobody understands the framework in depth. It has been transfered

What's the best way to become familiar with a large codebase? [closed]

扶醉桌前 提交于 2019-11-29 19:03:42
Joining an existing team with a large codebase already in place can be daunting. What's the best approach; Broad; try to get a general overview of how everything links together, from the code Narrow; focus on small sections of code at a time, understanding how they work fully Pick a feature to develop and learn as you go along Try to gain insight from class diagrams and uml, if available (and up to date) Something else entirely? I'm working on what is currently an approx 20k line C++ app & library (Edit: small in the grand scheme of things!). In industry I imagine you'd get an introduction by

How to unit test a method with a `using` statement?

三世轮回 提交于 2019-11-29 11:25:25
问题 How can I write a unit test for a method that has a using statement? For example let assume that I have a method Foo . public bool Foo() { using (IMyDisposableClass client = new MyDisposableClass()) { return client.SomeOtherMethod(); } } How can I test something like the code above? Sometimes I choose not to use using statement and Dispose() an object manually. I hope that someone will show me a trick I can use. 回答1: If you construct the IMyDisposableClass using a factory (injected into the

Will Windows 7 support the VB6 runtime?

依然范特西╮ 提交于 2019-11-28 20:22:11
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 very helpful. MarkJ YES! Official support statement : The core Visual Basic 6.0 runtime will be supported for the full lifetime of Windows Vista, Windows Server 2008 and Windows 7 EDIT and now Windows 8 ,which is five years of mainstream support followed by

Method for finding memory leak in large Java heap dumps

主宰稳场 提交于 2019-11-28 14:38:49
问题 I have to find a memory leak in a Java application. I have some experience with this but would like advice on a methodology/strategy for this. Any reference and advice is welcome. About our situation: Heap dumps are larger than 1 GB We have heap dumps from 5 occasions. We don't have any test case to provoke this. It only happens in the (massive) system test environment after at least a weeks usage. The system is built on a internally developed legacy framework with so many design flaws that

What's the best way to become familiar with a large codebase? [closed]

十年热恋 提交于 2019-11-28 13:16:41
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Joining an existing team with a large codebase already in place can be daunting. What's the best approach; Broad; try to get a general

Possible consequences of increasing varchar length in MySql?

别来无恙 提交于 2019-11-28 08:41:11
问题 I'm using an old table, which has a varchar(40) field in it. I want it to be possible to insert more characters in that field, so I want to increase the length of it. Are there possible negative consequences I should think of before increasing the length? 回答1: Increasing should typically not cause issues, it is the decreasing that can cause problems. 回答2: Changing the declared size of a varchar field should not require the existing data to be modified. Note that changing the size of char or

Redirect both cout and stdout to a string in C++ for Unit Testing

柔情痞子 提交于 2019-11-27 13:08:01
I'm working on getting some legacy code under unit tests and sometimes the only way to sense an existing program behavior is from the console output. I see lots of examples online for how to redirect stdout to another file in C++, but is there a way I can redirect it to an in-memory stream so my tests don't have to rely on the disk? I'd like to get anything that the legacy code sends to stdout into a std::string so I can easily .find on the output. Edit The legacy code is so bad that it users a mixture of cout << .. and printf . Here is what I have so far: void TestSuite::setUp(void) {