What is the protocol for handling Long data with over 18 digits sent by backend developers? Who holds the responsibility, front-end or back-end?

It came to my attention that the data provided by our backend developer is in a Long format with over 18 digits. I raised concerns about how the last two digits might turn into 00 when converted to JS. I suggested receiving the data in String format or shortening the Long type, but he was hesitant.

He mentioned that there are various solutions available on the front end side like BigInt and other methods. This got me thinking, in a project's architecture, should resolving this issue fall upon the frontend developer or backend developer? What approach would be most effective?

Answer №1

In my opinion, pinpointing a single source as being responsible is not an easy task. The nuances in different languages and their unique data structures present challenges, such as JSON with web servers serving as a prime example.

I believe that finding the best solution is a shared responsibility between both parties involved. A crucial question to consider is: "Is it feasible for the number to have fewer digits?" If the answer is no due to precision or other factors, the onus falls on the front-end engineer. Conversely, it is up to the backend engineer to carefully determine what is truly essential before introducing a new problem for the frontend to tackle.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

At times, the loading image fails to appear on Ajax

Take a look at my code below: function apply_image_effect(){ $.ajax({ url: "image/image.php", global: false, type: "POST", data: ({my_color:encodeURIComponent($('#my_color').val()),my_size:$('#my_size&apos ...

Once the class is displayed in the DOM, click on the button to proceed

Within a popup window, there exists a form that utilizes Ajax to send data. Upon successful submission of the form, a message indicating success will appear below with the class name .form-message--success. My goal is for the close button within the window ...

Streamline the process of setting up a semantic UI dropdown with

Is there a way to automatically handle semantic UI dropdown in selenium with Java? The current code I have tried without success is: Select drpdwn1 = new Select(driver.findElement(By.cssSelector("#ddIssue"))); int sel1Size = drpdwn1.getOptions().size(); ...

What is the best way to manage horizontal scrolling using buttons?

I was hoping that when the button is clicked, the scroll would move in the direction of the click while holding down the button. Initially, it worked flawlessly, but suddenly it stopped functioning. export default function initCarousel() { const carous ...

Unexpected error when using Slack SDK's `client.conversations.open()` function: "User Not Found"

I am currently utilizing the Slack node SDK in an attempt to send private messages through a bot using user IDs: const client = new WebClient(process.env.SLACK_TOKEN); const sendMessage = async (userId) => { try { await client.conversations.open( ...

PHP Array Output: Understanding the Basics

I am relatively new to PHP and faced with a challenge. I have an array $companyStates = array("AR","TX","LA","OK","GA","NC","SC"); It contains a list of US states. My goal is to do two simple tasks with this array: 1) print the values in this format: ART ...

Is there a way to navigate to the home page using a PNG icon without refreshing the page when clicked on, while also utilizing NavLink with a route of '/'?

Here's the code I'm working with: <div key="1" className="menu-item"> <NavLink to="/"> <span className="icon-home3" />&nbsp; Home </NavLink> </div> The Home button functions ...

Using the URL parameter in a jQuery AJAX request

When I try to make an ajax call from a modal window, the request URL doesn't seem to be correct. My webserver is set up to accept URLs like http://localhost/search, but not file:///search. How can I fix this issue? I have posted more details about wh ...

Encountering issues while attempting to utilize pdf2json in a TypeScript environment

When attempting to import pdf2json (3.0.1) into my Node project using TypeScript, I encountered the following error: "Could not find a declaration file for module 'pdf2json'." I also tried installing @types/pdf2json for TypeScript but found tha ...

jQuery Validation Engine - Error messages within a div

I'm looking to enhance my form validation using jQuery Validation Engine. I'd like to improve accessibility by displaying the error message in a tag below the input field. <input type="text" ... > <p class="error">Error message</p ...

Challenges regarding the scope of Android development with Retrofit

Encountering a variable scope issue in Android while using Retrofit: In my MainActivity, I utilize Retrofit to fetch JSON response into a POJO (ApiResponse), create an extendedJourney Object, and add it to the extendedJourneyArrayList: public class MainA ...

Having trouble establishing a connection with the electron or CEF application through the selenium web driver

I have been attempting to automate the [electron-api-demos][1]app using the provided sample code. public static void main(String args[]) throws IOException, InterruptedException { int port = 9223;// Open App Runtime.getRuntime().exec( ...

Typescript tutorial: Implementing a 'lambda function call' for external method

The Issue Just recently diving into Typescript, I discovered that lambda functions are utilized to adjust the value of this. However, I find myself stuck on how to pass my view model's this into a function that calls another method that hasn't b ...

Using JavaScript and jQuery, apply a class when a specific radio button is checked and the data attribute meets certain criteria

Need help with changing explanation color based on correct answer selection in multiple choice question. Currently, all choices turn green instead of just the selected correct one. Any assistance is welcome, thank you. html <li class='test-questi ...

"Performing a row count retrieval after updating records in a Microsoft SQL Server database

Recently, I have been utilizing the MSSQL NodeJS package (https://npmjs.org/package/mssql#cfg-node-tds) in order to establish a connection with a MS SQL database and execute UPDATE queries. One thing that has caught my attention is that when an UPDATE que ...

Combining Angular 2 RC with Play Framework 2 for seamless integration

I am seeking to combine angular2 rc and play framework 2. Take a look at this example using the beta version https://github.com/joost-de-vries/play-angular2-typescript. One challenge is that rc has different naming conventions and each angular module is ...

Tips for avoiding storing duplicate data in local storage?

I have encountered a challenge in my code where I am trying to alert the user when they attempt to save data that is already stored in local storage. Essentially, when the user clicks on a save button to add data to favorites (local storage), I want a mess ...

Create compelling visual representations by utilizing Google charts to draw customized charts based on variable

I have been attempting to create a chart using Google Charts by passing some parameters to the function. I am trying to use these parameters to populate the data, but it doesn't seem to be working as expected. Is it possible to include parameters in t ...

Changing the CSS property from "display: none" to "display: block" using JavaScript causes all the div elements to overlap

My issue involves several radio inputs where clicking one should reveal a hidden div containing information. However, when this div appears, it overlaps with the footer instead of staying positioned between the footer and radio input as intended. I am str ...

Automatically sorting data in JavaScript from PHP-generated JSON

When I receive JSON data from PHP and use it in JavaScript to populate a select box, the order is automatically sorted. This behavior should not occur. I am utilizing this JSON as the value for HTML select box options and I require the data to be in its o ...