How We Make Sense of the World with Maps

Why does Atlas of Caregiving use maps to help family caregivers better understand their daily activities and needs? There could have been multiple formats used, so why employ cartography as the…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




More Depth to Refactoring and Using Design Patterns

I have mentioned in my previous blog(specifically about TDD) and mentioned the outline of refactoring, in this blog I will be writing more about what is refactoring and how to apply refactoring correctly by using design patterns.

Refactoring is the process of clarifying and simplifying the design of existing codes without changing the functionality of the codes.We use refactoring because by writing your code neatly less code smells will appear and this can improve the program’s performance,maintainability, scalability and flexibility. A simple example of refactoring would be applying clean codes to your program, however another application of refactoring will be using design patterns.

Design patterns are repeatable solutions to a commonly occuring problem in a program, design pattern is more like a template to solve a problem that can be used in many different situations. By using design patterns reduces code smell and increases code readability.

There are three types of design patterns commonly used:

A design pattern that focuses on object creation mechanism, this will improve the flexibility of a function creating an object in the most suitable situation.

A design pattern that simplifies the way to realize relationship between entities,this will improve code readability and more flexible to changes.

A design pattern that identifies communication patterns between objects, by using the pattern this will increase flexibility in carrying out this communication.

Model-View-Template(MVT for short) is a design pattern that is used in Django to develop web applications, the difference from the patterns above is that the controller part is taken care for us by the framework itself and MVT will divide into different files and these files will function as a type of pattern. An example would be comparing between observer pattern and a Django component Signals, both patterns identifies the communication pattern between objects.

I recommend apply refactoring to your code because refactoring can improve the program’s performance,maintainability, scalability and flexibility. Design pattern can be used in order to reduce code smells and improve code readability.

Add a comment

Related posts:

A roda

Esse foi o meu primeiro pensamento ao vê-la de pé, de mãos dadas a outras mulheres que formam uma roda. Era baixa e magra, do tipo mignon, de pele clara e bem cuidada, que escondia sua idade —…

Zenland

Semua tentang tahu Anda punya banyak pilihan ketika datang ke layanan escrow Anda, dan ingin Anda tahu bahwa Zenland ada di sini untuk Anda. Platform ini bukan sekadar nama lain — kami di sini karena…

Sonus Complete

Tinnitus is a common problem that affects millions of people worldwide. It’s a condition that causes ringing or buzzing in the ears, and it can be quite distressing. Sonus Complete is a dietary…