45
Computer programming for lawyers Nehal Madhani [email protected] @AltLegalHQ

Computer Programming for Lawyers

Embed Size (px)

Citation preview

Page 1: Computer Programming for Lawyers

Computer programming for lawyers

Nehal Madhani [email protected] @AltLegalHQ

Page 2: Computer Programming for Lawyers

AGENDA

Modern web architecture

How to learn to program

Key programming concepts

Streamlining your practice

Resources to learn programming

Page 3: Computer Programming for Lawyers

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.

Page 4: Computer Programming for Lawyers

Modern web architecture

Page 5: Computer Programming for Lawyers

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.

Page 6: Computer Programming for Lawyers

HOW DO MODERN WEBSITES AND MOBILE APPS WORK?

Request data

Receive data

Page 7: Computer Programming for Lawyers

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.

Page 8: Computer Programming for Lawyers

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.

Page 9: Computer Programming for Lawyers

SEEING FOR YOURSELF

Page 10: Computer Programming for Lawyers

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.

Page 11: Computer Programming for Lawyers

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.

Page 12: Computer Programming for Lawyers

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.

Page 13: Computer Programming for Lawyers

WHAT ARE APIs?

Source: An introduction to APIs, https://zapier.com/learn/apis/chapter-1-introduction-to-apis/

Page 14: Computer Programming for Lawyers

FRONTEND LANGUAGES

Page 15: Computer Programming for Lawyers

BACKEND LANGUAGES

Page 16: Computer Programming for Lawyers

FRAMEWORKS

Page 17: Computer Programming for Lawyers

DATABASES

Page 18: Computer Programming for Lawyers

EXAMPLE: ALT LEGAL ARCHITECTURE

•  Unique architecture

•  Backend: Python/Django, Javascript/Node.js

•  Frontend: Javascript, HTML, CSS (most websites rely on this)

•  Database: Mongo, Postgres

Page 19: Computer Programming for Lawyers

Learning to program

Page 20: Computer Programming for Lawyers

FIRST ATTEMPT: A “LAWYERLY” APPROACH

Page 21: Computer Programming for Lawyers

FIRST ATTEMPT: A “LAWYERLY” APPROACH

Page 22: Computer Programming for Lawyers

FIRST ATTEMPT: A “LAWYERLY” APPROACH

Page 23: Computer Programming for Lawyers

THE RIGHT WAY TO LEARN PROGRAMMING: “THE HARD WAY”

Page 24: Computer Programming for Lawyers

THE RIGHT WAY TO LEARN PROGRAMMING: GOOGLE

Page 25: Computer Programming for Lawyers

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

Page 26: Computer Programming for Lawyers

Key programming concepts

Page 27: Computer Programming for Lawyers

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.

Page 28: Computer Programming for Lawyers

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”

Page 29: Computer Programming for Lawyers

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].

Page 30: Computer Programming for Lawyers

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

Page 31: Computer Programming for Lawyers

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 (!=)

Page 32: Computer Programming for Lawyers

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.

Page 33: Computer Programming for Lawyers

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

Page 34: Computer Programming for Lawyers

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)

Page 35: Computer Programming for Lawyers

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

Page 36: Computer Programming for Lawyers

Streamlining your practice

Page 37: Computer Programming for Lawyers

•  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

Page 38: Computer Programming for Lawyers

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.

Page 39: Computer Programming for Lawyers

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.

Page 40: Computer Programming for Lawyers

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.

Page 41: Computer Programming for Lawyers

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

Page 42: Computer Programming for Lawyers

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.”

Page 43: Computer Programming for Lawyers

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.

Page 44: Computer Programming for Lawyers

ADDITIONAL RESOURCES

Page 45: Computer Programming for Lawyers

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)