Git Product home page Git Product logo

bookit's Introduction

technology scope

BookIt - sample Ionic/Angular app using RxJs, Google Maps and Firebase

License: MIT

DEMO: https://yuriity.github.io/bookit/places

application screens

Application Improvements

This application started as a practice project of Maximilian Schwarzmüller's Udemy course Ionic 4 - Build iOS, Android & Web Apps with Ionic & Angular. But from that time this project has a lot of improvements.

Architecture enhancement

The default project structure looks like a mess of random folders, and this could be changed to something more precise. Thanks to Tomas Trajan and his article we have a good guideline to improve the architecture.

So now the application has a CoreModule which contains all common parts: singleton services, model classes which they use and guards. A SharedModule contains all the "dumb" components. It is also a perfect place to import and re-export common Angular and Ionic stuff. And other FeatureModule's, like AuthModule, BookingsModule, and PlacesModule with submodules. Those modules don’t depend on any other features just on services provided by CoreModule and components provided by SharedModule.

Added aliases

Aliasing the app and environments folders will enable us to implement clean imports, which will be consistent throughout the application.

By default, the app has ugly imports that look like this: import { SomeSingletonService} from '../../../core/subpackage1/subpackage2/some-singleton.service'. That could be changed by configuring baseUrl and paths properties in the tsconfig.json file. And now we could use much shorter import { SomeSingletonService} from '@app/core'. Looks better, doesn’t it?

Also, we need to re-export every public entity in the main index.ts file. That provides us the possibility to import entities (like SomeSingletonService in the example above) directly from the @app/core instead of @app/core/some-package/some-singleton.service.

OnPush

Changed ChangeDetectionStrategy to OnPush for all components. After that, Angular will run change detection for components only if its input bindings have changed.

This is the only choice for making the application way faster, and personally, see no reasons for not using it every time.

| async

Replaced subscribe() method with | async pipe, where it's possible. That provides us some advantages:

  1. | async pipe works with OnPush change detection out of the box. Unlike the subscribing to observable manually in the ngOnInit().
  2. No need to manage unsubscribing at the end of the component life-cycle to avoid memory leaks.

Getting started

Run npm start for a dev server. Navigate to http://localhost:8100/. The app will automatically reload if you change any of the source files.

bookit's People

Contributors

yuriity avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.