<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jymo</title>
    <description>The latest articles on DEV Community by Jymo (@jamesmatheri).</description>
    <link>https://dev.to/jamesmatheri</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1123347%2F45cf6e32-4cec-4466-a5bd-1bda615e519e.jpg</url>
      <title>DEV Community: Jymo</title>
      <link>https://dev.to/jamesmatheri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jamesmatheri"/>
    <language>en</language>
    <item>
      <title>JavaScript Classes: Like a pro-2</title>
      <dc:creator>Jymo</dc:creator>
      <pubDate>Tue, 01 Apr 2025 10:38:04 +0000</pubDate>
      <link>https://dev.to/jamesmatheri/javascript-classes-like-a-pro-2-4d64</link>
      <guid>https://dev.to/jamesmatheri/javascript-classes-like-a-pro-2-4d64</guid>
      <description>&lt;h2&gt;
  
  
  JavaScript class methods and &lt;strong&gt;&lt;em&gt;this&lt;/em&gt;&lt;/strong&gt; keyword
&lt;/h2&gt;

&lt;p&gt;The "this" keyword in JavaScript classes is not as complicated as it seems. Let's see why. But we have to understand a few things first.&lt;br&gt;
• Class methods.&lt;br&gt;
• Constructors&lt;/p&gt;

&lt;p&gt;Each JavaScript class has a unique method called a &lt;strong&gt;constructor&lt;/strong&gt;.&lt;br&gt;
Only one constructor is allowed in each class, and its function is to define the initial state of a class.&lt;br&gt;
Another property of a class is a method. A single class can have several of these. &lt;strong&gt;Methods&lt;/strong&gt; define the behavior and actions of the resulting object.&lt;br&gt;
A class can lack methods, but a constructor must be included otherwise, the class creates an empty object when initialized.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person {
  constructor(name, gender){
    this.name = name;
    this.gender = gender;

  }

}
const james = new Person ("James","Male");
console.log(james) // Person { name: 'James', gender: 'Male' };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's add more functionality to our object person. The resulting person should be able to greet people. Right?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person {
  constructor(name, gender){
    this.name = name;
    this.gender = gender;

  }
  sayHi(){
    console.logHi friend? I am ${this.name}. I am ${this.gender}.);
  }

}
const james = new Person ("James","Male");
console.log(james); // Person { name: 'James', gender: 'Male' }
   james.sayHi();   //   Hi friend? I am James. I am Male

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The method now allows our resulting object to be a bit dynamic. Try initializing the code with different details. Compare the output from the two instances. How different are the results? Each instance is meant to be unique and independent of all other instances.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const james = new Person ("James","Male");
const james = new Person ("Lucy","Female");

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the examples, methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;are defined within a class.
&lt;/li&gt;
&lt;li&gt;Have access to class data, state, and other class methods.&lt;/li&gt;
&lt;li&gt;can take arguments.
&lt;/li&gt;
&lt;li&gt;are invoked on instances/ are independent of each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Understanding the "this " keyword in a class
&lt;/h3&gt;

&lt;p&gt;The keyword "this" in a class represents the resulting object (current instance). For example, if we console logged "this" within the constructor, like in the code below, the output is an object that holds the details of the resulting object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;// Output &lt;br&gt;
Person { name: 'James', gender: 'Male' }&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
class Person {
  constructor(name, gender){
    this.name = name;
    this.gender = gender;
    console.log(this) // Person { name: 'James', gender: 'Male' };

  }
}
const james = new Person ("James","Male");
console.log(james) // Person { name: 'James', gender: 'Male' };
}
const james = new Person ("James","Male");
console.log(james) // Person { name: 'James', gender: 'Male' };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two console logs print out the same thing. &lt;code&gt;Person { name: 'James', gender: 'Male' }&lt;/code&gt;.  Which is the current instance. Therefore, this refers to the created object (class instance)&lt;/p&gt;

