Is there way to better identify design pattern in source codes, esp. if you are not familiar with all of the patterns? What's the best way to identify them?
What do you mean? You identify them by knowing them, and then seeing the signs of one, and putting the pieces together.
Sometimes the name is indicative, FooFactory
, etc.
There's no "magic". I don't quite understand the point of this question ...
A design pattern is a piece of code / architecture, designed to solve a certain problem, that is useful and abstractly applicable to the same problem in other domains. If you see the same kind of code/architecture used in multiple places, it's probably a design pattern, albeit not necessarily a Gang of Four design pattern
One of the most important things design patterns has given us is a more unified vocabulary. Any (well-written) code that uses a particular design pattern should identify the name of the pattern somewhere.
I would start with becoming familiar with Code Smells. It is very typical that a pattern will improve/remove a code smell. Another great resource with some real work examples is the Refactoring to Patterns book. The book shows code with smells and how to fix them with patterns.