Upload
nehal-madhani
View
84
Download
0
Embed Size (px)
Citation preview
AGENDA
Modern web architecture
How to learn to program
Key programming concepts
Streamlining your practice
Resources to learn programming
Nehal Madhani Founder & CEO Alt Legal @nehalm
Nehal Madhani is the founder and CEO of Alt Legal, whose software makes it easy for law firms to create and manage IP filings. Before starting Alt Legal, Nehal practiced as an attorney at Kirkland & Ellis, LLP. He is a self-taught Python/Django programmer. Nehal has a J.D. from the University of Pennsylvania Law School, a Certificate in Business and Public Policy from the Wharton School of Business, and a B.A. from Northwestern.
Modern web architecture
HOW DOES THE INTERNET WORK?
1. Enter a website address (URL).
2. The DNS service translates this into a specific IP address.
3. The web server at the IP address corresponding to the domain name you requested is then contacted over the internet.
4. The server comes back with data, and your web browser translates the data to content like text, images, animations, etc.
HOW DO MODERN WEBSITES AND MOBILE APPS WORK?
Request data
Receive data
UNDERSTANDING MODERN WEB ARCHITECTURE
• Web servers are just computers. Your computer can be a web server too, but it’s best practice to use a dedicated computer (usually one with hardware specially selected for that purpose) in a datacenter managed by professional administrators.
• TCP/IP, DNS, and HTTP are all plain text that is sent as messages delivered over existing networks such as cable lines, phone lines, or specially built high capacity phone lines or fiber optic lines.
• Databases are also just a program run on a computer (again, perhaps on a dedicated machine with specialized hardware), but you can run one. You probably will use your own small database as you learn to program.
UNDERSTANDING MODERN WEB ARCHITECTURE
• You make a “request” when you click a link or type in an address into your web browser.
• Your request is translated into the location of a specific file on a specific computer. This file is broken into small chunks called packets and sent to your device.
• Your device assembles the chunks and passes them to your browser. The file you have been sent (we'll say an HTML file) is a small program meant for your browser. That program contains instructions on how to present and style a web document.
SEEING FOR YOURSELF
UNDERSTANDING MODERN WEB ARCHITECTURE
• Your browser is just receiving a file full of plain text instructions, which is why you can view the source.
• Contrast this with programs that you install on your computer like Word. This program is compiled directly into machine code, so if you open it, you can't read it. It is just a series of numbers that correspond to specific instructions for your CPU.
• On the web, almost everything is transparent, and it should be this way because you don’t know who is sending your computer instructions.
• This creates a secure, transparent environment (in theory) : the browser; and a public database of who is who: DNS; and then we all let each other run programs that each other wrote on our computers.
WHAT IS AN API?
• An API is an Application Programming Interface.
• An interface is a boundary between two things. In this case, the boundary between a person and a service. A user interface on the web is a webpage. Twitter has a user interface where you can read tweets, send tweets, follow, DM, favorite, etc.
• An API is a programmatic interface. Twitter also has an API that lets you tweet, follow, DM, etc. APIs are how two programs integrate, or even how a mobile app communicates back to the servers.
• Amazon is famous for using APIs everywhere. The warehouse is an API to let any authorized user (within the company or among partners) check stock, reorder, place pull or ship requests, etc.
WHAT IS AN API?
1. An API is an Application Programming Interface. 2. An interface is boundary between two things. In this case, the boundary between a person
and a service. A user interface on the web is a webpage. Twitter has a user interface where you can read tweets, send tweets, follow, DM, favorite, etc.
3. An API is a programmatic interface. Twitter also has an API that lets you tweet, follow, DM, etc. APIs are how two programs integrate, or even how a mobile app communicates back to the servers.
4. Amazon is famous for using APIs everywhere. The warehouse is an API to let any authorized user (within the company or among partners) check stock, reorder, place pull or ship requests, etc.
WHAT ARE APIs?
Source: An introduction to APIs, https://zapier.com/learn/apis/chapter-1-introduction-to-apis/
FRONTEND LANGUAGES
BACKEND LANGUAGES
FRAMEWORKS
DATABASES
EXAMPLE: ALT LEGAL ARCHITECTURE
• Unique architecture
• Backend: Python/Django, Javascript/Node.js
• Frontend: Javascript, HTML, CSS (most websites rely on this)
• Database: Mongo, Postgres
Learning to program
FIRST ATTEMPT: A “LAWYERLY” APPROACH
FIRST ATTEMPT: A “LAWYERLY” APPROACH
FIRST ATTEMPT: A “LAWYERLY” APPROACH
THE RIGHT WAY TO LEARN PROGRAMMING: “THE HARD WAY”
THE RIGHT WAY TO LEARN PROGRAMMING: GOOGLE
THE RIGHT WAY TO LEARN PROGRAMMING: BE PART OF THE COMMUNITY
• Join local communities like Meetup
• Contribute to open source projects on Github
• Contribute to discussions on Stack Overflow, LinkedIn, and Twitter
Key programming concepts
REGULAR EXPRESSIONS
• Regular expressions (regex) are a compact way to specify a pattern of characters in text using specific rules.
• Using this language, you can set the rules for the set of potential strings you want to match. This could include sentences, statutes, and email addresses.
• For example, you can ask questions like “Does all statute cites follow a particular pattern?”
• It can even be used to do advanced searches in Microsoft Word.
REGEX SYNTAX
• \d: Matches any digit [0-9]
• \d{3,5}: Matches 3, 4, or 5 digits
• \d+: Matches any positive interger
• \D: Matches any non-digit character (anything other than a digit)
• \w: Matches any alphanumeric character (any digit, lowercase letter, or uppercase letter)
• \w+: Matches ny word
• \W: Matches any non-alphanumeric character (anything other than a digit, lowercase letter, uppercase letter)
• \s: Matches space
• [Pp]ython: Matches “Python” or “python”
DATA TYPES
• Strings: A collection of characters like “This is a trademark”.
• Integers: A whole number like 1, 2, -2, and -1.
• Floats: A number with a decimal point like 0.1 and 1.1.
• Booleans: Variables whose value is expressed as True or False.
• Array: List of other data types like Classes = [“Evidence”, “Property”, “Contracts”] Values in arrays can be retrieved using Classes[0].
FUNCTIONS
Function is a group of code that has been given a name.
Example:
def update_case(x):
```Code that accesses government databases, queries a ```particular case, updates the case, and saves the information
return x
CONDITIONS (TESTS A COMPUTER CAN COMPLETE)
• Greater than: Is one value greater than another value (>)
• Lesser than: Is one value lesser than another value (<)
• Greater than or equal: Is one value greater or equal to another value (>=)
• Lesser than or equal: Is one value lesser or equal to another value (<=)
• Equal: Is one value equal to another value (==)
• Unequal: Is one value not equal to another value (!=)
CONDITIONS (PSEUDO CODE)
If a trademark application receives a new office action:
• Find the current status date (the date the office action was issued)
• Add a new entry in my calendar: “Respond to the office action.”
• Use the date the office action was issued and add six months as the deadline to respond.
TRANSLATING INTO CODE USING CONDITIONS
If TM_APPLICATION_CURRENT_STATUS == “office action”: STATUS_DATE = TM_APPLICATION_CURRENT_STATUS_DATE CALENDAR_ENTRY_TITLE = “Respond to office action” CALENDAR_ENTRY_DEADLINE = STATUS_DATE + 6m
LOOPS
Loops are used to repeat a piece of code some set number of times or while a particular condition is true.
Example:
cases = ['124201', '125201', '178304'] for case in cases: print "Updating " + case update_case(case)
LOOPS
Another way to create loops:
index = 0 cases = [124201, 125201, 178304] while index < len(cases): print “Updating case number ” + cases[index] update_case(cases[index]) index = index + 1
Streamlining your practice
• Administrative work: Work that requires minimal interpretation like calendaring and billing
• Repetitive work: Legal tasks that are repetitive in nature and ripe for automation
• Legal work: Substantive legal tasks that require interpretation and are not entirely repetitive
DIVIDING AND CONQUERING
A DAY IN THE LIFE OF A LAWYER WHO CODES
Meet Sarah. Sarah is an IP lawyer. She has a broad practice where she helps clients protect their IP rights. Sarah prosecutes patents, trademarks, and copyrights registrations on behalf of her clients.
A DAY IN THE LIFE OF A LAWYER WHO CODES
At 9AM, Sarah reads an email from a client whose photos are being made available for download illegally. The infringing party has copies all the photos all over its website and hasn't even bothered to change the names of the files.
A DAY IN THE LIFE OF A LAWYER WHO CODES
Sarah’s client sent her a file with all of the filenames that he says are being infringed. Sarah uses the command line to parse the text file of file names and remove the file paths and saves it as a CSV file.
She then writes a small python program to spider the infringing website and find the links and save them back to a new file.
A DAY IN THE LIFE OF A LAWYER WHO CODES
Next, Sarah looks up the ownership information of the infringing website and finds out who is hosting the content. She just launches Terminal on her Mac and just types in whois and the infringing party’s website.
Whois www.istealphotographs.com Domain Name: ISTEALPHOTOGRAPHS.COM Registrar: GODADDY.COM, LLC Registry Registrant ID: Registrant Name: Cosmo Kramer Registrant Organization: Vandalay Industries Registrant Street: 1500 First Street Registrant City: New York Registrant State/Province: New York Registrant Postal Code: 10011 Registrant Country: United States
A DAY IN THE LIFE OF A LAWYER WHO CODES
Then, Sarah loads up her Word template for a cease and desist letter and a DMCA takedown notice for the hosting company and emails them to the respective parties with a particular subject.
Sarah uses Google Apps for her email and has created a rule that automatically tag emails “DMCA Notices” if the email subject starts with “Copyright Infringement.”
A DAY IN THE LIFE OF A LAWYER WHO CODES
Using Zapier, if a new email is tagged DMCA Notice, it automatically creates (1) follow-up reminders in Clio (her practice management software); (2) a new matter; and (3) a new billing entry.
ADDITIONAL RESOURCES
RESOURCES
• Codecademy (use this to get familiar with syntax and HTML)
• Learn python the hard way
• Learn command line the hard way
• Regex Tutorial
• Harvard CS50 Course
• Stack Overflow (programming forum)
• Treehouse (paid service)
• Codeschool (paid service)
• Dash by General Assembly (HTML, CSS, Javascript Intro)