Is your theme folder filled with files like this: page.old.2.bak.php? Does Git make you angry inside? Do you resent that everyone except you regularly visits the magical place referred to as "The Command Line"? Are you afraid of the vagrant who stole your puppet? In this workshop you will get a step-by-step introduction to working efficiently as a Drupal developer in small teams, or as a solo developer. We'll focus on real world examples you can actually use to make your work faster and more efficient.
Full workshop available at: http://designtotheme.com/workshops/work-flow-solo-developers-and-small-teams
8. In the Beginning,
Was the Command Line
A command-line interface (CLI) is a means of
interaction with a computer program where the user
(or client) issues commands to a program in the form
of successive lines of text (command lines).
The command-line interface evolved from a form of
dialog once conducted by humans over teleprinter
machines, in which human operators remotely
exchanged information, usually one line of text at a
time.
http://en.wikipedia.org/wiki/Command-line_interface
9. Commands Affect Your Environment
http://en.wikipedia.org/wiki/Logo_(programming_language)
12. define:prompt
a transitive verb meaning To move to action.
? forward 90
> open mailbox
At the command line, you are constantly being
asked by the computer, “What action would you like
to take next?”
13. Commands
(verb)
● One-word actions:
– sing
– jump
– look
● One-word commands:
– help
– exit
– history
14. Commands With Parameters
(verb noun)
● An action, and a direct object:
– take book
– read pamphlet
– open window
● Commands with parameters:
– cd /var/www
– man <command_name>
– mv file_current_name.jpg file_new_name.jpg
15. Commands With Modifiers + Parameters
(verb adjective noun)
● Refining the request:
– go down stairs
– take blue pill
– open left door
● Adding a flag/switch/modifier:
– mkdir -p parent_directory/sub-directory
– tar xvf file_to_extract.tar.gz
– ls -lh
16. Ten Commands I Use All the Time
ls list files
cd change the current directory
mv move a file to a new location (and/or rename)
cp copy a file
pwd print working directory (answers: where am I?)
rm remove file
clear refresh the screen
man read the manual page for a specific command
tar work with packages of files
chmod change the “mode” (aka permissions) of a file or directory
18. Learning the CLI tools
makes your knowledge portable.
● OSX and Linux both use the same flavour of
command line environment (“the shell”).
● Not all Web server applications have a graphical
administrative interface, so learning to use the
command line allows you to run server
applications in your local developer environment.
● Sequences of commands can be captured as
scripts, which you can run on any compatible
machine without having to point-and-click.
20. Benefits of Version Control
● Backup and restore
●
Syncronization across multiple systems
●
Short-term undo to test implications
● Long-term undo to reverse bugs
● Track changes to see why/how software evolved
● Track ownership to give ‘credit’ to change makers
● Sandboxing our code to test changes without
affecting others
21. There is no excuse
for not having version control.
The cheapest way to get version control is to use an
automated backup system, like Dropbox, for your
code.
22. Terminology
●
Repository. The database of changes to your files.
●
Server. The computer storing the repository.
●
Client. The computer connecting to the repository.
●
Working copy. Your local copy, where changes are
made.
●
Trunk (or “main”). The current, primary source for
unchanged code.
●
Head. The latest revision in the repository.
23. Basic Actions
●
Add. Put a file into the repo.
●
Revision. Checks what version a file is on.
●
Check out. Download files from the main repository.
●
Check in. Upload changed files to the main repository.
●
Changelog. A list of changes made to a file since it was
created.
●
Update/sync. Synchronize your files with the ones from
the main repository.
●
Revert. Throw away your local changes and reload the
latest version from the repository.
24. Workflow: The Solo Developer
Create project Add files Do your work Upload files
Do more work
26. Diffs Show the Difference
Between Two Versions of a Project
Main Trunk
Milk Milk Milk Milk
Eggs Eggs - Juice Eggs
+ Eggs + Juice
Juice + Soup Soup
r1 r2 r3 r4
27. define:work
Tagging
James’s Final Emma’s Groceries
Grocery List Additions Purchased
Main Trunk
Milk Milk Milk
Eggs Eggs Eggs
Soup Soup Soup
Bread Bread
M&Ms
r4 r7 r9
28. define:work Milk
Branching Eggs
Soup
Bread
St o re M&Ms r9
Ca ndy
Main Trunk
Milk Milk
Eggs Eggs
Soup Soup
Bread
r4 r7
30. Workflow: Partner
1. James starts a grocery list 2. Emma already had a grocery list started.
She asks to see James’s list.
3. James remembers a couple more items. 4. Emma adds a few things from her list.
5. The grocery lists are combined and James goes shopping.
31. Collaborative Actions
●
Branch. Create a separate copy of a repository for personal use.
●
Diff/change/delta. Identifies the differences between two
versions of a file.
●
Merge/patch. Apply the changes from one version of a file, to
another.
●
Conflict. When two versions of a file have proposed changes at
the same place.
●
Resolve. Deciding which version of conflicting changes should
be applied, and which should be discarded.
38. Complicated problems are complicated.
● Bigger code base = more contributors ->
formalized code review process
● Bigger projects = more stakeholders ->
project management
● Bigger projects = more infrastructure ->
devops
39. Formal Code Review Process
● Code should never be released into the wild
without having a second set of eyes on it.
● It’s very easy to overengineer your workflow
process.
● Make sure you do what’s right, not what’s easy,
for your team.
40. Workflow:
Decentralized with human gatekeeper
clone
commit
s)
d ate
(fo r up
pull
s
ng e
e cha
mer g
reject changes
request merge
commit
43. * Driven Development
● Test-driven development (TDD)
Write an (initially failing) automated test case that defines a
desired improvement or new function, then produces the minimum
amount of code to pass that test, and finally refactors the new
code to acceptable standards.
● Behaviour-driven development (BDD)
Behaviour-driven development specifies that tests of any unit of
software should be specified in terms of the desired behaviour of
the unit.
46. Start Today, Refine Later Today.
● Don’t try to change everything at once.
●
Look for easy things to change and implement
little bits at a time.
● Sometimes you need to have short term
inefficiencies (learning a new tool) to gain long
term productivity.
● Don’t let the enemy of progress be perfection.
47. Let’s Keep In Touch
● emma@designtotheme.com
●
@emmajanedotnet
48. Credits
● Type face:
– Neutra Text by House Industries.
● Icons:
– “Gartoon” icon theme pack for GNOME from
http://art.gnome.org/themes/icon
– http://openclipart.org/user-detail/yyycatch
●
Diagram ideas:
– http://betterexplained.com/articles/a-visual-guide-to-version-control/
– http://wiki.bazaar.canonical.com/Workflows