[TINY TIM VOICE] HELLO my dear friends! Here we are, it's Monday at last! Welcome to another edition of our Developer Spotlight. This week, we spoke to Harris Beg, the developer behind Smartify.
@shadowcypher: I’m Harris, I’m 16, I’m from San Diego, and really I was introduced to repl.it from my AP Computer Science Principles class—we were learning C# at the time, I think. And setting up a dev environment for a lot of novice students is really difficult for a teacher, so that’s why we started using repl.it. I noticed how simple it was to set up, so I started using it for my snippets here and there. And then that morphed to full fledged projects.
On Learning to Code & Being a Hacker
@katyadee: Nice. I am sure your teacher would like that story! When did you start learning to code?
@shadowcypher: I know this sounds kind of generic, but maybe 2 or 3 years ago? When I say 2 or 3 years ago, back then I thought I was some master hacker where I’d type tree into the command prompt and you know, my friends would think “This guy’s a hacker.” As for real coding—I really just started last year.
@katyadee: You know, it’s so funny I’ll hear this story a lot…People get—you know, I wouldn’t say arrogant—but they’re super passionate about coding at first, and they’re trucking along, and one day they wake up, and they’re like, “What have I been doing? I haven’t learned anything.” And maybe they’ll walk away from it, or maybe it’ll be this gradual thing, but it always seems like a bit of a journey towards getting serious about it.
@shadowcypher: Before coding was this weird process for me… I’d look at a tutorial and I’d go, “This is way too complex,” and I’d switch to the next one. Honesty, that’s not a good way of approaching it. The best way to learn to code is to know what you want to build. That way, you can sustain your passion—you have an end goal. My end goal for learning Android app development was building a skin disease classifier. Having a goal at the end is just so important.
@katyadee: It’s like filmmaking. It’s useless until you’re actually doing the thing. Is this skin disease classifier why you learned to code in the first place? Was that your “I’m getting serious” project?
@shadowcypher: It’s not why I learned to code… my brother got into it earlier than I did. And, well, sibling rivalry. I was like, “If he’s doing it, I might as well.” He learned Java, so I learned Java. Then I started making websites… apps…
@katyadee: How many languages do you know?
@katyadee: And you started off with Java trying to beat your brother?
@shadowcypher: Actually… I think originally took a class on C++ but I hated it.
@katyadee: That’s ambitious! I don’t understand this. I feel like so many of these classes just throw people into C or C++ and I feel like that’s really not the right place to start when you’re fresh on the scene.
@shadowcypher: Definitely start with Python, or get your feet wet with HTML. You can actually build something immediately, and you won’t get intimidated, you realize it’s not like on TV where people are just typing green text into a console.
@katyadee: A lot of people actually think that, haha.
@shadowcypher: Yeah—me too, to be honest. I was that type of person.
On Getting Serious & Challenging Yourself
@katyadee: I think you’d mentioned something at some point about creating a lot of story-based programs. I was really curious about what you meant by that… and it also got me thinking, do you think there’s a relationship between coding and storytelling?
@shadowcypher: Story-based games were my first applications, because they’re really easy to do. You have print statements, if statements, looping… so there’s not much inspiration or anything behind it. It’s just really easy to do when you’re a beginner or you know the basics of a language. It’s the first application you can have.
@katyadee: I remember really honing in on the “story” part of the “storybased game” thing when I tried to learn C… like 15 years ago or something crazy like that. Anyway, needless to say, I don’t know C. But it’s something worth thinking about: the temptation to start using the story as a crutch, and focus more on the story than the code.
@shadowcypher: I agree. You get accustomed to the concept, and then stop pushing yourself. And that’s vital to programming. If you don’t put yourself out there, you’re missing a lot of information or ways you can apply your ideas.
@katyadee: Do you think as you’ve learned more, the way you think about coding has changed?
@shadowcypher: Before I wouldn’t really have scalable ideas. That’s the main transition. Before I would come in with the mindset, “I’m going to be the only one using this.” Now I try to write my code with the knowledge that other people might use it… and that there might be some things they won’t understand. When you’re a developer, it’s very easy to start adding features that you think are cool, but your users don’t notice or understand. You want your design to reflect that your users probably won’t have the same design philosophy as most developers.
@katyadee: So, Amjad actually put you on my radar—he was really impressed by you and Smartify. How’d you guys end up meeting?
@shadowcypher: I was at the Hack Club Summit last week, and when Amjad had some free time, I started talking to him about my project, Smartify.
And I told him how sometimes I’d create a cool app or website and no one would really notice, and how that would kind of be a downer. But then I shamelessly plugged Smartify, and from there it kind of snowballed. He saw a speaker on the desk with a computer hooked up to it and he said, “You should try Smartify on that.” And so I did. As debug sessions go—the app crashed right when I was demo-ing it, so I had to do a fix on the spot. And that was fun. And that’s how we met.
@katyadee: That’s so sad that people aren’t noticing your projects—Smartify is really cool, at least, I’ve been using it myself. Where do you usually post them?
@shadowcypher: Sometimes on Reddit, but people really see what they want to see there. Smartify has done okay, though. We’ve had maybe 80 upvotes, and we have 180 active users so far.
@katyadee: And this is all from Reddit? 180 users is really impressive given the lifespan of Smartify.
@shadowcypher: I’d say a fair share are from Hack Club, but when I checked the analytics we have people from all over… India, Russia, Africa, so I’m assuming a good number are from Reddit.
@katyadee: That’s a huge jump from “I feel discouraged because no one’s looking at my project” to an international userbase.
@shadowcypher: It’s unexpected. Usually I get 5 upvotes within the first hour, and then nothing.
@katyadee: YMMV on Reddit, I feel. So let’s back up for a second: what was the inspiration for Smartify? What problem were you trying to solve by creating it?
@shadowcypher: I’m usually the one with the aux cable on long car rides. And then after an hour or so, I usually stop wanting to manually choose songs. And then what ends up happening is I’ll have this perfect queue and then some random song that’s completely different from the song before ruins it. So, Smartify is the solution to that.
@katyadee: Can you walk us through some of the features? How does it work, on a technical level?
@shadowcypher: You can plug in an album or playlist and let’s say you come up with Post Malone’s new album. Then it’ll view all the tracks in that album and it’ll generate scores like key, valence, danceability, and tempo…things like that. Those are actually generated through the Spotify API. Key is the musical note throughout the song. Valence is the happiness. Danceability, is well, danceability. It’ll calculate each song’s deviation from your current song. The one with the least deviation is the one that’s the most similar. Smartify just creates a list where the songs next to eachother are the most similar.
@katyadee: It’s supposed to just pull from a given album or playlist, right? Why not search by artist?
@shadowcypher: Adding a search by artist was a little complicated at first, but I have a list of things I want to implement.
@katyadee: Because musicians will write albums with a theme already in mind— but it seems to work best with a really long album, for example. One that I tried it with was “69 Love Songs” by the Magnetic Fields. It’s literally just 69 love songs, it’s super long. So it was really cool to have Smartify pull out the songs there that have the same vibe. But then what do you do with an 8 track album?
@shadowcypher: I agree… I recommend using Smartify for playlists, mainly.
@katyadee: What weren’t you satisfied with when it came to Spotify’s pre-existing “Made for You” or “create a song radio” features?
@shadowcypher: They always suggest songs where I’m just like “c’mon…” I don’t want to experiment with music all the time.
@katyadee: That’s fair—haha.
The Spotify API and Working in Django
@katyadee: Can you talk about some of the features you want to add?
@shadowcypher: The biggest one right now is using advanced data structures. So, recently I’ve been doing a Udemy class that teaches about them. One of them is the priority queue. And I think that would really help Smartify. Right now, it’s just simple arrays just floating around. Actually having some logic to it where certain songs have certain priority and you can remove songs from the queue—that’s the way to go.
Besides that, I want to make the autoplayer available to everyone, not just people with Spotify Premium. I might use the YouTube API instead. Spotify is really strict about playing songs. For the purpose of testing, it’s fine, but if I want to scale, I can’t.
@katyadee: If you used YouTube’s API, do you think it would be hard to make sure like… a Joe Rogan podcast doesn’t get in the queue somehow or something?
@shadowcypher: Yeah… That would be a challenge, but I don’t know how I’d deal with that. Maybe look at the title of the video? And compare it to the Spotify title. Generally, if you’re sorting by “liked” videos, you’ll come up with relevant results. I can see myself running into some issues there.
@katyadee: Speaking of challenges, what were some challenges you had building what we currently see here with Smartify?
@shadowcypher: I, for some reason, didn’t realize that albums and playlists have completely separate data structures. With the Spotify API, you can either send a request for an album or a playlist, and there’s no overlap there. So the main thing is I created one Python class called “Albums” and so adding playlists into there was problematic, because there’s no overlap in the API. I added a variable called “is album”… It was kind of like the, “Well yes, but actually no” meme but for playlists. It’ll set “is album” to false and then access the Playlist URL.
@katyadee: So you had this issue—but you solved it pretty quick.
@shadowcypher: Oh, and I had some issues with the autoplayer… You have to implement an authentication system because Spotify’s really strict.
@katyadee: Can you explain Spotify’s authentication model?
@shadowcypher: Spotify, unlike Facebook for example, tells the users exactly what applications are accessing what data. So every time you want to create a playlist or play music on a person’s account, you have to ask them for permission. And so basically, Spotify will take them to a new login screen, and they’ll have to verify, I want this app to access my data. It’ll generate an access token and you can use it for an hour and after that you have to regenerate it with a separate token.
@katyadee: As you continue to improve Smartify, is there anything you need to learn before you can progress?
@shadowcypher: I had to learn Django to build it. I don’t really have an understanding of connecting databases to Django… that’s one thing.
@katyadee: Woa. You wandered in and created this awesome thing. How do you like Django, since you’re pretty new at it?
@shadowcypher: I like Django a little more than Flask. Flask is really small, you can write one Python file and have a fully functioning website. That’s great for entry level developers.. but not great for scaling. Django really gives you the option to have a good backend database.
@katyadee: What was the debugging process like?
@shadowcypher: Django has a debugging process built in. It’s really good. It’ll tell you exactly where the error is in the Python file and you can just jump to it. I guess the main thing is… When you’re accessing the Spotify API, you’re sending a bunch of get and post requests and so for some APIs, it’s sometimes you won’t know what you’re getting a repsonse to those get and post requests, but the thing with the Spotify API is that they’ll have a try it button, so you can try the API before you even implement the code…so luckily, I didn’t have to debug that much.
@katyadee: That’s a pretty friendly move.
@shadowcypher: I recommend everyone check it out. It’s so easy to use.
Some Notes on Security
@katyadee: Based on your username… and your crypto practice repl, you seem like you have some interest in security. What’s your interest level? And if my guess is totally wrong here, is there an area of programming you’re most interested in learning about?
@shadowcypher: I’m not a security expert, but I am getting into it. I’m doing a lot of blockchain stuff at my internship…my mentor came to me with really good advice, up until this point I’ve been developing and hoping that it runs for every user but he recommended before I publish any project that I go through every single test case, because chances are—if there’s even one test case that fails, your API gets exposed, things like that, your whole thing will fall apart. You have to be more cautious.
@katyadee: Wise beyond your years again!
@shadowcypher: Programmers already run into a lot of issues when developing their applications, so having to consider other test cases that might fail… it’s easy to ignore. Like the everything is fine comic.
@katyadee: Any last pieces of wisdom?
@shadowcypher: Hmm.. A good developer will know when it’s inefficient to use pre-built technology. If you think about it, you can probably develop a solution to your problems yourself.
@katyadee: That’s pretty punk rock.
@shadowcypher: And more generally... sometimes it's easy to feel really small in this field, but if you have the passion, you can make it happen.
@katyadee: It's not about who does it first... it's about who does it bet.
@shadowcypher: I think that's right.