• Home
  • About
  • Contact

Blogger templates

facebook twitter instagram pinterest bloglovin Email

Programming Addict

We are suppose to develop fashion web site as our AF group project. i'm developing  the administrators part .
Administrator should be able to manage product categories and store managers admin should be able to add new store mangers. Once the admin creates a login for the store manager, it should be notified to the store manager via email.

so i started my part by first developing the front- end of the Manage categories section. we found a CSS template built with bootstrap and we integrated it in our project  this is how administrator page looks like 





i have created a component named Category to store Category Information 

import React from 'react'

function Category(props) {
    return (

        <tr>
            <th scope="row">{props.id}</th>
            <td>{props.name}</td>
            <td><button className="btn btn-primary btn-sm">
                <i className="fa fa-pencil" aria-hidden="true"></i>
                <span> Edit</span></button></td>
            <td><button className="btn btn-danger btn-sm">
                <i className="fa fa-trash" aria-hidden="true"></i>
                <span> Delete</span>
            </button></td>
        </tr>

    )
}

export default Category


then i created CategoriesList Component to store all Category Components in a table


import React from 'react'
import Categoty from '../../Components/Category/Category'
    
const CategoriesList = () =>{
    return (
        <table className="table">
            <thead>
                <tr>
                    <th scope="col">#</th>
                    <th colspan="3" scope="col">Name</th>
                </tr>
            </thead>
            <tbody>
                <Categoty id={1} name="Shoe" />
                <Categoty id={2} name="Dress"/>
                <Categoty id={3} name="Watch"/>
                <Categoty id={4} name="Beauty"/>
                
            </tbody>
        </table>
    )
}

export default CategoriesList

(for now i hard coded few categories but later ill change it get data from api)


and finally i added it to AdminPage Container

import React, { Component } from "react";
import CategoryList from "../../Layouts/CategoriesList/CategoriesList";
import StoreManagersList from "../../Layouts/StoreMangersList/StoreManagersList";
import RegisterNewStoreManager from "../../Layouts/RegisterNewStoreManager/RegisterNewStoreManager";
import Banner from "../../Components/Banner/Banner";

class AdminPage extends Component {
  render() {
    return (
      <div>
        <Banner
          name="Administrator"
          description="Manage Categories and Store Managers"
        />

        <div className="container pt-4">
          <h2 className="pt-4">Manage Categories</h2>
          <div className="row">
            <div className="col-sm ">
              <h4 className="pt-4 ">Product Categories</h4>
              <CategoryList />
            </div>
            <div className="col-sm">
              <h4 className="pt-4 ">Add New Categories</h4>
              <input
                type="text"
                className="form-control"
                id="name"
                placeholder="Category Name"
              />
              <br />
              <button className="button">Add</button>
            </div>
          </div>
   
      </div>
    );
  }
}

export default AdminPage;




Share
Tweet
Pin
Share
No comments

Enable Bootstrap in ReactJS

We all know that ReactJS is the most poplar javascript library that exists in web developing community. React makes it painless to create interactive UIs. Design simple views for each state in your application. Even if its not a javascript framework its really powerful. 

Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive web sites. it has many usefull css classes that we can use in our web apps. In this article we are going to look at how we can integrate bootstrap in our ReactJS web application to get the most out of thees two technologies to develop amazing , responsive and beautiful web apps without much pain.

In order to enable bootstrap on your react app first of all you have to install bootstrap using Node Package Manager(NPM) for this open the terminal and run the following code.

npm install react-bootstrap bootstrap
after you successfully install bootstrap you can import bootstrap to your project using import keyword.

import 'bootstrap/dist/css/bootstrap.min.css';



Share
Tweet
Pin
Share
No comments

In this Article we are going to talk about NodeJS. you will learn what is NodeJS and Why it is very important , pros and cons of NodeJS and finally how we can install NodeJS in our systems.

What is NodeJS

When you heard the term JAVA SCRIPT the first thing that will come to your mind is web browser because its the most common way to execute JS codes. with NodeJS you will no longer require a web browser to execute your java script code because NodeJS  is an open-source, cross-platform, JavaScript run-time environment that executes JavaScript code outside of a web browser. NodeJS is built on Google Chrome's V8 Engine.  

