Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Smashing CoffeeScript - Alex Hudson

Smashing CoffeeScript

(Autor)

Buch | Softcover
336 Seiten
2013
John Wiley & Sons Inc (Verlag)
978-1-118-45437-4 (ISBN)
CHF 49,95 inkl. MwSt
  • Titel ist leider vergriffen;
    keine Neuauflage
  • Artikel merken
Brew the perfect code with CoffeeScript If you're familiar with JavaScript and the often-frustrating process of creating complex applications, a nice cup of CoffeeScript can help. CoffeeScript is a programming language that compiles into JavaScript and simplifies the entire development process. Now you can tap the full power of CoffeeScript with Smashing CoffeeScript . This full-color, practical book explains CoffeeScript language, syntax, and processes, and will soon have you producing concise and quality code. Ultimately, you'll create RIAs and mobile apps faster, with less hassle. Gets developers up and running on CoffeeScript, a programming language that compiles into JavaScript and simplifies the process of building software Helps you produce better JavaScript and more quickly Introduces the language, syntax, and processes of CoffeeScript Covers the development of both mobile and rich internet apps Explores the HTML5 feature set, real-time communication, and using CoffeeScript within node.js projects Developers, blend some better JavaScript with CoffeeScript and Smashing CoffeeScript .

Alex Hudson i s a technology expert and programmer. A hacker by trade, he likes to keep on top of new technologies. He hacks in C, C#, JavaScript, Perl, PHP, Python, and Vala Primarily, and due to the day job has a keen interest in HTML5, CSS, SQL, and NoSQL.

