Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!

Vijay Venkat

Ranch Hand
+ Follow
since Aug 12, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vijay Venkat

You mentioned that most of it is servlet and JSPS. I believe you only have the presentation aspects in JSP and the business logic is not part of it . If not, you need to refactor code to addressed this first.

As you decouple presentation, business logic and controller aspects clearly, most of it will become obvious.

Then you can clearly test your business logic(unit tests) and then use other tools like Selenium/sahi/ to do functional testing.

You can also look at Cactus.

You may also want to identify the container version in which your servlets and jsps are running. Moving to 2.4 and above should give you lot of benefits.

As Ilja Preuss, mentioned, you can take many agile principles and get started, rather than having none. And over a period of time, the benefits will become obvious and you can move to a total agile development process.

It is not necessary to always use framework. It should be used only if necessary. I have worked on project which didn't use any framework, because we didn't need one. So, using a framework should solve you problem, else it adds more problem. I am sure you can identify it.

Thanks,
Vijay Venkataraman
Thanks to everyone.

I am happy and waiting to have a copy of this book.

Vijay Venkataraman
[ September 29, 2008: Message edited by: Vijay Venkat ]
Hi G�za Czimeth

1. You can read couple of books/sites to identify what is bad code.
2. This book "Clean Code" should serve that purpose +
3. Don't forget to read Refactoring: Improving the Design of Existing Code (http://www.refactoring.com/catalog/index.html) +
4. Other book is Code Complete 2 by Steve McConnell
5. Write tests before you make code clean. Not always possible at all situations. But getting to do that is the first step.
6. The most important is the courage to get started with it.

Thanks,
Vijay Venkataraman
Hi arulk pillai,
That's a very good question.
That's where some discipline comes in to play.

When we talk about clean code - it's learning and discipline put in place.

For every good product that is there, there is one or many people who follow good development discipline. I am sure they keep a tab on this.

There are plugins which show all the todos that is in the code and contant vigil is kept on the todos. Else todos list will grow beyond a point.

There are occasions i had filed bug on another product, but had to work around till it was fixed in that product. Once it is fixed, we got the work around removed.

For these cases? then i would ask, what is the best way to handle?

Thanks,
Vijay Venkataraman
It is well know that code review is very effective in reducing bugs and improving code quality. Be it agile, when two developer are working over the same code, where review is happening while it is being coded, or when it is done by peer once a developer has finished with. Both has positive effect on the code.

But there are other trick issues involved with it some organizations.


You many want to look at this
http://smartbearsoftware.com/codecollab-book-review.php

There are two more books good books on this, i will try to get this information and post it later.

Thanks,
Vijay Venkataraman


;-) Since all classes should be thread safe, I would simply call it AdministratorDAO. I would put the ThreadUnsafe prefix on it if it wasn't thread safe....



That's very interesting. This make me think harder.

1. Yes we do strive to make class immutable.(Implies it is thread safe)
unless on is exposing the internal implementation to be manipulated outside it.

2. While that is the case, there are place where we use lot of bean classes which have setters and getters, in these places, we don't make them thread safe, but expect a instance of this created and for each operation, and leave it to the client class handle the threading if it is really required.

3. Let us take instance of java's HashMap, we don't need thread safe instance always. If we have all of objects thread safe, will it not lead to performance problem?
We use thread safe version of HashMap only when it is needed.
Isn't that we need to think of the usage, while we decide to make any class thread safe or not?

4. Another note on the class name - If the class name is not clear, all i can conclude is, the coder/developer is not clear of what he is doing or has a very poor coding discipline.


Most comments are lies. They don't start out to be lies, but gradually the get out of date.


This is what i have seen happen the most. Since code is mostly changing, the comments goes out of context very soon.
While in certain places, like there is a bug in some other product that needs to be worked around, i try and a comment with in the function and point to the bugs as a link, also with a TODO to keep a tab, so that it can be removed once the bug is fixed. But the function name will surely reflect the problem that is being worked around.

When the bug is fixed, the function along with the code is removed.

Thanks,
Vijay Venkataraman
Hi Rulk pillai
Glad to hear that it helped.


I would also add books like Bitter Java, Bitter EJB, etc.



Thanks for pointing to me other books. I looked at the different reviews it has, look very impressive.

Should grab Bitter Java and start with it very soon.

EJB 1.x to 2.x is bitter. After looking into hibernate and spring i don't think i will think of EJB.

And for other, who believe in agile programming and TDD and are always looking to do good development, many things will be repetition.

For anyone who has been following books and writings by Kent Beck ,Martin Fowler and the agile group, most of what is said in the book will be obvious.

Nothing like following it and finding out for oneself.

