Abstraction in WordPress

I listened about the ADTs in my college last semester in subject JAVA. What I know about it is like “An abstract data type is a collection of data and operations that work on that data.” just this Definition. I don’t think any of the student thought about this topic and researched about it. Because it is not a major topic for exams. I also do not know what it is, while reading the Code Complete 2” in the chapter 6 it is all about the ADTs. It is about how programmers create classes with loosely related functions in it, loosely connected data. This type of classes are just easy to create but hard to keep up in future.

In the book there is an example of changing a particular font size from point to pixel and changing it to bold  by creating a particular ADT for that having all the class that can manipulate all the data and can interact like the real world. As I am working on the WordPress so in my example there is a WordPress feature  that have the manipulating function so I can relate with them.

Last time when I am working on the custom posts type creation for a particular post type I came across with the loop of WordPress that have many functions you can use. You just have to think what you want in the code if you need the Title of the post here is the function “get_the_title()”, If you want permalink to add with the an anchor tag just type “get_permalink()”.

The loop is an ADT but if the classes have functions like this then I am sure everyone love to use that module and love to work with and what I read about the Abstraction data types is the same about the abstraction that I am not taking the links or title from the database directly I’m just going through a function and retrieving the data.

If we look at the function get_title() what it explains that it will return the title of the current post and yeah it does it. In WordPress if you are a newbie like me and you are thinking that how you gonna remember the names of the classes/functions so I bet you it is easier to remember the name of functions.

Creating Features in WordPress

Work On The Authentication Plugin

WordPress powers more than 24% of the web  a figure that rises every day. Everything from simple websites, to blogs, to complex portals and enterprise websites, and even applications, are built with WordPress. WordPress is an easy to use framework have simplicity for the users.

I am still exploring the features that WordPress can do. In WordPress there is a feature to add plugins that can increase the features of the WordPress.
In my project at ColoredCow I was asked to create some functionality that can Authenticate users via Google so that we can get access to the Admin Panel by our google ids of that company. Are you thinking that why a firm/company needs the google login system and not using the WordPress’s inbuilt login system. 

What if we use a SSO(Single Sign on) system for the users. It is convenient to the users and employees to log in to the website admin panel.  The idea behind this is to create an automation system for creating new users. A new Employee joined the Company he have the Google Id of that firm so he can get access to the Admin Panel. And there is no need create a new user manually. Like in WordPress Login System we have to go to the users and add a new user. Unlike in our system if you have Companies google id you can access the admin panel.  

In the above discussion a new plugin comes up that is Role Defining plugin. If a new user is login and can access the Admin Panel what features he can access and what type of role is given to him. As the inbuilt roles in WordPress are not good enough for a company so we have to create a new plugin for just to define the roles.In these Plugins the main thing is that to provide the convenience to the user. So that they can get access to Admin Panel via their google IDs.

Work On The Authentication Plugin
Work On The Authentication Plugin

Above is a screenshot of my work on the Authentication Plugin. By this we can Sign in with Google.

Why to start from Basics

When I started working on the project we are given started the project from creating the Repository on GIT, installed the WordPress and pushed all the data in directory of WordPress to the repository (including the config. file with the passwords of database). Then in our code review, we find out that we are wrong, we just uploaded all the core files and with passwords along with it. And then I created a new repository and now I added a .Gitignore to ignore some files of WordPress like config file so I thought now I am in the right direction.
As I didn’t search about the basic that way to add WordPress git integration and how the only public file can be there in repository So I am just in the wrong direction again. Now we discussed about it with Vaibhav that how the Integration works then he told us that why we need the core files on the GIT they can be configured by the another contributor so why? then we got to know about the Composer that this is the thing we are missing we have to create a composer installation file that can configure all the WordPress files and we need to take care of just the public ones.

We can install WordPress on the remote server by composer. This is happening because we don’t know the basics. If we know why to integrate the WordPress and the How so that our details not be shared like our first repository. And next on we added PHP codes on the files to get access to the files, etc. in WordPress😛 ) means if we are working in the WordPress then why we used the PHP because we don’t know what the basic approach is to have there in a random project. So start from basics to get into it.

Building the Core

Great minds have tended to create and they are creative and curious about what’s happening. The thing that I love at ColoredCow that there are lots of people to guide us and love to create the environment that everyone can learn from each other and discuss ideas. In the software industry there is a lot to work and achieve the success. You can make it by two methods anyhow by Jugaad or by applying some principles and doing it in the right way. By Creating the models ideas. If we have a project we are asked that “How you going to achieve that, anyways or applying some principle and starting from the core”.

The “why” and “how” is the question here. I want to relate to the newton’s story that he discovered about the Gravity by falling of an apple. He asked himself the why and which is his idea of exploring. Three types of people can be there(or more maybe) if we discuss it that, the ones who is interested in the personality of the Issac Newton and talk about him or interested in the apple, second one who are discussing about his discovery details about gravity, the third one discuss on the “why” once again as the Einstein did on theory of relativity even if the Newton’s theory is accepted globally. Here the “why” is core. The quote

Great minds discuss ideas, average minds discuss events, small minds discuss people.

Work on your basics and make great things happen. As in our first Code Review they told about the core building. Start from the basics and start from asking questions.

Working On Git

WordPress is a famous CMS that based on PHP and MySQL. You can create blogs(just like this one) and websites for your own and yeah its free to use open source so you can install on your own server and make any changes to it. If you are working on a small project and only you are on the team so you can check all the code on your own Machine and put the code on the server.

But if you are working in a team and have to work on different features and may be your codes can be overlap then what you are going to do. Here we need GIT the very famous Version Control System that can track our codes and earlier versions. If you are working on different features you can create branches as well.

The Documentation on Git is the best place you can learn about it.On working on my very first live project in ColoredCow I am working in a team so that I have to learn GIT first to work smartly. So I just googled it out and remembered some commands and learn how to pull and push the code. KD gave a good explanation on GIT last day. And he said to set some rules to use GIT because sometimes it just overwritten our code with another teammate who just edited the code.

The Rules are :

  • Pull the Code
  • Push your Code
  • Write Code
  • Commit the New
  • Pull
  • Push

These steps are a healthy practice for a developer.

Getting into Software

The 1st chapter of the book Code Complete is What is Software construction, so what’s the term software construction means. Before it we have to understand what is a Construction. A Construction is a process of building, creating stuff. It is like planning, designing an architecture, creating something. As the many processes were used in the process of Construction so that in Software Construction.
Now the word software construction. It’s a process of Developing a Software within many phases. They include many steps like Problem definition, Requirement development, etc. This is what we have to do with our first task of developing a website for Hiring but we did it in different ways like we actually work on the whole part of the problem setup a server on AWS and installed WordPress and GIT on it and started the server and then we think what to do next and then we go to the Requirement phase and gathered some of the requirements.

But actually it has to be like first gather information about it how we create the website and mainly what is the requirement of the user here and then we have to go to the design and construction phase. But in the discussion with Prateek and KD I realized that we just did it in the reverse way. It is not going to happen like this.

The coding or testing phase is just the 10% of the Software Development process and another 90% is the information gathering and designing phases etc. They just related the whole part to the “Stone Soup” that’s how soldiers in the story feed themselves. Soldiers just created curiosity in the customers and make it happen. Soldiers found things in the installment, but got a good product to be shown. So apart from this the story tells that “Keep adding up smalls to create something large” do it in the parts.

Want something more on Stone Soup” my friend wrote an awesome blog about it.