├── .gitattributes
├── .gitignore
├── AdapterPattern
├── AdapterPattern.csproj
├── App.config
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── BridgePattern
├── App.config
├── BridgePattern.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── DecoratorPattern
├── App.config
├── DecoratorPattern.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── Design_Pattern.sln
├── PrototypePattern
├── App.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── PrototypePattern.csproj
└── ProxyPattern
├── App.config
├── Program.cs
├── Properties
└── AssemblyInfo.cs
└── ProxyPattern.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/AdapterPattern/AdapterPattern.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {96D91C5A-24EB-40D9-90E6-D00F8DEE4851}
8 | Exe
9 | AdapterPattern
10 | AdapterPattern
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/AdapterPattern/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AdapterPattern/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdapterPattern
8 | {
9 | /*Adapter Pattern sistemin arabirimleri gereksinimlerine tam olarak uymayan sınıfları kullanılmasını sağlar. Bu pattern özellikle hazır kodlar, araç setleri ve kütüphaneler için kullanışlıdır. Adapter Pattern'ın bir çok örneği input/output gerektirir. Örneğin geçmiş yıllarda yazılmış olan bir uygulama günümüz uygulamalarından farklı kullanıcı arayüzlerine sahip olacaktır. Sistemin bu bölümlerini yeni donanım kaynak ve olanaklarına uyarlamak, yeniden yazmaktan çok daha uygun maliyetli olacaktır. Burada araç kitleri adaptörlere ihtiyaç duyar. Yeniden kullanım için tasarlanmış olsalarda, tüm uygulamalar araç setlerinin sağladığı arabirimleri kullanamk istemeyecektir. Bu gibi durumlarda bağdaştırıcı uygulamadan çağrıları kabul edebilir ve araç takımı yöntemleriyle cağrıları uygun aktivitelere dönüştürebilir. Bu desnin önemli katkısı programlamayı arayüzlerle teşvik etmesidir. */
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | Uyarlayıcı birinciAdaptor = new Uyarlayıcı();
15 | Console.WriteLine(birinciAdaptor.SpesifikIstek(5,3));
16 |
17 | IHedef ikinciAdaptor = new Adaptor();
18 | Console.WriteLine(ikinciAdaptor.Istek(5));
19 | Console.ReadKey();
20 | }
21 | }
22 |
23 | class Uyarlayıcı//Uyarlanması gereken bir uygulama
24 | {
25 | public double SpesifikIstek (double a, double b)
26 | {
27 | return a / b;
28 | }
29 | }
30 |
31 | interface IHedef//Client'ın kullanmak istediği arayüz
32 | {
33 | string Istek(int i);
34 | }
35 |
36 | class Adaptor : Uyarlayıcı, IHedef //IHedef arayüzünü Uyarlayıcı açısından uygulayan sınıf
37 | {
38 | public string Istek(int i) //Client'ın istediği herhangi bir işlem
39 | {
40 | return "Yaklaşık tahmin " + (int)Math.Round(SpesifikIstek(i, 3));
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/AdapterPattern/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("AdapterPattern")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AdapterPattern")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("96d91c5a-24eb-40d9-90e6-d00f8dee4851")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/BridgePattern/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BridgePattern/BridgePattern.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BEBA361F-3A68-4807-954F-0F9AB236112B}
8 | Exe
9 | BridgePattern
10 | BridgePattern
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/BridgePattern/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BridgePattern
8 | {
9 | /*Bridge Pattern mevcut bir sürümün yerini alacak yeni bir yazılım sürümü çıkarıldığında kullanışlıdır. Uygulamasından bir soyutlamayı ayırır ve bağımsız olarak değişmelerini sağlar.Bridge çok basit ama çık güçlü bir kalıptır. Tek bir uygulama göz önüne alındığında bir köprü ve bir soyutlama ile birlikte ikinci bir tane ekleyebilir ve original tasarım üzerinde kayda değer bir genellik kazanabiliriz.
10 |
11 | Bu modeli şu durumlarda kullanın:
12 | 1.Her zaman aynı şekilde uygulanması gerekmeyen işlemler olduğunda bu gibi durumlarda
13 | 2.Uygulamaları client'tan tamamen gizlemek istediğimizde
14 | 3.Bir soyutlamayı tekrar derlemeden bir uygulamayı değiştirmek istediğimizde.
15 | 4.Çalışma zamanında bir sistemin farklı parçalarını birleştirmke istediğimizde.*/
16 | class Program
17 | {
18 | static void Main(string[] args)
19 | {
20 | Console.WriteLine(new Soyutlama(new Uygulama_A()).Operasyon());
21 | Console.WriteLine(new Soyutlama(new Uygulama_B()).Operasyon());
22 | Console.ReadKey();
23 | }
24 | }
25 |
26 | class Soyutlama//client'ın gördüğü arayüz
27 | {
28 | Kopru kopru;
29 | public Soyutlama(Kopru uygulama)
30 | {
31 | kopru = uygulama;
32 | }
33 |
34 | public string Operasyon()//client tarafından çağrılan bir yöntem
35 | {
36 | return "Soyutlama" + "==Koprü==" + kopru.OperasyonUygulaması();
37 | }
38 | }
39 |
40 | interface Kopru //Soyutlamanın farklı olabilecek kısımlarını tanımlayan bir interface
41 | {
42 | string OperasyonUygulaması();
43 | }
44 |
45 | class Uygulama_A : Kopru // Köprü uygulamaları
46 | {
47 | public string OperasyonUygulaması()
48 | {
49 | return "Uygulama A"; // Köprüde, Soyutlama işleminden çağrılan bir yöntem
50 | }
51 | }
52 |
53 | class Uygulama_B : Kopru //Köprü uygulamaları
54 | {
55 | public string OperasyonUygulaması()
56 | {
57 | return "Uygulama_B";
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/BridgePattern/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("BridgePattern")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BridgePattern")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("beba361f-3a68-4807-954f-0f9ab236112b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DecoratorPattern/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DecoratorPattern/DecoratorPattern.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {065BFE02-A451-4D5E-A81D-270DD8219B0B}
8 | Exe
9 | DecoratorPattern
10 | DecoratorPattern
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 | ..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll
39 |
40 |
41 |
42 | ..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll
43 |
44 |
45 | ..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/DecoratorPattern/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 |
8 | namespace DecoratorPattern
9 | {
10 | /*Decorator Pattern'ın amacı dinamik olarak nesneye yeni durum ve davranış eklemenin bir yolunu sağlamaktır. Nesne dekore edildiğini bilmediğinden bu durum gelişen sistemler için faydalı bir model haline geliyor. Dekoratör modelindeki önemli bir uygulama noktası, dekoratörlerin hem orjinal sınıfı miras alması hemde bir örneklemin kendisini içermesidir.
11 |
12 | Bu desenin temel özelliği, davranışı genişletmek için mirasa dayanmamasıdır. Decorator Pattern ile Arayüzlere herhangi bir yöntem uygulayarak bileşenin başlangıç davranışını değiştirebilirsiniz. Herhangi bir yeni durum ve davranış eklenebilir ve herhangi bir sınıfın public üyesine costruction üzerinden nesne ile erişim sağlanabilir.
13 |
14 | Decorator Pattern ne zaman tercih etmeliyim
15 | 1.Alt sınıflandırma için kullanılmayan mevcut bir bileşen sınıfna sahipken
16 | 2.Bir nesneye dinamik olarak ek durum veya davranış eklemek istediğimde
17 | 3.Sınıftaki bazı nesnelerde diğer sınıfları etkilemeden değişiklikler yapmak istediğimizde
18 | 4.Alt sınıflama yapmaktan kaçındığım durumlarda çünkü çok fazla sınıf ortaya çıkabilir
19 | */
20 |
21 | class Program
22 | {
23 | static void Main(string[] args)
24 | {
25 | IBilesen component = new Bilesen();
26 |
27 | Client.Display("1. Basit bileşen: ", component);
28 | Client.Display("2. A-decorated : ", new DecoratorA(component));
29 | Client.Display("3. B-decorated : ", new DecoratorB(component));
30 | Client.Display("4. B-A-decorated : ", new DecoratorB(new DecoratorA(component)));
31 |
32 | DecoratorB b = new DecoratorB(new Bilesen());
33 | Client.Display("5. A-B-decorated : ", new DecoratorA(b));
34 | //Eklenen durmu ve davranışı çağırmak
35 | Console.WriteLine("\t\t\t" + b.addedState + b.EklenenDavranis());
36 | Console.ReadKey();
37 | }
38 | }
39 |
40 | interface IBilesen//Dekore edilecek nesne sınıflarını tanımlayan arayüz
41 | {
42 | string Operasyon();
43 | }
44 |
45 | class Bilesen : IBilesen//Operasyonların eklenmiş veya değiştirilmiş olabilecek orijinal bir nesne sınıf
46 | {
47 | public string Operasyon()//IComponent nesnelerinde değiştirilebilecek bir işlem
48 | {
49 | return "Çalıştığım firma için";
50 | }
51 | }
52 |
53 | class DecoratorA : IBilesen//IComponent interface'sine uyan durum veya davranış ekleyen bir sınıf
54 | {
55 | IBilesen bilesen;
56 |
57 | public DecoratorA (IBilesen b)
58 | {
59 | bilesen = b;
60 | }
61 |
62 | public string Operasyon()
63 | {
64 | string s = bilesen.Operasyon();
65 | s += "Yazılım Tanımlı Ağlar ile";
66 | return s;
67 | }
68 | }
69 |
70 | class DecoratorB : IBilesen//IComponent interface'sine uyan durum veya davranış ekleyen bir sınıf
71 | {
72 | IBilesen bilesen;
73 |
74 | public string addedState = "ağ altyapısı üretiyorum";
75 |
76 | public DecoratorB(IBilesen b)
77 | {
78 | bilesen = b;
79 | }
80 |
81 | public string Operasyon()
82 | {
83 | string s = bilesen.Operasyon();
84 | s += "ve bazı robotik süreçler geliştiriyorum.";
85 | return s;
86 | }
87 |
88 | public string EklenenDavranis()
89 | {
90 | return "Ayrıca yüksek lisans öğrencisiyim.";
91 | }
92 | }
93 |
94 | class Client
95 | {
96 | public static void Display(string s, IBilesen c)
97 | {
98 | Console.WriteLine(s + c.Operasyon());
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/DecoratorPattern/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DecoratorPattern")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DecoratorPattern")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("065bfe02-a451-4d5e-a81d-270dd8219b0b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/DecoratorPattern/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Design_Pattern.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28922.388
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DecoratorPattern", "DecoratorPattern\DecoratorPattern.csproj", "{065BFE02-A451-4D5E-A81D-270DD8219B0B}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxyPattern", "ProxyPattern\ProxyPattern.csproj", "{242A3DCD-46A8-42EA-87B0-62087294F8CD}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdapterPattern", "AdapterPattern\AdapterPattern.csproj", "{96D91C5A-24EB-40D9-90E6-D00F8DEE4851}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BridgePattern", "BridgePattern\BridgePattern.csproj", "{BEBA361F-3A68-4807-954F-0F9AB236112B}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrototypePattern", "PrototypePattern\PrototypePattern.csproj", "{24B2E8BC-6F27-4385-AE03-C588D4EEF13F}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release|Any CPU = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {065BFE02-A451-4D5E-A81D-270DD8219B0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {065BFE02-A451-4D5E-A81D-270DD8219B0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {065BFE02-A451-4D5E-A81D-270DD8219B0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {065BFE02-A451-4D5E-A81D-270DD8219B0B}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {242A3DCD-46A8-42EA-87B0-62087294F8CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {242A3DCD-46A8-42EA-87B0-62087294F8CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {242A3DCD-46A8-42EA-87B0-62087294F8CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {242A3DCD-46A8-42EA-87B0-62087294F8CD}.Release|Any CPU.Build.0 = Release|Any CPU
30 | {96D91C5A-24EB-40D9-90E6-D00F8DEE4851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {96D91C5A-24EB-40D9-90E6-D00F8DEE4851}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {96D91C5A-24EB-40D9-90E6-D00F8DEE4851}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {96D91C5A-24EB-40D9-90E6-D00F8DEE4851}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {BEBA361F-3A68-4807-954F-0F9AB236112B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {BEBA361F-3A68-4807-954F-0F9AB236112B}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {BEBA361F-3A68-4807-954F-0F9AB236112B}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {BEBA361F-3A68-4807-954F-0F9AB236112B}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {24B2E8BC-6F27-4385-AE03-C588D4EEF13F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {24B2E8BC-6F27-4385-AE03-C588D4EEF13F}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {24B2E8BC-6F27-4385-AE03-C588D4EEF13F}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {24B2E8BC-6F27-4385-AE03-C588D4EEF13F}.Release|Any CPU.Build.0 = Release|Any CPU
42 | EndGlobalSection
43 | GlobalSection(SolutionProperties) = preSolution
44 | HideSolutionNode = FALSE
45 | EndGlobalSection
46 | GlobalSection(ExtensibilityGlobals) = postSolution
47 | SolutionGuid = {9997BEDB-D051-4149-A021-1EBAE98AC98D}
48 | EndGlobalSection
49 | EndGlobal
50 |
--------------------------------------------------------------------------------
/PrototypePattern/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PrototypePattern/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PrototypePattern
8 | {
9 | class Program
10 | {
11 | /*Prototype Pattern: Birkaç depolanmış prototipten birirni klonlayarak yeni nesneler yaratılır. Prototype modelinin iki avantajı bulunmaktadır. Çok büyük dinamik olarak yüklenmiş sınıfların (nesnelerin kopyalanması daha hızlı olduğunda) başlatılmasını hızlandırır ve alt sınıfı kopyalanabilen büyük bir veri yapısının tanımlanabilir bölümlerinin kaydını tutar.
12 |
13 | Prototype Pattern şu durumlarda kullanın
14 | 1.Client'tan somut sınıfları gizlemek istediğinde
15 | 2.Prototipler aracılığıyla çalışma ananında yeni sınıflar eklemek ve kaldırmak istediğimizde
16 | 3.Sistemdeki sınıf sayısını minimumda tutmak istediğimde
17 | 4.Composite pattern ile arşilemeyi sağlamayı düşündüğümüzde
18 | 5.Alt sınıfların çoğalmaya başladığı durumlarda Factory Method Pattern yerine düşünülebilir
19 |
20 | Prototip modeli bir sınıfın bir modelini seçer ver gelecekteki tüm durumlar için onu üretici olarak kullanır. Composite and Decorator patterns yoğun olarak faydalınan tasarımlar. Prototipler, nesne başlatmanın maliyetli olduğu durumlarda faydalıdır ve başlatma parametrelerinde birkaç değişiklik olmasını beklersiniz. Bu bağlamda, Prototip modeli, önceden başlatılmış bir prototipin ucuz klonlanmasını destekleyen maliyetli “sıfırdan yaratma” işlemlerinden kaçınabilir. Nesne üretim maliyetlerinin minimize etemk amaçlanmaktadır.
21 | */
22 |
23 | static void Main(string[] args)
24 | {
25 |
26 | }
27 |
28 | class Veri
29 | {
30 | public string;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/PrototypePattern/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PrototypePattern")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PrototypePattern")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("24b2e8bc-6f27-4385-ae03-c588d4eef13f")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/PrototypePattern/PrototypePattern.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {24B2E8BC-6F27-4385-AE03-C588D4EEF13F}
8 | Exe
9 | PrototypePattern
10 | PrototypePattern
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ProxyPattern/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProxyPattern/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProxyPattern
8 | {
9 | /*Proxy Pattern diğer nesnelerin oluşturulmasını ve bunlara erişimi kontrol eden nesneleri destekler. Proxy genellikle belirli koşullar netleştiğinde etkinleştirilen daha karmaşık (özel) bir nesnenin yerine geçen küçük (genel) bir nesnedir.*/
10 |
11 |
12 | class Program
13 | {
14 | static void Main(string[] args)
15 | {
16 | //subject => konu
17 | IKonu subject = new Proxy();
18 |
19 | Console.WriteLine(subject.Talep());
Console.WriteLine(subject.Talep());
20 |
21 | ProtectionProxy subjectProxy = new ProtectionProxy();
22 | Console.WriteLine(subjectProxy.Talep());
23 | Console.WriteLine((subjectProxy as ProtectionProxy).KimlikDogrulaması("Secret"));
24 | Console.WriteLine((subjectProxy as ProtectionProxy).KimlikDogrulaması("besatMikeTyson"));
Console.WriteLine(subjectProxy.Talep());
25 |
26 | Console.ReadKey();
27 | }
28 | }
29 |
30 |
31 | interface IKonu//Nesneler ve procy'ler için birbirlerinin yerine kullanılmalarını sağlayan ortak bir arabirim
32 | {
33 | string Talep();
34 | }
35 |
36 | class Konu//Bir proxy'nin temsil ettiği sınıf
37 | {
38 | public string Talep() //Konuyla ilgili bir proxy üzerinden yönlendirilen bir işlem
39 | {
40 | return "Subject Talebi ";
41 | }
42 | }
43 | //Proxy => Vekil
44 | public class Proxy : IKonu //Bir Konuya erişimi oluşturan, kontrol eden, geliştiren ve doğrulayan bir sınıf
45 | {
46 | Konu konu;
47 |
48 | public string Talep()
49 | {
50 | if (konu == null)
51 | {
52 | Console.WriteLine("Subject aktif değil");
53 | konu = new Konu();
54 | }
55 | Console.WriteLine("Subject aktif");
56 | return "Proxy: Çağrılıyor... " + konu.Talep();
57 | }
58 | }
59 |
60 | public class ProtectionProxy : IKonu
61 | {
62 | Konu konu;
63 | string sifre = "besatMikeTyson";
64 |
65 | public string KimlikDogrulaması (string gelenSifre)
66 | {
67 | if (gelenSifre != sifre)
68 | {
69 | return "Protection Proxy : Erişim yok";
70 | }
71 | else
72 | {
73 | konu = new Konu();
74 | return "Protection Proxy: Kimlik Doğrulanmış";
75 | }
76 | }
77 |
78 | public string Talep()
79 | {
80 | if (konu == null)
81 | {
82 | return "Protection Proxy: Önce Kimliğini Doğrula";
83 | }
84 | else
85 | {
86 | return "Protection Proxy: Çağrılıyor... " + konu.Talep();
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/ProxyPattern/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ProxyPattern")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ProxyPattern")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("242a3dcd-46a8-42ea-87b0-62087294f8cd")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ProxyPattern/ProxyPattern.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {242A3DCD-46A8-42EA-87B0-62087294F8CD}
8 | Exe
9 | ProxyPattern
10 | ProxyPattern
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------