Refactoring: Ugly Code That Does Everything

Gabe Schmidt Development Technologies, JavaScript, Node.js, Programming, Tutorial Leave a Comment

If you’ve been writing code for a significant amount of time, you’re sure to have seen the—anything but godly—“God Method.” It’s a method that performs way too many processes in the system and has grown beyond all realistic logic to become “The Method That Does Everything.”

This single unsightly method can span dozens, if not hundreds, of lines. Sometimes even over 1,000! This type of “ugly code” is an unbearable beast to maintain. This is why it’s considered a “code smell” or anti-pattern.

In this tutorial, we walk through a tangible “God Method” and step through the process to refactor it into something more manageable and human-readable. Our code is written in JavaScript for a Node.js service, but the principles apply to any language.

Using Jest and Testing Library with React Native Part I: Setting Up

Justin Leach Development Technologies, JavaScript, React, React Native, Testing, Testing React Native Series, Tutorial Leave a Comment

In this post, Part 1 of Using Jest and Testing Library with React Native, I’ll give a brief introduction to Jest, Testing Library, and React Native. Then, we’ll walk through how to set each of them up. This will prepare us for Part 2, creating our first test.

How TypeScript Can Take Your React Development to the Next Level

Justin Hurt JavaScript, React, TypeScript Leave a Comment

No matter how much you love JavaScript, as with all languages, there are certain aspects of it that are bothersome and frustrating. The lack of strict typing of variables/objects and the mysterious reference errors that don’t present themselves until run-time are among the most common complaints about JavaScript. Luckily, TypeScript offers a solution, especially for React-based applications.

TypeScript alleviates these headaches for vanilla Javascript. When integrated with a JavaScript framework like React, web application development becomes much more consistent with a standard object-orientated language.

In this blog post, I will be giving you a high-level breakdown of what TypeScript is and how to use it with either a new or existing React application.

Storybook with React

Braden Niswonger Development Technologies, JavaScript, React, React Native Leave a Comment

In most React applications, there are many components working closely together to share and pass data between them. This can sometimes make it difficult to test components individually. Maybe you want to see how a component will react when given invalid data, or you want to test your component visually in different states. Storybook gives you a great way to do this in isolation, without worrying about the app-specific dependencies or requirements.

Storybook is an open-source tool for developing user interface components in isolation. In other words, it’s a playground for UI components. In this blog, we will dive into the basics of Storybook, write a Storybook for Material UI’s button component, and look at a couple of its add-ons.

A Look at Styled-Components

Nick Brown Development Technologies, JavaScript, React, React Native Leave a Comment

The React framework’s component-based approach makes managing large projects simpler. By making it easier to break functionality down into logical pieces that are encapsulated, the framework makes it easier for developers to manage. With that in mind, there have been a lot of choices when it comes to styling your React application. One approach is styled-components. This is a really …