&lt;p&gt;When we initialize a new class, a blank object &lt;code&gt;Person{}&lt;/code&gt; is created, and the "this" keyword of the class is then used to assign values to the newly created object. In a constructor, it is mostly used to define where class states are stored when a class is initialized.&lt;br&gt;
Example&lt;br&gt;
&lt;code&gt;this.name&lt;/code&gt; in the example below creates a persistent instance property for each created object and stores the assigned property “name” of each instance.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const james = new Person ("James","Male"); // initializing a class&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;code&gt;this.name = name; //saves property "name" on this.name instance.&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Sharing class instances between classes or between a class and a function
&lt;/h3&gt;

&lt;p&gt;On mastering these basics, it is intuitive how to manipulate classes. For example, let us try to share a class instance between a class and a function.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sayGreetersName(user){
  console.logyour name is ${user.name}.); 
}
class Person {
  constructor(name, gender){
    this.name = name;
    this.gender = gender;
   }

checkName(){
  sayGreetersName(this)
}
}
const james = new Person ("James", "Male")
james.checkName();
// Output - your name is James. Outputs the value “James” as assigned to an instance //property “name”.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The key takeaway from the lessons is that a class is a template for creating an object.&lt;/p&gt;

&lt;p&gt;A constructor helps us define the initial state of our object. A class without a constructor creates an empty object.&lt;/p&gt;

&lt;p&gt;Methods add functionality to the resulting object.&lt;/p&gt;

&lt;p&gt;Understanding "this" keyword in a class allows us to manipulate JavaScript classes better.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>JavaScript Classes: Like a pro-1</title>
      <dc:creator>Jymo</dc:creator>
      <pubDate>Mon, 24 Mar 2025 16:32:17 +0000</pubDate>
      <link>https://dev.to/jamesmatheri/javascript-classes-like-a-pro-oi1</link>
      <guid>https://dev.to/jamesmatheri/javascript-classes-like-a-pro-oi1</guid>
      <description>&lt;p&gt;Classes in JavaScript is a relatively complex topic for most people working with or learning JavaScript. Most tutorials try to simplify the topic but, unfortunately, end up complicating the topic for most of us. I think the best way to get done with this topic once and for all is to concentrate on the things most tutorials don’t talk about, important terms about JavaScript classes. Example, state, and instances of a class. Most people who are relatively new to programming may not initially get an intuition of what these terms mean in programming, but we will try to keep things as simple as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  The lesson might be long, so we will divide it into several articles.
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Learning goals:&lt;/strong&gt;&lt;br&gt;
      What is a class?&lt;br&gt;
      What does a class do?&lt;br&gt;
      What is initializing a class?&lt;br&gt;
      Difference between a constructor and a super&lt;br&gt;
      What is an instance of a class?&lt;br&gt;
      What is a state in a class?&lt;br&gt;
      When to and not use this in a class.&lt;br&gt;
      What is a class?&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;class&lt;/strong&gt; in &lt;em&gt;&lt;strong&gt;object-oriented programming (OOP)&lt;/strong&gt;&lt;/em&gt; is a template. It acts as a predefined framework that simplifies and standardizes the creation of objects. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User {
  constructor (name, age, occupation) {
    this.occupation = occupation;
    this.name = name;
    this. age = age;

  }
}
const user1 = new User ("john" , 25, "chef");
console.log(user1);
 // output: User { occupation: 'chef', name: 'john', age: 25 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As seen from the output, we can create a concrete object from the class blueprint. Or what we call a &lt;strong&gt;class instance&lt;/strong&gt;.&lt;br&gt;