Thanks,
Vijay Venkataraman
Hi Jeanne Boyarsky, Alaa Nassef and Ilja Preuss
Thanks for taking time to respond.

The table of contents with more information is better in safari than posted in the original link.
http://my.safaribooksonline.com/9780136083238?tocview=true

I think it will be very interesting see what is in these chapters:
Chapter 8. Boundaries
Using Third-Party Code
Exploring and Learning Boundaries
Learning log4j
Learning Tests Are Better Than Free
Using Code That Does Not Yet Exist
Clean Boundaries
Bibliography

Chapter 13. Concurrency
Why Concurrency?
Challenges
Concurrency Defense Principles
Know Your Library
Know Your Execution Models
Beware Dependencies Between Synchronized Methods
Keep Synchronized Sections Small
Writing Correct Shut-Down Code Is Hard
Testing Threaded Code
Conclusion
Bibliography

Is there more information about these chapter. I did get a peek on this in safari, but would be nice to see more information on it.

Thanks,
Vijay Venkataraman
Hi Adeel Ansari,
The books "Clean Code" seems to touch on topic from all the books i quoted.

I am quite aware and it is quite obvious that these two books talk about different aspects.
Pragmatic JUnit Testing - Andrew Hunt and David Thomas
Effective Java - Joshua Bloch

My question was - The book we are talking about seems to touch up different topics in all the books i have mentioned.

Let me rephrase - how is it specifically different from parts of the contents that have been already dealt in these books.
Eg - Exception and Threading has been dealt in Effective Java
Refactoring - In Martin Fowler's Refactoring
Testing is well talked about in Pragmatic JUnit Testing
Naming,functions and looping and much much more in Code Complete II

I have read all the book i mentioned and much more, so what is new and very important learning it will impart?

What makes it different from all of those mentioned?

It will be great to know about it.

Thanks,
Vijay Venkataraman
Hi Robert Martin
What differentiates this book from the following:
Code Complete 2 by Steve McConnell
Martin Fowler's - Refactoring: Improving the Design of Existing Code.
Pragmattic Junit Testing - Andrew Hunt and David Thomas
Practices of Agile Developer - Venkat Subramanian and Andy Hunt
Effective Java - Joshua Bloch
Avoid singletons as in http://c2.com/cgi-bin/wiki?SingletonPattern

Is there details about what is the right way to manage dependencies, how it should be passed around or it is good to use IOC, when to use one over the other, do you touch up on these.
Couldn't find more on this from Safari

What will be the most important take for developers from this, if they have already familiarized with what is specified in above books and topic relating to them?

Thanks,
Vijay Venkataraman
Over and above the HTML document that will be rendered is actually wrong. As per HTML spec, there cannot be two element having same id.


results in element with id's as 'payment' for all the checkboxes.

If there is no need for it, you can avoid using it.

If you are using JSP 2.0 then you should use Expression Language. See JSP 2.0 Spec.

Vijay Venkataraman
14 years ago
JSP
1. final --> implies it is immutable.
It holds good in any java environment.
Beware: If you are using object, if the properties inside the objects are not final then they are mutable and not thread safe.

Eg private final int _FIVE = 5
private final List _SHAPES = new ArrayList();

Here you cannot assign new values to _FIVE and _SHAPES cannot be made to refer to a different list.

This is invalid : Somewhere in your code you cannot do
_FIVE = 10
_SHAPES = new ArrayList()
On doing above you will get compilation errors.

But the objects with in _SHAPES can be mutated, depending up the objects which have been added to _SHAPES.

Vijay Venkataraman
Hi James Carman,

Thanks for your helping hand on this issue. I had done that. But my requirement was to pick the MANIFEST.MF file from a specific jar. say B.jar in the path rather than making my class loader look for all the files by that name. I am not sure what is the cost of doing something like that.

If anyone know's how expensive it is - Kindly let me know.

I really appreciate the time taken from your end to respond. So what i am doing is something like this i know there is a class by name a.b.c.X.class.
Use X.class.getClassLoader().getResource(a/b/c/X.class). With this i know from which Jar file my class is being picked up

The url would be some thing like /somedirve/.../TheJar.jar!/a/b/c/X.class.
Then do url.getFile()
Remove the extra path from theJar.jar and create a new inputStream to the Jar file TheJar.jar and create a JarInputStream and then read the manifest file using the jar api's.

Thanks,
Vijay Venkataraman
15 years ago
Hi,
I found a way to get to the Jar files in WEB-INF/lib using
String path = ServletContext.getRealPath(WEB-INF/lib/[myJarName])
Create a Jar URL stream using this path. And then get to the manifest to look for information.

If any one knows of a better way of doing it, kindly let me know.

Thanks,
Vijay Venkataraman
15 years ago