ਡਿਜ਼ਾਇਨ ਪੈਟਰਨ ਸੰਭਵ ਹਨ ਦੁਬਾਰਾ ਵਰਤੇ ਜਾ ਸਕਣ ਵਾਲੇ, ਸਾਬਤ ਹੋਏ ਹੱਲ ਆਮ ਸਾਫਟਵੇਅਰ ਡਿਜ਼ਾਇਨ ਸਮੱਸਿਆਵਾਂ ਲਈ — ਕੋਡ ਨੂੰ ਸੰਰਚਨਾ ਕਰਨ ਦਾ ਆਮ ਟੈਮਪਲੇਟ ਦੁਹਰਾਉਣ ਵਾਲੀਆਂ ਚੁਣੌਤੀਆਂ ਨੂੰ ਹੱਲ ਕਰਨ ਲਈ। ਉਹ ਸਾਝਾ ਸ਼ਬਦਾਵਲੀ ਅਤੇ ਪ੍ਰਮਾਣਿਤ ਪਹੁੰਚ ਪ੍ਰਦਾਨ ਕਰਦੇ ਹਨ, ਬਿਹਤਰ, ਵਧੇਰੇ ਰਖ-ਰਖਾਅ ਯੋਗ ਕੋਡ ਲਿਖਣ ਵਿੱਚ ਸਹਾਇਤਾ ਕਰਦੇ ਹਨ।
ਡਿਜ਼ਾਇਨ ਪੈਟਰਨ ਕੀ ਹਨ
DESIGN PATTERNS = proven, reusable solutions to RECURRING design problems:
→ not code to copy, but TEMPLATES/approaches for structuring code
→ distilled from experience (best practices for common situations)
→ e.g. "how do I ensure only one instance of a class?" → Singleton pattern
→ describe the PROBLEM, the SOLUTION structure, and the trade-offs
ਕਲਾਸਿਕ ਸ਼੍ਰੇਣੀਆਂ (Gang of Four)
CREATIONAL → how OBJECTS are created (Singleton, Factory, Builder, Prototype)
STRUCTURAL → how objects/classes are COMPOSED (Adapter, Decorator, Facade, Proxy, Composite)
BEHAVIORAL → how objects INTERACT/communicate (Observer, Strategy, Command, Iterator, State)
→ the famous "GoF" (Gang of Four) patterns; many others exist too
