Reactive Programming
Reactive Programming
programming logic to handle changes or real time updates rather than static contents.
a)It is a method that lets your program/software to start a task that could go on for a long time and,
instead of needing to wait for it to finish, it becomes responsive to other events while the other
work is ongoing.
1. Single-Responsibility Principle - It means that for instance in React JavaScript a component should
have one and only one reason to change, meaning that one component should have only one job.
For instance you have component that handles the user inputs its work should only change when
user changes the input not other things which should be assigned to a different component. I have
applied this recently in my ongoing online shop system where I am only using one component say for
shipping to handle only shipping another one for payment and so on, this had made it easier mostly
when trying to identify which part of the software isn't working properly.
2. Open-Closed Principle - I could explain using the same components that the components should
be made easily available to be used by other components but not modifying them. For the case of
shipping and payment component the shipping component should be able to import data from the
payment component in that if the user has paid for his or her item then the shipping should be
processed.
3. Liskov Substitution Principle - This means that every subclass or derived class should be
substitutable for their base or parent class. For this case I was working on JavaScript classes and
when using the extend method to create a subclass from the parent class, the child class inherits the
methods that are available in its parent class. This makes the code more readable since the
properties and methods in the main class will be reused thus making my code more modular and
reusable.
4. Interface Segregation Principle -A client or user of your software should never be forced to
implement or view an interface that it doesn’t they don't want to use, or clients shouldn’t be forced
to depend on methods they do not use. For my current project the shopping system I am applying
this principle to give the user the freedom to find what page or interface they would like by using
search filtering in the software. This feature makes it easier for the clients to easily use your system
interface without much complications
5. Dependency Inversion Principle -This principle allows for decoupling. That is your software should
be able to be broken into several parts and they work or are connected without being directly
connected. Your software you should not force say high level classes say for my system The
PasswordReminder class should not care what low level databaseConnection method the application
uses rather it the database connection method should interface with the password reminder class,
with this it enables me achieve high level of abstraction.
I used it in the modelling of the system with different classes and components to show what class or
component interfaces or relates with one one another.
It works by visually representing a system along with its main actors, roles, actions, artifacts or
classes, in order to better understand, alter, maintain, or document information about the system.
I used it because it is the best way to visualize a project before it takes place or you start
implementing the code.
Agile software development process is practice that promotes continuous iteration of development
and testing throughout the software development lifecycle of the project. In the Agile model in
software development process, both development and testing activities are concurrent. It is a
software development approach that employ continual planning, learning, improvement, team
collaboration, evolutionary development, and early delivery. It encourages flexible responses to
change.
Has the following Phases -Project Initiation, Planning, Development, Integration and testing,
Implementation and deployment and lastly Review
Given my final year project a criminal record management system with several level of user
interactivity with system and different privileges'.
The first phase I could gather on what the stakeholders or the users of the software need. Then I
could determine the time and work resources are required to complete the project. Taking stock of
resources is crucial to determining economic feasibility for project approval.
In the Planning phase
This is where I could get to know what the stakeholders really need what the management system
should maintain how it will be accessed and what privilege's are given to what users of the system,
what programming languages and which database to be used.
After gathering the requirements and the plans for the management system, I could code the system
first iterations that will be rolled out to some users for testing, I would develop different parts or
sprints for it to be tested separately and improve the ones tested.
This is after several testing of different sprints of my coded system is where the system is made
available to the users and final testing of the entire system is done.
the system software is now fully deployed and available to customers. This action leads to
maintenance phase. During this phase, I provide ongoing support to keep the system running
smoothly and fix any new bugs.
Lastly, Review
That is the last stage of the Agile development cycle. After completing all the previous stages of
development, I would present to the owner the result achieved in meeting the requirements. After
that, the Agile software development phases start over – either with a new iteration or moving to
the next stage and scaling Agile.
Coupling describes is the degree of interdependence between software modules - is used to indicate
the relative independence among the modules.
Cohesion refers to the degree to which the elements inside a module relates together - it is a
measure of the strength of relationship between the methods and data of a class and some unifying
purpose or concept served by that class
Alpha testing is mainly about ensuring bug-free functionality it relates to the internal testing by
customers, online visitors or an independent test team for in-house preliminary software, before the
next stage.
Beta testing involves releasing the software to a limited number of real users. It is a reference to the
external form of user acceptance testing within the marketplace.
I am currently using MongoDB database and Mongoose rather than the previously used MySQL, with
the change in the database system it has been a challenging problem to make use of data that was in
the MySQL database to the MongoDB using the schemas and to try and store the data and fetch it
rather from the localhost of MySQL, my shopping system has different data to be stored in the
database.
I used different learning platforms to be able to integrate the previously MySQL database to
MongoDB, with the help of online resources and some of tutorials and my friends in tech I was able
to use MongoDB to store and fetch data from the database as it was in MySQL
if (x == 0) {
return 0;
if (x < 2) {
return Number.MAX_VALUE;
if (cnt[x]) {
return cnt[x];
return cnt[x];
let ans = 0;
if (temp == Number.MAX_VALUE) {
ans = -1;
break;
} else {
ans += temp;
return ans;
};
console.log(minimumRounds(tasks));
//OUTPUT = 4
public String[] chatBot(String[][] conversations, String[] currentConversation) {
ArrayList<String> hmRestOfWords = new ArrayList<>(); // the rest of the words in the matched
conversation
int numOfMatches = 0;
if (!uw.contains(pw)) {
String w = currentConversation[i];
if (w.compareTo(pw) == 0) {
numOfMatches++;
indexOfLastMatchingWord = j;
uw.add(pw);
if (indexOfLastMatchingWord != -1)
else continue;
if (hmNumOfMatches == 0) {
hmNumOfMatches = numOfMatches;
hmRestOfWords.addAll(restOfWords);
hmNumOfMatches = numOfMatches;
hmRestOfWords = restOfWords;
/**
*/
int i;
answer[i] = currentConversation[i];
// and append the rest of the words from the matched historical conversation
for (int j = 0; j < hmRestOfWords.size(); j++) {
answer[i + j] = hmRestOfWords.get(j);
return answer;
if (!restOfWords.contains(pc[i])) restOfWords.add(pc[i]);
return restOfWords;
JavaScript code
function validTime(time) {
console.log(checkTime); // true