-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2865 lines (1487 loc) · 81.9 KB
/
index.html
File metadata and controls
2865 lines (1487 loc) · 81.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html class="theme-next mist use-motion" lang="">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />
<meta name="keywords" content="Hexo, NexT" />
<link rel="alternate" href="/atom.xml" title="StrGlee" type="application/atom+xml" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />
<meta property="og:type" content="website">
<meta property="og:title" content="StrGlee">
<meta property="og:url" content="http://www.strglee.com/index.html">
<meta property="og:site_name" content="StrGlee">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="StrGlee">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Mist',
sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
fancybox: true,
motion: true,
duoshuo: {
userId: '0',
author: 'Author'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://www.strglee.com/"/>
<title> StrGlee </title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="">
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3c22be1dd09d5465f2c52b44576313b4";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<div class="container sidebar-position-left
page-home
">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">StrGlee</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<h1 class="site-subtitle" itemprop="description"></h1>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
Home
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
Categories
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
Archives
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
Tags
</a>
</li>
<li class="menu-item menu-item-search">
<a href="javascript:;" class="popup-trigger">
<i class="menu-item-icon fa fa-search fa-fw"></i> <br />
Search
</a>
</li>
</ul>
<div class="site-search">
<div class="popup search-popup local-search-popup">
<div class="local-search-header clearfix">
<span class="search-icon">
<i class="fa fa-search"></i>
</span>
<span class="popup-btn-close">
<i class="fa fa-times-circle"></i>
</span>
<div class="local-search-input-wrapper">
<input autocapitalize="off" autocomplete="off" autocorrect="off"
placeholder="Searching..." spellcheck="false"
type="text" id="local-search-input">
</div>
</div>
<div id="local-search-result"></div>
</div>
</div>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://www.strglee.com/2017/11/18/brd-mrd-prd/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="StrGlee">
<meta itemprop="description" content="">
<meta itemprop="image" content="https://avatars2.githubusercontent.com/u/7496311">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="StrGlee">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/11/18/brd-mrd-prd/" itemprop="url">
BRD MRD PRD 的区别
</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-11-18T13:37:50+08:00">
2017-11-18
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/产品/" itemprop="url" rel="index">
<span itemprop="name">产品</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>作者:张鹏涛TAO</p>
<p>链接:<a href="https://www.zhihu.com/question/19655491/answer/49122402" target="_blank" rel="external">https://www.zhihu.com/question/19655491/answer/49122402</a></p>
<p>来源:知乎</p>
<p>著作权归作者所有。</p>
<p>BRD 商业需求文档 Business Requirement Document </p>
<p>MRD 市场需求文档 Market Requirement Document</p>
<p>PRD 产品需求文档 Product Requirement Document</p>
<p>好了,最好的记忆就一个单词 Business商业、Market市场、Product产品;那么这三个是什么关系呢?BRD是产品的head、MRD是产品的body、PRD是产品的Heart,有了Head、Body、Heart这就是一个完整的产品了!</p>
<h2 id="一、BRD是针对谁看的呢?"><a href="#一、BRD是针对谁看的呢?" class="headerlink" title="一、BRD是针对谁看的呢?"></a>一、BRD是针对谁看的呢?</h2><p>一般都是针对老版或CEO或者项目总负责人,那么他们需要了解的是什么呢?</p>
<h3 id="1、要做什么样的产品;"><a href="#1、要做什么样的产品;" class="headerlink" title="1、要做什么样的产品;"></a>1、要做什么样的产品;</h3><p>这就包含了项目定义,描述项目并且让老版感觉到产品的竞争优势;</p>
<h3 id="2、需要什么样的资源"><a href="#2、需要什么样的资源" class="headerlink" title="2、需要什么样的资源"></a>2、需要什么样的资源</h3><p>要什么资源就必须知道产品的市场位置,通过多少人、多长时间、多少Money、多少关系等等能够实现这样的市场位置,并且还需要有利且有力的商业说明,需要有一定的高度!</p>
<h3 id="3、最终做成什么样;"><a href="#3、最终做成什么样;" class="headerlink" title="3、最终做成什么样;"></a>3、最终做成什么样;</h3><p>要怎么做或者说怎么安排,老板们很少关心,更多的是关心产品的结果展示及盈利,这个产品能带来什么样的收入情况;</p>
<p>最终BRD就浓缩为 商业模式、盈利模式、资源投入、市场优势等;</p>
<p>哦!对了!还有重要的一点就是“战略壁垒”,为什么呢?这一点主要是针对被Copy和产品包括来做的,这一点或许决定着整个产品的成败,但是如果说有些公司有特殊的资源那就另一码事!</p>
<h2 id="二、MRD是针对谁看的呢?"><a href="#二、MRD是针对谁看的呢?" class="headerlink" title="二、MRD是针对谁看的呢?"></a>二、MRD是针对谁看的呢?</h2><p>一般都是商务、运营、市场人员,那么他们需要了解的是什么呢?整个文档对于他们的重要性?</p>
<h3 id="1、我们要找什么样的客户,进行资源合作"><a href="#1、我们要找什么样的客户,进行资源合作" class="headerlink" title="1、我们要找什么样的客户,进行资源合作"></a>1、我们要找什么样的客户,进行资源合作</h3><p>一般公司资源合作的都是商务和市场人员,或者加上运营人员,那么他们是资源拓展者,对于产品保驾护航,正如船要出海,就必须有在海里或者有水的地方,海的大小决定了船的大小,所以他们就是船的载体,不可能产品开发完介入吧?要是真是这样,那就当这里我没有说!商务、市场及运营人员在产品之前必须对于产品进行资源拓展,且快速评估产品的实现情况,MRD就是给他们一个清楚的方向,我该找什么样的客户,在这里或许有的朋友就问题了?n你没有产品这些人员不可能空说吧,看到客户该怎们沟通,这一块就是项目与运营之间一种Demo沟通了,在这里暂时不说了!</p>
<h3 id="2、找到客户后,我们该怎么和他们说"><a href="#2、找到客户后,我们该怎么和他们说" class="headerlink" title="2、找到客户后,我们该怎么和他们说"></a>2、找到客户后,我们该怎么和他们说</h3><p>上面说了MRD指引着商务、市场和运营往前走,那么找到客户该怎么和他们说呢?除了文档描述一个清晰的蓝图,或者说从红海中挖出新的路子,这里边就是MRD中的业务模式了,通过业务模式,可以看到清晰的产品,且客户可以看到他们在中间的位置,甚至说他们怎么赢利;一般给客户看到的都是PPT+Demo的方式,这样对于客户更直观更易于理解,所以MRD的文档就是给团队和客户一个说明;</p>
<h3 id="3、产品针对什么样的用户群体"><a href="#3、产品针对什么样的用户群体" class="headerlink" title="3、产品针对什么样的用户群体"></a>3、产品针对什么样的用户群体</h3><p>商务是资源拓展的关键、市场是产品保障的关键、则运营就是产品的推手,那么市场和运营就需要了解产品是针对什么用户群体的,毕竟最终的是使用人群是用户,MRD基本需要明确产品的用户人群,这样市场才能更好的进行分析,通过分析这个人群,给运营提供很好的参考资料,这样运营在推广这部分人群的时候也能够制定出很好的方案,资源优化及减少资源消耗,这就是MRD对于商务、市场、运营的关键作用;最终MRD就浓缩为产品模式、业务模式、运营模式、市场模式等,明确客户及市场方向!</p>
<h2 id="三、PRD是针对谁看的呢?"><a href="#三、PRD是针对谁看的呢?" class="headerlink" title="三、PRD是针对谁看的呢?"></a>三、PRD是针对谁看的呢?</h2><p>一般都是项目组、开发组、测试组、策划组、体验组人员;</p>
<h3 id="1、产品具体是什么样的呢?"><a href="#1、产品具体是什么样的呢?" class="headerlink" title="1、产品具体是什么样的呢?"></a>1、产品具体是什么样的呢?</h3><p>对于与产品相关的人员,就必须有一个清楚的产品概念,这个产品到底是干嘛的?插句话说,公司对于人员有一个硬管理文化,这就是公司的管理制度,而产品则是公司的软文化,让每一个参与产品的人都有一个“产品梦”,变成一群有产品信仰的人,无形中就会增加团队的战斗力。话扯回来了!要了解到底是什么产品,那就需要详细而简单的进行说明,但是这个只能是描述,还需要有与策划、开发、测试等另一种沟通语言,那就是UI、UE、原型图、流程图等,这样方便策划及开发人员的工作进展!</p>
<h3 id="2、我们该怎么实现呢?"><a href="#2、我们该怎么实现呢?" class="headerlink" title="2、我们该怎么实现呢?"></a>2、我们该怎么实现呢?</h3><p>该怎么实现,那就是规划了,包括时间、人力、资源等,什么时间完成什么事了!在前进的路上设立一些里程碑!这就对于产品经理来说就是一个挑战了?为什么呢?因为产品经理与商务、市场、运营沟通的方式和开发人员方式不一样,有什么不一样呢?商务、市场、运营更多的是发散型思维,而开发则更多是紧密型思维,对于开发人员的沟通则不能用“基本”“差不多”“还好”等这样的词来进行沟通,否则开发人员会开始发散,如果发散的和你一致的话,你就烧高香吧,如果不一致,对于程序来说推导再来,就不是那么容易的了!甚至出现了大量的BUG,有时候过多的BUG会让一个产品死掉!<br>所以就需要有详细的功能说明,细化到什么程度了,用YN原则来说明,VISIO是甚好的工具,不能出现模凌两可的语句,甚至需要通过语句进行if else描述,对了还有default,这个很关键,当程序运行正确了那固然好,如果程序出现BUG,则你不能让程序没有出口吧,那就是default了,给程序的BUG找一个合理的理由!</p>
<h3 id="3、什么样的产品才能投入到市场?"><a href="#3、什么样的产品才能投入到市场?" class="headerlink" title="3、什么样的产品才能投入到市场?"></a>3、什么样的产品才能投入到市场?</h3><p>产品开发人员更多的是站在产品角度思考问题,以实现产品而完成产品,那么产品最终开发完后,是不是能够满足运营需求呢?这时候产品经理就需要进行产品审核!怎么审核呢?简单的依据于之前的详细功能说明来进行需求审核,但是需求审核只是测试走完了第一步,第二步就是黑盒、白盒、甚至灰盒测试,走完第二部还有第三步,那就是需求优化,怎么优化呢,依据于市场人员及运营人员提供的用户数据来进行,再让产品设计人员进行UI优化,立足站在用户的角度;第三步完成了,就是最终的步骤了,体验师就起了关键性的作用,AB原则就出来了,将产品上线,体验师们就开始采集用户信息进行分析了,这个阶段对于产品的整个战略规划很关键,因为用户对于产品的第一感觉非常重要,如果是互联网产品则你可以换个网站,反正用户没法删除你的网站,但是对于移动互联网的产品APP来说,就是一个挑战了,看着不顺眼就直接给删除了,你说你的产品还有第二次机会进入用户的手机吗?除非你搞特殊!</p>
<p>PRD最终浓缩下就是产品界面、产品流程、功能需求、测试需求、体验需求等,保证产品有效率有节奏的进行!关系到整个产品的发展方向!</p>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://www.strglee.com/2017/06/08/识别微信浏览器/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="StrGlee">
<meta itemprop="description" content="">
<meta itemprop="image" content="https://avatars2.githubusercontent.com/u/7496311">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="StrGlee">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/06/08/识别微信浏览器/" itemprop="url">
识别微信浏览器
</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-06-08T15:32:00+08:00">
2017-06-08
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/微信/" itemprop="url" rel="index">
<span itemprop="name">微信</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>根据User Agent 来识别是否是微信浏览器,</p>
<p>微信在 Android 下的 User Agent<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352</div></pre></td></tr></table></figure></p>
<p>微信在 iPhone 下的 User Agent<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mozilla/5.0 (iphone; cpu iphone os 5_1_1 like mac os x) applewebkit/534.46 (khtml, like gecko) mobile/9b206 micromessenger/5.0</div></pre></td></tr></table></figure></p>
<p>只需判断是否包含关键字 micromessenger:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">if 'micromessenger' in self.user_agent.lower():</div><div class="line"> return True</div></pre></td></tr></table></figure></p>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://www.strglee.com/2017/04/19/中介者模式/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="StrGlee">
<meta itemprop="description" content="">
<meta itemprop="image" content="https://avatars2.githubusercontent.com/u/7496311">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="StrGlee">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/04/19/中介者模式/" itemprop="url">
中介者模式
</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-04-19T19:06:50+08:00">
2017-04-19
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/设计模式/" itemprop="url" rel="index">
<span itemprop="name">设计模式</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>基本原理请参考相关资料,这里直接给实例。</p>
<p>基本说明:中介者模式,( 仲裁者、集中控制),隔离了各个对象间的直接耦合</p>
<p>指挥中心分:灾害处理中心(DisasterDealCenter),边境处理中心(FrontierDealCenter)</p>
<p>处理小分队分:警犬巡逻队(SentryA),边境情报对(SentryB),边境缉毒队(sentryC)</p>
<p>小队间是平行级别,需要帮助时,向注册的指挥中心发出请求。</p>
<p>指挥中心根据请求,回复该小队,并安排其它小队配合</p>
<p><img src="/uploads/2016/11/12.jpg" alt="12" width="660" height="559" class="alignnone size-full wp-image-192"></p>
<pre><code># -*- coding: utf-8 -*-
#######################################################
#
# mediator.py
# Python implementation of the Class DisasterDealCenter
#
#######################################################
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class Headquarters(object):
"""This class defines an interface for communicating with Colleague objects.
"""
def __init__(self,name='司令部'):
self.name=name
pass
def Request(self, sentry):
pass
class DisasterDealCenter(Headquarters):
"""This class defines an interface for communicating with Colleague objects.
"""
def __init__(self,name='灾害处理中心'):
super(DisasterDealCenter,self).__init__(name)
pass
def Request(self, sentry):
pass
class FrontierDealCenter(Headquarters):
"""This class defines an interface for communicating with Colleague objects.
"""
def __init__( self,name='边防处理中心'):
super(FrontierDealCenter,self).__init__(name)
self.ls=list()
pass
def Register(self,sentry):
self.ls.append(sentry)
pass
def Request(self, sentry):
print('#############################')
print(self.name+':')
print(' 收到信息:'+sentry.info+ ' 来源:' +sentry.name)
print(' 处理:请其它小队配合')
print('\n')
sentry.Recieve('已派其它小队配合你部')
print('\n')
for obj in self.ls:
if obj!=sentry:
obj.Recieve('请迅速配合'+sentry.name)
pass
pass
pass
class Sentry(object):
"""Each colleague class knows its mediator object and communicates with its
mediator whenever it would have otherwise communicated with another colleague.
"""
m_Headquarters= Headquarters()
def __init__(self, name):
self.info=None
self.mediator=None
self.name=name
pass
def Recieve(self, info):
print(self.name+':')
print(' 收到信息:'+info)
pass
def Send(self,mediator):
pass
def Register(self,mediator):
self.mediator=mediator
pass
class SentryA(Sentry):
"""Each colleague class knows its mediator object and communicates with its
mediator whenever it would have otherwise communicated with another colleague.
"""
m_FrontierDealCenter= FrontierDealCenter()
def __init__(self, name='警犬巡逻队'):
super(SentryA,self).__init__(name)
pass
def Send(self):
self.info='发现可疑物品'
self.mediator.Request(self)
pass
class SentryB(Sentry):
"""Each colleague class knows its mediator object and communicates with its
mediator whenever it would have otherwise communicated with another colleague.
"""
m_FrontierDealCenter= FrontierDealCenter()
def __init__(self, name='边境情报队'):
super(SentryB,self).__init__(name)
def Send(self):
self.info='四点整,边境将有可疑组织活动'
self.mediator.Request(self)
pass
class SentryC(Sentry):
"""Each colleague class knows its mediator object and communicates with its
mediator whenever it would have otherwise communicated with another colleague.
"""
m_FrontierDealCenter= FrontierDealCenter()
def __init__(self, name='边境缉毒队'):
super(SentryC,self).__init__(name)
def Send(self):
self.info='有毒贩入境'
self.mediator.Request(self)
pass
#客户端
if(__name__=="__main__"):
#建立边防事务指挥中心
m_FrontierDealCenter=FrontierDealCenter()
#成立边防小队
m_SentryA=SentryA()
m_SentryB=SentryB()
m_SentryC=SentryC()
#在指挥中心注册小队
m_FrontierDealCenter.Register(m_SentryA)
m_FrontierDealCenter.Register(m_SentryB)
m_FrontierDealCenter.Register(m_SentryC)
#在各小队注册指挥中心
m_SentryA.Register(m_FrontierDealCenter)
m_SentryB.Register(m_FrontierDealCenter)
m_SentryC.Register(m_FrontierDealCenter)
#请求
m_SentryB.Send()
m_SentryA.Send()
</code></pre>
<p>运行结果:</p>
<pre><code>#############################
边防处理中心:
收到信息:四点整,边境将有可疑组织活动 来源:边境情报队
处理:请其它小队配合
边境情报队:
收到信息:已派其它小队配合你部
警犬巡逻队:
收到信息:请迅速配合边境情报队
边境缉毒队:
收到信息:请迅速配合边境情报队
#############################
边防处理中心:
收到信息:发现可疑物品 来源:警犬巡逻队
处理:请其它小队配合
警犬巡逻队:
收到信息:已派其它小队配合你部
边境情报队:
收到信息:请迅速配合警犬巡逻队
边境缉毒队:
收到信息:请迅速配合警犬巡逻队
</code></pre>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<link itemprop="mainEntityOfPage" href="http://www.strglee.com/2017/04/19/创建模式-结构模式-行为模式的区别/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="StrGlee">
<meta itemprop="description" content="">
<meta itemprop="image" content="https://avatars2.githubusercontent.com/u/7496311">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="StrGlee">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2017/04/19/创建模式-结构模式-行为模式的区别/" itemprop="url">
创建模式 vs 结构模式 vs 行为模式
</a>
</h2>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2017-04-19T19:06:50+08:00">
2017-04-19
</time>