Lorand Komaromi

Ranch Hand
+ Follow
since Oct 08, 2009
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lorand Komaromi

My question was a bit imprecise, what I wanted to ask: are you sure that when BUsesSingleton.uodate() is invoked in your test method, ASingleton.getInstance() returns the mock instance on which you set the expectations..?
13 years ago
I'm not familiar with Easymock, but are you sure that your fixture is set up properly and the singleton is returning the mocked object..?
13 years ago

Nuwan Arambage wrote:
In enterprise software development context, what circumstances doesn't allow you to use OOP as a programming paradigm.

Legacy systems written in a language that doesn't support OOP, e.g. COBOL, C, RPG..? Applying the principles of OOP could be possible in non-OOP languages, but beyond a point it becomes difficult...
If the application that produces the logs uses log4j, and you have write access to its configuration, you could add a SocketAppender that sends the log messages to your application. But you scenario is probably more complicated than this...
One example I could think of are programs which run on devices with limited memory/processing power. These applications are extremely small compared to enterprise applications, and the benefits OOP offers don't make up for the costs of object creation, late binding, etc.

How about making DAOFactory an Abstract Factory and using some DI framework to inject the implementation..? You could get rid of the no-rg constructor and you'd have one less case to test (instantiating the class using the no-arg constructor)!
13 years ago
StarUML can reverse engineer Java code and is freeware, but it is very buggy.

Sparx Systems Enterprise Architect is much better, it's not free but according to many it's the best in terms of price/features.

Kristofer Hindersson wrote:Because I can't imagine how that would be done without the code becoming more confusing to read.

As a start you can put your networking code in a separate class called Client. Hasn't your GUI code become shorter and more comprehendable..?

Is this more confusing than your version..?

but I also think theres a point of diminishing returns beyond which it causes more trouble than it's worth to try to force a separation.

As your application grows, separation of concerns becomes more and more important. Maybe you don't see the gains in a small "toy project", but in a large application with over 100k LoC large classes that try to handle everything from network/disk IO to presentation logic are the coder's nightmare!

Marco Ehrentreich wrote:

Wrong, you should ALWAYS check the preconditions in public methods.

Uhm... I talked about private methods in this case.

Yepp, you're right, sorry. I'm too tired...

Marco Ehrentreich wrote: it's OK to have no null checks in this method because it simply expects that parameters should not be null when the method is used correctly

Wrong, you should ALWAYS check the preconditions in public methods. Assertions must be explicitly enabled, hence you can't rely on them for validating public methods as they'll be probably called by other people. You can use them to validate your private methods, you enable them during testing to make sure that you're using your methods correctly, once tested you don't need the extra checks...

Rajkumar balakrishnan wrote:As i said earlier there is no problem in detecting the prop file. Because the log messages got printed in console

Which message? The one printed with System.out.println()?
14 years ago

Jan Cumps wrote:Yes. Rollback undoes all updates and deletes from when you started your transaction.

Assuming that you're using a DB that supports transactions...
Commit it in the last line of the try block, you want to commit it only if there has not been an exception...
In Java SE the compiler will optimize the string concatenation to use StringBuilder. In ME this could be different, though...
14 years ago

Alex Parvan wrote:
For example, creating Strings like this:

is very bad practice.

Compile it, then decompile it with jad. You will be surprised...
14 years ago