The Foundation of Well-Written Code: Structure
Start writing a post
Lifestyle

The Foundation of Well-Written Code: Structure

An examination of how programming languages are similar to verbal language, how code is inherently structured through programming paradigms, and how organized (structured) code is beneficial.

15
The Foundation of Well-Written Code: Structure
Hind SCC

Learning code, as the stereotypical saying goes, is a lot like learning a foreign language. Programming languages have developed over time like spoken ones do and while the goal of spoken languages is to communicate verbally with other human beings, the objective of code is to program instructions. There are hundreds of programming languages, some not used anymore, some highly developed over time, that are so similar and yet so different from each other. Some of the languages are extremely extensive (C#, C++, Java, Python, etc.), whereas others were made just to have fun, known as esoteric languages (Whitespace, INTERCAL, Piet, AAAAAAAAAAAAAA!!!!, etc.). Each language contains its own set of terms and rules, however the structure of the code is the most essential part of making it work.


A way to organize code is through the use of UML. UML (Unified Modeling Language) is used to visualize the design of a system. It has various types of diagrams that can show the structure or behavior of the system. The main diagram for object-oriented programming is the class diagram. A class box represents three compartments: the top is the class name, the middle is the class attributes (objects), and the bottom is the class methods. UML uses different arrows and lines to show relationships between classes, such as if a class inherits another or if a class is dependent on another.

Many programmers working with object-oriented programming begin not with actual code, but a UML (or other) design in order to organize their code and view the overall picture of what is required to code in each class and how to connect classes. This is essential in group projects where different programmers can work on different classes that rely on each other due to knowing how their classes interact and how the different objects and methods are called.

UML is not used solely for object-oriented programming. There are various other diagrams such as the component diagram, which shows how components are wired together, the activity diagram, which shows the flow of different actions step-by-step, and the sequence diagram, which shows how objects are ordered and how they interact with each other. UML can be used by many, if not all programming languages, and it is even used outside of code (patient healthcare systems, transportation, defense, etc.) as it is meant to be general purpose.



Report this Content
This article has not been reviewed by Odyssey HQ and solely reflects the ideas and opinions of the creator.
the beatles
Wikipedia Commons

For as long as I can remember, I have been listening to The Beatles. Every year, my mom would appropriately blast “Birthday” on anyone’s birthday. I knew all of the words to “Back In The U.S.S.R” by the time I was 5 (Even though I had no idea what or where the U.S.S.R was). I grew up with John, Paul, George, and Ringo instead Justin, JC, Joey, Chris and Lance (I had to google N*SYNC to remember their names). The highlight of my short life was Paul McCartney in concert twice. I’m not someone to “fangirl” but those days I fangirled hard. The music of The Beatles has gotten me through everything. Their songs have brought me more joy, peace, and comfort. I can listen to them in any situation and find what I need. Here are the best lyrics from The Beatles for every and any occasion.

Keep Reading...Show less
Being Invisible The Best Super Power

The best superpower ever? Being invisible of course. Imagine just being able to go from seen to unseen on a dime. Who wouldn't want to have the opportunity to be invisible? Superman and Batman have nothing on being invisible with their superhero abilities. Here are some things that you could do while being invisible, because being invisible can benefit your social life too.

Keep Reading...Show less
houses under green sky
Photo by Alev Takil on Unsplash

Small towns certainly have their pros and cons. Many people who grow up in small towns find themselves counting the days until they get to escape their roots and plant new ones in bigger, "better" places. And that's fine. I'd be lying if I said I hadn't thought those same thoughts before too. We all have, but they say it's important to remember where you came from. When I think about where I come from, I can't help having an overwhelming feeling of gratitude for my roots. Being from a small town has taught me so many important lessons that I will carry with me for the rest of my life.

Keep Reading...Show less
​a woman sitting at a table having a coffee
nappy.co

I can't say "thank you" enough to express how grateful I am for you coming into my life. You have made such a huge impact on my life. I would not be the person I am today without you and I know that you will keep inspiring me to become an even better version of myself.

Keep Reading...Show less
Student Life

Waitlisted for a College Class? Here's What to Do!

Dealing with the inevitable realities of college life.

106206
college students waiting in a long line in the hallway
StableDiffusion

Course registration at college can be a big hassle and is almost never talked about. Classes you want to take fill up before you get a chance to register. You might change your mind about a class you want to take and must struggle to find another class to fit in the same time period. You also have to make sure no classes clash by time. Like I said, it's a big hassle.

This semester, I was waitlisted for two classes. Most people in this situation, especially first years, freak out because they don't know what to do. Here is what you should do when this happens.

Keep Reading...Show less

Subscribe to Our Newsletter

Facebook Comments