- عنوان کتاب: Crafting Clean Code with JavaScript and React
- نویسنده: Héla Ben Khalfallah
- حوزه: توسعه فرانت
- سال انتشار: 2024
- تعداد صفحه: 443
- زبان اصلی: انگلیسی
- نوع فایل: pdf
- حجم فایل: 3.01 مگابایت
اگر هشت سال پیش در مورد این موضوع بحث میکردیم، شاید من این کتاب را نمینوشتم. چرا؟ در آن زمان، جاوا اسکریپت در درجه اول به عنوان یک “ابزارک” برای اضافه کردن انیمیشنها، مدیریت رویدادهای کلیک دکمه یا انجام سایر وظایف خاص مانند تغییر پویای کد HTML/CSS یا فراخوانی سرویسهای backend دیده میشد. HTML نیروی غالب در توسعه وب بود. با این حال، امروزه نقشها به طرز چشمگیری تغییر کردهاند. با چارچوبهایی مانند Angular، کتابخانههایی مانند React و runtimeهایی مانند Node.js و Deno، جاوا اسکریپت به بازیگر غالب تبدیل شده است. به عبارت دیگر، یک برنامه وب مدرن را میتوان کاملاً با جاوا اسکریپت نوشت، چه در frontend و چه در backend. با توجه به این تغییرات، توسعهدهندگان وب حداقل دو نقش جدید را بر عهده گرفتهاند: نقش یک صنعتگر نرمافزار و نقش یک معمار. چندین سوال نیز مطرح شده است: چگونه میتوانیم با جاوا اسکریپت کد تمیز بنویسیم؟ چگونه باید یک برنامه frontend یا backend را به درستی سازماندهی و معماری کنیم؟ بهترین شیوهها برای دنبال کردن چیست؟ واضح است که وقتی HTML تمرکز اصلی بود، این سوالات مانند الان مطرح نمیشد. من به این تسلط جدید جاوا اسکریپت به عنوان “حباب جاوا اسکریپت” اشاره میکنم. پیش از این، جاوا اسکریپت در سایه HTML و CSS قرار داشت. امروزه، جاوا اسکریپت به شهرت رسیده است. چه چیزی از “حباب جاوا اسکریپت” حاصل شده است؟ توسعه وب به یک پلتفرم برنامهنویسی “واقعی” (یک محیط اجرا و یک زبان برنامهنویسی) تبدیل شده است، دقیقاً مانند سایر محیطهای برنامهنویسی مانند C، C++، جاوا، سوئیفت، کاتلین و غیره. به عنوان مثال، من به عنوان کسی که توسعهدهنده سیستمهای تعبیهشده و سپس توسعهدهنده موبایل بودهام، برنامهنویسی وب را امروز قابل درکتر میدانم زیرا با یک محیط برنامهنویسی “واقعی” کار میکنم، که در درجه اول از جاوا اسکریپت استفاده میکند. این مرا به یاد زمانی میاندازد که با استفاده از C++، GTK، QT و برنامههای رابط کاربری گرافیکی جاوا با Swing، برنامههای گرافیکی توسعه میدادم. در نتیجه، ایجاد ماژولها، اتخاذ معماری ماژولار، استفاده مجدد از کد و تفکر بر اساس مهارت، آسانتر و انعطافپذیرتر است. اما اینها تنها دلایل “حباب جاوا اسکریپت” نیستند. وب اکنون جایگاه اصلی را در زندگی روزمره انسان، چه از طریق تلفنهای هوشمند یا دسکتاپ، چه در خانه، خیابان، قطار یا سوپرمارکت، اشغال کرده است. مردم از وب برای جستجو، انجام حوالههای بانکی، سفارش پیتزا یا رزرو پرواز استفاده میکنند. این افزایش استفاده از اینترنت و وب، نیازها و الزامات دیگری را نیز ایجاد کرده است: امنیت، عملکرد و دسترسی. من به این نیازها با اختصار SAGE(S) اشاره میکنم: معنایی، دسترسیپذیر، سبز، آسان و امن. ما این مفاهیم را در فصلهای آینده به تفصیل بررسی خواهیم کرد.
If we were discussing this topic eight years ago, I might not have written this book. Why? Back then, JavaScript was primarily seen as a “gadget” used to add animations, handle button click events, or perform other specific tasks like dynamically changing HTML/CSS code or calling backend services. HTML was the dominant force in web development. However, today the roles have shifted dramatically. With frameworks like Angular, libraries like React, and runtimes like Node.js and Deno, JavaScript has become the dominant player. In other words, a modern web application can be written entirely in JavaScript, both on the frontend and the backend. Given these changes, web developers have taken on at least two new roles: that of a software craftsman and that of an architect. Several questions have also arisen: How can we write clean code with JavaScript? How should we properly organize and architect a frontend or backend application? What are the best practices to follow? It’s clear that when HTML was the primary focus, these questions didn’t arise as they do now. I refer to this new dominance of JavaScript as “JavaScript Bubbling.” Previously, JavaScript was submerged and overshadowed by HTML and CSS. Today, JavaScript has risen to prominence. What has resulted from “JavaScript Bubbling”? Web development has evolved into a “real” programming platform (a runtime and a programming language), much like other programming environments such as C, C++, Java, Swift, Kotlin, etc. For instance, as someone who was an Embedded Systems Developer and then a Mobile Developer, I find web programming more comprehensible today because I am working with a “real” programming environment, primarily using JavaScript. It reminds me of when I developed graphical applications using C++, GTK, QT, and Java GUI applications with Swing. As a result, it’s easier and more flexible to create modules, adopt a modular architecture, reuse code, and think in terms of craftsmanship. But these aren’t the only reasons for “JavaScript Bubbling.” The Web now occupies a central place in daily human life, whether through smartphones or desktops, whether at home, on the street, on a train, or in a supermarket. People use the Web for searching, making bank transfers, ordering pizzas, or booking flights. This rise of the Internet and web usage has generated additional needs and requirements: security, performance, and accessibility. I refer to these needs with the acronym SAGE(S): Semantic, Accessible, Green, Easy, and Secure. We will explore these concepts in detail in the upcoming chapters.
این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:
نظرات کاربران