Abstraction in WordPress

July 20, 2016

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.

Thanks for reading if you have any comments or feedback you can reach out to me on twitter.

Up Next