Sheldon  Grant

Sheldon Grant

1671079920

How to Creating Web Apps with Declarative Programming and FSMs

Adopting declarative-style programming techniques allows teams to create web applications that are easier to extend and maintain. In this article, Toptal Full-stack Developer Peter Suggate demonstrates how to leverage declarative programming and finite-state machines in JavaScript.

In this article, I show how adopting declarative-style programming techniques judiciously can allow teams to create web applications that are easier to extend and maintain.

“…declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow.” —Remo H. Jansen, Hands-on Functional Programming with TypeScript

Like most problems in software, deciding to make use of declarative programming techniques in your applications requires carefully evaluating the tradeoffs. Check out one of our previous articles for an in-depth discussion of these.

Here, the focus is on how declarative programming patterns can be gradually adopted for both new and existing applications written in JavaScript, a language that supports multiple paradigms.

First, we discuss how to use TypeScript on both the back and front end to make your code more expressive and resilient to change. We then explore finite-state machines (FSMs) to streamline front-end development and increase stakeholder involvement in the development process.

FSMs are not a new technology. They were discovered nearly 50 years ago and are popular in industries such as signal processing, aeronautics, and finance, where software correctness can be critical. They are also very well suited to modeling problems that frequently arise in modern web development, such as coordinating complex asynchronous state updates and animations.

This benefit arises due to constraints on the way state is managed. A state machine can be in only one state simultaneously and has limited neighboring states it can transition to in response to external events (such as mouse clicks or fetch responses). The result is usually a significantly reduced defect rate. However, FSM approaches can be difficult to scale up to work well in large applications. Recent extensions to FSMs called statecharts allow complex FSMs to be visualized and scale to much larger applications, which is the flavor of finite-state machines this article focuses on. For our demonstration, we will be using the XState library, which is one of the best solutions for FSMs and statecharts in JavaScript.

Declarative on the Back End with Node.js

Programming a web server back end using declarative approaches is a large topic and might typically start by evaluating a suitable server-side functional programming language. Instead, let’s assume you are reading this at a time when you’ve already chosen (or are considering) Node.js for your back end.

This section details an approach to modeling entities on the back end that has the following benefits:

  • Improved code readability
  • Safer refactoring
  • Potential for improved performance due to the guarantees type modeling provides

Behavior Guarantees Through Type Modeling

JAVASCRIPT

Consider the task of looking up a given user via their email address in JavaScript:

function validateEmail(email) {
  if (typeof email !== "string") return false;

  return isWellFormedEmailAddress(email);
}

function lookupUser(validatedEmail) {
  // Assume a valid email is passed in.
  // Safe to pass this down to the database for a user lookup..
}

This function accepts an email address as string and returns the corresponding user from the database when there is a match.

The assumption is that lookupUser() will only be called once basic validation has been performed. This is a key assumption. What if several weeks later, some refactoring is performed and this assumption no longer holds? Fingers crossed that the unit tests catch the bug, or we might be sending unfiltered text to the database!

TYPESCRIPT (FIRST ATTEMPT)

Let’s consider a TypeScript equivalent of the validation function:

function validateEmail(email: string) {
  // No longer needed the type check (typeof email === "string").
  return isWellFormedEmailAddress(email);
}

This is a slight improvement, with the TypeScript compiler having saved us from adding an additional runtime validation step.

The safety guarantees that strong typing can bring haven’t really been taken advantage of yet. Let’s look into that.

TYPESCRIPT (SECOND ATTEMPT)

Let’s improve type safety and disallow passing unprocessed strings as input to looukupUser:

type ValidEmail = { value: string };

function validateEmail(input: string): Email | null {
  if (!isWellFormedEmailAddress(input)) return null;

  return { value: email };
}

function lookupUser(email: ValidEmail): User {
  // No need to perform validation. Compiler has already ensured only valid emails have been passed in.

  return lookupUserInDatabase(email.value);
}

This is better, but it’s cumbersome. All uses of ValidEmail access the actual address through email.value. TypeScript employs structural typing rather than the nominal typing employed by languages such as Java and C#.

While powerful, this means any other type that adheres to this signature is deemed equivalent. For example, the following password type could be passed to lookupUser() without complaint from the compiler:

type ValidPassword = { value: string };

const password = { value: "password" };

lookupUser(password); // No error.

TYPESCRIPT (THIRD ATTEMPT)

We can achieve nominal typing in TypeScript using intersection:

type ValidEmail = string & { _: "ValidEmail" };

function validateEmail(input: string): ValidEmail {
  // Perform email validation checks..

  return input as ValidEmail;
}

type ValidPassword = string & { _: "ValidPassword" };
function validatePassword(input: string): ValidPassword { ... }

