• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. Conceptualizing Data: Simplifying the way we think about complex data structures.

      Preface Conceptual models in programming are essential for being able to reason about problems. We see this through code all the time, with implementation details hidden away behind abstractions...

      Preface

      Conceptual models in programming are essential for being able to reason about problems. We see this through code all the time, with implementation details hidden away behind abstractions like functions and objects so that we can ignore the cumbersome details and focus only on the details that matter. Without these abstractions and conceptual models, we might find ourselves overwhelmed by the size and complexity of the problem we’re facing. Of these conceptual models, one of the most easily neglected is that of data and object structure.


      Data Types Galore

      Possibly one of the most overwhelming aspects of conceptualizing data and object structure is the sheer breadth of data types available. Depending on the programming language you’re working with, you may find that you have more than several dozens of object classes already defined as part of the language’s core; primitives like booleans, ints, unsigned ints, floats, doubles, longs, strings, chars, and possibly others; arrays that can contain any of the objects or primitives, and even other arrays; and several other data structures like queues, vectors, and mixed-type collections, among others.

      With so many types of data, it’s incredibly easy to lose track in a sea of type declarations and find yourself confused and unsure of where to go.


      Tree’s Company

      Let’s start by trying to make these data types a little less overwhelming. Rather than thinking strictly of types, let’s classify them. We can group all data types into one of three basic classifications:

      1. Objects, which contain key/value pairs. For example, an object property that stores a string.
      2. Arrays, which contain some arbitrary number of values.
      3. Primitives, which contain nothing. They’re simply a “flat” data value.

      We can also make a couple of additional notes. First, arrays and objects are very similar; both contain references to internal data, but the way that data is referenced differs. In particular, objects have named keys while arrays have numeric, zero-indexed keys. In a sense, arrays are a special case of objects where the keys are more strictly typed. From this, we can condense the classifications of objects and arrays into the more general “container” classification.

      With that in mind, we now have the following classifications:

      1. Containers.
      2. Primitives.

      We can now generally state that containers may contain other containers and primitives, and primitives may not contain anything. In other words, all data structures are a composition of containers and/or primitives, where containers may accept containers and/or primitives and primitives may not accept anything. More experienced programmers should notice something very familiar about this description--we’re basically describing a tree structure! Primitive types and empty containers act as the leaves in a tree, whereas objects and arrays act as the nodes.


      Trees Help You Breathe

      Okay, great. So what’s the big deal, anyway? We’ve now traded a bunch of concrete data types that we can actually think about and abstracted them away into this nebulous mess of containers and primitives. What do we get out of this?

      A common mistake many programmers make is planning their data types out from the very beginning. Rather than planning out an abstraction for their data and object architecture, it’s easy to immediately find yourself focusing too much on the concrete implementation details.

      Imagine, for example, modeling a user account for an online payment system. A common feature to include is the ability to store payment information for auto-pay, and payment methods typically take the form of some combination of credit/debit cards and bank accounts. If we focus on implementation details from the beginning, then we may find ourselves with something like this in a first iteration:

      UserAccount: {
          username: String,
          password: String,
          payment_methods: PaymentMethod[]
      }
      
      PaymentMethod: {
          account_name: String,
          account_type: Enum,
          account_holder: String,
          number: String,
          routing_number: String?,
          cvv: String?,
          expiration_date: DateString?
      }
      

      We then find ourselves realizing that PaymentMethod is an unnecessary mess of optional values and needing to refactor it. Odds are we would break it off immediately into separate account types and make a note that they both implement some interface. We may also find that, as a result, remodeling the PaymentMethod could result in the need to remodel the UserAccount. For more deeply nested data structures, a single change deeper within the structure could result in those changes cascading all the way to the top-level object. If we have multiple objects, then these changes could propagate to them as well. And what if we decide a type needs to be changed, like deciding that our expiration date needs to be some sort of date object? Or what if we decide that we want to modify our property names? We’re then stuck having to update these definitions as we go along. What if we decide that we don't want an interface for different payment method types after all and instead want separate collections for each type? Then including the interface consideration will have proven to be a waste of time. The end result is that before we’ve even touched a single line of code, we’ve already found ourselves stuck with a bunch of technical debt, and we’re only in our initial planning stages!

      To alleviate these kinds of problems, it’s far better to just ignore the implementation details. By doing so, we may find ourselves with something like this:

      UserAccount: {
          Username,
          Password,
          PaymentMethods
      }
      
      PaymentMethods: // TODO: Decide on this container’s structure.
      
      CardAccount: {
          AccountName,
          CardHolder,
          CardNumber,
          CVV,
          ExpirationDate,
          CardType
      }
      
      BankAccount: {
          AccountName,
          AccountNumber,
          RoutingNumber,
          AccountType
      }
      

      A few important notes about what we’ve just done here:

      1. We don’t specify any concrete data types.
      2. All fields within our models have the capacity to be either containers or primitives.
      3. We’re able to defer a model’s structural definition without affecting the pace of our planning.
      4. Any changes to a particular field type will automatically propagate in our structural definitions, making it trivial to create a definition like ExpirationDate: String and later change it to ExpirationDate: DateObject.
      5. The amount of information we need to think about is reduced down to the very bare minimum.
      6. By deferring the definition of the PaymentMethods structure, we find ourselves more inclined to focus on the more concrete payment method definitions from the very beginning, rather than trying to force them to be compatible through an interface.
      7. We focused only on data representation, ensuring that representation and implementation are both separate and can be handled differently if needed.

      SOLIDifying Our Conceptual Model

      In object-oriented programming (OOP), there’s a generally recommended set of principles to follow, represented by the acronym “SOLID”:

      • Single responsibility.
      • Open/closed.
      • Liskov substitution.
      • Interface segregation.
      • Dependency inversion.

      These “SOLID” principles were defined to help resolve common, recurring design problems and anti-patterns in OOP.

      Of particular note for us is the last one, the “dependency inversion” principle. The idea behind this principle is that implementation details should depend on abstractions, not the other way around. Our new conceptual model obeys the dependency inversion principle by prioritizing a focus on abstractions while leaving implementation details to the future class definitions that are based on our abstractions. By doing so, we limit the elements involved in our planning and problem-solving stages to only what is necessary.


      Final Thoughts

      The consequences of such a conceptual model extend well beyond simply planning out data and object structures. For example, if implemented as an actual programming or language construct, you could make the parsing of your data fairly simple. By implementing an object parser that performs reflection on some passed object, you can extract all of the publicly accessible object properties of the target object and the data contained therein. Thus, if your language doesn’t have a built-in JSON encoding function and no library yet exists, you could recursively traverse your data structure to generate the appropriate JSON with very little effort.

      Many of the most fundamental programming concepts, like data structures ultimately being nothing more than trees at their most abstract representation, are things we tend to take for granted and think very little about. By making ourselves conscious of these fundamental concepts, however, we can more effectively take advantage of them.

      Additionally, successful programmers typically solve a programming problem before they’ve ever written a single line of code. Whether or not they’re conscious of it, the tools they use to solve these problems effectively consist largely of the myriad conceptual models they’ve collected and developed over time, and the experience they’ve accumulated to determine which conceptual models need to be utilized to solve a particular problem.

      Even when you have a solid grasp of your programming fundamentals, you should always revisit them every now and then. Sometimes there are details that you may have missed or just couldn’t fully appreciate when you learned about them. This is something that I’m continually reminded of as I continue on in my own career growth, and I hope that I can continue passing these lessons on to others.

      As always, I'm absolutely open to feedback and questions!

      15 votes
    2. Careem privacy policy

      i was reading careem's privacy policy (yeah using the app from yeah & didn't read privacy policy yet) & i found they collect almost everything & sharing it with 3rd parties & while dragging down i...

      i was reading careem's privacy policy (yeah using the app from yeah & didn't read privacy policy yet) & i found they collect almost everything & sharing it with 3rd parties & while dragging down i saw "access your info" section i found they want from you money to send you a copy of your data (WTF ARE YOU KIDDING ME, YOU STEALING MY DATA & WANT MONEY TO REQUEST MY DATA) so its so mean from careem to get money to give you right its already free & its collect your data so its very bad move so i decided to use Uber within browser (in new profile in firefox) to stop uber from stealing my data in phone & to be more safe what guys you think ? browser in more safer right ?

      EN version(of pic that says careem need money to send you your data): https://i.ibb.co/LYfqFbn/Screenshot-2019-03-30-20-06-52.png

      AR version(of pic that says careem need money to send you your data): https://i.ibb.co/rsnRNzm/Screenshot-2019-03-30-20-11-03.png

      Careem's Privacy policy (in case you not trust me xD): https://www.careem.com/en-ae/privacy/ & Ar version: https://www.careem.com/ar-ae/privacy/

      3 votes
    3. MLS Week 5: All Match Discussions

      NYCFC @ Toronto FC NYRB @ Chicago Fire MNUFC @ New England Montreal @ Sporting Kansas City LAFC @ San Jose Philadelphia Union @ FC Cincinnati Atlanta United @ Columbus Crew Houston Dynamo @...

      NYCFC @ Toronto FC
      NYRB @ Chicago Fire
      MNUFC @ New England
      Montreal @ Sporting Kansas City
      LAFC @ San Jose
      Philadelphia Union @ FC Cincinnati
      Atlanta United @ Columbus Crew
      Houston Dynamo @ Colorado Rapids
      FC Dallas @ Real Salt Lake
      Seattle Sounders @ Vancouver Whitecaps
      DC United @ Orlando City
      Portland Timbers @ LA Galaxy

      5 votes
    4. This week's album and EP releases

      Here's a list of a lot of things that came out in this past week, including many which are set to release on Friday. Of course, there's no way to be completely comprehensive with this and I...

      Here's a list of a lot of things that came out in this past week, including many which are set to release on Friday. Of course, there's no way to be completely comprehensive with this and I avoided including things where information was too lacking, so feel free to mention anything that isn't on here that you think is worth mentioning. Beyond that, if you have any thoughts of any of these albums, it would be great to hear them :)

      (oh and don't bully me for the genre tags, a lot of these things have very limited resources available and I couldn't individually listen to everything and determine what fits best, so I'm pulling from third parties and an artist's past work a lot of the time)


      03 Greedo & Mustard - Still Summer in the Projects (West Coast Hip Hop, Trap Rap)

      1TEAM - HELLO! (K Pop)

      A Brilliant Lie - Threads: Weaver (Alternative Rock, Pop Punk)

      American Pleasure Club - Fucking Bliss (Post-Industrial, Ambient Pop, Drone)

      Ben Platt - Sing To Me Instead (Pop)

      Betty Carter- The Music Never Stops (Vocal Jazz)

      Billie Eilish - When We Fall Asleep, Where Do We Go? (Alternative R&B, Electropop)

      Borleone - Hard to Kill (Trap Rap)

      Brutus - Nest (Post-Hardcore, Alternative Rock)

      C Duncan - Health (Indie Pop, Indie Rock)

      Carcer City - Silent War (Metalcore)

      Chris Cohen - Chris Cohen (Singer-Songwriter, Indie Pop)

      Clint Alphin - Straight to Marrow (Singer-Songwriter, Bluegrass)

      Coughy - Ocean Hug (Indie Pop)

      DJ Muggs & Mach-Hommy - Tuez-Les Tous (East Coast Hip Hop)

      Devin Townsend - Empath (Progressive Metal, Avant-Garde Metal)

      Facs - Lifelike (Post-Punk Revival)

      Fennesz - Agora (Ambient, Electroacoustic)

      Fredo Bang - Big Ape (Trap)

      Garcia Peoples - Natural Facts (Psychedelic Rock, Roots Rock)

      George Strait - Honky Tonk Time Machine (Country)

      I Prevail - TRAUMA (Metal Core)

      ILL BILL - Cannibal Hulk (East Coast Hip Hop, Hardcore Hip Hop)

      Ian Simmonds - All That's Left (Downtempo, Jazz)

      JBJ95 - Awake (K Pop)

      Jake Miller - Based on a True Story. EP (Pop)

      Jake Owen - Greetings from...Jake (Bro Country)

      Jamie Lawson - The Years In Between (Singer Songwriter)

      Jo Schornikow - Secret Weapon (Ambient Pop, Indie Pop)

      K Á R Y Y N - The Quanta Series (Art Pop, Glitch Pop)

      L.A. Guns - The Devil You Know (Hard Rock, Glam Metal)

      LION BABE - Cosmic Wind (Contemporary R&B)

      La Bouquet - Sad People Dancing (Contemporary R&B)

      Laura Stevenson - The Big Freeze (Indie Folk, Folk Rock)

      Lil Debbie - Bay Chronicles (Trap Rap)

      Logic - Supermarket (Soundtrack) (Indie Pop, Pop Rap)

      M. Lockwood - Communion In The Ashes (Alt-Country, Indie Folk, Power Pop)

      MaHaWaM - Is an Island (Hip Hop, House, Indie Pop)

      Magic Circle - Departed Souls (Traditional Doom Metal, Heavy Psych)

      Marvin Gaye - You’re the Man (Soul)

      Matthew Herbert Big Band - The State Between Us (Big Band, Electronic)

      Mdou Moctar - Ilana: The Creator (Tishoumaren)

      Mechanical God Creation - The New Chapter (Death Metal)

      Mekons - Deserted (Art Punk)

      Melii - phAses (Pop)

      Monsta X - Shout Out (K Pop)

      Moodie Black - MB I I I. V MICHOA (Industrial Hip Hop)

      Moon Tooth - Crux (Progressive Metal)

      Musket Hawk - Upside of Sick (Grindcore, Doom Metal)

      NEIKED - Best Of Hard Drive (Dance Pop)

      Nightmarathons - Missing Parts (Pop Punk)

      O.A.R. - The Mighty (Pop Rock)

      OWEL - Paris (Emo, Indie Rock)

      Ohtis - Curve of Earth (Indie Folk)

      Okey Dokey - Tell All Your Friend (Indie Pop)

      Oshiego - The Book of Wonders (Death Metal, Thrash Metal, Grindcore)

      PENTAGON (Korea) - Genie:us (K Pop)

      Park Ji Hoon - O'CLOCK (K Pop)

      pH-1 - HALO (K Pop)

      Pink Sweat$ - Volume 2 EP (Singer Songwriter)

      Quelle Chris - Guns (Abstract Hip Hop)

      Randy Randall - Sound Field Volume One (Ambient, Drone)

      Reaches - Wherever The Internet Goes, Sorrow Follows (Dance Pop, House)

      Saweetie - ICY EP (Trap Rap)

      Section H8 - Phase One (Hardcore Punk, Heavy Metal)

      Show Me The Body - Dog Whistle (Hardcore Punk)

      Simple Creatures - Strange Love (Pop Rock, Electropop)

      Small Feet - With Psychic Powers (Indie Pop, Indie Folk)

      Son Volt - Union (Americana, Alt-Country)

      Soulja Boy Tell 'Em - Tell Ya (Pop Rap)

      Stella Parton - Survivor (Country)

      Steve Earle & The Dukes - GUY (Americana, Country Rock)

      Stray Kids - Clé 1: MIROH (K Pop)

      Suzi Quatro - No Control (Hard Rock)

      TAEYEON - Four Seasons (K Pop)

      Tay Iwar - GEMINI (Singer Songwriter)

      The Bobbleheads - Myths and Fables (Pop Rock, Indie Rock)

      The Maine - You Are OK (Pop Rock, Alternative Rock)

      The Strumbellas - Rattlesnake (Indie Rock, Folk Rock)

      The Underground Youth - Lust & Fear (Psychedelic Rock, Gothic Rock)

      The XCERTS - Wildheart Dreaming EP (Power Pop )

      Tom Williams - What Did You Want To Be? (Indie Rock)

      Triumvir Foul - Urine of Abomination (Death Metal)

      Unkle - The Road: Part II (Art Pop, Trip Hop)

      White Denim - Side Effects (Indie Rock, Psychedelic Rock)

      Whitechapel - The Valley (Deathcore, Groove Metal)

      Wincent Weiss - Irgendwie anders (Pop)

      Yelawolf - Trunk Muzik III (Southern Hip Hop)

      Yngwie Malmsteen - Blue Lightning (Neoclassical Metal)

      woods + segal (Billy Woods & Kenny Segal)- Hiding Places (East Coast Hip Hop)

      12 votes
    5. Anyone here into homebrewing?

      I've been semi into this for a short while. I've done a few brews over the last year or so, three single gallon mead brews (one being a joam), one 5 gal cider brew and I've just started 3...

      I've been semi into this for a short while. I've done a few brews over the last year or so, three single gallon mead brews (one being a joam), one 5 gal cider brew and I've just started 3 different single gallon brews, with two being wine and one cider. From here on out I'll be starting a new batch each week to create something I really enjoy, most likely ciders.

      I would enjoy talking to anyone that is also interested in this subject.

      21 votes
    6. Junji Ito's "Shiver" collection

      I recently purchased Junji Ito's Shiver collection, which has nine of his self-descirbed "best" shorts inside: Used Record Shiver Fashion Model Hanging Blimp Marionette Mansion Painter The Long...

      I recently purchased Junji Ito's Shiver collection, which has nine of his self-descirbed "best" shorts inside:

      • Used Record
      • Shiver
      • Fashion Model
      • Hanging Blimp
      • Marionette Mansion
      • Painter
      • The Long Dream
      • Honored Ancestors
      • Greased

      And while overall I would say the collection was well worth the £16 it cost, I will say I was somewhat disappointed in the varying "shivers" delivered by each short.

      For example, I found the Fashion Model short to be quite frustrating: compared to the creativity and build up of horror present in some of the other shorts such as Hanging Blimp, it was essentially "creepy looking lady is serial killer". Others such as Used Record seemed as though there was a lot of wasted story.

      Meanwhile, some such as Marionette Mansion did a grand job of building a suspenseful atmosphere and The Long Dream was certainly scary to dwell on.

      I understand variable impact on the reader is to be expected for so many different works, but for what Ito described as nine of his best I was a little disappointed.

      Outside of this collection, the only work of Ito's I have seen is the one where people enter holes carved out for their bodies (which for the record I also enjoyed).

      Are others familar with Junji Ito's work? Recommendations for his or similar artists work would be very welcome.

      Edits: paragraphing.

      5 votes
    7. Crazy idea to help stop the spreading of untruthful news

      One of the main issues with news on social media is the spread of fake or false news. This happens on every platform that allows sharing news. If Tildes continues to gain popularity, this will...

      One of the main issues with news on social media is the spread of fake or false news. This happens on every platform that allows sharing news. If Tildes continues to gain popularity, this will likely happen on Tildes. I had an Idea: what if tildes had a group of fact checkers that check to see if the news is truthful, and block posts that link to untrustworthy new sites? could be like a 3 strikes thing, where if a new source has 3 articles posted that have misinformation, they would be blocked (the post also removed).

      This is just an idea, feel free to highlight any issues with it.

      10 votes
    8. What does the word 'civilized' mean to you? Can it be used to compare and contrast societies and cultures?

      Do you believe that some cultures/societies are more 'civilized' than others? What is your definition of 'civilized' / what does it mean to be 'civilized'? ~ If you've studied history and/or...

      Do you believe that some cultures/societies are more 'civilized' than others? What is your definition of 'civilized' / what does it mean to be 'civilized'?
      ~
      If you've studied history and/or anthropology then surely you've heard many uses of the term "savages" to describe groups of people that were considered to be less 'civilized' than whomever was writing that piece.
      I was also just reading a book that described in detail some of the really horrible war crimes committed by both sides in the Sri Lankan civil war including but not limited to: raging mobs burning people alive, murder and rape of civilians, use of child soldiers, suicide bombers, etc. Please note that in no way am I considering the people of Sri Lanka as 'uncivilized', just using an example of what seems to be 'uncivilized' behavior.

      An initial thought that I had was "huh, I'm glad I don't currently live somewhere where I could be burned alive based on my ethnicity/religion/beliefs by a rage fueled mob of people", but then the history of the western world came to mind - some of those exact same thing happened less than 100 years ago to many non-white groups of people in America, including some things even worse (read: human slavery). From here came a flood of other thoughts poking holes in whatever my initial definition of 'civilized' was. Plenty of things in present-day United States could be considered uncivilized. Yet one could make an argument that a more 'civilized' civilization might be one that allows many personal freedoms.

      So, I want to ask all of you what you think of the concept of being 'civilized'. Is it a colonialistic-type term used to promote a higher sense of placement in the world that should be abolished. Does it have any merit in its use? If so, what do you think makes a civilized group of people and does one exist?

      16 votes
    9. Which messenger(s) do you currently use? If you had your preference, what single messaging service would you prefer to use?

      SMS, iMessage, WhatsApp, Facebook Messenger, Instagram Direct, Signal, Wire, Wickr, Telegram, GroupMe, Viber, Threema, etc. There are dozens of competing messenger services out there, each of...

      SMS, iMessage, WhatsApp, Facebook Messenger, Instagram Direct, Signal, Wire, Wickr, Telegram, GroupMe, Viber, Threema, etc.

      There are dozens of competing messenger services out there, each of which is either supported by or suffers from the network effect. Futhermore, each seems to come with its own pros and cons. I'm curious about not only people's current use, but where everyone thinks we are headed. As such, I have a few questions:

      1. Which messengers do you currently use at the moment? What are their advantages and disadvantages?

      2. If you could magically switch all of your contacts to be on one messaging service, which would it be and why?

      3. Do you think we'll ever see a realistic convergence of messaging, or are people destined to use different platforms for different contacts?

      35 votes
    10. What is your favourite audiobook?

      Some books are adapted to the medium of audiobooks better than others. A mediocre narrator can taint what is otherwise a great story. Likewise, an outstanding narrator can uplift what is an...

      Some books are adapted to the medium of audiobooks better than others. A mediocre narrator can taint what is otherwise a great story. Likewise, an outstanding narrator can uplift what is an average story.
      For me, His Dark Materials is the best audiobook I've listened to. It's read by the author, and has a full cast of (fantastic) voice actors for each character, it brings the story to life so wonderfully. To the point that even if I read the book now, I hear a good amount of the voice cast speaking for each character.
      If you haven't heard it, I can recommend it! Honourable mention goes to Stephen Fry reading the Harry Potter series.

      What is your favourite audiobook?

      14 votes
    11. How do you read NY Times? Subscription? Other?

      I see a lot of posts referencing NY Times articles. NY Times is behind a paywall. Are there a large number of folks paying to subscribe to NY Times? Are there other more nefarious methods for...

      I see a lot of posts referencing NY Times articles.

      NY Times is behind a paywall.

      Are there a large number of folks paying to subscribe to NY Times? Are there other more nefarious methods for reading the occasional article?

      6 votes