Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "recursion = recursion"
... so... maybe not that much of a thing, but i think it is:
a gal (27 years old) i started teaching programming two weeks ago, who had literally no previous experience with programming, algoritmization nor c#...
... just now, after 3 lessons of 6 hours altogether, and after yesterday when i explained to her what arrays are and reminded her what loops do...
... invented bubble sort. on her own. no googling. on paper. no "trial and error code typing and running".
i'm actually pretty proud of her :)
... putting the algo concept into actual code will still be a bit of a struggle, but yeah, hell, can't help thinking that she's actually pretty smart :)
(p. s. fist lesson was i drew uml of a fibonacci algo and forced her to understand what it does, second lesson was i explained the minimum required c# syntax for her to be able to implement it and forced her to write it (with as little help as i could), third lesson was the concept of array and "okay, now here's array of numbers, make a function that will sort them")
looking forward to what will happen when i explain recursion and nudge her towards quicksort O:-)8
At a restaurant in Augustow there was a sign: "please wait for the waiter"
it confused me. If I'm waiting for the waiter, then what/who's the waiter: the one who's being waited for or the one waiting?
If I'm waiting for the waiter, do I become the waiter?
I think this is a good spot for a recursion bug to occur, resulting in waiter leaks.4
I don't know if I'm being pranked or not, but I work with my boss and he has the strangest way of doing things.
- Only use PHP
- Keep error_reporting off (for development), Site cannot function if they are on.
- 20,000 lines of functions in a single file, 50% of which was unused, mostly repeated code that could have been reduced massively.
- Zero Code Comments
- Inconsistent variable names, function names, file names -- I was literally project searching for months to find things.
- There is nothing close to a normalized SQL Database, column ID names can't even stay consistent.
- Every query is done with a mysqli wrapper to use legacy mysql functions.
- Most used function is to escape stirngs
- Type-hinting is too strict for the code.
- Do not use a package manger composer because he doesn't have it installed.. Though I told him it's easy on any platform and I'll explain it.
- He downloads a few composer packages he likes and drag/drop them into random folder.
- Uses $_GET to set values and pass them around like a message contianer.
- One file is 6000 lines which is a giant if statement with somewhere close to 7 levels deep of recursion.
- Never removes his old code that bloats things.
- Has functions from a decade ago he would like to save to use some day. Just regular, plain old, PHP functions.
- Always wants to build things from scratch, and re-using a lot of his code that is honestly a weird way of doing almost everything.
- Using CodeIntel, Mess Detectors, Error Detectors is not good or useful.
- Would not deploy to production through any tool I setup, though I was told to. Instead he wrote bash scripts that still make me nervous.
- Often tells me to make something modern/great (reinventing a wheel) and then ends up saying, "I think I'd do it this way... Referes to his code 5 years ago".
- Using isset() breaks things.
- Tens of thousands of undefined variables exist because arrays are creates like $this = 5;
- Understanding the naming of functions required me to write several documents.
- I had to use #region tags to find places in the code quicker since a router was about 2000 lines of if else statements.
- I used Todo Bookmark extensions in VSCode to mark and flag everything that's a bug.
- Gets upset if I add anything to .gitignore; I tried to tell him it ignores files we don't want, he is though it deleted them for a while.
- He would rather explain every line of code in a mammoth project that follows no human known patterns, includes files that overwrite global scope variables and wants has me do the documentation.
- Open to ideas but when I bring them up such as - This is what most standards suggest, here's a literal example of exactly what you want but easier - He will passively decide against it and end up working on tedious things not very necessary for project release dates.
- On another project I try to write code but he wants to go over every single nook and cranny and stay on the phone the entire day as I watch his screen and Im trying to code.
I would like us all to do well but I do not consider him a programmer but a script-whippersnapper. I find myself trying to to debate the most basic of things (you shouldnt 777 every file), and I need all kinds of evidence before he will do something about it. We need "security" and all kinds of buzz words but I'm scared to death of this code. After several months its a nice place to work but I am convinced I'm being pranked or my boss has very little idea what he's doing. I've worked in a lot of disasters but nothing like this.
We are building an API, I could use something open source to help with anything from validations, routing, ACL but he ends up reinventing the wheel. I have never worked so slow, hindered and baffled at how I am supposed to build anything - nothing is stable, tested, and rarely logical. I suggested many things but he would rather have small talk and reason his way into using things he made.
I could fhave this project 50% done i a Node API i two weeks, pretty fast in a PHP or Python one, but we for reasons I have no idea would rather go slow and literally "build a framework". Two knuckleheads are going to build a PHP REST framework and compete with tested, tried and true open source tools by tens of millions?
I just wanted to rant because this drives me crazy. I have so much stress my neck and shoulder seems like a nerve is pinched. I don't understand what any of this means. I've never met someone who was wrong about so many things but believed they were right. I just don't know what to say so often on call I just say, 'uhh..'. It's like nothing anyone or any authority says matters, I don't know why he asks anything he's going to do things one way, a hard way, only that he can decipher. He's an owner, he's not worried about job security.13
Back from the dead with more vaguely-obscure technical bullshit
Working on a chatbot for my BS-CS. Almost done with college, so the assignment is to make a bot that recommends you a CS career. Cool.
I get through making a joint personality and skill-interest quiz that gives you number grades on different spectra. So far, so good. But this project has to be done entirely in pandorabots' online editor. So no scripting. Zero scripting. 100% markup language. That means to even do math, you need to copy a standard library off GitHub.
I mean, that's fine and all, but the syntax is just atrocious, because everything in AIML is input->response. If you ask the bot "what is 5+5?" you must have it go:
- recognize pattern WHAT IS * + *
-> redirect -> XADD * XS *
-> do math -> recurse result
uncomfy. Plus, variables can only be accessed through <get> and <set> tags. But mangeable.
So here's where the story becomes a rant.
In the standard docs, there's all these math functions, and they work. There's also logic.
And then there's this fucker
XIF [ * ] XS [ * ]
Which has no documentation and just doesn't work. No idea what the brackets mean. Tried putting in TRUE, tried putting in true math statements (5 XEQ 5), tried putting in recursion tags to trick it, tried everything. It just ignores it.
There is not a single comment, stackOverflow post, or youtube video that even acknowledges the existence of this thing.
So unless I want to convert the entire logic of my program into nested SWITCH statements with the <condition> tag, I'm just fucked.
The icing on the cake is, I go to tech support on Pandorabots to ask for help with this. What do they have except a chatbot to cheerfully tell me that no humans are around to help me right now?
gonna have to build an entire fuckin turing machine in markup tags to calculate whether x = 3
I hate my brain.
Got a compliment, my brain automatically rejected it and judged it.
Then it started to judge the judgement. Then the judge^3.
Then go all the way to the recursion.
For the last few days my brain is making me lose focus on everything because of this.
And the most fucked up thing is, I am paranoid of my own brain, so I really judged my memories and shit. I think I am losing my mind, my uni doesn't have consulting for students either nor I have money.
Any advices from ppl who went to a psychologists will be appreciated. A lot.13
I'm learning Rust as a case study for my own programming language. It's funny how many approaches exist to the humble loop.
- In classic procedural languages, a loop's job is to repeat actions, and as such it provides a multitude of tools to control this repetition.
- In all languages with iterators, a for-in loop is a construct that does something with every element of a collection. In languages with both iterators and generator functions, this can even be used to define a sequence in terms of another.
- In Rust, a loop is an expression that obtains its value through repeated execution. It can also be used like a classic loop, of course, but this is the interesting part.
- My little language is a functional language, so "loop" is the Y combinator. To loop means to define the value of an expression in terms of itself. It's the only looping construct, gets special treatment from the type checker and it's also used in recursive type definitions.
does recursion have any practical use outside of being a cute/elegant solution under constraints where stack overflow isn't a concern due to small input size, and leetcode?
im having trouble thinking of anywhere you could justify using recursion in industry outside of leetcoding people
i assume the iterative approach would be preferred in scenarios where scaling matters18
IF I see something infinite and more than three.
and never more than three in real world.
I use recursion.
because who knows, people are crazy.