کتاب الکترونیکی

Grails 1.1 توسعه برنامه های کاربردی وب

Grails 1.1 Web Application Development

دانلود کتاب Grails 1.1 Web Application Development (به فارسی: Grails 1.1 توسعه برنامه های کاربردی وب) نوشته شده توسط «Jon Dickinson»


اطلاعات کتاب Grails 1.1 توسعه برنامه های کاربردی وب

موضوع اصلی: شبکه: اینترنت

نوع: کتاب الکترونیکی

ناشر: Packt Publishing

نویسنده: Jon Dickinson

زبان: English

فرمت کتاب: pdf (قابل تبدیل به سایر فرمت ها)

سال انتشار: 2009

تعداد صفحه: 328

حجم کتاب: 3 مگابایت

کد کتاب: 1847196683 , 9781847196682

توضیحات کتاب Grails 1.1 توسعه برنامه های کاربردی وب

ادامه مطلب را اینجا بخوانید: […]

خط برچسب: بازیابی بهره وری برای توسعه سریعتر وب جاوا
مخاطبان هدف توسعه دهندگان جاوا هستند که به دنبال راه هایی برای توسعه سریع تر و آسان تر برنامه های کاربردی وب بدون دور انداختن دانش قبلی خود یا ترک پلت فرم جاوا هستند. Grails از جاوا و سایر کتابخانه های فنی اثبات شده مرتبط در زیر جلد استفاده می کند. نویسنده با توضیح بسیار ساده در مورد اصول اولیه سعی می کند برنامه نویس معمولی جاوا را فریب دهد تا دوباره نگاهی بیندازد. اما کتاب در برخی قسمت‌ها بسیار فنی و پیچیده می‌شود، زیرا قلمروی ناخواسته را لمس می‌کند. دانش قبلی در زمینه توسعه اپلیکیشن وب جاوا الزامی است.

فصل 1: شروع با Grails
در ابتدا بحثی در مورد اینکه چرا باید از Grails استفاده شود و چگونه بر اساس فناوری های اثبات شده مانند Hibernate و Spring است، ارائه شده است. این فصل نکات مهم زیر را به نفع Grails فهرست می کند:

نیاز به پیکربندی کمتر
راه اندازی سریعتر
چرخه توسعه/آزمون کوتاه تر
محیط توسعه سازگار
زبان اختصاصی دامنه برای توسعه وب
وابستگی کمتر
شاید برخی از نکات Grails v Java یا Grails v Rails باشد.
به دنبال آن نصب Grails انجام می شود. فکر می کنم این موضوع بسیار مهمی است و بسیاری از کتاب ها چنین موضوعاتی را پوشش نمی دهند. این قسمت دارای اسکرین شات های ویندوز و مک می باشد. این به دنبال ایجاد یک برنامه جدید به نام کار تیمی با استفاده از دستور ایجاد برنامه است. این اسکلت برای دامنه، نماها، کنترلر، conf، i18n، خدمات کمکی، برچسب ها ایجاد می کند. برای اجرای این برنامه از دستور run-app استفاده می شود.
در سراسر کتاب از یک برنامه پورتال ارتباطی تیمی استفاده شده است. الزامات و معماری این اپلیکیشن به طور خلاصه توضیح داده شده است.

