The Secret Art of Storytelling
in
Programming
How to write code that is fun to read
Yehonathan Sharvit @viebel
Chapter 1/8
HARD TO READ
function handleSearchQuery(catalog, query, options) {
// Finding books that match the query
var prefixRegExp = new RegExp("\\b" + query + "\\b");
var books = _.filter(catalog.books, function(book) {
if(options.query.wholeWord) {
return book.title.match(prefixRegExp) != null;
}
return book.title.includes(query);
});
// Enriching books
var enrichedBooks = _.map(books, function(book) {
var author = catalog.authors[book.authorID];
return _.set(book, "author",
_.capitalize(author.firstName) +
" " + _.capitalize(author.lastName));
});
// Sorting books according to options
var sortingOptions = options.format.sort;
var sortedBooks = _.sortBy(enrichedBooks, sortingOptions.fields);
if(sortingOptions.order == "desc") {
sortedBooks = _.reverse(sortedBooks);
}
// Selecting fields
var fields = options.format.fields;
var formattedBooks = _.map(sortedBooks, function(book) {
var book = _.pick(book, fields);
return _.omitBy(book, _.isUndefined);
});
return formattedBooks;
}
CONSULTING AGREEMENT
This Consulting Agreement (this “Agreement”) is effective as of <Effective Date> by and between <Company>, and <Consultant>.
WHEREAS, the Company desires to retain the Consultant as an independent contractor to perform the Services (as defined below) for the benefit of the Company and the Consultant desires to perform such Services, on the terms described below; and
WHEREAS, the parties wish to regulate their relationship in accordance with the terms and conditions set forth in this Agreement.
NOW, THEREFORE, in consideration of the mutual promises, covenants and undertakings contained herein, the parties have agreed as set forth herein.
1. Services
1.1. During the Term (as defined below) the Consultant shall be responsible for providing the services set out in Exhibit A hereto (the “Services”). The Consultant shall provide the Services as instructed by, and shall report to the officer set forth in Exhibit A (the “Supervising Officer”) or anyone designated for such purpose by the Supervising Officer, in a diligent, professional and faithful manner.
1.2. The Consultant warrants that he/she has the necessary experience, talent, expertise, knowledge and capability to carry out his obligations and undertakings under this Agreement and all documents and agreements ancillary hereto.
1.3. The Consultant shall render the Services in a diligent manner and at a high professional standard for the benefit of the Company and shall perform and discharge well and faithfully, with devotion, honesty and fidelity, its obligations hereunder, and comply with applicable law pertaining to the Services and with all the Company’s policies, procedures and objectives, as may be reasonably determined by the Company from time to time.
1.4. The Services shall be provided and performed solely by the Consultant. The Consultant shall not assign, sub-contract or delegate the performance of the Services or any part thereof to any other person or entity, without the prior written consent of the Company.
1.5. The Consultant represents that there is no contractual or other legal restriction preventing or limiting it from entering into this Agreement or performing any of its obligations hereunder and no third party consent is required for it to enter into this Agreement and provide the Services. The Consultant shall immediately and without delay inform the Company of any affairs and/or matters that might constitute a conflict of interest with the Services to Company and/or the interests of the Company.
1.6. The Consultant will not act or attempt to act or represent itself directly or by implication as an agent of the Company or in any manner assume or create, or attempt to create, any obligation on behalf of, or in the name of the Company, without the Company’s prior written consent. Without limiting the foregoing, the Consultant will not have any right or authority to commit, obligate or bind the Company.
2. Independent Contractor; Indemnity
2.1. The parties agree that there are no, and there will not be, any employer - employee relations between the Company and the Consultant or any person providing Services on behalf of the Consultant (“Consultant Employees”) and the Consultant shall be deemed an independent contractor of the Company for all intents and purposes hereunder.
2.2. The Consultant hereby represents and warrants that the nature of the relationship with the Company was determined at the Consultant’s explicit request, for its own personal reasons, and that it explicitly demanded from the Company that no employee - employer relations be established between the Consultant or any of the Consultant Employees and the Company.
2.3. The Fee constitutes the sole and exclusive consideration, which the Company shall be required to pay the Consultant (including any of the Consultant Employees) under this Agreement, and it includes any and all payments to which the Consultant or the Consultant Employees may be entitled under this Agreement and applicable law in respect of the Services.
2.4. The Consultant undertakes to maintain a proper set of accounting books as required by law, to maintain a file with the Israeli Income Tax Authorities and with the Israel National Insurance Institute and to pay all required taxes, and make other compulsory payments in accordance with applicable law. If the Company is required pursuant to applicable law or by a competent authority to provide proof of such payments, then the Consultant shall provide the Company with such proof upon the request of the Company. The Consultant acknowledges and agrees that as a service provider to the Company neither it nor any of the Consultant Employees are entitled to receive from the Company any social benefits (including without limitation, paid vacation days, paid sick leave, severance payments, pension funds, etc.). The Consultant and the Consultant Employees are estopped from making any claim regarding the existence of employer - employee relations between the Consultant or any Consultant Employee and the Company.
2.5. If, despite the parties’ express representations and agreements hereunder, it shall, at any time, be determined by a court of competent jurisdiction that employer - employee relations exist between the Company and the Consultant or between the Company and any Consultant Employee, and as a result of such decision the Consultant and/or any Consultant Employee shall become entitled to rights and/or payments resulting from the existence of such relations, the Consultant undertakes to indemnify the Company, immediately following receipt of notice from the Company, for any loss, payment, expense or damage caused to the Company as a result of such decision. The Company shall be entitled to offset any payment to which the Consultant may become entitled under such decision from any payment due or paid to the Consultant under this Agreement.
2.6. The Consultant hereby explicitly, voluntarily, irrevocably and unconditionally waives, releases and forever discharges the Company of and from any and all demands, actions or causes of action, suits, claims, charges, complaints, promises and contracts, whether in law or in equity, which it has or may claim to have in the future against the Company with respect to the existence of an employee-employer relationship between it and the Company. This general release specifically includes, but is not limited to, claims for any rights to severance pay or any social benefits.
2.7. The parties acknowledge and agree that the Fee payable to the Consultant under this Agreement is considerably higher than what it would have been had the Consultant or any Consultant Employee been employed by the Company as an employee, and that had the Consultant or any Consultant Employee been employed by the Company as an employee, the aggregate gross salary for the Consultant and all Consultant Employees would have been only 60% of the Fee. Therefore, it is agreed that if it is determined, at any time in the future, by a court or tribunal of competent jurisdiction, that under this Agreement, the Consultant or any of the Consultant Employees was an employee of the Company, then the Consultant shall immediately return to the Company 40% of the Fee paid to Consultant in respect of such period, and such amount shall be deemed to be a loan from the Company that is immediately due and payable and shall be linked to the Israeli Consumer Price Index as of the date of payment of any amount. The aforesaid shall also be deemed as a settlement and admission of payment for purposes of Section 29 of the Severance Pay Law, 5723- 1963.
2.8. Without derogating from any other provision of this Agreement, the Consultant shall indemnify and hold the Company harmless from and against any liability, assessment or claim made by any competent authority against the Company in respect of any income tax, national insurance, social security or similar contributions or any other taxation whatsoever, in each case relating to the provision of the Services (where such recovery is not prohibited by law). The Consultant will also indemnify the Company against any penalty, fine or interest accrued or payable by it in connection with or in consequence of any such liability, assessment or claim.
2.9. The Consultant shall make any and all payments required under applicable law and contract to all of the Consultant Employees, including without limitation, all salary, pension payments, disability and all other social benefits.
3. Term; Termination
3.1. This Agreement shall commence on the date hereof and shall continue in effect until terminated in accordance with the provisions herein (the “Term”).
3.2. Notwithstanding the provisions of Section 3.1 above and without derogating from any other remedy to which the Company may be entitled, the Company may terminate this Agreement by providing the Consultant with written notice to that effect upon a material breach by the Consultant of any term of this Agreement that has not been cured within 14 days of receipt of a written notice from the Company.
3.3. Notwithstanding the provisions set forth in this Section 3, either party may terminate this Agreement for any reason by providing the other party with 30 days prior written notice.
3.4. Sections 2, 3.4, 5, 6, 7 and 8 of this Agreement will survive the termination or expiration of this Agreement.
4. Compensation
4.1. As the sole consideration for the performance of the Services by the Consultant under this Agreement to the satisfaction of the Company, the Company shall pay the Consultant the fee set forth in Exhibit A (the “Fee”).
4.2. The Fee shall be paid against and conditioned upon receipt by the Company of a duly issued tax invoice issued by the Consultant, which, to the extent the Fee is based on an hourly fee, includes the number of hours spent providing the Services and a description of the Services provided. The Fee shall be paid by the Company to the Consultant as set forth in Exhibit A.
5. Proprietary Information
5.1. The Consultant acknowledges and agrees that it had and will have access to confidential and proprietary information concerning the business and financial activities of the Company and information and technology from the Company’s product research and development, including without limitation, the Company’s trade secrets, research and test results, ideas, processes, data, know-how, improvements, inventions, techniques and products (actual or planned), trademarks and trade names. Such information, whether documentary, written, oral or computer generated, shall be deemed to be referred to as “Proprietary Information”.
5.2. Proprietary Information shall be deemed to include any and all proprietary information disclosed by or on behalf of the Company and irrespective of form but excluding information that: (i) shall have become a part of the public knowledge except as a result of breach of the provisions of the Agreement or of this Section 5 by the Consultant; or (ii) received by the Consultant from a third party without confidentiality obligations towards the Company.
5.3. The Consultant recognizes that the Company received and will receive confidential or proprietary information from third parties, subject to a duty on the Company’s part to maintain the confidentiality of such information and to use it only for certain limited purposes. In connection with such duties, such information shall be deemed Proprietary Information hereunder, and be treated in the same manner, mutatis mutandis.
5.4. The Consultant agrees and declares that, all Proprietary Information of the Company and patents, trademarks, copyrights, designs and other rights in connection therewith shall be the sole property of the Company and its assignees. At all times, both during the engagement by the Company and after the termination thereof, the Consultant will keep in confidence and trust all Proprietary Information using the same degree of care it uses to safeguard its own proprietary information but no less than a reasonable degree of care. In addition, the Consultant will not use or disclose any Proprietary Information or anything relating to it without the prior written consent of the Company except as may be necessary in order to perform the Services.
5.5. In the event that the Consultant shall be legally required (by formal questioning or, in the written opinion of his legal counsel, by applicable securities laws) to disclose any Proprietary Information, the Consultant shall immediately notify the Company of such request or requirement prior to disclosure so that the Company may seek an appropriate protective order with the reasonable assistance of the Consultant, and/or waive compliance with the terms of this undertaking, at the Company's absolute discretion. If such order or waiver is not timely obtained, only such portion of the Proprietary Information as specifically required shall be disclosed. For the avoidance of doubt, any information disclosed pursuant to such event, shall continue to be deemed as Proprietary Information.
5.6. Upon termination of the engagement with the Company, the Consultant will promptly deliver to the Company all documents and materials of any nature pertaining to the Services, and it will not take any documents or materials or copies thereof containing any Proprietary Information. The Consultant further covenants that it will delete all copies of Proprietary Information stored in digital or electronic databases.
6. Disclosure and Assignment of Inventions
6.1. From and after the date it first became engaged with the Company, the Consultant undertakes and covenants that it will promptly disclose in confidence to the Company all inventions, improvements, designs, concepts, techniques, methods, systems, processes, know how, computer software programs, databases, mask works and trade secrets (“Inventions”) relating to the Company’s business and, whether or not patentable, copyrightable or protectable as trade secrets, that are made or conceived or first reduced to practice or created by it, either alone or jointly with others, during the period of the engagement with the Company and in connection with the provision of the Services.
6.2. The Consultant agrees that all Inventions that: (a) are developed using equipment, supplies, facilities or trade secrets of the Company; (b) result from the Services or other work performed for the Company; or (c) relate to the Company’s business or current or anticipated research and development, will be the sole and exclusive property of the Company (“Company Inventions”) and are hereby assigned to the Company.
6.3. The Consultant acknowledges that the consideration under the Agreement is sufficient consideration for, inter alia, the obligations pursuant to this Section 6 and includes any compensation due for “Service Inventions” under Chapter H of the Israeli Patents Law, 1967.
6.4. The Consultant shall immediately on request by the Company (whether during engagement with the Company or after the termination of such engagement) and at the expense of the Company:
(a) apply or join with the Company in applying for any any Proprietary Information or other protection or registration (“Protection”) for, or in relation to, any Company Inventions;
(b) execute all instruments and do all things necessary for vesting Company Inventions or Protection when obtained and all right, title and interest to and in the same absolutely and as sole beneficial owner in the Company or other person as the Company may nominate;
(c) in the event that the Company is unable for any reason, after reasonable effort, to secure The Consultant signature on any document needed in connection with the actions specified in the preceding paragraph, The Consultant hereby: (i) irrevocably designates and appoints the Company and its duly authorized officers and agents as his agent and attorney in fact, which appointment is coupled with an interest, to act for and in his behalf to execute, verify and file any such documents and to do all other lawfully permitted acts to further the purposes of the preceding paragraph with the same legal force and effect as if executed by him, and (ii) hereby waives and quitclaims to the Company any and all claims, of any nature whatsoever, which he now or may hereafter have for infringement of any Company Inventions assigned hereunder to the Company.
6.5. The Consultant agrees and acknowledges that he will not be entitled, with respect to all of the above, to any monetary consideration or any other consideration except as explicitly set forth in this Agreement, and that the consideration explicitly set forth in this Agreement is in lieu of any rights for compensation that may arise in connection with the Company Inventions under applicable law. The Consultant hereby waives any right to claim royalties or other consideration with respect to any such Company Inventions, including under Section 134 of the Israeli Patents Law - 1967. Consultant further forever waives and agrees never to assert any and all Moral Rights he may have in or with respect to any Company Inventions, even after termination of the engagement hereunder. “Moral Rights” means any right to claim authorship of a Company Invention, any right to object to any distortion or other modification of a Company Invention, and any similar right, existing under the law of any country in the world, or under any treaty
7. Non-Competition; Non- Solicitation
7.1. The Consultant agrees and undertakes that, during the Term and for a period of 12 months following termination ("Restricted Period") thereof for whatever reason shall not, directly or indirectly, as owner, partner, joint venturer, stockholder, employee, broker, agent, principal, trustee, corporate officer, director, licensor or in any capacity whatsoever engage in, become financially interested in, be employed by, or have any connection with, any business or venture that is engaged in any activity which directly competes with the Company's business anywhere in the world, other than for the exclusive benefit of the Company.
7.2. The Consultant agrees and undertakes that during the Restricted Period, it will not, directly or indirectly, including personally or in any business in which it is an officer, director or consultant, for any purpose or in any place and to the extent the matter is under his control, solicit, interfere with and/or endeavor to entice away from the Company, any person, firm or company with whom Company has had any contractual and/or commercial relationship as an employee, consultant, licenser, joint venturer, supplier, customer, distributor, agent or contractor of whatsoever nature, existing or under negotiation on the date of the Restricted Period. Notwithstanding the foregoing, this provision shall not preclude the Consultant from (i) making good faith generalized solicitations for employees through advertisements and hiring any persons through such solicitations, or (ii) responding to or hiring any employee of the Company who contacts the Consultant at his or her own initiative without any prior direct or indirect encouragement or solicitation (other than as permitted by clause (i) of this Section).
7.3. The Consultant acknowledges that the restrictions set under this Section 7 are fair and reasonable, and are essential for protection of the Company's and the Company's business, proprietary rights and other legitimate interests of the Company, in view of the nature of the business in which the Company is engaged and its innovative course. In addition, such restrictions are fully compensated for by the Fee and other benefits granted hereunder
7.4. If any one or more of the terms contained in this Section shall for any reason be held to be excessively broad with regard to time, geographic scope or activity, the term shall be construed in a manner to enable it to be enforced to the extent compatible with applicable law.
8. Miscellaneous
8.1. Withholding. Each of the parties shall withhold at source any amount required to be withheld at source by it under applicable law from any payment made hereunder. Any amount(s) so withheld at source from any such payment shall be deemed for all purposes as having been paid to the party entitled to such payment.
8.2. Governing Law; Jurisdiction. This Agreement shall be governed by and construed according to the laws of the State of Israel, without regard to the conflict of laws provisions thereof. Any dispute arising under or in relation to this Agreement shall be resolved exclusively in the competent court for Tel Aviv-Jaffa district, and each of the parties hereby irrevocably submits to the exclusive jurisdiction of such court.
8.3. Successors and Assigns. Except as otherwise expressly limited herein, the provisions hereof shall inure to the benefit of, and be binding upon, the successors, assigns, heirs, executors, and administrators of the parties hereto. None of the rights, privileges, or obligations set forth in, arising under, or created by this Agreement may be assigned or transferred without the prior consent of the other party; provided that such consent shall not be required in the event of any assignment or transfer in connection with the sale of all or substantially all of the assets or business operations of a party.
8.4. Entire Agreement; Amendment and Waiver. This Agreement and the Exhibit attached hereto constitute the full and entire understanding and agreement between the parties with regard to the subject matters hereof and thereof. Any term of this Agreement may be amended and the observance of any term hereof may be waived (either prospectively or retroactively and either generally or in a particular instance) only with the written consent of all of the parties to this Agreement.
8.5. Notices, etc. All notices and other communications required or permitted hereunder to be given to a party to this Agreement shall be in writing, in the English language, and shall be telecopied or mailed by registered or certified mail, postage prepaid, or prepaid air courier, or otherwise delivered by hand or by messenger, addressed to such party’s address as set forth below or at such other address as the party shall have furnished to each other party in writing.
8.6. Delays or Omissions. No delay or omission to exercise any right, power, or remedy accruing to any party upon any breach or default under this Agreement, shall be deemed a waiver of any other breach or default theretofore or thereafter occurring. Any waiver, permit, consent, or approval of any kind or character on the part of any party of any breach or default under this Agreement, or any waiver on the part of any party of any provisions or conditions of this Agreement, must be in writing and shall be effective only to the extent specifically set forth in such writing. All remedies, either under this Agreement or by law or otherwise afforded to any of the parties, shall be cumulative and not alternative.
8.7. Severability. If any provision of this Agreement is held by a court of competent jurisdiction to be unenforceable under applicable law, then such provision shall be excluded from this Agreement and the remainder of this Agreement shall be interpreted as if such provision were so excluded and shall be enforceable in accordance with its terms; provided, however, that in such event this Agreement shall be interpreted so as to give effect, to the greatest extent consistent with and permitted by applicable law, to the meaning and intention of the excluded provision as determined by such court of competent jurisdiction and further provided that the essential terms and conditions of this Agreement for each party remain valid, binding and enforceable.
8.8. Counterparts. This Agreement may be executed in any number of counterparts, each of which shall be deemed an original and enforceable against the parties actually executing such counterpart, and all of which together shall constitute one and the same instrument.
Exhibit A
Services
Software Consultancy and Development]. Consultant shall not devote more than <max-hours> hours of actual work per each calendar month (the "Scope of Work") for the provision of the Services unless such deviation was approved in advance and in writing by the Supervising Officer.
Supervising Officer
The Consultant shall provide the Services as instructed by, and shall report to the Company’s VP R&D.
Fee
As the sole consideration for the performance of the Services by the Consultant under this Agreement to the satisfaction of the Company, the Company shall pay to the Consultant an hourly fee of <fees> plus applicable VAT per each actual working hour of Consultant in the provision of the Services. It is hereby clarified and agreed that Consultant shall not be entitled to receive any payment for Services performed in excess of the Scope of Work, unless such deviation was approved in writing and in advance by the Supervision Officer. The Fee will be made no later than thirty (30) days from the end of the applicable calendar month (subject to the receipt of a valid and duly issued tax invoice from the Consultant as provided under Section 4.2 to the Agreement).
The Struggle
Books
Code
Contracts
Chapter 2/8
COGNITIVE SPANS
THE SPAN
Memory span
Test #1: 6 letters
B
C
Y
T
K
X
How does it feel to remind
the 6 letters?
B C Y T K X
Test #2: 10 letters
H
B
F
K
C
M
T
B
V
X
How does it feel to remind
the 10 letters?
H B F K C M T B V X
Attention span
Pomodoro Technique
Structure span
Mind spans
7 items
Memory
Attention
25 minutes
Structure
What vs. How
<span>
<span class="memory" max="7 items">
</span>
<span class="attention" max="25 minutes">
</span>
<span class="structure">
<div class="what"></div>
<div class="how"></div>
</span>
</span>
A joke
Books and attention span
CONSULTING AGREEMENT
This Consulting Agreement (this “Agreement”) is effective as of <Effective Date> by and between <Company>, and <Consultant>.
WHEREAS, the Company desires to retain the Consultant as an independent contractor to perform the Services (as defined below) for the benefit of the Company and the Consultant desires to perform such Services, on the terms described below; and
WHEREAS, the parties wish to regulate their relationship in accordance with the terms and conditions set forth in this Agreement.
NOW, THEREFORE, in consideration of the mutual promises, covenants and undertakings contained herein, the parties have agreed as set forth herein.
1. Services
1.1. During the Term (as defined below) the Consultant shall be responsible for providing the services set out in Exhibit A hereto (the “Services”). The Consultant shall provide the Services as instructed by, and shall report to the officer set forth in Exhibit A (the “Supervising Officer”) or anyone designated for such purpose by the Supervising Officer, in a diligent, professional and faithful manner.
1.2. The Consultant warrants that he/she has the necessary experience, talent, expertise, knowledge and capability to carry out his obligations and undertakings under this Agreement and all documents and agreements ancillary hereto.
1.3. The Consultant shall render the Services in a diligent manner and at a high professional standard for the benefit of the Company and shall perform and discharge well and faithfully, with devotion, honesty and fidelity, its obligations hereunder, and comply with applicable law pertaining to the Services and with all the Company’s policies, procedures and objectives, as may be reasonably determined by the Company from time to time.
1.4. The Services shall be provided and performed solely by the Consultant. The Consultant shall not assign, sub-contract or delegate the performance of the Services or any part thereof to any other person or entity, without the prior written consent of the Company.
1.5. The Consultant represents that there is no contractual or other legal restriction preventing or limiting it from entering into this Agreement or performing any of its obligations hereunder and no third party consent is required for it to enter into this Agreement and provide the Services. The Consultant shall immediately and without delay inform the Company of any affairs and/or matters that might constitute a conflict of interest with the Services to Company and/or the interests of the Company.
1.6. The Consultant will not act or attempt to act or represent itself directly or by implication as an agent of the Company or in any manner assume or create, or attempt to create, any obligation on behalf of, or in the name of the Company, without the Company’s prior written consent. Without limiting the foregoing, the Consultant will not have any right or authority to commit, obligate or bind the Company.
2. Independent Contractor; Indemnity
2.1. The parties agree that there are no, and there will not be, any employer - employee relations between the Company and the Consultant or any person providing Services on behalf of the Consultant (“Consultant Employees”) and the Consultant shall be deemed an independent contractor of the Company for all intents and purposes hereunder.
2.2. The Consultant hereby represents and warrants that the nature of the relationship with the Company was determined at the Consultant’s explicit request, for its own personal reasons, and that it explicitly demanded from the Company that no employee - employer relations be established between the Consultant or any of the Consultant Employees and the Company.
2.3. The Fee constitutes the sole and exclusive consideration, which the Company shall be required to pay the Consultant (including any of the Consultant Employees) under this Agreement, and it includes any and all payments to which the Consultant or the Consultant Employees may be entitled under this Agreement and applicable law in respect of the Services.
2.4. The Consultant undertakes to maintain a proper set of accounting books as required by law, to maintain a file with the Israeli Income Tax Authorities and with the Israel National Insurance Institute and to pay all required taxes, and make other compulsory payments in accordance with applicable law. If the Company is required pursuant to applicable law or by a competent authority to provide proof of such payments, then the Consultant shall provide the Company with such proof upon the request of the Company. The Consultant acknowledges and agrees that as a service provider to the Company neither it nor any of the Consultant Employees are entitled to receive from the Company any social benefits (including without limitation, paid vacation days, paid sick leave, severance payments, pension funds, etc.). The Consultant and the Consultant Employees are estopped from making any claim regarding the existence of employer - employee relations between the Consultant or any Consultant Employee and the Company.
2.5. If, despite the parties’ express representations and agreements hereunder, it shall, at any time, be determined by a court of competent jurisdiction that employer - employee relations exist between the Company and the Consultant or between the Company and any Consultant Employee, and as a result of such decision the Consultant and/or any Consultant Employee shall become entitled to rights and/or payments resulting from the existence of such relations, the Consultant undertakes to indemnify the Company, immediately following receipt of notice from the Company, for any loss, payment, expense or damage caused to the Company as a result of such decision. The Company shall be entitled to offset any payment to which the Consultant may become entitled under such decision from any payment due or paid to the Consultant under this Agreement.
2.6. The Consultant hereby explicitly, voluntarily, irrevocably and unconditionally waives, releases and forever discharges the Company of and from any and all demands, actions or causes of action, suits, claims, charges, complaints, promises and contracts, whether in law or in equity, which it has or may claim to have in the future against the Company with respect to the existence of an employee-employer relationship between it and the Company. This general release specifically includes, but is not limited to, claims for any rights to severance pay or any social benefits.
2.7. The parties acknowledge and agree that the Fee payable to the Consultant under this Agreement is considerably higher than what it would have been had the Consultant or any Consultant Employee been employed by the Company as an employee, and that had the Consultant or any Consultant Employee been employed by the Company as an employee, the aggregate gross salary for the Consultant and all Consultant Employees would have been only 60% of the Fee. Therefore, it is agreed that if it is determined, at any time in the future, by a court or tribunal of competent jurisdiction, that under this Agreement, the Consultant or any of the Consultant Employees was an employee of the Company, then the Consultant shall immediately return to the Company 40% of the Fee paid to Consultant in respect of such period, and such amount shall be deemed to be a loan from the Company that is immediately due and payable and shall be linked to the Israeli Consumer Price Index as of the date of payment of any amount. The aforesaid shall also be deemed as a settlement and admission of payment for purposes of Section 29 of the Severance Pay Law, 5723- 1963.
2.8. Without derogating from any other provision of this Agreement, the Consultant shall indemnify and hold the Company harmless from and against any liability, assessment or claim made by any competent authority against the Company in respect of any income tax, national insurance, social security or similar contributions or any other taxation whatsoever, in each case relating to the provision of the Services (where such recovery is not prohibited by law). The Consultant will also indemnify the Company against any penalty, fine or interest accrued or payable by it in connection with or in consequence of any such liability, assessment or claim.
2.9. The Consultant shall make any and all payments required under applicable law and contract to all of the Consultant Employees, including without limitation, all salary, pension payments, disability and all other social benefits.
3. Term; Termination
3.1. This Agreement shall commence on the date hereof and shall continue in effect until terminated in accordance with the provisions herein (the “Term”).
3.2. Notwithstanding the provisions of Section 3.1 above and without derogating from any other remedy to which the Company may be entitled, the Company may terminate this Agreement by providing the Consultant with written notice to that effect upon a material breach by the Consultant of any term of this Agreement that has not been cured within 14 days of receipt of a written notice from the Company.
3.3. Notwithstanding the provisions set forth in this Section 3, either party may terminate this Agreement for any reason by providing the other party with 30 days prior written notice.
3.4. Sections 2, 3.4, 5, 6, 7 and 8 of this Agreement will survive the termination or expiration of this Agreement.
4. Compensation
4.1. As the sole consideration for the performance of the Services by the Consultant under this Agreement to the satisfaction of the Company, the Company shall pay the Consultant the fee set forth in Exhibit A (the “Fee”).
4.2. The Fee shall be paid against and conditioned upon receipt by the Company of a duly issued tax invoice issued by the Consultant, which, to the extent the Fee is based on an hourly fee, includes the number of hours spent providing the Services and a description of the Services provided. The Fee shall be paid by the Company to the Consultant as set forth in Exhibit A.
5. Proprietary Information
5.1. The Consultant acknowledges and agrees that it had and will have access to confidential and proprietary information concerning the business and financial activities of the Company and information and technology from the Company’s product research and development, including without limitation, the Company’s trade secrets, research and test results, ideas, processes, data, know-how, improvements, inventions, techniques and products (actual or planned), trademarks and trade names. Such information, whether documentary, written, oral or computer generated, shall be deemed to be referred to as “Proprietary Information”.
5.2. Proprietary Information shall be deemed to include any and all proprietary information disclosed by or on behalf of the Company and irrespective of form but excluding information that: (i) shall have become a part of the public knowledge except as a result of breach of the provisions of the Agreement or of this Section 5 by the Consultant; or (ii) received by the Consultant from a third party without confidentiality obligations towards the Company.
5.3. The Consultant recognizes that the Company received and will receive confidential or proprietary information from third parties, subject to a duty on the Company’s part to maintain the confidentiality of such information and to use it only for certain limited purposes. In connection with such duties, such information shall be deemed Proprietary Information hereunder, and be treated in the same manner, mutatis mutandis.
5.4. The Consultant agrees and declares that, all Proprietary Information of the Company and patents, trademarks, copyrights, designs and other rights in connection therewith shall be the sole property of the Company and its assignees. At all times, both during the engagement by the Company and after the termination thereof, the Consultant will keep in confidence and trust all Proprietary Information using the same degree of care it uses to safeguard its own proprietary information but no less than a reasonable degree of care. In addition, the Consultant will not use or disclose any Proprietary Information or anything relating to it without the prior written consent of the Company except as may be necessary in order to perform the Services.
5.5. In the event that the Consultant shall be legally required (by formal questioning or, in the written opinion of his legal counsel, by applicable securities laws) to disclose any Proprietary Information, the Consultant shall immediately notify the Company of such request or requirement prior to disclosure so that the Company may seek an appropriate protective order with the reasonable assistance of the Consultant, and/or waive compliance with the terms of this undertaking, at the Company's absolute discretion. If such order or waiver is not timely obtained, only such portion of the Proprietary Information as specifically required shall be disclosed. For the avoidance of doubt, any information disclosed pursuant to such event, shall continue to be deemed as Proprietary Information.
5.6. Upon termination of the engagement with the Company, the Consultant will promptly deliver to the Company all documents and materials of any nature pertaining to the Services, and it will not take any documents or materials or copies thereof containing any Proprietary Information. The Consultant further covenants that it will delete all copies of Proprietary Information stored in digital or electronic databases.
6. Disclosure and Assignment of Inventions
6.1. From and after the date it first became engaged with the Company, the Consultant undertakes and covenants that it will promptly disclose in confidence to the Company all inventions, improvements, designs, concepts, techniques, methods, systems, processes, know how, computer software programs, databases, mask works and trade secrets (“Inventions”) relating to the Company’s business and, whether or not patentable, copyrightable or protectable as trade secrets, that are made or conceived or first reduced to practice or created by it, either alone or jointly with others, during the period of the engagement with the Company and in connection with the provision of the Services.
6.2. The Consultant agrees that all Inventions that: (a) are developed using equipment, supplies, facilities or trade secrets of the Company; (b) result from the Services or other work performed for the Company; or (c) relate to the Company’s business or current or anticipated research and development, will be the sole and exclusive property of the Company (“Company Inventions”) and are hereby assigned to the Company.
6.3. The Consultant acknowledges that the consideration under the Agreement is sufficient consideration for, inter alia, the obligations pursuant to this Section 6 and includes any compensation due for “Service Inventions” under Chapter H of the Israeli Patents Law, 1967.
6.4. The Consultant shall immediately on request by the Company (whether during engagement with the Company or after the termination of such engagement) and at the expense of the Company:
(a) apply or join with the Company in applying for any any Proprietary Information or other protection or registration (“Protection”) for, or in relation to, any Company Inventions;
(b) execute all instruments and do all things necessary for vesting Company Inventions or Protection when obtained and all right, title and interest to and in the same absolutely and as sole beneficial owner in the Company or other person as the Company may nominate;
(c) in the event that the Company is unable for any reason, after reasonable effort, to secure The Consultant signature on any document needed in connection with the actions specified in the preceding paragraph, The Consultant hereby: (i) irrevocably designates and appoints the Company and its duly authorized officers and agents as his agent and attorney in fact, which appointment is coupled with an interest, to act for and in his behalf to execute, verify and file any such documents and to do all other lawfully permitted acts to further the purposes of the preceding paragraph with the same legal force and effect as if executed by him, and (ii) hereby waives and quitclaims to the Company any and all claims, of any nature whatsoever, which he now or may hereafter have for infringement of any Company Inventions assigned hereunder to the Company.
6.5. The Consultant agrees and acknowledges that he will not be entitled, with respect to all of the above, to any monetary consideration or any other consideration except as explicitly set forth in this Agreement, and that the consideration explicitly set forth in this Agreement is in lieu of any rights for compensation that may arise in connection with the Company Inventions under applicable law. The Consultant hereby waives any right to claim royalties or other consideration with respect to any such Company Inventions, including under Section 134 of the Israeli Patents Law - 1967. Consultant further forever waives and agrees never to assert any and all Moral Rights he may have in or with respect to any Company Inventions, even after termination of the engagement hereunder. “Moral Rights” means any right to claim authorship of a Company Invention, any right to object to any distortion or other modification of a Company Invention, and any similar right, existing under the law of any country in the world, or under any treaty
7. Non-Competition; Non- Solicitation
7.1. The Consultant agrees and undertakes that, during the Term and for a period of 12 months following termination ("Restricted Period") thereof for whatever reason shall not, directly or indirectly, as owner, partner, joint venturer, stockholder, employee, broker, agent, principal, trustee, corporate officer, director, licensor or in any capacity whatsoever engage in, become financially interested in, be employed by, or have any connection with, any business or venture that is engaged in any activity which directly competes with the Company's business anywhere in the world, other than for the exclusive benefit of the Company.
7.2. The Consultant agrees and undertakes that during the Restricted Period, it will not, directly or indirectly, including personally or in any business in which it is an officer, director or consultant, for any purpose or in any place and to the extent the matter is under his control, solicit, interfere with and/or endeavor to entice away from the Company, any person, firm or company with whom Company has had any contractual and/or commercial relationship as an employee, consultant, licenser, joint venturer, supplier, customer, distributor, agent or contractor of whatsoever nature, existing or under negotiation on the date of the Restricted Period. Notwithstanding the foregoing, this provision shall not preclude the Consultant from (i) making good faith generalized solicitations for employees through advertisements and hiring any persons through such solicitations, or (ii) responding to or hiring any employee of the Company who contacts the Consultant at his or her own initiative without any prior direct or indirect encouragement or solicitation (other than as permitted by clause (i) of this Section).
7.3. The Consultant acknowledges that the restrictions set under this Section 7 are fair and reasonable, and are essential for protection of the Company's and the Company's business, proprietary rights and other legitimate interests of the Company, in view of the nature of the business in which the Company is engaged and its innovative course. In addition, such restrictions are fully compensated for by the Fee and other benefits granted hereunder
7.4. If any one or more of the terms contained in this Section shall for any reason be held to be excessively broad with regard to time, geographic scope or activity, the term shall be construed in a manner to enable it to be enforced to the extent compatible with applicable law.
8. Miscellaneous
8.1. Withholding. Each of the parties shall withhold at source any amount required to be withheld at source by it under applicable law from any payment made hereunder. Any amount(s) so withheld at source from any such payment shall be deemed for all purposes as having been paid to the party entitled to such payment.
8.2. Governing Law; Jurisdiction. This Agreement shall be governed by and construed according to the laws of the State of Israel, without regard to the conflict of laws provisions thereof. Any dispute arising under or in relation to this Agreement shall be resolved exclusively in the competent court for Tel Aviv-Jaffa district, and each of the parties hereby irrevocably submits to the exclusive jurisdiction of such court.
8.3. Successors and Assigns. Except as otherwise expressly limited herein, the provisions hereof shall inure to the benefit of, and be binding upon, the successors, assigns, heirs, executors, and administrators of the parties hereto. None of the rights, privileges, or obligations set forth in, arising under, or created by this Agreement may be assigned or transferred without the prior consent of the other party; provided that such consent shall not be required in the event of any assignment or transfer in connection with the sale of all or substantially all of the assets or business operations of a party.
8.4. Entire Agreement; Amendment and Waiver. This Agreement and the Exhibit attached hereto constitute the full and entire understanding and agreement between the parties with regard to the subject matters hereof and thereof. Any term of this Agreement may be amended and the observance of any term hereof may be waived (either prospectively or retroactively and either generally or in a particular instance) only with the written consent of all of the parties to this Agreement.
8.5. Notices, etc. All notices and other communications required or permitted hereunder to be given to a party to this Agreement shall be in writing, in the English language, and shall be telecopied or mailed by registered or certified mail, postage prepaid, or prepaid air courier, or otherwise delivered by hand or by messenger, addressed to such party’s address as set forth below or at such other address as the party shall have furnished to each other party in writing.
8.6. Delays or Omissions. No delay or omission to exercise any right, power, or remedy accruing to any party upon any breach or default under this Agreement, shall be deemed a waiver of any other breach or default theretofore or thereafter occurring. Any waiver, permit, consent, or approval of any kind or character on the part of any party of any breach or default under this Agreement, or any waiver on the part of any party of any provisions or conditions of this Agreement, must be in writing and shall be effective only to the extent specifically set forth in such writing. All remedies, either under this Agreement or by law or otherwise afforded to any of the parties, shall be cumulative and not alternative.
8.7. Severability. If any provision of this Agreement is held by a court of competent jurisdiction to be unenforceable under applicable law, then such provision shall be excluded from this Agreement and the remainder of this Agreement shall be interpreted as if such provision were so excluded and shall be enforceable in accordance with its terms; provided, however, that in such event this Agreement shall be interpreted so as to give effect, to the greatest extent consistent with and permitted by applicable law, to the meaning and intention of the excluded provision as determined by such court of competent jurisdiction and further provided that the essential terms and conditions of this Agreement for each party remain valid, binding and enforceable.
8.8. Counterparts. This Agreement may be executed in any number of counterparts, each of which shall be deemed an original and enforceable against the parties actually executing such counterpart, and all of which together shall constitute one and the same instrument.
Exhibit A
Services
Software Consultancy and Development]. Consultant shall not devote more than <max-hours> hours of actual work per each calendar month (the "Scope of Work") for the provision of the Services unless such deviation was approved in advance and in writing by the Supervising Officer.
Supervising Officer
The Consultant shall provide the Services as instructed by, and shall report to the Company’s VP R&D.
Fee
As the sole consideration for the performance of the Services by the Consultant under this Agreement to the satisfaction of the Company, the Company shall pay to the Consultant an hourly fee of <fees> plus applicable VAT per each actual working hour of Consultant in the provision of the Services. It is hereby clarified and agreed that Consultant shall not be entitled to receive any payment for Services performed in excess of the Scope of Work, unless such deviation was approved in writing and in advance by the Supervision Officer. The Fee will be made no later than thirty (30) days from the end of the applicable calendar month (subject to the receipt of a valid and duly issued tax invoice from the Consultant as provided under Section 4.2 to the Agreement).
Contracts don't respect structure span
var catalog = {
"books": [ {
"isbn": "978-1779501127",
"title": "Watchmen",
"publicationYear": 1987,
"authorID": "alan-moore",
} ],
"authors": {
"alan-moore": {
"firstName": "Alan",
"lastName": "Moore",
"bookIsbns": ["978-1779501127"]
}
}, ...
}
var options = {
query: { wholeWord: false},
format: {
fields: ["title", "author"],
sort: {fields: ["publicationYear"], order: "desc"}}
};
handleSearchQuery(catalog, "Wat", options);
//→ [
//→ {
//→ "author": "Sara Gruen",
//→ "title": "Water for Elephants"
//→ },
//→ {
//→ "author":"Alan Moore",
//→ "title": "Watchmen"
//→ }
//→ ]
function handleSearchQuery(catalog, query, options) {
// Finding books that match the query
var prefixRegExp = new RegExp("\\b" + query + "\\b");
var books = _.filter(catalog.books, function(book) {
if(options.query.wholeWord) {
return book.title.match(prefixRegExp) != null;
}
return book.title.includes(query);
});
// Enriching books
var enrichedBooks = _.map(books, function(book) {
var author = catalog.authors[book.authorID];
return _.set(book, "author",
_.capitalize(author.firstName) +
" " + _.capitalize(author.lastName));
});
// Sorting books according to options
var sortingOptions = options.format.sort;
var sortedBooks = _.sortBy(enrichedBooks, sortingOptions.fields);
if(sortingOptions.order == "desc") {
sortedBooks = _.reverse(sortedBooks);
}
// Selecting fields
var fields = options.format.fields;
var formattedBooks = _.map(sortedBooks, function(book) {
var book = _.pick(book, fields);
return _.omitBy(book, _.isUndefined);
});
return formattedBooks;
}
😒 1/5
Long function
function handleSearchQuery(catalog, query, options) {
// Finding books that match the query
var prefixRegExp = new RegExp("\\b" + query + "\\b");
var books = _.filter(catalog.books, function(book) {
if(options.query.wholeWord) {
return book.title.match(prefixRegExp) != null;
}
return book.title.includes(query);
});
// Enriching books
var enrichedBooks = _.map(books, function(book) {
var author = catalog.authors[book.authorID];
return _.set(book, "author",
_.capitalize(author.firstName) +
" " + _.capitalize(author.lastName));
});
// Sorting books according to options
var sortingOptions = options.format.sort;
var sortedBooks = _.sortBy(enrichedBooks, sortingOptions.fields);
if(sortingOptions.order == "desc") {
sortedBooks = _.reverse(sortedBooks);
}
// Selecting fields
var fields = options.format.fields;
var formattedBooks = _.map(sortedBooks, function(book) {
var book = _.pick(book, fields);
return _.omitBy(book, _.isUndefined);
});
return formattedBooks;
}
😒 2/5
Comments in
the way
function handleSearchQuery(catalog, query, options) {
// Finding books that match the query
var prefixRegExp = new RegExp("\\b" + query + "\\b");
var books = _.filter(catalog.books, function(book) {
if(options.query.wholeWord) {
return book.title.match(prefixRegExp) != null;
}
return book.title.includes(query);
});
// Enriching books
var enrichedBooks = _.map(books, function(book) {
var author = catalog.authors[book.authorID];
return _.set(book, "author",
_.capitalize(author.firstName) +
" " + _.capitalize(author.lastName));
});
// Sorting books according to options
var sortingOptions = options.format.sort;
var sortedBooks = _.sortBy(enrichedBooks, sortingOptions.fields);
if(sortingOptions.order == "desc") {
sortedBooks = _.reverse(sortedBooks);
}
// Selecting fields
var fields = options.format.fields;
var formattedBooks = _.map(sortedBooks, function(book) {
var book = _.pick(book, fields);
return _.omitBy(book, _.isUndefined);
});
return formattedBooks;
}
High level
(what)
High level
(what)
Low level
(how)
😒 3/5
What
mixed with
How
Low level
(how)
function handleSearchQuery(catalog, query, options) {
// Finding books that match the query
var prefixRegExp = new RegExp("\\b" + query + "\\b");
var books = _.filter(catalog.books, function(book) {
if(options.query.wholeWord) {
return book.title.match(prefixRegExp) != null;
}
return book.title.includes(query);
});
// Enriching books
var enrichedBooks = _.map(books, function(book) {
var author = catalog.authors[book.authorID];
return _.set(book, "author",
_.capitalize(author.firstName) +
" " + _.capitalize(author.lastName));
});
// Sorting books according to options
var sortingOptions = options.format.sort;
var sortedBooks = _.sortBy(enrichedBooks, sortingOptions.fields);
if(sortingOptions.order == "desc") {
sortedBooks = _.reverse(sortedBooks);
}
// Selecting fields
var fields = options.format.fields;
var formattedBooks = _.map(sortedBooks, function(book) {
var book = _.pick(book, fields);
return _.omitBy(book, _.isUndefined);
});
return formattedBooks;
}
search
enrich
pick
sort
😒 4/5
Unclear Flow
function handleSearchQuery(catalog, query, options) {
// Finding books that match the query
var prefixRegExp = new RegExp("\\b" + query + "\\b");
var books = _.filter(catalog.books, function(book) {
if(options.query.wholeWord) {
return book.title.match(prefixRegExp) != null;
}
return book.title.includes(query);
});
// Enriching books
var enrichedBooks = _.map(books, function(book) {
var author = catalog.authors[book.authorID];
return _.set(book, "author",
_.capitalize(author.firstName) +
" " + _.capitalize(author.lastName));
});
// Sorting books according to options
var sortingOptions = options.format.sort;
var sortedBooks = _.sortBy(enrichedBooks, sortingOptions.fields);
if(sortingOptions.order == "desc") {
sortedBooks = _.reverse(sortedBooks);
}
// Selecting fields
var fields = options.format.fields;
var formattedBooks = _.map(sortedBooks, function(book) {
var book = _.pick(book, fields);
return _.omitBy(book, _.isUndefined);
});
return formattedBooks;
}
sort
enrichedBooks
sortingOptions
sortedBooks
😒 5/5
Unclear Scope
Coding style that challenges
congnitive spans
- Long functions
Memory
Attention
- Unclear flow
- Unclear scope
Structure
- What mixed with How
- Comments in the way
😒
Chapter 3/8
THE REVELATION
Programs must be written
for people to read,
and only incidentally
for machines to execute
Chapter 4/8
FUNDAMENTAL THEOREM OF CODE WRITING
Code that is written
with respect to our
cognitive spans
is
fun to read
The fundamental theorem of code writing
😊
😊
😊
Guidelines
🔑 1/3
Small functions
function handleSearchQuery(catalog, query, options) {
var books = searchBooks(catalog.books, query, options.query);
var enrichedBooks = enrichBooks(books, catalog.authors);
var sortedBooks = sortBooks(enrichedBooks, options.format.sort);
return selectBooksFields(sortedBooks, options.format.fields);
}
🔑 2/3
Single level of abstraction
function searchBooks(books, query, queryOptions) {
return _.filter(books, function(book) {
return matchQuery(book, query, queryOptions);
});
}
🔑 3/3
Descriptive names instead of comments
function sortBooks(books, sortingOptions) {
var sortedBooks = sortByFields(books, sortingOptions);
return maybeReverse(sortedBooks, sortingOptions);
}
Benefits
function handleSearchQuery(catalog, query, options) {
var books = searchBooks(catalog.books, query, options.query);
var enrichedBooks = enrichBooks(books, catalog.authors);
var sortedBooks = sortBooks(enrichedBooks, options.format.sort);
return selectBooksFields(sortedBooks, options.format.fields);
}
search
enrich
pick
sort
😊 1/3
Clear flow
😊 2/3
Clear scope
function sortBooks(books, sortingOptions) {
var sortedBooks = sortByFields(books, sortingOptions);
return maybeReverse(sortedBooks, sortingOptions);
}
sortBooks
enrichedBooks
sortingOptions
sortedBooks
😊 3/3
Interactivity
function sortBooks(books, sortingOptions) {
var sortedBooks = sortByFields(books, sortingOptions);
return maybeReverse(sortedBooks, sortingOptions);
}
Coding style that respects
cognitive spans
- Small functions
Memory
Attention
- Interactivity
- Descriptive names instead of comments
Structure
- Single level of abstraction
- Clear scope
- Clear flow
😊
Chapter 5/8
IN PRACTICE
Only in JavaScript?
Data-Oriented Programming
- Code is separated from data
Functions
Maps
- No types
Immutable
- No surprise
Moderation
- Too many level of nesting
Depth
Naming
- Naming is hard
Testing
- Should we test inner functions?
First, write code the easy way, then refactor
Chapter 6/8
SUMMARY
Chapter 7/8
HOPE
Book refactoring
The consultant and the company wish to regulate their relationship(Effective Date, Company, Consultant).
The consultant shall provide services(Fee, Max hours) to the company as an independent contractor, according to those terms. The consultant shall keep in confidence proprietary information, shall not compete with the company, and agrees that all their inventions are assigned to the company.
The company shall compensate the consultant.
This agreement shall be governed by and construed according to the laws of the State of Israel.
Code refactoring
Chapter 8/8
DISCUSSION
Odaya and Advah
The Secret Art of Storytelling in Programming
By Yehonathan Sharvit
The Secret Art of Storytelling in Programming
- 175