devdong

Welcome to devdong โ€” a cozy corner where developers share stories over a cup of coffee. โ˜•๐Ÿ’ป

[UML] Let's Fully Understand Object Diagrams
In software development projects, class diagrams are like blueprints when explaining the structure of complex systems. However, these blueprints alone can sometimes make it difficult to understand how the system actually operates at a specific moment. This is where UML Object Diagrams become incredibly usefulโ€”they provide a snapshot of the system at a particular point in time. In this article, weโ€™ll explore what UML Object Diagrams are, what their main components consist of, and how they differ from class diagrams so that youโ€™ll clearly understand when to use them. Weโ€™ll also look at examples applied to real-world development scenarios and best practices to help enhance your software design skills.
[UML] Understanding Class Diagrams Perfectly
Software development is the process of building complex systems. Often, multiple developers collaborate, and there's a need to grasp the structure of the system at a glance. What if there were a tool to visually express the system with a unified set of conventions? Thatโ€™s where UML (Unified Modeling Language) comes in. UML is a standard modeling language used to visualize, specify, and document object-oriented software systems. Especially as microservice architecture and large-scale system design become more common, UMLโ€™s importance continues to grow. Among the many types of UML diagrams, the Class Diagram stands out as a core tool that clearly shows the static structure of a system. In this post, weโ€™ll walk through the basic concepts, components, and real-world uses of class diagrams. This guide will help you better understand system structure and communicate more effectively with your team.
UML ๋‹ค์ด์–ด๊ทธ๋žจ ์ข…๋ฅ˜ ์™„๋ฒฝํžˆ ์ดํ•ดํ•ด๋ณด์ž
ํด๋ž˜์Šค, ์‹œํ€€์Šค, ์œ ์Šค์ผ€์ด์Šค ๋“ฑ ์ฃผ์š” UML ๋‹ค์ด์–ด๊ทธ๋žจ ์ข…๋ฅ˜๋ฅผ ์‹ค๋ฌด ์˜ˆ์ œ์™€ ํ•จ๊ป˜ ์•Œ์•„๋ณด์„ธ์š”. ์†Œํ”„ํŠธ์›จ์–ด ์„ค๊ณ„ ๋Šฅ๋ ฅ์„ ํ•œ ๋‹จ๊ณ„ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜์„ธ์š”. ์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ์—์„œ ๋ณต์žกํ•œ ์‹œ์Šคํ…œ์„ ์„ค๊ณ„ํ•  ๋•Œ, ํŒ€์›๋“ค๊ณผ ๋ช…ํ™•ํ•˜๊ฒŒ ์†Œํ†ตํ•˜๋Š” ๊ฒƒ์€ ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค. ์ฝ”๋“œ๋กœ ๋ฐ”๋กœ ๊ตฌํ˜„ํ•˜๊ธฐ ์ „์— ์‹œ์Šคํ…œ์˜ ๊ตฌ์กฐ์™€ ๋™์ž‘ ๋ฐฉ์‹์„ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ์–ด๋–จ๊นŒ์š”? ๋ฐ”๋กœ ์ด ์ง€์ ์—์„œ UML(Unified Modeling Language)์ด ๊ทธ ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. UML์€ ๊ฐ์ฒด ์ง€ํ–ฅ ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ์„ ์‹œ๊ฐํ™”, ๋ช…์„ธํ™”, ๊ตฌ์ถ•, ๋ฌธ์„œํ™”ํ•˜๊ธฐ ์œ„ํ•œ ํ‘œ์ค€ ๋ชจ๋ธ๋ง ์–ธ์–ด์ž…๋‹ˆ๋‹ค. 1990๋…„๋Œ€ ์ค‘๋ฐ˜์— ๋“ฑ์žฅํ•œ ์ดํ›„, UML์€ ์†Œํ”„ํŠธ์›จ์–ด ์—”์ง€๋‹ˆ์–ด๋ง์˜ ํ•ต์‹ฌ ๋„๊ตฌ๋กœ ์ž๋ฆฌ ์žก์•˜์Šต๋‹ˆ๋‹ค. ํŠนํžˆ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ์•„ํ‚คํ…์ฒ˜๋‚˜ ๋Œ€๊ทœ๋ชจ ์‹œ์Šคํ…œ ์„ค๊ณ„๊ฐ€ ์ผ์ƒํ™”๋œ ์ง€๊ธˆ, UML์˜ ์ค‘์š”์„ฑ์€ ๋”์šฑ ์ปค์ง€๊ณ  ์žˆ์–ด์š”. UML์€ ํฌ๊ฒŒ ๊ตฌ์กฐ์  ๋‹ค์ด์–ด๊ทธ๋žจ(Structural Diagrams) ๊ณผ ํ–‰์œ„์  ๋‹ค์ด์–ด๊ทธ๋žจ(Behavioral Diagrams) ์œผ๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค. ๊ฐ ๋‹ค์ด์–ด๊ทธ๋žจ์€ ์‹œ์Šคํ…œ์˜ ํŠน์ • ์ธก๋ฉด์„ ํ‘œํ˜„ํ•˜๋Š” ๋ฐ ์ตœ์ ํ™”๋˜์–ด ์žˆ์ฃ . ์ด ๊ธ€์—์„œ๋Š” ์‹ค๋ฌด์—์„œ ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” UML ๋‹ค์ด์–ด๊ทธ๋žจ ์ข…๋ฅ˜๋ฅผ ์ƒ์„ธํžˆ ์‚ดํŽด๋ณด๊ณ , ๊ฐ ๋‹ค์ด์–ด๊ทธ๋žจ์ด ์–ด๋–ค ์ƒํ™ฉ์—์„œ ์œ ์šฉํ•œ์ง€ ์‹ค์ œ ์˜ˆ์‹œ์™€ ํ•จ๊ป˜ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
class-validator's IsMongoId: Validating MongoDB ObjectId
When developing APIs with NestJS, you often need to validate parameters in the MongoDB ObjectId format. If an invalid ID format is passed, it results in a database query error and an unfriendly error message to the user. Using the @IsMongoId() decorator from class-validator makes this easy to handle. Just add this decorator to a DTO, and MongoDB ObjectId validation happens automatically. Invalid requests are blocked before reaching the controller. In this post, weโ€™ll cover everything from basic usage of @IsMongoId() to its internal implementation, real-world usage, and even creating custom validations.
Why Can't `IsDecimal` Validate Numbers?
In NestJS, class-validator is a powerful tool that simplifies data validation. By adding a few decorators to a DTO (Data Transfer Object), you can easily control the structure of incoming requests. However, sometimes decorators behave differently than expected, causing confusion. One such decorator is @IsDecimal. Have you ever encountered an error saying "not a valid decimal" even though you sent a properly formatted decimal number? In this post, Iโ€™ll clearly explain why @IsDecimal behaves this way and how to properly validate decimal numbers in NestJS.
Let's Use `IsEnum` Properly in NestJS with class-validator
When validating DTOs in NestJS, there are many cases where you need to "allow only specific values". For example, you may want to allow only 'admin' | 'user' | 'blogger' for the role (role) or 'S' | 'M' | 'L' | 'XL' for product size (size). In such cases, using the @IsEnum decorator from class-validator effectively allows for clean and secure input validation.
How to use class-validator in Nextjs

