自定义 MVVM 实现与.棱镜

Custom MVVM implementation Vs. PRISM(自定义 MVVM 实现与.棱镜)

本文介绍了自定义 MVVM 实现与.棱镜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题的灵感来自这个封闭的问题:

This question is inspired from this closed question:

Prism 实际提供什么开发商?值得吗?

我已经在企业应用程序中实现了我自己的自定义 MVVM 实现.我有兴趣知道:

I have already implemented my own custom MVVM implementations in enterprise applications. I am interested in knowing:

  • 我为什么要学习 PRISM(特别是 PRISM,而不是其他 MVVM 框架)?
  • PRISM 相对于自定义 MVVM 实施的优势和
  • 投资学习 PRISM 是否值得?

我希望这个问题不是主观的,请大家不要争论:)

I hope this question is not subjective and everyone please don't get into arguments :)

推荐答案

与许多为您执行共同任务的框架一样,您会得到:

As with many frameworks that do a common task for you, you get:

  1. 经过更多的眼球测试:不仅仅是你自己.这(希望)包括单元测试,您在构建自己的框架时可能会或可能不会这样做.
  2. 对其他开发人员更具可读性:没有其他人对您的自定义 MVVM 框架有经验.但是,如果其他开发人员加入您的项目、加入您的团队或加入您的公司,他们可以直接跳入 Prism 代码.
  3. 更好的文档:同样,任何新加入的人都可能必须通过手动收集您的大脑和团队中任何其他用户的集体知识,并通过查看源代码.第三方框架有自己的文档,互联网上还有大量博客文章.
  4. 更好的社区:您可以在 StackOverflow 上提问我如何使用 Prism 做 X?"你不能用你的自定义框架来问这个.
  5. 可能更有能力:需要为更多用户提供服务,而不仅仅是您/您的团队,因此将添加更多功能.如果您需要做一些您以前从未做过的与 MVVM 相关的事情,那么您自己的 MVVM 框架中可能没有内置对它的支持.但它很可能出现在 Prism 中.
  6. 更好的结构:假设您想做一些与 MVVM 相关的事情,但它不在 Prism 中.很有可能,这是有充分理由的!如果某些东西不在为在给定域中工作而设计的(相当成熟的)框架中,则表明您正在尝试做的是一种不自然或尴尬的解决问题的方式.使用你自己的框架,说哦,我要添加那个特性"太容易了,然后 6 个月后你意识到你犯了一个巨大的错误,因为这个新特性使你的代码很难遵循或者最终成为很多向量错误或诸如此类的东西.
  7. 一个 CV 项目:我对聘用实施并使用了自定义 MVVM 框架"的人有不同的感受.虽然这可能意味着他们很聪明,但也可能表明可怕的非在这里建造综合症".另一方面,将Microsoft Prism MVVM 框架"放在一大堆技术中可能很好,但并不令人惊叹.两全其美将是一个更长的要点,类似于深入理解 MVVM 模式,通过在切换到 MVVM Prism 之前首先实现一个用于学习目的的玩具 MVVM 框架来实现".是的,这三者之间的区别不会影响或破坏你的简历,而且非本地综合症可能会在面试中出现,但值得牢记的是,特别是如果你正在申请对于一个获得足够简历的地方,他们有能力扔掉任何让他们稍微不安的东西.
  1. Tested by many more eyeballs: than just yourself. This (hopefully) includes unit tests, which you may or may not be doing while building your own framework.
  2. More readable for other developers: nobody else has experience with your custom MVVM framework. But if another developer joins your project, or joins your team, or joins your company, they can jump straight into Prism code.
  3. Better documentation: Along the same lines, anyone new joining likely has to learn the ropes by manually gathering the collective knowledge from your brain, and any other users on the team, and by looking at the source code. Third party frameworks have their own documentation, and tons more blog posts on the internet.
  4. Better community: You can ask questions on StackOverflow about "how do I do X with Prism?" You can't ask that with your custom framework.
  5. Likely more capable: by needing to serve more users than just you/your team, more features will have been added. If you need to do something MVVM-related that you've never done before, chances are support for it isn't built in to your own MVVM framework. But it's likely in Prism.
  6. Better structure: Let's say you wanted to do something MVVM-related but it wasn't in Prism. Very likely, there's a good reason for that! If something's not in a (reasonably-mature) framework made for working in a given domain, that's a sign that what you're trying to do is an unnatural or awkward way of approaching the problem. Working with your own framework, it's too easy to say "oh I'll add that feature," then 6 months later realize you made a huge mistake because this new feature makes your code very hard to follow or ends up being a vector for lots of bugs or whatnot.
  7. A CV line-item: I would have mixed feelings toward hiring someone who had "implemented and used custom MVVM framework." While it could mean they're smart, it could also indicate the dreaded "not built here syndrome." On the other hand, putting "Microsoft Prism MVVM Framework" among a huge list of technologies could be nice, but isn't a wow-er. The best of both worlds would be a longer bullet point, along the lines of "Deep understanding of the MVVM pattern, achieved by first implementing a toy MVVM framework for learning purposes before switching to MVVM Prism." Yes, the difference between these three isn't going to make or break your CV, and not-built-here syndrome is something that would hopefully come up in an interview, but it's just worth keeping in mind, especially if you're applying for a place that gets enough resumes they can afford to throw out anything that unnerves them slightly.

这篇关于自定义 MVVM 实现与.棱镜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:自定义 MVVM 实现与.棱镜

基础教程推荐