Skip to content

Instantly share code, notes, and snippets.

@nbxx
nbxx / System Design.md
Created March 28, 2019 17:23 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@nbxx
nbxx / System Design.md
Created March 28, 2019 17:23 — forked from mylamour/System Design.md
System Design Cheatsheet

系统设计备忘录

挑选正确的架构约等于选择正确的战斗并做好权衡

基本步骤

  1. 明确系统边界
  • 用户案列 (描述哪些业务,事件,组合在一起会产生什么样的效果)
    • 谁使用这个系统?
    • 他们怎么使用这个系统?
using System;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace CrazyVote1
{
class Program
{
static void Main(string[] args)
using System;
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
public sealed class ExtensionAttribute : Attribute
{
}
}
/// <summary>
/// Convert Image to Icon.
/// </summary>
/// <param name="image">The source image.</param>
public static Icon ConvertToIcon(Image image, bool nullTonull = false)
{
if (image == null)
{
if (nullTonull)
{
using System;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
// Want to detect which build is used
Console.WriteLine(BuildConfiguration.IsDebug ? "Debug" : "Release");
using System.Threading;
using DevLib.Diagnostics;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Benchmark.Run(i =>
//-----------------------------------------------------------------------
// <copyright file="Benchmark.cs" company="YuGuan Corporation">
// Copyright (c) YuGuan Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DevLib.Diagnostics
{
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
static void Main(string[] args)
{
RunStopwatch(() =>
{
foreach (var item in collection)
{
DoSomething(item);
}
});
}
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
foreach (var item in collection)
{
DoSomething(item);
}
stopWatch.Stop();