I have been reading DRY principle.Though it seems so easy but I am having difficulty in understanding how we actually achieve it in any Project be it Web Application or Swing? May be few examples will give me lead and help me in developing my thought process. I have tried to search on Google but could not find any thing suitable.
DRY is nothing that requires examples. If you are copying and pasting blocks of code from one method, function or block of code to another, then you are in violation of DRY.
Very simply, DRY tells you to move that code into a reusable unit: either into a function or method or macro, or other mechanism relevant to your programming language. If you have places in your codebase where you clearly have very similar code (even with minor variations) then you should be looking to refactor that code to make it DRY.
"Don't repeat yourself!" == "Don't write the same code repeatedly"