<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shay Tavor on Medium]]></title>
        <description><![CDATA[Stories by Shay Tavor on Medium]]></description>
        <link>https://medium.com/@shay-tavor?source=rss-d61c1a9e025c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NSEJifaQ6yUHu_LyZIyk4A.jpeg</url>
            <title>Stories by Shay Tavor on Medium</title>
            <link>https://medium.com/@shay-tavor?source=rss-d61c1a9e025c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 10:53:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shay-tavor/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI Killed the Creative Star]]></title>
            <link>https://shay-tavor.medium.com/ai-killed-the-creative-star-ba9254c8f4ed?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba9254c8f4ed</guid>
            <category><![CDATA[art]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[van-gogh]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 05:43:50 GMT</pubDate>
            <atom:updated>2025-04-10T05:43:50.866Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1MUmFt7JUj7WNafpW9fwOQ.png" /></figure><p>AI Killed the Creative Star</p><p>In their 1979 song “Video Killed the Radio Star,” The Buggles sang nostalgically about how technology changed the creative landscape. While video may have indeed displaced the radio star, it also gave rise to an entirely new kind of stardom. Today, in the first quarter of the 21st century, I believe we’re witnessing a more profound shift: AI is killing the creative star. And unlike before, it’s unclear what new “stars” will take its place.</p><p>A few years ago, I began teaching a Data Structures course at the university. Anyone who’s studied computer science knows this course — it’s foundational and notoriously challenging. I once had an idea: to visualize some of its concepts through comics or other visual methods. I knew that sometimes, abstract topics become clearer when represented graphically. But like many good ideas, it remained unexecuted. A lack of time — and more importantly, a lack of artistic and technical skill — held me back.</p><p>Fast forward to 2025. A friend showed me a comic he’d made about recursion. It was clever, funny, and educational. It immediately reminded me of my old idea. I asked him, “How did you do it?” His response: “I just asked ChatGPT. It made it in a minute.”</p><p>I tried it myself. I created a comic about the Master Theorem. It was solid. Creative. Even funny. But somehow… it wasn’t interesting. The spark of originality was missing. What once felt like an innovative idea now felt automated. Sanitized. Hollow. You can see it in the image attached.</p><p>Why do we, as human beings, love art? Why do we enjoy paintings, music, and sculpture? Of course, we appreciate beauty and aesthetics. But I believe a deeper part of the experience is the knowledge that another human, like you or me, created it. Someone conjured something new from their imagination — something we might never have done ourselves.</p><p>Think of Van Gogh. His work captivates not just because it’s beautiful, but because it’s an achievement of one singular, extraordinary human mind. But now? Anyone can type “flowers in Van Gogh’s style” into an AI tool and, voilà, a convincing imitation appears in seconds.</p><p>Would you attend an exhibition of AI-generated Van Gogh-style paintings? Probably not. It’s not that the images are ugly — they might even be stunning. But they lack meaning. Knowing that no human hand or heart was involved strips them of substance. They become no more than machine-made products. Impressive, perhaps, but not art.</p><p>As large language models continue to evolve, I fear more and more fields of human creativity will start to feel… dull. Replaceable. Imagine this: Do you love the Beatles? Think they were geniuses? Then how would you feel about a “new” Beatles song created entirely by AI? Would you listen to it? Would you care about a brilliant album cover designed in seconds by a machine? Would you use software entirely written by AI and marvel at its elegance?</p><p>See where I’m going?</p><p>We are facing a unique problem — one we’ve never encountered before. For centuries, creative expression was the domain of human beings alone. That’s no longer true. We can debate whether AI-generated content is truly creative, but that misses the point. What matters is this: the once-rare ability to create something exceptional is now within everyone’s reach. And when everyone can do it instantly and perfectly… it becomes boring.</p><p>Video may have killed the radio star, but it birthed new ideas and performers. AI, by contrast, threatens to overwhelm human creativity — not by replacing it entirely, but by diluting its uniqueness. If a machine can create faster and better, what motivates a person to try?</p><p>And here’s a final thought exercise: if you’ve read this far, what would you think if I told you this entire essay was written by AI? Hold on — I promise it wasn’t. I wrote every word myself, carefully, thoughtfully, and it took me a decent amount of time. But consider this: I <em>could</em> have written it faster — and maybe better — with AI. If I had, would you still want to read it?</p><p>Think about that.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba9254c8f4ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Who Wants to be a Telegraph Operator?]]></title>
            <link>https://shay-tavor.medium.com/who-wants-to-be-a-telegraph-operator-0aae64d6fc2e?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/0aae64d6fc2e</guid>
            <category><![CDATA[academic]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 21:28:52 GMT</pubDate>
            <atom:updated>2024-02-27T21:28:52.532Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DuGcs0byDwYRdZpAZe2Lqw.jpeg" /><figcaption>telegraph operator, 1900</figcaption></figure><p>Who Wants to be a Telegraph Operator?</p><p>In the last year we’ve witnessed a tremendous change in technology. The rise of ChatGPT and its friends in the generative ai field introduced the world a brand new technology that is not one or two steps ahead, it’s twenty steps more advanced than anything we could imagine.</p><p>For those of you who lived on an isolated island in the last year and don’t know what chatgpt is — it’s a generative ai engine that can answer your questions, delivered in natural language. Even though chatgpt can answer questions on any subject, I’ll focus naturally on programming.</p><p>I’m teaching in the academy and software industry for more than twenty years. During those years I’ve composed hundreds of programming exercises for my students. Here is an example for one of them:</p><p>Write a method in java that accepts a one dimensional array of numbers, and returns true if all the numbers are even, or false if not.</p><p>It’s a nice exercise, aimed to practice students in their first steps at programming, with arrays and loops.</p><p>Nowadays, this exercise is useless. Not that it’s not good anymore, it still gives a good practice. The problem is that one can type the exercise into chatgpt prompt and get the answer immediately.</p><p>That means that a first year undergrad student who would get this exercise can simply get the answer without solving it by him/herself. That’s for its own is a problem, but I think the problem is deeper — the fact that a machine can perform this task as equally well as a human being, means (as always with technology) that the human is not necessary.</p><p>Over the years, I’ve always been asked by young people who consider their future “should I study programming?”. All of those years my answer was “Absolutely Yes! Programming is a well paid profession, it’s interesting and challenging, and if you are into it — this is probably the best profession you can get in the modern era”.</p><p>That was my answer up until last year. But now if someone asks me, my answer would be “I’m not sure”. Students that had started their studies this year would already find it hard to find a job. Students that would start in the next academic year would find it harder. What would the world look like in three or four years? I’m not a prophet, but by looking at the normal rate of technological advances, I can’t see a reason why the abilities of generative ai wouldn’t increase and exceed its current abilities. It means that if now, chatgpt can easily write pieces of code that are accurate and good as a human programmer would, in the next coming years, generative ai tools would be able to write more complex and sophisticated code, tasks that up until now were considered as human only abilities.</p><p>What I’m saying is that the profession of programming, like so many other professions in the past, is going to disappear, at least in its current form.</p><p>Does it seem to you too radical? Let’s take an example from the past –</p><p>Up until the 19th century, the only means of long distance communication was mail. I mean written letters. If you lived in Ney York, and wanted to say something to a friend in Washington, you would write a letter, and this letter would probably arrive its destination in a week or so. The latency became higher when you wanted to write to someone in Europe, and if you wanted to talk with an acquaintance in Australia, it might took a whole month.</p><p>Around 1830 the telegraph was invented. The telegraph was based on long wires that carried electric streams. You could transmit a long pulse (“Line”) or a short one (“Dot”). Then the Morse code was invented. The morse code encodes every letter in the alphabet (as long with some punctuations) to a series of lines and dots. Now if you were in New York and wanted to say something to a friend in Washington, you could transmit your message via telegraph, encoding it in morse code. It would take seconds instead of days. The telegraph really changed the world in any aspect. The world had become small and connected.</p><p>In order to send a message via the telegraph you had to deliver the message to a telegraph operator — a person that took your hand written message and transmitted it in morse code to its destination. The telegraph operator should also be able to receive incoming messages as morse code, and decrypt it into English. In these years, a telegraph operator was a very desirable job. It was well paid, and demanding job — a person that wanted to be a telegraph operator should have a good memory, quick responses and a huge patience to sit long hours and transmitting and receiving lines and dots. It was a very respectable job. The big communication companies back then administrated their own training paths for operator’s jobs, and only the best could be telegraph operators.</p><p>And what had happened next we all know. Somewhere in the 20th century the telephone and radio communication were invented. People discover that it’s much faster and efficient to communicate via spoken words instead of enigmatic dots and lines. The use of telegraph became more and more rare, and therefore, telegraph operator became a very not needed profession, until it had disappeared completely.</p><p>So, is the same thing can happen to us, programmers? I think it surely can and will. I can’t see any option of technology stop advancing, hence in the coming years we are expected to see more sophisticated and advanced ai tools that would perform more complex tasks. Consequently, software companies would use those tools more intensively, replacing some of their programmers with ai tools, and then most of their programmers.</p><p>Is there a future for programmers? I think there is no such future, exactly as the telegraph operators disappeared when a new and superior technology overcame the telegraph.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0aae64d6fc2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s write a sudoku]]></title>
            <link>https://shay-tavor.medium.com/lets-write-a-sudoku-8948a92394cf?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8948a92394cf</guid>
            <category><![CDATA[sudoku]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Thu, 24 Feb 2022 06:18:59 GMT</pubDate>
            <atom:updated>2022-02-24T06:18:59.474Z</atom:updated>
            <content:encoded><![CDATA[<p>I love to play sudoku. I play it while I’m at the bus stop or waiting to pick up my kids from school… really, whenever I have some dead time.</p><p>Lately I ran out of sudoku boards in my sudoku application. Well, I know there are tones of apps out there, but in addition of loving sudoku, I’m also a programmer and I love to program. So I thought, why not writing my own sudoku application?</p><p>I’ve learned a lot from this experience, and I even recorded my process in an online course (link in the end), and I want to share my journey:</p><p><strong>First thing first</strong></p><p>Whenever we encounter a big challenge (in developing a software or any other field) it may be overwhelming — the number of things we should consider can be daunting and that for itself can cause us to “freeze” — we just don’t know where to start.</p><p>My solution to that — I always look for some small module in the whole project and try to develop it first. Of course it should be something that can be developed separately and with no dependencies in the rest of the project.</p><p>When dealing with the sudoku app (and games in general) I think the best place to start with is the game’s logic. My rule of thumb says that I code the game’s logic such that in the end I can play the game on the command line without any graphics. It’s not always practical for every application, but in the sudoku it works. So first thing to do — write a class that implements a sudoku game. It should generate a new sudoku board, be able to validate solutions and all other game’s rules.</p><p><strong>Now what?</strong></p><p>So we have a complete sudoku logic class. How to proceed?</p><p>Now it’s time to start writing the game’s manager which is the module that mediate between the UI and the logic.</p><p>It’s time to write a very basic UI. We don’t have to implement every aspect here, but we want it to be sufficient for presenting the board. Later on we’ll deal with the user clicks and dwell deeper into board manipulations.</p><p><strong>Curious?</strong></p><p>There are a lot of technical details that that involved and in a all, it’s not an easy project. But if you are curious, you’re invited to see my process of developing this game. I think it’s a great way to learn how to approach such a medium scale application and how to proceed.</p><p>You are invited to watch my course:</p><p><a href="https://www.udemy.com/course/lets-create-a-sudoku-game/?couponCode=22EFD0A10CC4D0AA98D8">https://www.udemy.com/course/lets-create-a-sudoku-game/?couponCode=22EFD0A10CC4D0AA98D8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8948a92394cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Farewell to my Text Editor]]></title>
            <link>https://shay-tavor.medium.com/a-farewell-to-my-text-editor-ad96a767f130?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad96a767f130</guid>
            <category><![CDATA[brackets]]></category>
            <category><![CDATA[text-editor]]></category>
            <category><![CDATA[adobe]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Fri, 04 Jun 2021 19:51:33 GMT</pubDate>
            <atom:updated>2021-06-04T19:51:33.491Z</atom:updated>
            <content:encoded><![CDATA[<p>One morning, one wakes up and finds his favourite text editor is going to be forsaken. That happened to me, as Adobe declared they seize to support <a href="https://blog.brackets.io/brackets-eol-notice/">Brackets text editor on September 1, 2021.</a></p><p>My acquaintance with the beloved editor had started somewhen in 2015, when I switched from Windows to Mac and looked for a simple text editor that would work with it. I found brackets and fell in love.</p><p>You may ask what is there in this simple software that is worth whining about. Well, I’ll try to point out some of the things that stands out for me.</p><p>I write code. A lot of it. But I’m not a developer, I’m an academic and technical instructor, and I teach a lot of courses on various programming languages and platforms.</p><p>In addition, I read a huge amount of code, as a reviewer, again, in many different programming languages.</p><p>It’s very common for me to go on one day from writing a script in Python, reviewing a class in Java, writing some code in Javascript and jump to the HTML to change some properties. That’s what I’m doing, actually. So for me, the number one requirement from my text editor is that it would allow me to write and use all those languages in one place.</p><p>Yeah, sure, I have Intellij for Java and Kotlin, I have Pycharm for Python but jumping from one environment to another is exhausting.</p><p>And sure, we have VSCode. All of us. And it’s really a fantastic development tool. But for me, I find all the hassle and whizzes to be just too much, and the need of jumping between languages becomes cumbersome with this mighty software.</p><p>And then enters Brackets. With a click I fire this modest editor and it does miracles. It opens every text, without complaining. It recognises every language and has all the needed tools as auto indentation, closing parentheses and quotation marks and so on.</p><p>But Adobe had decided to end their support, so I guess I’ll stick with it as long as I can, but then — anyone can recommend a good simple editor for me?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad96a767f130" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Exam had Failed the Exa]]></title>
            <link>https://shay-tavor.medium.com/the-exam-had-failed-the-exa-e94d8083737a?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e94d8083737a</guid>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[academia]]></category>
            <category><![CDATA[exam]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Sun, 27 Sep 2020 06:28:45 GMT</pubDate>
            <atom:updated>2020-09-27T06:28:45.831Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Exam had Failed the Exam</h3><p>Coronavirus, aka Covid-19, has caused a lot of changes in our everyday lives. There is almost no aspect of our life that wasn’t changed in one way or another. The academic word is not exceptional, and I want to focus on the examination process.</p><p>For hundreds of years the way universities and colleges assessed their students’ knowledge was the written frontal exam. The process is known to everyone — you arrive in a certain date to a classroom, in which you identify yourself and then handed a questionnaire. You sit in your place watched over by a guard and answer by yourself on the questions.</p><p>This method has its faults, no doubt about that. But it has some advantages too — first of all, it’s very hard to let other person take the exam instead of you. In addition, although cheating is not rare, it’s also not very easy to do. All in all, written exams are thought to be pretty reliable means for grading a student in the end of the course.</p><p>Enter Covid-19.</p><p>With the arrival of the disease, one big change was forced over the academia — in most places, they couldn’t do written frontal exams in which students actually present in one room. So every institute tried to find its own way, usually as an ad hoc solution, to examine its students.</p><p>I teach in several academic institutes, and even inside the same place there was more than one method. Here are some examples for examinations that was implemented due the previous semester –</p><p>- The students were given a regular exam which they did in their homes and uploaded the answers. No supervision or guarding was made.</p><p>- The students were given an exam that they had to answer on a dedicated application (such as the universities website). The exam was divided into several parts, each part had its time (i.e. one could neither go back to previous part after the time had ended nor to go to an advanced part before its time).</p><p>- The students were given an exam and were watched via one or two web cameras by a supervisor.</p><p>- The students answered their exams and had to “chat” with the professor to answers some oral questions regarding their answers.</p><p>And a lot of other variations.</p><p>But it turned out that all those solutions have a major flaw — they are easy to cheat on. All the exams that were taken without any supervision were asking to be cheated on — the students quickly discover they can talk with their friends (via email, whatsapp or phone) and share solutions. Even worse — some students gave others to answer the exam instead of them. Even on allegedly supervised exams there were just too many holes that couldn’t be covered. In the bottom line — as opposed to frontal exams, the online exams are flawed because they just too easy to be cheated on.</p><p>I’ve tried to figure that out, to find a way that allows me as an instructor to examine my students in a reliable way. But any solution I came up with was not feasible or not effective (or both). I couldn’t think of a realistic and reliable way to asses online a person’s knowledge.</p><p>And then I thought that maybe I’m trying in the wrong place. Maybe there’s just no solution in this pattern of one final exam. We are so fixed with that paradigm that it’s hard to think of another way that could possibly work, but there must be. My conclusion is that we cannot continue to pretend that our exams are reliable tools in the online world and we must change our way of thinking. In my opinion, the (long) era of one final exam as a mean to test student’s knowledge is over.</p><p>So what can we do? As Albert Einstein said — “No problem can be solved from the same level of consciousness that created it”.</p><p>Next time I’ll write about my suggestion for examine and grade student’s knowledge. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e94d8083737a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming Languages Oddity]]></title>
            <link>https://shay-tavor.medium.com/programming-languages-oddity-6856f9e0a803?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6856f9e0a803</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[language]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Thu, 03 Oct 2019 18:53:58 GMT</pubDate>
            <atom:updated>2019-10-03T18:53:58.721Z</atom:updated>
            <content:encoded><![CDATA[<p>Programming languages can be (and should be) clear to write and read, and no doubt that some of them, especially the new generations of languages, are just that. But we can’t escape the fact that a programming language is still an artificial, human made product, and so it sometimes looks and behaves quite, well, strange.</p><p>In this post I’ll show some of the most strange and bizarre programming languages constructs, structures or syntax. Things that always make me wonder — what were they thinking of? Let’s be honest — we’re not writing things like that anymore –</p><pre>mov dptr, #10h</pre><pre>movx a, @dptr</pre><pre>inc dptr</pre><p>Those days are over, thanks god, but still, sometimes the code we write can look as bad. Here are some examples that form, in my opinion, some of the worst constructs in programming languages. Enjoy!</p><p>Compilers have this annoying thing — they must know when a block of code begins and when it ends. Before the clever invention of curly brackets entered, each language found its own way. Remembered for good is the Pascal’s way with its “begin” and “end” keywords. But why use English words when we can invent some? How do you end a while loop in VB6? Well, it’s called “wend” meaning “while end”. And the python “elif” word for “else if”. I don’t know about you, but every time I read and write it I have a vision of Lord of the Rings with its elves.</p><p>But the prize for the most gruesome invented words go to the “Cool” programming language — I know, I know, it’s not a “real” language but it’s quite real for those who learn compilers theory. In this language there is a nice way of ending a block. The keyword for ending a block is the keyword that begun it, in reverse. “if” ends with “fi”, “case” ends with “esac”, “loop” ends with “pool”. Oh my.</p><p>Sometimes a language must express certain ideas, and those ideas must be different from another, that should be yet different and so on. That makes the code very, very verbose and oh so strange. C++ is the definite queen of defining things with all possible ways. Look at this –</p><pre>const int*const myFunction(const int*const&amp;)const;</pre><p>Say “const” one more time!</p><p>We all love arithmetic signs, they make our life easier. When you write “a + b” you just mean what is written. The equal sign is a little bit problematic. It can mean an assignment, like a = 5, but how would we ask if a is equal to 5? We got used to it, but guys, come on, writing ‘==’ is not natural! But as mentioned, we got used to it. But then came Javascript and boom, we got ‘===’. When I show this operator to my students they start to laugh.</p><p>Speaking of signs — sometimes the language designers forgot that we are human beings and make us write all kind of encrypted-like code that looks like a monkey hit randomly on the keyboard. I just love the C pointers and addresses:</p><pre>**p = &amp;(*q)</pre><p>Or</p><pre>int **a = (int*)(malloc(sizeof(int)*10);</pre><p>and all kind of weird mutations like</p><pre>&amp;a[i], *(a+1), *a[9], &amp;&amp;a</pre><p>Ok, the last one is a compilation error but you must admit it looks just as rational as the rest.</p><p>So, what is your worst code list? Which languages win the most unreadable? Tell me in the comments :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6856f9e0a803" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Functional Programming — Higher Order Functions]]></title>
            <link>https://shay-tavor.medium.com/demystifying-functional-programming-higher-order-functions-3bf4544a5c30?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bf4544a5c30</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[ramdajs]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 09:24:49 GMT</pubDate>
            <atom:updated>2019-01-31T09:24:49.575Z</atom:updated>
            <content:encoded><![CDATA[<h3>Demystifying Functional Programming — Higher Order Functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z6Q1NnPB9kZsnIQFSjbTrg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/3UI-q-GOrlc?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">andrew welch</a> on <a href="https://unsplash.com/search/photos/ram?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Functional programming is a huge buzz nowadays and a lot unknowns about it. In this series I’ll try to unlock some of the common and most useful functional programming concepts, and with that I’ll show an interesting and effective JS library — Ramda.js.</p><p>Javascript’s ecosystem contains huge number of libraries and platforms that do almost anything you can imagine. One of my favorites is Ramda.js.</p><p>Ramda.js is a JS library that gives a set of utility tools for manipulating and handling arrays, collections, objects, strings and more. It’s not that different from similar utilities libraries like Lodash.js and Sugar.js, but Ramda has its specialty — it does it all with functional programming.</p><p>Everyone talks about functional programming, and there are a lot of definitions for this paradigm. I think that the most intuitive of them all says that functional programming treats functions as first class citizens, they are the main and most important entities. It also means that we can pass functions as parameters to other functions, or return functions as returned values, which I always found interesting.</p><p>A lot of languages have this feature, and that how it’s done in JS:</p><pre>function execute(arg1, arg2, op) {</pre><pre>    return op(arg1, arg2);</pre><pre>}</pre><p>The <em>execute</em> function accepts three parameters. The third of them, <em>op</em>, is a function, and the execute function invokes <em>op</em> on <em>arg1</em> and <em>arg2</em> and returns the result.</p><p>Now we can use this function like that:</p><pre>execute(3, 5, (a, b) =&gt; a + b);    // 8</pre><p>Functions that accepts or returns functions are called <strong>higher order functions</strong>.</p><p>Let’s look at an example from Ramda:</p><p>The function <em>any</em> accepts a predicate (function) and an array, and returns true if the predicate returns true on at least one of the array’s elements:</p><pre>R.any( x =&gt; x &lt; 0, [1, 2, 3, 4, 5]);    // false</pre><p>Here we pass the function <em>x =&gt; x &lt; 0</em> that checks if a number is negative. The function <em>any</em> then takes this predicate and invokes it over each of the array’s element. The next example would return true:</p><pre>R.any(x =&gt; x &lt; 0, [1, 2, -4, 5, -2]);    // true</pre><p>Now let’s try to practice that. Ramda has a function called <em>partition</em>. This function accepts a predicate and a list, and returns a list that contains two lists — in the first one located all the elements from the original list that returned true in the predicate, and in the last are the elements that got false.</p><p>Suppose we have a list of users, each user is an object that contains name and an age:</p><pre>let users = [{name: “John”, age: 17}, {name: “Sara”, age: 25},</pre><pre>             {name: “Bob”, age: 30}, {name: “Alice”, age: 16}];</pre><p>We want to split the list into two lists — the users that are under 18 and those who are above. How would we write it?</p><p>It would be very intuitive using the <em>partition</em> function:</p><pre>let results = R.partition(user =&gt; user.age &gt;= 18, users);</pre><p>Isn’t it nice?</p><p>If you liked it and feel curious about Ramda and other cool libraries, check out my new online course, <a href="https://www.udemy.com/javascript-greatest-hits/?couponCode=HITS-J19-1">Javascript Greatest Hits</a>.</p><p>Up next — functions composition in Ramda.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bf4544a5c30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Chunk — Part Two]]></title>
            <link>https://shay-tavor.medium.com/lets-chunk-part-two-dc754b0da244?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc754b0da244</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Tue, 25 Dec 2018 21:11:34 GMT</pubDate>
            <atom:updated>2018-12-25T21:11:34.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let’s Chunk — Part Two</h3><p>Previously in this blog we talked about the <a href="https://medium.com/@shay.tavor/lets-chunk-f1ab5257e6fd">chunk function</a> and implemented it in Javascript. Today I’ll try to show an example for using this function. This example popped into my mind when I read about the chunk function, because it reminded me of a question I’ve once gave to my students in an exam, and I think the chunk function could have been helpful for them had they known it.</p><p>The task goes like that — write a function called printWithCommas. The function would get two integers — num and d. The function would return a string represents num with a comma after every d digits from right. It is possible that the last leftmost part wouldn’t contain exactly d digits, according to d and the total digits in the number.</p><p>For example, if num was 12345678 and d was 3 the output would have been 12,345,678. And for the same num, if d was 2 the output would have been 12,34,56,78.</p><p>It’s not a very complicated problem, but it does have a twist because the only group of digits that can contain less than d digits is the leftmost one, but because of the nature of reading numbers, we usually start reading the number from right to left, using modulo operation, such as num % 10 to get the last digit.</p><p>Now when I thought about the chunk function it suddenly occurred to me that the number is divided into chunks of d digits. So the chunk function may be used here.</p><p>OK, I’ll say in advance — it’s a long shot and I guess solving this problem without the chunk function is not that difficult, and we do have to make some pre-processing before the chunk function can kick in, but I think it’s a good practice and demonstration of solving a problem in a creative way using existing tools.</p><p>To solve this problem we first have to convert the number into an array because the chunk function works on arrays. So after splitting the number into an array, the number 12345678 would yield the array [8, 7, 6, 5, 4, 3, 2, 1] note that the digits are in reversed order.</p><p>Now we can chunk them in chunks of d elements, using the chunk function. Note that according to the chunking algorithm, the last chunk can be with less than d elements, exactly as we defined in the question. For example, after chunking this array with d = 3 we’ll get the array — [[8, 7, 6], [5, 4, 3], [2, 1]].</p><p>We should output the digits with a comma between each chunk. But we should start printing the last chunk first, so let’s reverse the array and get — [[2, 1], [5, 4, 3], [8, 7, 6]].</p><p>Now it’s pretty easy — for each sub array in the array, print its elements and then print comma. Note that since the digits are in reversed order, we’ll print each sub array from end to start.</p><p>This is the code:</p><pre>function printWithCommas(num, d) {<br>   var numArr = [];</pre><pre>   // convert num to array<br>   while(num != 0) {<br>      numArr.push(num % 10);<br>      num = Math.floor(num / 10);<br>   }</pre><pre>   var res = “”;</pre><pre>   // create chunks of d elements each<br>   var chunks = chunk(numArr, d).reverse();</pre><pre>   // concat each chunk with a comma separator<br>   chunks.forEach(function(chunk, ind) { <br>               chunk.reverse().forEach(x =&gt; res += x);<br>               if(ind &lt; chunks.length — 1)<br>                     res += “,”;<br>           });</pre><pre>   return res;<br>}</pre><p>Was it worth it? I don’t know, it is probably an overkill for this problem. Nonetheless I think the solution is creative and elegant because it contains the essence of solving problems — it takes the given problem and transform it to another one, because we have a given solution to the other one.</p><p>What do you think?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc754b0da244" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Chunk]]></title>
            <link>https://shay-tavor.medium.com/lets-chunk-f1ab5257e6fd?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1ab5257e6fd</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[libraries]]></category>
            <category><![CDATA[chunking]]></category>
            <category><![CDATA[underscorejs]]></category>
            <category><![CDATA[lodash]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Sat, 15 Dec 2018 22:13:53 GMT</pubDate>
            <atom:updated>2018-12-15T22:13:53.801Z</atom:updated>
            <content:encoded><![CDATA[<p>There is huge amount of Javascript libraries that give us all kinds of functionality — DOM manipulations, AJAX calls, animations, DB querying, you name it. There is a library (and usually more than one) for everything. All those functions provided by the libraries can be done, of course, in pure Javascript.</p><p>Lodash and Underscore are two such libraries. They are very useful and contain a lot of utility functions that can make our life as Javascript programmers easier. I won’t describe here those libraries, but instead, for the practice, let’s write in pure Javascript one of Lodash’s neat function, called chunk.</p><p>The chunk function takes as parameters an array and a number (let’s call it num). The function returns a new array containing all the original array’s elements organized in chunks with the size of num. What it means is that we pass an array and get back an array of arrays, each of them (besides, maybe, the last) is in the length of num.</p><p>For example, if we had this array –</p><pre><em>var a = [1, 2, 3, 4, 5, 6, 7, 8];</em></pre><p>We could call the chunk function as follows (the results in the comments):</p><pre><em>var b = chunk(a, 2); // b = [[1, 2], [3, 4], [5, 6], [7, 8]]</em></pre><pre><em>b = chunk(a, 3);     // b = [[1, 2, 3], [4, 5, 6], [7, 8]]</em></pre><pre><em>b = chunk(a, 5)      // b = [[1, 2, 3, 4, 5], [6, 7, 8]]</em></pre><p>So how are we going to write that?</p><p>Most of the work is pretty simple — we take the next num elements from the array, push them to a new array and push this array to the result array. For example, given the array a from above, if we want to create 3-elements chunks, we would take the first three elements of the array — 1, 2, 3 — and put them in a new array, and then put this new array into the result — [[1, 2, 3]]. Then we’ll take the next three elements — 4, 5, 6 — and again put them into a new array and push it to the result — [[1, 2, 3], [4, 5, 6]].</p><p>This process would continue until we don’t have enough elements to fill a chunk. In this case, all the elements that are left just put into a new array. In this example the numbers 7 and 8 would be alone in the last chunk. How do we know that we don’t have enough elements to fill a chunk? If the index we’re in is bigger than the array length minus num. Try it with examples and see it’s correct. So here is the code:</p><pre><em>function chunk(a, num) {</em></pre><pre><em>   var res = [];</em></pre><pre><em>   var i = 0;</em></pre><pre><em>   while(i &lt;= a.length — num) {</em></pre><pre><em>      var chunk = Array(num);</em></pre><pre><em>      for(var j = 0; j &lt; num; j++)</em></pre><pre><em>         chunk[j] = a[i + j];</em></pre><pre><em>      res.push(chunk);</em></pre><pre><em>      i += num;</em></pre><pre><em>   }</em></pre><pre><em>   if(i &lt; a.length)</em></pre><pre><em>      res.push(a.slice(i));</em></pre><pre><em>   return res;</em></pre><pre><em>}</em></pre><p>Cool, ah?</p><p>So this is how we implemented the chunk function, and again, using lodash.js we would get this function for free but hey, it was fun doing it by ourselves, wasn’t it?</p><p>In the next article I’ll try to show an example for using this function, until then, try to think what would the function return if num was bigger than the array’s length? Or if it was negative? Or if the array was empty?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1ab5257e6fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Start Here — First Steps in WebDev]]></title>
            <link>https://shay-tavor.medium.com/start-here-first-steps-in-webdev-519343ac26f6?source=rss-d61c1a9e025c------2</link>
            <guid isPermaLink="false">https://medium.com/p/519343ac26f6</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shay Tavor]]></dc:creator>
            <pubDate>Tue, 13 Nov 2018 07:11:54 GMT</pubDate>
            <atom:updated>2018-11-13T07:11:54.600Z</atom:updated>
            <content:encoded><![CDATA[<h3>Start Here — First Steps in WebDev</h3><p>TL;DR — Learn HTML, CSS, JS, they are the tools of the past, present and future.</p><p>Web development is a big thing nowadays, and probably would be in the next coming years. Web development is the field of writing applications that would run and accessed via the web browser. The web development field had gone (and is going every day!) through tremendous changes. From the very first days of the internet and to our present days, the web technology advances in huge steps, making state of the art technologies obsolete, creating new technologies almost on monthly basis, and attracting more and more developers, companies and industries to the web development area.</p><p><strong>What is a web development really?</strong></p><p>In web development we build <strong>web applications</strong>. A web application is an application that is rendered on the browser, and accessed by the user through the browser. Simply put — when you order tickets to movie in your home town theatre, when you check your bank account balance, when you write a post on Facebook or update your resume on LinkedIn, all of these and more are examples to web applications. You open a web browser, go to a specific URL, and get a full working application. Today you can even find sophisticated applications on the web, like sound and video editing applications, drawing, recording, gaming, word processing, you name it. They’re all on the web, and all are accessed via the browser.</p><p><strong>So, how do I build one?</strong></p><p>Like any other field, web development has its own jargon and tools. Since the technology becomes more able and strong, new platforms, languages and tools arise every day. But over the years that passed and probably for the years to come, there are three essentials tools and skills that stand in the base of <strong>every</strong> web application — those are html, css and javascript, and I call them The Triad.</p><p><strong>What is HTML?</strong></p><p>HTML (stands for HyperText Markup Language) was invented by Tim Berners-Lee in the late 1980’s. It’s a standard that contains data to be rendered on the browser, and directions of how to render it. The browser reads HTML document that tells it what to show and how to show it. For example, we can tell the browser to show the sentence “Hello World”, and if we want the browser to make it bold, we’ll add HTML directions (called “markups”) that would direct the browser how to render the text. In this manner, html contains the data (What to be shown) and the meta-data (how it would be shown).</p><p><strong>What is CSS?</strong></p><p>HTML comes with very narrow set of abilities to style the page. For real styling we use CSS (stands for Cascading StyleSheet). CSS contain rules that control the page styling and actually can do anything — we can change font family, size, decoration, we can change background colors, images, shadows, gradients, every type of styling is possible with CSS, and more features are added all the time.</p><p><strong>What is Javascript?</strong></p><p>Javascript (abbreviated to JS) is a programming language that was invented in the mid 1990’s and its main and primary goal was to enable simple functionality to the HTML. For example, if we built a HTML form in which the user should fill his/her name, we could use JS code to validate the input. Over the years, and really in the last decade, JS had become from a modest, inefficient and kind of “toy” language, to a monstrous creature that controls every last aspect of the web. Everything in the web development world is done with JS, and its popularity increases by every known matrix.</p><p><strong>But hey, people really build web apps using those three tools?</strong></p><p>The answer is yes and no. HTML is too complicated, CSS is a mess and JS code tends to be unmaintainable very quickly, so you can’t really write a web app that is more than trivial and keep your sanity.</p><p>Over the last decade tons of tools were invented to overcome those Triad’s disadvantages, and modern web applications are written in variety of modern, new and shiny tools. You probably heard some buzzwords like Angular, React, Vue, Meteor, Bootstrap, Node and so on. To be a web developer you will probably have to learn one (and usually much more than one) of those tools.</p><p>But here is the trick — every platform, every modern tool, with no exception at all, works on the same basic tools — HTML, CSS, JS. No Exceptions, and I mean it. That means that you just can’t start learning how to develop web application without them. If you try to start learning Angular for example, without any knowledge in the three basic tools, you’ll get nowhere. So the conclusion is that you have to learn the basic tools and to use them as a jumpstart to other newer tools.</p><p><strong>Another advantage for learning the basic triad</strong></p><p>Even if you somehow manage to learn reasonably enough one platform without the triad, you are not safe! As mentioned earlier — the web development world is crazy and moving fast. I mean <strong>very</strong> fast. New platforms are invented on day to day basis. New libraries, new tools. AngularJS had started in 2010, but now it is version 7 and the Angular paradigm had changed drastically during this time. Vue.js was presented in 2017, and as to the time I’m writing those lines, there is some trend to migrate to Vue.js from other platforms. And it’s not the end. One just can’t keep track of all the new ideas and innovations with this influx of ideas. What I’m saying is that if you don’t know the basics, you’d be irrelevant the minute a new technology appears. If you knew only AngularJS, what would you do when version 3 came along, and it’s different from the one you know? But since the basic triad — html, css and js — stands at the basis of every platform, when you know it you can migrate to any other new and shiny platform.</p><p>In the bottom line — learn html, css and js if you want to be a web developer. They are not going anywhere anytime soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=519343ac26f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>