English
[1Day-1CS] Proxy Patterns & Iterator Patterns & Exposure Module Patterns

[1Day-1CS] Proxy Patterns & Iterator Patterns & Exposure Module Patterns

A Quick Recap of 1CS, Proxy Patterns, Iterator Patterns, and Exposure Module Patterns

Proxy Pattern

  • A design pattern that acts as an interface to a target object by intercepting its flow before it is accessed and acting as a front-end to the target object.

  • Used for security, data validation, caching, and logging; also utilized as a server rather than an object

Proxy Server

  • Works between server and client

  • A system or program that allows clients to access other network services indirectly through it.

Examples include Apache, Nginx, CloudFlare, etc.

Example usage of a proxy server

  • Go through a proxy, so you can hide the actual port you're using

  • Allows you to gzip static resources through Nginx, or logging in front of your main server

  • CloudFlare makes it easy to deploy HTTPS, which can help defend against DDOS attacks

  • Front-end proxy servers can be used to prevent Cross Origin Resource Sharing (CORS) errors

Iterator Pattern

Design pattern for accessing elements of a collection through an iterator.

  • Regardless of the structure of the data types, it is possible to traverse them with one interface: an iterator.

  • Normally iterable objects can be traversed via the iterator protocol

Exposed Module Pattern

Pattern that creates access controllers such as private, public through immediate functions

  • In case of JS, access controllers don't exist separately, so we also build them by implementing them

댓글 작성

게시글에 대한 의견을 남겨 주세요.

댓글 0