Tag Archives: public post

“The lady doth protest too much, methinks”

(Week 11)

If you can’t guess from the very obvious title, this post will be on Angular.

Sorry Shakespeare, nobody cares.

Old timey meme with some peasant farmers gesturing at a field saying, "Behold! The field in which I grow my fucks. Lay thine eyes upon it and thous shall see that it is barren."

If you have happened across my last post, you will know how new I am to Angular. If you had not, I am brand spanking new. As the responsibility to know Angular for one of my projects was thrust upon me, my React-laced soul was ripped in two and I dramatically prepared myself for the worst.

Woe… WOE.

Lucille Bluth pretending to faint with the caption, "Faints in Spanish."
Oh, Lucille you! (At least I think this is Lucille Bluth)

So why am I doing a post on something I am new at and already have an unnecessarily dramatic negative attachment to? Once upon a time, I heard somewhere from someone much smarter than me that to really learn and know a topic is to be able to successfully talk about and teach that topic. So here I am, so brave.

Alright, let’s get down to the brass tax (also what is brass tax?).

What is Angular?

Angular is an open-source platform that utilizes Typescript and allows for the simplified building of web applications.

Angular focuses on the use of components, templates, dependency injection, and other tools to get the job done.

What are components?

A component is a building block that you may use to create an Angular application. Components control an area on the screen and may be used multiple times throughout the application, achieving reusability and modularity. A component consists of three things:

  • A class
  • A template
  • And a style sheet

Here is an example I coded of a simple Leaflet map component:

Screenshot of my simple map component code.

What are templates?

A template acts as a companion to a component and describes the view of that component. This view is in the form of good ol’ HTML.

In Angular, there is a view hierarchy that starts with the root template and branches down to other nested templates.

Here is an example of a table template for a table component that utilizes Angular Material UI:

Screen shot of some code I made in an Angular app for a table template.

What is dependency injection?

Do you lay awake at night worrying about instantiating your objects? Lose sleep no more as Angular has you covered with dependency injection!

All you need to do is declare your dependencies, and Angular does the rest allowing for more flexibility in code.

I have not really done any dependency injection yet, so here is a source I feel is straightforward in explaining it better than I could at the present moment.

I’d like to say more, but I am strapped for time due to my pursuit of graduating with a decent GPS and trying REALLLYYYY hard not to check out (aka lots of projects).

Ta ta for now!

Meme of Tony Stark rolling his eyes with words that say, "Bye! See you next time"
Just kidding, you are still here so obviously you are awesome and I am grateful. Ok bye for real!


(Week 9)

I’m not going to lie, I am not very certain as to what to do here… How does one remix code? Hmm…

Actually… Hello, StackOverflow!

It’s a love-hate relationship a developer has with StackOverflow. A programmer’s paradise or hell, paradise if you find the exact code snippet or solution you are looking for, hell if you post and you get a bunch of comments about how your question is stupid (another meme about stupid questions).

Meme about stackoverflow.com and how everyone hates you and won't answer your question.

What I do every day when I “borrow” code from StackOverflow is essentially remixing. I take what they present and add, subtract, and modify what I need to fit into the big picture that is the program. Like a song remixed with other snippets of songs, or a new rendition of a song, or an autotune song of some poor fellow trying desperately to become a Jedi, remixing code is really quite similar. Let me show you!

This is my problem, like those super relatable and very useful wordy math questions we all loved in high school, I have TOO MANY FLAMINGOS. I am yelling because I cannot keep track of them and honestly I am this close to sending them to a river upstate (upprovince??). To calm my frail nerves, besides popping alprazolam, I decide to keep a list of all my flamingo’s names, and I want to sort them in reverse alphabetical order. Why does this help? I find the end of the alphabet soothing (I like introverts).

Today we are using Typescript. Here is a string array of the names of my flamingos:

var myFlamingos = ["scotty", "rotty", "one eye", "begonia", "flabber jacks", "hakuna", "ma ta ta", "what a wonderful phrase", "pink", "rubber duck", "josh"];

Cool, now what? I have suddenly forgotten how to sort this list in reverse alphabetical order. Help!

Let’s hop over to StackOverflow. Actually, correction. Let’s hop over to Google to find what we need on StackOverflow because StackOverflow’s search algorithms are crap:

Snapshot of a Google search

That second link looks promising!

Bam it’s right there:

Snapshot of an answer on stackoverflow.com

Let’s steal “remix” it and put it into our code:

var myFlamingos = ["scotty", "rotty", "one eye", "begonia", "flabber jacks", "hakuna", "ma ta ta", "what a wonderful phrase", "pink", "rubber duck", "josh"];

var myDescFlamingos = myFlamingos.sort().reverse();
console.log(myDescFlamingos.toString()); // let's log these bad boys  

And this is my output:

what a wonderful phrase,scotty,rubber duck,rotty,pink,one eye,ma ta ta,josh,hakuna,flabber jacks,begonia

Ahhh, relief. I can feel myself sinking deeper into my ugly ergonomic mesh office chair already.

I like to make jokes about stealing, but for those that are not programmers, it’s not really stealing, it’s “sharing and obtaining information.” If you asked any programmer if they could fix what they needed to fix without StackOverflow, they would probably scoff like it’s no big deal and then hobble into a soothing corner of their mom’s basement to begrudgingly read the man pages/docs and drink stale mountain dew (I don’t know).

Anywho, thanks for reading!