@ -6,7 +6,7 @@ tags: javascript,function,type,boolean
|
||||
expertise: advanced
|
||||
author: chalarangelo
|
||||
cover: blog_images/lighthouse.jpg
|
||||
excerpt: Boolean traps can cause readabiltiy and maintainability issues in your code. Learn what they are, how to spot and fix them in this article.
|
||||
excerpt: Boolean traps can cause readability and maintainability issues in your code. Learn what they are, how to spot and fix them in this article.
|
||||
firstSeen: 2021-07-11T05:00:00-04:00
|
||||
---
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ tags: javascript,object,class
|
||||
expertise: intermediate
|
||||
author: chalarangelo
|
||||
cover: blog_images/last-light.jpg
|
||||
excerpt: Understading the difference between these two object-oriented programming paradigms is key to taking your skills to the next level.
|
||||
excerpt: Understanding the difference between these two object-oriented programming paradigms is key to taking your skills to the next level.
|
||||
firstSeen: 2021-11-21T05:00:00-04:00
|
||||
---
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ tags: javascript,object,class,symbol,generator
|
||||
expertise: intermediate
|
||||
author: chalarangelo
|
||||
cover: blog_images/book-chair.jpg
|
||||
excerpt: Enums are part of TypeScript, but what about defininf enums in plain old JavaScript? Here are a few way you can do that.
|
||||
excerpt: Enums are part of TypeScript, but what about defining enums in plain old JavaScript? Here are a few way you can do that.
|
||||
firstSeen: 2021-05-24T12:00:00+03:00
|
||||
lastUpdated: 2021-06-12T19:30:41+03:00
|
||||
---
|
||||
|
||||
@ -12,7 +12,7 @@ firstSeen: 2021-08-31T05:00:00-04:00
|
||||
|
||||
### Definition
|
||||
|
||||
A binary search tree is a data structure consisting of a set of orderd linked nodes that represent a hierarchical tree structure. Each node is linked to others via parent-children relationship. Any given node can have at most two children (left and right). The first node in the binary search tree is the root, whereas nodes without any children are the leaves. The binary search tree is organized in such a way that for any given node, all nodes in its left subtree have a key less than itself and all nodes in its right subtree have a key greater than itself.
|
||||
A binary search tree is a data structure consisting of a set of ordered linked nodes that represent a hierarchical tree structure. Each node is linked to others via parent-children relationship. Any given node can have at most two children (left and right). The first node in the binary search tree is the root, whereas nodes without any children are the leaves. The binary search tree is organized in such a way that for any given node, all nodes in its left subtree have a key less than itself and all nodes in its right subtree have a key greater than itself.
|
||||
|
||||

|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ const reducer = (state = initialState, action) => {
|
||||
|
||||
While the code in the example is not that complicated right now, complexity can increase very fast as more action types need to be handled by our application. This is due to the fact that each `action.type`'s logic is nested inside the `reducer` function, thus adding more code and complexity with each new action.
|
||||
|
||||
Another issue we can identify is that each `action` has a different structure, which increases congitive load for future maintainers, as they have to remember what keys their `action` needs to have. There's also the added issue of running into a case where `action.type` might be needed to pass actual data to the state (i.e. `state.type` could exist).
|
||||
Another issue we can identify is that each `action` has a different structure, which increases cognitive load for future maintainers, as they have to remember what keys their `action` needs to have. There's also the added issue of running into a case where `action.type` might be needed to pass actual data to the state (i.e. `state.type` could exist).
|
||||
|
||||
Finally, our `action.type` values are hardcoded inside the `reducer` function, making it hard to remember and sync across other files and components. This might seem like the least of our problems, but it's probably the easiest one to fix, so let's start there.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user