The document discusses techniques for working with legacy code, including breaking dependencies, adding tests, and refactoring code in small incremental changes to introduce improvements.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Codigo legado fisl
1. Fazendo as pazes com
CÓDIGO
LEGADO
quinta-feira, 30 de junho de 2011
2. ~ 12 anos de estrada
~ Desenvolvedor Senior da Globo.com
~ Apaixonado pelo que faço ...
quinta-feira, 30 de junho de 2011
3. Guilherme Souza (não pode vir)
~ 4 anos de estrada
~ Desenvolvedor da Globo.com
~ Hacker por definição e apaixonado por tecnologia
quinta-feira, 30 de junho de 2011
21. Missão
Ensinar técnicas e formas de pensar que
facilitem e deixem a todos confiantes para
mexer em qualquer base de código
quinta-feira, 30 de junho de 2011
22. Era uma vez ...
quinta-feira, 30 de junho de 2011
36. Como eu faço isso ?
quinta-feira, 30 de junho de 2011
37. example.rb Page 1
class Example
def send_welcome_msg
clients = Client.get_all
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
end
client.billing << Charging.new(200)
account = client.bank_account
account.charge
end
end
end
quinta-feira, 30 de junho de 2011
38. example.rb Page 1
class Example
def send_welcome_msg
clients = Client.get_all
Quero colocar
clients.each do |client|
addresses = client.get_all_users
aqui um audit
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
end
client.billing << Charging.new(200)
account = client.bank_account
account.charge
end
end
end
quinta-feira, 30 de junho de 2011
39. Sprout
Methods
quinta-feira, 30 de junho de 2011
41. New Tested
Method
Change Point
quinta-feira, 30 de junho de 2011
42. example.rb Page 1
class Example
def send_welcome_msg
clients = Client.get_all
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
client.billing << Charging.new(200)
account = client.bank_account
account.charge
end
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
43. example.rb Page 1
class Example
def send_welcome_msg
clients = Client.get_all
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
client.billing << Charging.new(200)
account = client.bank_account
account.charge
end
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
44. example.rb Page 1
class Example
def send_welcome_msg
clients = Client.get_all
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
client.billing << Charging.new(200)
account = client.bank_account
account.charge
end
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
45. example.rb Page 1
class Example
def send_welcome_msg
clients = Client.get_all
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
DO
A
sender.from= "aoqfonseca@gmail.com"
ST
sender.to= user.mail
TE
sender.body=body
sender.send
audit_send(user.mail, body)
end
client.billing << Charging.new(200)
account = client.bank_account
account.charge
end
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
46. Sprout
Classes
quinta-feira, 30 de junho de 2011
48. New Tested
Class
Change Point
quinta-feira, 30 de junho de 2011
49. example.rb[+] Page 1
class Example
def welcome
clients = Client.get_all
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
end
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
50. Wrap
Methods
quinta-feira, 30 de junho de 2011
54. example.rb[+] Page 1
class Example
def old_welcome(clients)
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
end
end
def welcome
clients= Client.get_all
old_welcome clients
Billing.charge(clients)
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
55. example.rb[+] Page 1
class Example
def old_welcome(clients)
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
end
end
def welcome
clients= Client.get_all
old_welcome clients
Billing.charge(clients)
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
56. example.rb[+] Page 1
class Example
def old_welcome(clients)
clients.each do |client|
addresses = client.get_all_users
body = << EOF
Welcome to our system. We're very happy for your presence here.
EOF
addresses.each do |user|
sender = MailSender.new
sender.from= "aoqfonseca@gmail.com"
sender.to= user.mail
sender.body=body
sender.send
audit_send(user.mail, body)
end
end
end
def welcome
clients= Client.get_all
old_welcome clients
Billing.charge(clients)
end
def audit_send(mail, body)
audit = Audit.new
audit.operations << SendMailOperatio.new(:to=> mail, :body => body, created_at =
> Date.now)
audit.save
end
end
quinta-feira, 30 de junho de 2011
57. Wrap
Classes
quinta-feira, 30 de junho de 2011