فصل 2: ​​مدیریت کاربران با داربست
این توضیح می دهد که استفاده از داربست و چه صفحات و اقداماتی در نتیجه انتظار می رود. کلاس های دامنه برای برنامه با استفاده از دستور create-domain-class ایجاد می شوند. کنترلرها برای تمام کلاس های دامنه با استفاده از دستور create-controller ایجاد می شوند. داربست def =DomainClassName به طور جادویی تمام کدهای CRUD لازم برای کارکرد برنامه را ایجاد می کند.
Grails به طور پیش فرض از پایگاه داده HSQLDB در حافظه استفاده می کند و در این مرحله هیچ پیکربندی برای شروع این کار لازم نیست. معرفی محدودیت‌های استاتیک به اعتبارسنجی اولیه داده‌ها و تعیین نوع ورودی هنگام ارائه یک فرم کمک می‌کند. این برای این است که برنامه شما سریع اجرا شود، اما من به سختی نمونه واقعی آن را پیدا می کنم. اکثر پایگاه های داده پر از کلیدهای ترکیبی پیچیده و کلیدهای خارجی هستند که با داربست قابل مدل سازی نیستند و نیاز به سفارشی سازی زیادی در Grails دارند.
روابط در این برنامه ایجاد می شود. از آنجایی که Grails از hibernate در زیر پوشش ها استفاده می کند، انواع روابط پشتیبانی شده عبارتند از: یک به یک، یک به چند، چند به چند، چند به چند. بوت استرپ داده ها از طریق کلاس Grails-app/conf/BootStrap انجام می شود که به بارگذاری داده ها در برنامه در هنگام راه اندازی کمک می کند.
به طور خلاصه یک فصل کاملاً بارگذاری شده برای شروع.

فصل 3: ارسال پیام
به نظر من عنوان این فصل به Grails بی ربط است. فصل‌ها باید نام‌های مرتبط با زمینه Grails داشته باشند و نه زمینه کاربرد/مثال. در این فصل، نویسنده در مورد بلوک‌های سازنده اصلی گریل‌ها صحبت می‌کند – کلاس‌های دامنه بیشتر، کنترل‌کننده‌ها و نماهای مربوطه، اعتبارسنجی و GORM (نگاشت رابطه‌ای اشیاء Grail). dateCreated و lastUpdated ویژگی های بسیار ویژه ای از نوع Date در Grails هستند و به صورت خودکار مدیریت می شوند. این بار کنترلر با دستور create-controller ایجاد نمی شود، بلکه یک فایل مستقیماً در دایرکتوری مناسب ایجاد می شود.
صفحات سرور Groovy (GSP) شبیه به JSP معرفی شده اند. سپس کد view ارائه می شود و دوباره از دستور برای create.gsp استفاده نمی شود. Grails از مکانیسم طرح‌بندی ساده و در عین حال قدرتمند SiteMesh استفاده می‌کند که از برچسب‌های g:layoutTitle، g:layoutHead و g:layoutBody استفاده می‌کند. کدهای دستی بیشتری برای نمایش مناسب فرم به همراه یادداشت کوتاهی در مورد برچسب های فرم گریل g:form وجود دارد.
فرم ورودی Grails، اتصال فرم Grails، اعتبارسنجی و چرخه ذخیره Grails به طور خلاصه توضیح داده شده است. محدوده فلش که پیام موفقیت یا شکست را بین دو درخواست HTTP متوالی نگه می دارد، اضافه می شود. redirect برای ارسال کاربر پس از یک عملیات موفقیت آمیز استفاده می شود در حالی که از render برای نشان دادن اطلاعات خطا به کاربر به منظور تصحیح و ارسال مجدد آن استفاده می شود.
ایجاد صفحه اصلی برنامه توضیح داده شده است – دامنه، کنترل کننده و نماها. توضیح مفصلی در مورد لیست کردن همه پیام ها با پرس و جو از پایگاه داده و همچنین پارامترهای معتبر برای روش لیست ارائه شده است. سپس نویسنده توضیح می‌دهد که چگونه صفحه اصلی پیش‌فرض را تغییر دهید تا از طریق عملکرد فهرست کنترل‌کننده خانه انجام شود. این هنگام استفاده از پلاگین هایی مانند cas برای Single Sign On مهم است. شیوه نامه های css با کد موجود با کتاب به روز می شوند. نویسنده با یک بخش عالی در مورد اسکریپت بین سایتی و اعتبار سنجی پایان می دهد. Grails یک برچسب g:message ارائه می‌کند که برای جستجوی پیام‌ها در یک بسته پیام بر اساس کد پیام استفاده می‌شود. این توضیح می دهد که چگونه i18n c


