- عنوان کتاب: Creational Design Patterns in Java -Designing Flexible, Scalable, and Reliable Software
- نویسنده: Vaskaran Sarcar
- حوزه: برنامهنویسی جاوا
- سال انتشار: 2026
- تعداد صفحه: 167
- زبان اصلی: انگلیسی
- نوع فایل: pdf
- حجم فایل: 2.88 مگابایت
به سفر خود در میان الگوهای طراحی خلاقانه در جاوا خوش آمدید. مفاهیم الگوهای طراحی جهانی هستند و به کارگیری آنها در جاوا فرصتهای جدیدی را برای نوشتن کدهای انعطافپذیر، قابل نگهداری و قابل استفاده مجدد ایجاد میکند. احتمالاً میدانید که الگوهای طراحی از طریق کتاب کلاسیک Gang of Four (GoF) با عنوان الگوهای طراحی: عناصر نرمافزار شیءگرای قابل استفاده مجدد (Addison-Wesley, 1994) محبوب شدند. کتاب GoF مدتها قبل منتشر شده و بر روی ++C تمرکز داشت. برعکس، از زمان تولدش در سال ۱۹۹۵، جاوا با ویژگیهای جدید غنی شده است و اکنون کاملاً بالغ شده است. بنابراین، ممکن است فکر کنید: آیا هنوز به این الگوها نیاز دارم؟ اول، بگذارید به شما بگویم که بسیاری از این الگوها پایه و اساس شیوههای برنامهنویسی امروزی را تشکیل میدهند. در مرحله بعد، الگوهای طراحی نه به ویژگیهای غیرمعمول زبان و نه به ترفندهای برنامهنویسی شگفتانگیز برای غافلگیر کردن دیگران نیاز دارند. اگر یک ویژگی پشتیبانی در دسترس نباشد، ممکن است لازم باشد برای دستیابی به انعطافپذیری و قابلیت استفاده مجدد در درازمدت تلاش بیشتری کنید. بنابراین، جای تعجب نیست که کتاب GoF همچنان پرفروشترین کتاب در آمازون است. کتاب کلاسیک GoF، ۲۳ الگو را در سه دسته دستهبندی کرده است – خلقی، ساختاری و رفتاری. آنها پنج الگو را دستهبندی کردند: کارخانه انتزاعی، روش کارخانه، نمونه اولیه، سازنده و تکلایه (Singleton). الگوهای خلقی در مورد ایجاد اشیاء هستند (بله، اگرچه تکلایه تعداد اشیاء را محدود میکند، اما همچنان خلقی است). در سطح بالا، این الگوها فرآیند نمونهسازی را انتزاعی میکنند و به شما کمک میکنند تا سیستمها را از نحوه ترکیب، ایجاد و نمایش اشیاءشان مستقل کنید. برای روشن شدن موضوع، هنگام پیادهسازی این الگوها، معمولاً میپرسید: “کلمه کلیدی “جدید” را در کجای برنامه خود قرار دهم؟” این تصمیم میتواند میزان اتصال کلاسهای شما را تعیین کند. در طول دوره، کارخانه انتزاعی به امری فرعی تبدیل شد (به “الگوهای طراحی ۱۵ سال بعد: مصاحبهای با اریش گاما، ریچارد هلم و رالف جانسون”، InformIT1 مراجعه کنید). بنابراین، من در این کتابچه در مورد این الگو بحث نکردم. در عوض، بحث در مورد الگوی تزریق وابستگی (DI) را گنجاندم (به جای اینکه آن را به عنوان یک الگوی واحد در نظر بگیریم، برخی از توسعهدهندگان و نویسندگان، DI را مجموعهای از الگوها و اصول میدانند). جالب است بدانید که بعداً، یکی از نویسندگان GoF، رالف جانسون، اذعان کرد که نام این الگو پس از انتشار کتابشان منتشر شده است. او همچنین اظهار داشت که آنها مایلند DI را در ویرایش دوم کتاب خود بگنجانند (به JDD2015 – بیست و یک سال الگوهای طراحی (رالف جانسون)، YouTube2 مراجعه کنید). به همین دلیل است که این کتاب جیبی چهار الگوی GoF و یک الگوی غیر GoF را پوشش میدهد.
Welcome to your journey through Creational Design Patterns in Java. The concepts of design patterns are universal, and applying them in Java opens new opportunities for writing flexible, maintainable, and reusable code. You probably know that the design patterns became popular through the Gang of Four’s (GoF) classic book, Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley, 1994). The GoF book was published long before and focused on C++. On the contrary, since its birth in 1995, Java has been enriched with new features, and it is quite mature now. So, you may think: Do I still need these patterns? First, let me tell you that many of these patterns form the foundation of today’s programming practices. Next, design patterns require neither unusual language features nor amazing programming tricks to surprise others. If a supporting feature is not available, you may need to put some extra effort into achieving long-term flexibility and reusability. So, it’s no surprise that the GoF book remains a bestseller on Amazon. The classical GoF book cataloged 23 patterns into three categories —Creational, Structural, and Behavioral. They grouped five patterns: Abstract Factory, Factory Method, Prototype, Builder, and Singleton under the creational patterns. The creational patterns are about the creation of objects (yes, though the singleton restricts the number of objects, it is still creational). At a high level, these patterns abstract the instantiation process and help you make the systems independent from how their objects are composed, created, and represented. To illustrate, while implementing these patterns, you normally ask: “Where should I place the ‘new’ keyword in my application?” This decision can determine the degree of coupling of your classes. Over the period, the Abstract Factory became peripheral (see “Design Patterns 15 Years Later: An Interview with Erich Gamma, Richard Helm, and Ralph Johnson,” InformIT1). So, I did not discuss this pattern in this pocketbook. Instead, I included the discussion on the Dependency Injection (DI) pattern (instead of considering it as a single pattern, some developers and authors consider DI as a set of patterns and principles). It is interesting to note that later, one of the GoF authors, Ralph Johnson, acknowledged that the name of this pattern came out after their book was published. He also stated that they’d like to include DI in the second edition of their book (see JDD2015 – Twenty-one Years of Design Patterns (Ralph Johnson), YouTube2). This is why this pocketbook covers four GoF patterns and one non-GoF pattern.
این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:
Download: Creational Design Patterns in Java





نظرات کاربران