[Presented at WordCamp Montreal <a>View session description</a>]
Simple text editors are fast and easy to use, but they don’t understand the code you’re writing. This talk explains how Integrated Development Environments (IDEs) like NetBeans or Eclipse (both are Free Software and cross-platform), can handle the tedious parts of programming to let you focus on getting things done with your code. Stop having to memorize function arguments and type out PHPDoc by hand! If you haven’t tried working with an IDE, or even if you have and got scared, this talk will walk you through the why and the how of saving time and headaches by committing to one. I’ll also cover using PHPXref, a simple alternative to IDEs that offers a lot of the same utility without changing any of your code workflow.
This talk is targeted at people coding PHP. Though IDEs are also useful for HTML, CSS and Javascript authors, their value is relative to how serious your coding is. If you’re planning to attend consider installing NetBeans beforehand so you can follow along.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Code faster and smarter PHP with IDEs Like Netbeans
1. CODE FASTER AND
SMARTER PHP WITH IDES
LIKE NETBEANS
Jeremy Clarke • http://jeremyclarke.org
Download these slides:
http://slideshare.net/jeremyclarke
2. WHO IS JEREMY CLARKE?
• Communications Studies at Concordia
University.
• HTML+CSS since 2003
• Montreal WordPress
Community/
WordCamp organizer.
3. IDES: OVERVIEW
• Basic code editors
• IDEs as a concept
• NetBeans and IDE features
• IDEs and WordPress development
• IDE issues and justifications
• PHPXref
4. BASIC CODE EDITORS
Tabs
• Texteditor with Syntax
extra tools. highlighting
• Lightweight and
Line
simple. Numbers
• Often many
features, but always
some missing. Complex
Find/Replace
* Sublime Text 2 (pseudo-IDE) http://sublimetext.com/dev
5. 3 PRINCIPLES OF IDES
• Handle everything
• The IDE should be the only application you need, all tools
are built-in and integrated together.
• Understand the code
• Codeis parsed and modelled by the IDE so it can help you
make decisions and correct your mistakes.
• Extreme customizability
• By programmers, for programmers. Every aspect is optional.
6. NETBEANS OVERVIEW
• Written by Sun in and for use with Java.
• Open Source/Free Software.
• Similar
to competitors Eclipse,
Komodo, PHPStorm, Aptana etc.
• Has hundreds of features, not all
implemented perfectly*. http://netbeans.org/
*Projects, tabs, split-window, multiple-window, navigator, bookmarks, code folding, macros, snippets, debugging, breakpoints,
database access, SVN integration, syntax coloring (configurable), PHP error detection, code hints, code completion, PHPDoc
generation, inline PHPDoc display, quick-open file, find usages of function/variable, go to function, go to line, PHPUnit testing, IDE
log, rename function/variable, configurable keyboard shortcuts, synonymous keyboard shortcuts. Infinitely more, I don’t even
pretend to know them all.
7. PROJECT-ORIENTED
• IDEs open projects instead of single files.
• A project includes all files used for a single site.
• The whole project is parsed together, the IDE
understands how the functions and variables interact.
• All forms of search and auto-complete apply to the
entire project.
• This includes all of core WordPress, plugins and themes.
8. SYNTAX INTELLIGENCE
• Configurable syntax color
themes. Matching variables
Syntax error
highlighted
• Visualhints for brackets
and control structure
pairs (if/endif;)
• Highlightother uses of
variable and functions
• PHP/HTML/CSS syntax
error checking.
9. CODE COMPLETION
• Guesses object, function Possible functions/arguments
and variable names as
you type. PHPDoc of selection
• Like
spellcheck for code.
Saves time and avoids
errors.
• Setsup arguments to be
quickly filled in.
• Exposes documentation
as you code!
10. PHPDOC INTEGRATION
• PHPDoc is default documentation for PHP, used by core WP.
• Reading
(autocomplete) AND writing PHPDoc is built into
NetBeans.
• Automatically generate PHPDoc for new functions.
Automatically- Filled-in function
generated PHPDoc documentation
11. SOURCE NAVIGATION
• Navigator pane shows full list of
functions in current file.
• Go to symbol: Jump to a function/
class, guesses as you type.
• Go to file: Open any file in the
project, guesses as you type.
• Go to declaration: Select a function
and a keyboard shortcut jumps you
to it’s definition in the source,
opening a new file if necessary.
12. DEEP SEARCH
Find in Project Find Usages
Search entire project for any List every time a function
string, results sorted by file. or variable is used.
13. SUBVERSION INTEGRATION
• Changed/added/removed lines highlighted as you edit.
• View visual diff of changes to files.
• Update, commit and revert files without leaving the app.
Note: SVN interface is awkward. Use keyboard shortcuts.
14. CUSTOMIZATION
• All keyboard shortcuts are editable.
• Tweakcolor schemes and install
new ones (e.g. Solarized).
• Enable/disable
syntax checking,
hints, autocompletion etc.
• Create
custom templates and
macros (e.g. ending semicolon).
• Settings
import/export for backing Download my color scheme:
up and sharing color schemes, simianuprising.com/netbeans-color-scheme
macros, and keyboard shortcuts.
15. SIMPLIFY WINDOW LAYOUT
• Default
view is cluttered, Close all panes you don’t
immediately need.
• Re-enable panes if/when you learn how to use them, most
features are better used as keyboard shortcuts.
BAD GOOD
16. WORDPRESS AND IDES
• Entire WordPress codebase (core, plugins, themes) is parsed
by IDE, not just your code.
• Easiest way to dive into core/plugin code and figure out how it
works.
• Autocompletemeans not having to memorize every strange,
legacy WP/PHP function and it’s argument order.
• PHPDoc of core WP means all of WordPress has an
integrated manual as you type.
17. IDE ISSUES
• Slower to boot up and requires a powerful CPU+RAM.
• Simpler text editors offer most features without extra weight.
• Many unwanted/unnecessary features clutter up the interface.
• More complicated software means steeper learning curve.
18. IDE JUSTIFICATIONS
• Professional
photo, video and even accounting software is
system-intensive. Programming can similarly benefit from giving
your CPU a workout.
• Unwanted features can be disabled or hidden to simplify UI.
Core intelligence hides until needed.
• Programming is complicated and hard. We should expect a
learning curve on software that actually thinks for us.
19. APPENDIX 0: PHPXREF
• Perl
script generates HTML that
summarizes any PHP codebase.
• http://phpxref.sourceforge.net/
• Links
for all variables and functions
showing where they are defined
and used.
• Generateyour own, or use one of
* http://phpxref.ftwr.co.uk/wordpress
many WordPress Xref ’s hosted
online*.
• Next best thing to a real IDE.
21. CODE FASTER AND
SMARTER PHP WITH IDES
LIKE NETBEANS
Jeremy Clarke • http://jeremyclarke.org
Creative Commons Share Alike
http://creativecommons.org/licenses/by-sa/3.0/
Download these slides:
http://slideshare.net/jeremyclarke