Read more here : […]

Tag Line: Reclaiming Productivity for Faster Java Web Development
The target audience are Java developers looking for ways to develop web applications faster and more easy without throwing away their previous knowledge or leaving the java platform. Grails utilizes Java and other related proven technical libraries under the covers. With very simple explanation of basics the author tries to lure the average Java programmer to take a second look. But the book gets too technical and complex in some parts as it touches unwanted territory. Prior knowledge of java web application development is required.

Chapter 1: Getting Started with Grails
Right upfront an argument is given as to why Grails should be used and how it is based on proved technologies like Hibernate and Spring. The chapter lists the following important points in favor of Grails:-

Requiring less configuration
Faster setup
Shorter develop/test cycle
Consistent development environment
Domain-specific language for web development
Fewer dependencies
Perhaps some of the points would have been Grails v Java or Grails v Rails.
This is followed by installation of Grails. I think this is a very important and many books do not cover such topics. This part is has Windows and Mac screen shots. This follows creation of a new application called teamwork using create-app command. This creates the skeleton for domain, views, controller, conf, i18n, helper services, taglibs. To run this application run-app command is used.
Throughout the book a team communication portal application is used. The requirements and architecture of this application is explained in brief.

Chapter 2: Managing Users with Scaffolding
This explains the use of scaffolding and what pages and actions to expect as a result. Domain classes are created for the application using create-domain-class command. Controllers are created for all the domain classes using create-controller command. The def scaffold =DomainClassName magically creates all the CRUD code necessary for the application to work.
Grails uses in-memory HSQLDB database by default and at this point no configuration is necessary to get this started. Introducing static constraints helps in basic validation of data and to determine which input type is used when rendering a form. This is to get your application running quick but I hardly find a real-life example of this. Most databases are full of complex composite keys and foreign keys which cannot be modeled with scaffolding and need a lot of customization in Grails.
Relationships are created in this application. Since Grails uses hibernate under the covers the supported types of relationships are: One-to-one, One-to-many, Many-to-many, Many-to-many. Bootstrapping of data is done though grails-app/conf/BootStrap class which helps in loading data into the application on start up.
In short a fully loaded chapter to get started.

Chapter 3: Posting Messages
I find the title of this chapter irrelevant to Grails. Chapters should be given names relevant to Grails context and not application/example context. In this chapter the author talks about basic building blocks of grails – more domain classes, respective controllers and views, validation and GORM (Grail’s Object Relational Mapping). dateCreated and lastUpdated are very special properties of type Date in Grails and they are handled automatically. This time the controller is not created with create-controller command but rather a file is directly created in the appropriate directory.
Groovy Server Pages (GSP) are introduced as being similar to JSP. The view code is then provided and again the command is not used for create.gsp. Grails uses simple yet powerful SiteMesh layout mechanism which uses tags g:layoutTitle, g:layoutHead, and g:layoutBody. There is more manual code to get the form appropriately displayed along with a short note about grails form tags g:form
The Grails input form, Grails form binding, validation and save cycle of Grails is explained briefly. The flash scope which holds the success or failure message between two consecutive HTTP requests is added. redirect is used to forward the user after a successful operation while render is used to show error information back to the user in order to correct it and re-send it.
The application home page creation is explained – domain, controller and views. Detailed explanation is provided of listing all messages by querying the database as well as the valid parameters for the list method. The author then explains how to change the default home page to go through the home controller index action. This is important when using plug-ins like cas for Single Sign On. The css style sheets are updated with the code available with the book. The author ends with an excellent section on cross-site scripting and validation. Grails provides a g:message tag that is used to look up messages in a message bundle based on a message code. This explains how i18n can be used in Grails.

