<?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 Ece Aslan on Medium]]></title>
        <description><![CDATA[Stories by Ece Aslan on Medium]]></description>
        <link>https://medium.com/@eceaslan1001?source=rss-e500cb242bd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cjtWMiWoMeeoS7shT1VdXw.jpeg</url>
            <title>Stories by Ece Aslan on Medium</title>
            <link>https://medium.com/@eceaslan1001?source=rss-e500cb242bd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:25:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eceaslan1001/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[GlobalExceptionHandler in Java]]></title>
            <link>https://medium.com/@eceaslan1001/globalexceptionhandler-in-java-9f99e5151457?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f99e5151457</guid>
            <category><![CDATA[global-exception-handling]]></category>
            <category><![CDATA[java-exception-handling]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[exception-handling]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 16:14:23 GMT</pubDate>
            <atom:updated>2026-04-16T16:14:23.162Z</atom:updated>
            <content:encoded><![CDATA[<p>GlobalExceptionHandler is, as it’s called, an actual global exception handler. It picks up all the errors through the app and handles them from one place, a center. It takes them and turns them into something user can read better.</p><ul><li>For example; when we send a request from Postman, it returns an error, let’s say, and the response error message has all the lines that contain, status code, error line, port, host and etc. All too long for us and our time will be wasted when we look for the error part in all this. This is where GlobalExceptionHandler comes into play, it takes the error and matches the message we want the user/developer to see. Instead of 5 or 10 lines, it just returns a line or two that explains the error simply to the client.</li><li>There can be same type of error for different Controller methods. GlobalExceptionHandler saves us from writing lots of try-catch methods all over in every Controller that has the same error type.</li><li>When exceptions are thrown, it’s usually done with where the error is, line number, if used some credentials and etc. This violates our privacy and data. Outside shouldn’t see these. Or front-end developers. They don’t need them. Actually, when using GlobalExceptionHandler, we also hide this private stuff.</li></ul><p><strong><em>Attention: Here are somethings we should be aware!</em></strong></p><ul><li>Don’t try to catch all the errors with only one method. If there is no error log in the background, your specific error will be gone, and you won’t what it was and where did it occur.</li><li>If you want to test your error and if it does not work, you cannot try your B plan or any other way, that is if you send your error up to GlobalExceptionHandler. Instead that you should use a try-catch block here.</li><li>Do not try to catch all your errors with only ONE exception handler file. Have a few of them and scatter them around the modules.</li><li>Trying to catch every error (even the not error ones), will slow down your system.</li></ul><h4><strong>And this is how I used it in my Spring Boot project:</strong></h4><p>I have 3 files in my exception directory which are <em>GlobalExceptionHandler, AlreadyExistsException </em>and <em>CountryAlreadyExistsException.</em></p><p><strong><em>AlreadyExistsException:</em></strong></p><pre>public class AlreadyExistsException extends RuntimeException{<br>    public AlreadyExistsException(String message){<br>        super(message);<br>    }<br>}</pre><ul><li>This class will catch all the ‘This thing already exists in the database.’ errors. Root for these errors.</li><li>It’s extending RuntimeException, which meaning that the error gets thrown does not need to be checked.</li><li>We send a message to it, the one that’s going to be displayed for the front-end of the app.</li></ul><p>— — — — — — —</p><p><strong><em>CountryAlreadyExists:</em></strong></p><pre>public class CountryAlreadyExistsException extends AlreadyExistsException{<br>    public CountryAlreadyExistsException(){<br>        super(i18nConstants.COUNTRY_ALREADY_EXISTS);<br>    }<br>}</pre><ul><li>This class is a specialized version of AlreadyExistsException class.</li><li>It also takes a message to throw. <strong>BUT! </strong>This time it takes the message from a constant which we defined before. In i18n. We have defined an error sentence for each language that is in the app. So this function only takes the error variable name. Then goes to language message properties. And picks up the error message and returns it to the screen.</li></ul><p>— — — — — — —</p><p><strong><em>GlobalExceptionHandler:</em></strong></p><pre>@RequiredArgsConstructor<br>@ControllerAdvice<br>public class GlobalExceptionHandler {<br>    private final I18nMessageService messageService;<br>    @ExceptionHandler({AlreadyExistsException.class})<br>    public ResponseEntity&lt;GenericResponse&lt;Object&gt;&gt; handleAlreadyExistsException(AlreadyExistsException exception){<br>        String message = messageService.getMessage(exception.getMessage(), LocaleContextHolder.getLocale());<br>        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(<br>                GenericResponse.builder().success(false).message(message).data(LocaleContextHolder.getLocale().toString()).build());<br>    }<br>}</pre><ul><li><em>@ControllerAdvice</em> annotation tells Spring that itself is the root of all Controllers, I’ll take care of the errors.</li><li><em>@ExceptionHandler({AlreadyExistsException.class}) </em>means that if the error that’s been thrown is under this class, take it through this one and generate a proper response and return it back.</li></ul><p>— — — — — — — — — —</p><blockquote>When error happens in the Service layer it goes back up.</blockquote><blockquote>GlobalExceptionHandler catches it before it goes to Postman and after Controller. With GenericResponse it will take the matched answer and convert it to a JSON format. Then the answer will go to Postman.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f99e5151457" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some Annotations in Java]]></title>
            <link>https://medium.com/@eceaslan1001/some-annotations-in-java-9dffc5b53fbe?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dffc5b53fbe</guid>
            <category><![CDATA[annotations]]></category>
            <category><![CDATA[constructor]]></category>
            <category><![CDATA[java-annotations]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 16:19:19 GMT</pubDate>
            <atom:updated>2026-04-15T16:19:19.476Z</atom:updated>
            <content:encoded><![CDATA[<p>And some from my Spring Boot project that I’ve used and what they do.</p><h4>What do annotations do?</h4><ul><li>They mark the classes, methods or variables with metadata (information).</li><li>They provide additional information basically for the usual use.</li></ul><p>Standard/Built-in annotation types are 5; Marker, Single value, Full, Type and Repeating.</p><ol><li><strong>Marker Annotations</strong><br>- Just marks it, has no elements or values.</li><li><strong>Single Value Annotations</strong><br>- Contains only one element. Does not need element name when entering value.</li><li><strong>Full Annotations</strong><br>- Multiple elements and their values as key-value pairs. If no default, elements must be defined.</li><li><strong>Type Annotations</strong><br>- Used for type checking. Declared with <em>@TargetElementType.TYPE_USE).</em></li><li><strong>Repeating Annotations</strong><br>- Allows the same annotation to be applied multiple times on a single element. Declared using @Repeatable.</li></ol><ul><li>Standard annotations come built-in with libraries itself.</li></ul><p>But we can also create our own annotations!! Here is how:</p><ul><li>Rule 1: Define where you annotation can be used.</li></ul><pre>@Target(ElementType.METHOD) //Here we say it can be used only with methods.</pre><ul><li>Rule 2: Define how long it will stay alive.</li></ul><pre>@Retention(RetentionPolicy.RUNTIME) <br>//Here we said our annotation will stay alive only in runtime.</pre><ul><li>Rule 3: Design your annotation’s purpose.</li></ul><pre>public @interface workItOnceMore {<br>  int sayi() default 1;  //If not there is no parameter sent, default is 1.<br>}</pre><p>And voila! Your annotation is ready to use!</p><p>— — — — — — — — — — — — —</p><h4>What did I use with my Spring Boot project? Let’s see some of them and their purposes:</h4><p><strong><em>i. Spring Framework / Spring Boot: Architecture, routes and dependencies are set with these annotations.</em></strong></p><ul><li><strong>@Configuration:</strong> Says that that’s marked is a setting/configuration file.</li><li><strong>@Bean:</strong> Adds a permanent object to Spring’s general memory, so everyone can use it as they like.</li><li><strong>@Service:</strong> Means that this is where the actual code and calculations are made. Business logic is here and happens.</li><li><strong>@Repository: </strong>Marks the classes that do CRUD operations, speaks directly to the database.</li><li><strong>@RestController:</strong> Tells that the class that’s been marked with this annotation gets the HTTP requests and returns the answers with JSON format, not HTML page.</li><li><strong>@RequestMapping</strong>: Gives a general URL to a class or a method.</li><li><strong>@GetMapping: </strong>When user only wants to get/read data from inside, this annotation works.</li><li><strong>@PostMapping:</strong> When user wants to send new data or save it to the database, this annotation works.</li><li><strong>@ControllerAdvice: </strong>Collects all the errors across the app and lets us control them from one place.</li><li><strong>@ExceptionHandler:</strong> Used in @ControllerAdvice, helps us create read-friendly error messages for users. Or us when developing/testing.</li><li><strong>@SpringBootApplication:</strong> A combo package annotation that works 3 annotations all together. Which are <em>@Configuration, @ComponentScan</em> and <em>@EnableAutoConfiguration. </em>When you run the app, this annotation, scans all the files, connects the between relations and says, “We’re ready to go, let’s get this app working!’’.</li></ul><p><strong><em>ii. Lombok: Prevents boilerplate code.</em></strong></p><ul><li><strong>@Getter and @Setter: </strong>Automatically writes the get and set methods for the variables. Developer does not see them. They’re written in the background.</li><li><strong>@Data: </strong>Includes @Getter, @Setter along with other constructors like @ToString, @EqualsAndHashCode and etc. But if you’re not using other constructor, suggestion is towards to use only @Getter and @Setter.</li><li><strong>@Builder:</strong> When creating an object, it saves us the trouble of creating long constructor. We just go like, <em>.name(…).age(…).build();</em> and there you go, your one-line constructor.</li><li><strong>@Slf4j:</strong> Adds a log object to the class in the background, helps with the error messages to be more read-friendly.</li></ul><p><strong><em>iii. JPA/Hibernate: Helps with data permanency, relational databases tables.</em></strong></p><ul><li><strong>@Entity:</strong> Indicates the class it’s been marked with, represents a table in the database.</li><li><strong>@Table:</strong> Not necessarily used but when we want a different table name in the database, we indicate it with this annotation. If not used, class name will be used also as the table name.</li><li><strong>@Id: </strong>Marks the variable that’s going to be used as a primary key in the table.</li><li><strong>@GeneratedValue:</strong> Means that the ID will not be manually created. It will be generated automatically by the database.</li><li><strong>@Column:</strong> Specifies the column’s attributes like is it unique or can it be empty and some others.</li></ul><p><strong><em>iv. MapStruct: Simplifies converting objects from entity to DTO, generates boilerplate mapping code during complications.</em></strong></p><ul><li><strong>@Mapper: </strong>Converts objects from one to another. Like, Entity to DTO.</li></ul><p><strong><em>v. Java Core: Basic Java foundation with fundamental concepts.</em></strong></p><ul><li><strong>@Override:</strong> Pure Java annotation. Tells the compiler that the method is will be overwritten from an upper class or interface.</li></ul><p>— — — — — — — — — — — — — — —</p><h4>@ArgsConstructor Annotations</h4><p>From Lombok library, we have three types of ArgsConstructor annotations, that saves us from writing long constructors when creating objects!</p><ol><li><strong><em>@NoArgsConstructor: </em></strong>Creates an empty constructor that has no parameters. When using JPA/Hibernate, this is a must. Because Hibernate would want to create an empty object/instance when pulling a row of data. After that, it sets data in its attributes. Also, when converting JSON (Jackson lib) need this annotation too.</li><li><strong><em>@AllArgsConstructor:</em></strong> Creates a constructor with all attributes of the class in order they have been declared. Used with DTO classes, or tests. But if there are too many attributes, it’s more likely to get an error so, we use <em>@Builder</em> instead.</li><li><strong><em>@RequiredArgsConstructor: </em></strong>Creates a constructor with the only required parameters. The attributes with the @final keyword cannot be changed after created and they must be given a value upon creating. @NonNull attributes also cannot be null or left empty. This is used when doing Dependency Injection. This constructor only takes the attributes with <em>@final</em> and <em>@NonNull.</em></li></ol><p>— — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dffc5b53fbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Collections]]></title>
            <link>https://medium.com/@eceaslan1001/java-collections-3022884007ad?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3022884007ad</guid>
            <category><![CDATA[java-collection]]></category>
            <category><![CDATA[collection]]></category>
            <category><![CDATA[map-interface]]></category>
            <category><![CDATA[java-map]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 14:26:01 GMT</pubDate>
            <atom:updated>2026-04-15T14:26:01.228Z</atom:updated>
            <content:encoded><![CDATA[<p>JCF (Java Collection Framework) is a set of classes and interfaces that provide ready-premade data structures for us to use. They are useful when we want to store more than one object that are related together in <strong>one </strong>place.</p><p>There are interfaces such as List, Set, Map, Queue, ArrayList, HashSet, HashMap, PriorityQueue. These interfaces support dynamic resizing, includes algorithms, improves code reusability.</p><ol><li><strong>Core Interfaces</strong> are as follows:</li></ol><h3>1. Collection Interface:</h3><ul><li>Extends <strong>Iterable</strong>, meaning collections can be traversed.</li><li>Represents a group of objects <em>as a single unit.</em></li><li>Dynamic resizing.</li><li>Provides simple methods like add or remove.</li></ul><pre>public interface Collection &lt;E&gt; extends Iterable&lt;E&gt;</pre><p>— — — — — — — — — — — — — — — — —</p><ul><li>Example: Creating a ArrayList with the type of String as a Collection.</li></ul><pre>Collection&lt;String&gt; fruits = new ArrayList&lt;&gt;();</pre><p>In Java, we create an object of the ArrayList class which implements the interface and we assign this to interface reference. There isn’t a way of creating an object right out of an interface.</p><blockquote><strong><em>Sub Interfaces of Collection Interface:</em></strong></blockquote><h4><strong>a. List Interface:</strong></h4><ul><li>Ordered sequence.</li><li>Allows duplicates.</li><li>Extends Collection Interface.</li><li>Implements ArrayList, LinkedList, Stack, Vector.</li><li>Supports multiple nulls, bidirectional traversal.</li><li>add(), set(), indexOf(), lastIndexOf(), remove(), get(), contains(), size(), clear(), isEmpty(), equals()…</li></ul><p><em>Implementations of List Interface:</em></p><p><strong><em>i. ArrayList Class:</em></strong></p><ul><li>Access by indexes to elements.</li><li>Cannot store primitive types, so Wrapper classes are used instead.</li><li>Has a default capacity of 10, when needed for resizing it increases its size by %50 every time.</li><li>Not thread-safe.</li></ul><p><strong><em>ii. LinkedList Class:</em></strong></p><ul><li>Better performance than ArrayList when insertion/deletion operations are applied.</li><li>Cannot access elements by indexes. Nodes are connected to each other by their references as previous and next nodes. So, accessing must be done by traversing from head.</li><li>Implements both List and Deque interfaces from Collection which makes itself ideal for FIFO and double-ended queue operations.</li><li>Uses double-linked list logic.</li><li>Slower random access than ArrayList.</li><li>Uses more memory, extra node pointers on every node.</li><li>Iteration is slower but insertion/deletion is faster.</li><li>Not thread-safe.</li></ul><p><strong><em>iii. Vector Class:</em></strong></p><ul><li>Thread-safe. Meaning it can be reached/invoked by multiple threads without causing any damage to the data. Meaning that there will be a queue of threads to work on one Vector. This prevents data corruption, crashing.</li><li>Implements List, RandomAccess, Cloneable, Serializable interfaces.</li><li>It’s one of the legacy classes in Java as it’s one of the early introduced ones.</li><li>If multi-threading is not needed, ArrayList is actually chosen over Vector.</li></ul><p><strong><em>iv. Stack Class:</em></strong></p><ul><li>Extends Vector class.</li><li>Thread-safe.</li><li>Implements List, RandomAccess, Cloneable, Serializable.</li><li>Also, a legacy class. In modern Java, ArrayDeque and LinkedList are preferred. If the situation is single threaded, then ArrayDeque is preferred also.</li><li>Instead of add(), get(), remove(); Stack has push(), peek(), pop(). But still uses other methods as itself extends Vector class.</li></ul><p>— — — — — — — — — — — — —</p><h4><strong>b. Set Interface:</strong></h4><ul><li>No duplicates.</li><li>Except TreeSet, can contain only <strong>one </strong>null value. TreeSet doesn’t allow any null value.</li><li>Provides search, insertion, deletion operations. add(), contains(), remove().</li><li>Implementations for HashSet, EnumSet, TreeSet and LinkedHashSet.</li></ul><pre>public interface Set&lt;E&gt; extends Collection &lt;E&gt;</pre><ul><li>But Set is also an interface which means that we cannot create an object directly from it. So, we use a class that implements it.</li></ul><pre>Set&lt;Obj&gt; set = new HashSet&lt;Obj&gt;();</pre><p><em>Implementations of Set Interface:</em></p><p><strong><em>i. HashSet Class:</em></strong></p><ul><li>Uses HashMap which is a hash table data structure.</li><li>Implements Serializable and Cloneable.</li><li>Not thread-safe.</li><li>Uses wrapper classes.</li><li>Default capacity is 16 and load factor is considered 0,75. oldCapacity * loadFactor is the way to calculate for threshold. If threshold is exceeded, the capacity is doubled.</li></ul><p><strong><em>ii. EnumSet Class:</em></strong></p><ul><li>In enum types, EnumSet is slightly faster in comparison.</li><li>Does not allow null values. If tried, NullPointerException is thrown.</li><li>Extends Serializable and implements Cloneable, AbstractSet which implements Set.</li><li>Since it’s an abstract class, a direct instance cannot be created from it.</li><li>Less than or equal to 64 number of elements is used RegularEnumSet and if it’s more than 64, then, JumboEnumSet is used.</li><li>Only enum constants from a single enum type can be used.</li><li>.allOf(), .noneOf(), .range(), .of() are the methods when we create an EnumSet.</li></ul><p><strong><em>iii. LinkedHashSet Class:</em></strong></p><ul><li>Maintains the insertion order even though it extends HashSet which does not maintain it.</li><li>Fast performance for basic operations.</li><li>Extends HashSet.</li><li>Uses LinkedList and HashMap as a data structure.</li></ul><p><strong><em>iv. TreeSet Class:</em></strong></p><ul><li>Does not allow null values unlike other set types. If we try to add a null value, NullPointerException will be thrown.</li><li>Implements NavigableSet interface (extends SortedSet extends Set) which provides navigation methods such as lower(), higher() and etc.</li><li>Not thread-safe.</li><li>When added new element, it’s added by ascending order. Duplicates are ignored.</li><li>Access is with contains(), first(), last() methods.</li></ul><p>— — — — — — — — — — — — —</p><h4><strong>c. SortedSet Interface:</strong></h4><ul><li>Extends Set, implementation for TreeSet to create an object from it.</li><li>No duplicates. No nulls.</li><li>As it&#39;s called, element order is by ascending.</li></ul><p>— — — — — — — — — — — — —</p><h4><strong>d. NavigableSet Interface</strong></h4><ul><li>Extends SortedSet, provides navigation methods to retrieve elements closest to the given element.</li><li>Elements are in order of ascending.</li><li>As it’s an interface, no way of creating direct objects from it.</li><li>Usually implemented by TreeSet class.</li></ul><p>— — — — — — — — — — — — —</p><h4>e. Queue Interface</h4><ul><li>FIFO is followed in LinkedList and priority order in PriorityQueue.</li><li>No access by indexes.</li><li>Duplicates are allowed.</li><li>Implementations are LinkedList, ArrayDeque, PriorityQueue, ConcurrentLinkedQueue, BlockingQueue.</li><li>Has basic methods like add(), remove() etc.</li></ul><p><em>i. LinkedList has been explained above.</em></p><p><em>ii. ArrayDeque</em></p><p><em>iii. PriorityQueue:</em></p><ul><li>Standard queue operations.</li><li>Dynamic resizing.</li><li>No nulls.</li><li>Heap data structure is used for priority order and efficient insertion/deletion operations.</li><li>Default implementation for PriorityQueue is min-heap.</li></ul><p><em>iv. ConcurrentLinkedQueue</em></p><p><em>v. BlockingQueue Interface</em></p><h4>f. Deque Interface</h4><ul><li>Can be used as a stack/LIFO or a queue/FIFO.</li><li>Stands for double-ended queue.</li><li>Dynamic resizing.</li><li>Thread-safe.</li><li>Extends Queue.</li><li>Implementations for;</li></ul><p><em>i. ArrayDeque<br>ii. LinkedList<br>iii. ConcurrentLinkedDeque</em></p><h3>2. Map Interface</h3><ul><li>A collection of key-value pairs, keys are unique, but values can be duplicated.</li><li>Efficient retrieval, insertion and deletion operations by keys.</li><li>HashMap and LinkedHashMap allow only one null key, but TreeMap does not allow any.</li><li>ConcurrentHashMap is used for when thread-safe operations are needed.</li><li>Extend for Hashtable class and SortedMap interface.</li><li>Implementation for HashMap class.</li></ul><p><em>i. HashMap</em></p><ul><li>Not thread-safe.</li><li>Hashing is used internally.</li><li>For insertion order, LinkedHashMap is preferred while for sorted order TreeMap is used.</li><li>Allows one null key but multiple null values. If there is a second null key, its value will be overwritten.</li><li>Fast and efficient key-based retrieval insertion and removal operations. O(1) time efficient to be precise.</li></ul><p><em>ii. LinkedHashMap</em></p><ul><li>Insertion order.</li><li>One null key and multiple null values are allowed.</li><li>Not thread-safe.</li><li>Since it’s extending HashMap, there will be key-value pairs. And since it’s also Linked and maintains the insertion order which means there will be references to the previous and the next nodes.</li></ul><p><em>iii. TreeMap</em></p><ul><li>Uses Red-Black Tree internally for efficient sorting. Provides O(log n) time for insertion/deletion operations.</li><li>No null keys. But there can be null values.</li><li>Implements NavigableMap which extends SortedMap which extends Map Interface itself.</li><li>Has a custom operator, if not natural order is used.</li></ul><p><em>iv. Hashtable</em></p><ul><li>No null keys or null values.</li><li>Uses hashing to retrieve elements.</li><li>Thread-safe. Which makes it slower than HashMap.</li></ul><h3>3. Enumeration Interface</h3><ul><li>Legacy cursor used before Iterator and ListIterator.</li><li>Traversal is possible only forward.</li><li>Preferred with Vector, Stack and Hashtable.</li></ul><p>— — — — — — — — — — — — — — — — — — — —</p><p>Here’s two pictures to visualize the relationship between interfaces and classes.</p><figure><img alt="Collection Interface Hierarchy from https://media.geeksforgeeks.org/wp-content/cdn-uploads/20200811210521/Collection-Framework-1.png" src="https://cdn-images-1.medium.com/max/1024/0*hwE6hyo626xN1WAp.png" /><figcaption>Collection Interface Hierarchy from <a href="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20200811210521/Collection-Framework-1.png">https://media.geeksforgeeks.org/wp-content/cdn-uploads/20200811210521/Collection-Framework-1.png</a></figcaption></figure><p>— — — — — — —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/0*LJiGExKRocDB9pH0.png" /><figcaption>Map Interface Hierarchy from <a href="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20200811210611/Collection-Framework-2.png">https://media.geeksforgeeks.org/wp-content/cdn-uploads/20200811210611/Collection-Framework-2.png</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3022884007ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep and Shallow Copy in Java]]></title>
            <link>https://medium.com/@eceaslan1001/deep-and-shallow-copy-in-java-6edbe3e56f19?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6edbe3e56f19</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[shallow-vs-deep-copy]]></category>
            <category><![CDATA[deep-copy-vs-shallow-copy]]></category>
            <category><![CDATA[objectcloning]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 14:56:00 GMT</pubDate>
            <atom:updated>2026-03-23T14:56:00.454Z</atom:updated>
            <content:encoded><![CDATA[<p>Object copying in general means creating a new object but using another existing object’s data. Like its memory addresses/references.</p><h4>Shallow Copy</h4><p>We create a new object but do not duplicate referenced objects, just their <em>references. </em>In the end, both objects point to the same location of memory.</p><ul><li>Both object refers to the same values. If changed in one, it will affect the other too.</li><li>Fast and memory efficient.</li></ul><p>Example:</p><pre>class shallow_copy{<br>  private int[] data;<br>  public shallow_copy(int[] values){<br>    this.data = values;<br>  }<br>}<br>------<br>class use_shallow{<br>  public static void main(String[] args){<br>  int[] vals = {3, 7, 9};<br>  shallow_copy e = new shallow_copy(vals);<br>  vals[0] = 13;<br>  //new array values will be 13, 7 and 9.<br>  }<br>}</pre><p><strong>Deep Copy<br></strong>We create a new object but with separate copies of all referenced objects. To ensure independence from each other. Meaning, one change won’t affect the other.</p><ul><li>When cloning, <em>all of the referenced objects</em> need to be cloned one by one.</li><li>Safer than shallow copy.</li><li>Uses more memory space.</li><li>Could be more complex.</li></ul><p>Example:</p><pre>class deep_copy{<br>  private int[] data;<br>  public deep_copy(int[] values){<br>    data = new int[values.length];<br>    for(int i = 0; i &lt; values.lenght; i++)<br>      data[i] = values[i];<br>  }<br>}<br><br>---------<br>class use_deep{<br>  public static void main(String[] args){<br>    int[] vals = {3, 7, 9};<br>    deep_copy e = new deep_copy(vals);<br>    vals[0] = 13;<br>    //values in data still will be 3, 7 and 9. Because they&#39;re independent.<br>  }<br>}</pre><h4>Another Type of Copy: Lazy Copy (Copy-on-Write)</h4><p>This one is a hybrid copy of shallow and deep. For efficiency, we use both. Shallow copy is used for creation while deep copy is used when a write operation is needed.</p><p>Reference count is used to see how many users is using the list at the moment.</p><p>Example:</p><pre>class SharedData {<br>    int[] data;<br>    int refCount = 1;<br>    <br>    SharedData(int[] values) { this.data = values; }<br>    SharedData copy() { return new SharedData(this.data.clone()); }<br>}<br><br>class LazyCopy {<br>    private SharedData shared;<br><br>    LazyCopy(int[] values) { shared = new SharedData(values); }<br>    LazyCopy(LazyCopy other) {<br>        this.shared = other.shared;<br>        this.shared.refCount++; <br>    }<br><br>    void setValue(int index, int value) {<br>        if (shared.refCount &gt; 1) {<br>            shared.refCount--;         // I&#39;m leaving the group<br>            shared = shared.copy();    // I&#39;m making my own private copy<br>        }<br>        shared.data[index] = value;<br>    }<br>}</pre><ul><li>Let’s say I’m using the list, reading it currently. No changes yet. This makes reference count to 1.</li><li>And you come to read the list. This makes reference count rise to 2. Meaning there is 2 users who are using the list at the moment.</li><li>Then I want to make some changes on the list. Lazy copy checks reference count and see it’s more than 1. And copies the original list for another memory address. And reference counts drop by one.</li><li>I make my modifications on the new address. But you still see the old original data and do not see my modifications on it.</li><li>Then you leave the list, not using it anymore. Reference count is now zero. No one is using the old list memory address. It gets deleted. Remember, I’m on the new address now. I’m not using it neither.</li><li>When another user comes or you come back to the list, you’ll now be seeing the list on the new address with my modifications.</li><li>This makes using copying/cloning both memory and time efficient because when you don’t need to make some many write operations, this is probably the best option you should use.</li></ul><p>— — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6edbe3e56f19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database Types and Differences Between and Which One to Choose]]></title>
            <link>https://medium.com/@eceaslan1001/database-types-and-differences-between-and-which-one-to-choose-46844034664f?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/46844034664f</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[database-types]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 14:01:01 GMT</pubDate>
            <atom:updated>2026-03-23T14:01:01.518Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Definition of Database: </em></strong><em>A digital repository for storing, managing and securing organized collections of data.</em></p><h4><strong>Why do we need Databases?</strong></h4><p>It’s essential for storing, managing and retrieving large volumes of structured information, efficiently and securely. With them, data integrity is ensured. Multiple users are allowed to access data simultaneously. Data in the systems are guaranteed to be correct. With the help of DMLs, updating data is easy. When you search for a specific kind of data, it can be easily found. And data is secured because authorized personnel access it through user logins and some other authorization specifiers.</p><h4><strong>Types of Databases</strong></h4><p>Databases are generally categorized into 2 main groups: Relational (SQL) and Non-relational (NoSQL) with some other specialized ones.</p><p><strong>Relational DB: </strong>These types of databases, store data with predefined tables with rows and columns. Each table represents a different entity such as customers, orders or products, etc. SQL, Structured Query Language, is used for data manipulation. Tables are linked with ‘keys’ to represent relationships between. Examples:</p><ul><li><strong>MySQL, PostgreSQL, Oracle, Microsoft SQL Server.</strong></li></ul><p><strong>Advantages: </strong>Clear, consistent structure. Data integrity. SQL usage for complex operations.</p><p><strong>Disadvantages:</strong> Struggles with unstructured, rapidly-changing, large data. Limited flexibility for storing data of different formats. Limited scability.</p><p>— — — — —</p><p><strong>Non-Relational DB: </strong>Unlike relational databases, these types of databases are flexible, schema-less systems designed for unstructured/rapidly changing data. They get bigger with the addition of more servers. Examples:</p><ul><li><strong>MongoDB, Redis, Cassandra, DynamoDB, CouchDB.</strong></li></ul><p><strong>Advantages: </strong>Handles unstructured or semi-structured or structured data. Can scale horizontally, which is best for big data. Can be used for real-time analytics, IoT applications.</p><p><strong>Disadvantages: </strong>Querying can be hard for unstructured data as they are all not actually connected by some keys. Speed and scability is prioritized over security of data information.</p><p><strong>Specialized Other DB Types:</strong></p><ul><li><strong>Hierarchical DB:</strong> Data arranged in a tree structure with parent-child relationships. Used in organizational models, file systems, hierarchical workflows and designed for machine learning, computer vision and semantic search. Examples: <strong>Windows Registry, XML/JSON Files.</strong></li><li><strong>Network DB: </strong>Considered as ancestor of modern connected data. A child can have multiple parent records here, many-to-many relationships are used. This was an upgrade from the hierarchical databases. Relies on physical pointers. It is very rigid to use; to find a data, you had to know its exact place.</li><li><strong>Graph DB:</strong> Considered modern evolution of connected data. It’s flexible. Uses nodes and edges, graph structures to represent and store data. Used for social networks, fraud detection. Optimized for traversing complex interconnections and discovering patterns. Examples: <strong>Neo4j, Amazon Neptune, Memgraph, OrientDB.</strong></li><li><strong>Object Oriented DB: </strong>Data is stored as objects, like in OOP, these types of databases are ideal for applications with complex data models. Like multimedia/financial systems. Seamless integration with object-oriented languages and applications, can store complex data directly<em> but </em>it is not as widely used and is less developed than SQL or NoSQL databases. Examples: <strong>ObjectDB, db4o, Versant.</strong></li><li>Time Series: InfluxDB, TimescaleDB.</li><li>Search Engines: ElasticSearch, Apache Solr, Meilisearch.</li><li>NewSQL: CockroachDB, Google Spanner.</li></ul><p><strong>Modern Type DB:</strong></p><ul><li><strong>Cloud-Native &amp; Serverless DB:</strong> Allows businesses to store big amount of data, petabytes of data without physical servers. They scale automatically based on business&#39;s demands. Examples: <strong>Snowflake, Google BigQuery, Amazon Aurora.</strong></li><li><strong>Vector DB: </strong>Stores data as Vector Embeddings (long lists of numbers). Numbers here represent ‘meaning’ or ‘features’ of the data. Uses mathematical distance to find the ‘nearest neighbors’ to a query. It’s AI focused. Examples: <strong>Pinecone, Milvus, Weaviate, Chroma, Qdrant.</strong></li><li><strong>Multi-Model DB:</strong> Modern systems that act like a document, graph, key-value all at once. Examples: <strong>Azure Cosmos DB</strong></li></ul><p><strong><em>When to Use Which?</em></strong></p><ul><li>When every data must be accounted for, relationships are complex, structure is mandatory. <strong><em>Use SQL.</em></strong></li><li>Need to track user behavior on websites, process millions of IoT sensor signals. <strong><em>Use NoSQL.</em></strong></li><li>When need suggestions with specialized structures, building elastic applications. <strong><em>Use Modern/Recommendation Databases.</em></strong></li></ul><h4><strong>Differences Between Relational and Non-Relational DB:</strong></h4><ul><li><strong>Structure:</strong> Strict data fixations for SQL. Flexible for NoSQL.</li><li><strong>Changes:</strong> Redesigning is hard for SQL. Add new types easily for NoSQL.</li><li><strong>Scaling:</strong> Vertical for SQL. Horizontal for NoSQL.</li><li><strong>Speed:</strong> Steady, great with complexity for SQL. Fast, great for massive simple data tasks for NoSQL.</li><li><strong>Best Usage: </strong>Accuracy for SQL. Growth for NoSQL.</li></ul><p>Before choosing database, you got to know your projects requirements.</p><p>Is it write-heavy or read-heavy? Is data structured or not? Is it going to scale horizontally or vertically? Consistency? Availability? Physical or cloud servers?</p><p><strong>Workloads: Read-Heavy and Write-Heavy</strong></p><ul><li>Read-Heavy: Fast and frequent data retrieval is prioritized. Changing/writing is rarely used. Most likely to use Relational (PostgreSQL/MySQL) or Document (MongoDB) for delivering specific records <em>fast.</em></li><li>Write-Heavy: Storing large volumes of data quickly is prioritized. Wide-Column (Cassandra/ScyllaDB) or Time-Series (InfluxDB) are most likely to be used. Because these can handle a non-stop flow of incoming data without crashing down.</li><li>Hybrid-Heavy: Lately, companies/businesses seperated their databases to see live from one and analytics from another. NewSQL (Google Spanner, CockroachDB) or Multi-Model type of databases are likely to be used here.</li></ul><p><strong>Data Structure Type: Structured/Semi-Structured/Unstructured</strong></p><ul><li>Structured/Tabular: Relational is chosen because data has fixed schema and complex relationships and ensured data integrity.</li><li>Unstructured/Semi-Structured: NoSQL is the one to go here because data is changed frequently, has schema-less approach.</li></ul><p><strong>Scalability: Horizontally/Vertically</strong></p><ul><li>Vertical Scalability/Scale Up: Means adding more CPU/RAM to a single server. Easy to manage but hardware’s has a limit. And it can be challenging as financially. Traditional SQL databases choose to scale this way.</li><li>Horizontal Scalability/Scale/Out: Means adding more servers to a cluster. It’s considered essential for big data. NoSQL and Distributed SQL are designed this way to grow infinitely by adding more nodes.</li></ul><p><strong>Consistency or Availability:</strong></p><ul><li>Consistency Prioritized: When network breaks down, the database refuses to new data entry/updates so everyone who access to the database can see the same, correct data.</li><li>Availability Prioritized: Database is online and accepts new data entry/updates, but different users can see different version of data. Because availability is more important than correct data here.</li></ul><p><strong>Server Environment: Cloud or Physical</strong></p><ul><li>Physical: Is used when in need of extreme speed. And you want your data secured in some place where no one else other than your authorized personnel cannot reach.</li><li>Cloud: You need space. Like lots of space, and you need it quickly. You can store your data in some cloud servers. And when you need more storage, you can have one more or ten more servers.</li><li>Serverless: Modern way to store your data. You don’t see where the server is. You just store it and pay for what you use. Big data projects use this mostly.</li></ul><p>— — — — — — — — —</p><p>To summarize;<br><strong>Data Accuracy and Relations:</strong> Use SQL.<br><strong>Massive Scaling and Speed:</strong> Use NoSQL(Wide-Column).<br><strong>Rapid Growth &amp; Flexibility:</strong> Use NoSQL(Document).<br><strong>Social Ties/Connections: </strong>Use Graph databases.<br><strong>Real-Time Speed/Cache</strong>: Use Key-Value/SQL.<br><strong>AI/Similarity(LLMs):</strong> Vector databases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46844034664f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local Storage, Session Storage and Cookies]]></title>
            <link>https://medium.com/@eceaslan1001/local-storage-session-storage-and-cookies-334829f757c6?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/334829f757c6</guid>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 09:11:00 GMT</pubDate>
            <atom:updated>2026-02-23T09:11:00.611Z</atom:updated>
            <content:encoded><![CDATA[<p>We can store our data with cookies, local storage and session storage. If we can store data with all, then what’s with the types? Let’s see:</p><h4><strong>Cookies</strong></h4><p>Also known as: HTTP cookie, web cookie, Internet cookie, browser cookie.<br>It’s a small block of data created by a web server while user is browsing through a website and placed on the computer/other devices. More than one cookie can be stored in one session. They allow web servers to store stateful information such as items added to the cart in a shopping site, information that has been used for logging in, form fields, addresses, payment etc.</p><p>But it’s inefficient because data is reloaded with every request. Since server receives many requests every second, user’s information is not stored in the server. But cookies are sent and are stored in your local. Which uniquely identifies you. When the same server sees you, it will recognize you by your cookies.</p><h4>Local Storage &amp; Session Storage</h4><p>Websites with HTML5 can store data as locally in the browser. Data is used only when there is a request, unlike the cookies that reloads data with every server request. HTML5 has the advantage of storage. While HTML5 can store data up to 5 MB, cookies can only do that for 4 KB. There is 2 storage types HTML5 offers: <strong>Local Storage </strong>and <strong>Session Storage. </strong>Session storage lasts until the end of session while local storage keeps data even after sessions. Data stored by local storage can be deleted manually.</p><p><strong>Local Storage</strong></p><p>Websites are allowed to store key-value pairs in the browser. It’s stored even after the browser is closed and reopened. UTF-16 is used to encode data, strings are automatically generated from integer keys. Stored data is specific to the protocols. Like it’s different when it’s HTTP and HTTPS.</p><p><strong>Session Storage</strong></p><p>This storage type objects can be accessed using read-only property. It’s deleted when session ends. But it’s available even when page is refreshed, it’s stored as long as the tab is open. UTF-16 is used like Local Storage.</p><p><strong>Methods for Local &amp; Session Storage</strong></p><ul><li>setItem(): Takes 2 parameters, one is key and the other is value. Used to store the value in a particular location with the key.</li><li>getItem(): Takes 1 parameter (key). Used to get the value stored with the specified key.</li><li>removeItem(): Takes 1 parameter (key). Used to delete the value specified with the key.</li><li>clear(): Used to clear all the values.</li></ul><h4>Differences</h4><ul><li><strong>Capacity:</strong> <br>Cookies: 4 KB<br>Session Storage: 5 MB<br>Local Storage: 5 MB-10MB</li><li><strong>Storage: <br></strong>Cookies: Depends on the settings<br>Session Storage: From the beginning of the session until the end.<br>Local Storage: Manually/by JavaScript deleted. If not, it’s stored permanently.</li><li><strong>Read/Write: <br></strong>Cookies: Both clients and servers<br>Session Storage: Only client<br>Local Storage: Only client</li><li><strong>Data Transfer: <br></strong>Cookies: To the server<br>Session Storage: No Transfer<br>Local Storage: No Transfer</li><li><strong>Supported by:<br></strong>Cookies: All browsers. Older ones too.<br>Session Storage: All browsers. Older ones too.<br>Local Storage: All browsers. Older ones too.</li><li><strong>Usage:<br></strong>Cookies: Data needs to be sent to the server. Authentication, user tracking, session management situations.<br>Session Storage: Temporary data storage needed. Form progress, shopping carts situations.<br>Local Storage: Data needs to be stored permanently and needs to be at the browser itself, not the server. User preferences, cached API data situations.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=334829f757c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Caches in Web]]></title>
            <link>https://medium.com/@eceaslan1001/caches-in-web-7f156c53a024?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f156c53a024</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Wed, 18 Feb 2026 07:19:54 GMT</pubDate>
            <atom:updated>2026-02-18T07:19:54.354Z</atom:updated>
            <content:encoded><![CDATA[<p>We all know the classic method for “turn it off and on back again” for any electronic devices, right? Well, it’s “clear your browser cache and delete your cookies” for websites that don’t work. Let’s see what these caches mean, what they do, how can we control them, and some other information about them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*oEbfo_ZsSs_nNO_aQgTNzg.png" /><figcaption><a href="https://pressidium.com/wp-content/uploads/2017/05/Pressidium_blogpost_04_05_2017-05.png">https://pressidium.com/wp-content/uploads/2017/05/Pressidium_blogpost_04_05_2017-05.png</a></figcaption></figure><p>The browser cache is used by browsers to store web page resources locally so when the users visit the web page again it will load instantly. It helps with performance gains, minimizing bandwidth consumption, faster experience.</p><p>They are stored temporarily until their TTL expires or hard drive cache is full. Request headers go from the browser to the server, and the headers tells how long the caches should be stored.</p><h4>What is happening when we clear the caches?</h4><p>When the caches are cleared, there is nothing in the storage to load before. Just like visiting a website for the first time. We could say it’s like we delete the browser’s memory and visit the same place. And it says, ‘It’s my first time here, let me cache these!’. If we clear the cache before every visit, the browser will say the same thing and cache over and over again. But for it, it’ll be like the first time.</p><p>“Clearing the caches” is asked when there is an update in the page we visited and it differs from the old, cached version we stored before. This usually fixes the problem that has been faced. This may slow down the page load time, but we won’t be facing more issues about old-new version crashes.</p><h4>Types of Web Caches</h4><p><strong>Browser Cache: </strong>A local storage area on the computer that stores images, scripts, etc. It stores them, so they don’t need to be downloaded again upon visiting them again. Disadvantage of it, is that if your page is updated your cache has to be cleared and (if necessary) be downloaded again.</p><p><strong>Proxy Cache: </strong>This one is a server-side cache that’s between the client and the servers. It’s preferred for performance optimization, security and privacy. When you want to access to a page, you access through a proxy cache server. Then the proxy retrieves your cache from the original server.</p><p><strong>CDN/Content Delivery Network Cache: </strong>This web cache is a distributed network of proxy cache servers that are around the worldwide. When you make a request CDN will try to get the content from a server that’s closest to you. This helps with the performance, redundance of latency between when your request has been sent and when it responded to your computer.</p><p><strong>Server Cache: </strong>This type of web cache also helps with the performance. Its difference is that this cache stored the frequently use content on the server, so when visited again, it will be downloaded quickly.</p><h4>Ways to control caches</h4><ul><li><strong>Freshness/Staleness</strong>: We use “age” when we decide if the cache is fresh or stale. To calculate this, we use ‘Date’ and ‘Cache-Control&#39;s max-age information. If the calculated age is more than the max-age, we say that the cache is stale. If not, it’s fresh. <br>Expires header was used before this; to determine a specific date but later it was found with lots of bugs, so they dropped it.</li><li><strong>Vary: </strong>Responses are distinguished from one another based on their URL’s. Even if their URLs are same, the responses are not.</li><li><strong>Validation: </strong>When the responses became stale, they are not deleted immediately. We check the headers for <em>If-Modified-Since </em>or <em>If-None-Match. <br> — </em>We request with If-Modified-Since header and if it responds with the status code of 304 Not Modified, it means content has not been changed, therefore there is no need for re-downloading the cache. <br> — Value of the header ETag is a random value by the server. We take this value and ask the server with the header of If-None-Match. If it responds with 304 Not Modified, it means the cache is still validated.</li></ul><h4>Cache-Control Header:</h4><ul><li>no-cache: Wants web browser to validate the content against the server. If fresh, it can be served from the cache.</li><li>no-store: Tells the browser to not to cache anything in any way. Used for sensitive data or frequently changed data.</li><li>public: The content can be cached by the browser or any intermediate parties like proxies, etc.</li><li>private: Content is private so it can be reached by only by the browser and not by intermediate proxies, etc. Used for user related data.</li><li>max-age: Tells the server that how long the cached content will stay there.</li><li>s-maxage: Similar to max-age but used for intermediate caches.</li><li>must-revalidate: Forces browser to validate the content again.</li><li>proxy-revalidate: Similar to must-revalidate but for intermediate caches.</li><li>no-transform: Tells browser to not transform the content received from the server in any kind of way.</li></ul><h4>Deleting Stored Responses:</h4><p>We cannot delete the stored responses that are in the intermediate servers with a long max-age. There is nothing the server can do once the response is stored. But <strong>Clear-Site-Data: cache</strong> header can be used here to clear the browser caches but it’s no use for intermediate servers. Those will stay in the cache until their max-age expires. Except for the situations of reload, force-reload and clear-history.</p><p><strong>Back/Forward Cache / bfcache: </strong>In modern websites, this enables instant navigation back and forward between previously visited pages. It stores a snapshot of the page as the user navigates away from it; it quickly brings it back when user comes back to it.</p><p><strong>Server-Side Web Caching Servers<br></strong>And lastly here are some web servers that are commonly used for caching:</p><ul><li>Express</li><li>Apache</li><li>nginx</li><li>Firebase Hosting</li><li>Netlify</li></ul><p>……………….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f156c53a024" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Response Status Codes]]></title>
            <link>https://medium.com/@eceaslan1001/http-response-status-codes-e106bd16c6c6?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e106bd16c6c6</guid>
            <category><![CDATA[http-status-code]]></category>
            <category><![CDATA[http-response]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Mon, 16 Feb 2026 07:24:09 GMT</pubDate>
            <atom:updated>2026-02-16T08:53:48.179Z</atom:updated>
            <content:encoded><![CDATA[<p>We request things from a server and it returns us a result, a response. And they come with a body containing requested data and a status code. Status codes helps us understand how the request has been handled by the server. We have 5 categories for status codes:</p><ol><li>Informational Responses: 100–199</li><li>Successful Responses: 200–299</li><li>Redirection Responses: 300–399</li><li>Client Error Responses: 400–499</li><li>Server Error Responses: 500–599</li></ol><p>Let’s see what the codes tells us and I’ll leave some with no explanation because they are used less than the others.</p><h4>1XX Informational Responses</h4><ul><li>100 Continue: Continue your request/ignore the response. Move on.</li></ul><p>Some other:</p><ul><li>101 Switching Protocols</li><li>102 Processing</li><li>103 Early Hints</li></ul><h4>2XX Successful Responses</h4><ul><li>200 OK: Your request succeeded.</li><li>201 Created: Your request succeeded and a new resource has been created upon it.</li><li>202 Accepted: I got your request but there is a queue. I’ll process it when its turn.</li></ul><p>Some other:</p><ul><li>203 Non-Authoritative Information</li><li>204 No Content</li><li>205 Reset Content</li><li>206 Partial Content</li><li>207 Multi-Status</li><li>208 Already Reported</li><li>226: IM Used</li></ul><h4>3XX Redirection Responses:</h4><ul><li>300 Multiple Choices: There is more than one response.</li><li>301 Moved Permanently: Requested URL has been changed permanently and here is the new URL for it.</li><li>302 Found: Requested URL has been changed temporarily. You can use the current URL for now. But I’ll direct you to the other one anyway.</li><li>303 See Other: Requested URL is not here but might be here, see this one.</li><li>305 Use Proxy: Use proxy to access the requested response.</li></ul><p>Some other:</p><ul><li>304 Not Modified</li><li>306 Unused</li><li>307 Temporary Redirect (Same as 302)</li><li>308 Permanent Redirect (Same as 301)</li></ul><h4>4XX Client Error Responses</h4><ul><li>400 Bad Request: I can’t access the server because you did something wrong. Probably a syntax error.</li><li>401 Unauthorized: First, authenticate yourself. Then you may get your requested response.</li><li>403 Forbidden: Even though I know who you are, I can’t let you access here.</li><li>404 Not Found: I don’t recognize the URL, I can’t find it therefore.</li></ul><p>Some other:</p><ul><li>402 Payment Required</li><li>405 Method Not Allowed</li><li>406 Not Acceptable</li><li>407 Proxy Authentication Required</li><li>408 Request Timeout</li><li>409 Conflict</li><li>410 Gone</li><li>411 Length Required</li><li>412 Precondition Failed</li><li>413 Content Too Large</li><li>414 URI Too Long</li><li>415 Unsupported Media Type</li><li>416 Range Not Satisfiable</li><li>417 Expectation Failed</li><li>418 I’m a teapot</li><li>421 Misdirected Request</li><li>422 Unprocessable Content (WebDAV)</li><li>423 Locked (WebDAV)</li><li>424 Failed Dependency (WebDAV)</li><li>425 Too Early</li><li>426 Upgrade Required</li><li>428 Precondition Required</li><li>429 Too Many Requests</li><li>431 Request Header Fields Too Large</li><li>451 Unavailable For Legal Reasons</li></ul><h4>5XX Server Error Responses</h4><ul><li>500 Internal Server Error: There is a problem and I don’t know how to handle it.</li><li>502 Bad Gateway: While I was trying to handle the request I got an invalid response.</li><li>503 Service Unavailable: The server is not ready to handle the request. It may be down or overloaded, I don’t know but you can try it again later.</li><li>504 Gateway Timeout: Server is the gateway and I cannot get a response.</li></ul><p>Some other:</p><ul><li>501 Not Implemented</li><li>505 HTTP Version Not Supported</li><li>506 Variant Also Negotiates</li><li>507 Insufficient Storage (WebDAV)</li><li>508 Loop Detected (WebDAV)</li><li>510 Not Extended</li><li>511 Network Authentication Required</li></ul><p>…………</p><p>Status codes help us know about the response. Instead of reading lines and lines, we take a look at the code and understand what happened in a moment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e106bd16c6c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP Request Methods]]></title>
            <link>https://medium.com/@eceaslan1001/http-request-methods-f426f82e33a6?source=rss-e500cb242bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f426f82e33a6</guid>
            <category><![CDATA[http-request]]></category>
            <dc:creator><![CDATA[Ece Aslan]]></dc:creator>
            <pubDate>Mon, 16 Feb 2026 07:23:23 GMT</pubDate>
            <atom:updated>2026-02-16T07:23:23.634Z</atom:updated>
            <content:encoded><![CDATA[<p>HTTP stands for Hypertext Transfer Protocol and it’s used for loading webpages using hypertext links. And it has methods which are associated with RESTful web development. We have these methods below that are commonly used and what they do and how they work:</p><h4>GET</h4><p>Purpose of this method is retrieve data from the server. It’s safe to use because it is only used for data reading. It does not contain body since we’re only reading. And it’s idempotent too, meaning if we request the same information over and over, the result will be the same. The response will be returned with a body containing the requested data.</p><p>Syntax:</p><pre>GET &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example:</p><pre>GET /api/v1/articles?category=tect&amp;sort=recent HTTP/1.1<br>Host: api.medium-clone.com<br>Accept: application/json<br>Authorization: Bearer &lt;user_token&gt;<br></pre><p>The code above asks for the latest articles in the category of technology in JSON format.</p><h4>POST</h4><p>Purpose of this method is sending data to the server for the processing. This method is not safe as GET method because it can alter the server. And also not idempotent.</p><p>We can use this method to send data from input fields in online forms, XML or JSON data or text data from query parameters. But we can also post data on a page or save data to a database.</p><p>Syntax:</p><pre>POST &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example:</p><pre>POST /api/v1/users/register HTTP/1.1<br>Host: api.myapp.com<br>Content-Type: application/json<br><br>{<br>  &quot;username&quot;:&quot;code_lady&quot;,<br>  &quot;email&quot;:&quot;code_lady@coding.com&quot;,<br>  &quot;password&quot;:&quot;p455w0rd&quot;<br>}<br></pre><p>The code above creates a new user with the provided information on the database. The request has a body since we are sending data to the server.</p><h4>HEAD</h4><p>Purpose of this method is returning the metadata about a resource on the server which means it can be used to check for the size of a resource on the server or if it is there or modified date. Unlike, GET method this method’s response does not have a body.</p><p>Syntax:</p><pre>HEAD &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example: The code below shows the successfully returned data from a HEAD request.</p><pre>HTTP/1.1 200 OK<br>Date: Fri, 19 Aug 2023 12:00:00 GMT<br>Content-Type: text/html<br>Content-Length: 1234<br>Last-Modified: Thu, 18 Aug 2023 15:30:00 GMT<br></pre><h4>PUT</h4><p>Purpose of this method is to create a new resource or replace a resource identified with a URL. This method may be unsafe, cause of it is changing state of a resource in the server but it is idempotent, which meaning how muchever you run the operation its result won’t be different.</p><p>Syntax:</p><pre>PUT &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example:</p><p>The code below shows user’s request to change the information on resource which’s id is 42. It will overwrite on the old information.</p><pre>PUT /api/v1/products/42 HTTP/1.1<br>Host: store-api.com<br>Content-Type: application/json<br><br>{<br>  &quot;id&quot;:42,<br>  &quot;name&quot;:&quot;Wireless Mouse&quot;,<br>  &quot;price&quot;:599.90,<br>  &quot;stock&quot;: 120<br>}<br></pre><h4>DELETE</h4><p>Purpose for this method is obviously to delete the given resource from the server. Just like PUT method, this method is also idempotent and unsafe.</p><p>Syntax:</p><pre>DELETE &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example: The code below shows user’s request to delete the file from the given server.</p><pre>DELETE /file.html HTTP/1.1<br>Host: example.com</pre><p>The response may return with a body or not and a status code. There are several status codes it may return, such as 200 OK, 202 Accepted etc.</p><h4>TRACE</h4><p>We use this method for diagnostics, debugging and troubleshooting. When requested, it will return a diagnostics trace data from request-response.</p><p>Syntax:</p><pre>TRACE &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example:</p><pre>TRACE HTTP/1.1<br>Host: example.com<br>User-Agent: curl/8.7.1<br>Accept: */*<br></pre><p>Request will return a response with a responser body containing request headers and a status code. Such as:</p><pre>HTTP/1.1 200 OK<br>Content-Length: 123<br>Date: Wed, 04 Sep 2024 11:50:24 GMT<br>Server: Apache/2.4<br>Content-Type: message/http<br></pre><h4>OPTIONS</h4><p>This method is used to list the method options that can be used on the current server. GET and HEAD methods are a must in every server but the others are optional. The request may contain a body but is not necessarily used.</p><p>Syntax:</p><pre>OPTIONS *|&lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example:</p><pre>OPTIONS /example/resource HTTP/1.1<br></pre><p>The code above will return the answer below:</p><pre>Host: www.example.com HTTP/1.1 200 OK<br>Allow: GET, POST, DELETE, HEAD, OPTIONS<br>Access-Control-Allow-Origin: *<br>Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS<br>Access-Control-Allow-Headers: Authorization, Content-Type<br></pre><h4>CONNECT</h4><p>This operation is used to establish a HTTP tunnel to a destination server and forward encrypted data/package both ways until the connection is closed. Encrypted packages sent from network to client, they won’t be seen from outside.</p><p>Syntax:</p><pre>CONNECT &lt;host&gt;:&lt;port&gt; HTTP/1.1<br></pre><p>Example:</p><pre>CONNECT server.example.com:80 HTTP/1.1<br><br><br>Host:server.example.com:80<br>proxy-Authorization: basic aGVsbG86d29ybGQ=<br></pre><h4>PATCH</h4><p>This method is used for when there is need for a small change in a large resource. It is used for ‘patching’, literally. It’s time and memory efficient but not safe and not idempotent. The request has a body which used to identify the part that needs to be patched.</p><p>Syntax:</p><pre>PATCH &lt;request-target&gt;[&quot;?&quot;&lt;query&gt;] HTTP/1.1</pre><p>Example:</p><pre>PATCH /users/123 HTTP/1.1<br>Host: example.com<br>Content-Type: application/json<br>Content-Length: 27<br>Authorization: Bearer ABC123<br>{<br>  &quot;status&quot;: &quot;suspended&quot;<br>}<br></pre><p>The code above sends a request to change “status” from “active” to “suspended” for the user 123. Response will be returned with a status code.</p><p>… <br>There are more methods in HTTP that are used less than the mentioned above such as BIND, COPY, LABEL, LINK, MERGE, MKWORKSPACE, MOVE, QUERY, UPDATE and more. You may visit this link to see more of these: https://www.iana.org/assignments/http-methods/http-methods.xml</p><p>Long explanations short:</p><ul><li>To get information use GET,</li><li>To create something new use POST</li><li>To replace information use PUT,</li><li>To know about the resource use HEAD,</li><li>To erase information use DELETE,</li><li>To know what methods the server supports use OPTIONS,</li><li>To get encrypted data use CONNECT,</li><li>To change a little in a large resource use PATCH,</li><li>To debug, troubleshoot use TRACE.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f426f82e33a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>