A &lt;strong&gt;class instance&lt;/strong&gt; is a single, concrete object created from a class blueprint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This is a class instance.
User { occupation: 'chef', name: 'john', age: 25 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How to Create an Instance&lt;/strong&gt;&lt;br&gt;
We use the new keyword:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user1 = new User ("john" , 25, "chef");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each class instance holds data. For example, this class holds the data concerning our first object. That is the name, age, and occupation of our first user, John. This data is what is referred to us as the &lt;strong&gt;state&lt;/strong&gt; of a class.&lt;br&gt;
A &lt;strong&gt;state&lt;/strong&gt; refers to the data (properties) stored inside an object at any given time. It represents the object's current condition or configuration.&lt;br&gt;
The first instance of a class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User {
  constructor (name, age, occupation) {
    this.occupation = occupation;
    this.name = name;
    this. age = age;

  }
}
const user1 = new User ("john" , 25, "Chef");
console.log(user1);
//Below is the first instance of our class User and its state.
 // output: User { occupation: 'Chef', name: 'john', age: 25 }
The second instance of a class:
class User {
  constructor (name, age, occupation) {
    this.occupation = occupation;
    this.name = name;
    this. age = age;

  }
}
const user2 = new User ("James”, 13, "Student");
console.log(user2);
// Below is the second instance of our class User and its state.
 // output: User { occupation: 'Student', name: 'James, age: 13 }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Updating State&lt;/strong&gt;&lt;br&gt;
The state of a class can be modified after object creation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user2 = new User ("James”, 13, "Student"); // creating user2
user2.age = 26; // updating age state of user2 once user2 has been created
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the examples, you can see why we are referring to a class as a template. We are able to create several objects (class instances) from a single class initialization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Characteristics of instances and states&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Class Instances and why they are useful.
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Instances allow us to create numerous objects where each class has its own state. It is important to note that each instance of a class is different from its predecessor in that it has its own copy of properties.&lt;/li&gt;
&lt;li&gt;Instances share method. Methods are like functions and are a major property of a class. Learn about them in the next article, where we learn how to appropriately use this in a class.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;State and why it is useful.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; We can update the state of a class. Refer to the example given earlier in the article.&lt;/li&gt;
&lt;li&gt; The state of a class is used to cause dynamic behavior of class methods based on the prevailing state of a class. &lt;a href="https://dev.to/jamesmatheri/javascript-classes-like-a-pro-2-4d64"&gt;See the next lesson&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; Encapsulation—allows for each class instance to be manipulated independently without interfering with other class instances available at a given time.&lt;/li&gt;
&lt;li&gt; Memory Efficiency—possible to apply different coding patterns, e.g., the flyweight pattern, to effectively conserve space when working with class instances.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
I hope understanding these terms helps demystify classes. If this article was helpful, check the follow-up article(&lt;a href="https://dev.to/jamesmatheri/javascript-classes-like-a-pro-2-4d64"&gt;JavaScript Classes: Like a pro-2&lt;/a&gt;) where we look at &lt;strong&gt;&lt;em&gt;class methods&lt;/em&gt;&lt;/strong&gt; and the &lt;strong&gt;&lt;em&gt;this&lt;/em&gt;&lt;/strong&gt; property of JavaScript classes.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>The Thin Line Between Web Development and UI/UX Design</title>
      <dc:creator>Jymo</dc:creator>
      <pubDate>Tue, 18 Mar 2025 17:25:08 +0000</pubDate>
      <link>https://dev.to/jamesmatheri/the-thin-line-between-web-development-and-uiux-design-5bnp</link>
      <guid>https://dev.to/jamesmatheri/the-thin-line-between-web-development-and-uiux-design-5bnp</guid>
      <description>&lt;h3&gt;
  
  
  Despite being a good developer, I could not deliver a project. As a web developer.
&lt;/h3&gt;

&lt;p&gt;If you are yet to work with UI/UX designers, it is easy for you to overlook their purpose in a project. In this article, we appreciate the UI/UX designers and look at the need to keep taking note of common UI/UX development patterns as web developers.&lt;/p&gt;

&lt;p&gt;I have been disregarding UI/UX design since I started learning web development at the Odin project. I should have known better; it was the basis of a project, the cornerstone of most projects, and the tool that allows stakeholders, developers, product managers, and marketers to work in harmony.&lt;/p&gt;

&lt;p&gt;I am sure I am not the only one who has been overlooking UI/UX designs and the role of web app designers. Clients and other developers must be doing it too. Clients may disregard UX/UI developers for two reasons. First, they may consider it as an unnecessary cost, or most clients are unable to distinguish the important role played by web developers and web designers in a project. This has left me wondering, how many freelance web developers charge for web development and web design separately?&lt;/p&gt;

&lt;h3&gt;
  
  
  Difference between web developers and web designers (UI/UX designers)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Web developers:&lt;/strong&gt; are responsible for the technical implementation of a website or application. They write code, build databases, and ensure that the site functions smoothly across devices and browsers. Their expertise lies in programming languages like HTML, CSS, and JavaScript, and frameworks like React or Angular.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. UI/UX Designers:&lt;/strong&gt; on the other hand, focus on the user experience and interface design. They create wireframes, prototypes, and visual designs that prioritize usability, accessibility, and aesthetics. Their goal is to ensure that users can navigate the product effortlessly and enjoy the experience.&lt;/p&gt;

&lt;p&gt;It is unfortunate for me that it had to take an experience for me to bow to the reality that a perfect project is a result of a perfect blend of good web development and UI/UX design skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning UI/UX is equally important.
&lt;/h3&gt;

&lt;p&gt;Late last year a friend in the web development field entrusted a project to me as a way of showing support and welcoming me into the field of web development. The project involved editing a popular theme, PHPTRAVELS, to suit the client's needs. The hardest part of the project was mastering the technologies used in the theme, that is, PHP, Laravel, jQuery, and a few others. So, I thought. In a few weeks, I had mastered all the corners of the project, both front-end and back-end. I could make any changes to the project in a blink. However, there was an issue. My progress in changing the theme to suit what the client desired was questionable. &lt;/p&gt;

&lt;p&gt;Weeks passed and there was very little to show for it. I was not satisfied with the already completed sections. Some components were complex and served no purpose. Sections were not fitting in as desired. How? And I am a good coder/web developer. I believe in my skills 🤗. I was wasting a lot of time with less to show for it.&lt;/p&gt;

&lt;p&gt;I had to take a break and figure out the dilemma. Turns out, I was mostly wasting a lot of time coding and dismantling sections. There was a lot of unnecessary code and components that were trying to communicate my coding prowess but were neither aesthetically nor functionally fit for the project. The issue: I did not have a blueprint for the project. I wasted a lot of time hopping from one website to the other seeking design inspirations for the website. The result was a lot of experimenting, a lot of moving back and forth, and very complicated code that would not be so useful to the end user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Design Matters
&lt;/h3&gt;

&lt;p&gt;After my ordeal, I have come to appreciate the role the UI/UX designers play. They may be expensive, but the repercussions of not having one are costlier. Some of the advantages of having a UI/UX designer include: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Providing a Clear Blueprint for Development&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no more building in the dark among developers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;- Reducing Development Time and Costs&lt;/strong&gt; - like in my case, I experimented a lot with the web development trends; I tried to fit it all in the project but ended up wasting a lot of time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Bridging the Gap Between Creativity and Technical Feasibility&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;there should be a balance between aesthetics and functionality.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;- Creating User-Centered Designs&lt;/strong&gt; — They can anticipate user behavior and create designs that feel natural and effortless to navigate. easy-to-use features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Collaboration and Communication&lt;/strong&gt; — where designs of a project are available, there is better collaboration among stakeholders, developers, product managers, and marketers. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Ensuring Consistency Across the Product&lt;/strong&gt; —  of UI/UI designs leads to better adherence to product designs and guidelines among developers. &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: A Call to Action
&lt;/h3&gt;

&lt;p&gt;My urge to developers is to start working towards understanding basic aspects of UI/UX design. They must learn how to work with application design tools like Figma, Adobe XD, Sketch, InVision Studio, Axure, Webflow, Canva, and the like.&lt;/p&gt;

&lt;p&gt;My vow is to always work on UI/UX designs first before diving into coding a project.&lt;/p&gt;

&lt;p&gt;The greatest lesson I picked through this ordeal is that clients' needs are first met through a proper and perfect UI/UX design because the design phase is where the vision, functionality, and user experience of a product are defined.&lt;/p&gt;

&lt;p&gt;My final appeal is before investing in a web developer, consider investing in quality web design.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