lookupUser("email@address.com"); // Error: expected type ValidEmail.
lookupUser(validatePassword("MyPassword"); // Error: expected type ValidEmail.
lookupUser(validateEmail("email@address.com")); // Ok.

We’ve now achieved the goal that only validated email strings can be passed to lookupUser().

Pro Tip: Apply this pattern easily using the following helper type:

type Opaque<K, T> = T & { __TYPE__: K };

type Email = Opaque<"Email", string>;
type Password = Opaque<"Password", string>;
type UserId = Opaque<"UserId", number>;

Pros

By strongly typing entities in your domain, we can:

  1. Reduce the number of checks needing to be performed at runtime, which consume precious server CPU cycles (although a very small amount, these do add up when serving thousands of requests per minute).
  2. Maintain fewer basic tests due to the guarantees the TypeScript compiler provides.
  3. Take advantage of editor- and compiler-assisted refactoring.
  4. Improve code readability through improved signal-to-noise ratio.

Cons

Type modeling comes with some tradeoffs to consider:

  1. Introducing TypeScript usually complicates the toolchain, leading to longer build and test suite execution times.
  2. If your goal is to prototype a feature and get it into users’ hands ASAP, the extra effort required to explicitly model the types and propagate them through the codebase may not be worth it.

We’ve shown how existing JavaScript code on the server or shared back-end/front-end validation layer can be extended with types to improve code readability and allow for safer refactoring—important requirements for teams.

Declarative User Interfaces

User interfaces developed using declarative programming techniques focus effort on describing the “what” over the “how.” Two of the main three basic ingredients of the web, CSS and HTML, are declarative programming languages that have stood the test of time and more than 1 billion websites.

 

The main languages powering the web

The main languages powering the web.

 

React was open-sourced by Facebook in 2013, and it significantly altered the course of front-end development. When I first used it, I loved how I could declare the GUI as a function of the application’s state. I was now able to compose large and complex UIs from smaller building blocks without dealing with the messy details of DOM manipulation and tracking which parts of the app need updating in response to user actions. I could largely ignore the time aspect when defining the UI and focus on ensuring my application transitions correctly from one state to the next.

 

Evolution of front-end JavaScript from how to what

Evolution of front-end JavaScript from how to what.

 

To achieve a simpler way to develop UIs, React inserted an abstraction layer between the developer and the machine/browser: the virtual DOM.

Other modern web UI frameworks have also bridged this gap, albeit in different ways. For example, Vue employs functional reactivity through either JavaScript getters/setters (Vue 2) or proxies (Vue 3). Svelte brings reactivity through an extra source code compilation step (Svelte).

These examples seem to demonstrate a great desire in our industry to provide better, simpler tools for developers to express application behavior through declarative approaches.

Declarative Application State and Logic

While the presentation layer continues to revolve around some form of HTML (e.g., JSX in React, HTML-based templates found in Vue, Angular, and Svelte), I postulate that the problem of how to model an application’s state in a way that is easily understandable to other developers and maintainable as the application grows is still unsolved. We see evidence of this through a proliferation of state management libraries and approaches that continues to this day.

The situation is complicated by the increasing expectations of modern web apps. Some emerging challenges that modern state management approaches must support:

  • Offline-first applications using advanced subscription and caching techniques
  • Concise code and code reuse for ever-shrinking bundle size requirements
  • Demand for increasingly sophisticated user experiences through high-fidelity animations and real-time updates

(RE)EMERGENCE OF FINITE-STATE MACHINES AND STATECHARTS

Finite-state machines have been used extensively for software development in certain industries where application robustness is critical such as aviation and finance. It’s also steadily gaining in popularity for front-end development of web apps through, for example, the excellent XState library.

Wikipedia defines a finite-state machine as:

An abstract machine that can be in exactly one of a finite number of states at any given time. The FSM can change from one state to another in response to some external inputs; the change from one state to another is called a transition. An FSM is defined by a list of its states, its initial state, and the conditions for each transition.

And further:

A state is a description of the status of a system that is waiting to execute a transition.

FSMs in their basic form do not scale well to large systems due to the state explosion problem. Recently, UML statecharts were created to extend FSMs with hierarchy and concurrency, which are enablers for wide use of FSMs in commercial applications.

Declare Your Application Logic

First, what does an FSM look like as code? There are several ways to go about implementing a finite-state machine in JavaScript.

  • Finite-state machine as a switch statement

Here’s a machine describing the possible states that a JavaScript can be in, implemented using a switch statement:

const initialState = {
  type: 'idle',
  error: undefined,
  result: undefined
};

function transition(state = initialState, action) {
  switch (action) {
    case 'invoke':
      return { type: 'pending' };
    case 'resolve':
      return { type: 'completed', result: action.value };
    case 'error':
      return { type: 'completed', error: action.error ;
    default:
      return state;
  }
}

This style of code will be familiar to developers who’ve used the popular Redux state management library.

  • Finite-state machine as a JavaScript object

Here’s the same machine implemented as a JavaScript object using the JavaScript XState library:

const promiseMachine = Machine({
  id: "promise",
  initial: "idle",
  context: {
    result: undefined,
    error: undefined,
  },
  states: {
    idle: {
      on: {
        INVOKE: "pending",
      },
    },
    pending: {
      on: {
        RESOLVE: "success",
        REJECT: "failure",
      },
    },
    success: {
      type: "final",
      actions: assign({
        result: (context, event) => event.data,
      }),
    },
    failure: {
      type: "final",
      actions: assign({
        error: (context, event) => event.data,
      }),
    },
  },
});

While the XState version is less compact, the object representation has several advantages:

  1. The state machine itself is simple JSON, which can be easily persisted.
  2. Because it is declarative, the machine can be visualized.
  3. If using TypeScript, the compiler checks that only valid state transitions are performed.

XState supports statecharts and implements the SCXML specification, which makes it suitable for use in very large applications.

Statecharts visualization of a promise:

Finite-state machine of a promise

Finite-state machine of a promise.

 

XState Best Practices

The following are some best practices to apply when using XState to help keep projects maintainable.

Separate Side Effects from Logic

XState allows side effects (which include activities such as logging or API requests) to be independently specified from the logic of the state machine.

This has the following benefits:

  1. Assist detection of logic errors by keeping the state machine code as clean and simple as possible.
  2. Easily visualize the state machine without needing to remove extra boilerplate first.
  3. Easier testing of the state machine by injecting mock services.
const fetchUsersMachine = Machine({
  id: "fetchUsers",
  initial: "idle",
  context: {
    users: undefined,
    error: undefined,
    nextPage: 0,
  },
  states: {
    idle: {
      on: {
        FETCH: "fetching",
      },
    },
    fetching: {
      invoke: {
        src: (context) =>
          fetch(`url/to/users?page=${context.nextPage}`).then((response) =>
            response.json()
          ),
        onDone: {
          target: "success",
          actions: assign({
            users: (context, event) => [...context.users, ...event.data], // Data holds the newly fetched users
            nextPage: (context) => context.nextPage + 1,
          }),
        },
        onError: {
          target: "failure",
          error: (_, event) => event.data, // Data holds the error
        },
      },
    },

    // success state..

    // failure state..
  },
});

While it’s tempting to write state machines in this way while you’re still getting things working, a better separation of concerns is achieved by passing side effects as options:

const services = {
  getUsers: (context) => fetch(
    `url/to/users?page=${context.nextPage}`
  ).then((response) => response.json())
}

const fetchUsersMachine = Machine({
  ...
  states: {
    ...
    fetching: {
      invoke: {
        // Invoke the side effect at key: 'getUsers' in the supplied services object.
        src: 'getUsers',
      }
      on: {
        RESOLVE: "success",
        REJECT: "failure",
      },
    },
    ...
  },
  // Supply the side effects to be executed on state transitions.
  { services }
});

This also allows for easy unit testing of the state machine, allowing explicit mocking of user fetches:

async function testFetchUsers() {
  return [{ name: "Peter", location: "New Zealand" }];
}

const machine = fetchUsersMachine.withConfig({
  services: {
    getUsers: (context) => testFetchUsers(),
  },
});

Splitting Up Large Machines

It’s not always immediately obvious how best to structure a problem domain into a good finite-state machine hierarchy when starting out.

Tip: Use the hierarchy of your UI components to help guide this process. See the next section on how to map state machines to UI components.

A major benefit of using state machines is to explicitly model all the states and transitions between states in your applications so that the resulting behavior is clearly understood, making logic errors or gaps easy to spot.

In order for this to work well, machines need to be kept small and concise. Fortunately, composing state machines hierarchically is easy. In the canonical statecharts example of a traffic light system, the “red” state itself becomes a child state machine. The parent “light” machine isn’t aware of the internal states of “red” but decides when to enter “red” and what the intended behavior is upon exiting:

Traffic light example using statecharts

Traffic light example using statecharts.

1-1 Mapping of State Machines to Stateful UI Components

Take, for example, a much simplified, fictional eCommerce site that has the following React views:

<App>
  <SigninForm />
  <RegistrationForm />
  <Products />
  <Cart />
  <Admin>
    <Users />
    <Products />
  </Admin>
</App>

The process for generating state machines corresponding to the above views may be familiar for those who have used the Redux state management library:

  1. Does the component have state that needs to be modeled? For example, Admin/Products may not; paged fetches to the server plus a caching solution (such as SWR) may suffice. On the other hand, components such as SignInForm or the Cart usually contain state that needs to be managed, such as data entered into fields or the current cart contents.
  2. Are local state techniques (e.g., React’s setState() / useState()) sufficient to capture the problem? Tracking whether the cart popup modal is currently open hardly requires the use of a finite-state machine.
  3. Is the resulting state machine likely to be too complex? If so, split the machine into several smaller ones, identifying opportunities to create child machines that can be reused elsewhere. For example, the SignInForm and RegistrationForm machines may invoke instances of a child textFieldMachine to model validation and state for user email, name, and password fields.

When to Use a Finite-state Machine Model

While statecharts and FSMs can elegantly solve some challenging problems, deciding the best tools and approaches to use for a particular application usually depends on several factors.

Some situations where using finite-state machines shine:

  • Your application includes a considerable data entry component where field accessibility or visibility is governed by complex rules: for example, form entry in an insurance claims app. Here, FSMs help ensure business rules are implemented robustly. Further, the visualization features of statecharts can be used to help increase collaboration with non-technical stakeholders and identify detailed business requirements early on in development.
  • To work better on slower connections and deliver higher-fidelity experiences to users, web apps must manage increasingly complex async data flows. FSMs explicitly model all states an application can be in, and statecharts can be visualized to help diagnose and solve asynchronous data problems.
  • Applications that require a lot of sophisticated, state-based animation. For complex animations, techniques for modeling animations as event streams through time with RxJS are popular. For many scenarios, this works well, however, when rich animation is combined with a complex series of known states, FSMs provide well-defined “rest points” that the animations flow between. FSMs combined with RxJS seem the perfect combination to help deliver the next wave of high-fidelity, expressive user experiences.
  • Rich client applications such as photo or video editing, diagram-creation tools, or games where much of the business logic resides client side. FSMs are inherently decoupled from the UI framework or libraries and are easy to write tests for allowing high-quality applications to be iterated on quickly and shipped with confidence.

Finite-state Machine Caveats

  • The general approach, best practices, and API for statechart libraries such as XState are novel to most front-end developers, who will require investment of time and resources in order to become productive, particularly for less experienced teams.
  • Similar to the previous caveat, while XState’s popularity continues to grow and is well documented, existing state management libraries such as Redux, MobX, or React Context have huge followings that provide a wealth of online information XState doesn’t yet match.
  • For applications following a simpler CRUD model, existing state management techniques combined with a good resource caching library such as SWR or React Query will suffice. Here, the extra constraints FSMs provide, while incredibly helpful in complex apps, may slow development down.
  • The tooling is less mature than other state management libraries, with work still underway on improved TypeScript support and browser devtools extensions.

Wrapping Up

Declarative programming’s popularity and adoption in the web development community continue to rise.

While modern web development continues to become more complex, libraries and frameworks that adopt declarative programming approaches surface with increasing frequency. The reason seems clear—simpler, more descriptive approaches to writing software need to be created.

Using strongly typed languages such as TypeScript allows entities in the application domain to be modeled succinctly and explicitly, which reduces the chance of errors and amount of error-prone checking code that needs to be manipulated. Adopting finite-state machines and statecharts on the front end allows developers to declare an application’s business logic through state transitions, enabling the development of rich visualization tools and increasing the opportunity for close collaboration with non-developers.

When we do this, we shift our focus from the nuts and bolts of how the application works to a higher-level view that allows us to focus even more on the needs of the customer and create lasting value.

Original article source at: https://www.toptal.com/

#programming #javascript 

What is GEEK

Buddha Community

How to Creating Web Apps with Declarative Programming and FSMs
Easter  Deckow

Easter Deckow

1655630160

PyTumblr: A Python Tumblr API v2 Client

PyTumblr

Installation

Install via pip:

$ pip install pytumblr

Install from source:

$ git clone https://github.com/tumblr/pytumblr.git
$ cd pytumblr
$ python setup.py install

Usage

Create a client

A pytumblr.TumblrRestClient is the object you'll make all of your calls to the Tumblr API through. Creating one is this easy:

client = pytumblr.TumblrRestClient(
    '<consumer_key>',
    '<consumer_secret>',
    '<oauth_token>',
    '<oauth_secret>',
)

client.info() # Grabs the current user information

Two easy ways to get your credentials to are:

  1. The built-in interactive_console.py tool (if you already have a consumer key & secret)
  2. The Tumblr API console at https://api.tumblr.com/console
  3. Get sample login code at https://api.tumblr.com/console/calls/user/info

Supported Methods

User Methods

client.info() # get information about the authenticating user
client.dashboard() # get the dashboard for the authenticating user
client.likes() # get the likes for the authenticating user
client.following() # get the blogs followed by the authenticating user

client.follow('codingjester.tumblr.com') # follow a blog
client.unfollow('codingjester.tumblr.com') # unfollow a blog

client.like(id, reblogkey) # like a post
client.unlike(id, reblogkey) # unlike a post

Blog Methods

client.blog_info(blogName) # get information about a blog
client.posts(blogName, **params) # get posts for a blog
client.avatar(blogName) # get the avatar for a blog
client.blog_likes(blogName) # get the likes on a blog
client.followers(blogName) # get the followers of a blog
client.blog_following(blogName) # get the publicly exposed blogs that [blogName] follows
client.queue(blogName) # get the queue for a given blog
client.submission(blogName) # get the submissions for a given blog

Post Methods

Creating posts

PyTumblr lets you create all of the various types that Tumblr supports. When using these types there are a few defaults that are able to be used with any post type.

The default supported types are described below.

  • state - a string, the state of the post. Supported types are published, draft, queue, private
  • tags - a list, a list of strings that you want tagged on the post. eg: ["testing", "magic", "1"]
  • tweet - a string, the string of the customized tweet you want. eg: "Man I love my mega awesome post!"
  • date - a string, the customized GMT that you want
  • format - a string, the format that your post is in. Support types are html or markdown
  • slug - a string, the slug for the url of the post you want

We'll show examples throughout of these default examples while showcasing all the specific post types.

Creating a photo post

Creating a photo post supports a bunch of different options plus the described default options * caption - a string, the user supplied caption * link - a string, the "click-through" url for the photo * source - a string, the url for the photo you want to use (use this or the data parameter) * data - a list or string, a list of filepaths or a single file path for multipart file upload

#Creates a photo post using a source URL
client.create_photo(blogName, state="published", tags=["testing", "ok"],
                    source="https://68.media.tumblr.com/b965fbb2e501610a29d80ffb6fb3e1ad/tumblr_n55vdeTse11rn1906o1_500.jpg")

#Creates a photo post using a local filepath
client.create_photo(blogName, state="queue", tags=["testing", "ok"],
                    tweet="Woah this is an incredible sweet post [URL]",
                    data="/Users/johnb/path/to/my/image.jpg")

#Creates a photoset post using several local filepaths
client.create_photo(blogName, state="draft", tags=["jb is cool"], format="markdown",
                    data=["/Users/johnb/path/to/my/image.jpg", "/Users/johnb/Pictures/kittens.jpg"],
                    caption="## Mega sweet kittens")

Creating a text post

Creating a text post supports the same options as default and just a two other parameters * title - a string, the optional title for the post. Supports markdown or html * body - a string, the body of the of the post. Supports markdown or html

#Creating a text post
client.create_text(blogName, state="published", slug="testing-text-posts", title="Testing", body="testing1 2 3 4")

Creating a quote post

Creating a quote post supports the same options as default and two other parameter * quote - a string, the full text of the qote. Supports markdown or html * source - a string, the cited source. HTML supported

#Creating a quote post
client.create_quote(blogName, state="queue", quote="I am the Walrus", source="Ringo")

Creating a link post

  • title - a string, the title of post that you want. Supports HTML entities.
  • url - a string, the url that you want to create a link post for.
  • description - a string, the desciption of the link that you have
#Create a link post
client.create_link(blogName, title="I like to search things, you should too.", url="https://duckduckgo.com",
                   description="Search is pretty cool when a duck does it.")

Creating a chat post

Creating a chat post supports the same options as default and two other parameters * title - a string, the title of the chat post * conversation - a string, the text of the conversation/chat, with diablog labels (no html)

#Create a chat post
chat = """John: Testing can be fun!
Renee: Testing is tedious and so are you.
John: Aw.
"""
client.create_chat(blogName, title="Renee just doesn't understand.", conversation=chat, tags=["renee", "testing"])

Creating an audio post

Creating an audio post allows for all default options and a has 3 other parameters. The only thing to keep in mind while dealing with audio posts is to make sure that you use the external_url parameter or data. You cannot use both at the same time. * caption - a string, the caption for your post * external_url - a string, the url of the site that hosts the audio file * data - a string, the filepath of the audio file you want to upload to Tumblr

#Creating an audio file
client.create_audio(blogName, caption="Rock out.", data="/Users/johnb/Music/my/new/sweet/album.mp3")

#lets use soundcloud!
client.create_audio(blogName, caption="Mega rock out.", external_url="https://soundcloud.com/skrillex/sets/recess")

Creating a video post

Creating a video post allows for all default options and has three other options. Like the other post types, it has some restrictions. You cannot use the embed and data parameters at the same time. * caption - a string, the caption for your post * embed - a string, the HTML embed code for the video * data - a string, the path of the file you want to upload

#Creating an upload from YouTube
client.create_video(blogName, caption="Jon Snow. Mega ridiculous sword.",
                    embed="http://www.youtube.com/watch?v=40pUYLacrj4")

#Creating a video post from local file
client.create_video(blogName, caption="testing", data="/Users/johnb/testing/ok/blah.mov")

Editing a post

Updating a post requires you knowing what type a post you're updating. You'll be able to supply to the post any of the options given above for updates.

client.edit_post(blogName, id=post_id, type="text", title="Updated")
client.edit_post(blogName, id=post_id, type="photo", data="/Users/johnb/mega/awesome.jpg")

Reblogging a Post

Reblogging a post just requires knowing the post id and the reblog key, which is supplied in the JSON of any post object.

client.reblog(blogName, id=125356, reblog_key="reblog_key")

Deleting a post

Deleting just requires that you own the post and have the post id

client.delete_post(blogName, 123456) # Deletes your post :(

A note on tags: When passing tags, as params, please pass them as a list (not a comma-separated string):

client.create_text(blogName, tags=['hello', 'world'], ...)

Getting notes for a post

In order to get the notes for a post, you need to have the post id and the blog that it is on.

data = client.notes(blogName, id='123456')

The results include a timestamp you can use to make future calls.

data = client.notes(blogName, id='123456', before_timestamp=data["_links"]["next"]["query_params"]["before_timestamp"])

Tagged Methods

# get posts with a given tag
client.tagged(tag, **params)

Using the interactive console

This client comes with a nice interactive console to run you through the OAuth process, grab your tokens (and store them for future use).

You'll need pyyaml installed to run it, but then it's just:

$ python interactive-console.py

and away you go! Tokens are stored in ~/.tumblr and are also shared by other Tumblr API clients like the Ruby client.

Running tests

The tests (and coverage reports) are run with nose, like this:

python setup.py test

Author: tumblr
Source Code: https://github.com/tumblr/pytumblr
License: Apache-2.0 license

#python #api 

Harry Patel

Harry Patel

1614145832

A Complete Process to Create an App in 2021

It’s 2021, everything is getting replaced by a technologically emerged ecosystem, and mobile apps are one of the best examples to convey this message.

Though bypassing times, the development structure of mobile app has also been changed, but if you still follow the same process to create a mobile app for your business, then you are losing a ton of opportunities by not giving top-notch mobile experience to your users, which your competitors are doing.

You are about to lose potential existing customers you have, so what’s the ideal solution to build a successful mobile app in 2021?

This article will discuss how to build a mobile app in 2021 to help out many small businesses, startups & entrepreneurs by simplifying the mobile app development process for their business.

The first thing is to EVALUATE your mobile app IDEA means how your mobile app will change your target audience’s life and why your mobile app only can be the solution to their problem.

Now you have proposed a solution to a specific audience group, now start to think about the mobile app functionalities, the features would be in it, and simple to understand user interface with impressive UI designs.

From designing to development, everything is covered at this point; now, focus on a prelaunch marketing plan to create hype for your mobile app’s targeted audience, which will help you score initial downloads.

Boom, you are about to cross a particular download to generate a specific revenue through your mobile app.

#create an app in 2021 #process to create an app in 2021 #a complete process to create an app in 2021 #complete process to create an app in 2021 #process to create an app #complete process to create an app

Fredy  Larson

Fredy Larson

1595059664

How long does it take to develop/build an app?

With more of us using smartphones, the popularity of mobile applications has exploded. In the digital era, the number of people looking for products and services online is growing rapidly. Smartphone owners look for mobile applications that give them quick access to companies’ products and services. As a result, mobile apps provide customers with a lot of benefits in just one device.

Likewise, companies use mobile apps to increase customer loyalty and improve their services. Mobile Developers are in high demand as companies use apps not only to create brand awareness but also to gather information. For that reason, mobile apps are used as tools to collect valuable data from customers to help companies improve their offer.

There are many types of mobile applications, each with its own advantages. For example, native apps perform better, while web apps don’t need to be customized for the platform or operating system (OS). Likewise, hybrid apps provide users with comfortable user experience. However, you may be wondering how long it takes to develop an app.

To give you an idea of how long the app development process takes, here’s a short guide.

App Idea & Research

app-idea-research

_Average time spent: two to five weeks _

This is the initial stage and a crucial step in setting the project in the right direction. In this stage, you brainstorm ideas and select the best one. Apart from that, you’ll need to do some research to see if your idea is viable. Remember that coming up with an idea is easy; the hard part is to make it a reality.

All your ideas may seem viable, but you still have to run some tests to keep it as real as possible. For that reason, when Web Developers are building a web app, they analyze the available ideas to see which one is the best match for the targeted audience.

Targeting the right audience is crucial when you are developing an app. It saves time when shaping the app in the right direction as you have a clear set of objectives. Likewise, analyzing how the app affects the market is essential. During the research process, App Developers must gather information about potential competitors and threats. This helps the app owners develop strategies to tackle difficulties that come up after the launch.

The research process can take several weeks, but it determines how successful your app can be. For that reason, you must take your time to know all the weaknesses and strengths of the competitors, possible app strategies, and targeted audience.

The outcomes of this stage are app prototypes and the minimum feasible product.

#android app #frontend #ios app #minimum viable product (mvp) #mobile app development #web development #android app development #app development #app development for ios and android #app development process #ios and android app development #ios app development #stages in app development

Top Enterprise Angular Web Apps Development Company in USA

AppClues Infotech is one of the leading Enterprise Angular Web Apps Development Company in USA. Our dedicated & highly experienced Angular app developers build top-grade Angular apps for your business with immersive technology & superior functionalities.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#top enterprise angular web apps development company in usa #enterprise angular web apps development #hire enterprise angular web apps developers #best enterprise angular web app services #custom enterprise angular web apps solution #professional enterprise angular web apps developers

Carmen  Grimes

Carmen Grimes

1595491178

Best Electric Bikes and Scooters for Rental Business or Campus Facility

The electric scooter revolution has caught on super-fast taking many cities across the globe by storm. eScooters, a renovated version of old-school scooters now turned into electric vehicles are an environmentally friendly solution to current on-demand commute problems. They work on engines, like cars, enabling short traveling distances without hassle. The result is that these groundbreaking electric machines can now provide faster transport for less — cheaper than Uber and faster than Metro.

Since they are durable, fast, easy to operate and maintain, and are more convenient to park compared to four-wheelers, the eScooters trend has and continues to spike interest as a promising growth area. Several companies and universities are increasingly setting up shop to provide eScooter services realizing a would-be profitable business model and a ready customer base that is university students or residents in need of faster and cheap travel going about their business in school, town, and other surrounding areas.

Electric Scooters Trends and Statistics

In many countries including the U.S., Canada, Mexico, U.K., Germany, France, China, Japan, India, Brazil and Mexico and more, a growing number of eScooter users both locals and tourists can now be seen effortlessly passing lines of drivers stuck in the endless and unmoving traffic.

A recent report by McKinsey revealed that the E-Scooter industry will be worth― $200 billion to $300 billion in the United States, $100 billion to $150 billion in Europe, and $30 billion to $50 billion in China in 2030. The e-Scooter revenue model will also spike and is projected to rise by more than 20% amounting to approximately $5 billion.

And, with a necessity to move people away from high carbon prints, traffic and congestion issues brought about by car-centric transport systems in cities, more and more city planners are developing more bike/scooter lanes and adopting zero-emission plans. This is the force behind the booming electric scooter market and the numbers will only go higher and higher.

Companies that have taken advantage of the growing eScooter trend develop an appthat allows them to provide efficient eScooter services. Such an app enables them to be able to locate bike pick-up and drop points through fully integrated google maps.

List of Best Electric Bikes for Rental Business or Campus Facility 2020:

It’s clear that e scooters will increasingly become more common and the e-scooter business model will continue to grab the attention of manufacturers, investors, entrepreneurs. All this should go ahead with a quest to know what are some of the best electric bikes in the market especially for anyone who would want to get started in the electric bikes/scooters rental business.

We have done a comprehensive list of the best electric bikes! Each bike has been reviewed in depth and includes a full list of specs and a photo.

Billy eBike

mobile-best-electric-bikes-scooters https://www.kickstarter.com/projects/enkicycles/billy-were-redefining-joyrides

To start us off is the Billy eBike, a powerful go-anywhere urban electric bike that’s specially designed to offer an exciting ride like no other whether you want to ride to the grocery store, cafe, work or school. The Billy eBike comes in 4 color options – Billy Blue, Polished aluminium, Artic white, and Stealth black.

Price: $2490

Available countries

Available in the USA, Europe, Asia, South Africa and Australia.This item ships from the USA. Buyers are therefore responsible for any taxes and/or customs duties incurred once it arrives in your country.

Features

  • Control – Ride with confidence with our ultra-wide BMX bars and a hyper-responsive twist throttle.
  • Stealth- Ride like a ninja with our Gates carbon drive that’s as smooth as butter and maintenance-free.
  • Drive – Ride further with our high torque fat bike motor, giving a better climbing performance.
  • Accelerate – Ride quicker with our 20-inch lightweight cutout rims for improved acceleration.
  • Customize – Ride your own way with 5 levels of power control. Each level determines power and speed.
  • Flickable – Ride harder with our BMX /MotoX inspired geometry and lightweight aluminum package

Specifications

  • Maximum speed: 20 mph (32 km/h)
  • Range per charge: 41 miles (66 km)
  • Maximum Power: 500W
  • Motor type: Fat Bike Motor: Bafang RM G060.500.DC
  • Load capacity: 300lbs (136kg)
  • Battery type: 13.6Ah Samsung lithium-ion,
  • Battery capacity: On/off-bike charging available
  • Weight: w/o batt. 48.5lbs (22kg), w/ batt. 54lbs (24.5kg)
  • Front Suspension: Fully adjustable air shock, preload/compression damping /lockout
  • Rear Suspension: spring, preload adjustment
  • Built-in GPS

Why Should You Buy This?

  • Riding fun and excitement
  • Better climbing ability and faster acceleration.
  • Ride with confidence
  • Billy folds for convenient storage and transportation.
  • Shorty levers connect to disc brakes ensuring you stop on a dime
  • belt drives are maintenance-free and clean (no oil or lubrication needed)

**Who Should Ride Billy? **

Both new and experienced riders

**Where to Buy? **Local distributors or ships from the USA.

Genze 200 series e-Bike

genze-best-electric-bikes-scooters https://www.genze.com/fleet/

Featuring a sleek and lightweight aluminum frame design, the 200-Series ebike takes your riding experience to greater heights. Available in both black and white this ebike comes with a connected app, which allows you to plan activities, map distances and routes while also allowing connections with fellow riders.

Price: $2099.00

Available countries

The Genze 200 series e-Bike is available at GenZe retail locations across the U.S or online via GenZe.com website. Customers from outside the US can ship the product while incurring the relevant charges.

Features

  • 2 Frame Options
  • 2 Sizes
  • Integrated/Removable Battery
  • Throttle and Pedal Assist Ride Modes
  • Integrated LCD Display
  • Connected App
  • 24 month warranty
  • GPS navigation
  • Bluetooth connectivity

Specifications

  • Maximum speed: 20 mph with throttle
  • Range per charge: 15-18 miles w/ throttle and 30-50 miles w/ pedal assist
  • Charging time: 3.5 hours
  • Motor type: Brushless Rear Hub Motor
  • Gears: Microshift Thumb Shifter
  • Battery type: Removable Samsung 36V, 9.6AH Li-Ion battery pack
  • Battery capacity: 36V and 350 Wh
  • Weight: 46 pounds
  • Derailleur: 8-speed Shimano
  • Brakes: Dual classic
  • Wheels: 26 x 20 inches
  • Frame: 16, and 18 inches
  • Operating Mode: Analog mode 5 levels of Pedal Assist Thrott­le Mode

Norco from eBikestore

norco-best-electric-bikes-scooters https://ebikestore.com/shop/norco-vlt-s2/

The Norco VLT S2 is a front suspension e-Bike with solid components alongside the reliable Bosch Performance Line Power systems that offer precise pedal assistance during any riding situation.

Price: $2,699.00

Available countries

This item is available via the various Norco bikes international distributors.

Features

  • VLT aluminum frame- for stiffness and wheel security.
  • Bosch e-bike system – for their reliability and performance.
  • E-bike components – for added durability.
  • Hydraulic disc brakes – offer riders more stopping power for safety and control at higher speeds.
  • Practical design features – to add convenience and versatility.

Specifications

  • Maximum speed: KMC X9 9spd
  • Motor type: Bosch Active Line
  • Gears: Shimano Altus RD-M2000, SGS, 9 Speed
  • Battery type: Power Pack 400
  • Battery capacity: 396Wh
  • Suspension: SR Suntour suspension fork
  • Frame: Norco VLT, Aluminum, 12x142mm TA Dropouts

Bodo EV

bodo-best-electric-bikes-scootershttp://www.bodoevs.com/bodoev/products_show.asp?product_id=13

Manufactured by Bodo Vehicle Group Limited, the Bodo EV is specially designed for strong power and extraordinary long service to facilitate super amazing rides. The Bodo Vehicle Company is a striking top in electric vehicles brand field in China and across the globe. Their Bodo EV will no doubt provide your riders with high-level riding satisfaction owing to its high-quality design, strength, breaking stability and speed.

Price: $799

Available countries

This item ships from China with buyers bearing the shipping costs and other variables prior to delivery.

Features

  • Reliable
  • Environment friendly
  • Comfortable riding
  • Fashionable
  • Economical
  • Durable – long service life
  • Braking stability
  • LED lighting technology

Specifications

  • Maximum speed: 45km/h
  • Range per charge: 50km per person
  • Charging time: 8 hours
  • Maximum Power: 3000W
  • Motor type: Brushless DC Motor
  • Load capacity: 100kg
  • Battery type: Lead-acid battery
  • Battery capacity: 60V 20AH
  • Weight: w/o battery 47kg

#android app #autorent #entrepreneurship #ios app #minimum viable product (mvp) #mobile app development #news #app like bird #app like bounce #app like lime #autorent #best electric bikes 2020 #best electric bikes for rental business #best electric kick scooters 2020 #best electric kickscooters for rental business #best electric scooters 2020 #best electric scooters for rental business #bird scooter business model #bird scooter rental #bird scooter rental cost #bird scooter rental price #clone app like bird #clone app like bounce #clone app like lime #electric rental scooters #electric scooter company #electric scooter rental business #how do you start a moped #how to start a moped #how to start a scooter rental business #how to start an electric company #how to start electric scooterrental business #lime scooter business model #scooter franchise #scooter rental business #scooter rental business for sale #scooter rental business insurance #scooters franchise cost #white label app like bird #white label app like bounce #white label app like lime