Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What every beginning developer should know

235 views

Published on

"What every beginning developer should know", from Codemash, January 10, 2019

Here's an article that's a sort of companion to the presentation: https://blog.newrelic.com/culture/10-secrets-learned-software-engineering-degree-probably-didnt/

Published in: Software
  • Be the first to comment

What every beginning developer should know

  1. 1. What every beginning developer should know Andy Lester CodeMash, January 10, 2019 @petdance andy@petdance.com
  2. 2. What brings you to this talk?
  3. 3. Where I'm coming from 32 years of software development Manager, team leader, hire programmers I spend a lot of time on StackOverflow (That's a lot of beginning devs)
  4. 4. Tools of the trade
  5. 5. Be able to live outside the IDE
  6. 6. Version Control Systems Branching Merging Using VCS as a team How to write a commit message
  7. 7. Let the language help gcc warnings -Wall and -Wextra JavaScript 'use strict' PHP's error_reporting(E_ALL); Perl's use warnings; use strict;
  8. 8. Static analysis tools Python: pylint, vulture, mypy PHP: phan, PHPMD Go: golint Perl: Perl::Critic Javascript: JSLint, jshint, flow SQL: sqlcheck C/C++: splint, oclint, cppcheck https://matthias-endler.de/awesome-static-analysis/
  9. 9. Serious editing vim emacs Atom Eclipse Not Notepad for God's sake
  10. 10. Make, shell scripts, and repeatability Computers do the drudge work. Humans do the thinking.
  11. 11. HTML + CSS
  12. 12. HTML+CSS Chances are your front end will be a browser Just the basics Separating structure from display
  13. 13. # ❌ Physical markup
 <b><font size="+2">Customers</b></font>
 <p>Lorem ipsum <i>cupit non proident</i></p> 
 
 
 # ✅ Semantic markup
 <h1>Customers</h1>
 <p>
 Lorem ipsum <span class="emphasis">cupit non proident</span>
 </p>
  14. 14. SQL
  15. 15. "All the SQL I know I learned on the job. Why are databases an elective? What doesn’t use a database?"
  16. 16. ID Name Manager Salary 1 Smith N 1,000 2 Jones N 1,200 3 Franklin Y 1,500 4 Davis N 800 # 10% raise for non-managers
 while (employee = read_employee())
 if employee.manager = 'N'
 employee.salary *= 1.10
 write_employee( employee )
  17. 17. ID Name Manager Salary 1 Smith N 1,000 2 Jones N 1,200 3 Franklin Y 1,500 4 Davis N 800 # 10% raise for non-managers
 UPDATE employees
 SET salary = salary * 1.10
 WHERE manager = 'N';
  18. 18. Different mindset # Iterative
 while ( employee = read_employee() )
 if employee.manager = 'N'
 employee.salary *= 1.10
 write_employee( employee ) -- Declarative
 UPDATE employees
 SET salary = salary * 1.10
 WHERE manager = 'N'; -- Plus it's faster!
  19. 19. Regular Expressions
  20. 20. Two big needs Validating data Searching source code NOT parsing
  21. 21. Validating strings Part numbers must be like "ABCD-12" Four alphas Hyphen Two digits
  22. 22. Four alphas, hyphen, two digits ok = TRUE # Assume OK
 
 for pos ( 0..3 )
 if ( !isalpha( substr(partno,pos,1 ) )
 ok = FALSE
 
 if substr(partno,4,1) != '-'
 ok = FALSE
 
 for pos ( 5..6 )
 if ( !isdigit( substr(partno,pos,1 ) )
 ok = FALSE

  23. 23. Or...
  24. 24. Four alphas, hyphen, two digits /^[A-Z]{4}-d{2}$/
  25. 25. Four alphas, hyphen, two digits # Perl
 $ok = $partno =~ /^[A-Z]{4}-d{2}$/; # PHP
 $ok = preg_match(
 '/^[A-Z]{4}-d{2}$/', $partno );
 
 # Python
 ok = re.match(
 '/^[A-Z]{4}-d{2}$/', partno )

  26. 26. Who can read that?
  27. 27. Who can read that? If you can learn to read this:
 
 f = (9/5) * c + 32
 
 You can learn to read this: 
 
 /^[A-Z]{4}-d{2}$/
  28. 28. Whitespace + comments! /^[A-Z]{4}-d{2}$/
 
 / ^ [A-Z]{4} - d{2} $ /x / 
 ^ # Start of the string
 [A-Z]{4} # Four alphas
 - # Hyphen
 d{2} # Two digits
 $ # End of string
 /x
  29. 29. Haters like to point and laugh
  30. 30. Searching for text
  31. 31. Searching source code Find all the instances of: set_user_id get_user_id set_user_name get_user_name
  32. 32. Searching source code $ grep -R set_user_id .
 $ grep -R get_user_id .
 $ grep -R set_user_name .
 $ grep -R get_user_name .
  33. 33. Searching source code $ grep -E 
 '(get|set)_user_(id|name)' 
 -R .

  34. 34. Searching source code $ ack '(get|set)_user_(id|name)'
 
 (ack is at https://beyondgrep.com)
  35. 35. Your editor uses regexes
  36. 36. Editors have helpers, too
  37. 37. A different mindset ok = TRUE # Assume OK
 for pos ( 0..3 )
 if ( !isalpha( substr(partno,pos,1 ) )
 ok = FALSE
 if substr(partno,4,1) != '-'
 ok = FALSE
 for pos ( 5..6 )
 if ( !isdigit( substr(partno,pos,1 ) )
 ok = FALSE ... or ... /^[A-Z]{4}-d{2}$/

  38. 38. Concepts
  39. 39. Debugging How to find programming problems, methodically narrowing them down to the core cause.
  40. 40. Defensive programming What do you do when "that can never happen" happens?
  41. 41. Testing Thinking in terms of causing problems Manual testing Unit testing Continuous integration
  42. 42. DRY Don't Repeat Yourself
  43. 43. Don't Repeat Yourself "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system"
 -- Andy Hunt & Dave Thomas "Cut & paste is a headache in waiting."
 -- Andy Lester
  44. 44. Efficiency
  45. 45. Most of the time "efficiency" doesn't matter.
  46. 46. Which kind of efficiency are you talking about anyway? Run-time speed? Memory usage? Disk usage? Network usage?
  47. 47. Thinking business
  48. 48. Thinking business You're there to make money for the company. Income Lower costs Saved time
  49. 49. How do I get my boss to use Language X? Show how it will make money.
  50. 50. How do I get a second monitor? Show how it will make money.
  51. 51. How do I get us to migrate to the cloud? Show how it will make money.
  52. 52. Working with existing code
  53. 53. This is what you write in school
  54. 54. This is your first project on the job "Look into ticket #3481"
  55. 55. Working with existing code Assignment 5 in CS 200 Write code that does a thing Assignment 6 Code review on another random student's Assignment 5 Badmouthing their code = instant F Assignment 7 Extending the code from Assignments 5+6
  56. 56. Written communication
  57. 57. Telecommuting in software development 2008 2010 2012 2014 2016 2018 2020
  58. 58. I made up that meaningless chart, but the point is...
  59. 59. In everything you do, whether in English or in a computer language
  60. 60. Teams are communicating remotely more
  61. 61. Written communication Slack Email Bug reports Documentation Code comments
  62. 62. What can you do to fill in these gaps?
  63. 63. Two missing textbooks
  64. 64. Work in open source Working with distributed teams Source control Project lifecycle: New features, bugs, releases, etc Test-driven development Written communication
  65. 65. Thank you for your time Andy Lester, @petdance on Twitter blog.petdance.com
  66. 66. Two competing misconceptions of beginning programmers
  67. 67. You have to have everything memorized, and if you look it up you're a loser. All you have to do is look things up on the Internet and use those answers.
  68. 68. Three traits of a great programmer Laziness Impatience Hubris -- Larry Wall, creator of patch & Perl
  69. 69. Laziness The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it.

×