Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Tuesday, February 1, 2022

All About Power Apps Component Framework

 

All About Power Apps Component Framework

All About Power Apps Component Framework

These days, Power Apps Component Frameworks are in trend because of various reasons. It has replaced the traditional HTML web resources in development practices worldwide. Also, it has enabled the programmers to reuse and configure UI components. If you haven’t heard about Power Apps Component Framework, then this blog is for you. Here we will discuss all the details of PCF(Power Apps Component Framework) and we need it in development practices. Let’s get started.

What Is Power Apps Component Framework?

Power Apps Component Framework

It is powered by Microsoft, allowing programmers to develop code components that can offer great user experience while working on  data on forms, views, and dashboards. Microsoft used this framework some time and developed components like editable grids and others before making it public.

With PCF, programmers can create code components while working on model-driven and canvas apps. For instance, if a developer want to add some extra features and functionalities to app, then he can develop widgets and configure them with app with the help of system customizer or an app maker. 

With PCF, one can transform many things to look visually attractive with great features. One of the main benefit of it is, this framework allow programmers to develop reusable components by using libraries and other features. Then these components can be easily added in canvas or model-driven apps.

Regardless of this, programmers can use various microsoft features and functionalities to develop components like component creation, built-in variation, code editing, debugging and so on. One can add many features to ease advanced interactions. 

Need Of Power Apps Component Framework-

One of the main reason to usePower apps Component Framework is to address all limitations with HTML web resources. You know that HTML web resources were not flexible and portable, for instance, HTML web resources didn’t allows programmers to package components with different parameters. Whereas, this is not the case with PCF. One can easily abstract a component and use it as a reusable component with PCF. 

Let’s have a look at the example- you want to add a weather forecast feature for different zip codes from record. While using HTML web resources, you need to store forecast information in configuration entity. Also you have to use a method named as window.parent to fetch the crm context to read the zip code. It’s not as complicated with PCF. 

PCF allows programmers to use control configuration form to get the forecast API information and fetch zipcode data from the context object of framework. PCF is more fast, convenient, user-friendly and accessible than HTML web resources.  

Features Of Power Apps Component Framework 

1. PopupService in PCF- 

Generally creating and managing popups and dialog boxes in PCF control is carried out using external UI libraries such as Fluent UI. But with PopupService, a native PCF option and managing popups become so easier. Create and manage popups for your model-driven and canvas apps with methods such as- createPopup, closePopup, deletePopup, openPopup, updatePopup, getPopupsld and setPopupsld.

2. Create Multiselect Option Using PCF Control-

With the updates in PCF, now one can develop PCF control for multi select optionset field. It is possible because of the  MultiSelectOptionSet type property. 

3. Can work with different languages within Dynamics 365 CRM using PCF Control-

When you work with clients from different geo locations all over the globe, it is necessary to deal with native languages. PCF control have the feature to run in multiple languages. Every language has its own way of script writing, some are written in left-to-right direction and some are in right-to-left direction. To deal with the situation where language of user interface is set to language that is set from right to left direction, usersettings API of power apps can be used. PCF recently released Multiselect Lookup Control in Dynamics 365 CRM.

Who Can Use Power Apps Component Framework?

There are two kinds of developers. Beginners and professionals. PCF is best for professional developers who are well experienced in HTML web resources and have knowledge of web development life cycle and components like NPM, Typescript and so on.  

Now, professional programmers can use this framework to develop code components and beginners will use these code components to develop canvas apps. Those components are called custom controls.

Difference Between HTML Resources And Code Components-

1. License Requirement-

To decide the licensing scheme, you need to understand the interaction of code component with the external service. There are two types of license-

  • You require a power apps license if a code component is used by an app that connects with an external service. Then it will become premium. 
  • You need Office 365 license, if the code component within app doesn’t connect with external service.

2. Accessibility-

Tuesday, January 25, 2022

Remix Vs Next.js – Which One To Choose?

 

Remix Vs Next.js – Which One To Choose?

Remix vs Next.js