Chapter 4: Introduction to Groovy
Groovy is the primary language used in Grails. This chapter covers some high level basics of Groovy with respect to Java, installation, data structures, closures, POGO, metaprogramming, builders. Definition of Groovy along with explanation of its properties are explained – Object Oriented, Dynamic and functional loosely typed. Similarly there are questions why Groovy makes software development simpler : familiar syntax like Java & direct integration into Java. The next phase takes us into how to install and configure Groovy on local PC and Mac. Groovy shell is a command line where you can type up some Groovy code. The Groovy console is a Swing application which allows user to write and execute Groovy scripts. This follows an explanation of difference between Groovy classes v scripts – Groovy scripts having less overhead and simpler to write.
All the basic features of Groovy language are explained including-
Optional Semicolons, different ways to express String, Numbers and utility methods, easier way to work with List, enhanced Maps, Range – which is a new data type to simplify iteration and work with collections, slightly different way to operate with Truth and equality, Closures – blocks of code which can be passed as arguments and executed, Plain Old Groovy Objects (POGO) whose properties are published as getters and setters automatically, Metaprogramming – also called Dynamic Groovy or compile-time metaprogramming and builders. All these features are well explained with simple examples which makes for good understanding of concepts.
This chapter was a welcome adding to the Grails book.

Chapter 5: Authentication with JSecurity Plug-in
This is where the power of Grails lies – the plug-ins! Some basic functionality would be developed as modules by programmers and made available to the world as plug-in. Installing a plug-in and following some simple configuration would give your Grails application some new features with cheap coding. Firstly, I would advise you to be careful of plug-ins since they are a double edged sword – in terms of who have developed them and the testing. Secondly, some plug-ins just don’t work as advertised!!
The author has given example of JSecurity plug-in. This can be an excellent start for someone who is yet to think of a security strategy. Honestly it is scary for those who are new to plug-ins and find it so many pages to go through to get started. I would have loved to play with simple plug-ins like searchable, cas, filter pane. Such plug-ins are more commonly used. The author has used basic idea of users and roles. JSecurity system covers users, roles, permissions, subject, principle and realms (Realm class) . A method is defined to allow authentication. This is where the concept of dynamic finders is introduced. These methods do not exist but the name of method is used by Grails to query against database. There is good coverage of this topic including the operators that can be used for constructing the method name and their limitations. Querying by Criteria is explained with hasRole method which tests if a user has a particular role. Such queries are more complex and more widely used. But the explanation is short. Authentication is added to the Grails application using a Grails Filters which is quick and easy. Password encryption is achieved through Sha1Hash. This spins my head into thinking whether I want to really learn JSecurity or stick with my good old cas filter. It feels I am learning cryptography and not grails! Three more things are discussed which are: 1. Encryption of users’ password: This uses the ‘Open Session in View’ pattern of hibernate which means the object is not persisted until all server-side operations have finished and the author actually changes the password after calling save method – Neat! 2. Permission denied page: This is done by implementing the unauthorized action in AuthController and creating unauthorized.gsp view. 3. Sign Out: This uses the signout tag provided by JSecurity which leads to a table listing of all JSecurity tags. The service layer of Grails and how to inject the service is discussed very briefly.
Hibernate’s lazy loading property and how it affects the relationships in an application is discussed. The n+ 1 problem can be solved with eager loading (lazy:false)
In short, I feel this chapter was more a case study. There is a potpourri of new topics which are all discussed in short – plug-ins, JSecurity, authentication, authorization, encryption of passwords, services, lazy loading, eager loading, relationships to name a few – phew!

Chapter 6: Testing
This chapter starts with a back

دانلود کتاب «Grails 1.1 توسعه برنامه های کاربردی وب»

مبلغی که بابت خرید کتاب می‌پردازیم به مراتب پایین‌تر از هزینه‌هایی است که در آینده بابت نخواندن آن خواهیم پرداخت.