<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samet KÖRÜK on Medium]]></title>
        <description><![CDATA[Stories by Samet KÖRÜK on Medium]]></description>
        <link>https://medium.com/@sametkoruk2?source=rss-9a3649ea6080------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZT8JdVB10RNso4lLAY4bdA.jpeg</url>
            <title>Stories by Samet KÖRÜK on Medium</title>
            <link>https://medium.com/@sametkoruk2?source=rss-9a3649ea6080------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 21:03:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sametkoruk2/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Java’da Singleton Design Pattern]]></title>
            <link>https://medium.com/@sametkoruk2/javada-singleton-design-pattern-44ff1b42dbf5?source=rss-9a3649ea6080------2</link>
            <guid isPermaLink="false">https://medium.com/p/44ff1b42dbf5</guid>
            <dc:creator><![CDATA[Samet KÖRÜK]]></dc:creator>
            <pubDate>Mon, 04 Dec 2023 10:36:55 GMT</pubDate>
            <atom:updated>2023-12-04T10:36:55.343Z</atom:updated>
            <content:encoded><![CDATA[<p>Bu makalede Singleton design pattern’in amacının ne olduğunu, hangi sorunları çözdüğünü ve uygulanabilirliğini göreceğiz.</p><p>Farklı farklı cretional design patterns vardır ve bunların kendi amaçları ve uygulanabilirlikleri vardır.</p><p>Yaratıcı tasarım modelleri, esnekliği ve mevcut kodun yeniden kullanımını artıran çeşitli nesne oluşturma mekanizmaları sağlar:</p><ol><li><strong>Factory Method</strong>— Fabrika Yöntemi, bir üst sınıfta nesneler oluşturmak için bir arayüz sağlayan ancak alt sınıfların oluşturulacak nesnelerin türünü değiştirmesine izin veren yaratıcı bir tasarım modelidir.</li><li><strong>Abstract Factory Method</strong>— Soyut Fabrika, somut sınıflarını belirtmeden ilgili nesnelerin ailelerini oluşturmanıza olanak tanıyan yaratıcı bir tasarım modelidir.</li><li><strong>Builder</strong>— Builder,karmaşık nesneleri adım adım oluşturmanıza olanak tanıyan yaratıcı bir tasarım modelidir. Desen, aynı yapı kodunu kullanarak bir nesnenin farklı türlerini ve temsillerini üretmenize olanak tanır.</li><li><strong>Singleton</strong>— Singleton, bir sınıfın yalnızca bir örneğe sahip olmasını sağlarken bu örneğe küresel bir erişim noktası sağlamanıza olanak tanıyan yaratıcı bir tasarım modelidir.</li><li><strong>Prototype</strong>— Prototip, kodunuzu sınıflarına bağımlı hale getirmeden mevcut nesneleri kopyalamanıza olanak tanıyan yaratıcı bir tasarım modelidir.</li></ol><h3>Singleton Design Pattern Nedir?</h3><p>Singleton pattern, en basit tasarım desenlerinden biridir. Bazen sınıfımızın yalnızca bir örneğine ihtiyacımız olur; örneğin, her nesne için ayrı bir DB bağlantısı oluşturmak maliyetli olabileceğinden, birden fazla nesne tarafından paylaşılan tek bir DB bağlantısı. Benzer şekilde bir uygulamada birden fazla yönetici oluşturmak yerine tüm sorunları ele alan tek bir konfigürasyon yöneticisi veya hata yöneticisi olabilir. Singleton modeli, bir sınıfın somutlaştırılmasını tek bir nesneyle sınırlayan bir tasarım modelidir. Böyle bir sınıfı uygulamaya yönelik çeşitli tasarım seçeneklerini görelim. Statik sınıf değişkenleri ve erişim değiştiricileri konusunda iyi bir bilginiz varsa, bu zor bir iş olmamalıdır.</p><h3><strong>Yöntem 1: Lazy Initialization</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*1p4WXubEJIE8ZrBdpHTryQ.png" /></figure><p>Burada, sınıfı başlatmadan çağırabilmemiz için getInstance() statiğini tanımladık. getInstance() ilk kez çağrıldığında yeni bir tekil nesne oluşturur ve bundan sonra aynı nesneyi döndürür. Singleton nesnesinin, ihtiyacımız olana ve getInstance() yöntemini çağırana kadar yaratılmadığını unutmayın. Buna lazy Initialization denir. Yukarıdaki yöntemle ilgili temel sorun, iş parçacığı açısından güvenli olmamasıdır. Aşağıdaki yürütme sırasını göz önünde bulundurun.</p><p><strong>Avantajları:</strong></p><ul><li>GetInstance() statik metodu çağrıldığında obje oluşturulur.</li></ul><p><strong>Dezevantajları:</strong></p><ul><li>Multi-Thread bir ortamda , birden çok iş parçacığı aynı anda if bloğunun içinde olabilir ve birden çok nesne oluşturulabilir.Yani singleton tasarım modelinin kuralını ihlal edecektir.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/0*a1DBPpUme27RwRls.png" /></figure><p>Bu yürütme sırası, singleton için iki nesne oluşturur. Bu nedenle bu klasik uygulama iş parçacığı açısından güvenli değildir.</p><h3><strong>Yöntem 2: getInstance()’ı senkronize edin(Thread Safe Singleton)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*1bJWht0JvDyvs2HYLXNoPQ.png" /></figure><p>Burada synchronized’ı kullanmak aynı anda yalnızca bir iş parçacığının getInstance()’ı çalıştırabilmesini sağlar. Bu yöntemin en büyük dezavantajı singleton nesnesi oluşturulurken her zaman synchronized kullanılmasının pahalı olması ve programınızın performansını düşürebilmesidir. Ancak getInstance()’ın performansı uygulamanız için kritik değilse bu yöntem temiz ve basit bir çözüm sağlar.</p><h3><strong>Yöntem 3: Eager Initialization</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*xgDNRzG-roll0LVxY3Ksuw.png" /></figure><p>Burada statik bir başlatıcıda bir singleton örneği oluşturduk. JVM, sınıf yüklendiğinde statik bir başlatıcı çalıştırır ve dolayısıyla bunun iş parçacığı açısından güvenli olduğu garanti edilir. Bu yöntemi yalnızca singleton sınıfınız hafif olduğunda ve programınızın yürütülmesi boyunca kullanıldığında kullanın.</p><h3><strong>Yöntem 4:(En iyisi) Çift Kontrollü Kilitleme’yi Kullanın(Lazy Initialization with Double-Check Locking)</strong></h3><p>Dikkatli bir şekilde fark ederseniz, bir nesne oluşturulduktan sonra senkronizasyon artık işe yaramaz çünkü artık obj boş olmayacaktır ve herhangi bir işlem dizisi tutarlı sonuçlara yol açacaktır. Dolayısıyla getInstance() üzerindeki kilidi yalnızca nesne boş olduğunda bir kez alacağız. Bu şekilde yalnızca ilk yolu, tam istediğimizi senkronize ederiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*gZtOfy1ofHlB-BDFcTlMmg.png" /></figure><p>obj’yi geçici ilan ettik; bu, Singleton örneğine başlatılırken birden çok iş parçacığının obj değişkenini doğru şekilde sunmasını sağlar. Bu yöntem, senkronize yöntemin her seferinde çağrılmasının getirdiği yükü büyük ölçüde azaltır.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44ff1b42dbf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular | A Beginners Guide]]></title>
            <link>https://medium.com/@sametkoruk2/angular-a-beginners-guide-b916364dd685?source=rss-9a3649ea6080------2</link>
            <guid isPermaLink="false">https://medium.com/p/b916364dd685</guid>
            <dc:creator><![CDATA[Samet KÖRÜK]]></dc:creator>
            <pubDate>Sat, 02 Dec 2023 11:30:00 GMT</pubDate>
            <atom:updated>2023-12-02T11:30:00.860Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Angular ?</h3><ul><li>Angular is a Typescript-based open-source web application development framework.</li><li>Angular is used in developing sophisticated ‘<em>Single Page Application</em>’ (<em>SPA</em>) projects.</li></ul><h3>Why learn Angular ?</h3><ul><li>Angular is backed by <em>( ie. maintained by ) </em><strong>Google</strong>, so<strong> </strong>it’s here to stay for long.</li><li>Angular has a huge and active community of developers, So If stuck somewhere, you can easily get support from the community.</li><li>Angular provides a proper structure to your web application which helps us visualize the project in a better fashion.</li><li>MVC Architecture: MVC stands for <strong>Model-View-Controller</strong>. <em>Data</em> is managed by the <em>Model</em> and <em>View</em> manages the <em>data display</em>. While the <em>controller</em> plays as a <em>connector </em>between the view and model layers.</li><li>Using Typescript instead of JavaScript which is more or less a strictly typed version of JS which helps developers to detect bugs at compile time reducing overall development time.</li></ul><h3>Are Angular and Angular JS same ?</h3><p><strong>Angular JS</strong> is Angular 1, Angular is Angular 2+. Google did a complete rewrite of Angular for Angular 2 and made <strong>Angular JS</strong> basically a totally separate framework.</p><blockquote><strong><em>Typescript in Brief</em></strong></blockquote><blockquote><em>Typescript is an open-source, object-oriented language developed and maintained by Microsoft, It is a typed superset of JavaScript that compiles to plain JavaScript.</em></blockquote><blockquote><em>JavaScript is a dynamic programming language that doesn’t check for the values assigned to the variable &amp; JavaScript doesn’t support object-oriented features.</em></blockquote><blockquote><em>The type system increases the code quality, readability and makes it easy to maintain and refactor the codebase.</em></blockquote><blockquote><em>Therefore, the reason to choose Typescript over JavaScript is that it can detect bugs and errors during compile time itself, has support for object-oriented programming features. If you are familiar with JavaScript then moving to Typescript is piece of cake</em></blockquote><blockquote><strong><em>Angular Updates</em></strong></blockquote><blockquote><em>Angular updates are very frequent with minor releases every 2–3 months and major releases every 6 months.</em></blockquote><h3>Getting Started with Angular</h3><h3>Installation</h3><ul><li>The first step is to install <strong>Angular CLI</strong> from <em>npm (</em>Node Package Manager) — <em>(If npm is not present then install </em><a href="https://nodejs.org/en/download/"><em>Node.js</em></a><em> , npm will come with it.)</em></li></ul><blockquote><em>The </em><strong><em>Angular CLI</em></strong><em> is a </em><strong><em>command-line</em></strong><em> interface tool that you use to initialize, develop, scaffold, and maintain </em><strong><em>Angular</em></strong><em> applications directly from a command shell.</em></blockquote><ul><li>Enter the command in the terminal to install angular CLI npm install -g @angular/cli</li><li>To create a new Angular Project enter the command ng new helloworld-app , ng new creates an initial skeleton application at the root level of the workspace</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*ClCbgFdtinOM3LbG.png" /></figure><ul><li>To serve the project created enter ng serve from the project directory.</li></ul><h3>File Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/0*u-EdhJK41fE5jSwX.png" /></figure><p>root folder</p><ul><li><strong>package.json</strong>: Configures <a href="https://angular.io/guide/npm-packages">npm package dependencies</a> that are available to all projects in the workspace.</li><li><strong>angular.json</strong>: CLI configuration defaults for all projects in the workspace, including configuration options for the build, serve, and test tools that the CLI uses.</li><li><strong>editorconfig.json</strong>: Configuration for code editors.</li><li><strong>/src</strong>: Directory where source code is stored.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/197/0*9qhOFQ44JkJl2E-J.png" /></figure><p>src folder</p><ul><li><strong>index.html: </strong>index.html serve as the default or home page of the complete app.</li><li><strong>styles.css:</strong> You can add global styles to this file, and also import other style files.</li><li><strong>main.ts:</strong> It is the entry point of our web-app.It compiles the web-app and bootstraps the AppModule to run in the browser.</li><li><strong>/environments:</strong> There are 2 files in this folder where you can specify env. variables for the app for <em>production</em> and <em>development</em> builds.</li><li><strong>/assets: </strong>In this folder, static assets for the web-app can be stored like images, icons, etc.</li><li><strong>/app :</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/0*4fKfQnp8bCtxY2pe.png" /></figure><p>app folder</p><ul><li><strong>app-routing.module.ts:</strong> Here you can handle routes for different components or pages of your app.</li><li><strong>app.module.ts: </strong>Every <strong>Angular app</strong> has at least one NgModule class, the root <strong>module</strong>, which is conventionally named <strong>AppModule</strong> and resides in this file.</li></ul><h3>Component</h3><p><em>Components are the</em><strong><em> UI building block</em></strong><em> of an Angular App, they are the unit blocks with html css and ts file.</em></p><ul><li><strong>app.component.ts:</strong> This is the default root/app component <em>controller file.</em></li><li><strong>app.component.html : </strong>This is the view for the app component.</li><li><strong>app.component.css :</strong> This contains styling for the app component.</li></ul><h3>Serve Your Content</h3><p>Enter command <strong>ng serve</strong> in the terminal and the app will be hosted on port 4200 by default. — <em>( to serve on port other than 4200 you can run </em><em>ng serve --port &lt;port&gt;</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*b9p10hOPxgKMxtLP.png" /></figure><p><a href="http://localhost:4200/">http://localhost:4200</a></p><h3>Index.html</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*6BCSGdvGKBQF1bl4.png" /></figure><p>index.html file</p><ul><li>The body part contains tag &lt;app-root&gt;&lt;/app-root&gt; It refers to the AppComponent in App module.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/0*VlTPRVZC_aicbjJq.png" /></figure><p>selector value is ‘app-root’ which can be used to add this component anywhere</p><ul><li>This <em>App component</em> is added to the body tag.</li><li>Open <strong>app.component.html </strong>and replace its content it will get reflected on the site.</li></ul><p><strong><em>There are two forms of Angular bindings :</em></strong></p><p><strong>One way binding [] or {{}}</strong></p><p><em>One way data binding are write-only data bindings, It will read a property from the model and display it in the view.</em></p><p><strong>app.component.html</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/0*IF1vJuKa538I0Hjj.png" /></figure><p><strong>app.component.ts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*eSzL2PdkxJQkdhRa.png" /></figure><p>declared the variable ‘message’ with content I want to show</p><blockquote><em>Text interpolation allows you to incorporate dynamic string values into your HTML templates, interpolation uses the double curly braces </em><em>{{ and </em><em>}} as delimiters.</em></blockquote><p><strong>Two Way binding [()]</strong></p><p><em>Two-way bindings are bindings that read from the input and update the model. They are commonly referred to as banana in a box, two way binding listen to a particular event</em></p><p><em>For this to work you will have to import the forms module in </em><strong><em>app.module.ts</em></strong></p><p>and add it to the imports list.</p><pre>import { FormsModule } from &#39;@angular/forms&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*AxiU2okqkQFaNGa5.png" /></figure><p>app.module.ts, import forms module and add it to the imports section</p><h3>Output :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/0*zkWN1FFmO5nqPt87.gif" /></figure><h3>Deploy The App</h3><p>Enter command ng build -- prod , It will prepare a deployable build for you with index.html as the entry point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/0*8zKu0lV2izzoUhUZ.png" /></figure><p>the output will be stored in dist folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/0*-LVSPzQeNuUnCCCG.png" /></figure><p>production build</p><p><em>This is your production-ready application ready to be deployed,</em></p><p><strong>wherever you deploy it keep in mind that index.html is the entry point to the website.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b916364dd685" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>