一起了解 .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 的項目介紹 。原文受原項目許可證保護。

其他項目


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM