服务交付经理与项目经理区别
更好的软件开发 (BETTER SOFTWARE DEVELOPMENT)
Truth be told, we’re all confused.
说实话,我们都感到困惑。
One thing is obvious after years of professional development, wading through tons of code. Developers are terrible at naming things.
经过数年的专业发展,经过无数次代码编写,一件事情是显而易见的。 开发人员在命名事物方面很糟糕。
As a rookie developer, I know you feel overwhelmed, puzzled or straight-up confused whenever you meet SomeService
or WhateverManager
class in the wild — or better, WhatevsManagerService
.
作为一名新手开发人员,我知道您会在遇到野外的SomeService
或WhateverManager
类(或者更好的是WhatevsManagerService
时感到不知所措,困惑或直截了当。
类名就像职位 (Class names are like job titles)
Vague.
模糊。
Business Developer? Yeah, you’re a salesperson. Social Media Ninja? You probably got a 3-week course in how to post cat pics on Instagram and develops a “sick” SoMe strategy. Software Developer? You might as well be a code monkey. Who knows which responsibilities you’re assigned.
企业发展者? 是的,你是业务员。 社交媒体忍者? 您可能有一个为期3周的课程,内容涉及如何在Instagram上发布猫图片并制定“病态” SoMe策略。 软件开发师? 您最好还是代码猴子。 谁知道您分配了哪些职责。
There’s a distinction to make. Job title and job role. We sometimes (often) like to make our titles fancier than the role we’re having.
有一个区别。 职务和职务。 我们有时(经常)喜欢使自己的头衔比我们现在所扮演的角色更出色。
The same goes for classes.
类也一样。
服务类别 (The service classes)
Anything suffixed Service
is basically a logic dumpster. Any new feature added to your application somehow always ends up implemented in some “service” class.
任何带有后缀的Service
基本上都是一个逻辑垃圾箱。 添加到您的应用程序的任何新功能总会以某种“服务”类最终实现。
A service class takes a large number of constructor arguments, making it hugely painful to test. Having to test that new method GetUserCount()
? Sure, it makes total sense we’ll need to mock 7 completely unrelated classes to even instantiate the service class.
服务类需要大量的构造函数参数,这使得测试非常痛苦。 必须测试该新方法GetUserCount()
吗? 当然,从总体上讲,我们需要模拟7个完全不相关的类,甚至实例化服务类。
If the GetUserCount()
only relies on a single constructor argument in the service class, then move it to its own class. In that way, you now have a very simple class with only one constructor argument.
如果GetUserCount()
仅依赖服务类中的单个构造函数参数,则将其移到其自己的类中。 这样,您现在有了一个非常简单的类,其中只有一个构造函数参数。
Sure, it’s not as cool to have GetUserCount
class. But at least you know exactly what it does.
当然,拥有GetUserCount
类并不那么酷。 但是至少您确切知道它的作用。
Testing becomes a breeze.
测试变得轻而易举。
经理班 (The manager classes)
You’ve likely met a UserManager
. It manages users. Whatever that means.
您可能遇到了UserManager
。 它管理用户。 不管它是什么意思。
Like service classes, they too are logical dumpsters. But there’s a slight difference. If the Service class is a general waste dumpster, a manager class is like a cardboard dumpster. It’s more specialized.
像服务类一样,它们也是逻辑转储程序。 但是有一点区别。 如果“服务”类是普通的垃圾箱,那么“管理者”类就像是纸板箱。 比较专业。
You’ll face the same issues dealing with unit tests as with the service classes. You’d need to mock a ton before doing the tiniest of operations.
您将在处理单元测试方面遇到与服务类相同的问题。 在进行最小的操作之前,您需要模拟一吨。
Utility和Helper类 (The Utility and Helper classes)
“We basically didn’t know where to put this, so here’s a WatevsUtils
class”.
“我们基本上不知道将其放在哪里,所以这里是WatevsUtils
类”。
These are annoying as hell. There’s not a whole lot more to say about this.
这些令人讨厌。 关于这一点,没有太多要说的了。
那你该怎么办? (So, what should you do?)
Simple. Give proper names matching the responsibilities. There’s no shame in naming a class GetUser
and only have a single method. It’s simple. Everyone knows what it does. It’s easy to unit test.
简单。 给出与职责匹配的专有名称。 命名类GetUser
并没有什么可耻的,它只有一个方法。 这很简单。 每个人都知道它在做什么。 单元测试很容易。
Stop the code bloat and simplify those classes. Like, one method simple.
停止代码膨胀,并简化那些类。 就像,一种方法很简单。
![Image for post](https://miro.medium.com/max/9999/0*Zh3rke_9-qnO0oha.png)
Nicklas Millard is a software development engineer in one of the fastest-growing banks, building mission-critical financial services infrastructure.
Nicklas Millard是发展最快的银行之一的软件开发工程师,负责构建关键任务金融服务基础架构。
Previously, he was a Big4 Senior Tech Consultant developing software for commercial clients and government institutions.
在此之前,他是Big4高级技术顾问,为商业客户和政府机构开发软件。
Connect on LinkedIn
在 LinkedIn上 连接
![Image for post](https://miro.medium.com/max/9999/0*uTk624mqiR1rUURv.png)
Gain Access to Expert View — Subscribe to DDI Intel
获得访问专家视图的权限- 订阅DDI Intel
服务交付经理与项目经理区别