forked from cyrilis/epub-gen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
62 lines (56 loc) · 138 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Generated by CoffeeScript 1.12.2
(function() {
var EPub, optionsAlice, optionsHtmlPaste, path;
EPub = require("./lib");
path = require("path");
optionsHtmlPaste = {
title: "Simple Test Book",
author: "Cyril Hou",
publisher: "txt.sx",
cover: "https://dn-baiim.qbox.me/54bb3eb8fdadac375c311be9.jpg",
version: 3,
content: [
{
title: "What's the Dam Problem",
author: "Heather Hansman",
excludeFromToc: true,
data: "<div class=\"postField postField--body\" data-scroll=\"native\"><section name=\"b972\" class=\" section--last\"><div class=\"section-divider layoutSingleColumn\"><hr class=\"section-divider\"></div><div class=\"section-content\"><div class=\"section-inner layoutSingleColumn\"><p name=\"1273\" id=\"a1273\" class=\"graf--p graf--first\">The salmon look stressed. Behind the algae-streaked windows at Seattle’s Hiram Chittenden fish ladder they’re bumping heads, flipping in the current, and pointing their narrow jaws upstream.</p><p name=\"f31a\" id=\"f31a\" class=\"graf--p\">To get to this point, they’ve already swum through the Straits of Juan de Fuca and the Puget Sound, and jumped through the first 17 steps of the ladder, which looks like a skinny set of concrete bleachers. Most fish passes aren’t as visible at the Seattle one, which has an observation deck where you can peer into the steps, but the way the fish have to work around a manmade barrier in the river is common. From here, the fish will keep following the current upstream to spawn in the stream where they were born. Anadramous fish are imprinted, Twilight style, in the rivers where they hatched, so depending on where they came from, they’ll still have several more dams to navigate.</p><p name=\"0111\" id=\"a0111\" class=\"graf--p\">There are more than 80,000 dams in the U.S. and nearly all of them have some kind of fish pass. They range from multi-step ladders like the Seattle one to elevators that suck the fish upstream to nature-like diversion canals. Some of them have been in place since the colonists started farming, and in 1890 the state of Washington passed a law that all dams, “wherever food fish are wont to ascend,” needed to include a fishway. The rest of the country eventually followed suit. Now, any new hydropower dam needs to get its fish ladder design cleared by the Federal Energy Regulatory Commission. But there aren’t a ton of new dams going in, and it’s becoming increasingly clear that just because a ladder exists it doesn’t mean that fish are going to figure out how to use it, or want to.</p></div><div class=\"section-inner sectionLayout--outsetColumn\"><figure name=\"e046\" id=\"e046\" class=\"graf--figure postField--outsetCenterImage\"><div class=\"aspectRatioPlaceholder is-locked\" style=\"max-width: 1020px; max-height: 765px;\"><div class=\"aspect-ratio-fill\"></div><img class=\"graf-image\" data-image-id=\"a1*-zwVwLnT7QJQ9HDrvOZCyw.jpeg\" data-width=\"3264\" data-height=\"2448\" data-action=\"zoom\" data-action-value=\"1*-zwVwLnT7QJQ9HDrvOZCyw.jpeg\" src=\"https://dn-baiim.qbox.me/54bb3ee5fdadac375c311c25.jpg\"></div><figcaption class=\"imageCaption\">Spillway of Seattle’s Hiram Chittenden locks. Flickr/<a target=\"_blank\" href=\"https://www.flickr.com/photos/acordova/7039116327/in/photolist-bJ2j3B-eQZK1c-7uR7Q4-H9FWR-oHsUa2-fQ4p9n-p3W1Ss-6QhD9F-abgFSw-55L3pG-nnsZoy-9uvG1f-bv7xqj-daY3HN-bJ2jAR-bJ2jVK-73CqVE-pkeAPx-91grS2-dgg8w4-bv7wfA-bv7x2s-bJ2jaK-bv7wvN-bv7woo-bv7wDQ-bJ2jpg-bJ2ikM-bv7w19-bJ2hEp-dgNvCs-bJ2jMT-iEN3Vt-9uvFM7-6RDxoz-kmzYce-8KZrPr-8KZAog-e848hd-8bpi3y-8bpi7d-d5wCXS-dcmWzN-f5k8FN-dgNtiR-aarCDC-dgNt5j-hTaCFu-91gspc-fkfv3d\" data-href=\"https://www.flickr.com/photos/acordova/7039116327/in/photolist-bJ2j3B-eQZK1c-7uR7Q4-H9FWR-oHsUa2-fQ4p9n-p3W1Ss-6QhD9F-abgFSw-55L3pG-nnsZoy-9uvG1f-bv7xqj-daY3HN-bJ2jAR-bJ2jVK-73CqVE-pkeAPx-91grS2-dgg8w4-bv7wfA-bv7x2s-bJ2jaK-bv7wvN-bv7woo-bv7wDQ-bJ2jpg-bJ2ikM-bv7w19-bJ2hEp-dgNvCs-bJ2jMT-iEN3Vt-9uvFM7-6RDxoz-kmzYce-8KZrPr-8KZAog-e848hd-8bpi3y-8bpi7d-d5wCXS-dcmWzN-f5k8FN-dgNtiR-aarCDC-dgNt5j-hTaCFu-91gspc-fkfv3d\" class=\"markup--anchor markup--figure-anchor\" rel=\"nofollow\">acordova</a></figcaption></figure></div><div class=\"section-inner layoutSingleColumn\"><p name=\"3aea\" id=\"a3aea\" class=\"graf--p graf--startsWithDoubleQuote\">“We found that, in general, engineered fish ladders have not performed up to everyone’s expectation,” says John Waldman, author of<em class=\"markup--em markup--p-em\">Running Silver: Restoring Atlantic Rivers and Their Great Fish Migrations</em> and a recent study about how migratory fish navigate dams. The numbers from the study were grim. Less than three percent of American shad, for instance, were making it back upstream to their spawning grounds.</p><p name=\"e451\" id=\"e451\" class=\"graf--p\">All fish migrate to a degree, but dams have the biggest disrupting force on anadramous fish, like salmon or shad, which spawn in rivers but spend most of their lives in the ocean, and catadramous ones, like eel, which live in freshwater, but swim out into the ocean to do it.</p><p name=\"b0f8\" id=\"b0f8\" class=\"graf--p\">There are other factors, like overfishing and climate change, which also hurt declining fish populations, but dams are the most obvious, and because of that, environmental engineers, dam operators, and fish biologists have been trying, with limited success, to design ways for fish to get past them.</p><p name=\"e1a5\" id=\"e1a5\" class=\"graf--p\">In the middle of last century, dams were seen as the answer to a wide range of issues, from water supply to energy security. JFK boosted dam building in his campaign speeches. From the 1920s to the ‘70s, the Army Corps of Engineers built tens of thousands of dams, ones like the Columbia River’s Grand Coulee, which has cut off more access to fish habitat than any other structure in the world. That boom in dam building took a toll. “Many fishways were originally designed for adult salmon over 50 years ago, but we’ve recently found that they don’t work well for other species,” says USGS fish biologist Alexander Haro.</p><p name=\"3a71\" id=\"a3a71\" class=\"graf--p\">He’s trying to find ways to make them more appealing. At the Conte Anadramous Fish Branch, in Massachusetts, Haro sends fish through a respirometer to see how much energy they exert when they’re stressed, and through what he calls a “sprint swimming flume,” to see how fast they can swim and for how long. “It’s kind of like a high-speed treadmill for fish,” he says. He’ll use that data to try to design fishways that actually work.</p><p name=\"2837\" id=\"a2837\" class=\"graf--p\">The biggest issue, according to Jim Taurek, a NOAA restoration ecologist, is that different fish swim very differently. Some, like salmon, can jump high and sprint, while others — sturgeon for instance — mosey upstream. Alewife freak out in confined spaces and shad don’t like air bubbles.</p><p name=\"4570\" id=\"a4570\" class=\"graf--p\">Because of that, there are almost as many ways to design a passage as there are fish trying to swim through it. “In general, the lower the slope of a fishway, the easier fish can ascend, but that also means the fishway needs to be longer, and many fish will not stay in a fishway structure for very long,” Haro says. It’s possible to have a theoretically perfectly designed ladder that keeps fish stranded on the bottom, because they don’t like its style.</p></div><div class=\"section-inner sectionLayout--outsetColumn\"><figure name=\"72dc\" id=\"a72dc\" class=\"graf--figure postField--outsetCenterImage\"><div class=\"aspectRatioPlaceholder is-locked\" style=\"max-width: 1020px; max-height: 680px;\"><div class=\"aspect-ratio-fill\"></div><img class=\"graf-image\" data-image-id=\"a1*Gp4-XDgUw0jvKEgK9LInKw.jpeg\" data-width=\"1200\" data-height=\"800\" data-action=\"zoom\" data-action-value=\"1*Gp4-XDgUw0jvKEgK9LInKw.jpeg\" src=\"https://dn-baiim.qbox.me/54bb3eadfdadac375c311bda.jpg\"></div><figcaption class=\"imageCaption\">French Lake Dam fish ladder, Wichita Mountains Wildlife Refuge, Oklahoma. Flickr/<a target=\"_blank\" href=\"https://www.flickr.com/photos/lsmith2010/14442265487/in/photolist-o1donn-f4Di9G-ojrTS6-8ut2AT-55wRSV-5PjiW9-hZcSXc-p1eZ8a-7pSen7-71rTyU-56DJpD-hc7bxS-5X4yX5-o3o9yk-agacdQ-5EvKrm-f7RMX-dWuZyS-fs1R9h-ewH3Fv-4EmseE-4EmsLo-q1mBer-jTkFt-61Kwuc-5oUEak-ebk2hy-4RrwTc-nUajVq-8KZrPr-jSVn1-7DfSn1-47v92-9PQvJ1-h7ahu-a5cRZb-9Q3Cgf-sSP9-9Aftud-6tB18W-fmxw91-9eZs2J-pip3HJ-55VKBQ-awBq5i-iMYJ4-47viD-cHhNa5-mDiCJP-o59ARA\" data-href=\"https://www.flickr.com/photos/lsmith2010/14442265487/in/photolist-o1donn-f4Di9G-ojrTS6-8ut2AT-55wRSV-5PjiW9-hZcSXc-p1eZ8a-7pSen7-71rTyU-56DJpD-hc7bxS-5X4yX5-o3o9yk-agacdQ-5EvKrm-f7RMX-dWuZyS-fs1R9h-ewH3Fv-4EmseE-4EmsLo-q1mBer-jTkFt-61Kwuc-5oUEak-ebk2hy-4RrwTc-nUajVq-8KZrPr-jSVn1-7DfSn1-47v92-9PQvJ1-h7ahu-a5cRZb-9Q3Cgf-sSP9-9Aftud-6tB18W-fmxw91-9eZs2J-pip3HJ-55VKBQ-awBq5i-iMYJ4-47viD-cHhNa5-mDiCJP-o59ARA\" class=\"markup--anchor markup--figure-anchor\" rel=\"nofollow\">lsmith2010</a></figcaption></figure></div><div class=\"section-inner layoutSingleColumn\"><p name=\"0509\" id=\"a0509\" class=\"graf--p\">In addition to figuring out the size and shape of the structure you also need to design an appealing entrance, and to make sure the river flow points the fish in the right direction. Salmon can’t use an elevator if they can’t find the door. “Building fish ladders, even thought it’s engineering, it’s also art,” Waldman says.</p><p name=\"803d\" id=\"a803d\" class=\"graf--p\">Then you have to engineer the other side, for downstream fish migration. That’s simpler from a design perspective — the hardest part is teasing the fish out of the main current and into the fish pass — but it can be complicated from the financial side. Running water around the dam is the simplest solution, but utilities make their money on river flows, so they’re hesitant to spill a single drop.</p><p name=\"8274\" id=\"a8274\" class=\"graf--p\">Because of that the workarounds are myriad. Taurek says they’ve tried to truck juvenile fish to less-dammed rivers before they start migrating. That way, when they want to spawn, they come back to the new river. He says it works pretty well, but it’s not cheap and it doesn’t really address the heart of the issue.</p><figure name=\"bf6d\" id=\"bf6d\" class=\"graf--figure postField--outsetLeftImage\"><div class=\"aspectRatioPlaceholder is-locked\" style=\"max-width: 525px; max-height: 700px;\"><div class=\"aspect-ratio-fill\"></div><img class=\"graf-image\" data-image-id=\"a1*lvHBjnavz12mkcqq7lhnpQ.jpeg\" data-width=\"1200\" data-height=\"1600\" data-action=\"zoom\" data-action-value=\"1*lvHBjnavz12mkcqq7lhnpQ.jpeg\" src=\"https://dn-baiim.qbox.me/54bb3e83fdadac375c311bab.jpg\"></div><figcaption class=\"imageCaption\">The salmon ladder at the Bonneville Dam on the Columbia River in Oregon. Flickr/<a target=\"_blank\" href=\"https://www.flickr.com/photos/snowmail/12800308103\" data-href=\"https://www.flickr.com/photos/snowmail/12800308103\" class=\"markup--anchor markup--figure-anchor\" rel=\"nofollow\">snowmail</a></figcaption></figure><p name=\"6ef4\" id=\"a6ef4\" class=\"graf--p\">Other creative alternatives tend to be expensive, resource intensive (it’s not uncommon for the Department of National Resources to fly fish around dams by helicopter), or slightly crazy. One alternative, Washington-based Whooshh Innovations’ Salmon Cannon (yes, it is exactly what it sounds like), got spoofed on<a target=\"_blank\" href=\"https://www.youtube.com/watch?v=l9qA8c-E_oA\" data-href=\"https://www.youtube.com/watch?v=l9qA8c-E_oA\" class=\"markup--anchor markup--p-anchor\" rel=\"nofollow\">John Oliver’s Last Week Tonight</a>. “Clearly this is the best object that’s ever been invented,” Oliver said, as he launched fish into Jon Stewart’s studio. It seems ridiculous, but the Washington Department of Fish & Wildlife bought one, and started testing it with hatchery fish on the Washougal River in September. Whooshh says it’s less stressful on the fish, and can be used to get them over any height dam, but its actual usability is still unproven.</p><p name=\"3cb3\" id=\"a3cb3\" class=\"graf--p\">As the ageing U.S. dams start to break down, and more empirical evidence shows that fish populations are being depleted, there’s been a growing movement to eliminate dams all together. The non-profit advocacy group American Rivers has a whole department dedicated to dam removal. Last year, a documentary,<a target=\"_blank\" href=\"https://vimeo.com/ondemand/damnation/89928979\" data-href=\"https://vimeo.com/ondemand/damnation/89928979\" class=\"markup--anchor markup--p-anchor\" rel=\"nofollow\">DamNation</a>, won the Audience Choice award at South by Southwest and galvanized environmentalists and river lovers to take down dams, sometimes with Ed Abbey-style monkeywrenching strategies.</p><p name=\"d57b\" id=\"d57b\" class=\"graf--p\">There’s weight behind their goals, if not always their techniques. When you get rid of a dam, fish come back, often in exponential numbers and at awesome speeds. When the Edwards Dam on Maine’s Sebasticook River came down in 1999, the alewife population went from zero to three million in 10 years. In 2011, the National Park Service<a target=\"_blank\" href=\"https://www.youtube.com/watch?v=4LxMHmw3Z-U\" data-href=\"https://www.youtube.com/watch?v=4LxMHmw3Z-U\" class=\"markup--anchor markup--p-anchor\" rel=\"nofollow\">blew up two dams</a> on the Elwha River in Olympic National Park. It was the largest dam removal in history, and now, three years later, Chinook salmon are spawning in upstream habitats for the first time in 100 years.</p></div><div class=\"section-inner sectionLayout--outsetColumn\"><figure name=\"0870\" id=\"a0870\" class=\"graf--figure postField--outsetCenterImage\"><div class=\"aspectRatioPlaceholder is-locked\" style=\"max-width: 1020px; max-height: 681px;\"><div class=\"aspect-ratio-fill\"></div><img class=\"graf-image\" data-image-id=\"a1*GIU0UrBeoHKRVZLLNygQ8Q.jpeg\" data-width=\"1200\" data-height=\"801\" data-action=\"zoom\" data-action-value=\"1*GIU0UrBeoHKRVZLLNygQ8Q.jpeg\" src=\"https://dn-baiim.qbox.me/54bb4a3ea44ad6bf2b3a06bd.jpg\"></div><figcaption class=\"imageCaption\">The Elwha dam before it was removed.</figcaption></figure></div><div class=\"section-inner layoutSingleColumn\"><p name=\"637f\" id=\"a637f\" class=\"graf--p\">But it’s not that straightforward, which is why scientists are still trying to design the perfect fish passage. “A lot of people talk a good story, like, ‘Let’s just take that dam out,’” Taurek says. “That’s our preference, but in a lot of cases because of the social challenges, you’ve got to have alternatives.” Aside from power generation — about seven percent of U.S. power comes from hydro and in Washington State it’s as high as 75 percent — many dams are now embedded into the cultural and physical geography around them. We use reservoirs for drinking water, and, especially in old mill towns in the Northeast, the town infrastructure has built up around the dam. Plus, it’s expensive to knock out a dam and rebuild an ecosystem. The Elwha project cost $26.9 million.</p><p name=\"ce81\" id=\"ce81\" class=\"graf--p\">So what’s the solution? Given the options, blasting fish over dams in air cannons doesn’t sound quite as outlandish as you might think. Waldman and Taurek advocate for nature-like fishways, meandering streams that go around dams and mimic the native ecosystem. They say they’re the best alternative for fish viability, but, because they need to be low angle, and require a lot of land, they don’t make sense in many situations, especially on high head hydro dams in the West. “I’m not totally anti fish ladder,” Waldman says, “there are some small rivers and streams where fish ladders work great for river herring, but I think all dams should have an existential crisis, to see if they’re really necessary.”</p><p name=\"5bd1\" id=\"a5bd1\" class=\"graf--p graf--last\">But for now, the only things having existential crises are probably the fish, who are working their way back to where they’re from, thrown off by weirs and ladders. It’s not clear if fish even have feelings, but as the Seattle salmon thrash against the glass, it’s easy to imagine them questioning what kind of madness brought them to this point.</p></div></div></section></div>"
}, {
author: ["PhotoEl"],
beforeToc: true,
data: "<h1>Learning JavaScript Design Patterns</h1>\n<a href=\"filenametest.xhtml\">Test custom file link</a>\n<div lang=\"en\"><div id=\"RIL_IMG_1\" class=\"RIL_IMG loaded\"><img src=\"https://dn-baiim.qbox.me/54bb3e8dfdadac375c311bb8.jpg\"><caption><cite></cite></caption></div><p nodeindex=\"14\">Design patterns are reusable solutions to commonly occurring problems in software design. They are both exciting and a fascinating topic to explore in any programming language.</p><p nodeindex=\"15\">One reason for this is that they help us build upon the combined experience of many developers that came before us and ensure we structure our code in an optimized way, meeting the needs of problems we're attempting to solve.</p><p nodeindex=\"16\">Design patterns also provide us a common vocabulary to describe solutions. This can be significantly simpler than describing syntax and semantics when we're attempting to convey a way of structuring a solution in code form to others.</p><p nodeindex=\"17\">In this book we will explore applying both classical and modern design patterns to the JavaScript programming language.</p><h2 nodeindex=\"18\">Target Audience</h2><p nodeindex=\"19\">This book is targeted at professional developers wishing to improve their knowledge of design patterns and how they can be applied to the JavaScript programming language.</p><p nodeindex=\"20\">Some of the concepts covered (closures, prototypal inheritance) will assume a level of basic prior knowledge and understanding. If you find yourself needing to read further about these topics, a list of suggested titles is provided for convenience.</p><p nodeindex=\"21\">If you would like to learn how to write beautiful, structured and organized code, I believe this is the book for you.</p><h2 nodeindex=\"22\">Acknowledgments</h2><p nodeindex=\"23\">I will always be grateful for the talented technical reviewers who helped review and improve this book, including those from the community at large. The knowledge and enthusiasm they brought to the project was simply amazing. The official technical reviewers tweets and blogs are also a regular source of both ideas and inspiration and I wholeheartedly recommend checking them out.</p><ul nodeindex=\"25\"><li nodeindex=\"24\">Nicholas Zakas (<a href=\"http://nczonline.net/\" nodeindex=\"1775\">http://nczonline.net</a>,<a href=\"http://twitter.com/slicknet\" nodeindex=\"1776\">@slicknet</a>)</li><li nodeindex=\"26\">Andrée Hansson (<a href=\"http://andreehansson.se/\" nodeindex=\"1777\">http://andreehansson.se</a>,<a href=\"http://twitter.com/peolanha\" nodeindex=\"1778\">@peolanha</a>)</li><li nodeindex=\"27\">Luke Smith (<a href=\"http://lucassmith.name\" nodeindex=\"1779\">http://lucassmith.name</a>,<a href=\"http://twitter.com/ls_n\" nodeindex=\"1780\">@ls_n</a>)</li><li nodeindex=\"28\">Eric Ferraiuolo (<a href=\"http://ericf.me/\" nodeindex=\"1781\">http://ericf.me/</a>,<a href=\"https://twitter.com/ericf\" nodeindex=\"1782\">@ericf</a>)</li><li nodeindex=\"29\">Peter Michaux (<a href=\"http://michaux.ca\" nodeindex=\"1783\">http://michaux.ca</a>,<a href=\"http://twitter.com/petermichaux\" nodeindex=\"1784\">@petermichaux</a>)</li><li nodeindex=\"30\">Alex Sexton (<a href=\"http://alexsexton.com\" nodeindex=\"1785\">http://alexsexton.com</a>,<a href=\"http://twitter.com/slexaxton\" nodeindex=\"1786\">@slexaxton</a>)</li></ul><p nodeindex=\"31\">I would also like to thank Rebecca Murphey (<a href=\"http://rebeccamurphey.com\" nodeindex=\"1787\">http://rebeccamurphey.com</a>,<a href=\"http://twitter.com/rmurphey\" nodeindex=\"1788\">@rmurphey</a>) for providing the inspiration to write this book and more importantly, continue to make it both available on GitHub and via O'Reilly.</p><p nodeindex=\"32\">Finally, I would like to thank my wonderful wife Ellie, for all of her support while I was putting together this publication.</p><h2 nodeindex=\"33\">Credits</h2><p nodeindex=\"34\">Whilst some of the patterns covered in this book were implemented based on personal experience, many of them have been previously identified by the JavaScript community. This work is as such the production of the combined experience of a number of developers. Similar to Stoyan Stefanov's logical approach to preventing interruption of the narrative with credits (in<em nodeindex=\"1789\">JavaScript Patterns</em>), I have listed credits and suggested reading for any content covered in the references section.</p><p nodeindex=\"35\">If any articles or links have been missed in the list of references, please accept my heartfelt apologies. If you contact me I'll be sure to update them to include you on the list.</p><h2 nodeindex=\"36\">Reading</h2><p nodeindex=\"37\">Whilst this book is targeted at both beginners and intermediate developers, a basic understanding of JavaScript fundamentals is assumed. Should you wish to learn more about the language, I am happy to recommend the following titles:</p><ul nodeindex=\"39\"><li nodeindex=\"38\"><em nodeindex=\"1790\">JavaScript: The Definitive Guide</em> by David Flanagan</li><li nodeindex=\"40\"><em nodeindex=\"1791\">Eloquent JavaScript</em> by Marijn Haverbeke</li><li nodeindex=\"41\"><em nodeindex=\"1792\">JavaScript Patterns</em> by Stoyan Stefanov</li><li nodeindex=\"42\"><em nodeindex=\"1793\">Writing Maintainable JavaScript</em> by Nicholas Zakas</li><li nodeindex=\"43\"><em nodeindex=\"1794\">JavaScript: The Good Parts</em> by Douglas Crockford</li></ul><h1 nodeindex=\"44\"><em nodeindex=\"1795\">Table Of Contents</em></h1><h1 id=\"introduction\" nodeindex=\"94\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#introduction\" class=\"subhead-link\" nodeindex=\"1796\">#</a> Introduction</h1><p nodeindex=\"95\">One of the most important aspects of writing maintainable code is being able to notice the recurring themes in that code and optimize them. This is an area where knowledge of design patterns can prove invaluable.</p><p nodeindex=\"96\">In the first part of this book, we will explore the history and importance of design patterns which can really be applied to any programming language. If you're already sold on or are familiar with this history, feel free to skip to the chapter \"<a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#whatisapattern\" nodeindex=\"1797\">What is a Pattern?</a>\" to continue reading.</p><p nodeindex=\"97\">Design patterns can be traced back to the early work of an architect named<a href=\"http://www.wikiwand.com/en/Christopher_Alexander\" nodeindex=\"1798\" data-new-link=\"http://www.wikiwand.com/en/Christopher_Alexander\" data-noreplace=\"1\">Christopher Alexander</a>. He would often write publications about his experience in solving design issues and how they related to buildings and towns. One day, it occurred to Alexander that when used time and time again, certain design constructs lead to a desired optimal effect.</p><p nodeindex=\"98\">In collaboration with Sara Ishikawa and Murray Silverstein, Alexander produced a pattern language that would help empower anyone wishing to design and build at any scale. This was published back in 1977 in a paper titled \"A Pattern Language\", which was later released as a complete hardcover<a href=\"http://www.amazon.co.uk/Pattern-Language-Buildings-Construction-Environmental/dp/0195019199/ref=sr_1_1?s=books&ie=UTF8&qid=1329440685&sr=1-1&tag=rnwap-20\" nodeindex=\"1799\">book</a>.</p><p nodeindex=\"99\">Some 30 years ago, software engineers began to incorporate the principles Alexander had written about into the first documentation about design patterns, which was to be a guide for novice developers looking to improve their coding skills. It's important to note that the concepts behind design patterns have actually been around in the programming industry since its inception, albeit in a less formalized form.</p><p nodeindex=\"100\">One of the first and arguably most iconic formal works published on design patterns in software engineering was a book in 1995 called<em nodeindex=\"1800\">Design Patterns: Elements Of Reusable Object-Oriented Software</em>. This was written by<a href=\"http://www.wikiwand.com/en/Erich_Gamma\" nodeindex=\"1801\" data-new-link=\"http://www.wikiwand.com/en/Erich_Gamma\" data-noreplace=\"1\">Erich Gamma</a>,<a href=\"http://en.wikipedia.org/w/index.php?title=Richard_Helm&action=edit&redlink=1\" nodeindex=\"1802\" data-noreplace=\"1\">Richard Helm</a>,<a href=\"http://www.wikiwand.com/en/Ralph_Johnson\" nodeindex=\"1803\" data-new-link=\"http://www.wikiwand.com/en/Ralph_Johnson\" data-noreplace=\"1\">Ralph Johnson</a> and<a href=\"http://www.wikiwand.com/en/John_Vlissides\" nodeindex=\"1804\" data-new-link=\"http://www.wikiwand.com/en/John_Vlissides\" data-noreplace=\"1\">John Vlissides</a> - a group that became known as the Gang of Four (or GoF for short).</p><p nodeindex=\"101\">The GoF's publication is considered quite instrumental to pushing the concept of design patterns further in our field as it describes a number of development techniques and pitfalls as well as providing twenty-three core Object-Oriented design patterns frequently used around the world today. We will be covering these patterns in more detail in the section \"Categories of Design Patterns\".</p><p nodeindex=\"102\">In this book, we will take a look at a number of popular JavaScript design patterns and explore why certain patterns may be more suitable for your projects than others. Remember that patterns can be applied not just to vanilla JavaScript (i.e standard JavaScript code), but also to abstracted libraries such as<a href=\"http://jquery.com\" nodeindex=\"1805\">jQuery</a> or<a href=\"http://dojotoolkit.org\" nodeindex=\"1806\">dojo</a> as well. Before we begin, let’s look at the exact definition of a \"pattern\" in software design.</p><h1 id=\"whatisapattern\" nodeindex=\"103\">What is a Pattern?</h1><p nodeindex=\"104\">A pattern is a reusable solution that can be applied to commonly occurring problems in software design - in our case - in writing JavaScript web applications. Another way of looking at patterns are as templates for how we solve problems - ones which can be used in quite a few different situations.</p><p nodeindex=\"105\">So, why is it important to understand patterns and be familiar with them? Design patterns have three main benefits:</p><p nodeindex=\"111\">Patterns are<strong nodeindex=\"1807\">not</strong> an exact solution. It’s important that we remember the role of a pattern is merely to provide us with a solution scheme. Patterns don’t solve all design problems nor do they replace good software designers, however, they<strong nodeindex=\"1808\">do</strong> support them. Next we’ll take a look at some of the other advantages patterns have to offer.</p><ul nodeindex=\"113\"><li nodeindex=\"112\"><strong nodeindex=\"1809\">Reusing patterns assists in preventing minor issues that can cause major problems in the application development process.</strong> What this means is when code is built on proven patterns, we can afford to spend less time worrying about the structure of our code and more time focusing on the quality of our overall solution. This is because patterns can encourage us to code in a more structured and organized fashion avoiding the need to refactor it for cleanliness purposes in the future.</li></ul><ul nodeindex=\"115\"><li nodeindex=\"114\"><strong nodeindex=\"1810\">Patterns can provide generalized solutions which are documented in a fashion that doesn't require them to be tied to a specific problem.</strong> This generalized approach means that regardless of the application (and in many cases the programming language) we are working with, design patterns can be applied to improve the structure of our code.</li><li nodeindex=\"116\"><strong nodeindex=\"1811\">Certain patterns can actually decrease the overall file-size footprint of our code by avoiding repetition.</strong> By encouraging developers to look more closely at their solutions for areas where instant reductions in<span id=\"internal-source-marker_0.982673292361492\" nodeindex=\"1812\">repetition</span> can be made, e.g. reducing the number of functions performing similar processes in favor of a single generalized function, the overall size of our codebase can be decreased. This is also known as making code more<em nodeindex=\"1813\">DRY</em>.</li><li nodeindex=\"117\"><strong nodeindex=\"1814\">Patterns add to a developer's vocabulary, which makes communication faster.</strong></li><li nodeindex=\"118\"><strong nodeindex=\"1815\">Patterns that are frequently used can be improved over time by harnessing the collective experiences other developers using those patterns contribute back to the design pattern community.</strong> In some cases this leads to the creation of entirely new design patterns whilst in others it can lead to the provision of improved guidelines on how specific patterns can be best used. This can ensure that pattern-based solutions continue to become more robust than ad-hoc solutions may be.</li></ul><h3 nodeindex=\"119\">We already use patterns everyday</h3><p nodeindex=\"120\">To understand how useful patterns can be, let's review a very simple element selection problem that the jQuery library solves for us.</p><p nodeindex=\"121\">Imagine that we have a script where for each DOM element found on a page with class \"foo\" we wish to increment a counter. What's the most efficient way to query for this collection of elements? Well, there are a few different ways this problem could be tackled:</p><ol nodeindex=\"123\"><li nodeindex=\"122\">Select all of the elements in the page and then store references to them. Next, filter this collection and use regular expressions (or another means) to only store those with the class \"foo\".</li><li nodeindex=\"124\">Use a modern native browser feature such as<code nodeindex=\"1816\">querySelectorAll()</code> to select all of the elements with the class \"foo\".</li><li nodeindex=\"125\">Use a native feature such as<code nodeindex=\"1817\">getElementsByClassName()</code> to similarly get back the desired collection.</li></ol><p nodeindex=\"126\">So, which of these options is the fastest? It's actually option 3. by a factor of 8-10 times the<a href=\"http://jsperf.com/getelementsbyclassname-vs-queryselectorall/5\" nodeindex=\"1818\">alternatives</a>. In a real-world application however, 3. will not work in versions of Internet Explorer below 9 and thus it's necessary to use 1. where both 2. and 3. aren't supported.</p><p nodeindex=\"127\">Developers using jQuery don't have to worry about this problem however, as it's luckily abstracted away for us using the<em nodeindex=\"1819\">Facade</em> pattern. As we'll review in more detail later, this pattern provides a simple set of abstracted interfaces (e.g<code nodeindex=\"1820\">$el.css()</code>,<code nodeindex=\"1821\">$el.animate()</code>) to several more complex underlying bodies of code. As we've seen, this means less time having to be concerned about implementation level details.</p><p nodeindex=\"128\">Behind the scenes, the library simply opts for the most optimal approach to selecting elements depending on what our current browser supports and we just consume the abstraction layer.</p><p nodeindex=\"129\">We're probably all also familiar with jQuery's<code nodeindex=\"1822\">$(\"selector\")</code>. This is significantly more easy to use for selecting HTML elements on a page versus having to manually opt for<code nodeindex=\"1823\">getElementById()</code>,<code nodeindex=\"1824\">getElementsByClassName()</code>,<code nodeindex=\"1825\">getElementByTagName</code> and so on.</p><p nodeindex=\"130\">Although we know that<code nodeindex=\"1826\">querySelectorAll()</code> attempts to solve this problem, compare the effort involved in using jQuery's Facade interfaces vs. selecting the most optimal selection paths ourselves. There's no contest! Abstractions using patterns can offer real-world value.</p><p nodeindex=\"131\">We'll be looking at this and more design patterns later on in the book.</p><h1 id=\"patternity\" nodeindex=\"132\">\"Pattern\"-ity Testing, Proto-Patterns & The Rule Of Three</h1><p nodeindex=\"133\">Remember that not every algorithm, best practice or solution represents what might be considered a complete pattern. There may be a few key ingredients here that are missing and the pattern community is generally wary of something claiming to be one unless it has been heavily vetted. Even if something is presented to us which<strong nodeindex=\"1827\">appears</strong> to meet the criteria for a pattern, it should not be considered one until it has undergone suitable periods of scrutiny and testing by others.</p><p nodeindex=\"134\">Looking back upon the work by Alexander once more, he claims that a pattern should both be a process and a \"thing\". This definition is obtuse on purpose as he follows by saying that it is the process which should create the \"thing\". This is a reason why patterns generally focus on addressing a visually identifiable structure i.e we should be able to visually depict (or draw) a picture representing the structure that placing the pattern into practice results in.</p><p nodeindex=\"135\">In studying design patterns, it's not irregular to come across the term \"proto-pattern\". What is this? Well, a pattern that has not yet been known to pass the \"pattern\"-ity tests is usually referred to as a proto-pattern. Proto-patterns may result from the work of someone that has established a particular solution that is worthy of sharing with the community, but may not have yet had the opportunity to have been vetted heavily due to its very young age.</p><p nodeindex=\"136\">Alternatively, the individual(s) sharing the pattern may not have the time or interest of going through the \"pattern\"-ity process and might release a short description of their proto-pattern instead. Brief descriptions or snippets of this type of pattern are known as patlets.</p><p nodeindex=\"137\">The work involved in fully documenting a qualified pattern can be quite daunting. Looking back at some of the earliest work in the field of design patterns, a pattern may be considered \"good\" if it does the following:</p><ul type=\"disc\" nodeindex=\"139\"><li nodeindex=\"138\"><strong nodeindex=\"1828\">Solves a particular problem</strong>: Patterns are not supposed to just capture principles or strategies. They need to capture solutions. This is one of the most essential ingredients for a good pattern.</li><li nodeindex=\"140\"><strong nodeindex=\"1829\">The solution to this problem cannot be obvious</strong>: We can find that problem-solving techniques often attempt to derive from well-known first principles. The best design patterns usually provide solutions to problems indirectly - this is considered a necessary approach for the most challenging problems related to design.</li><li nodeindex=\"141\"><strong nodeindex=\"1830\">The concept described must have been proven</strong>: Design patterns require proof that they function as described and without this proof the design cannot be seriously considered. If a pattern is highly speculative in nature, only the brave may attempt to use it.</li><li nodeindex=\"142\"><strong nodeindex=\"1831\">It must describe a relationship</strong>: In some cases it may appear that a pattern describes a type of module. Although an implementation may appear this way, the official description of the pattern must describe much deeper system structures and mechanisms that explain its relationship to code.</li></ul><p nodeindex=\"143\">We would be forgiven for thinking that a proto-pattern which fails to meet guidelines isn't worth learning from, however, this is far from the truth. Many proto-patterns are actually quite good. I’m not saying that all proto-patterns are worth looking at, but there are quite a few useful ones in the wild that could assist us with future projects. Use best judgment with the above list in mind and you’ll be fine in your selection process.</p><p nodeindex=\"144\">One of the additional requirements for a pattern to be valid is that they display some recurring phenomenon. This is often something that can be qualified in at least three key areas, referred to as the<em nodeindex=\"1832\">rule of three</em>. To show recurrence using this rule, one must demonstrate:</p><ol start=\"1\" type=\"1\" nodeindex=\"146\"><li nodeindex=\"145\"><strong nodeindex=\"1833\">Fitness of purpose</strong> - how is the pattern considered successful?</li><li nodeindex=\"147\"><strong nodeindex=\"1834\">Usefulness</strong> - why is the pattern considered successful?</li><li nodeindex=\"148\"><strong nodeindex=\"1835\">Applicability</strong> - is the design worthy of being a pattern because it has wider applicability? If so, this needs to be explained. When reviewing or defining a pattern, it is important to keep the above in mind.</li></ol><h1 id=\"designpatternstructure\" nodeindex=\"149\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#designpatternstructure\" class=\"subhead-link\" nodeindex=\"1836\">#</a> The Structure Of A Design Pattern</h1><p nodeindex=\"150\">You may be curious about how a pattern author might approach outlining structure, implementation and purpose of a new pattern. A pattern is initially presented in the form of a<strong nodeindex=\"1837\">rule</strong> that establishes a relationship between:</p><ul nodeindex=\"152\"><li nodeindex=\"151\">A<strong nodeindex=\"1838\">context</strong></li><li nodeindex=\"153\">A system of<strong nodeindex=\"1839\">forces</strong> that arises in that context and</li><li nodeindex=\"154\">A<strong nodeindex=\"1840\">configuration</strong> that allows these forces to resolve themselves in context</li></ul><p nodeindex=\"155\">With this in mind, let’s now take a look at a summary of the component elements for a design pattern. A design pattern should have a:</p><ul nodeindex=\"157\"><li nodeindex=\"156\"><strong nodeindex=\"1841\">Pattern name</strong> and a<strong nodeindex=\"1842\">description</strong></li><li nodeindex=\"158\"><strong nodeindex=\"1843\">Context outline</strong> – the contexts in which the pattern is effective in responding to the users needs.</li><li nodeindex=\"159\"><strong nodeindex=\"1844\">Problem statement</strong> – a statement of the problem being addressed so we can understand the intent of the pattern.</li><li nodeindex=\"160\"><strong nodeindex=\"1845\">Solution</strong> – a description of how the user’s problem is being solved in an understandable list of steps and perceptions.</li><li nodeindex=\"161\"><strong nodeindex=\"1846\">Design</strong> – a description of the pattern’s design and in particular, the user’s behavior in interacting with it</li><li nodeindex=\"162\"><strong nodeindex=\"1847\">Implementation</strong> – a guide to how the pattern would be implemented</li><li nodeindex=\"163\"><strong nodeindex=\"1848\">Illustrations</strong> – a visual representation of classes in the pattern (e.g. a diagram))</li><li nodeindex=\"164\"><strong nodeindex=\"1849\">Examples</strong> – an implementation of the pattern in a minimal form</li><li nodeindex=\"165\"><strong nodeindex=\"1850\">Co-requisites</strong> – what other patterns may be needed to support use of the pattern being described?</li><li nodeindex=\"166\"><strong nodeindex=\"1851\">Relations</strong> – what patterns does this pattern resemble? does it closely mimic any others?</li><li nodeindex=\"167\"><strong nodeindex=\"1852\">Known usage</strong> – is the pattern being used in the<em nodeindex=\"1853\">wild</em>? If so, where and how?</li><li nodeindex=\"168\"><strong nodeindex=\"1854\">Discussions</strong> – the team or author’s thoughts on the exciting benefits of the pattern</li></ul><p nodeindex=\"169\">Design patterns are quite a powerful approach to getting all of the developers in an organization or team on the same page when creating or maintaining solutions. If considering working on a pattern of your own, remember that although they may have a heavy initial cost in the planning and write-up phases, the value returned from that investment can be quite worth it. Always research thoroughly before working on new patterns however, as you may find it more beneficial to use or build on top of existing proven patterns than starting afresh.</p><h1 id=\"writingdesignpatterns\" nodeindex=\"170\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#writingdesignpatterns\" class=\"subhead-link\" nodeindex=\"1855\">#</a> Writing Design Patterns</h1><p nodeindex=\"171\">Although this book is aimed at those new to design patterns, a fundamental understanding of how a design pattern is written can offer a number of useful benefits. For starters, we can gain a deeper appreciation for the reasoning behind why a pattern is needed. We can also learn how to tell if a pattern (or proto-pattern) is up to scratch when reviewing it for our own needs.</p><p nodeindex=\"172\">Writing good patterns is a challenging task. Patterns not only need to (ideally) provide a substantial quantity of reference material for end-users, but they also need to be able to defend why they are necessary.</p><p nodeindex=\"173\">Having read the previous section on<em nodeindex=\"1856\">what</em> a pattern is, we may think that this in itself is enough to help us identify patterns we see in the wild. This is actually not completely true. It's not always clear if a piece of code we're looking at is following a set pattern or just accidentally happens to appear like it does.</p><p nodeindex=\"174\">When we're looking at a body of code we think may be using a pattern, we should consider writing down some of the aspects of the code that we believe falls under a particular existing pattern or set of patterns.</p><p nodeindex=\"175\">In many cases of pattern-analysis we can find that we're just looking at code that follows good principles and design practices that could happen to overlap with the rules for a pattern by accident. Remember - solutions in which neither interactions nor defined rules appear are<em nodeindex=\"1857\">not</em> patterns.</p><p nodeindex=\"176\">If interested in venturing down the path of writing your own design patterns I recommend learning from others who have already been through the process and done it well. Spend time absorbing the information from a number of different design pattern descriptions and take in what’s meaningful to you.</p><p nodeindex=\"177\">Explore structure and semantics - this can be done by examining the interactions and context of the patterns you are interested in so you can identify the principles that assist in organizing those patterns together in useful configurations.</p><p nodeindex=\"178\">Once we've exposed ourselves to a wealth of information on pattern literature, we may wish to begin writing our pattern using an<em nodeindex=\"1858\">existing</em> format and see if we can brainstorm new ideas for improving it or integrating our ideas in there.</p><p nodeindex=\"179\">An example of a developer that did this is in recent years is Christian Heilmann, who took the existing<em nodeindex=\"1859\">Module</em> pattern and made some fundamentally useful changes to it to create the<em nodeindex=\"1860\">Revealing Module</em> pattern (this is one of the patterns covered later in this book).</p><p nodeindex=\"180\">The following are tips I would suggest if interested in creating a new design pattern:</p><ul type=\"disc\" nodeindex=\"182\"><li nodeindex=\"181\"><strong nodeindex=\"1861\">How practical is the pattern?</strong>: Ensure the pattern describes proven solutions to recurring problems rather than just speculative solutions which haven’t been qualified.</li><li nodeindex=\"183\"><strong nodeindex=\"1862\">Keep best practices in mind:</strong> The design decisions we make should be based on principles we derive from an understanding of best practices.</li><li nodeindex=\"184\"><strong nodeindex=\"1863\">Our design patterns should be transparent to the user</strong>: Design patterns should be entirely transparent to any type of user-experience. They are primarily there to serve the developers using them and should not force changes to behavior in the user-experience that would not be incurred without the use of a pattern.</li><li nodeindex=\"185\"><strong nodeindex=\"1864\">Remember that originality is<em nodeindex=\"1865\">not</em> key in pattern design</strong>: When writing a pattern, we do not need to be the original discoverer of the solutions being documented nor do you have to worry about our design overlapping with minor pieces of other patterns. If the approach is strong enough to have broad useful applicability, it has a chance of being recognized as a valid pattern.</li><li nodeindex=\"186\"><strong nodeindex=\"1866\">Pattern need a strong set of examples:</strong> A good pattern description needs to be followed by an equally strong set of examples demonstrating the successful application of our pattern. To show broad usage, examples that exhibit good design principles are ideal.</li></ul><p nodeindex=\"187\">Pattern writing is a careful balance between creating a design that is general, specific and above all, useful. Try to ensure that if writing a pattern you cover the widest possible areas of application and you should be fine. I hope that this brief introduction to writing patterns has given you some insights that will assist your learning process for the next sections of this book.</p><h1 id=\"antipatterns\" nodeindex=\"188\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#antipatterns\" class=\"subhead-link\" nodeindex=\"1867\">#</a> Anti-Patterns</h1><p nodeindex=\"189\">If we consider that a pattern represents a best practice, an anti-pattern represents a lesson that has been learned. The term anti-patterns was coined in 1995 by Andrew Koenig in the November C++ Report that year, inspired by the GoF's book<em nodeindex=\"1868\">Design Patterns</em>. In Koenig’s report, there are two notions of anti-patterns that are presented. Anti-Patterns:</p><ul type=\"disc\" nodeindex=\"191\"><li nodeindex=\"190\">Describe a<em nodeindex=\"1869\">bad</em> solution to a particular problem which resulted in a bad situation occurring</li><li nodeindex=\"192\">Describe<em nodeindex=\"1870\">how</em> to get out of said situation and how to go from there to a good solution</li></ul><p nodeindex=\"193\">On this topic, Alexander writes about the difficulties in achieving a good balance between good design structure and good context:</p><p nodeindex=\"194\"><em nodeindex=\"1871\">“These notes are about the process of design; the process of inventing physical things which display a new physical order, organization, form, in response to function.…every design problem begins with an effort to achieve fitness between two entities: the form in question and its context. The form is the solution to the problem; the context defines the problem”.</em></p><p nodeindex=\"195\">While it’s quite important to be aware of design patterns, it can be equally important to understand anti-patterns. Let us qualify the reason behind this. When creating an application, a project’s life-cycle begins with construction however once you’ve got the initial release done, it needs to be maintained. The quality of a final solution will either be<em nodeindex=\"1872\">good</em> or<em nodeindex=\"1873\">bad</em>, depending on the level of skill and time the team have invested in it. Here<em nodeindex=\"1874\">good</em> and<em nodeindex=\"1875\">bad</em> are considered in context - a ‘perfect’ design may qualify as an anti-pattern if applied in the wrong context.</p><p nodeindex=\"196\">The bigger challenges happen after an application has hit production and is ready to go into maintenance mode. A developer working on such a system who hasn’t worked on the application before may introduce a<em nodeindex=\"1876\">bad</em> design into the project by accident. If said<em nodeindex=\"1877\">bad</em> practices are created as anti-patterns, they allow developers a means to recognize these in advance so that they can avoid common mistakes that can occur - this is parallel to the way in which design patterns provide us with a way to recognize common techniques that are<em nodeindex=\"1878\">useful.</em></p><p nodeindex=\"197\">To summarize, an anti-pattern is a bad design that is worthy of documenting. Examples of anti-patterns in JavaScript are the following:</p><ul type=\"disc\" nodeindex=\"199\"><li nodeindex=\"198\">Polluting the global namespace by defining a large number of variables in the global context</li><li nodeindex=\"200\">Passing strings rather than functions to either setTimeout or setInterval as this triggers the use of<code nodeindex=\"1879\">eval()</code> internally.</li><li nodeindex=\"201\">Modifying the<code nodeindex=\"1880\">Object</code> class prototype (this is a particularly bad anti-pattern)</li><li nodeindex=\"202\">Using JavaScript in an inline form as this is inflexible</li><li nodeindex=\"203\">The use of document.write where native DOM alternatives such as document.createElement are more appropriate. document.write has been grossly misused over the years and has quite a few disadvantages including that if it's executed after the page has been loaded it can actually overwrite the page we're on, whilst document.createElement does not. We can see<a href=\"http://jsfiddle.net/addyosmani/6T9vX/\" nodeindex=\"1881\">here</a> for a live example of this in action. It also doesn't work with XHTML which is another reason opting for more DOM-friendly methods such as document.createElement is favorable.</li></ul><p nodeindex=\"204\">Knowledge of anti-patterns is critical for success. Once we are able to recognize such anti-patterns, we're able to refactor our code to negate them so that the overall quality of our solutions improves instantly.</p><h1 id=\"categoriesofdesignpatterns\" nodeindex=\"205\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#categoriesofdesignpatterns\" class=\"subhead-link\" nodeindex=\"1882\">#</a> Categories Of Design Pattern</h1><p nodeindex=\"206\">A glossary from the well-known design book,<em nodeindex=\"1883\">Domain-Driven Terms,</em> rightly states that:</p><p nodeindex=\"207\">“A design pattern names, abstracts, and identifies the key aspects of a common design structure that make it useful for creating a reusable object-oriented design. The design pattern identifies the participating classes and their instances, their roles and collaborations, and the distribution of responsibilities.</p><p nodeindex=\"208\">Each design pattern focuses on a particular object-oriented design problem or issue. It describes when it applies, whether or not it can be applied in view of other design constraints, and the consequences and trade-offs of its use. Since we must eventually implement our designs, a design pattern also provides sample ... code to illustrate an implementation.</p><p nodeindex=\"209\">Although design patterns describe object-oriented designs, they are based on practical solutions that have been implemented in mainstream object-oriented programming languages ....”</p><p nodeindex=\"210\">Design patterns can be broken down into a number of different categories. In this section we’ll review three of these categories and briefly mention a few examples of the patterns that fall into these categories before exploring specific ones in more detail.</p><h2 nodeindex=\"211\">Creational Design Patterns</h2><p nodeindex=\"212\">Creational design patterns focus on handling object creation mechanisms where objects are created in a manner suitable for the situation we're working in. The basic approach to object creation might otherwise lead to added complexity in a project whilst these patterns aim to solve this problem by<em nodeindex=\"1884\">controlling</em> the creation process.</p><p nodeindex=\"213\">Some of the patterns that fall under this category are: Constructor, Factory, Abstract, Prototype, Singleton and Builder.</p><h2 nodeindex=\"214\">Structural Design Patterns</h2><p nodeindex=\"215\">Structural patterns are concerned with object composition and typically identify simple ways to realize relationships between different objects. They help ensure that when one part of a system changes, the entire structure of the system doesn't need to do the same. They also assist in recasting parts of the system which don't fit a particular purpose into those that do.</p><p nodeindex=\"216\">Patterns that fall under this category include: Decorator, Facade, Flyweight, Adapter and Proxy.</p><h2 nodeindex=\"217\">Behavioral Design Patterns</h2><p nodeindex=\"218\">Behavioral patterns focus on improving or streamlining the communication between disparate objects in a system.</p><p nodeindex=\"219\">Some behavioral patterns include: Iterator, Mediator, Observer and Visitor.</p><h1 id=\"summarytabledesignpatterns\" nodeindex=\"220\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#summarytabledesignpatterns\" class=\"subhead-link\" nodeindex=\"1885\">#</a> Design Pattern Categorization</h1><p nodeindex=\"221\">In my early experiences of learning about design patterns, I personally found the following table a very useful reminder of what a number of patterns has to offer - it covers the 23 Design Patterns mentioned by the GoF. The original table was summarized by Elyse Nielsen back in 2004 and I've modified it where necessary to suit our discussion in this section of the book.</p><p nodeindex=\"222\">I recommend using this table as reference, but do remember that there are a number of additional patterns that are not mentioned here but will be discussed later in the book.</p><h3 nodeindex=\"223\">A brief note on classes</h3><p nodeindex=\"224\">Keep in mind that there will be patterns in this table that reference the concept of \"classes\". JavaScript is a class-less language, however classes can be simulated using functions.</p><p nodeindex=\"225\">The most common approach to achieving this is by defining a JavaScript function where we then create an object using the<code nodeindex=\"1886\">new</code> keyword.<code nodeindex=\"1887\">this</code> can be used to help define new properties and methods for the object as follows:</p><p nodeindex=\"229\">For more ways to define \"classes\" using JavaScript, see Stoyan Stefanov's useful<a href=\"http://www.phpied.com/3-ways-to-define-a-javascript-class/\" nodeindex=\"1888\">post</a> on them.</p><p nodeindex=\"230\">Let us now proceed to review the table.</p><table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"1\" nodeindex=\"1889\" class=\" ril_dataTable\"><tbody nodeindex=\"1890\"><tr nodeindex=\"232\"><td colspan=\"4\" nodeindex=\"231\"><strong nodeindex=\"1891\"><b nodeindex=\"1892\">Creational</b></strong></td><td colspan=\"4\" nodeindex=\"233\">Based on the concept of creating an object.</td></tr><tr nodeindex=\"235\"><td colspan=\"8\" nodeindex=\"234\"><em nodeindex=\"1893\"><strong nodeindex=\"1894\">Class</strong></em></td></tr><tr nodeindex=\"237\"><td colspan=\"5\" nodeindex=\"236\"><em nodeindex=\"1895\">Factory Method</em></td><td colspan=\"3\" nodeindex=\"238\">This makes an instance of several derived classes based on interfaced data or events.</td></tr><tr nodeindex=\"240\"><td colspan=\"8\" nodeindex=\"239\"><em nodeindex=\"1896\"><strong nodeindex=\"1897\">Object</strong></em></td></tr><tr nodeindex=\"242\"><td colspan=\"5\" nodeindex=\"241\"><em nodeindex=\"1898\">Abstract Factory</em></td><td colspan=\"3\" nodeindex=\"243\">Creates an instance of several families of classes without detailing concrete classes.</td></tr><tr nodeindex=\"245\"><td colspan=\"5\" nodeindex=\"244\"><em nodeindex=\"1899\">Builder</em></td><td colspan=\"3\" nodeindex=\"246\">Separates object construction from its representation, always creates the same type of object.</td></tr><tr nodeindex=\"248\"><td colspan=\"5\" nodeindex=\"247\"><em nodeindex=\"1900\">Prototype</em></td><td colspan=\"3\" nodeindex=\"249\">A fully initialized instance used for copying or cloning.</td></tr><tr nodeindex=\"251\"><td colspan=\"5\" nodeindex=\"250\"><em nodeindex=\"1901\">Singleton</em></td><td colspan=\"3\" nodeindex=\"252\">A class with only a single instance with global access points.</td></tr><tr nodeindex=\"254\"><td height=\"20\" width=\"6\" nodeindex=\"253\"></td><td width=\"6\" nodeindex=\"255\"></td><td width=\"6\" nodeindex=\"256\"></td><td width=\"139\" nodeindex=\"257\"></td><td width=\"1\" nodeindex=\"258\"></td><td width=\"18\" nodeindex=\"259\"></td><td width=\"18\" nodeindex=\"260\"></td><td width=\"681\" nodeindex=\"261\"></td></tr><tr nodeindex=\"263\"><td colspan=\"4\" nodeindex=\"262\"><strong nodeindex=\"1902\"><b nodeindex=\"1903\">Structural</b></strong></td><td colspan=\"4\" nodeindex=\"264\">Based on the idea of building blocks of objects</td></tr><tr nodeindex=\"266\"><td colspan=\"8\" nodeindex=\"265\"><em nodeindex=\"1904\"><strong nodeindex=\"1905\">Class</strong></em></td></tr><tr nodeindex=\"268\"><td colspan=\"5\" nodeindex=\"267\"><em nodeindex=\"1906\">Adapter</em></td><td colspan=\"3\" nodeindex=\"269\">Match interfaces of different classes therefore classes can work together despite incompatible interfaces</td></tr><tr nodeindex=\"271\"><td colspan=\"8\" nodeindex=\"270\"><em nodeindex=\"1907\"><strong nodeindex=\"1908\">Object</strong></em></td></tr><tr nodeindex=\"273\"><td colspan=\"5\" nodeindex=\"272\"><em nodeindex=\"1909\">Adapter</em></td><td colspan=\"3\" nodeindex=\"274\">Match interfaces of different classes therefore classes can work together despite incompatible interfaces</td></tr><tr nodeindex=\"276\"><td colspan=\"5\" nodeindex=\"275\"><em nodeindex=\"1910\">Bridge</em></td><td colspan=\"3\" nodeindex=\"277\">Separates an object's interface from its implementation so the two can vary independently</td></tr><tr nodeindex=\"279\"><td colspan=\"5\" nodeindex=\"278\"><em nodeindex=\"1911\">Composite</em></td><td colspan=\"3\" nodeindex=\"280\">A structure of simple and composite objects which makes the total object more than just the sum of its parts.</td></tr><tr nodeindex=\"282\"><td colspan=\"5\" nodeindex=\"281\"><em nodeindex=\"1912\">Decorator</em></td><td colspan=\"3\" nodeindex=\"283\">Dynamically add alternate processing to objects.</td></tr><tr nodeindex=\"285\"><td colspan=\"5\" nodeindex=\"284\"><em nodeindex=\"1913\">Facade</em></td><td colspan=\"3\" nodeindex=\"286\">A single class that hides the complexity of an entire subsystem.</td></tr><tr nodeindex=\"288\"><td colspan=\"5\" nodeindex=\"287\"><em nodeindex=\"1914\">Flyweight</em></td><td colspan=\"3\" nodeindex=\"289\">A fine-grained instance used for efficient sharing of information that is contained elsewhere.</td></tr><tr nodeindex=\"291\"><td colspan=\"5\" nodeindex=\"290\"><em nodeindex=\"1915\">Proxy</em></td><td colspan=\"3\" nodeindex=\"292\">A place holder object representing the true object</td></tr><tr nodeindex=\"294\"><td colspan=\"8\" nodeindex=\"293\"></td></tr><tr nodeindex=\"296\"><td colspan=\"4\" nodeindex=\"295\"><strong nodeindex=\"1916\"><b nodeindex=\"1917\">Behavioral</b></strong></td><td colspan=\"4\" nodeindex=\"297\">Based on the way objects play and work together.</td></tr><tr nodeindex=\"299\"><td colspan=\"8\" nodeindex=\"298\"><em nodeindex=\"1918\"><strong nodeindex=\"1919\">Class</strong></em></td></tr><tr nodeindex=\"301\"><td colspan=\"5\" nodeindex=\"300\"><em nodeindex=\"1920\">Interpreter</em></td><td colspan=\"3\" nodeindex=\"302\">A way to include language elements in an application to match the grammar of the intended language.</td></tr><tr nodeindex=\"304\"><td colspan=\"5\" nodeindex=\"303\"><em nodeindex=\"1921\">Template<br nodeindex=\"1922\">Method</em></td><td colspan=\"3\" nodeindex=\"305\">Creates the shell of an algorithm in a method, then defer the exact steps to a subclass.</td></tr><tr nodeindex=\"307\"><td colspan=\"8\" nodeindex=\"306\"><em nodeindex=\"1923\"><strong nodeindex=\"1924\">Object</strong></em></td></tr><tr nodeindex=\"309\"><td colspan=\"5\" nodeindex=\"308\"><em nodeindex=\"1925\">Chain of<br nodeindex=\"1926\">Responsibility</em></td><td colspan=\"3\" nodeindex=\"310\">A way of passing a request between a chain of objects to find the object that can handle the request.</td></tr><tr nodeindex=\"312\"><td colspan=\"5\" nodeindex=\"311\"><em nodeindex=\"1927\">Command</em></td><td colspan=\"3\" nodeindex=\"313\">Encapsulate a command request as an object to enable, logging and/or queuing of requests, and provides error-handling for unhandled requests.</td></tr><tr nodeindex=\"315\"><td colspan=\"5\" nodeindex=\"314\"><em nodeindex=\"1928\">Iterator</em></td><td colspan=\"3\" nodeindex=\"316\">Sequentially access the elements of a collection without knowing the inner workings of the collection.</td></tr><tr nodeindex=\"318\"><td colspan=\"5\" nodeindex=\"317\"><em nodeindex=\"1929\">Mediator</em></td><td colspan=\"3\" nodeindex=\"319\">Defines simplified communication between classes to prevent a group of classes from referring explicitly to each other.</td></tr><tr nodeindex=\"321\"><td colspan=\"5\" nodeindex=\"320\"><em nodeindex=\"1930\">Memento</em></td><td colspan=\"3\" nodeindex=\"322\">Capture an object's internal state to be able to restore it later.</td></tr><tr nodeindex=\"324\"><td colspan=\"5\" nodeindex=\"323\"><em nodeindex=\"1931\">Observer</em></td><td colspan=\"3\" nodeindex=\"325\">A way of notifying change to a number of classes to ensure consistency between the classes.</td></tr><tr nodeindex=\"327\"><td colspan=\"5\" nodeindex=\"326\"><em nodeindex=\"1932\">State</em></td><td colspan=\"3\" nodeindex=\"328\">Alter an object's behavior when its state changes</td></tr><tr nodeindex=\"330\"><td colspan=\"5\" nodeindex=\"329\"><em nodeindex=\"1933\">Strategy</em></td><td colspan=\"3\" nodeindex=\"331\">Encapsulates an algorithm inside a class separating the selection from the implementation</td></tr><tr nodeindex=\"333\"><td colspan=\"5\" nodeindex=\"332\"><em nodeindex=\"1934\">Visitor</em></td><td colspan=\"3\" nodeindex=\"334\">Adds a new operation to a class without changing the class</td></tr></tbody></table><h1 id=\"designpatternsjavascript\" nodeindex=\"335\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#designpatternsjavascript\" class=\"subhead-link\" nodeindex=\"1935\">#</a> JavaScript Design Patterns</h1><p nodeindex=\"336\">In this section, we will explore JavaScript implementations of a number of both classic and modern design patterns.</p><p nodeindex=\"337\">Developers commonly wonder whether there is an<em nodeindex=\"1936\">ideal</em> pattern or set of patterns they should be using in their workflow. There isn't a true single answer to this question; each script and web application we work on is likely to have its own individual needs and we need to think about where we feel a pattern can offer real value to an implementation.</p><p nodeindex=\"338\">For example, some projects may benefit from the decoupling benefits offered by the Observer pattern (which reduces how dependent parts of an application are on one another) whilst others may simply be too small for decoupling to be a concern at all.</p><p nodeindex=\"339\">That said, once we have a firm grasp of design patterns and the specific problems they are best suited to, it becomes much easier to integrate them into our application architectures.</p><p nodeindex=\"340\"><strong nodeindex=\"1937\">The patterns we will be exploring in this section are the:</strong></p><h2 id=\"constructorpatternjavascript\" nodeindex=\"355\"><a href=\"http://addyosmani.com/resources/essentialjsdesignpatterns/book/#constructorpatternjavascript\" class=\"subhead-link\" nodeindex=\"1938\">#</a> The Constructor Pattern</h2><p nodeindex=\"356\">In classical object-oriented programming languages, a constructor is a special method used to initialize a newly created object once memory has been allocated for it. In JavaScript, as almost everything is an object, we're most often interested in<em nodeindex=\"1939\">object</em> constructors.</p><p nodeindex=\"357\">Object constructors are used to create specific types of objects - both preparing the object for use and accepting arguments which a constructor can use to set the values of member properties and methods when the object is first created.</p><h3 nodeindex=\"358\">Object Creation</h3><p nodeindex=\"359\">The three common ways to create new objects in JavaScript are as follows:</p>"
}, {
title: "The Secret Life of Passwords",
author: "Ian Urbina",
filename: "filenametest.xhtml",
data: "<div class=\"text_body\"><div id=\"RIL_IMG_1\" class=\"RIL_IMG loaded\"><img src=\"https://dn-baiim.qbox.me/5542ec332be167a102ceff53.jpg\"><caption> <cite></cite></caption></div><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"362\" data-total-count=\"362\" itemprop=\"articleBody\" id=\"story-continues-1\" nodeindex=\"414\">Howard Lutnick, the chief executive of Cantor Fitzgerald, one of the world’s largest financial-services firms, still cries when he talks about it. Not long after the planes struck the twin towers, killing 658 of his co-workers and friends, including his brother, one of the first things on Lutnick’s mind was passwords. This may seem callous, but it was not.</p> <p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"1047\" data-total-count=\"1409\" itemprop=\"articleBody\" id=\"story-continues-2\" nodeindex=\"430\">Like virtually everyone else caught up in the events that day, Lutnick, who had taken the morning off to escort his son, Kyle, to his first day of kindergarten, was in shock. But he was also the one person most responsible for ensuring the viability of his company. The biggest threat to that survival became apparent almost immediately: No one knew the passwords for hundreds of accounts and files that were needed to get back online in time for the reopening of the bond markets. Cantor Fitzgerald did have extensive contingency plans in place, including a requirement that all employees tell their work passwords to four nearby colleagues. But now a large majority of the firm’s 960 New York employees were dead. “We were thinking of a major fire,” Lutnick said. “No one in those days had ever thought of an entire four-to-six-block radius being destroyed.” The attacks also knocked out one of the company’s main backup servers, which were housed, at what until that day seemed like a safe distance away, under 2 World Trade Center.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"713\" data-total-count=\"2122\" itemprop=\"articleBody\" nodeindex=\"431\">Hours after the attacks, Microsoft dispatched more than 30 security experts to an improvised Cantor Fitzgerald command center in Rochelle Park, N.J., roughly 20 miles from the rubble. Many of the missing passwords would prove to be relatively secure — the “JHx6fT!9” type that the company’s I.T. department implored everyone to choose. To crack those, the Microsoft technicians performed “brute force” attacks, using fast computers to begin with “a” then work through every possible letter and number combination before ending at “ZZZZZZZ.” But even with the fastest computers, brute-force attacks, working through trillions of combinations, could take days. Wall Street was not going to wait.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"1168\" data-total-count=\"3290\" itemprop=\"articleBody\" id=\"story-continues-3\" nodeindex=\"440\">Microsoft’s technicians, Lutnick recalled, knew that they needed to take advantage of two facts: Many people use the same password for multiple accounts, and these passwords are typically personalized. The technicians explained that for their algorithms to work best, they needed large amounts of trivia about the owner of each missing password, the kinds of things that were too specific, too personal and too idiosyncratic for companies to keep on file. “It’s the details that make people distinct, that make them individuals,” Lutnick said. He soon found himself on the phone, desperately trying to compartmentalize his own agony while calling the spouses, parents and siblings of his former colleagues to console them — and to ask them, ever so gently, whether they knew their loved ones’ passwords. Most often they did not, which meant that Lutnick had to begin working his way through a checklist that had been provided to him by the Microsoft technicians. “What is your wedding anniversary? Tell me again where he went for undergrad? You guys have a dog, don’t you? What’s her name? You have two children. Can you give me their birth dates?”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"627\" data-total-count=\"3917\" itemprop=\"articleBody\" id=\"story-continues-4\" nodeindex=\"442\">“Remember, this was less than 24 hours after the towers had fallen,” he said. “The fire department was still referring to it as a search-and-rescue mission.” Families had not accepted their losses. Lutnick said he never referred to anyone as being dead, just “not available right now.” He framed his questions to be an affirmation of that person’s importance to the company, he said. Conversations oscillated between sudden bawling and agonizing silences. “Awful,” he said. Sometimes it took more than an hour to work through the checklist, but Lutnick said he made sure he was never the one to hang up first.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"233\" data-total-count=\"4150\" itemprop=\"articleBody\" nodeindex=\"443\">In the end, Microsoft’s technicians got what they needed. The firm was back in operation within two days. The same human sentimentality that made Cantor Fitzgerald’s passwords “weak,” ultimately proved to be its saving grace.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"1030\" data-total-count=\"5180\" itemprop=\"articleBody\" nodeindex=\"444\"><strong nodeindex=\"701\">Several years ago</strong> I began asking my friends and family to tell me their passwords. I had come to believe that these tiny personalized codes get a bum rap. Yes, I understand why passwords are universally despised: the strains they put on our memory, the endless demand to update them, their sheer number. I hate them, too. But there is more to passwords than their annoyance. In our authorship of them, in the fact that we construct them so that we (and only we) will remember them, they take on secret lives. Many of our passwords are suffused with pathos, mischief, sometimes even poetry. Often they have rich back stories. A motivational mantra, a swipe at the boss, a hidden shrine to a lost love, an inside joke with ourselves, a defining emotional scar — these keepsake passwords, as I came to call them, are like tchotchkes of our inner lives. They derive from anything: Scripture, horoscopes, nicknames, lyrics, book passages. Like a tattoo on a private part of the body, they tend to be intimate, compact and expressive.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"606\" data-total-count=\"5786\" itemprop=\"articleBody\" nodeindex=\"445\">Perhaps my biggest surprise has been how willing, eager actually, people are to openly discuss their keepsakes. The friends I queried forwarded my request, and before long I started receiving passwords from complete strangers. There was the former prisoner whose password includes what used to be his inmate identification number (“a reminder not to go back”); the fallen-away Catholic whose passwords incorporate the Virgin Mary (“it’s secretly calming”); the childless 45-year-old whose password is the name of the baby boy she lost in utero (“my way of trying to keep him alive, I guess”).</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"605\" data-total-count=\"6391\" itemprop=\"articleBody\" nodeindex=\"446\">Sometimes the passwords were playful. Several people said they used “incorrect” for theirs so that when they forgot it, the software automatically prompted them with the right one (“your password is incorrect”). Nicole Perlroth, The New York Times’s cybersecurity reporter, told me about the awkward conversation she had not long ago, when, locked out of her account, she was asked by the newspaper’s tech-support staff to disclose her password: a three-digit code plus an unpublishable epithet — a reference to a funny exchange she overheard years earlier between a store clerk and a thief.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"477\" data-total-count=\"6868\" itemprop=\"articleBody\" id=\"story-continues-5\" nodeindex=\"448\">Often, though, these disclosures had an emotional edge to them. One woman described the jarring realization that her sister’s name was the basis for all of their mother’s passwords. Another, Becky FitzSimons, recalled needling her husband, Will, after their wedding in 2013 because he was still using the digits of his ex-girlfriend’s birthday for his debit-card PIN. “I’m not a jealous person,” FitzSimons said. “But he changed it to my birthday the next day.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"827\" data-total-count=\"7695\" itemprop=\"articleBody\" id=\"story-continues-6\" nodeindex=\"450\">Standing at the park watching my 11-year-old son climb on the jungle gym, I struck up a conversation with a woman walking her dog, and I told her about my keepsakes idea. Like most people, she did not want her name used in my article, because she said her vignette was too personal; she also feared being hacked. But she proceeded to tell me that several months after her son committed suicide, she found his password written on a piece of paper at his desk: “Lambda1969.” Only then, after some Internet searching, did she realize he had been gay. (Lambda is the Greek lowercase “l,” which some historians say stands in gay culture for liberation. The number, “1969,” she explained, referred to the year of the <a href=\"http://topics.nytimes.com/top/reference/timestopics/subjects/s/stonewall_rebellion/index.html?inline=nyt-classifier\" title=\"More articles about the Stonewall Riots.\" class=\"meta-classifier\" nodeindex=\"702\">Stonewall</a> Riots — the protests that followed a police raid on the Stonewall Inn in Greenwich Village.)</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"897\" data-total-count=\"8592\" itemprop=\"articleBody\" nodeindex=\"451\">Some keepsakes were striking for their ingenuity. Like spring-loaded contraptions, they folded big thoughts down into tidy little ciphers. After being inspired by Sheryl Sandberg’s book, “Lean In: Women, Work and the Will to Lead,” Cortni Kerr, a running partner of mine, began using “Ww$$do13,” which stood for “What would Sheryl Sandberg do” plus “13” for the year (2013) of the password’s creation. “TnsitTpsif” was the password of another friend, a computer scientist who loves wordplay. It stands for “The next sentence is true. The previous sentence is false,” which in philosophy is called a liar’s paradox. For my friend, it was a playful reference to the knots that language can tie. When I described keepsake passwords to Paul Saffo, who teaches engineering at Stanford and writes often about the future of technology, he coined the term “crypto haiku.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"366\" data-total-count=\"8958\" itemprop=\"articleBody\" nodeindex=\"452\">Rachel Malis, 29, a friend’s former housemate, heard about my password fixations and emailed hers to me: “Odessa,” the Ukrainian city of her father’s birth. It seemed unremarkable to me. But she said there was more to it. So I suggested we meet for coffee. We sat for an hour while Malis nursed a latte and explained what gave her password its power for her.</p><h2 class=\"interactive-headline _RIL_KEEPER_CLASS_\" nodeindex=\"453\"> A String of Characters </h2><div id=\"RIL_IMG_2\" class=\"RIL_IMG hasCaption loaded\" style=\"max-width: 540px;\"><img src=\"https://dn-baiim.qbox.me/54bb406bfdadac375c311dad.jpg\"><caption>The Secret Life of Passwords For some people, passwords protect dreams, secrets, even fears, and serve as a daily reminder of what matters most. Video by Leslye Davis on Publish Date November 19, 2014.<cite></cite></caption></div><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"960\" data-total-count=\"9918\" itemprop=\"articleBody\" id=\"story-continues-8\" nodeindex=\"471\">“Odessa,” she said, referred not just to her lineage but also to a transformative trip she took there in 2008 with her father. In a sense, it was a place that had always separated them — it embodied a language, a regime and a past that she could never share. Her father fled Ukraine in 1980 when he was 28, and he vowed never to return. Even in America, old habits, like his KGB-induced skepticism of the police lingered. Malis said that during her childhood in Trumbull, Conn., near New Haven, he would close the living-room blinds whenever he wanted to discuss anything “sensitive,” like summer travel plans or family finances. The city loomed large in her father’s consciousness when Malis was growing up. She once asked why there was no fleck of green anywhere in their house — not in the wallpaper, pictures, dishes, throw rugs — and her mother explained that it was because the color reminded him of painful early years spent in the army.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"782\" data-total-count=\"10700\" itemprop=\"articleBody\" id=\"story-continues-9\" nodeindex=\"473\">On that trip back, Malis paid for her father’s plane ticket and arranged their accommodations, and they were both surprised to find him just as lost as she was in the streets of Odessa. Her laconic father was more talkative, though, in his native tongue. He was strangely calm visiting his father’s grave but became choked up when he showed her the tracks where he caught the train that whisked him out of the city one panicked night so long ago. Above all, Malis said, typing “Odessa” every time she logged in to her computer was a reminder of the true epiphany she carried home: that getting closer to something — her father, this city — didn’t make it smaller or more manageable. “It actually just brought their complexity and nuance more into focus,” she said.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"759\" data-total-count=\"11459\" itemprop=\"articleBody\" nodeindex=\"474\">At least as interesting as the amount of thought Malis had packed into this one six-letter word was the fact that she was telling me it all. I confessed to her that I loved “Odessa” as a password. At the same time, I worried that her office’s techies might not share my affection, given that their first rule is to avoid choosing passwords with personal significance. Malis pointed out that we break that rule precisely because secure passwords are so much harder to remember. Our brains are prone to mooring new memories to old ones, she said. I added that I thought the behavior spoke to something deeper, something almost Cartesian. Humans like, even need, to imbue things with meaning, I suggested. We’re prone to organizing symbols into language.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"362\" data-total-count=\"11821\" itemprop=\"articleBody\" nodeindex=\"475\">Malis gave me an inquisitive look. So I continued: We try to make the best of our circumstances, converting our shackles into art, I said. Amid all that is ephemeral, we strive for permanence, in this case ignoring instructions to make passwords disposable, opting instead to preserve our special ones. These very tendencies are what distinguish us as a species.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"210\" data-total-count=\"12031\" itemprop=\"articleBody\" nodeindex=\"476\">These special passwords are a bit like origami, I suggested: small and often impromptu acts of creativity, sometimes found in the most banal of places. Malis seemed to agree. She nodded, shook my hand and left.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"330\" data-total-count=\"12361\" itemprop=\"articleBody\" id=\"story-continues-10\" nodeindex=\"477\"><strong nodeindex=\"703\">Asking strangers about</strong> their passwords is a touchy proposition. Push too hard, and you come off as a prospective hacker. Go too easy, and people just rant about how much they hate passwords. Still, it’s not every day that you stumble across a conversation topic that teaches you new things about people you’ve known for years.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"276\" data-total-count=\"12637\" itemprop=\"articleBody\" nodeindex=\"478\">I discovered, for example, that my father — a recently retired federal judge and generally a pretty serious guy — derived his passwords from a closeted love for goofy, novelty songs from the late ’50s and early ’60s (“The Purple People Eater,” “Monster Mash”).</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"498\" data-total-count=\"13135\" itemprop=\"articleBody\" nodeindex=\"479\">The “4622” that my wife uses in her passwords was not just the address of her own father’s childhood home but also a reminder of his fragility and strength. Apparently when the former 270-pound football standout, a scholarship athlete and the pride of his working-class neighborhood in west Tulsa, was a small boy, he had to sing his home address (“4622 South 28th West Avenue”) in one full breath rather than try to say it normally; otherwise, his debilitating stutter would trip him up.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"642\" data-total-count=\"13777\" itemprop=\"articleBody\" id=\"story-continues-11\" nodeindex=\"481\">My young son revealed that his password was “philosophy,” because, he said, several years earlier, when he created it, he took secret pride in knowing the meaning of a concept that big. The disclosure had an interesting echo for me, because one of my first childhood passwords was a play on “ontogeny recapitulates phylogeny,” an evolutionary theory from a high-school biology class that I found especially captivating. (The hypothesis, now unfashionable, posits that the physical or intellectual development of each individual passes through stages similar to the developmental stages of that individual’s species or civilization.)</p><div class=\"pullQuote _RIL_KEEPER_CLASS_\" nodeindex=\"484\"><div class=\"thickHalfRule\" nodeindex=\"485\"></div> <blockquote nodeindex=\"486\"><p nodeindex=\"487\">These special passwords are a bit like origami, I suggested: small and often impromptu acts of creativity, sometimes found in the most banal of places.</p></blockquote> </div><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"506\" data-total-count=\"14283\" itemprop=\"articleBody\" id=\"story-continues-12\" nodeindex=\"489\">I asked Andy Miah, a professor of science communication and digital media at the University of Salford in England, for his thoughts on passwords, and he offered an anthropological outlook. Keepsake passwords, he suggested, ritualize a daily encounter with personal memories that often have no place else to be recalled. We engage with them more frequently and more actively than we do, say, with the framed photo on our desk. “You lose that ritual,” Miah said, “you lose an intimacy with yourself.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"987\" data-total-count=\"15270\" itemprop=\"articleBody\" nodeindex=\"490\">For some people, these rituals are motivational. Fiona Moriarty, a competitive runner, told me that she often used “16:59” — her target time for the 5,000 meters in track. Mauricio Estrella, a designer who emailed me from Shanghai, described how his passwords function like homemade versions of popular apps like Narrato or 1 Second Everyday, which automatically provide its user with a daily reminder to pause and reflect momentarily on personal ambitions or values. To help quell his anger at his ex-wife soon after their divorce, Estrella had reset his password to “Forgive@h3r.” “It worked,” he said. Because his office computer demanded that he change his password every 30 days, he moved on to other goals: “Quit@smoking4ever” (successful); “Save4trip@thailand” (successful); “Eat2@day” (“it never worked, I’m still fat,” Estrella wrote); “Facetime2mom@sunday” (“it worked,” he said, “I’ve started talking with my mom every week now”).</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"762\" data-total-count=\"16032\" itemprop=\"articleBody\" nodeindex=\"491\">Keepsakes also memorialize loss or mark painful turning points. Leslye Davis, the New York Times reporter who produced the video series that accompanies this article online, said that “stroke911” was her original Facebook password because she happened to create her page on the same day that her cousin had a stroke. My friend Monica Vendituoli’s keepsake was “swim2659nomore” — a reference to a career-ending shoulder injury in 2008 that prevented her from hitting the 26.59-second qualifying time in the 50-yard freestyle she needed for a championship meet in high school. But the effect of typing this password had shifted over the years, she added. What started as a mourning ritual, she said, was now more a reminder of how “time heals all.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"615\" data-total-count=\"16647\" itemprop=\"articleBody\" nodeindex=\"492\"><strong nodeindex=\"704\">These personal tributes</strong> vary widely, I found. Stuck on a tarmac last year, I sat next to a chatty man who, judging by his expensive watch and suit, seemed to have done well for himself. We made small talk about our jobs, and eventually I told him about my interest in passwords. After a long, silent look out the window, he turned to me and said that he typically uses “1060” in his passwords. This was his SAT score, he explained. He liked reminding himself of it, he said, because he took a certain private satisfaction in how far he had come in life in spite of his mediocre showing on the standardized test.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"695\" data-total-count=\"17342\" itemprop=\"articleBody\" id=\"story-continues-13\" nodeindex=\"494\">I got an email from a college student, Megan Welch, 21, who described having been trapped several years earlier in a relationship with a physically abusive boyfriend. She recounted how he routinely spied on her email. When she tried to change her password, he always either guessed or got her to tell him the new one. “I was so predictable,” she said. After finally deciding to break up with him, she used for her new password the date of her decision, plus the word “freedom” — a deviation, she said, from the cutesy words that had been her norm. In being uncharacteristic, her password became unhackable; it was at once a break from her former self and a commemoration of that break.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"542\" data-total-count=\"17884\" itemprop=\"articleBody\" nodeindex=\"495\">Keepsake passwords are so universal that they are now part of the fabric of pop culture. I noticed, for instance, that on Showtime’s “Dexter,” the main character (a blood-spatter analyst for the police by day, vigilante serial killer by night) forgot his work computer’s password. He was soon visited by the ghost of his adoptive father, Harry, who killed himself after witnessing Dexter’s violent tendencies. The visit reminded Dexter of his password (“Harry”) and the viewer of the longevity and depth of his personal torment.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"562\" data-total-count=\"18446\" itemprop=\"articleBody\" nodeindex=\"496\">Googling for more examples, I came across Jack Donaghy, Alec Baldwin’s character on the NBC sitcom “30 Rock.” He convinced himself that a high-school crush still had feelings for him after he learned that her voice-mail code, “55287,” stood for “Klaus,” the name Jack used in the high-school German class they took together. I found George Costanza from “Seinfeld” nearly driving his girlfriend mad, and maybe even killing a guy, by refusing to share his A.T.M. password, “Bosco,” a reference to George’s weakness for the chocolate syrup.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"741\" data-total-count=\"19187\" itemprop=\"articleBody\" nodeindex=\"497\">But perhaps the most bizarre one I found was Jerry Seinfeld’s A.T.M. code — “Jor-El.” On the simplest level — as the episode explained — this was the name of Superman’s Kryptonian father. It served as a nod to the fictional Jerry’s love of the comic-book character. But in digging a bit further, I found that the real-life Jerry’s father was of Eastern European-Jewish descent, and his first name was Kalman, a.k.a. Kal. This is why one of the actor’s two sons, born long after the episode was made, has Kal as his middle name. Though most people know Superman as Clark Kent, his Kryptonian name is Kal-El. What Jerry hid in his PIN looped between fact and fiction, past and present; and comic book, sitcom and real life.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"559\" data-total-count=\"19746\" itemprop=\"articleBody\" nodeindex=\"498\">I loved the Seinfeld password story because it was so convoluted that in retelling it I could barely follow it myself. Its circularity inspired a certain awe in me — the way you might feel when you first see an optical illusion by Escher. That got me thinking about the intricate and self-referential patterns famously described in Douglas R. Hofstadter’s 1979 classic “Gödel, Escher, Bach: An Eternal Golden Braid.” The book is a beautiful and personal musing on how we mold both language and our sense of self from the inanimate material around us.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"320\" data-total-count=\"20066\" itemprop=\"articleBody\" id=\"story-continues-14\" nodeindex=\"500\">I wondered if there might be some (modest) parallel between what I saw in keepsakes and the elaborate loops in music, math and art that he described in his book. Like a fractal running through human psychology, maybe we have a tendency not just to create keepsakes but to create ones with self-referential loops in them.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"381\" data-total-count=\"20447\" itemprop=\"articleBody\" nodeindex=\"501\">So I called Hofstadter to get his take. He was reserved but intrigued. I suggested that many of these passwords seem to be quiet celebrations of things we hold dear. Hofstadter concurred. His primary password, he said, was the same one he has used since 1975, when he was a visiting scholar at Stanford. It consisted of a sentimental date from his past coupled with a word problem.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"126\" data-total-count=\"20573\" itemprop=\"articleBody\" nodeindex=\"502\">“Might there be something deeper at work in these password habits and in the self-referential loops you studied?” I asked.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"165\" data-total-count=\"20738\" itemprop=\"articleBody\" nodeindex=\"503\">Some of these patterns we discover, Hofstadter said, others we create. But above all, “we oppose randomness,” he said. “Keepsake passwords are part of that.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"1275\" data-total-count=\"22013\" itemprop=\"articleBody\" nodeindex=\"504\">The Internet is a confessional place. With so little privacy, passwords may soon be tomorrow’s eight-track player, quaintly described to our grandchildren. Ten years ago, Bill Gates announced during a tech-security conference in San Francisco that “people are going to rely less and less” on passwords, because they cannot “meet the challenge” of keeping critical information secure. In recent years, there has been a push for machines to identify us not by passwords but by things we possess, like tokens and key cards, or by scanning our eyes, voices or fingerprints. This year, for example, Google purchased SlickLogin, a start-up that verifies IDs using sound waves. iPhones have come equipped with fingerprint scanners for more than a year now. And yet passwords continue to proliferate, to metastasize. Every day more objects — thermostats, car consoles, home alarm systems — are designed to be wired into the Internet and thus password protected. Because big data is big money, even free websites now make you register to view virtually anything of importance so that companies can track potential customers. Five years ago, people averaged about 21 passwords. Now that number is 81, according to LastPass, a company that makes password-storage software.</p><h2 class=\"interactive-headline _RIL_KEEPER_CLASS_\" nodeindex=\"505\"> A String of Characters </h2><div id=\"RIL_IMG_3\" class=\"RIL_IMG hasCaption loaded\" style=\"max-width: 540px;\"><img src=\"https://dn-baiim.qbox.me/54ed3ab16c1e211d7f45ed1b.jpg\"><caption>Sharing Password Stories People explain the origins of their most personal keepsake passwords.Video by Leslye Davis onPublish Date November 19, 2014.<cite></cite></caption></div><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"329\" data-total-count=\"22342\" itemprop=\"articleBody\" id=\"story-continues-16\" nodeindex=\"523\">Partly this push is being fueled by a growing and shared hatred of passwords. The digital era is nothing if not overwhelming. The unrelenting flood of information. The constant troubleshooting. We only just master one new device before it becomes outmoded. These frustrations are channeled into tantrums over forgotten passwords.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"369\" data-total-count=\"22711\" itemprop=\"articleBody\" nodeindex=\"524\">There is scarcely a more modern sense of anomie than that of being caught in the purgatory where, having forgotten a password, we’re asked personal trivia questions about ourselves that we can’t seem to answer correctly. The almost-weekly stream of news stories about major security breaches makes it tough not to feel as if privacy on the Internet is unattainable.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"225\" data-total-count=\"22936\" itemprop=\"articleBody\" nodeindex=\"525\">It’s enough to make the conscientious objectors seem sane. These are the many people I interviewed who said they had given up on the whole notion of online security, opting instead to adopt intentionally insecure passwords.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"446\" data-total-count=\"23382\" itemprop=\"articleBody\" id=\"story-continues-17\" nodeindex=\"527\">Digital nudists of sorts, these people throw all discretion to the wind, leaving themselves naked to hackers and identity thieves; they are protected only by the hope that they might disappear in the crowd. Their humble acts of rebellion seem to suggest that maybe the reason people were so willing to tell me their keepsakes was that it offered a small, private catharsis from the pent-up pressure that we all feel to police our online security.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"340\" data-total-count=\"23722\" itemprop=\"articleBody\" nodeindex=\"528\"><strong nodeindex=\"705\">In December 2009</strong>, an Eastern European hacker trolling the Internet for vulnerable targets stumbled across the mother lode: a database of 32 million passwords for a company called RockYou that runs a network of online games. Several weeks later, the hacker published the database, which remains among the largest such archives ever released.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"701\" data-total-count=\"24423\" itemprop=\"articleBody\" nodeindex=\"529\">The digital nudists were well represented. At least one of every 10 users chose a name or a name plus a year for his password. Two of every thousand passwords were the word “password.” But the RockYou breach had bigger lessons to offer. Most password research is focused on security, rather than on psychology or anthropology. Few modern activities, however, are more universal than creating a password. Rich, poor, young, old, virtually all of us are confronted daily by some kind of registration-demanding technology: wire transfers, prepaid cellphones, online banking, email, calling cards. The RockYou database could show how, when and why words gather weight — existential, personal weight.</p><div class=\"pullQuote _RIL_KEEPER_CLASS_\" nodeindex=\"533\"><div class=\"thickHalfRule\" nodeindex=\"534\"></div><blockquote nodeindex=\"535\"><p nodeindex=\"536\">In our authorship of passwords, in the fact that we construct them so that we (and only we) will remember them, they takeon secret lives. Many of our passwords are suffused with pathos, mischief, sometimes even poetry.</p></blockquote></div><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"675\" data-total-count=\"25098\" itemprop=\"articleBody\" id=\"story-continues-18\" nodeindex=\"538\">This is partly why, for the past several years, a small team of computer scientists at the University of Ontario Institute of Technology has studied the RockYou database for lexical patterns. Among their more interesting finds: “Love” was by far the most common verb among the passwords — about twice as common as conjugations of the verb “to be” and roughly 12 times as common as conjugations of the verb “to hate.” By far the most popular adjectives used in the database’s passwords were “sexy,” “hot” and “pink.” Men’s names were about four times as likely as women’s names to appear as the object of passwords that start with “I love.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"607\" data-total-count=\"25705\" itemprop=\"articleBody\" nodeindex=\"539\">Christopher Collins, one of the group’s lead researchers, explained that affection even appears in disguised forms. What at first looked like a disproportionately frequent use of the word “team,” for instance, turned out to be versions of the Spanish words “<em nodeindex=\"706\">te amo,</em>” or “I love you,” Collins said. The number “14344” appeared unusually often, and the researchers at first figured that it referred to a date: March 14, 1944. After consulting the urban dictionary, they soon found out that the number actually is popular code for “I love you very much.” (Count the letters in each word.)</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"985\" data-total-count=\"26690\" itemprop=\"articleBody\" nodeindex=\"540\">In my own conversations, I, too, noticed that love (familial, unrequited, Platonic, failed) seemed to be a common source of inspiration for keepsakes. Perhaps my favorite of these anecdotes came from Maria T. Allen, who wrote that in 1993, when she was 22, she used for her password a combination of the name of her summer crush, J. D., with an autumn month and the name of a mythological female deity (she wouldn’t tell me which) to whom he had compared her when they first met. The fling ended, and they went their separate ways. But the password endured. Eleven years later, out of the blue, Allen received a message through <a href=\"http://Classmates.com\" nodeindex=\"707\">Classmates.com</a> from J. D. himself. They dated for several years, then decided to marry. Before the wedding, J. D. asked Maria if she had ever thought of him during that interim decade. “About every time I logged in to my Yahoo account,” she replied, before recounting to him her secret. He had the password inscribed on the inside of his wedding ring.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"406\" data-total-count=\"27096\" itemprop=\"articleBody\" id=\"story-continues-19\" nodeindex=\"543\">Granted, passwords harbor humanity’s darker side too. Joseph Bonneau, 30, who was among the first computer scientists to study RockYou’s archive, said he was amazed that tens of thousands of people would choose to introduce messages like “killmeplease,” “myfamilyhatesme” and “erinisaslut” — not to mention a slew of obscenities and racial slurs — into their lives multiple times a day.</p><div class=\"pullQuote _RIL_KEEPER_CLASS_\" nodeindex=\"546\"><div class=\"thickHalfRule\" nodeindex=\"547\"></div><blockquote nodeindex=\"548\"><p nodeindex=\"549\"> ‘People take a nonnatural requirement imposed on them, like memorizing a password,’ he said, ‘and make it a meaningful human experience.’</p></blockquote></div><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"343\" data-total-count=\"27439\" itemprop=\"articleBody\" id=\"story-continues-20\" nodeindex=\"551\">In studying the database, Bonneau’s focus was not on the meaning of passwords but their security. And the further he dug into it, he said, the more he worried about the fate of privacy as so much of life moves online. “What the database made clear,” he said, “was that humans really are the weak link when it comes to data security.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"235\" data-total-count=\"27674\" itemprop=\"articleBody\" nodeindex=\"552\">But precisely what made passwords so flawed is also what Bonneau said he found uplifting. “People take a nonnatural requirement imposed on them, like memorizing a password,” he said, “and make it a meaningful human experience.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"229\" data-total-count=\"27903\" itemprop=\"articleBody\" nodeindex=\"553\">I later recounted Bonneau’s comment to Collins, who agreed. “We don’t just make it a meaningful experience,” he said. “Statistically speaking, at least based on the data, it’s most often an affectionate experience.”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"333\" data-total-count=\"28236\" itemprop=\"articleBody\" nodeindex=\"554\"><strong nodeindex=\"708\">There is something</strong> mildly destructive about collecting people’s keepsakes. Observers disturb the things we measure. But with passwords, or other secrets, we ruin them in their very discussion. Virtually all the people who revealed their passwords to me said they planned to stop using them. And yet they divulged them all the same.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"341\" data-total-count=\"28577\" itemprop=\"articleBody\" nodeindex=\"555\">Over the course of a half-hour, Hossein Bidgoli, a management information systems professor at California State University, Bakersfield, and editor of The Internet Encyclopedia, told me about the many dangers of using personal information in passwords. He fell silent, however, when I asked him whether he thought keepsakes were a bad thing.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"474\" data-total-count=\"29051\" itemprop=\"articleBody\" nodeindex=\"556\">Then he began to tell me about his life. He grew up in a small town near Tehran, he said, where he lived until he left Iran in 1976 to pursue his doctoral studies. He described his high school, which was named Karkhaneh, and the roses and rhododendron at a nearby plantation where he and his parents used to picnic. He recalled the distinct taste of the freshly made olive oil that his father, an engineer, used to bring home from the olive-processing plant where he worked.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"93\" data-total-count=\"29144\" itemprop=\"articleBody\" nodeindex=\"557\">“What you’re calling keepsake passwords,” Bidgoli said, “mine is ‘Karkhaneh.’ ”</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"275\" data-total-count=\"29419\" itemprop=\"articleBody\" nodeindex=\"558\">Translated from Farsi, the word means “the place where people work,” he said. But for him, the name conjured a past happiness, time spent with his parents and the place that shaped his work ethic and his ethnic identity. “It’s a pretty memory,” he said, sotto voce.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"517\" data-total-count=\"29936\" itemprop=\"articleBody\" nodeindex=\"559\">I wondered why someone so concerned about security would be willing to tell me his password. I figured it might just be an extension of the oversharing culture that the Internet has created. Maybe my very hunt for significance in passwords and people’s general eagerness to help in that endeavor says more than any particular meaning I might actually find in the passwords themselves. Humans aren’t the only ones who solve puzzles. We are, however, the only ones who make puzzles simply so that we can solve them.</p><p class=\"story-body-text story-content _RIL_KEEPER_CLASS_ _RIL_KEEPER_CLASS_\" data-para-count=\"178\" data-total-count=\"30114\" itemprop=\"articleBody\" nodeindex=\"560\">Bidgoli said he wasn’t sure why he disclosed his password. “It just seemed like your keepsakes are true,” he added after a long pause. “I wanted to contribute to that.”</p><nav id=\"next-in\" nodeindex=\"709\"></nav><div style=\"font-style:italic;font-size:11px;line-height:12.5px;opacity:0.8;padding-top:12px;padding-bottom:12px;\">© 2015 The New York Times Company.The content you have chosen to save (which may include videos, articles, images and other copyrighted materials) is intended for your personal, noncommercial use. Such content is owned or controlled by The New York Times Company or the party creditedas the content provider. Please refer to nytimes.com and the Terms of Service available on its website for information and restrictions related to the content.</div></div>"
}, {
title: "Trouble",
author: "Unknow",
data: "<p id=\"chapter001-text-element00001\" class=\"first first-in-chapter\"><span class=\"first-phrase\"><span class=\"first-letter first-letter-t\"><span class=\"first-letter-alpha\">T</span></span>he last time</span> I heard directly from Shanley Kane, it was by email.</p><p id=\"chapter001-text-element00002\" class=\"subsequent subsequent-in-chapter\">“Leave me the fuck alone and don’t ever contact me again,” she wrote, before launching into a two-day Twitter barrage demanding that I stop harassing her, her friends, and her family, and calling me a stalker. It might have been fair, or at least accurate, if I were doing any of the above.</p><p id=\"chapter001-text-element00003\" class=\"subsequent subsequent-in-chapter\">There are a few of my recent life experiences that I’d put into a category of “almost more trouble than it’s worth.” Training for a long distance race in single-digit weather; attempting to get Time Warner Cable to explain how it had double-charged me for six months of service; and now, writing about an up-and-coming website and its intriguing but controversial founder. All of these things have redeeming value, though unless you enjoy the idea of freezing slowly while still moving, or are a connoisseur of soul-destroying hold music, the first two have some obvious downsides. </p><p><img src=\"https://dn-baiim.qbox.me/54bb4025fdadac375c311d69.jpg\" alt=\"Creative Commons Attribution-NonCommercial\" /></p><p id=\"chapter001-text-element00004\" class=\"subsequent subsequent-in-chapter\">The negative side of the third only became apparent when the subject in question, Shanley Kane, alerted anyone who was following her that my story was in the works, and attributed all manner of bad faith—and a few colorful adjectives—to me, my journalistic process, and my ethics. </p><p id=\"chapter001-text-element00005\" class=\"subsequent subsequent-in-chapter\">Kane is the 27-year-old cocreator and now sole proprietor of Model View Culture, an indie website and print quarterly that publishes essays and interviews about tech culture and diversity. I knew a little about her, mainly that her name had surfaced in some controversies that mostly took place on Twitter. She often met with disagreements by using various profanities to describe her opponent, which seemed like an odd contrast to the tone and style of the site she ran. Her anger was part of what made people uncomfortable, because that’s what female anger does generally to men—even when it’s obviously and unqualifiedly justified. </p><p id=\"chapter001-text-element00006\" class=\"subsequent subsequent-in-chapter\">Earlier this year the New York Times fired its executive editor, Jill Abramson, with the ostensible rationale that she had not managed her newsroom well. When pressed to explain what that meant, Arthur Sulzberger, the paper’s publisher, talked specifically about her management style, which could be brusque and “bossy”. Others referred to her habit of shouting at staff, and reports included a heated argument with her male second-in-command that ended in him slamming his hand against a wall. Her inappropriate displays of anger got her fired; his seeming restraint saw him promoted in her place.</p><p><img src=\"https://dn-baiim.qbox.me/54dc17332dad68402a6204a1.jpg\" alt=\"The Office\" /></p><hr id=\"chapter001-text-element00007\"class=\"implicit-break\" /><p id=\"chapter001-text-element00008\" class=\"first first-after-break\"><span class=\"first-phrase\"><span class=\"first-letter first-letter-i\"><span class=\"first-letter-alpha\">I</span></span> was thinking</span> about Jill Abramson when I took on the job to write about Shanley Kane and her work. I kept thinking about Kane’s palpable anger on Twitter, and how people were reacting to it—how unacceptable it seemed to be to some people in the tech community, and whether it would be viewed the same way if she were a man. </p><p id=\"chapter001-text-element00009\" class=\"subsequent subsequent-in-chapter\">The more I read, the more curious I was. For many of us who do this for a living, being able to indulge that curiosity and find out what’s really going on is what makes any of it worth it, even when it turns out to be a lot of trouble. </p><p><img src=\"https://dn-baiim.qbox.me/54bb4025fdadac375c311d69.jpg\" alt=\"The Office\" /></p><p id=\"chapter001-text-element00010\" class=\"subsequent subsequent-in-chapter\">That’s when I flew to San Francisco to meet Shanley Kane. </p><hr id=\"chapter001-text-element00011\" class=\"ornamental-break\" />"
}
]
};
optionsAlice = {
title: "Alice's Adventures in Wonderland",
author: "Lewis Carroll",
publisher: "Macmillan & Co.",
cover: "http://orig10.deviantart.net/e272/f/2013/255/0/0/alice_in_wonderland_book_cover_by_pannucabaguana-d6m003p.jpg",
version: 3,
content: [
{
title: "About the author",
data: "<p>Charles Lutwidge Dodgson (January 27, 1832 – January 14, 1898), better known by the pen name Lewis Carroll, was an English author, mathematician, logician, Anglican clergyman, and photographer. His most famous writings are Alice's Adventures in Wonderland and its sequel Through the Looking-Glass as well as the poems "The Hunting of the Snark" and "Jabberwocky", all considered to be within the genre of literary nonsense. His facility at word play, logic, and fantasy has delighted audiences ranging from children to the literary elite. But beyond this, his work has become embedded deeply in modern culture. He has directly influenced many artists. There are societies dedicated to the enjoyment and promotion of his works and the investigation of his life in many parts of the world including North America, Japan, the United Kingdom, and New Zealand. His biography has recently come under much question as a result of what some call the "Carroll Myth."</p>"
}, {
title: "Down the Rabbit Hole",
data: "<p>Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or conversations?'</p><p>So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.</p><p>There was nothing so <i>very</i> remarkable in that; nor did Alice think it so <i>very</i> much out of the way to hear the Rabbit say to itself, 'Oh dear! Oh dear! I shall be late!' (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually <i>took a watch out of its waistcoat-pocket</i>, and looked at it, and then hurried on, Alice started to her feet, for it flashed across her mind that she had never before seen a rabbit with either a waistcoat-pocket, or a watch to take out of it, and burning with curiosity, she ran across the field after it, and fortunately was just in time to see it pop down a large rabbit-hole under the hedge.</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book1.jpg\" alt=\"Image\"/></p><p><b>White Rabbit checking watch</b></p><p>In another moment down went Alice after it, never once considering how in the world she was to get out again.</p><p>The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly down, so suddenly that Alice had not a moment to think about stopping herself before she found herself falling down a very deep well.</p><p>Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled 'ORANGE MARMALADE', but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it.</p><p>'Well!' thought Alice to herself, 'after such a fall as this, I shall think nothing of tumbling down stairs! How brave they'll all think me at home! Why, I wouldn't say anything about it, even if I fell off the top of the house!' (Which was very likely true.)</p><p>Down, down, down. Would the fall <i>never</i> come to an end! 'I wonder how many miles I've fallen by this time?' she said aloud. 'I must be getting somewhere near the centre of the earth. Let me see: that would be four thousand miles down, I think—' (for, you see, Alice had learnt several things of this sort in her lessons in the schoolroom, and though this was not a <i>very</i> good opportunity for showing off her knowledge, as there was no one to listen to her, still it was good practice to say it over) '—yes, that's about the right distance—but then I wonder what Latitude or Longitude I've got to?' (Alice had no idea what Latitude was, or Longitude either, but thought they were nice grand words to say.)</p><p>Presently she began again. 'I wonder if I shall fall right <i>through</i> the earth! How funny it'll seem to come out among the people that walk with their heads downward! The Antipathies, I think—' (she was rather glad there <i>was</i> no one listening, this time, as it didn't sound at all the right word) '—but I shall have to ask them what the name of the country is, you know. Please, Ma'am, is this New Zealand or Australia?' (and she tried to curtsey as she spoke—fancy <i>curtseying</i> as you're falling through the air! Do you think you could manage it?) 'And what an ignorant little girl she'll think me for asking! No, it'll never do to ask: perhaps I shall see it written up somewhere.'</p><p>Down, down, down. There was nothing else to do, so Alice soon began talking again. 'Dinah'll miss me very much to-night, I should think!' (Dinah was the cat.) 'I hope they'll remember her saucer of milk at tea-time. Dinah my dear! I wish you were down here with me! There are no mice in the air, I'm afraid, but you might catch a bat, and that's very like a mouse, you know. But do cats eat bats, I wonder?' And here Alice began to get rather sleepy, and went on saying to herself, in a dreamy sort of way, 'Do cats eat bats? Do cats eat bats?' and sometimes, 'Do bats eat cats?' for, you see, as she couldn't answer either question, it didn't much matter which way she put it. She felt that she was dozing off, and had just begun to dream that she was walking hand in hand with Dinah, and saying to her very earnestly, 'Now, Dinah, tell me the truth: did you ever eat a bat?' when suddenly, thump! thump! down she came upon a heap of sticks and dry leaves, and the fall was over.</p><p>Alice was not a bit hurt, and she jumped up on to her feet in a moment: she looked up, but it was all dark overhead; before her was another long passage, and the White Rabbit was still in sight, hurrying down it. There was not a moment to be lost: away went Alice like the wind, and was just in time to hear it say, as it turned a corner, 'Oh my ears and whiskers, how late it's getting!' She was close behind it when she turned the corner, but the Rabbit was no longer to be seen: she found herself in a long, low hall, which was lit up by a row of lamps hanging from the roof.</p><p>There were doors all round the hall, but they were all locked; and when Alice had been all the way down one side and up the other, trying every door, she walked sadly down the middle, wondering how she was ever to get out again.</p><p>Suddenly she came upon a little three-legged table, all made of solid glass; there was nothing on it except a tiny golden key, and Alice's first thought was that it might belong to one of the doors of the hall; but, alas! either the locks were too large, or the key was too small, but at any rate it would not open any of them. However, on the second time round, she came upon a low curtain she had not noticed before, and behind it was a little door about fifteen inches high: she tried the little golden key in the lock, and to her great delight it fitted!</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book2.jpg\" alt=\"Image\"/></p><p><b>Alice finding tiny door behind curtain</b></p><p>Alice opened the door and found that it led into a small passage, not much larger than a rat-hole: she knelt down and looked along the passage into the loveliest garden you ever saw. How she longed to get out of that dark hall, and wander about among those beds of bright flowers and those cool fountains, but she could not even get her head through the doorway; 'and even if my head would go through,' thought poor Alice, 'it would be of very little use without my shoulders. Oh, how I wish I could shut up like a telescope! I think I could, if I only knew how to begin.' For, you see, so many out-of-the-way things had happened lately, that Alice had begun to think that very few things indeed were really impossible.</p><p>There seemed to be no use in waiting by the little door, so she went back to the table, half hoping she might find another key on it, or at any rate a book of rules for shutting people up like telescopes: this time she found a little bottle on it, ('which certainly was not here before,' said Alice,) and round the neck of the bottle was a paper label, with the words 'DRINK ME' beautifully printed on it in large letters.</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book3.jpg\" alt=\"Image\"/></p><p><b>Alice taking "Drink Me" bottle</b></p><p>It was all very well to say 'Drink me,' but the wise little Alice was not going to do <i>that</i> in a hurry. 'No, I'll look first,' she said, 'and see whether it's marked "<i>poison</i>" or not'; for she had read several nice little histories about children who had got burnt, and eaten up by wild beasts and other unpleasant things, all because they <i>would</i> not remember the simple rules their friends had taught them: such as, that a red-hot poker will burn you if you hold it too long; and that if you cut your finger <i>very</i> deeply with a knife, it usually bleeds; and she had never forgotten that, if you drink much from a bottle marked 'poison,' it is almost certain to disagree with you, sooner or later.</p><p>However, this bottle was <i>not</i> marked 'poison,' so Alice ventured to taste it, and finding it very nice, (it had, in fact, a sort of mixed flavour of cherry-tart, custard, pine-apple, roast turkey, toffee, and hot buttered toast,) she very soon finished it off.</p><p><br/></p><p>* * *</p><p><br/></p><p>'What a curious feeling!' said Alice; 'I must be shutting up like a telescope.'</p><p>And so it was indeed: she was now only ten inches high, and her face brightened up at the thought that she was now the right size for going through the little door into that lovely garden. First, however, she waited for a few minutes to see if she was going to shrink any further: she felt a little nervous about this; 'for it might end, you know,' said Alice to herself, 'in my going out altogether, like a candle. I wonder what I should be like then?' And she tried to fancy what the flame of a candle is like after the candle is blown out, for she could not remember ever having seen such a thing.</p><p>After a while, finding that nothing more happened, she decided on going into the garden at once; but, alas for poor Alice! when she got to the door, she found she had forgotten the little golden key, and when she went back to the table for it, she found she could not possibly reach it: she could see it quite plainly through the glass, and she tried her best to climb up one of the legs of the table, but it was too slippery; and when she had tired herself out with trying, the poor little thing sat down and cried.</p><p>'Come, there's no use in crying like that!' said Alice to herself, rather sharply; 'I advise you to leave off this minute!' She generally gave herself very good advice, (though she very seldom followed it), and sometimes she scolded herself so severely as to bring tears into her eyes; and once she remembered trying to box her own ears for having cheated herself in a game of croquet she was playing against herself, for this curious child was very fond of pretending to be two people. 'But it's no use now,' thought poor Alice, 'to pretend to be two people! Why, there's hardly enough of me left to make <i>one</i> respectable person!'</p><p>Soon her eye fell on a little glass box that was lying under the table: she opened it, and found in it a very small cake, on which the words 'EAT ME' were beautifully marked in currants. 'Well, I'll eat it,' said Alice, 'and if it makes me grow larger, I can reach the key; and if it makes me grow smaller, I can creep under the door; so either way I'll get into the garden, and I don't care which happens!'</p><p>She ate a little bit, and said anxiously to herself, 'Which way? Which way?', holding her hand on the top of her head to feel which way it was growing, and she was quite surprised to find that she remained the same size: to be sure, this generally happens when one eats cake, but Alice had got so much into the way of expecting nothing but out-of-the-way things to happen, that it seemed quite dull and stupid for life to go on in the common way.</p><p>So she set to work, and very soon finished off the cake.</p><p><br/></p><p>* * *</p>"
}, {
title: "The Pool of Tears",
data: "<p>'Curiouser and curiouser!' cried Alice (she was so much surprised, that for the moment she quite forgot how to speak good English); 'now I'm opening out like the largest telescope that ever was! Good-bye, feet!' (for when she looked down at her feet, they seemed to be almost out of sight, they were getting so far off). 'Oh, my poor little feet, I wonder who will put on your shoes and stockings for you now, dears? I'm sure <i>I</i> shan't be able! I shall be a great deal too far off to trouble myself about you: you must manage the best way you can;—but I must be kind to them,' thought Alice, 'or perhaps they won't walk the way I want to go! Let me see: I'll give them a new pair of boots every Christmas.'</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book4.jpg\" alt=\"Image\"/></p><p><b>Alice stretched tall</b></p><p>And she went on planning to herself how she would manage it. 'They must go by the carrier,' she thought; 'and how funny it'll seem, sending presents to one's own feet! And how odd the directions will look!</p><blockquote><p>Alice's Right Foot, Esq.</p><p> Hearthrug,</p><p> near The Fender,</p><p> (with Alice's love). </p></blockquote><p>Oh dear, what nonsense I'm talking!'</p><p>Just then her head struck against the roof of the hall: in fact she was now more than nine feet high, and she at once took up the little golden key and hurried off to the garden door.</p><p>Poor Alice! It was as much as she could do, lying down on one side, to look through into the garden with one eye; but to get through was more hopeless than ever: she sat down and began to cry again.</p><p>'You ought to be ashamed of yourself,' said Alice, 'a great girl like you,' (she might well say this), 'to go on crying in this way! Stop this moment, I tell you!' But she went on all the same, shedding gallons of tears, until there was a large pool all round her, about four inches deep and reaching half down the hall.</p><p>After a time she heard a little pattering of feet in the distance, and she hastily dried her eyes to see what was coming. It was the White Rabbit returning, splendidly dressed, with a pair of white kid gloves in one hand and a large fan in the other: he came trotting along in a great hurry, muttering to himself as he came, 'Oh! the Duchess, the Duchess! Oh! won't she be savage if I've kept her waiting!' Alice felt so desperate that she was ready to ask help of any one; so, when the Rabbit came near her, she began, in a low, timid voice, 'If you please, sir—' The Rabbit started violently, dropped the white kid gloves and the fan, and skurried away into the darkness as hard as he could go.</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book5.jpg\" alt=\"Image\"/></p><p><b>Giant Alice watching Rabbit run away</b></p><p>Alice took up the fan and gloves, and, as the hall was very hot, she kept fanning herself all the time she went on talking: 'Dear, dear! How queer everything is to-day! And yesterday things went on just as usual. I wonder if I've been changed in the night? Let me think: was I the same when I got up this morning? I almost think I can remember feeling a little different. But if I'm not the same, the next question is, Who in the world am I? Ah, <i>that's</i> the great puzzle!' And she began thinking over all the children she knew that were of the same age as herself, to see if she could have been changed for any of them.</p><p>'I'm sure I'm not Ada,' she said, 'for her hair goes in such long ringlets, and mine doesn't go in ringlets at all; and I'm sure I can't be Mabel, for I know all sorts of things, and she, oh! she knows such a very little! Besides, <i>she's</i> she, and <i>I'm</i> I, and—oh dear, how puzzling it all is! I'll try if I know all the things I used to know. Let me see: four times five is twelve, and four times six is thirteen, and four times seven is—oh dear! I shall never get to twenty at that rate! However, the Multiplication Table doesn't signify: let's try Geography. London is the capital of Paris, and Paris is the capital of Rome, and Rome—no, <i>that's</i> all wrong, I'm certain! I must have been changed for Mabel! I'll try and say "<i>How doth the little</i>—"' and she crossed her hands on her lap as if she were saying lessons, and began to repeat it, but her voice sounded hoarse and strange, and the words did not come the same as they used to do:—</p><blockquote><p>'How doth the little crocodile</p><p>Improve his shining tail,</p><p>And pour the waters of the Nile</p><p>On every golden scale!</p></blockquote><p><br/></p><blockquote><p>'How cheerfully he seems to grin,</p><p>How neatly spread his claws,</p><p>And welcome little fishes in</p><p>With gently smiling jaws!'</p></blockquote><p>'I'm sure those are not the right words,' said poor Alice, and her eyes filled with tears again as she went on, 'I must be Mabel after all, and I shall have to go and live in that poky little house, and have next to no toys to play with, and oh! ever so many lessons to learn! No, I've made up my mind about it; if I'm Mabel, I'll stay down here! It'll be no use their putting their heads down and saying "Come up again, dear!" I shall only look up and say "Who am I then? Tell me that first, and then, if I like being that person, I'll come up: if not, I'll stay down here till I'm somebody else"—but, oh dear!' cried Alice, with a sudden burst of tears, 'I do wish they <i>would</i> put their heads down! I am so <i>very</i> tired of being all alone here!'</p><p>As she said this she looked down at her hands, and was surprised to see that she had put on one of the Rabbit's little white kid gloves while she was talking. 'How <i>can</i> I have done that?' she thought. 'I must be growing small again.' She got up and went to the table to measure herself by it, and found that, as nearly as she could guess, she was now about two feet high, and was going on shrinking rapidly: she soon found out that the cause of this was the fan she was holding, and she dropped it hastily, just in time to avoid shrinking away altogether.</p><p>'That <i>was</i> a narrow escape!' said Alice, a good deal frightened at the sudden change, but very glad to find herself still in existence; 'and now for the garden!' and she ran with all speed back to the little door: but, alas! the little door was shut again, and the little golden key was lying on the glass table as before, 'and things are worse than ever,' thought the poor child, 'for I never was so small as this before, never! And I declare it's too bad, that it is!'</p><p>As she said these words her foot slipped, and in another moment, splash! she was up to her chin in salt water. Her first idea was that she had somehow fallen into the sea, 'and in that case I can go back by railway,' she said to herself. (Alice had been to the seaside once in her life, and had come to the general conclusion, that wherever you go to on the English coast you find a number of bathing machines in the sea, some children digging in the sand with wooden spades, then a row of lodging houses, and behind them a railway station.) However, she soon made out that she was in the pool of tears which she had wept when she was nine feet high.</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book6.jpg\" alt=\"Image\"/></p><p><b>Alice in pool of tears</b></p><p>'I wish I hadn't cried so much!' said Alice, as she swam about, trying to find her way out. 'I shall be punished for it now, I suppose, by being drowned in my own tears! That <i>will</i> be a queer thing, to be sure! However, everything is queer to-day.'</p><p>Just then she heard something splashing about in the pool a little way off, and she swam nearer to make out what it was: at first she thought it must be a walrus or hippopotamus, but then she remembered how small she was now, and she soon made out that it was only a mouse that had slipped in like herself.</p><p><img src=\"http://www.alice-in-wonderland.net/wp-content/uploads/1book7.jpg\" alt=\"Image\"/></p><p><b>Alice with Mouse in pool of tears</b></p><p>'Would it be of any use, now,' thought Alice, 'to speak to this mouse? Everything is so out-of-the-way down here, that I should think very likely it can talk: at any rate, there's no harm in trying.' So she began: 'O Mouse, do you know the way out of this pool? I am very tired of swimming about here, O Mouse!' (Alice thought this must be the right way of speaking to a mouse: she had never done such a thing before, but she remembered having seen in her brother's Latin Grammar, 'A mouse—of a mouse—to a mouse—a mouse—O mouse!') The Mouse looked at her rather inquisitively, and seemed to her to wink with one of its little eyes, but it said nothing.</p><p>'Perhaps it doesn't understand English,' thought Alice; 'I daresay it's a French mouse, come over with William the Conqueror.' (For, with all her knowledge of history, Alice had no very clear notion how long ago anything had happened.) So she began again: 'Ou est ma chatte?' which was the first sentence in her French lesson-book. The Mouse gave a sudden leap out of the water, and seemed to quiver all over with fright. 'Oh, I beg your pardon!' cried Alice hastily, afraid that she had hurt the poor animal's feelings. 'I quite forgot you didn't like cats.'</p><p>'Not like cats!' cried the Mouse, in a shrill, passionate voice. 'Would <i>you</i> like cats if you were me?'</p><p>'Well, perhaps not,' said Alice in a soothing tone: 'don't be angry about it. And yet I wish I could show you our cat Dinah: I think you'd take a fancy to cats if you could only see her. She is such a dear quiet thing,' Alice went on, half to herself, as she swam lazily about in the pool, 'and she sits purring so nicely by the fire, licking her paws and washing her face—and she is such a nice soft thing to nurse—and she's such a capital one for catching mice—oh, I beg your pardon!' cried Alice again, for this time the Mouse was bristling all over, and she felt certain it must be really offended. 'We won't talk about her any more if you'd rather not.'</p><p>'We indeed!' cried the Mouse, who was trembling down to the end of his tail. 'As if <i>I</i> would talk on such a subject! Our family always <i>hated</i> cats: nasty, low, vulgar things! Don't let me hear the name again!'</p><p>'I won't indeed!' said Alice, in a great hurry to change the subject of conversation. 'Are you—are you fond—of—of dogs?' The Mouse did not answer, so Alice went on eagerly: 'There is such a nice little dog near our house I should like to show you! A little bright-eyed terrier, you know, with oh, such long curly brown hair! And it'll fetch things when you throw them, and it'll sit up and beg for its dinner, and all sorts of things—I can't remember half of them—and it belongs to a farmer, you know, and he says it's so useful, it's worth a hundred pounds! He says it kills all the rats and—oh dear!' cried Alice in a sorrowful tone, 'I'm afraid I've offended it again!' For the Mouse was swimming away from her as hard as it could go, and making quite a commotion in the pool as it went.</p><p>So she called softly after it, 'Mouse dear! Do come back again, and we won't talk about cats or dogs either, if you don't like them!' When the Mouse heard this, it turned round and swam slowly back to her: its face was quite pale (with passion, Alice thought), and it said in a low trembling voice, 'Let us get to the shore, and then I'll tell you my history, and you'll understand why it is I hate cats and dogs.'</p><p>It was high time to go, for the pool was getting quite crowded with the birds and animals that had fallen into it: there were a Duck and a Dodo, a Lory and an Eaglet, and several other curious creatures. Alice led the way, and the whole party swam to the shore.</p><p><br/></p>"
}
]
};
new EPub(optionsHtmlPaste, path.resolve(__dirname, "./tempDir/book.epub")).promise.then(function() {
return console.log(options.title + " is generated successfully");
});
}).call(this);