DEV Community

loading...

Some basic concepts for web developers

Sayem Mohammad Ismail
Full-stack web developer
・3 min read

Websites are a crucial part of this modern digital world. The developers who develop the websites need to have the knowledge of up to date
Tools and technologies. Because, programming languages, tools, frameworks etc. always get modified, updated and replaced with a better one.
Here I present some basic concepts to know in the first place:

JavaScript

Expressions:

In the JavaScript programming language expressions are like questions asked that will be answered by JavaScript. For example,
“ 10+100 ” is an expression and the answer is a value ‘110’. And JavaScript only answers with values.

Values:

JavaScript has 9 different types of values. 7 of them are Primitive Values and the rest two are Object and Function.
An Object is a collection of data, often denoted inside curly braces {}, while a function is a set of commands that does a particular work upon call. A function usually takes a name for it to be referred with and holds its set of commands within curly braces and takes its arguments, if any, in parenthesis, such as

function sum (x, y) {
    const result = x + y;
    return result;
}
Enter fullscreen mode Exit fullscreen mode
Primitive Values:

Primitive values are such values that cannot not be manipulated from the code. Though currently there are 7 of them, we are talking only about the most commonly used 5 of the primitive values. They are as such,
Undefined - (undefined) used for for unintentionally missing values
Null - (null) used for intentionally missing values
Booleans - (true and false) used for logical operations
Numbers - (1,2,3, negative numbers and all other numbers) used for mathematical calculations
Strings - (‘lorem ipsum’ etc.) used for texts

Errors :

Errors are the worst nightmare for programmers. However, JavaScript offers a mechanism, syntax construct “try...catch” that helps in
handling errors. If there is an error the script then dies(stops running immediately), but ‘try...catch’ lets to catch the error and make the
script do something meaningful instead of dying.
Here, ‘err’ is the error object.

try {
    // code here
} catch (err) {
// handle error
}
Enter fullscreen mode Exit fullscreen mode
Error Object:

The error object contains the error name and the error message. We can name the error object with any other word than ‘err’.

The error name is the name of the error that happened, such as, for an undefined variable the name of the error is “ReferenceError”.
Meanwhile, the error message is the text that contains the detailed information about the error.

Try {
    lorrem ipsum;  // making an error 
} catch (err) {
    alert (err.name); // ReferenceError
    alert (err.message); //lorem ipsum is not defined
}
Enter fullscreen mode Exit fullscreen mode

Caching Concepts

Caching:

API communication is like a negotiation between the client and the server, where caching is an aspect.
Caching is a concept of efficiency of data availability. It refers to a mechanism for storing some data, commonly accessed by users, in many places and serving them to users from the common data store.

Data cost:

Data cost is simply the idea that every operation, every function that we do with an API produces some sort of cost, which arises from several factors and systems, originating from both the client and server side. At the end, every bit of data has a cost associated with its generation, storage and transfer. This cost is called the data cost.
The data cost isn’t always controllable and to reduce it caching is helpful.

Client caching:

Client caching refers to storing some commonly asked/requested data in the client/application side. This mechanism helps reduce the data cost and boost up efficiency. For example, an application can have its username and user id for an user cached in, so that every time it might not require asking the server for the username and user id.

Server caching:

Server caching refers to responding to multiple user requests using the same data or parts of the same requests made by other users. This mechanism helps reduce server side data cost.

Cross browser testing

Cross browser testing:

A web developer needs to make it sure that the application works on nearly all web browsers and it is done with cross browser testing.
Cross browser issues commonly occur because, sometimes the browser may have bugs or implement features differently, it may have different levels of support for technology features or even due to some device constraints.
Workflows for cross browser testing is as such,
Initial planning > Development > Test > Fix / iterate

Sources: types of values, try-catch, balancing caching, cross browser testing

Discussion (0)