Skip to main content

Posts

React app with express server

In this tutorial you will learn how to build and serve your React app using an Express.js server.


You can find the project code on github here
Here is a brief plan of how you can do it fast and easy:

Build Toolsnode.jsexpress.jscreate-react-app InstallationInstall node if you don't have it already My version is 8.12.0 Assuming you are in the folder you want to create your project run:  npm init -y   npm install express - -save   npm i -g create-react-app   create-react-app client  ‘client ’ is the name of the react app , you can pick a different name if you like Now we have the react app ready to build it go inside the client directory on the terminal run :  cd client 
 yarn start  now you can see the react app in your browser press Ctr + C on the terminal to close the dev server run :  yarn build  wait for the process to end , the react code for production lives in the build directory. go back , it is time to build our express server  cd ..  create an index.js file and put the fol…
Recent posts

Cohesion

Cohesion is about how focused a given program element is in performing a single cohesive task.
Cohesion is often contrasted with Coupling which is a different concept, but loose coupling correlates with high cohesion and vice versa. So by increasing the cohesion of our code it becomes less coupled and we avoid the pitfalls associated with coupling.



Cohesion is an ordinal measuring type that is usually described as "high cohesion" and "low cohesion".

High Cohesion Well focused code in performing a single task.
Code with high cohesion is exhibiting: robustness, reliability, re-usability, and understand-ability.

Low Cohesion As the cohesion lowers , this code becomes more coupled and tends to do various tasks.
Code with low cohesion has the undesirable traits of : being difficult to modify, test, reuse, and even to understand.

Reasoning about Cohesion We start by asking questions like :
"How tightly focused are the methods and fields in a Class ?""Do all th…

Coupling

In a nutshell coupling is about how strongly connected are different program elements to one another.

In this article we will talk about the different types of coupling found in our classes and reason about them.


Note that not all forms of coupling are problematic as it is a natural part of software development. Reasoning about coupling can improve the overall quality of our code and make our code easier to test, evolve and to reuse.


Types of couplingData coupling             [usually harmless]Stamp coupling          [usually harmless]Control coupling        [kind of disturbing]Global coupling          [disturbing]Content coupling       [insidious]In the above list we have the types of coupling ordered from harmlessto insidious.
Note that Data and Stamp coupling are usually harmless and can be a part of a healthy software . 
If the code is too coupled even simple changes are made challenging, imagine fixing one bug in class X and after you change code in the class alone you realize tha…

Testable Code 101

Testability is all about making our code (and our system eventually) to be easy to test.
Why?  Testable code is an investmentthat will benefit your team and project in various ways, it can even make your grumpy project manager happy.
Testable code is more organized and will put us in the process of splitting our code's functionality to small, manageable and reusable components leading to more robust designs.Refactoring your code is easier and you can verify on the spot if something is wrong thus saving you precious time and effort.Writing your tests is faster and simpler.Testable code has the following properties:
Controllability : Is the extend of our ability to execute the code under test with the states and parameters we care about. Observability: The behaviors of our code that can be verified. Isolateability: Failures can be isolated from each other.Automatability: How able we are to automate our tests.





Controllabity Example: Our Function checks is it is Monday: if it is Monday…

Software Requirements 101

The requirements should: Define what the system is doing but Not how is done!
Functional :
The Functional Requirements capture what the system should do
Examples :
"We want our users to be able to log in using a single click"
"User should be able to view his/her purchase history on history tab"
Those would be great functional requirements.

Non Functional : The Non Functional Requirements are about the qualities our system should have
UsabilityPerformanceSecurityComplexityReliabilityTest-abilityDifferent stakeholders will care about different qualities for example: The customer will care more about Usability, Performance and Security but the Development team will care more for Test-ability and Complexity .

It's important that all the stakeholders involved are to weigh the pros and cons of each of these requirements. Because these decisions that you make will often be at the expense of one or another.

And make sure that each quality is testable : H…

Typescript boilerplate

A simple boilerplate for Typescript projects with Mocha, Chai and coverage report using nyc


As part of learning Typescript i came across of finding my self a hard time to setup all the tools to practice my coding skills. After a lot of trial and error i found the way to setup a simple yet usable environment for my projects.
Use this boilerplate and get coding asap instead of wasting your time!



What is included ?Testing : Test your app with Mocha and Chai... directly in Typescript!Coverage report : Take your testing to the next level and get coverage reports to improve your codes qualityBuild your files : Build your typescript files with a single commandView project on GitHub 
How to use Setup the boilerplate git clone https://github.com/Cyb3rN4u7/typescript-mocha-chai-nyc-boilerplate.git cd typescript-mocha-chai-nyc-boilerplate  
npm install Useful scripts included Build Typescript projectnpm run build Run Testsnpm run test Run Coverage reportnpm run coverage After open the …

Google play ratings are broken

Google play is undoubtedly the largest market for android apps , while Google has made relatively easy for anyone to publish their app the rating system is kind of broken.


Publishing your app
After you publish the app and is available in the store nobody is installing it because is not visible as play store has a ranking system based on different variables like : size, SEO, Ratings and others... those are important but the most important is the rating the app is receiving by the users.
The impact of rating"The quest of 5 star ratings begins" Usersavoid apps with poor or no rating , plus the number of installs an app has makes it more likely to be installed : the more the merrier. You might think : "Why is this a problem?" well think that an app when published has no ratings or installs that makes getting users very difficult as the store puts the app way below other apps with better ratings and installs. So you get to the point where your app is "avail…