There are lots of frameworks built on top of React. Some of them are Next.js, Remix, Gatsby, Redwood, Blitz etc. Next.js has gained a lot of popularity because of the performance, developer experience and tight integration with deployment platforms that it offers. However recently, Remix has been heavily discussed and compared to Next.js as an alternative. Lots of programmers are using Next.js as a potential tool to build apps. Remix is being presented as another option, but developers need to know the comparison and why they would want to pick one over other. Hence here we came with a comparison of Remix vs Next.js. Let’s compare Remix and Next.js on the basis of various parameters. 

Remix Vs Next.js-

1. Web Standard APIs Vs Node.js APIs-

Remix is built on top of standard Web APIs, whereas Next.js is built on Node APIs. With Remix you won’t have to learn as many extra abstractions over the web platform. You just need to learn useful concepts no matter what tool you decide to use later. Also, APIs, the core of Remix doesn’t rely on Node dependencies. As Remix doesn’t depend on Node, it is more portable to non-Node environments like Cloudflare Workers and Deno Deploy.

This will let you to run Remix on the edge easily. Running on the edge means server hosting your apps are distributed around world rather than being centralized in a single physical location. Whenever a user visits website, they are routed to the data center closest to them for fast response times. 

2. The Router-

Route is one of the most important parts of application because we are building a web application. In Next.js, they have their own router using the file system, hence you can create a pages folder and put files there,

pages/
  index.js
  about.js
  Contact.js

These files are going to becomes pages inside the application, with below URLs.

- / (this is index)
- /about
- /contact

They also have useRouter hook to access data from router like search (query) params or methods such as reload or push to navigate to another URL.

In Remix, they use React Router v6 internally but they provide a file system based system, rather than pages Remix call them routes, but the general is similar.

routes/
  index.js
  about.js
  Contact.js

Those files are going to become routes with same URLs as in Next. Main difference comes with the introduction of Layout Routes.

3. Layout Routes-

Most common requirement of user interfaces is to re-use a layout between two URLs, a common example is to keep header and footer on every page, however this can become more complicated. Amazing example of this is Discord, let’s analyze-

You can see four main areas-

  • Left column with list of servers
  • Next column with list of channels
  • Widest column with list of messages
  • Right column with list of users of server
  • It’s not image but not you can have list of messages for thread replacing users

Whenever you want to build this UI in Next.js, you need to create a file at pages/[serverId]/[channelId].tsx, get the data os each list and render a component like- 

function Screen() {
  return (
    <Layout>
      <Servers />
      <Channels />
      <Messages />
      <Users />
    </Layout>
  )
}

When the user navigate to another server or channel, according to the data loading strategy you used, you may need to get load everything again with the new channel or server. This is because Next doesn’t have support for layout routes, hence each page renders everything on the screens, including shared layouts between screens. 

As opposed to Next.js, Remix has support for that, so in Remix we would make a file structure like this:

routes/
  __layout.tsx
  __layout/
    $serverId.tsx
    $serverId/
      index.tsx
      $channelId.tsx
      $channelId/
        index.tsx
        $thread.tsx

While you have more documents, this will assist you with keeping the code more coordinated and to make stacking information more improved.

Know more


Monday, January 24, 2022

How To Secure Angular Apps?

 

How to secure angular apps

We all know that, AngularJS is an open-source front-end javascript framework and it provides convenient data binding options on client-side and. It allows developers to decouple HTML templates, leading to smoother development. AngularJS has some security features such as automatic output encoding, supports strict contextual escaping and has in-built content security policy but still it has its own issues that should be taken care of. Generally angularjs uses inline styles that can be easily bypassed by hackers through custom injected content. If you’re going to use AngularJS for your next project, then you must know how to secure angular apps. Here we’ll discuss about 10 best practices to secure angularjs app. Let’s see each one in detail.

10 Tips To Secure AngularJS App-

Angular logo

1. Prevent Apps From Cross-site scripting(XSS)-

XSS allows hackers to add client-side script or malicious code into web pages that can be viewed by users. Mostly such attacks happened through query string, input field, request headers. To prevent XSS attack, we must present a user to enter malicious code from DOM. For instance, attacker can enter some script tag to input field and that might render as read-only text. When values are inserted into DOM through attribute, interpolation, properties etc. by default, Angular considers all values as untrusted. It escapes and sanitizes values before render. XSS related security in Angular defined in “BrowserModule”. DomSanitizer helps to clean untrusted parts of value. DomSanitizer class looks like-

