EPUB= '' 5 }) => ({ title, description, timeStamp }); 6 7 // later... 8 const birthdayParty = createEvent({ 9 title: 'Birthday Party', 10 description: 'Best party ever!' 11 }); …is better than: 1 const createEvent = ( 2 title = 'Untitled', 3 timeStamp = Date.now(), 4 description = '' 5 ) => ({ title, description, timeStamp }); 6 7 // later... 8 const birthdayParty = createEvent( 9 'Birthday Party', 10 undefined , // This was avoidable 11 'Best party ever!' 12 ); 7. Use parallel code for parallel concepts. “…parallel construction requires that expressions of similar content and function should be outwardly similar. The likeness of form enables the reader to recognize more readily the likeness of content and function.” ∼ William Strunk, Jr., The Elements of Style There are few problems in applications that have not been solved before. We end up doing the same things over and over again. When that happens, it’s an opportunity for abstraction. Identify the parts Elements of JavaScript Style 212 that are the same, and build an abstraction that allows you to supply only the parts that are different. This is exactly what libraries and frameworks do for us. UI components are a great example. Less than a decade ago, it was common to mingle UI updates using jQuery with application logic and network I/O. Then people began to realize that we could apply MVC to web apps on the client-side, and people began to separate models from UI update logic. Eventually, web apps landed on a component mod
Rate this eBook
| File Name: | 2bda75453f231639292b099909cc7299.epub |
| Original Title: | Composing Software |
| Creator / Author: | Eric Elliott |
| Language: | English (en) |
| Identifier: | ASIN:292159 |
| Publisher: | Eric Elliott Publishing |
| Category: | Non-fiction |
| Format: | 📗 EPUB eBook |
| File Size: | 3.5 MB |




