Android Programming Taught Me Everything I Need to Be a Programmer

Android programming has equipped me with everything I need to become a software engineer. Starting in July, I will embark on my first professional Android development career. I am both excited and nervous, but I have been preparing by building my own Android project using Java.

For me, Android is not just an operating system; it’s a phenomenon, a beauty, and a philosophy. My first professional programming experience was with Java and the Spring Framework. Initially, I struggled to grasp the systematic mechanisms of OOP, which made me a less effective programmer.

However, as I gained more experience, I began coding in Android Studio two years ago. Fortunately, since Java is one of the main languages for building Android apps, it didn’t take long for me to familiarize myself with mobile app development.

MVVM, the standard architecture for modern mobile app development in Java/Kotlin, has been integral to my progress in this field.

Android Room redefined my programming journey:

Two years ago, I began coding my first Android portfolio project, which I am currently revitalizing. This project marked my first interaction with the Android Room architecture. For those unfamiliar with it, let me explain.

Android Room is Google’s recommended approach for developers to create an internal database within a local app. It uses annotations specifically designed for databases and tables, automatically handling the creation and deletion of these databases and tables.

Below is a sample entity class that indicates to the IDE that this will be a table named “sample_table” using the @Entity annotation.

Similarly, the @ColumnInfo annotations specify that these are columns within the table.

Since this is an entity, you can add getters, setters, and constructors as needed.

@Entity(tableName = "sample_table")
public class SampleTable implements Serializable {

    @PrimaryKey(autoGenerate = true)
    private int id;

    @ColumnInfo(name = "date")
    private String date;

    @Nullable
    @ColumnInfo(name = "store_name")
    private String storeName;

This is a database class, specified with the @Database annotation. Since it represents a database, you can include entity classes that will act as its tables.

@Database(entities = {SampleTable.class, SampleTable2.class, }, version = 1, exportSchema = false
)
public abstract class SampleDatabase extends RoomDatabase {

This is a DAO (Data Access Object) class, specified with the @Dao annotation. As you might guess, this class directly interacts with the database, performing CRUD operations with annotations such as @Insert, @Update, @Delete, and @Query.

@Dao
public interface SamplegDao {

    //CRUD
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    void insert(SampleTable sampleTable);

    @Query("DELETE FROM sample_table")
    void deleteAll();

    @Update
    void updateSampleTable(SampleTable sampleTable);

    @Delete
    void deleteSampleTable(SampleTable sampleTable);

    @Query("SELECT * FROM sample_table ORDER BY store_name ASC")
    LiveData<List<SampleTable>> getAllSampleTableList();

Similarities with Spring:

Reflecting on it, I realized that the Spring Framework also relies heavily on its own set of annotations. When I first encountered Spring through my job, I didn’t give much thought to it. With my limited understanding of programming at the time, I was simply copying, pasting, and making minor adjustments to classes.

However, by coding the Android app from scratch and learning its fundamental architectures, I began to appreciate the significance of those annotations I had seen in Spring. This understanding led me to recognize that the Java used for Android development is a customized version of the versatile language, and that Android itself is a framework.

This realization was a wake-up call for me, deepening my interest in the world of Android development.

LAMP (Linux, Apache, MySQL, PHP):

Since Kotlin is the official language of Android development, I felt compelled to create another Android portfolio using Kotlin. This led to my first experience building a backend Linux server from scratch. Initially, when I searched on Udemy, most backend server tutorials focused on WAMP. By learning WAMP from scratch and understanding the basics of PHP, I also watched some YouTube videos on LAMP to learn how to build it myself.

LAMP is highly technical and requires extensive knowledge not only about programming but also about Linux in general, so I won’t go into detail. Briefly, LAMP uses PHP as its API. Within these PHP files, you can write SQL queries that interact with the MySQL server on Linux and return the queried results to the client app.

Once again, Android app development inspired me to explore the LAMP architecture. The entire process of building everything from scratch by myself was both fun and exciting.

Main thread and Background thread:

The main thread in Android, known as the UI thread, should remain unblocked while background threads handle network or database operations.

The background thread is responsible for network operations, file I/O, and database operations. These operations should be independent of the main thread to ensure the UI remains responsive while the app performs complex backend tasks.

Callbacks are a method for managing asynchronous operations. In an asynchronous operation, it’s crucial to keep the main thread unblocked while the backend operation runs independently. To handle these tasks, you may want to create specific callback classes.

And this is the operation I learned through the original Android project.

Conclusion:

Starting in July, I will begin a new job as an Android programmer. My preparations and personal projects have provided me with a deep understanding of not only Android programming but also programming in general. From annotations to threads and everything in between, the knowledge I have gained through Android programming has been immense, and my journey continues.

Android all the way!!

Leave a Reply