export declare abstract class DomSanitizer implements Sanitizer {
 abstract sanitize(context: SecurityContext, value: SafeValue | string | null): string | null;
 abstract bypassSecurityTrustHtml(value: string): SafeHtml;
 abstract bypassSecurityTrustStyle(value: string): SafeStyle;
 abstract bypassSecurityTrustScript(value: string): SafeScript;
 abstract bypassSecurityTrustUrl(value: string): SafeUrl;
 abstract bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl;
}

There are two types of method patterns: sanitize and bypassSecurityTrustX (bypassSecurityTrustHtml, bypassSecurityTrustStyle, etc.). Sanitize method gets untrusted value from context and returns trusted value.

The bypassSecurityTrustX methods gets untrusted values from context and as per the value usage it returns a trusted value. In a particular condition, you may need to disable sanitization. After setting any one bypassSecurityTrustX methods, you can bypass security and binding the value.

Example

import {BrowserModule, DomSanitizer} from '@angular/platform-browser'

@Component({
 selector: test-Component',
 template: `
 <div [innerHtml]="myHtml"></div>
 `,
})
export class App {
public myHtml: string;
 constructor(private sanitizer: DomSanitizer) {
 this. myHtml = sanitizer.bypassSecurityTrustHtml('<h1>Example: Dom Sanitizer: Trusted HTML </h1>') ;
 }
}

Always be careful whenever you trun-off or bypass any security setting that might malicious code and we might inject a security vulnerability to the app. Sanitization inspect untrusted values and convert it to a value which is safe to insert into DOM tree. It doesn’t change value at all time and angular allows untrusted values for HTML, Styles and URLs. Here are some of the security contexts defined by Angular-

  • It makes use of HTML context when interrupting value as HTML
  • Uses Style context when any CSS bind into a style property
  • When bind URL, it uses URL context

Also know- Top 10 Concepts To Know For Angular Developer

2. Use Security Blinters-

Programmers can take an advantage of security linters to perform basic static code analysis and provide red flags for errors, bugs or security vulnerabilities. In AngularJS, we are talking about ‘eslint-plugin-scanjs-rules’a nd ‘eslint-plugin-angular’ that helps in general coding conventions, rules and guidelines about security.

Know more


Friday, January 14, 2022

Vite JS – All You Need To Know

If you are looking to improve your experience in frontend development, Vite JS is for you. It is the next generation of frontend tooling. Vite JS consist of a dev server that bundles your code for production. It allows programmers to set up a development environment for frameworks such as Vue and React and even for Vanilla Javascript app with dev server. Apart from this, it allows the development team to hot reload in just three commands. 

Vite offers a fast and opinionated build tool with highly customizable API using plugins. Also it supports many popular front-end libraries such as Preact, Vue JS, React and Vanilla Javascript through templates. Let’s see details of Vite JS.

What Is Vite JS?

Vite logo

Vite is a build tool that aims to provide faster and leaner development experience for web projects. It achieves this in two parts- First, in development, app code is not bundled, instead code is imported into browser using ES Modules, the native module system for Javascript. As ESM is supported in all modern browsers, Vite can take an advantage of this to completely remove a build step while in development. Libraries that need to be imported are still compiled, but for this Vite makes use of esbuilt tool written in Go. Esbuilt pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.

Second, Vite provides a build step using Rollup that has been highly optimized for generating static assets. Taking advantage of Rollup, Vite also provides a diverse plugin ecosystem. Standard Rollup plugins can be used with Vite, and custom Vie-specific plugins. Vite plugins extends Rollup’s well-designed plugin interface with some extra vite-specific options. Thus, you can write a Vite plugin once and have it work for both dev and build.

Latest version of Vite.js offers lots of new features. Released on 16th February 2021, Vite 2.0 offers completely redesigned architecture, first-class CSS support, a new plugin system and so on.

How Does Vite JS Work?

Browser support for ES6 modules was poor when ES modules were originally introduced in ES2016. Thus, lots of current browsers now support ES modules natively, and allows you to use import and export statements natively. You can include imports in HTML by specifying that you’re importing a module using type+”module” attribute in script tag: 