Why NodeJS is important to us?

Most simple answer for this question is, because NodeJS is everywhere. NodeJS is widely used by many large enterprise companies because its fast , efficient and most importantly it is the best option when it comes to scalabilty. 

in the following list you can see some huge companies that widely use NodeJS.



Advantages of using NodeJS

  • Easy Scalability
  • High Performance 
  • You can develop a complete web app just knowing the javascript without knowing any other languages.
  • Easy to Learn
  • Highly Extensible



Share
Tweet
Pin
Share
No comments

When we are developing any kind software we are gonna need a database at some point. In this article we are gonna talk about two major database technologies SQL and NoSQL.
 

SQL (Structured Query Language) 

SQL or Structured Query Language is a language that we are using to manipulate relational databases. in sql databases data is stored in multiple tables according to a schema. first relational database created on 1970s by an IBM Researcher using SESQL.


NoSQL



NoSQL is a non relational database system that doesn't have a fixed schema like SQL (Relational databases). All the data will be stored in documents without a predefined schema. Carl Strozz introduced the NoSQL concept in 1998.


Which is better?

both of thees systems has their own advantages and disadvantages, In order for a SQL Database to be more effective,input data needs to be well structured and consistent. if we have a well defined schema in our SQL Database it will also help us to reduce data redundancy. therefor SQL is much better for a system that has constant and unchanging data. if your requirements are not clear at the beginning of the system (if you are not sure about what data your gonna store in your database) NoSQL system will be more suitable for you. because NoSQL databases doesn't need consistent data. and if we also compare the scalabilty of thees two systems NoSQL clearly wins because NoSQL databases are horizontally scalable unlike SQL databases NoSQL Databases (which are vertically salable)  can handle more traffic by sharing or adding additional servers.   

Conclusion 

Every database technology has its own pros and cons so there is no one superior database technology. It all comes down to the requirements of your system.




Share
Tweet
Pin
Share
No comments



S.O.L.I.D is a term for Robert C. Martin's first five object oriented design principles,These concepts seek to make software architectures more comprehensible, easier to manage and easier to extend. 
every software engineer should know thees concepts.

S — Single Responsibility Principle

 The Single Responsibility Principle states in programming that each module or class will have responsibility for a particular part of the software's functionality. 
There is a famous quote: "Do one thing and do it right." 
This is known as Single Responsibility Principle.


O — Open/closed principle 

The open / closed theory states, in programming, that software entities (classes, modules, functions, etc.) should be open to extensions, but closed for modification. 
anyone who understands Object Oriented Programming generally, probably already know about polymorphism. We can ensure that our code complies with the open / closed principle by using inheritance and/or implementing interfaces which allows.




L — Liskov substitution principle

This theory specifies that objects of a superclass are to be replaceable without breaking the program with objects of its subclasses. That allows your subclass objects to behave in the same way as your superclass objects do. You can accomplish this by following a few rules which are somewhat similar to the Bertrand Meyer specified contract model design.




I — Interface segregation principle

Throughout programming, the theory of interface segregation states that no client should be forced to rely on methods that he does not use.
To put it more simply: Do not add additional features by applying new methods to an existing interface.
Instead, build a new interface, and if appropriate allow your class to implement multiple interfaces.




D - Dependency inversion principle

In programming, the concept of dependency inversion is a way of decoupling software modules.
This concept states that modules of high level should not be reliant on modules of low level. Both should be made based on abstractions.
Abstractions are not to be based on data. Abstractions will depend on the data.
In order to comply with this theory, we have to use a design pattern known as an inversion pattern of dependency, 


Share
Tweet
Pin
Share
No comments

Search This Blog

recent posts

Blog Archive

  • March 2020 (2)
  • February 2020 (3)
Powered by Blogger.

Our AF Group Project Fashion Store Part 1

We are suppose to develop fashion web site as our AF group project. i'm developing  the administrators part . Administrator should be ab...

Popular Posts

  • S.O.L.I.D the 5 principles every programmer should know S.O.L.I.D the 5 principles every programmer should know
  • no image Why you should know NodeJS
  • NoSQL vs SQL What is best NoSQL vs SQL What is best

About me

About Me

Ushan Fernando

ushansankalpafernando@gmail.com

Created with by ThemeXpose