The Importance of Helper Functions

  1. Readability- Chances are that as software engineers, we will be apart of a team working on task or project. Other team members should be able to go through our code and understand it in a reasonable fashion. The more unnecessary code we have the harder it will be to understand to other developers.
  2. Debugging- The more code that you have in an application usually means more chances to have typos and bugs. It’s much easier to comb over 50 lines of code and avoid mistakes than with 100 lines.
  3. Updatability- Suppose that we want to make a change to a specific function. If our functions is invoked X amount of times in our application, then we’ll have to manually find every part of the program where it’s utilized. Instead it is much easier to just update the function once where it’s defined.
fetch(url)  .then(res => res.json())  .then((filmArr) => {    filmArr.forEach(movieObj => {      movieTitle.innerText = movieobj.title      movieDescrip.innerText = movieobj.description      moviePoster.src = movieobj.poster      movieRuntime.innerText = movieobj.runtime      movieShowTime.innerText = movieobj.showtime      movieTickRem.innerText = movieobj.capacity-  movieobj.tickets_sold   })})
let updateMovie = (movie) => {  movieTitle.innerText = movie.title  movieDescrip.innerText = movie.description  moviePoster.src = movie.poster  movieRuntime.innerText = movie.runtime  movieShowTime.innerText = movie.showtime  movieTickRem.innerText = movie.capacity — movie.tickets_sold}
fetch(url)
.then(res => res.json())
.then((filmArr) => {
filmArr.forEach(movieObj => {
updateMovie(movieObj)
})
})

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Geogebra 4 Engineer

What is the Scalability in the distributed system?

Using the Girvan-Newman Algorithm To Recommend Movies

Bionitio | Software engineering template

Skaffold to GKE Deployment

Skaffold to GCR to GKE

Box brings its Notes app to Mac Windows updates web experience

How to get Purchase Order version specific tax amount using X++ in Dynamics 365 Finance & Operation

Learning AMP: Adding WooCommerce Cart Button — AMPire.city

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joshuadelapenha

Joshuadelapenha

More from Medium

Why war represents the worst way to solve a conflict in 2022?

Ghana: The evolution and challenges of women in peace and security

COLORFUL EASTER EGGS vs. CLUSTER MUNITION IN UKRAINE

What is Discounted Cash Flow (DCF) Financial Modeling?