<script type="module" src="filename.js"> </script>

According to the documentation of Vite JS, ES import syntax is served directly to browser in source code. <script module> native supported browser parses them automatically, making HTTP requests for every import. Dev server receives HTTP requests from browser and executes any necessary code changes. This improves the speed and makes Vite server very rapid.

Performance-

Vite dev server starts instantly, and with the Hot Module replacement, eahc code is reflected in browser quickly, sometimes instantly.

vite v2.1.3 dev server running at:
> Network: http://192.168.1.90.3000/
> Local: http://localhost:3000/

ready in 467ms.

Features Of Vite JS 2.0-

1. Great CSS Support-

Vite 2.0 offers features such as CSS splitting, URL re-bashing and so on. These features are supported without configuration. Resolver of Vite improves @import and url() paths in CSS by respecting aliases and npm dependencies.

2. Faster Builds-

Latest version Vite 2.0 offers faster build time with ESbuild. ESBuild is a bundler written in Go. It is 10-100 times faster than bundler. Vite 2.0 takes an advantage of ESbuild to convert CommonJS modules to ESM for dependencies. According to the official document, Vite 2.0 uses ESBuild rather than Rollup. It improves the performance in build time. 

At the moment, ESBuild is used for pre bundling dependencies.

3. New Plugin System-

Vite improves the developer’s performance by identifying build type and accessing configs and dev server configurations. It is compatible with lots of Rollup.js plugins. New plugin system makes use of unique Hot Module Reload handling and offers API to add middleware to dev server. Plugin server is WMR based system. New system adds Vite-specific functionality to the Rollup plugin system. 

4. Framework-agnostic-

Vite 2.0 has high-quality boilerplate for various frameworks like Vue.js, Preact, React and so on. It offers a vanilla Javascript boilerplate. Other boilerplates also support Typescript. Vite offers a consistent tooling experience across frameworks because of its framework-agnostic nature.

5. Support For SSR-

Vite supports SSR for React.js and Vue 3. It provides APIs and constructs for loading and updating ESM-based source code effectively. It externalizes CommonJS-compatible dependencies. Vite SSR is an extremely low-level functionality, and the team aims to offer tooling for a more higher-level feature in coming days. In production build, SSR can be decoupled from Vite. With same setup, it can support pre-rendering.

Advantages Of Vite js-

1. Bare Module Resolving-

Yet, browser don’t support bare module imports where you can import from a package name like import { createApp } from ‘vue’, because it’s not a relative path to our node_modules. Vite searches for bare import specifiers in your Javascript files. Once it finds them, it rewrites them and uses module resolution to locate relevant files from your project dependencies.It resolves them as legitimate module specifiers.

2. Hot Module Replacement-

It is an amazing feature in Javascript bundlers that changes source code in browser without refreshing the browser. Using Vite js tool, there’s no need to reload the browser to update content, as each change is reflected in browser with immediate effect. Hot module replacement is decoupled from all modules. This makes your project faster, regardless of app size.

3. Configuration-

If you want complete control of your project, you can extend the default configuration with vite.config.js or vite.config.ts file in existing project or directory from base root directory.

Also you can mention config file through vite -config my-config.js. You can add support for custom file transforms by adding Rollup plugin to build and Koa middleware in configuration file. 

4. On Demand Compilation-

We know that, browsers send source files to compile and only required or modified code is compiled on screen. In Vite, without modified files return a 304 error code. Unlike other existing bundlers, they compile every located file in project and bundle them before making any changes. Hence Vite is great for large-size projects.

Some Other Features-

  • Offers support for mode options and environment variables
  • Support for TypeScript, using ESBuild for transpilation
  • Asset URL handling
  • Vite supports .tsx and .jsx files ESBuild for transpilation

Why Use Vite?-

1. Server Side Rendering-

Vite.js for SSR is not included or available as a template. Official document includes all the details of how to use it. It’s important to note that it is labeled as experimental. This capability is provided through a plugin.   

2. Static Site Generator-


Monday, January 10, 2022

React.js Vulnerabilities And It’s Solutions That You Should Not Ignore

 

React.js Vulnerabilities And It’s Solutions That You Should Not Ignore

React,js vulnerabilities and it's solution

At a first glance, cybersecurity appears to be intangible. App’s unique features, attractive user interface and smooth performance will be of no use unless it is safe. It is applicable to apps based on React.js too. Most of the businesses are facing issues regarding app security. If you’re also one of them, then you are at the right place. Here we came with some react.js security vulnerabilities and how to fix them? Before digging into it, let’s see some common react.js cyberattacks.

Most Common React.js Cyberattacks-

React.js logo

Each time when React.js is updated, new security flaws emerge that go undiscovered. Hence it is difficult to cover all the possible cyberattacks that React.js may be vulnerable to. Let’s have a look at most common react.js cyberattacks-

  • Distributed Denial of Service (DDoS)-

DDoS attacks overwhelm a web app infrastructure with more traffic than it is able to handle. Their main purpose is to make an application inaccessible and unavailable to its users. Some common ways to conduct DDoS attacks are UDP, ICMP, SYN and HTTP request flooding. As an attacker tries to exhaust resources, like memory and CPU processing time, a server and firewall must process every request and respond to it.

  • Cross-Site Scripting (XSS)-

Adding malicious scripts into the code of a web app is called XSS. This script gets selected by the browser and interpreted as valid, and then malicious code run as a part of app. XSS attack might allow the attacker to steal user passwords, collect sensitive data from app’s pages, make requests to servers and so on. 

  • XML External Entity Attack (XXE)-

This kind of attack occur in online apps that employ XML(Extensible Markup Language). Text based language used in web apps to store and organize data. XML parser needs to convert XML into understandable code and XXE injections generally target such parsers. Using XXE, a perpetrator can perform a CSRF or DDoS attack.  Here the problem is that XML parsers are vulnerable to XXE by default, hence it’s upto your development team to ensure that the code is free from such vulnerabilities.

  • Cross-Site Request Forgery (CSRF)-

To commit CSRF attack, a perpetrator crafts an email or web page that will convince a victim to perform a state-changing request on web app. It can be granting permissions. Generally an attacker exploits links or invisible images to conduct a GET request or a form for PUT or POST request. Javascript code provides a way to craft that requests, but it will be prevented by any modern browser unless it’s allowed on the web app server.

React.js Security Vulnerabilities And It’s Solutions-

Here are some of the most common react.js vulnerabilities- Server side rendering, Dangerous URL schemes, Broken authentication, SQL Injections, DangerouslySetInnerHTML, Escape hatches. Let’s see each one in detail.

1. Server Side Rendering-

Main advantage of React is SSR(server side rendering). This features ensures a faster page load, better performance and ease of incorporating SEO. But it makes react apps prone to attacks. But why? Lots of React apps use Redux for app state management, that uses JSON, lightweight data-interchange format, to set initial app state:

<script>
 //WARNING: See the following for security issues around embedding JSON in HTML:
// https://redux.js.org/recipes/server-rendering/#security-considerations window._PRELOADED_STATE__= ${JSON.stringify(preloadedState).replace(/</g, ‘\\u003c’
)}
</script>

This is harmful because “JSON. stringify” will not recognize sensitive data or XSS code. Though the above example has code to mitigate simple XSS attacks, it’s not silver bullet by any means. Also, it’s worth mentioning that SSR opens a way for hackers to exploit vulnerabilities in third-party NPM packages. 

A solution to this is-

  • Use Regular-Expressions
  • Use serialize-javascript package

2. Harmful URL Schemes-

When hackers add harmful code starting with Javascript to URLs, links to other pages become harmful. Whenever a user clicks on a link, script in the browser is activated. React.js app security doesn’t restrict use of URLs that don’t start with “HTTP:” or “HTTPS:” and it lacks capabilities to protect against possible attacks.

Solution to this is-

  • Avoid the use of URLs as input. Create an application that takes YouTube video ISs instead of YouTube video URLs.
  • If the above option is not available, use trusted third-party tools like Sanitize URL NPM package to sanitize these harmful links. Ensure that everyone from the development team is using the same sanitization code.

3. Escape Hatches-

Main advantage of React is, it saves developers time from manually putting data into the browser DOM to render components. But there are some of the cases where programmers require direct access to the DOM elements.

For such cases, react offers escape hatches, like “findDOMNode” and “createRef”. App can manipulate element directly without going through React, because an escape hatch returns the native DOM elements with their full API. It leads to an XSS vulnerability. 

Solution to this is-

  • When direct output is required, use proper DOM APIs to generate HTML nodes.
  • Don’t output the HTML code, only text
  • Sanitize data with DOMPurify before putting it into page

Wednesday, January 5, 2022

Challenges In Cross Platform App Development And It’s Solutions

Challenges In Cross Platform App Development And It's Solutions

Cross-platform apps development gained a huge popularity as it allows to develop apps that can run on various platforms. These apps uses reusable code that can be used across platforms to produce the same features. Hence it saves time and money for developers. But Cross-platform development can result in slew of performance and usability issues. Apart from these, there are some more challenges while developing best cross platform app. Let’s see these challenges and their solutions. But before digging into it, let’s see what is cross platform app development.

What Is Cross Platform App Development?

Cross Platform App Development
Cross Platform App Development

Term “cross-platform application development” or “multi platform app development”  is self-evident. It allows programmers to create mobile solution that is compatible with multiple operating systems and platforms simultaneously(Android, iOS, Windows).

Main reason of why developers are switching from native to cross-platform development is the faster development time. There are lots of cross-platform app development frameworks available to meet the user’s requirements.

Challenges In Cross Platform App Development –

Although cross-platform apps development offers many appealing features, there are some challenges in cross platform app development. Here are some of those.

1. Poor UI/UX-

This may seem surprising, but most cross-platform apps fail due to unnecessary features and difficult to navigate designs. Native apps are all about animation features, 3D effects and beautiful blend of graphics enhanced by hardware features. But most cross-platform apps cannot take advantage of all functionality that mobile devices provided, which results in poor user experience. 

Every device has its unique characteristics, that makes it difficult to provide same functionality with single universal code. As a result, programmers must simplify features to ensure that screen layouts and images are consistent across all devices. 

2. Switching The Platform-

Most of the cross-platform frameworks use their Javascript subject and this create issues when you use reusable codes. Thus, finding the issue amongst the whale coding becomes a hectic task that increases time and cost required for mobile app development. 

3. Delayed Access To Latest Features-

One who choose to design a cross-platform mobile app will tuned to the framework they choose. Issue with them is they have a delay in updating. Apple provides new capabilities to iOS and Google adds new features to Android, frameworks must adapt their development tools to integrate new functionality. It needs some time. The integration process with local settings becomes lengthy with this platform. The integration process with local settings becomes quite lengthy with this platform.  

4. Limited Updates-

Sometimes, operating system does not support all features that the framework uses. For example, when iOS platform introduces new update or adds new element, you need to update iOS version of app accordingly, but you can’t do the same with Android until google releases the same update. 

5. Poor Customizations And Navigation Integration-

Development frameworks couldn’t  support every features that you need, including some options connected with hardware functionality, integration with device local settings and inbuilt storage access. Lack of features support may result in blocking the app operation. 

6. Loss Of Code-

Using a framework for cross platform development is a cost-effective option.  Platform ties you into your project just like a site builder allows you to create pages but don’t allow you to reuse them on other sites. Always think before you select the framework. If in case you want to switch to another framework, all your efforts can be lost. 

7. Limited Tool Support-

Go with cross-platform app development only if you are sure about the features that you want to include in your project and confident about the framework that it will handle all. There might not be enough tools for app customization. According to the techies, the greatest programming languages for cross-development are Java, javascript and ruby on rails. Though they aren’t ideal. Then what are your options to deal with this? Hiring experienced cross platform developers will be a great idea. 

Solutions-

1. Platform-

You must select whether your software will be available on a single or several operating systems. If you want to grab a broader audience, cross platform is a way to go. Whereas, if you want to reach ios and android customers, creating a great user experience with native solutions would be your top priority.

2. Native Feel-

You must consider how native your mobile app to feel to the user. App designing with material design or human interface guidelines makes digital products very attractive and user friendly. Whereas you can achieve this by using some popular cross-platform frameworks.

3. Flexibility-

Obviously, flexibility is important in any app development. It allows you to go from one framework to another. Just ensure that the structure you’re working with is adaptable. 

4. Complexity-

It refers to the extent to which you want to take the product. To deal with this issue, determine whether you want to use an MVP to test idea or whether you’re ready to go with a full-fledged app. 

5. Costing-

While choosing cross platform development, you should consider both sides of the issue. It is feasible. It’ll initially cost you less and you can develop it at lower cost. But due to maintenance and upgraded features the price will rise. Multiplatform mobile app development will be useful for small projects.

6. Maintenance-

Know more 

Monday, January 3, 2022

Most Common Mistakes To Avoid In Node.js Development

Most Common Mistakes To Avoid In Node.js Development

Node.js has given cutting-edge web applications with two way, real-time connections where both server and client could communicate with each other. Regardless of how difficult Node.js makes writing safe code, and how easy it makes writing highly concurrent code, the platform has been around for quite a while and has been used to build number of robust and sophisticated web services. These web services scale well and have proven their stability through their stability through their endurance of time on the internet.

But just like any other platform, Node.js is vulnerable to developer issues. Some of these mistake lowers the performance, while others make Node.js appear straight out unusable for what you are trying to achieve. Here we’ll discuss most common mistakes that Node.js developers make, and how it can be avoided.

Know the features of latest version Node.js 17 at- What’s New In Node.js 17?

Most Common Mistakes To Avoid In Node.js Development-

Node.js logo

1. Event Loop Blocking-

Being a single-threaded environment, no two parts of apps can run in parallel. Simply, since Node.js runs on single-thread, anything that blocks event look, blocks everything. Concurrency is achieved by handling input-output operations asynchronously. For instance, What allows Node.js to focus on other parts of app is a request to database engine, from Node.js to fetch some documents. 

// Trying to fetch an user object from the database. Node.js is free to run other parts of the code from the moment this function is invoked..
db.User.get(userId, function(err, user) {
	// .. until the moment the user object has been retrieved here
})

But a part of CPU-bound code in Node.js instance with thousands of clients connected is all it takes to block the event loop, that makes all the clients wait. CPU- bound codes include attempting to sort a large array, running a long loop, and so on. For instance:

function sortUsersByAge(users) {
	users.sort(function(a, b) {
		return a.age < b.age ? -1 : 1
	})
}

Calling this “SortUsersByAge” function may be fine if run on a small “users” array, but with a large array, it will have a horrible impact on performance. If this must be done and you’re certain that there will be nothing waiting on the event loop(for instance, if this was part of command line tool that you’re building with Node.js and it wouldn’t matter if entire thing ran synchronously), then this may not be an issue.

But in Node.js server instance trying to serve thousands of users simultaneously, such a pattern can prove fatal. 

If users array was retrieved from the database, the best solution will be- to fetch it already sorted directly from the database. If event loop blocked by loop written to compute the financial transaction data, it could be deferred to some external worker/queue setup to avoid hogging the event loop.

There’s no perfect solution for this type of Node.js problem, instead every case needs to be addressed individually. Main idea is to not do CPU intensive work within front-facing Node.js instances- the ones client connect to concurrently. 

2. Deeply Nesting Callbacks-

Generally, nested callbacks referred to as “callback hell”, is not a Node.js issue in itself. But this can cause problems making code quickly spin out of control:

function handleLogin(..., done) {
	db.User.get(..., function(..., user) {
		if(!user) {
			return done(null, ‘failed to log in’)
		}
		utils.verifyPassword(..., function(..., okay) {
			if(okay) {
				return done(null, ‘failed to log in’)
			}
			session.login(..., function() {
				done(null, ‘logged in’)
			})
		})
	})
}

In this way, by nesting callbacks, you can easily end up with error-prone, hard to read and also maintain code.

One solution is to declare these task as small functions and then link them. Though the clean solution is to use utility Node.js package that manages asynchronous Javascript patterns like Aync.js:

function handleLogin(done) {
	async.waterfall([
		function(done) {
			db.User.get(..., done)
		},
		function(user, done) {
			if(!user) {
			return done(null, ‘failed to log in’)
			}
			utils.verifyPassword(..., function(..., okay) {
				done(null, user, okay)
			})
		},
		function(user, okay, done) {
			if(okay) {
				return done(null, ‘failed to log in’)
			}
			session.login(..., function() {
				done(null, ‘logged in’)
			})
		}
	], function() {
		// ...
	})
}