How to use class-validator in Nextjs

dong1 min read
When developing with Next.js, how do you validate the data that comes through API routes or forms? Unlike frameworks like Express or NestJS, Next.js doesn't provide a built-in validation layer. This means developers have to write their own code to ensure data integrity. In this post, Iโ€™ll show you how to integrate the familiar class-validator libraryโ€”popular among NestJS developersโ€”into a Next.js project. Step by step, we'll explore how you can write cleaner, more maintainable, and reliable validation logic using decorator-based validation. From my personal experience, introducing class-validator significantly improved both the stability of the product and the ease of development. While Next.js isnโ€™t the most convenient tool for building APIs, a well-designed architecture can still make it a capable API server framework. This article is based on Next.js version 15. Please keep that in mind. ๐Ÿ˜‰
Improving Type Safety and Reusability with TypeScript Generics and keyof
When working with TypeScript, there are times when you want to write reusable code that can handle various types. This is exactly when generics come into play. And when used with the keyof operator, you can safely work with object properties. In this post, we'll explore how to use TypeScript generics along with keyof, with practical examples. From basic concepts to immediately applicable patterns, the content is structured to build your understanding step-by-step.
Complete Guide to CQRS Pattern in NestJS
When developing backend systems that require complex business logic and high performance, the traditional CRUD pattern often shows its limitations. In such cases, the CQRS (Command Query Responsibility Segregation) pattern can be a viable solution. This guide will walk you through implementing the CQRS pattern in NestJS step-by-step and share practical insights for applying it in real-world projects. From the core concepts of the CQRS pattern to its actual implementation and testing strategies in NestJS, this guide covers everything comprehensively to help you elevate your application architecture.
NestJS: Middleware vd Interceptor and How to Use Them?
When developing a backend with NestJS, it can be confusing to decide when to use middleware and when to use interceptors. Both features allow you to insert logic between a request and a response, but they differ in timing and capabilities. In this post, we'll clarify the differences between middleware and interceptors based on NestJSโ€™s request lifecycle, and examine which to use in real-world scenarios.
A Simple Guide to Shallow Copy vs Deep Copy in JavaScript
When developing in JavaScript, you often need to copy objects. However, simply copying with the = operator can lead to unexpected bugsโ€”because objects are reference types. In this post, weโ€™ll explore the differences between shallow and deep copies, when to use each, and practical implementation methods you can apply immediately.
Understanding the Concepts and Differences Between WebGL and WebGPU
As a web developer, youโ€™ll likely encounter situations where implementing 3D graphics or complex visualizations is necessary. While WebGL has been the standard for high-performance graphics on the web, a new option called WebGPU has now emerged. This article analyzes the key differences between WebGL and WebGPU, examining their strengths and weaknesses. It also offers a practical guide on which technology to choose in real-world development.