e suas nuances
roberta arcoverde
@rla4
rla4.com
(minhas experiências, frustrações, ideias e opiniões sobre parte das coisas que influenciam a manutenibilidade de projetos de software em evolução)
1
"DRY - don't repeat yourself", Andy Hunt/Dave Thomas
The Pragmatic Programmer
"Duplication is far cheaper than the wrong abstraction" Sandi Metz
https://www.youtube.com/watch?v=x1wnI0AxpEU
mas como saber se a abstração está certa ou errada?
https://stackoverflow.blog/2020/08/12/how-we-built-it-articles-feature-stack-overflow-teams/
@aphyr, CraftConf 2015
public static List<HelpPost> All()
{
return Current
.GlobalCache
.GetSet<List<HelpPost>>(
CacheKey,
(old, ctx) =>
{
using (var sitesDb = SitesDBContext.NewContext())
{
return sitesDb.Query<HelpPost>(@"SELECT p.Id, p.Title FROM ...");
}
}, 24 * 60 * 60, 24 * 60 * 60, server: StackRedis.Server.PreferReplica);
}
não causa dor de cabeça
dev mantendo código
dev mantendo código
😢
😢
😢
😢
😢
😢
😢
😢
function reduceTweet(users) {
users.reduce((acc, curr) => {
if (curr.active) {
return acc;
}
return {...acc, [curr.id]: curr.name};
}, {});
}
function reduceWithoutCopy(users) {
users.reduce((acc, user) => {
if (!user.active) {
acc[user.id] = user.name;
}
return acc;
}, {});
}
function forLoop(users) {
const nonActiveUsers = {};
for (let i = 0; i < users.length; i++) {
if (!users[i].active) {
nonActiveUsers[users[i].id] = users[i].name;
}
}
}
names = [c.name for c in customers if c.age > 50]
names = []
for c in customers:
if c.age > 50:
names.append(c.name)
https://www.youtube.com/watch?v=GLicXcf0uUE
gato vs 猫
https://speakerdeck.com/tastapod/why-every-element-of-solid-is-wrong
Greg Wilson. Slides em: https://third-bit.com/talks/greatest-hits
Video: https://www.youtube.com/watch?v=HrVtA-ue-x0
https://www.youtube.com/watch?v=rqw_Jnv6ZX4
@rla4
rla4.com