Just like “async.waterfall”, there are lost of functions that Async.js provides manage with different asynchronous patterns. 

3. Invoking Callbacks, Multiple Times-

Javascript is popular because of relying on callbacks. Callbacks were the only way asynchronous elements of your code communicated with each other in Node.js until promises came into picture. Still package developers  design their APIs around callbacks and hence callbacks are in use. Mistake that developers make while using callbacks is calling them multiple times.

Saturday, December 18, 2021

Software Outsourcing Trends To Follow In 2022

 

Software Outsourcing Trends To Follow In 2022

Software Outsourcing Trends To Follow In 2022

Outsourcing is a hot trend in software development, however its adoption needs organizations to rethink about their business processes and introduce technological innovations to remain agile. To keep you on track with the IT outsourcing market, we’ve collected some trends for 2022. Let’s see which are those.

Software Outsourcing Trends To Follow In 2022

1. Digital Enablers–

Since the pandemic, it has been noticed that we’re moving in the direction of digitization very rapidly. All this started as a forced work-from-home, new strategy of hiring, communicating and collaborating without borders. At the same time, remote work standards contribute to the development of new ways of solving business challenges. 

What are digital enablers and why do they matter for businesses in 2022?

In general, Digital enablers are tools and technologies that help to achieve process standardization and automation. Some of its examples are- Agile working processes, enterprise resource planning(ERP) system, Project management software, Team communication channels and platforms. 

These digital enablers contributes to enterprises hugely switching to cloud based solutions and robotic process automation (RPA). Gartner describes “distributed enterprise” as one of the strategic technology trends for 2022. 

As per Gartner, involving geographically dispersed employees will help organizations to achieve revenue growth 25% faster than competitors by 2023. Means so as to remain competitive and deliver seamless work experience, organizations in sectors from retail to education will require to reconfigure delivery models to embrace distributed services. 

Development team augmentation is a way to ramp up a software development with tech experts regardless of their location. Hiring an external team, you delegate the responsibility for hiring and HR matters to a third-party service provider who offers full-time staff. Simply, all necessary processes such as recruiting, onboarding, training and managing dedicated experts lie on outstaffing vendor’s shoulders, while as a product executive you can focus on business goals.

2. Rise Of Cloud Computing-

Cloud native platforms is another trend that will serve as a foundation for more than 95% of new digital initiatives by 2025. CNP has an architecture aimed at leveraging the automated cloud services by adding just some cloud attributes to your existing legacy system. When you use CPNs, it improves the delivery time and decreases costs. Being a part of global cloud adoption trends, CPNs serve as a way to optimize your infrastructure, improve operations and accelerate digital transformation. This trend reflected in numbers: According to the statista reports, the worldwide public cloud computing market keeps growing and is expected to reach $482 billion in 2022. In 2019, by comparison, the market size amounted to $243 billion. 

How to take advantage of cloud computing?

Some of the important benefits are- 

  • Reduced costs for maintenance and support
  • Advanced data recovery mechanisms in case of data loss or corruption
  • Stable and continuous releases with minimal downtime and no production interruptions

List depends on the method you choose for adopting and computing services.

Cloud software re-architecting- It is popular among businesses that undergo expansions and transformations. Redesigning of existing architecture is important to improve a system’s performance, scalability and security. 

Cloud migration- It includes evaluating the software architecture and developing an action plan to implement cloud solution so as to achieve cost savings, reliability, security and other benefits that cloud computing can provide.

Cloud native development- It can minimize efforts for infrastructure management by automating networks, servers and operating systems. This way developed apps can be scaled from scratched and have the ability to be released fast.

3. Robotic Process Automation-

Robotic process automation refers to the use of software or web app to automate complex business operations and routine actions. RPA solutions are mostly used for customer support, inventory management, payroll processing and other use cases. RPA implementation is popular after 2015, and its increase is strongly connected with the machine learning development. The pandemic outbreak accelerated global RPA adoption and has contributed to its being mentioned among software development outsourcing trends.

Read more