<?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 kaankubat on Medium]]></title>
        <description><![CDATA[Stories by kaankubat on Medium]]></description>
        <link>https://medium.com/@kaankubat?source=rss-e8f2dae5d866------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0p3jyr5prL_eCI-4aB0siw.jpeg</url>
            <title>Stories by kaankubat on Medium</title>
            <link>https://medium.com/@kaankubat?source=rss-e8f2dae5d866------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 20:31:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kaankubat/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[Building a Modern REST API with Spring Boot 3.5]]></title>
            <link>https://medium.com/ko%C3%A7-fiat-kredi/building-a-modern-rest-api-with-spring-boot-3-5-4ce2d68381ea?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ce2d68381ea</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 15:13:21 GMT</pubDate>
            <atom:updated>2026-06-27T15:13:21.396Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a REST API with Spring Boot is no longer just about adding a @RestController and exposing a few endpoints. In real projects, an API is expected to be readable, validated, observable, easy to deploy, and clear when something goes wrong.</p><p>Spring Boot 3.5 makes this workflow quite comfortable for developers. In this article, we will build a small but realistic REST API. The example will be simple: a Library API that creates and lists books.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jf6n9TIbKjSz8WVFr3dbrA.png" /></figure><h4><strong>Creating the project</strong></h4><p>For a clean start, these dependencies are enough:</p><pre>&lt;dependencies&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br><br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-boot-starter-validation&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br><br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br>&lt;/dependencies&gt;</pre><p><strong>We need three basic things here:</strong></p><p>spring-boot-starter-web for REST endpoints.<br>spring-boot-starter-validation for request validation.<br>spring-boot-starter-actuator for health checks and basic metrics.</p><p><strong>The main class is the usual Spring Boot entry point:</strong></p><pre>@SpringBootApplication<br>public class LibraryApiApplication {<br><br>    public static void main(String[] args) {<br>        SpringApplication.run(LibraryApiApplication.class, args);<br>    }<br>}</pre><p><strong>Starting with DTOs keeps things clean</strong></p><p>One common mistake in new projects is using the entity class directly as both request and response model. It may look harmless in small examples, but as the project grows, the controller becomes too tightly coupled with the database model.</p><p>So let’s keep our request and response models separate.</p><pre>public record CreateBookRequest(<br>        @NotBlank(message = &quot;Book title cannot be empty&quot;)<br>        @Size(max = 120, message = &quot;Book title can contain at most 120 characters&quot;)<br>        String title,<br><br>        @NotBlank(message = &quot;Author name cannot be empty&quot;)<br>        String author,<br><br>        @Positive(message = &quot;Page count must be positive&quot;)<br>        int pageCount)</pre><p><strong>The response model:</strong></p><pre>public record BookResponse(<br>        Long id,<br>        String title,<br>        String author,<br>        int pageCount<br>) </pre><p>In my opinion, using <strong>record </strong>with modern Java and Spring Boot feels very natural. It removes unnecessary getter/setter noise and makes DTO classes much easier to read.</p><h4>Service layer</h4><p>Let’s skip the database for now and keep the example simple with an in-memory service.</p><pre>@Service<br>public class BookService {<br><br>    private final Map&lt;Long, BookResponse&gt; books = new ConcurrentHashMap&lt;&gt;();<br>    private final AtomicLong sequence = new AtomicLong(1);<br><br>    public BookResponse create(CreateBookRequest request) {<br>        Long id = sequence.getAndIncrement();<br><br>        BookResponse response = new BookResponse(<br>                id,<br>                request.title(),<br>                request.author(),<br>                request.pageCount()<br>        );<br><br>        books.put(id, response);<br>        return response;<br>    }<br><br>    public BookResponse findById(Long id) {<br>        BookResponse book = books.get(id);<br><br>        if (book == null) {<br>            throw new BookNotFoundException(id);<br>        }<br><br>        return book;<br>    }<br><br>    public List&lt;BookResponse&gt; findAll() {<br>        return new ArrayList&lt;&gt;(books.values());<br>    }<br>}</pre><p><strong>The exception class is also simple:</strong></p><pre>public class BookNotFoundException extends RuntimeException {<br><br>    public BookNotFoundException(Long id) {<br>        super(&quot;Book not found. id=&quot; + id);<br>    }<br>}</pre><p>The idea is simple: the controller should deal with HTTP, while the service layer should contain the business logic. Even in small projects, this separation saves time later.</p><h4>Writing the controller</h4><p>Now let’s expose the endpoints.</p><pre>@RestController<br>@RequestMapping(&quot;/api/v1/books&quot;)<br>public class BookController {<br><br>    private final BookService bookService;<br><br>    public BookController(BookService bookService) {<br>        this.bookService = bookService;<br>    }<br><br>    @PostMapping<br>    @ResponseStatus(HttpStatus.CREATED)<br>    public BookResponse create(@Valid @RequestBody CreateBookRequest request) {<br>        return bookService.create(request);<br>    }<br><br>    @GetMapping(&quot;/{id}&quot;)<br>    public BookResponse findById(@PathVariable Long id) {<br>        return bookService.findById(id);<br>    }<br><br>    @GetMapping<br>    public List&lt;BookResponse&gt; findAll() {<br>        return bookService.findAll();<br>    }<br>}</pre><p>There are a few details worth noticing:</p><p>The endpoint path is versioned: /api/v1/books<br>The request body is validated with @Valid.<br>A successful create operation returns HTTP 201.<br>There is no unnecessary try-catch inside the controller.</p><p>Instead of spreading try-catch blocks across controllers, it is usually better to handle errors in one central place.</p><h4>Modern error response with ProblemDetail</h4><p>In the past, every project had its own error response format. One API returned errorMessage, another returned message, and another returned errors. This is not very pleasant for API clients.</p><p>With Spring’s ProblemDetail , we can return a more standard error response.</p><pre>RestControllerAdvice<br>public class GlobalExceptionHandler {<br><br>    @ExceptionHandler(BookNotFoundException.class)<br>    public ProblemDetail handleBookNotFound(BookNotFoundException exception) {<br>        ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(<br>                HttpStatus.NOT_FOUND,<br>                exception.getMessage()<br>        );<br><br>        problemDetail.setTitle(&quot;Book not found&quot;);<br>        problemDetail.setProperty(&quot;errorCode&quot;, &quot;BOOK_NOT_FOUND&quot;);<br><br>        return problemDetail;<br>    }<br><br> @ExceptionHandler(MethodArgumentNotValidException.class)<br> public ProblemDetail handleValidation(MethodArgumentNotValidException exception) {<br>        List&lt;String&gt; errors = exception.getBindingResult()<br>                .getFieldErrors()<br>                .stream()<br>                .map(error -&gt; error.getField() + &quot;: &quot; + error.getDefaultMessage())<br>                .toList();<br><br>        ProblemDetail problemDetail = ProblemDetail.forStatus(HttpStatus.BAD_REQUEST);<br>        problemDetail.setTitle(&quot;Validation failed&quot;);<br>        problemDetail.setDetail(&quot;There are validation errors in the request fields.&quot;);<br>        problemDetail.setProperty(&quot;errors&quot;, errors);<br><br>        return problemDetail;<br>    }<br>}</pre><p>Now, when the API returns an error, the response becomes easier to understand:</p><pre>{<br>  &quot;type&quot;: &quot;about:blank&quot;,<br>  &quot;title&quot;: &quot;Validation failed&quot;,<br>  &quot;status&quot;: 400,<br>  &quot;detail&quot;: &quot;There are validation errors in the request fields.&quot;,<br>  &quot;errors&quot;: [<br>    &quot;title: Book title cannot be empty&quot;,<br>    &quot;pageCount: Page count must be positive&quot;<br>  ]<br>}</pre><p>Small details like this make life much easier for frontend developers or other backend teams consuming the API.</p><h4>application.yml configuration</h4><p>With a simple file, <strong>application.yml </strong>we can configure both API behavior and Actuator endpoints.</p><pre>server:<br>  port: 8080<br><br>spring:<br>  application:<br>    name: library-api<br>  mvc:<br>    problemdetails:<br>      enabled: true<br><br>management:<br>  endpoints:<br>    web:<br>      exposure:<br>        include: health,info,metrics<br>  endpoint:<br>    health:<br>      probes:<br>        enabled: true</pre><p>After this configuration, we can check the application health from this endpoint:</p><pre>curl http://localhost:8080/actuator/health</pre><p>Example response:</p><pre><br>{<br>  &quot;status&quot;: &quot;UP&quot;<br>}</pre><p>This may look like a small thing during local development, but it becomes very useful in Docker or Kubernetes environments. External systems need a reliable way to understand whether the application is actually running.</p><h4>Testing the API</h4><p>Let’s create a book:</p><pre>curl -X POST http://localhost:8080/api/v1/books \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;title&quot;: &quot;Clean Code&quot;,<br>    &quot;author&quot;: &quot;Robert C. Martin&quot;,<br>    &quot;pageCount&quot;: 464<br>  }&#39;</pre><p>Response:</p><pre>{<br>  &quot;id&quot;: 1,<br>  &quot;title&quot;: &quot;Clean Code&quot;,<br>  &quot;author&quot;: &quot;Robert C. Martin&quot;,<br>  &quot;pageCount&quot;: 464<br>}</pre><p>Now fetch the book by id:</p><pre>curl http://localhost:8080/api/v1/books/1</pre><p>If we send an invalid request, validation kicks in:</p><pre>curl -X POST http://localhost:8080/api/v1/books \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;title&quot;: &quot;&quot;,<br>    &quot;author&quot;: &quot;&quot;,<br>    &quot;pageCount&quot;: 0<br>  }&#39;</pre><p>At this point, the API does not only fail. It also explains what went wrong in a clean format.</p><h4>A small note about containers</h4><p>A Spring Boot application can be containerized with a classic Dockerfile:</p><pre>FROM eclipse-temurin:21-jre<br><br>WORKDIR /app<br><br>COPY target/library-api.jar app.jar<br><br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;app.jar&quot;]dd</pre><p>Then build and run it:</p><pre>mvn clean package<br>docker build -t library-api .<br>docker run -p 8080:8080 library-api</pre><p>Spring Boot also provides a practical buildpack-based alternative:</p><pre>mvn spring-boot:build-image</pre><p>This command packages the application as a container image. It is especially useful when you want to keep your CI/CD pipeline simple.</p><h4>Conclusion</h4><p>When building REST APIs with Spring Boot 3.5, checking whether the endpoint works is not enough. A modern API should also care about these points:</p><p>Using DTOs<br>Adding validation<br>Handling errors centrally<br>Returning a standard error format<br>Making the application observable with Actuator<br>Thinking about container environments early</p><p>In this article, we covered these ideas with a small example. The code is simple, but the approach is close to what we usually need in real-world projects.</p><p>For me, a good REST API is not only an API that returns the correct response. It is also an API that explains itself when something goes wrong, can be monitored after deployment, and can be consumed comfortably by other teams.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ce2d68381ea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ko%C3%A7-fiat-kredi/building-a-modern-rest-api-with-spring-boot-3-5-4ce2d68381ea">Building a Modern REST API with Spring Boot 3.5</a> was originally published in <a href="https://medium.com/ko%C3%A7-fiat-kredi">Koç Stellantis Finansman Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle’da İndeks Var Ama Sorgu Hala Yavaş: Derin Performans İncelemesi]]></title>
            <link>https://medium.com/@kaankubat/oracleda-i%CC%87ndeks-var-ama-sorgu-hala-yava%C5%9F-derin-performans-i%CC%87ncelemesi-1d504c9d5cd7?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d504c9d5cd7</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[index]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 12:26:32 GMT</pubDate>
            <atom:updated>2025-12-31T12:26:32.826Z</atom:updated>
            <content:encoded><![CDATA[<p>Oracle veritabanında büyük veri setleri üzerinde indeks oluşturmak yaygın ilk adımdır, ancak çoğu zaman “indeks var ama sorgu yavaş” gibi şikayetlerle karşılaşırız. Bu durumun gerçek hayattaki karşılığı, büyük bir e-ticaret veya finans uygulamasında kritik bir raporun indeksli sorgu olmasına rağmen hala beklenenden çok uzun sürede dönmesidir. İdeal olarak indeks, uygun sütun üzerinde kurulduğunda sorgunun TABLE ACCESS FULL yerine INDEX RANGE SCAN veya INDEX UNIQUE SCAN ile çalışmasını sağlamalıdır.. Oysa bazen Oracle’ın cost-based optimizasyonu, satır sayısı, istatistikler veya sorgu yapısı nedeniyle farklı bir yol tercih eder. Yavaş sorgular sadece bekleme sürelerini artırmakla kalmaz, bankacılık ya da perakende gibi gerçek zamanlı sonuç beklentisi olan sistemlerde kullanıcı memnuniyetini ve sistem kaynak kullanımı verimliliğini doğrudan etkiler. Bu nedenle sorgu optimizasyonunda <em>execution plan</em> (yürütme planı) analizi, sadece indekslere odaklanmaktan daha kritiktir. Aşağıda önce örneklerle, sonra tipik SQL yazım hataları ve karşılaştırmalı execution plan çıktıları ile bu konuyu detaylıca inceliyor olacağız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*NmAHJG09dXi_O3ug1nJA2Q.png" /></figure><h4>İndekslerin Devre Dışı Kalmasına Neden Olan Yaygın Hatalar</h4><p>Oracle’da indekslerin devre dışı kalmasının en yaygın sebebi, farkında olmadan yapılan SQL yazım hatalarıdır. Veritabanı katmanında kod yazarak (PL/SQL) genellikle daha verimli sonuçlar elde edilebilir. Örneğin tek tek satır güncelleyen bir döngü yerine <strong>Toplu İŞLEM (Bulk Processing)</strong> veya tek bir UPDATE sorgusu kullanmak performansı artırır. Oracle, tüm işlemlerin mümkün olduğunca veritabanı içinde gerçekleştirilmesini vurgular Örneğin, Java kodunda 1000 kaydı tek tek güncelleyen bir döngü yerine bir PL/SQL prosedürü çağırmak daha hızlıdır; PL/SQL’de FORALL ile toplu insert veya update yapmak disk I/O’yu azaltır.</p><pre>BEGIN<br>  --toplu güncelleme<br>  FORALL i IN 1..v_row_count<br>    UPDATE orders SET status = &#39;DELIVERED&#39; WHERE order_id = v_order_ids(i);<br>END;</pre><p>Yukarıdaki örnekte tüm order_id listesi bir seferde güncellenir. Buna karşın Java’da satır satır güncelleyerek yapılan bir işlem, her satır için ayrı bir sorgu çalıştıracağı ve her seferinde parse yapacağı için (ağ gecikmeleri ve CPU maliyetiyle birlikte) çok daha yavaş sonuç verecektir. Sonuçları ise SQL’de dinamik SQL ile “anında analiz” yapmak mümkündür; örneğin DBMS_XPLAN.DISPLAY kullanarak planı PL/SQL içinde yakalayabilir, böylece sorgu performansını canlı analiz edebiliriz.</p><h4>SQL Örnekleri: Hatalı ve Doğru Yazımlar</h4><p>Aşağıda indeks kullanımını engelleyen tipik SQL hatalarından bazıları ve düzeltme yolları listelenmiştir. Her bir örnekte yanlış kullanım sorgunun full table scan yapmasına neden olurken, düzeltmeler indeksin etkin kullanılmasına olanak sağlar.</p><ul><li><strong>Fonksiyon Kullanımı (Function-Based Index)</strong>:</li></ul><pre>🔴Yanlış Sorgu: <br>SELECT * FROM Customers WHERE UPPER(last_name) = &#39;SMITH&#39;;</pre><pre>🟢Doğru Sorgu: <br>SELECT * FROM Customers WHERE last_name = &#39;Smith&#39;;</pre><p>UPPER(last_name) fonksiyonu sütuna uygulanınca normal indeks devre dışı kalır.. Bu durumda ya sorguyu fonksiyon kullanmadan yazar (ya da arama değerini büyük/küçük harfe göre düzenler) ya da CREATE INDEX idx_name_upper ON Customers (UPPER(last_name)); şeklinde <strong>fonksiyonel indeks</strong> tanımlar.</p><ul><li><strong>OR Kullanımı ve UNION ALL:</strong></li></ul><pre>🔴Yanlış Sorgu: <br>SELECT * FROM Orders WHERE status = &#39;PASSIVE&#39; OR status = &#39;ACTIVE&#39;;</pre><pre>🟢Doğru Sorgu:<br>SELECT * FROM Orders WHERE status = &#39;PASSIVE&#39;<br>UNION ALL<br>SELECT * FROM Orders WHERE status = &#39;ACTIVE&#39;;</pre><p>OR operatörü, iki farklı kritere aynı anda bakmak zorunda kaldığında genellikle full scan’e yol açar. Alternatif olarak UNION ALL ile iki sorgu birleştirilirse her birinde indeks kullanılabilir.</p><ul><li><strong>Covering Index Kullanımı:</strong></li></ul><p>🔴Yanlış: SELECT col1, col2, col3 FROM BigTable; (tüm satırlar çekiliyor)<br>🟢Doğru: Büyük tabloya gerçekten ihtiyacınız olan sütunları içeren bir indeks ekleyerek, sorgunun sadece indeksi taramasını sağlamak (örneğin, CREATE INDEX idx_cover ON BigTable(col1, col2, col3);</p><p>Eğer sorgunuz tüm satırları değil sınırlı sütunlar ve sınırlı satırlar içeriyorsa, bu sütunları kapsayan bir <strong>Covering Index </strong>sayesinde sadece indeks taranarak tabloya erişim atlanabilir.Örneğin sadece 3 sütuna ihtiyacınız varsa bu üçünü içeren bileşik indeks kurulursa, Oracle verileri direkt indeksten çekebilir.Bu yöntem, her ne kadar fiziksel I/O sayısını azaltsa da (özellikle az sütun çekiliyorsa) indeksteki boyut artışı nedeniyle fazla sayıda satır veya çok geniş indeks durumunda etkisi azalabilir.</p><ul><li><strong>Veri Tipi Uyumsuzluğu (Implicit Conversion)</strong>:</li></ul><p>🔴Yanlış: WHERE num_col = &#39;123&#39;<br>🟢Doğru: WHERE num_col = 123 veya WHERE TO_CHAR(num_col) = &#39;123&#39;</p><p>String literal, sayısal kolona eşitlenirken Oracle arka planda dönüşüm yapar. Bu dönüşüm indeksi kullanılamaz hale getirebilir (sütuna dönüştürme yaptırdığı için)</p><ul><li><strong>LIKE ve Joker Karakterler</strong>:</li></ul><p>🔴Yanlış: WHERE name LIKE &#39;%xyz&#39;<br>🟢Doğru: WHERE name LIKE &#39;abc%&#39; veya başka bir filtre.</p><p>LIKE içinde başında % olan desen indeks taramasını engeller çünkü arama baştan başlamak yerine sona göre yapılır. ‘abc%’ ise önde olduklarından indeks kullanabilir.</p><ul><li><strong>SELECT DISTINCT / GROUP BY ile Sıralamanın Maliyeti</strong>:</li></ul><p>DISTINCT, GROUP BY veya ORDER BY ifadeleri ek bir sıralama maliyeti ister.Örneğin:</p><pre>SELECT DISTINCT col FROM BigTable;</pre><p>Bu sorgu indeksli de olsa taranan sonuçları sıralayıp tekrar ayıklar ve maalesef performansı düşürür.İstenen sonuçlar için uygun kolonda indeks veya daha iyi sorgular tercih edilmelidir.Kısaca DISTINCT, veri modelindeki problemi gizlemek için kullanılmamalı. Bunun yerine EXISTS kullanılabilir.</p><pre>🔴Yanlış:<br>SELECT DISTINCT m.credit_id<br>FROM customer_info m<br>JOIN customer_info_det d ON d.customer_id = m.customer_id<br>WHERE d.customer_age &gt; 30;</pre><pre>🟢Doğru:<br>SELECT m.credit_id<br>FROM customer_info m<br>WHERE EXISTS (<br>    SELECT 1<br>    FROM customer_info_det d<br>    WHERE d.credit_id = m.credit_id<br>    AND d.customer_age &gt; 30<br>);</pre><h4>Execution Plan İnceleme</h4><p>Bir <strong>execution plan</strong>, bir SQL sorgusunu çalıştırırken Oracle’ın izlediği adımların sıralı bir özetidir. Yani sorgunun hangi tabloları tarayacağı, hangi index’leri kullanacağı ve hangi join yöntemlerini seçeceği bu planda gösterilir. Execution plan incelemek, yavaş sorguların nedenini bulmak için kritik öneme sahiptir; çünkü plan bize sorgunun hangi adımlarda çok kaynak kullandığını anlatır.</p><p>Oracle’da bir sorgunun planını görmek için genellikle şu adımlar izlenir;</p><p><strong>EXPLAIN PLAN</strong> <strong>kullanımı</strong>: Sorgudan hemen önce EXPLAIN PLAN FOR yazarak plan tabloya gönderilir. Örneğin:</p><pre>EXPLAIN PLAN FOR<br>SELECT * FROM worker_info WHERE monthly_salary &lt; 5000;</pre><p><strong>DBMS_XPLAN ile görüntüleme</strong>: Açıklanan planı görüntülemek için Oracle’ın DBMS_XPLAN paketini kullanırız. Örneğin:</p><pre>SELECT * <br>FROM TABLE(DBMS_XPLAN.DISPLAY(format =&gt; &#39;ALL&#39;));</pre><p>Bu yukarıdaki komut, en son <strong>PLAN_TABLE</strong> çıktısını ekrana verir veya SQL Developer/TOAD araçlarında genellikle “Explain Plan” düğmesi veya AutoTrace özelliği bulunur. Sorgu çalıştırılmadan önce bu seçenekle plan grafiksel veya tablo halinde kolayca alınabilir.Yanlız şu unutulmamalıdır, EXPLAIN PLAN yanlızca öngörülen planı verir. Gerçek yürütme bilgilerine ihtiyaç duyarsanız DBMS_XPLAN.DISPLAY_CURSOR veya SQL Monitor kullanabilirsiniz.</p><h4>Selectivity, Cardinality ve Cost Kavramları</h4><p>Oracle’ın sorgu optimizasyonunda selectivity, cardinality ve cost temel ölçütlerdir.</p><ul><li><strong>Selectivity</strong>, bir filtre koşulunun orijinal veri kümesinde geriye kaç satır bıraktığını gösterir (0 = hiç satır, 1 = tüm satırlar).Örneğin WHERE last_name = &#39;SMITH&#39; gibi eşitlik predikatı, genelde tüm değerlere eşit dağılmış veri için 1/NDV (örnek: 1/150) kadar bir selectivity ile hesaplanır.. Selectivity değeri 0’a yaklaştıkça predikat daha seçicidir (çok az satır döner), 1’e yaklaştıkça az seçicidir (çeşitli satırlar döner)</li><li><strong>Cardinality</strong>, her bir işlem adımının beklenen satır sayısıdır (örneğin TABLE ACCESS FULL veya JOIN sonrası dönecek satır sayısı). Oracle, tablo ve sütun istatistikleri (DBMS_STATS) ile histogram gibi bilgilere dayanarak cardinality tahmini yapar. Örneğin, tek bir eşitlik predikatı için histogram yoksa varsayılan formül cardinality = TOPLAM_SATIR / NDV şeklindedir (ör. 107 satır ve 58 farklı değer ise tahmin ≈2 satır). İstatistikler yoksa ya dinamik örnekleme kullanılır veya Oracle’ın varsayılan oranları uygulanır. Yanlış veya eksik istatistik cardinality tahminini bozup suboptimal bir plan seçilmesine yol açabilir.</li><li><strong>Cost</strong> (maliyet) ise Oracle’ın iş yükü ölçüsüdür ve disk I/O, CPU ve bellek gibi kaynakları içerir. Optimizatör her plan için selectivity ve cardinality ile maliyeti hesaplar ve en düşük maliyetli planı seçer. Örneğin, büyük bir tabloyu filtrelemek için az sayıda satır dönecekse indeks kullanmak cost’u düşürür; çok sayıda satır gerekiyorsa tam tarama daha avantajlı olabilir. Maliyet ölçütü sayısal ve ölçek içi olduğundan, yalnızca planları karşılaştırmak için kullanılır, mutlak bir zaman değeri vermez.</li></ul><h4>Yaygın Oracle Execution Plan Operatörleri ve Anlamları</h4><ul><li><strong>TABLE ACCESS FULL</strong> : genellikle tüm tablonun blok blok okunması demektir. Bu işlem çok sayıda satır için çok blok I/O yapacağından yüksek maliyetli kabul edilir. Ancak <strong>her zaman kötü değildir</strong>.En önemli kural, sorguyu en hızlı gerçekleştiren planı seçmektir; bazı durumlarda tam tarama en hızlı yöntemdir. <a href="https://connor-mcdonald.com/2019/10/24/the-holistic-sql-tuning-series/">Connor McDonald’ın</a> vurguladığı gibi, “Bir sorguda eğer full scan, index scan’dan hızlı ise full scan en iyisidir. Diğer sorguda index daha iyiyse index kullanılır”.</li><li><strong>INDEX RANGE SCAN</strong> : İndekste bir aralık taraması yapar. Koşulu sağlayan (≥, ≤, BETWEEN, LIKE vb.) değerleri B-ağacında bularak ilgili satırları seçer. Bu genellikle çok satır dönebilecek aralıklı sorgular için kullanılır.</li><li><strong>INDEX UNIQUE SCAN</strong> : Yalnızca bir indeks girdisi arar (tek satır döner). Unique ya da primary key koşullarında kullanılır. Sadece bir satır bekleniyorsa tercih edilmelidir.</li><li><strong>TABLE ACCESS BY INDEX ROWID</strong>: INDEX RANGE/UNIQUE SCAN ile bulunan ROWID’ler kullanılarak gerçek tablo verisinin okunduğu adımdır. Yani önce index’ten bir ROWID alınıp, sonrasında o satır tabloya gidilip getirilir.</li><li><strong>INDEX FULL SCAN</strong>: İndeksin tüm yaprak düğümlerini okur (tüm satırları indeks sırasına göre). Sorguda <em>tüm</em> indeks sütunları gerekli olduğunda veya sıralama gerekiyorsa tercih edilir.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*P-glGK611ITKhHZFvLWkUA.png" /><figcaption>Görsel1</figcaption></figure><p>Görsel1&#39;de görüldüğü üzere, Execution plan üzerindeki detaylar. İşlem satırları ve oklar sorgu akışını gösterirken, örnekte INDEX RANGE SCAN ve TABLE ACCESS BY INDEX ROWID adımları indeks kullanımını işaret ediyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*MtrxhQyn_jAR2H8cYiEmgw.png" /><figcaption>Görsel2</figcaption></figure><p>Görsel2 Oracle SQL Developer’da alınan örnek bir diagram view. Bu diyagram, her adımın satır işleme miktarı, CPU ve I/O maliyet yüzdelerini gösterir. Bu plan, TABLE ACCESS FULL içermekte ve büyük veri setlerinde yavaşlığa sebep olabilir.</p><h4>Sonuç</h4><p>Özetle, <strong>sorgu optimizasyonunda indeks tek başına mucizevi bir çözüm değildir</strong>; asıl belirleyici <strong>execution plan</strong> analizidir. İndeks varlığı performans için gerekli ancak yeterli değildir. Oracle’ın cost-based optimizer’ı sütun seçiciliği, tablo istatistikleri, bind değişken ve sorgu yapısı gibi faktörlere göre indeks kullanıp kullanmama kararını verir. Bu nedenle indeks sorunu yaşayan geliştiricilerin ilk kontrolü SQL yazım hataları, güncel istatistik ve sorgu planı olmalıdır.</p><p><em>Kaynaklar:</em></p><p><a href="https://docs.oracle.com/en/database/oracle/oracle-database/26/tgsql/query-optimizer-concepts.html#:~:text=The%20percentage%20of%20rows%20in,1">SQL Tuning Guide</a></p><p><a href="https://stackoverflow.com/questions/1464469/access-and-filter-predicates-in-oracle-execution-plan">optimization — Access and Filter predicates in Oracle execution plan — Stack Overflow</a></p><ul><li><a href="https://medium.com/nerd-for-tech/explain-about-a-selectivity-and-cardinality-in-oracle-c4417213b6f3">Explain about a Selectivity and Cardinality in oracle|Interview Q&amp;A</a></li><li><a href="https://use-the-index-luke.com/sql/explain-plan/oracle/filter-predicates#:~:text=Predicate%20Information%20,B">Filter-predicates are a major Oracle SQL performance risk</a></li><li><a href="https://asktom.oracle.com/ords/f?p=100:11:::NO::P11_QUESTION_ID:7807480400346035212">filter and access in execution plan - Ask TOM</a></li></ul><p><a href="https://richardfoote.wordpress.com/2008/05/12/index-scan-or-full-table-scan-the-magic-number-magic-dance/">Index Scan or Full Table Scan: The “Magic” Number (Magic Dance) | Richard Foote’s Oracle Blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d504c9d5cd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finansal Mikroservislerde Dayanıklılık: Retry, Circuit Breaker ve Fallback]]></title>
            <link>https://medium.com/ko%C3%A7-fiat-kredi/finansal-mikroservislerde-dayan%C4%B1kl%C4%B1l%C4%B1k-retry-circuit-breaker-ve-fallback-dc34fc96a09d?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc34fc96a09d</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[mockito]]></category>
            <category><![CDATA[unit-testing]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 11:18:00 GMT</pubDate>
            <atom:updated>2025-09-10T11:19:49.222Z</atom:updated>
            <content:encoded><![CDATA[<p>Finansal sistemlerde “küçük bir hata” müşteri güvenini, işlem bütünlüğünü ve servislerin stabilitesini hızla tehdit eder. Bu yazıda Spring Boot + OpenFeign + Resilience4j kullanarak bu tür hataları nasıl kıvamında yönetebileceğimizi — <strong>retry</strong>, <strong>circuit breaker</strong> ve <strong>fallback</strong> desenleriyle — gerçek ve çalışır kod örnekleriyle anlatıyorum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JNg58oXCtw2Og_VDFGgIAA.png" /></figure><p><strong>Neler kullanacağız?</strong></p><ul><li>Java + Spring Boot</li><li>Spring Cloud OpenFeign (declarative HTTP client)</li><li>Resilience4j (retry, circuit breaker, dekoratörler)</li><li>Mockito + JUnit 5 (test için)</li><li>Actuator / Micrometer (telemetri için)</li></ul><h3>1) Bağımlılıklar (pom.xml)</h3><pre>&lt;!-- OpenFeign --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-cloud-starter-openfeign&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br><br>&lt;!-- Resilience4j Spring boot starter --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;io.github.resilience4j&lt;/groupId&gt;<br>  &lt;artifactId&gt;resilience4j-spring-boot3&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br><br>&lt;!-- Actuator --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br><br>&lt;!-- Micrometer Prometheus (opsiyonel) --&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;io.micrometer&lt;/groupId&gt;<br>  &lt;artifactId&gt;micrometer-registry-prometheus&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h3>2) Konfigürasyon</h3><pre>resilience4j:<br>  retry:<br>    instances:<br>      bankApi:<br>        max-attempts: 3<br>        wait-duration: 500ms<br>        retry-exceptions:<br>          - java.io.IOException<br>          - java.net.SocketTimeoutException<br>  circuitbreaker:<br>    instances:<br>      bankApi:<br>        sliding-window-type: COUNT_BASED<br>        sliding-window-size: 20<br>        minimum-number-of-calls: 10<br>        failure-rate-threshold: 50<br>        wait-duration-in-open-state: 30s<br>        permitted-number-of-calls-in-half-open-state: 5<br><br>feign:<br>  client:<br>    config:<br>      default:<br>        connectTimeout: 5000<br>        readTimeout: 5000</pre><h3>3) Feign client</h3><pre>@FeignClient(name = &quot;bankClient&quot;, url = &quot;${bank.api.url}&quot;)<br>public interface BankClient {<br>    @GetMapping(&quot;/accounts/{id}&quot;)<br>    AccountDto getAccount(@PathVariable(&quot;id&quot;) String id);<br>}</pre><h3>4) Yaklaşım A: Servis katmanında Resilience4j anotasyonları (önerilen, esnek)</h3><pre>@Service<br>public class BankService {<br>    private final BankClient bankClient;<br>    private final Logger log = LoggerFactory.getLogger(BankService.class);<br><br>    public BankService(BankClient bankClient) {<br>        this.bankClient = bankClient;<br>    }<br><br>    @Retry(name = &quot;bankApi&quot;, fallbackMethod = &quot;getAccountFallback&quot;)<br>    @CircuitBreaker(name = &quot;bankApi&quot;, fallbackMethod = &quot;getAccountFallback&quot;)<br>    public AccountDto getAccount(String id) {<br>        return bankClient.getAccount(id);<br>    }<br><br>    // fallbackMethod: orijinal parametrelere ek olarak Throwable alabilir<br>    public AccountDto getAccountFallback(String id, Throwable t) {<br>        log.warn(&quot;Fallback for id={} due to: {}&quot;, id, t.toString());<br>        return AccountDto.builder()<br>                .id(id)<br>                .status(&quot;UNKNOWN&quot;)<br>                .balance(BigDecimal.ZERO)<br>                .note(&quot;fallback: cached-or-default&quot;)<br>                .build();<br>    }<br>}</pre><p><strong>Neden servis katmanında?</strong></p><p>Aynı Feign client’ı farklı servislerde farklı resilience davranışı ile kullanabilir ve Fallback mantığını iş bilgisiyle yazabilirsiniz (ör. cache, partial data, read-only mode).</p><h3>5) Yaklaşım B: Feign fallbackFactory kullanmak (client-side fallback)</h3><p>Feign’in kendi fallback mekanizmasını kullanabilirsiniz; fallbackFactory sayesinde hata nedenini alıp loglama/telemetri yapabilirsiniz:</p><pre>@FeignClient(name = &quot;bankClient&quot;,<br>             url = &quot;${bank.api.url}&quot;,<br>             fallbackFactory = BankClientFallbackFactory.class)<br>public interface BankClient {<br>    @GetMapping(&quot;/accounts/{id}&quot;)<br>    AccountDto getAccount(@PathVariable(&quot;id&quot;) String id);<br>}<br><br>@Component<br>public class BankClientFallbackFactory implements FallbackFactory&lt;BankClient&gt; {<br>    private final Logger log = LoggerFactory.getLogger(BankClientFallbackFactory.class);<br><br>    @Override<br>    public BankClient create(Throwable cause) {<br>        return new BankClient() {<br>            @Override<br>            public AccountDto getAccount(String id) {<br>                log.warn(&quot;Feign fallback for id={} cause={}&quot;, id, cause.toString());<br>                return AccountDto.builder()<br>                        .id(id)<br>                        .status(&quot;UNKNOWN&quot;)<br>                        .balance(BigDecimal.ZERO)<br>                        .note(&quot;feign-fallback&quot;)<br>                        .build();<br>            }<br>        };<br>    }<br>}</pre><p>Feign fallback, çağrıyı Feign tarafında ele alır; Resilience4j ile birlikte kullanılacaksa dikkatli olun — duplicate fallback mantığı veya farklı retry kontrolü yaşanabilir. Genelde <strong>service-layer + Resilience4j</strong> + (gerekiyorsa) <strong>feign fallback</strong> kombinasyonu daha kontrollü olur.</p><h3>6) Feign dekoratörleri ile Resilience4j</h3><p>resilience4j-feign ile client’ı runtime’da sarıp Resilience4j altyapısını doğrudan Feign çağrısına uygulayabilirsiniz. Bu, birden çok dekoratör (retry/cb/rateLimiter) uygulamak istediğinizde güçlüdür. (Kod konseptini daha önceki örnekte gösterdim; üretimde config/bean tanımı gerekir.)</p><h3>7) Testler: JUnit5 + Mockito</h3><p><strong>Unit test (Annotation etkisi yok )</strong></p><pre>@ExtendWith(MockitoExtension.class)<br>class BankServiceUnitTest {<br><br>    @Mock<br>    BankClient bankClient;<br><br>    @InjectMocks<br>    BankService bankService;<br><br>    @Test<br>    void whenFeignThrows_thenServiceFallbackReturns() {<br>        // arrange<br>        when(bankClient.getAccount(&quot;123&quot;))<br>            .thenThrow(new RuntimeException(&quot;timeout&quot;));<br><br>        // act<br>        AccountDto result = bankService.getAccountFallback(&quot;123&quot;, new RuntimeException(&quot;timeout&quot;));<br><br>        // assert<br>        assertEquals(&quot;123&quot;, result.getId());<br>        assertEquals(&quot;UNKNOWN&quot;, result.getStatus());<br>    }<br>}</pre><p>Bu test getAccountFallback metodunu doğrudan çağırır; annotation tabanlı retry/cb davranışını doğrulamaz. Bunun için Spring context ile test yapmak gerekir.</p><p><strong>Spring Boot test (annotation’lar aktif)</strong></p><pre>@SpringBootTest<br>class BankServiceIntegrationTest {<br><br>    @Autowired<br>    BankService bankService;<br><br>    @MockBean<br>    BankClient bankClient; // Spring context içindeki bean mocklanır<br><br>    @Test<br>    void whenRemoteFails_thenRetryHappens_andFallbackUsed() {<br>        // BankClient her çağrıda hata fırlatacak<br>        when(bankClient.getAccount(&quot;123&quot;)).thenThrow(new RuntimeException(&quot;down&quot;));<br><br>        AccountDto res = bankService.getAccount(&quot;123&quot;);<br><br>        assertNotNull(res);<br>        assertEquals(&quot;UNKNOWN&quot;, res.getStatus());<br><br>        // Retry max-attempts: 3 olduğundan çağrı 3 kere denenmiş olmalı<br>        verify(bankClient, times(3)).getAccount(&quot;123&quot;);<br>    }<br>}</pre><h4><strong>Dikkat Edilmesi Gereken Noktalar</strong></h4><p><strong>1)Aşırı Retry’den Kaçının</strong></p><p>Çok fazla tekrar denemesi sisteminize ekstra yük bindirir. max-attempts değerini gerçek ortamda gözlemlediğiniz istatistiklere göre belirleyin.</p><p><strong>2)Fallback’i Bilinçli Kullanın</strong></p><p>Fallback her zaman “geçici çözüm”dür. Yanıltıcı ya da riskli veri döndürmek yerine kullanıcıyı doğru bilgilendiren güvenli bir cevap tasarlayın.</p><p><strong>3)Circuit Breaker Threshold’larını Test Edin</strong></p><p>Varsayılan değerler her senaryoya uygun değildir. Özellikle finansal işlemlerde düşük failure-rate-threshold gereksiz kesintilere yol açabilir.</p><p><strong>4)Metrikleri İzleyin</strong></p><p>failure rate, retry attempts, circuit breaker state gibi metrikleri Spring Boot Actuator + Micrometer üzerinden mutlaka takip edin. Bu sayede ayarları doğru şekilde optimize edebilirsiniz.</p><p><strong>5)Test Senaryolarını İhmal Etmeyin</strong></p><p>Fallback ve hata durumlarını sadece manuel testlere bırakmayın. JUnit + Mockito ile mutlaka otomatik testler yazın.</p><p><strong>6)Gerçek Ortamla Uyum</strong></p><p>Lokal geliştirmede çalışan bir retry/circuit breaker ayarı, prod ortamda çok agresif veya çok gevşek olabilir. Canlıya geçmeden önce staging ortamında stres testleri yapın.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc34fc96a09d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ko%C3%A7-fiat-kredi/finansal-mikroservislerde-dayan%C4%B1kl%C4%B1l%C4%B1k-retry-circuit-breaker-ve-fallback-dc34fc96a09d">Finansal Mikroservislerde Dayanıklılık: Retry, Circuit Breaker ve Fallback</a> was originally published in <a href="https://medium.com/ko%C3%A7-fiat-kredi">Koç Stellantis Finansman Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kredi Başvurularında Zaman Serisi Analizi ile Süreç Optimizasyonu (Java & Oracle)]]></title>
            <link>https://medium.com/ko%C3%A7-fiat-kredi/kredi-ba%C5%9Fvurular%C4%B1nda-zaman-serisi-analizi-ile-s%C3%BCre%C3%A7-optimizasyonu-java-oracle-3aaca028a84d?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/3aaca028a84d</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Tue, 17 Jun 2025 07:53:29 GMT</pubDate>
            <atom:updated>2025-06-17T07:53:29.819Z</atom:updated>
            <content:encoded><![CDATA[<p>Kredi başvuruları, müşteri için sadece birkaç dakikalık bir form doldurma işleminden ibaret gibi görünse de, arka planda birçok servis, dış sistem, kontrol mekanizması ve iş kuralı çalışır. Başvuru yapıldığı andan itibaren onay, kullandırım ve diğer adımların tamamı, zamanla yarışılan bir sürecin parçasıdır.</p><p>Bu sürecin <strong>nerede, ne kadar sürede tamamlandığını</strong> anlamak ise çoğu zaman göründüğü kadar kolay değildir. Çünkü bu adımlar; dağıtık servisler, asenkron işlemler ve dış API çağrıları arasında kaybolur. Genellikle süreçle ilgili raporlar ancak gün sonunda, batch’lerle güncellenmiş tablolardan veya veritabanıda yapılan uzun karmaşık sorgu sonuçlarının export edilmesiyle alınır. Bu da gecikmeleri, darboğazları ve müşteri memnuniyetsizliğini zamanında görmeyi imkânsız hale getirir.</p><p>Peki ya her başvuru süreci bir “zaman serisi” gibi ele alınsaydı? Ve sürecin her adımı birer olay (event) olarak işlenseydi? Bu sayede başvuru süreçleri anbean izlenebilir, gecikmeler erkenden fark edilebilir ve süreçler sürekli optimize edilebilir hale gelirdi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MT0kaylHKOpNka2rRJ5HaA.png" /></figure><h3>MODERN YAKLAŞIM: Event-Driven Süreç Takibi + Zaman Serisi Veri Modeli</h3><p>Geleneksel süreç izleme yaklaşımlarında, bir başvurunun statü geçişleri genellikle ilişkisel veri tabanlarındaki log veya durum tablolarına yazılır. Bu veriler daha sonra batch sorgularla analiz edilir. Ancak bu yaklaşımın en büyük sorunu <strong>gerçek zamanlı olmaması</strong>, <strong>ölçeklenebilirlikten uzak olması</strong> ve <strong>görselleştirme olanağı sağlayan altyapılarından kopuk olmasıdır</strong>.</p><p>Modern bir süreç izleme sistemi ise şu üç temel üzerine kurulabilir:</p><p>⚙️<strong>Event-Driven Mimari</strong><br> Her statü geçişi veya önemli olay, merkezi bir event bus (RabbitMQ gibi) üzerinden bir “event” olarak yayınlanır.</p><p>🗄️<strong>Zaman Serisi Veritabanı</strong><br> Event’ler bir zaman serisi veritabanına kaydedilir. Böylece süreç verisi doğal olarak zaman ekseninde düzenlenir.</p><p>📊<strong>Gözlemlenebilirlik Katmanı (Observability)</strong><br> Event’ler; sürecin ortalama süresi, en yavaş adımı, SLA ihlalleri gibi metriklerle anlık olarak Kibana ve Grafana gibi araçlarda görsellenir.</p><p>Bu model sayesinde artık şu sorulara anlık cevaplar alınabilir:</p><p>Hangi başvurular hangi statüde bekliyor?<br>Bugün onay süreci ortalama ne kadar sürdü?<br>Son 1 saatte sistemde gecikmeye neden olan adımlar hangileri?</p><h3>Event-Driven Süreç İzleme Sistemi Nasıl Kurulur?</h3><p>Bu bölümde kredi başvurularını anlık olarak izlemek ve ölçmek için örnek bir mimari kuracağız. Amacımız, başvuruların her adımını birer event olarak kaydetmek, Oracle veritabanına zaman bilgisiyle birlikte işlemek ve bu verileri Kibana üzerinden görselleştirmektir.</p><h4><strong>Event Yapısı:</strong></h4><p>Bu yapı, başvuru kimliğini, yeni durumu, geçiş zamanını ve kaynağını içerir. Event şemasına, gerekirse “userId”, “channel” gibi alanlar da eklenebilir.</p><pre>{<br>  &quot;eventType&quot;: &quot;CREDIT_STATUS_CHANGED&quot;,<br>  &quot;applicationId&quot;: &quot;a12345b6789&quot;,<br>  &quot;status&quot;: &quot;ONAY_BEKLIYOR&quot;,<br>  &quot;timestamp&quot;: &quot;2025-06-06T12:34:56Z&quot;,<br>  &quot;source&quot;: &quot;credit-decision-service&quot;<br>}</pre><h4>Event Producer — Spring Boot ve RabbitMQ ile Event Yayını:</h4><p>Başvuru statüsü değiştiğinde bu bilgiyi RabbitMQ’ya göndermek için Spring Boot kullanıyoruz.</p><pre>&lt;dependency&gt;<br>  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>  &lt;artifactId&gt;spring-boot-starter-amqp&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h4><strong>RabbitMQ Yapılandırması:</strong></h4><pre>@Configuration<br>public class RabbitMQConfig {<br>    public static final String QUEUE_NAME = &quot;application-status-events&quot;;<br><br>    @Bean<br>    public Queue queue() {<br>        return new Queue(QUEUE_NAME, true);<br>    }<br>}</pre><h4><strong>Event Gönderici Servis:</strong></h4><pre>@Service<br>@RequiredArgsConstructor<br>public class ApplicationEventPublisher {<br><br>    private final RabbitTemplate rabbitTemplate;<br><br>    public void publishStatusChanged(String appId, String status) {<br>        Map&lt;String, Object&gt; event = Map.of(<br>            &quot;eventType&quot;, &quot;CREDIT_STATUS_CHANGED&quot;,<br>            &quot;applicationId&quot;, appId,<br>            &quot;status&quot;, status,<br>            &quot;timestamp&quot;, Instant.now().toString(),<br>            &quot;source&quot;, &quot;credit-decision-service&quot;<br>        );<br><br>        rabbitTemplate.convertAndSend(RabbitMQConfig.QUEUE_NAME, event);<br>    }<br>}</pre><h4><strong>Event’lerin Oracle Veritabanında Saklanması:</strong></h4><p>RabbitMQ’dan gelen event’leri alıp Oracle’a yazmak için bir consumer servisimiz olabilir. Alternatif olarak, RabbitMQ → Logstash → Oracle flow’u da kurulabilir.</p><pre>CREATE TABLE SUREC_OLCUM_TABLOSU (<br>    ID NUMBER GENERATED BY DEFAULT AS IDENTITY,<br>    APPLICATION_ID VARCHAR2(50),<br>    STATUS VARCHAR2(50),<br>    EVENT_TIME TIMESTAMP WITH TIME ZONE,<br>    SOURCE VARCHAR2(100)<br>);</pre><h4><strong>Örnek Süre Hesaplama Sorgusu:</strong></h4><p>Bu sorgu sayesinde her başvurunun “başvuru → onay” süresi dakika cinsinden kolayca ölçülebilir.Kibana ile Süreç Gözlemlenebilirliği</p><pre>SELECT<br>    application_id,<br>    MAX(CASE WHEN status = &#39;BASVURULDU&#39; THEN event_time END) AS basvuru_zamani,<br>    MAX(CASE WHEN status = &#39;ONAYLANDI&#39; THEN event_time END) AS onay_zamani,<br>    (MAX(CASE WHEN status = &#39;ONAYLANDI&#39; THEN event_time END) -<br>     MAX(CASE WHEN status = &#39;BASVURULDU&#39; THEN event_time END)) * 24 * 60 AS sure_dakika<br>FROM sürec_olcum_tablosu<br>GROUP BY application_id;</pre><h3>RabbitMQ Consumer — Spring Boot ile Oracle’a Event Kaydı</h3><p>Bu servisimiz, RabbitMQ kuyruğundan gelen kredi başvurularının event’lerini dinler ve veritabanına kaydeder.</p><h4>Gerekli Bağımlılıklar:</h4><pre>&lt;dependencies&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-boot-starter-amqp&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;com.oracle.database.jdbc&lt;/groupId&gt;<br>        &lt;artifactId&gt;ojdbc8&lt;/artifactId&gt;<br>        &lt;version&gt;19.8.0.0&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br>&lt;/dependencies&gt;</pre><h4>RabbitMQ Consumer Tanımı:</h4><p>gelen event içindeki bilgiler Veritabanına işleniyor.Bu yapı sayesinde artık gelen her event anında veritabanına yazılacak ve zaman serisi haline getirilebilecek.</p><pre>@Component<br>@RequiredArgsConstructor<br>public class ApplicationEventConsumer {<br><br>    private final JdbcTemplate jdbcTemplate;<br><br>    @RabbitListener(queues = &quot;application-status-events&quot;)<br>    public void handleMessage(Map&lt;String, Object&gt; event) {<br>        String applicationId = (String) event.get(&quot;applicationId&quot;);<br>        String status = (String) event.get(&quot;status&quot;);<br>        String timestamp = (String) event.get(&quot;timestamp&quot;);<br>        String source = (String) event.get(&quot;source&quot;);<br><br>        jdbcTemplate.update(&quot;&quot;&quot;<br>            INSERT INTO SUREC_OLCUM_TABLOSU<br>                (APPLICATION_ID, STATUS, EVENT_TIME, SOURCE)<br>            VALUES (?, ?, TO_TIMESTAMP(?, &#39;YYYY-MM-DD\&quot;T\&quot;HH24:MI:SS.FF3TZH:TZM&#39;), ?)<br>        &quot;&quot;&quot;, applicationId, status, timestamp, source);<br>    }<br>}</pre><h4>Kibana ile Süreç Gözlemlenebilirliği</h4><p>RabbitMQ üzerinden gelen event’ler Logstash ile Elasticsearch’e aktarılırsa, Kibana’da aşağıdaki dashboard fikirleri uygulanabilir;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_NZ8nTDGO0n2uOI3joMbw.png" /></figure><ul><li><strong>🕒</strong> Statü Bazlı Ortalama Süreler (Line Chart)</li><li><strong>🕒</strong> En Yavaş Süreçler (Top 10 vb.)</li><li>⚠️ SLA İhlali Yapan Başvurular (Metric &amp; Alert Panel)</li><li>📉 Zaman Bazlı Süreç Performansı (Time Series Line Chart)</li></ul><p>Bu yapı sayesinde sistemin zorlanmasına neden olan adımları, müşteri memnuniyetsizliğine neden olan gecikmeler gibi kritik çıktılar anlık olarak izlenebilir.</p><h3>🎯 Sonuç</h3><p>Event-Driven + Zaman Serisi temelli bu yapı sayesinde:</p><p>✅ Süreçler anlık ve doğru şekilde izlenebilir.<br>✅ Gecikmeler erkenden fark edilebilir.<br>✅ SLA ihlalleri önlenebilir.<br>✅ Süreçler veriyle optimize edilebilir hale gelir.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3aaca028a84d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ko%C3%A7-fiat-kredi/kredi-ba%C5%9Fvurular%C4%B1nda-zaman-serisi-analizi-ile-s%C3%BCre%C3%A7-optimizasyonu-java-oracle-3aaca028a84d">Kredi Başvurularında Zaman Serisi Analizi ile Süreç Optimizasyonu (Java &amp; Oracle)</a> was originally published in <a href="https://medium.com/ko%C3%A7-fiat-kredi">Koç Stellantis Finansman Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HEROKU KULLANMAK]]></title>
            <link>https://medium.com/@kaankubat/heroku-kullanmak-54722e2c921f?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/54722e2c921f</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[services]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Mon, 13 Jun 2022 21:23:05 GMT</pubDate>
            <atom:updated>2025-06-16T15:46:07.417Z</atom:updated>
            <content:encoded><![CDATA[<h3>HEROKU</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*In3wngBJeEJg4qaP3qoZbw.png" /></figure><h4>HEROKU NEDİR ?</h4><p>Heroku, bulut bilişim (cloud computing) uygulama altyapısı servis sağlayıcısıdır. oluşturduğumuz ufak ve büyük uygulamaları Local’ de biz görüntüleyebiliyorken diğer kullanıcılara da web üzerinde açmak istediğimiz noktada( deploy, manage ve scale) Heroku’ nun her bütçeye uygun paketleriyle, ihtiyaçlarınızın boyutuna göre hizmet alabiliyorsunuz.</p><p>Heroku, kullanmak için geliştirdiğimiz uygulamanın JavaScript, Ruby, Java, PHP, Python, <a href="https://ceaksan.com/tr/go-golang-programlama-dili-nedir">Golang</a>, Scala ve Clojure dillerinden biri veya birden fazlası ile geliştirmiş olması gerekiyor şuan Heroku’ nun desteklediği yazılım dilleri şuan bunlarla sınırlı.</p><p>Heroku’ da her bir kaynağı Dynolar ile birlikte sunarız proje büyüdükçe Dyno sayısı artar Projedeki Dyno sayısı ve Dyno boyutuna göre Heroku sizden aylık bir ücret talep eder. Temelde 4 Dyno türü vardır</p><p>1- Ücretsiz</p><p>2- Standart</p><p>3- Performans</p><p>4- Private</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAR4ocbONgPlHoFinyPQHg.png" /></figure><h4>Heroku Kullanmanın Sağladığı Avantajlar</h4><ul><li>Kolay kurulum - bir PaaS olarak Apache, nginx, unicorn, MySQL, Postgres vb. nasıl kuracağınızı ve yapılandıracağınızı bilmenize gerek yok</li><li>Başlangıçta ölçeklendirmek daha kolay , daha fazla Dyno yu döndürün, DB’leri boyutlandırın vb.</li><li>Üçüncü taraf uygulamalar için harika eklenti desteği</li><li>Geliştiricilerin alt yapı yerine koda odaklanmasını sağlar</li><li>Tüm projelere tek faturalandırma uygulanabilir.</li><li>Salesforce entegrasyonu.</li><li>7/24 Heroku operasyon ve güvenlik ekibinden destek olanağı.</li><li>Diğer AWS ürünleriyle kolay entegrasyon.</li><li>10 saniyede yeni bir sunucu oluşturabilme.</li></ul><h4>Heroku Kullanmanın Sağladığı Dezavantajlar</h4><ul><li>Yüksek yoğunlukta geçikme süresi artar.</li><li>Düşük ağ performansı sunar.</li><li>Heroku, dynos üzerinde başka herhangi bir hizmet çalıştırmanıza izin vermez.</li><li>Ek dynomo satın almak için ayda 35$ ödemeniz gerekir ki bu oldukça maliyetlidir.</li><li>Ağır bilgi işlem projeleri için ideal değildir.</li></ul><h4>Heroku Vs AWS ( Farkları nelerdir ?)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FqlpqN7nexI2Im7Cpxpt9g.jpeg" /></figure><p>Heroku, konteyner tabanlı bulut platformudur(PaaS) AWS ise, IaaS, PaaS ve SaaS sağlayan güvenlikli bir bulut hizmeti platformudur.</p><p>Heroku, kodunuzu hızlı bir şekilde dağıtmanıza olanak sağlar. AWS’ de hizmetin dağıtım süreci oldukça karmaşıktır.</p><p>Heroku, Başlangıçlar, Orta Ölçekli İşletmeler için en uygun olanıdır. AWS orta ölçekli ve büyük ölçekli işletmelere odaklıdır.</p><p>Heroku, düşük hesaplama taleplerini karşılayabilir. AWS yüksek/çok yüksek hesaplama taleplerini karşılayabilir.</p><p>Fiyatlandırma olarak kıyaslandığında Heroku ortalama saat başı 0,05 $ fiyat yansıtır. AWS saat başına 0,013 $ fiyat yansıtır.</p><p>Herko’ nun altyapı bakımına ihtiyacı yoktur. AWS’ in özel bir DevOps görevlisine ihtiyacı vardır.</p><p>Heroku nispeten daha az coğrafi bölgeyi destekler.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54722e2c921f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are SOLID PRINCIPLES ?]]></title>
            <link>https://medium.com/@kaankubat/what-are-solid-principles-8b69c537238d?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b69c537238d</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Sat, 05 Feb 2022 22:51:56 GMT</pubDate>
            <atom:updated>2022-02-06T18:24:04.999Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are SOLID PRINCIPLES ?</h3><p><strong>With examples in this article, we will easily understand SOLID Principles.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhBt0Rfu94EThl8HRuZ1Qg.jpeg" /></figure><p><strong>Let’s briefly introduce solid for those who have never heard of it before.</strong></p><p>The Software Engineering sector is growing day by day and the codes written in this sector can be in many different structures. It is getting harder to read, understand and develop these different structures. At this point, SOLID Principles<strong> </strong>are literally there to make the life of Software developers easier. Object-Oriented Programming is the basis of SOLİD Principles, which enables us to increase readability and create flexible code structures.</p><p><strong>I think we are starting to understand the SOLID Principles, so let’s elaborate on SOLID a little more.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*E3h8Rh83fO1rvwu5VO1BGA.jpeg" /></figure><p><strong>As you can see in the image, SOLID takes its name from the first letter of its principles and knowing the details of these principles is very important for the software developer.</strong></p><h3>1. Single Responsibility Principle</h3><p>According to Single Responsibility principles, when developing software, each class or method should have a single responsibility. Too much work should never be done.<br>“Do one thing and make the best of it.” can be said for this principle. By complying with this principle, the events that will cause difficulties for the team, the company, and the software developer are minimized after the changes made in the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AoqvnDV4mHe_D4pGVZ4kBw.png" /></figure><p>In the first example, the Single Responsibility principle was violated because Update and Insert were written together under a method. In addition to the error that will occur when we call the method, readability and flexible are reduced. Changes to be made in the code in the future have been complicated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*levz-pkgOT546v0Yd5gBng.png" /></figure><p>In the second example, since Update and Insert were written under different methods, the Responsibility principle was applied. The risk of error that will occur when we call the method has been eliminated. Readability and flexibility have increased. Changes to be made in the code in the future have been simplified.</p><h3>2. Open/Close Principle</h3><p>According to the Open/Close principle, projects should be open to adding new features and closed to changing their features. That is, when you add a new feature to the project, you should not change the code you wrote before. To give an example from daily life, the car has 4 wheels and 1 steering wheel. The car object is not subject to change, we cannot make the of 3 wheels , but we can improve the car by adding a stereo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzjdpsISsIFxhLtPzY2q8A.png" /></figure><p><strong>If one more Invoice Type comes then we need to add another else if condition within the source code of the above GetInvoiceDiscount() method which violates the Open closed principle.</strong></p><p><strong>If we want to show one more example.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NRQklmLq1euBf0_qb2p81g.png" /></figure><p><strong>Let’s we want to add a new feature to the application .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ilJAnptvclqAAUcjyJyvzQ.png" /></figure><p><strong>The programmer who does not know or care about the Open/Close principle will add new features as in the example or in a way similar to the example. Adding if else loops to the CustomerDal class pollutes the code and makes it difficult to control.</strong></p><p><strong>Well, let’s see how the conscious programmer reading this article innovates the project and applies the Toggle principle.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qkni0qE8ICsBjuMvbUBk8w.png" /></figure><ol><li><strong>Developer should abstract the CustomerDal class with the ICustomerDal class.</strong></li><li><strong>Care should be taken when using enum classes. Is it necessary to use an enum class, it should be analyzed well.</strong></li><li><strong>Add operation should be write with ICustomerDal.</strong></li><li><strong>The innovations to be added to the project should be classified separately, for example: SqlCustomerDal, JpaCustomerDal, HibernateCustomerDal.</strong></li></ol><h3>3. Liskov Substitution Principle</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*ZL2SdW0shibYHNWgXLkWXw.jpeg" /></figure><p>According to the LSP, “Derived classes must be substitutable for base classes.” Make sure that new derived classes are extending the base classes without changing their behaviour. As I have shown in the other principles, we will see the code that is against this principle and the restructuring of this code in accordance with the Liskov principle.</p><p><strong>The LSP is popularly explained using the square and rectangle example. if we assume an ISA relationship between Square and Rectangle. Thus, we call “Square is a Rectangle.” The code below represents the relationship.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*JJ-qyeuQYv6aO3RG2MS8Vw.png" /></figure><p><strong>Above is the code for Square. Note that Square extends Rectangle.</strong></p><p>In this case, we try to establish an ISA relationship between Square and Rectangle such that calling “Square is a Rectangle” in the below code would start behaving unexpectedly if an instance of Square is passed. An assertion error will be thrown in the case of checking for “Area” and checking for “Breadth,” although the program will terminate as the assertion error is thrown due to the failure of the Area check.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*XnbDp0sIkhrtTCpbr5T45A.png" /></figure><p>The class demonstrates the Liskov Substitution Principle (LSP) As per the principle, the functions that use references to the base classes must be able to use objects of derived class without knowing it.</p><p>Thus, in the example shown below, the function calculateArea which uses the reference of “Rectangle” should be able to use the objects of derived class such as Square and fulfill the requirement posed by Rectangle definition. One should note that as per the definition of Rectangle, following must always hold true given the data below:</p><ol><li>Length must always be equal to the length passed as the input to method, setLength</li><li>Breadth must always be equal to the breadth passed as input to method, setBreadth</li><li>Area must always be equal to product of length and breadth</li></ol><p>In case, we try to establish ISA relationship between Square and Rectangle such that we call “Square is a Rectangle”, above code would start behaving unexpectedly if an instance of Square is passed Assertion error will be thrown in case of check for area and check for breadth, although the program will terminate as the assertion error is thrown due to failure of Area check.</p><p>The Square class does not need methods like setBreadth or setLength. The LSPDemo class would need to know the details of derived classes of Rectangle (such as Square) to code appropriately to avoid throwing error. The change in the existing code breaks the open-closed principle in the first place.</p><h3>4. Interface Segregation Principle</h3><p>The Interface Segregation Principle (ISP) states that clients should not be forced to depend upon interface members they do not use. When we have non-cohesive interfaces, the ISP guides us to create multiple, smaller, cohesive interfaces.</p><p>When you apply ISP, classes and their dependencies communicate using tightly-focused interfaces, minimizing dependencies on unused members and reducing coupling accordingly. Smaller interfaces are easier to implement, improving flexibility and the possibility of reuse. As fewer classes share these interfaces, the number of changes that are required in response to an interface modification is lowered, which increases robustness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7zBK9kAanV_9-Qay5Q04A.png" /><figcaption>ı</figcaption></figure><p>In this scenario, there are Company employees and Company employees assigned from other companies. While Company Workers are Override with Pay, Food, Work, Out Source Workers are required to be override only with Pay, Work.</p><p>The biggest mistake made here is to leave the Food method under the OutSourceWorker empty or return null.</p><p><strong><em>This wrong approach can be solved correctly as follows.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U2imM4Go8-rGi86EI2AriA.png" /></figure><h3>5.Dependency Inversion Principle</h3><blockquote>“High-level modules should not depend on low-level modules. Both should depend on abstractions.”</blockquote><blockquote>“Abstractions should not depend on details. Details should depend on abstractions.”</blockquote><p>According to this principle, abstract and interface classes should be eliminated, since concrete classes are subject to frequent changes. Secondly, abstractions should not depend upon details; details should depend upon abstractions. The idea is that we isolate our class behind a boundary formed by the abstractions it depends on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZCsKzzfkBXUPoV34CxaDOw.png" /></figure><p>Examining the above code, it is seen that the ExceptionReporter class (high-level class) is directly dependent on the OracleDatabase class (low-level class). Unfortunately, if you want to use MySQL instead of Oracle as a database in the future, you will have to intervene in this class. This is undesirable behavior. The solution to this is to abstract the dependencies here.</p><p><strong><em>Here, the software developer should handle the issue like this.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K21c26To28wCmZOOni4Kcg.png" /></figure><p>As can be seen in the code, the high-level class does not directly connect to the subclass, but through abstractions. With a new implementation here, the superclass is prevented from being directly affected.</p><p><strong>Thank you for reading, in this article I tried to tell you what I know, what I learned and what I researched, I hope it will be useful.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b69c537238d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java 8 Fonksiyonel Arayüzler]]></title>
            <link>https://medium.com/@kaankubat/java-8-fonksiyonel-aray%C3%BCzler-708e04ced3e6?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/708e04ced3e6</guid>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[function]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 21:24:58 GMT</pubDate>
            <atom:updated>2022-01-29T21:36:29.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*BQAeu6cimzXS1sFeAtxQTA.png" /></figure><p>Java 8 ile birlikte java.util.function paketine, yazılcımcının hayatını kolaylaştıracak fonsiyonel arayüzler eklendi. java.util.function paketi içerisinde bulunan bu arayüzler basitçe şu şekilde gruplanabilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*mhxfvhK-pBcgNhK3AfcCRw.png" /></figure><ol><li>Function arayüzleri: Bu arayüzler bir veya iki tane giriş olan ve bir sonuç üretilmesi gereken işlemde kullanılır. Bu arayüzlerin en geneli Function ve BinFunction arayüzleridir. Function&lt;T, R&gt; arayüzü T türünden bir değer alan ve R türünden bir geri dönüş değerine sahip apply isimli bir metoda sahiptir. BiFunction&lt;T, U, R&gt; arayüzünde ise T ve U türünden<br> iki tane parametresi olan ve R türünden geri dönüş değerine sahip apply isimli abstract metot vardır.</li><li>Consumer arayüzleri: Bu arayüzler bir ya da iki girişe göre sadece işlem yapan, bir sonuç üretmeyen işlemlerdekullanılır. Bu arayüzlerin abstract metotları acceptXXX biçiminde isimlendirilir. Consumer&lt;T&gt; arayüzü tek parametreli, BiConsumer&lt;T, U&gt; arayüzü ise iki parametreli metoda sahiptir. Bu arayüzlerin de temel türler içim olan karşılıkları vardır.,</li><li>Predicate arayüzleri: Bu arayüzler bir giriş veya iki giriş alan ve sonucunda bir değer üretilmesi gereken durumlarda kullanılır. Bu arayüzlerin test isimli abstract metotları vardır. Yine bu arayüzlerin de temel türler<br> için olan karşılıkları bulunur.</li><li>Supplier arayüzleri: Bu arayüzler bir giriş almadan bir değer üretmek için kullanılır. Bu arayüzlerin getXXX isimli abstract metotları vardır. Bu metotlar parametresiz ilgili türden geri dönüş değerine sahiptir. Yine bu arayüzlerin de temel türler için olan karşılıkları bulunur. Bu arayüz grubunun yukarıdaki arayüzlerden farklı olarak boolean türü için BooleanSupplier arayüzü de vardır.</li></ol><h3>Function arayüz örnekleri</h3><h4>Örnek 1:</h4><pre>import java.util.Random;<br>import java.util.function.Supplier;<br><br>public class SupplierInterfaceExample {<br><br>    public static void main(String[] args) {<br><br>        Supplier&lt;Integer&gt; supplier = SupplierInterfaceExample::<em>getTwoDigitRandom</em>;<br><br>        System.<em>out</em>.println(supplier.get());<br><br>    }<br><br>    public static Integer getTwoDigitRandom() {<br><br>        int random = new Random().nextInt(100);<br><br>        if(random &lt; 10)<br>            return 10;<br><br>        return random;<br>    }<br>}</pre><p>Çıktı</p><pre>Hello there</pre><h4>Örnek 2:</h4><pre>@FunctionalInterface<br>interface sayable {<br>    void say(String msg);   // abstract method<br><br>    // It can contain any number of Object class methods.<br>    int hashCode();<br><br>    String toString();<br><br>    boolean equals(Object obj);<br>}<br><br>public class FunctionalInterfaceExample implements sayable {<br>    public void say(String msg) {<br>        System.<em>out</em>.println(msg);<br>    }<br><br>    public static void main(String[] args) {<br>        FunctionalInterfaceExample fie = new FunctionalInterfaceExample();<br>        fie.say(&quot;Hello there&quot;);<br>    }<br>}</pre><h4>Çıktı</h4><pre>Hello there</pre><h3>Consumer arayüzler örnekleri</h3><h4>Örnek 1:</h4><pre>// Importing Consumer interface<br><br>import java.util.function.Consumer;<br><br>public class ConsumerInterfaceExample {<br>    static void printMessage(String name) {<br>        System.<em>out</em>.println(&quot;Hello &quot; + name);<br>    }<br><br>    static void printValue(int val) {<br>        System.<em>out</em>.println(val);<br>    }<br><br>    public static void main(String[] args) {<br>        // Referring method to String type Consumer interface<br>        Consumer&lt;String&gt; consumer1 = ConsumerInterfaceExample::<em>printMessage</em>;<br>        consumer1.accept(&quot;John&quot;);   // Calling Consumer method<br><br>        // Referring method to Integer type Consumer interface<br>        Consumer&lt;Integer&gt; consumer2 = ConsumerInterfaceExample::<em>printValue</em>;<br>        consumer2.accept(12);   // Calling Consumer method<br>    }<br>}</pre><p>Çıktı</p><pre>Hello John<br>12</pre><h4>Örnek 2:</h4><pre>import java.util.ArrayList;<br>import java.util.List;<br>import java.util.function.Consumer;<br><br>public class ConsumerInterfaceExample {<br>    static void addList(List&lt;Integer&gt; list) {<br>        // Return sum of list values<br>        int result = list.stream()<br>                .mapToInt(Integer::intValue)<br>                .sum();<br>        System.<em>out</em>.println(&quot;Sum of list values: &quot; + result);<br>    }<br><br>    public static void main(String[] args) {<br>        // Creating a list and adding values<br>        List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();<br>        list.add(10);<br>        list.add(20);<br>        list.add(30);<br>        list.add(40);<br><br>        // Referring method to String type Consumer interface<br>        Consumer&lt;List&lt;Integer&gt;&gt; consumer = ConsumerInterfaceExample::<em>addList</em>;<br>        consumer.accept(list);  // Calling Consumer method<br><br>    }<br>}</pre><p>Çıktı</p><pre>Sum of list values: 100</pre><h3>Predicate arayüz örnekleri</h3><h4>Örnek 1:</h4><pre>import java.util.function.Predicate;<br><br>public class PredicateInterfaceExample {<br>    public static void main(String[] args) {<br>        Predicate&lt;Integer&gt; pr = a -&gt; (a &gt; 18); // Creating predicate<br>        System.<em>out</em>.println(pr.test(10));    // Calling Predicate method<br>    }<br>}</pre><p>Çıktı</p><pre>false</pre><h4>Örnek 2:</h4><pre>import java.util.function.Predicate;<br><br>public class PredicateInterfaceExample {<br>    static Boolean checkAge(int age) {<br>        if (age &gt; 17)<br>            return true;<br>        else return false;<br>    }<br><br>    public static void main(String[] args) {<br>        // Using Predicate interface<br>        Predicate&lt;Integer&gt; predicate = PredicateInterfaceExample::checkAge;<br>        // Calling Predicate method<br>        boolean result = predicate.test(25);<br>        System.out.println(result);<br>    }<br>}</pre><p>Çıktı</p><pre>true</pre><h3>Supplier arayüz örnekleri</h3><p>Örnek 1:</p><pre>import java.util.Random;<br>import java.util.function.Supplier;<br><br>public class SupplierInterfaceExample {<br><br>    public static void main(String[] args) {<br><br>        Supplier&lt;Integer&gt; supplier = SupplierInterfaceExample::<em>getTwoDigitRandom</em>;<br><br>        System.<em>out</em>.println(supplier.get());<br><br>    }<br><br>    public static Integer getTwoDigitRandom() {<br><br>        int random = new Random().nextInt(100);<br><br>        if(random &lt; 10)<br>            return 10;<br><br>        return random;<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=708e04ced3e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lambda İfadeleri Kullanım Örnekleri (Java)]]></title>
            <link>https://medium.com/@kaankubat/lambda-i%CC%87fadeleri-kullan%C4%B1m-%C3%B6rnekleri-java-78ec5c15da6d?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/78ec5c15da6d</guid>
            <category><![CDATA[lambda-function]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Tue, 25 Jan 2022 22:06:14 GMT</pubDate>
            <atom:updated>2022-01-25T22:06:14.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X3UIvqkytoa-TSq4xvOFfw.jpeg" /></figure><p>Java 8 ile hayatımıza giren Lambda, Anonim sınıfların gelişmiş versiyonu olarak düşünülebilir. Ancak her durumda anonim sınıf yerine kullanılmamalıdır. Lambda ifadeleri karmaşık olarak yazılabilse de 8 genel biçimde karşımıza çıkmaktadır. Bu yazımızda da sizlere lambda kullanımı ilgli örnekler göstermeye çalışacağım. Sizlerde bu biçimlere aşina olduğunuzda ne kadar karmaşık lamda ifaleri iler karşılaşırsanız karşılaşın hangi biçime ait olduğunu anımsayabileceksiniz.</p><pre>    1. (&lt;değişken isim listesi&gt;) -&gt; ifade<br>    2. (&lt;değişken isim listesi&gt;) -&gt; {...}<br>    3. &lt;değişken ismi&gt; -&gt; ifade<br>    4. &lt;değişken ismi&gt; -&gt; {...}<br>    5. () -&gt; ifade<br>    6. () -&gt; {...}<br>    7. (&lt;tür-değişken listesi&gt;) -&gt; ifade<br>    8. (&lt;tür-değişken listesi&gt;) -&gt; {...}</pre><p>Lambda ifadeleri fonksiyonel arayüz referanslarına atanabilir ve atanmış olduğu arayüz referansının abstract metodunun yerine geçer. Böylelikle yeni atanmış olan arayüz referansı çağarıldığında lambda ifadesinin ‘-&gt;’ dan sonra yazılmış olan kodları çağırılmış olur.</p><p>Lambda ifadelerinin genel biçimlerindeki 2, 4, 6 ve 8 numaraları biçimlerde fonksiyonel arayüzün abstract metodu yerine geçen metodun gövdesi yazılır. Bu durumda abstract metodun geri dönüş değeri varsa akışın her noktasında return deyimi olmalıdır. Lambda ifadeleri mümkün olduğunca yalın tutulmalıdır. Aksi durumda okunabilir olmayan kodlar yazılabilir.</p><pre>public class App {<br>    public static void main(String[] args) {<br>        Scanner kb = new Scanner(System.<em>in</em>);<br><br>        Islem islem = (x, y) -&gt; {<br>            System.<em>out</em>.printf(&quot;a = %d, b = %d&quot;, x, y);<br><br>            return x + y;<br>        };<br><br>        System.<em>out</em>.println(&quot;Birinci sayıyı giriniz:&quot;);<br>        int a = kb.nextInt();<br>        System.<em>out</em>.println(&quot;İkinci sayıyı giriniz:&quot;);<br>        int b = kb.nextInt();<br><br>        System.<em>out</em>.println(islem.topla(a, b));<br><br>    }<br>}<br><br>interface Islem {<br>    public int topla(int birinci, int ikinci);<br>}</pre><p>Lambda parametre sayısı ile abstract metodun parametre sayısı uyuşmadığında error oluşur.</p><pre>public class App {<br>    public static void main(String[] args) {<br>        Scanner kb = new Scanner(System.<em>in</em>);<br><br>        Islem islem = (x, y, z)  -&gt; x + y; // Error! <br>        <br>        //...<br><br>    }<br>}<br><br>interface Islem {<br>    public int topla(int birinci, int ikinci);<br>}</pre><p>Java 11 ile birlikte lambda ifadelerinin parametre bildirimlerinde var kullanılabilir. Bir parametre var olarak bildirilmişse hepsi var olarak bildirilmelidir.</p><pre>class App {<br>    public static void main(String[] args) {<br>        Scanner kb = new Scanner(System.<em>in</em>);<br><br>        Islem islem = (var a, var b) -&gt; a * b;<br><br>        System.<em>out</em>.println(&quot;Birinci sayıyı giriniz:&quot;);<br>        var x = kb.nextInt();<br>        System.<em>out</em>.println(&quot;İkinci sayıyı giriniz:&quot;);<br>        var y = kb.nextInt();<br><br><br>        System.<em>out</em>.println(islem.apply(x, y));<br>    }<br>}<br><br>interface Islem {<br>    int apply(int birinci, int ikinci);<br>}</pre><pre><br>public class App {<br>    public static void main(String[] args) {<br><br>        Selam s = (mesaj) -&gt; {<br>            return &quot;Selam, &quot; + mesaj;<br>        };<br>        System.<em>out</em>.println(s.soyle(&quot;Dünya&quot;));<br>    }<br><br>}<br><br>interface Selam {<br>    public String soyle(String mesaj);<br>}</pre><p>Çıktı</p><pre>Selam Dünya</pre><pre>public class App {<br>    public static void main(String[] args) {<br>        Selam s = () -&gt; {<br>            return &quot;Selam Dünya&quot;;<br>        };<br>        System.<em>out</em>.println(s.soyle());<br>    }<br><br>}<br><br>interface Selam {<br>    public String soyle();<br>}</pre><p>Çıktı</p><pre>Selam Dünya</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78ec5c15da6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Abstract & Interface]]></title>
            <link>https://medium.com/@kaankubat/abstract-interface-aaccee193cbc?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/aaccee193cbc</guid>
            <category><![CDATA[yazılım]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[abstract]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Tue, 14 Dec 2021 17:24:19 GMT</pubDate>
            <atom:updated>2021-12-14T17:24:54.807Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swa2XxYu6CIFuctu3NBwqA.jpeg" /></figure><ol><li>Arayüzler interface anahtar sözcüğü ile abstract sınıflar class sözcüğü ile bildirilir.</li><li>Arayüzler türünden nesne hiç bir şekilde yaratılmaz, abstract sınıf türünden nesne türemiş sınıf nesnesi içerisinde otomatik yaratılabilir.</li><li>Arayüzler nesne olmadığından ctor’ları olamaz, abstract sınıfların olabilir.</li><li>Bir sınıf istediği kadar arayüzü destekleyebilir, ancak tek bir sınıftan türetilebilir.</li><li>Arayüzlerin abstract metotları public ve abstract yazılmasa da bu şekilde kabul edilir. abstract sınıflarda bunlar yazılmalıdır.</li><li>Arayüzlere Java 8 ile birlikte eklenen gövdeli non-static metotlar default anahtar sözcüğü ile yazılmalıdır.abstract sınıflarda doğrudan erişim belirleyici ile yazılmalıdır.</li><li>Arayüzlerin veri elemanları yazılsa da yazılmasa da public, static ve final olur. abstract sınıflarda. bunlar belirtilmelidir.</li><li>Bir sınıf bir arayüzü implements anahtar sözcüğü ile destekler (implementation), abstract sınıftan ise extends anahtar sözcüğü ile türetilebilir.</li></ol><p><strong>Peki bir tür ne zaman interface ne zaman abstract sınıf yapılmalı ? Programcı buna nasıl karar verecek ?</strong></p><p>Önce interface düşünülmeli, interface özellikleri yazacağınız türü karşılamıyorsa (abstract) sınıf tercih edilmelidir interface yapılabildiği yerde abstract sınıf yerine interface yapılması, bu interface’i destekleyen sınıfın başka bir sınıftan da türetilmesi olanağını sağlar.</p><p><strong>Arayüzlerle ilgili tür dönüştürmeleri :</strong></p><p>1. Bir sınıf referansının onun desteklediği bir arayüz referansına dönüştürülmesi.</p><p>2. Bir arayüz referansının herhangi bir sınıf türüne dönüştürülmesi.</p><p>3. Bir arayüz referansının başka bir arayüz referansına dönüştürülmesi.</p><p>4. Bir sınıf referansının onun desteklemediği bir arayüz referansına dönüştürülmesi.</p><p>1)Bir sınıf referansının onun desteklediği bir arayüz referansına dönüştürülmesi doğrudan yapılabilir. Arayüz referansının taban sınıf referansı gibi kullanılmasıdır. Zaten interface’in kullanım hedeflerinden biriside budur.</p><pre>class App {<br>    public static void main(String [] args)<br>    {<br>        A a = new A();<br><br>        IX ix;<br><br>        ix = a;<br>    }<br>}<br><br>class A implements IX {<br><br>}<br><br>interface IX {<br>    //...<br>}</pre><p>2 ) Bir arayüz referansının herhangi bir sınıf türüne dönüştürülmesi:<br> Bu dönüşüm tür dönüştürme operatörü ile yapılmalıdır. Ancak çalışma zamanı sırasında arayüz referansının dinamik türünün dönüştürülecek sınıfı kapsayıp kapsamadığına bakılır. Kapsıyorsa haklı dönüşümdür. Kapsamıyorsa haksız dönüşümdür. ClassCastException nesnesi fırlatılır.</p><p><strong>Haklı dönüşüm</strong></p><pre>class App {<br>    public static void main(String [] args)<br>    {<br>        A a = new A();<br>        IX ix;<br><br>        ix = a;<br><br>        B b = (B)ix; //Haklı dönüşüm<br><br>        System.out.println(&quot;Tekrar yapıyor musunuz?&quot;);<br>    }<br>}<br><br>class A extends B implements IX {<br>    //...<br>}<br><br>class B {<br>    //...<br>}<br><br>interface IX {<br>    //...<br>}</pre><p><strong>Haksız dönüşüm</strong></p><pre>class App {<br>    public static void main(String [] args)<br>    {<br>        A a = new A();<br>        IX ix = a;<br><br>        B b = (B)ix; //Haksız dönüşüm<br><br>        System.out.println(&quot;Tekrar yapıyor musunuz?&quot;);<br>    }<br>}<br><br>class A implements IX {<br><br>}<br><br>class B {<br>    //...<br>}<br><br>interface IX {<br>    //...<br>}</pre><p>3) Kaynak arayüz referansına ilişkin tür hedef arayüz referansına ilişkin türden türetilmişse doğrudan yapılabilir</p><pre>class App {<br>    public static void main(String [] args)<br>    {<br>        A a = new A();<br>        IY iy = a;<br>        IX ix;<br><br>        ix = iy; //upcasting<br>        //...<br>    }<br>}<br><br><br>class A implements IY {<br><br>}<br><br>interface IY extends IX {<br>    //...<br>}<br><br>interface IX {<br>    //...<br>}<br></pre><p>4) Bu işlem tür dönüştürme operatörü ile yapılabilir. Çalışma zamanı sırasında kaynak referansın dinamik türünün hedef arayüzü destekleyip desteklemediğine bakılır. Destekliyorsa haklı dönüşümdür. Desteklemiyorsa haksız dönüşümdür. ClassCastException fırlatılır.</p><pre>class App {<br>    public static void main(String [] args)<br>    {<br>        A a = new B();<br>        IX ix;<br><br>        ix = (IX)a; //Haklı dönüşüm<br><br>    }<br>}<br><br>class B extends A implements IX {<br>    //...<br>}<br><br>class A {<br>    //...<br>}<br><br>interface IX {<br>    //...<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aaccee193cbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NESTED CLASSES]]></title>
            <link>https://medium.com/@kaankubat/nested-classes-252089da1ef2?source=rss-e8f2dae5d866------2</link>
            <guid isPermaLink="false">https://medium.com/p/252089da1ef2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[nested]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[class]]></category>
            <dc:creator><![CDATA[kaankubat]]></dc:creator>
            <pubDate>Thu, 09 Dec 2021 13:51:05 GMT</pubDate>
            <atom:updated>2021-12-09T13:51:05.314Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*mni355_kucQX9BfvfhW9GQ.png" /></figure><p>Nested type declarations can be made in Java. Here we will first get type declarations inside the class.</p><h4>There are 4 types of in-class declarations in Java:</h4><ol><li>Static Nested Classes</li><li>Inner Class (Non-Static classes)</li><li>Local Inner Classes</li><li>Anonymous Classes</li></ol><p>A class that is not in any type, that is, in a package, is called a “top-level class”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*5jW713qyavbrW2gQwCTvKg.png" /></figure><p>To create an object of the nested class, write the name of the first wrapper class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBkvMiEfDQulYyTeSCzQrw.png" /></figure><p>A top level class is not declared as static.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gsTlLUrOpGrMnyQ9MVeEiQ.png" /></figure><p>Within a class, another class can be declared static. In this case, the inner class is a member of the outer class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95D-6BoMcdRluo-HucYMbA.png" /></figure><p>Static classes can also have members. Except for the class belonging to the static class, the class name and “.” accessible by the operator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXyOOFyGNz-VEqodhNHvJA.png" /></figure><p>Since static classes are static members, they can be used unqualified with the “import static single type” declaration. But in this case, care was taken not to spoil the readability as it is accessed like a top level class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WX4tABcL3Kp2N5hIlvRErw.png" /></figure><p>Static Nested Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wSWI8e9wxS5cQ-tpPv9DFQ.png" /></figure><p>Inner Classes Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6lNlH_HthBWAFpBlYPioUA.png" /></figure><p>Declaring a static element inside an inner class is invalid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7FUbV6i28bc0H2u1Y23Ng.png" /></figure><p>An object of an inner class type cannot be created from outside the class, as in static classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ccMNcGweZYxf95BnoqOADg.png" /></figure><p>A’s static methods can also be called directly in the inner class. In the example below, the class name is used to call the foo method of class A. In case of direct call the method calls itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBb0i7wEtNCpnNrwtZjcBA.png" /></figure><p>Classes declared inside a method are called local classes. A local class declaration with the same name is valid within different fields of activity. Class declaration with the same name within the same scope is invalid.</p><p>Local classes do not have access specifiers. Also, a local class cannot be declared as static. Because there is no static or non-static distinction in local classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*U5YTDb4f_a0nfp7JdlOYtg.png" /></figure><p>Local class can be derived from another class. Of course, the base class name must be visible where the derived class is declared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NhiQcFWjywWo9g-Bkom_3A.png" /></figure><p>A local class cannot have static elements. Local variables and parameter variables declared before it in a local class can be accessed (capture)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*Ab47vDOpY2V03eljA7fwrw.png" /></figure><p>Anonymous Classes make your code shorter. It allows us to define a class and create an instance/instance from the related class at the same time. Anonymous Inner Classes have no names. We are creating a new object in the Anonymous inner class structure.</p><p>The class to be used in the anonymous class declaration must not be declared as final.</p><p>The class to be used in the anonymous class declaration must have accessible ctors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0GD3o1Z5WhXqFpP0Fp-PnQ.png" /></figure><h4>Source: C System Programmers Association</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=252089da1ef2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>