INTRODUCTION 1 PART I: COFFEESCRIPT BASICS 7 Chapter 1: Starting Up Your CoffeeScript Environment 9 CoffeeScript in the Browser 10 Starting CoffeeScript in Plain HTML 10 Understanding CoffeeScript 11 Compiling CoffeeScript Outside the Browser 12 What Is npm? 12 Installing Coffee Using npm 13 A Quick Tour of npm 13 Installing CoffeeScript 14 Compiling CoffeeScript Code 15 Putting It Together 16 Automatic Compilation 17 Avoiding Coff eeScript Errors 17 Coding in Good Style 18 Coffeelint Will Pick Up Errors 20 Summary 20 Chapter 2: Using jQuery: DOM Manipulation 21 jQuery's Fluent API 22 Th e "DOM Ready" Handler 23 Selectors, Now Even More Usable 24 Comprehensions 25 Working with Functions 26 Functions for Encapsulation 28 Keeping Code DRY 31 Function Parameters and Existential Operators 32 Using Utility Functions 33 Cleaner Click Handlers 36 General Event Handling 37 Page Events 38 Feature Detection for Practical Polyfi ll 40 Detecting CSS Features 41 Summary 42 Chapter 3: Working with Forms 43 Basic HTML5 Forms 44 Collecting Form Data 44 Validating Form Data 45 Systematizing Validation 47 Common Form Techniques 49 Displaying Validation Results Inline 49 Continuous Validation 52 Controlling Submit Button Interaction 54 Prepopulating Form Elements 54 Multi-Step Forms 55 Selective Form Display 55 Validating Partial Form Data 59 Modal Form UI 59 Using Subforms as Data Helpers 61 Summary 62 Chapter 4: AJAX Requests 63 Getting Data to and from the Server 64 HTTP Requests 64 Easily Retrieving Information 66 Cross-origin Request Handling 68 Understanding Browser Request Security 68 JSONP Requests 69 Cross-Origin Resource Sharing 71 Example: User Registration Form 71 Error Handling 78 Generating Errors 79 Detecting Errors 80 Retrying in Case of Temporary Errors 81 Deferring and Cancelling Requests Using Queues 83 Strategies to Defer Requests 84 Strategies to Cancel Requests 86 Local Storage and Offl ine Apps 87 A Short History of Local Storage 87 LocalStorage 88 IndexedDB 90 Comparing Local Storage Options 92 Summary 92 Chapter 5: Object-Oriented Design 93 Classes and Inheritance 94 What Does It Mean To Be Object-Oriented? 94 Functions Versus Objects to Encapsulate 95 Extending Classes 97 Making Classes Substitutable 100 Using this. in Coff eeScript 101 Private and Protected Members 102 Mixins and Interfaces 102 Summary 103 PART II: COFFEESCRIPT PROJECTS 105 Chapter 6: Using Javascript Libraries 107 Easy Calling Conventions: Don't Th row Away that Existing Code! 108 Calling JavaScript from Coff eeScript 108 Calling Coff eeScript from JavaScript 110 Using CommonJS Modules 111 Using Extends on Existing Classes 113 Not All Objects Are Created Equal 113 Writing Javascript Libraries in Coff eeScript 114 Providing a Natural Interface 114 Documenting Code 115 Mixing Javascript--When Absolutely Required 117 Summary 119 Chapter 7: Testing with Jasmine 121 Introducing Jasmine 122 Setting Up a Spec Area to Run Jasmine Tests 122 Writing Jasmine Tests 123 Spying with Jasmine 124 Behavior-Driven Development: What Is a Good Test? 126 Testing Inside the Browser 127 Conventions for Testing the UI 131 Driving jQuery 132 Fixtures 133 Summary 134 Chapter 8: Debugging CoffeeScript 135 Writing Reliable Software 136 Reading and Debugging CoffeeScript and JavaScript 136 Using Firebug 139 Using AceBug 142 Building Source Maps 143 Introducing CoffeeScript Redux 144 Using CoffeeScript Redux 145 Using Source Maps 146 Summary 150 Chapter 9: Building Resources with cake and hem 151 Tasks and the Cakefile 152 Starting with cake 152 Thinking about Project Directory Layout 153 Tests from cake 154 Compile Source into Single Files for Production Deployment 155 hem for Further Minification 156 Using Standardized Locations 157 Summary 158 PART III: COFFEESCRIPT APPLICATION DEVELOPMENT 159 Chapter 10: Writing Applications with Spine 161 Introducing Spine 162 Creating a New Spine Application 163 Building the Application 169 Preparing the Ground 170 Removing jQueryify 171 Styling an Application with Stylus 172 Working with Stylus 172 Taking a Deeper Look at Stylus Features 174 Spine's Default Styls 177 Starting with Controllers 180 Testing Controllers 181 Controlling the Page 182 Adding Controllers 185 Stacking Controllers 186 Viewing the Results 188 Using (j)Eco Templates 188 Data Binding 190 Modelling Client-Side Data 193 Creating a Spine Model 193 Working with Models 195 Triggering Model Events 196 Validating Models 198 Editing Model Data 199 Storing Data on the Server 202 Summary 204 Chapter 11: Writing jQuery Plug-ins 205 Anatomy of a jQuery Plug-in 206 Creating a Skeleton Plug-in 206 Writing a Classful Plug-in 209 Handling Events and Behavior 211 Attaching the Plug-in to jQuery 213 Inheriting from an Existing Plug-in 214 jQuery UI 215 Using Widgets Instead of Plug-ins 215 Writing a Tagging Component 218 Bridging the Divide 222 Summary 225 Chapter 12: Mobile Coff eeScript Applications 227 Understanding Mobile First Principles 228 jQuery and Mobile Applications 229 Spine.mobile 230 Creating an e-Commerce Shop 234 Providing a Product Listing 238 Bringing in jQuery Mobile 243 Jumping and History 250 Summary 254 PART IV: ADVANCED COFFEESCRIPT 255 Chapter 13: Data Bindings and Form Elements 257 One-Way Bindings onto Form Views 258 A Simple Binding Interface 258 Setting Form Data 260 Two-Way Bindings 261 The Infamous "Getter Setter" Pattern 262 Implicit Getter/Setter 264 Observing Changes 265 Dynamic Form Building 268 Form as Model, View, and Controller 270 Summary 270 Chapter 14: Server-Side CoffeeScript 271 Putting Coff ee in the Server 272 Node.js and Coff eeScript 272 Writing a Simple Server 273 Using MongoDB 273 Architecting with MVC 274 Introducing Express.js 275 Responding to Client Requests 279 Rendering Views 280 Controlling Responses 281 Securing the Application 287 Summary 290 Chapter 15: Real-Time Web with socket.io 291 Defi ning Real-Time Applications 292 Polling the Server for Data 292 Comet for Lightweight Polling 293 Server-Side Events and Web Sockets 293 Doing Micro-Blogging in Real Time 294 Integrating Static and Real-Time Data 296 Rendering on the Client Side 296 Reusing Server-Side Code on the Client 298 Sharing Templates 298 Sharing Models 299 Dealing with Callback Pyramids 299 Real-Time Collaboration within a Single App 301 Operational Transformation 302 Separating Input from Operation 302 Building a Meeting Whiteboard App 303 Modeling Information According to OT 306 Serving Simple socket.io Information 307 Handling Remote Updates 308 Summary 311 Index 313

Erscheint lt. Verlag 20.5.2013
Reihe/Serie Smashing Magazine Book Series
Verlagsort New York
Sprache englisch
Maße 188 x 233 mm
Gewicht 752 g
Einbandart Paperback
Themenwelt Informatik Office Programme Outlook
Informatik Web / Internet Web Design / Usability
ISBN-10 1-118-45437-5 / 1118454375
ISBN-13 978-1-118-45437-4 / 9781118454374
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich