一起了解 .Net Foundation 项目 No.13

 

.Net 基金会中包含有很多优秀的项目,今天就和笔者一起了解一下其中的一些优秀作品吧。

中文介绍

中文介绍内容翻译自英文介绍,主要采用意译、如与原文存在出入,请以原文为准。

MVVM Light Toolkit

MVVM Light Toolkit 的目标是加快 MVVM 应用程序的开发,包括有 WPF, Silverlight, Windows Store (RT), 和 Windows Phone 。

项目详情

相关链接

笔者简评

Silverlight 早已停更, Windows Phone 也早已是历史。 目前项目的目标也已经扩展到了 Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Windows 10 UWP, Windows Presentation Foundation (WPF), Silverlight, Windows Phone 。

某种意义上来说和 MvvmCross 有项目目的重叠,所以选择哪个也就见仁见智了。

英文介绍

MVVM Light Toolkit

The purpose of the MVVM Light Toolkit is to accelerate the creation and development of MVVM applications in WPF, Silverlight, Windows Store (RT), and for Windows Phone.

Project Details

以上《英文介绍》摘录自 .NET Foundation 的项目介绍 。原文受原项目许可证保护。

中文介绍

中文介绍内容翻译自英文介绍,主要采用意译、如与原文存在出入,请以原文为准。

MvvmCross

MvvmCross 是一个跨平台的 MVVM 框架,其使得开发者能够构建简洁的像素友好的原生 UI。

使用 Model-View-ViewModel (MVVM) 设计模式能够在多平台间使用一套代码共享业务逻辑。

MvvmCross 专门为 Xamarin 和移动设备生态设计。其支持 Xamarin.iOS, Xamarin.Android, Xamarin.Mac, Xamarin.Forms, Universal Windows Platform (UWP) 和 Windows Presentation Framework (WPF)。

项目详情

相关链接

笔者简评

一套代码走天下的努力从未停止,这种努力是值得的。

此类框架总能在一定程度上解决多设备 UI 需要重复开发的窘境,不过往往随着业务复杂度的攀升,为了适配而产生的额外代码又无法避免。

不论如何,业务复杂度不会随着技术框架的选择而减低,它只会从一个地方转移到另外的地方。

开发者可以尝试并使用此框架减轻初期多重开发的困难,而随着团队和业务的演变,变化永远是不会停止的。

英文介绍

MvvmCross

MvvmCross is a cross platform MVVM framework which lets you, build clean, pixel perfect, native UIs.
Share behavior and business logic in a single codebase across supported platforms, using the Model-View-ViewModel (MVVM) design pattern.
MvvmCross is a framework specifically developed for Xamarin and the mobile ecosystem. It supports Xamarin.iOS,
Xamarin.Android, Xamarin.Mac, Xamarin.Forms, Universal Windows Platform (UWP) and Windows Presentation Framework (WPF)

Project Details

以上《英文介绍》摘录自 .NET Foundation 的项目介绍 。原文受原项目许可证保护。

中文介绍

中文介绍内容翻译自英文介绍,主要采用意译、如与原文存在出入,请以原文为准。

Nancy

Nancy 是一个轻量的,简洁的 HTTP 服务构建框架,能够支持运行于 .Net Framework/Core 以及 Mono。该框架的目标在保持平台无关的前提下,保持各个环节都拥有 super-duper-happy-path 的体验(极致畅爽的开发体验)。

Nancy 能够处理 DELETEGETHEADOPTIONSPOSTPUT 和 PATCH 的请求。

其提供了一套简明优雅的 DSL 以便开发者能够稍微敲打几个字便能处理 HTTP 响应。这样开发者便可以将更多的时间应用于业务代码与核心程序。

以下便是一个简明扼要的 Hello 代码实例:

1
2
3
4
5
6
7
8
9
public class Module : NancyModule
{
public Module()
{
Get("/greet/{name}", x => {
return string.Concat("Hello ", x.name);
});
}
}

The super-duper-happy-path (极致畅爽的开发体验)

“super-duper-happy-path” (或称 SDHP) 是我们为体现 Nancy 框架的核心精神和创建的短语,并且我们秉承着 “super-duper-happy-path” 的经验,在 API 开发中努力践行。

尽管很难具体的定义这种精神是什么,毕竟这是一个非常情绪化的术语,不过其基本的奥义如下:

  • “It just works”(轻松启动) - 开发者可以轻松的用起来,而无需要将复杂的内容混合在一起。想要添加一个新的模块?好的,没问题!它将会被自动发现并弃用;想要引入一个新的视图引擎?好的,没问题!所有的工作都已经准备好了您无需过多操心;想要为模块注入一个新的依赖项?好的,没问题!默认我们将会为您定位并注入它到您的模块,完全零配置。
  • “Easily customisable”(快乐扩展) - 尽管已经能够轻松启动,但是如果需要进行自定义扩展也不应有任何障碍。比如想要自定义依赖注入容器?完全没问题!想要调整路由规则?完全没问题!通过框架的启动器机制,所有这些自定义都是小菜一碟。
  • “Low ceremony”(极致简洁) - 在您的程序中为了框架而写的 “Nancy 代码” 尽可能被保持最小。使用 Nancy 构建的应用程序中最为重要的部分应该是您的代码。我们的代码为您服务,为您编写精妙的应用程序而让路。您甚至完全可以在一篇推文(140 个字符)中将你应用程序所需要编写的 Nancy 代码全部包含其中。
  • “Low friction”(纵享丝滑) - 使用 Nancy 构建应用程序,我们将助您成功而非制造麻烦。尽管命名需要明确,配置量也被最小化,但其拥有的功能性和扩展性并不会打折,依旧强力,如您所需。

Above all, creating an application with Nancy should be a pleasure, and hopefully fun! But without sacrificing the power or extensibility that you may need as your application grows.

综上所述,采用 Nancy 构建一个应用程序将会是一件令人愉悦的乐事,完全不需要牺牲功能性和扩展性,轻松构建您的应用程序。

Project Details

相关链接

笔者简评

在 .Net 中构建 HTTP 应用程序的传统方法皆是围绕微软传统框架: WebForms 、 MVC 、 WebAPI 等等。而 Nancy 作为一个独立的开源项目已经存在很长时间,并且一直在活跃中。

如果您正想查找一个轻量型优秀 HTTP 应用程序构建框架,这回事一个不错的尝试。

英文介绍

Nancy

Nancy is a lightweight, low-ceremony, framework for building HTTP based services on .NET Framework/Core and Mono. The goal of the framework is to stay out of the way as much as possible and provide a super-duper-happy-path to all interactions.

Nancy is designed to handle DELETEGETHEADOPTIONSPOSTPUT and PATCH requests and provides a simple, elegant, Domain Specific Language (DSL) for returning a response with just a couple of keystrokes, leaving you with more time to focus on the important bits..
your code and your application.

Write your application

1
2
3
4
5
6
7
8
9
public class Module : NancyModule
{
public Module()
{
Get("/greet/{name}", x => {
return string.Concat("Hello ", x.name);
});
}
}

The super-duper-happy-path

The “super-duper-happy-path” (or SDHP if you’re ‘down with the kids’ ;-)) is a phrase we coined to describe the ethos of Nancy; and providing the “super-duper-happy-path” experience is something we strive for in all of our APIs.

While it’s hard to pin down exactly what it is, it’s a very emotive term after all, but the basic ideas behind it are:

  • “It just works” - you should be able to pick things up and use them without any mucking about. Added a new module? That’s automatically discovered for you. Brought in a new View Engine? All wired up and ready to go without you having to do anything else. Even if you add a new dependency to your module, by default we’ll locate that and inject it for you - no configuration required.
  • “Easily customisable” - even though “it just works”, there shouldn’t be any barriers that get in the way of customisation should you want to work the way you want to work with the components that you want to use. Want to use another container? No problem! Want to tweak the way routes are selected? Go ahead! Through our bootstrapper approach all of these things should be a piece of cake.
  • “Low ceremony” - the amount of “Nancy code” you should need in your application should be minimal. The important part of any Nancy application is your code - our code should get out of your way and let you get on with building awesome applications. As a testament to this it’s actually possible to fit a functional Nancy application into a single Tweet :-)
  • “Low friction” - when building software with Nancy the APIs should help you get where you want to go, rather than getting in your way. Naming should be obvious, required configuration should be minimal, but power and extensibility should still be there when you need it.

Above all, creating an application with Nancy should be a pleasure, and hopefully fun! But without sacrificing the power or extensibility that you may need as your application grows.

Project Details

以上《英文介绍》摘录自 .NET Foundation 的项目介绍 。原文受原项目许可证保护。

其他项目

posted @ 2020-03-06 09:35  Newbe36524  阅读(669)  评论(0编辑  收藏  举报