Natural Language Programming

17
Natural Language Modeling Creating Software from Written and Verbal Requirements Michael Blake

description

Using clues from verbal requirements to improve software design.

Transcript of Natural Language Programming

Page 1: Natural Language Programming

Natural Language ModelingCreating Software from Written and

Verbal Requirements

Michael Blake

Page 2: Natural Language Programming

Four very exciting parts of speechNouns

StringHashArrayObject

Adjectives

AccessibleAdjustableEnumerableDragable

Verbs

executeparsemerge

Adverbs

eachpotentialy_referenced_listsequentially

Page 3: Natural Language Programming

Language is an Important.

Page 4: Natural Language Programming

"lawmakers accused the Census Bureau of doing a poor job of explaining technical

requirements to Harris Corp"

http://www.latimes.com/http://www.census.gov/dmd/www/2000quest.html

Page 5: Natural Language Programming

Different Languages / Different Purposes"Why metaphorical only, why not natural language as the programming language itself?" Alistair Cockburn

Natural Language1. Ambiguous2. Contains Metaphors3. Redundant

Programming Language1. Precise2. Directive3. Less effective for picking

up women.

Page 6: Natural Language Programming

The Domain Dictionary

Terms and definitions agreed apon between the programmer and the users.

http://123.writeboard.com/1c3bee94488fdedb3

Page 7: Natural Language Programming

Nouns

"Underline the nouns."

Nouns become Objects and attributes in the system

Page 8: Natural Language Programming

User Requirements

Users will login and choose a quiz. They will sequentially be delivered a series of questions each which will contain one correct answer. Correct answers will improve their score, while incorrect answers will result in increasingly higher voltage, and sometimes fatal electrical shocks.http://123.writeboard.com/ff81e1c4fd73d7c86

Page 9: Natural Language Programming

Verbs (Actions)

Verbs become methods that act on our obejcts.

Users will login and choose a quiz. They will then be delivered a series of questions each which will contain one correct answer. Correct answers will improve their score, while incorrect answers will result in increasingly higher voltage, and sometimes fatal electrical shocks.

Page 10: Natural Language Programming

Adjectives (Modify Nouns)

Adjectives classify or determine state.

Users will login and choose a quiz. They will then be delivered a series of questions each which will contain one correct answer. Correct answers will improve their score, while incorrect answers will result in increasingly higher voltage, and sometimes fatal electrical shocks.

Page 11: Natural Language Programming

Adverbs (Modify Verbs)

Adjectives classify or determine state.

Users will login and choose a quiz. They will then be delivered a series of questions which will each contain one correct answer. Correct answers will improve their score, while incorrect answers will result in increasingly higher voltage, and sometimes fatal electrical shocks.

Page 12: Natural Language Programming

Ruby and JavaNouns : Objects

StringHashArrayObjectList (or Listable?)

Adjectives : Mixins

AccessibleAdjustableEnumerableDragable

Verbs : Methods

executeparsemerge

Adverbs : Closures

eachpotentialy_referenced_listsequentially

Page 13: Natural Language Programming

Behavior Driven Development

How do requirements relate to RSpec Stories?

Page 14: Natural Language Programming

Story: transfer from savings to checking accountAs a savings account holderI want to transfer money from my savings account to my checking accountSo that I can get cash easily from an ATM

Scenario: savings account has sufficient fundsGiven my savings account balance is $100And my checking account balance is $10When I transfer $20 from savings to checkingThen my savings account balance should be $80And my checking account balance should be $30

RSpec Story

Page 15: Natural Language Programming

An article is a word that combines with a noun to indicate the type of reference being made by the noun. The three main articles in the English language are the , an and a .

A preposition links nouns, pronouns and phrases to other words in a sentence. The word or phrase that the preposition introduces is called the object of the preposition.

Articles / Prepositions

Page 16: Natural Language Programming

Story: transfer from savings to checking accountAs a savings account holderI want to transfer money from my savings account to my checking accountSo that I can get cash easily from an ATM

Scenario: savings account has sufficient fundsGiven my savings account balance is $100And my checking account balance is $10When I transfer $20 from savings to checkingThen my savings account balance should be $80And my checking account balance should be $30

Articles / Prepositions

Page 17: Natural Language Programming

References

alistair.cockburn.us/osteele.com/archives/2007/11/sequentiallyDesign-Patterns-Object-Oriented-Addison-Wesley-Professionalwww.craiglarman.com/?title=Agile_TDD_and_Refactoringadams.id.au/blog/2007/10/what-is-behaviour-driven-developmentrspec.info/en.wikipedia.org/wiki/Article_(grammar)en.wikipedia.org/wiki/A_Wild_and_Crazy_Guy