Today, The Day of the Programmer, is a time for newbies like me to celebrate the fun we have in making. I just learned about this international holiday (okay, so maybe it’s more prominent in Russia) today. By no means do I call myself a programmer, just yet. Coder… maybe. But a programmer is some with real know-how. A person who breaths logic and loops. And one who brings life to this inanimate box we call a computer. Well, they’re not really just boxes anymore, but they still need instructions from us!
In an effort to move from front-end development to back-end dev, I’ve been taking my extra free minutes, not consumed by my toddler, as opportunities to refine my thought process. Going from designer to developer can be hard, but it’s not impossible to teach oneself to think like a programmer.
Here are my recent efforts in Ruby to create interaction with a user:
# Asking someone about themselves... puts 'Hello there, and what\'s your name?' name = gets.chomp.capitalize puts 'Your name is ' + name + '? What a lovely name!' puts 'How old are you, ' + name + '?' age = gets.chomp puts 'Pleased to meet you, ' + name + '. ' + age + ' years old is a good age to be.' puts "You\'re rocking it!" puts 'So, ' + name + ' what\'s your last name?' lname = gets.chomp.capitalize puts 'And your middle initial...?' mInitial = gets.chomp.capitalize puts 'Nice name, ' + name + ' ' + mInitial + '. ' + lname + '!' puts 'And what would you\'re favorite number be, ' + name + '?' faveNum = gets.chomp puts 'Rad!' newFaveNum = (faveNum.to_i + 1).to_s #name_grab2.rb:18:in `+': no implicit conversion of Fixnum into String (TypeError) puts "Do you think " + newFaveNum.to_s + ' could be a bigger and better choice?' # let the user respond with yes or no # if user says yes, puts newFaveNum + ' FTW!' answer = gets.chomp puts answer.upcase + '?' agree = newFaveNum.to_s + " FTW!" if answer == "YES" puts agree # else puts 'You\'re right, ' + faveNum + ' is the best number!' else puts 'You\'re right, ' + faveNum.to_s + ' is the best number!' end
And my recent efforts in Python to make an LED blink using a Raspberry Pi:
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(7, GPIO.OUT) led1 = 1 while led1 <= 25: led1 += 1 GPIO.output(7, True) time.sleep(0.25) GPIO.output(7, False) time.sleep(0.25) GPIO.output(7, True) time.sleep(0.12) GPIO.output(7, False) time.sleep(0.12) print("Show's over, folks!") GPIO.cleanup()
I still have much to learn, but I’m accelerating fast. The fog is lifting and ideas come to me quicker. Practice makes me better. And dreams manifest as more problems to be solved.
So, to all you ninjas and novices out there trying to solve our problems through the IOT: thank you for thinking, making, and inspiring! Keep doing what you do because we need you.