|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
I didn't make the distinction between any character and a letter in that previous question. How would you respond to an applicant making that mistake?
On June 13 2017 12:48 Mr. Wiggles wrote:Show nested quote +On June 12 2017 10:10 Manit0u wrote:On June 12 2017 06:36 Fwmeh wrote:On June 12 2017 03:12 Manit0u wrote:On June 11 2017 22:24 BrTarolg wrote: Hi!
I just completely learn python the hard way (except for the bits about creating web-pages)
And now im here haha. I wrote a blackjack simulator and tictactoe with some unit tests. Hoping to enter to do a masters in CS so i can do a career swap I did career swap without any kind of degree in CS (all I have is bachelor's in Sociology and I've been following a successful programming career for the past 4 years with steadily increasing gains and positions). Just so you know, unless you're working with something that's very close to the "sciency" part of the CS you probably won't use 90% of what you learn there in a real work (especially not the way they teach you to program). I have a friend who has a PhD in CS (specializing in distributed systems and parallel computing), he switched from academic work to regular programming and his opinion is that he was living in the dark for all those years and even programmers just above junior position were better than him in the beginning. There's plenty of people in my company (myself included) who'd love to get a degree in cognitivistics but unfortunately they don't offer weekend or evening classes so you can't really do that and work at the same time. Philosophy is actually super useful in programming since they teach you plenty of logic and abstractions in there. I would actually strongly disagree. I would estimate that I have had use of roughly 80% of what I learned at university, either directly or indirectly. Looking back, I realize just how good our initial programming courses were. That said, there were some very huge gaps, at least with the courses I took, most obviously: 1) How to work in larger, collaborative code-bases over a long period of time. 2) How to work effectively with requirements in a non-trivial business domain 3) How to manage legacy code/systems. But the reason I would prefer to hire people with degrees over those without is simple that a degree is at least some hint (however imperfect) that I'm dealing with someone capable of learning. Hopefully fast, and hopefully reasonably sophisticated things. The most valuable thing (to me) in a potential hire would be a desire to always improve and learn new things. It all depends on your uni (obviously, some have better courses than others). I just don't think it's a huge requirement or anything and way too many people think that if they get their CS degree they'll instantly become programmers (you wouldn't believe how many people apply for a job in my company only to learn they can't solve the most basic interview question). I even though about getting an engineer degree but when I solved some of the problems my friend needed help with (he was doing it at the time) I realized that it would just be a waste of every second weekend for the next 3 years just to get the paper. They give people some weird problems and after they get their degree they can't solve basically the only problem we give at interviews: Write a function (any language, can be pseudocode, doesn't have to be optimal) that gets a string as a parameter and returns first unique letter in it (or return '?' if no unique letter is found). Every single candidate is posed with this problem. It's not super trivial, but it doesn't require knowing anything past the absolute basics and some thinking. We do 5-10 interviews each week and we hired 3 people over past 4 months (and we need like 20 more). Most candidates fail on the above problem. Since everyone else is doing it  (In Python) + Show Spoiler + from collections import Counter
def first_unique_letter(string): frequency = Counter(string)
for character in string: if character.isalpha() and frequency[character] == 1: return character
return "?"
+ Show Spoiler [Test Run] +>>> from unique import first_unique_letter >>> first_unique_letter('bab') 'a' >>> first_unique_letter('!@#a') 'a' >>> first_unique_letter('aaabbb') '?' >>> first_unique_letter('!@#$') '?' >>> first_unique_letter('abc') 'a' Not the most optimal solution, but it's pretty clean. At my company, we normally get things rolling by trying to make sure that you know low-level programming in the form of C. For example, given a string, reverse all individual words within the string. For simplicity, assume all input is composed of letters and spaces. e.g. [code]void reverse_all_words(char *input, size_t len); "Hello World" => "olleH dlroW" "My name is Bob" => "yM eman si boB" "abc bb " => "cba bb " Bonus points if you do it space-efficiently.
Assuming a constant worst case amount of extra space is efficient:
+ Show Spoiler + void swap_word(char* word_start, char* word_end) { char swap_space; while(word_start < word_end) { swap_space = *word_start; *word_start = *word_end; *word_end = swap_space; ++word_start; --word_end; } }
void reverse_all_words(char* input, size_t len) { char* word_start = NULL;
for(size_t i = 0; i < len; ++i) { if(word_start == NULL && input[i] != ' ') { word_start = input + i; } else if(word_start != NULL && input[i] == ' ') { swap_word(word_start, input + i - 1); word_start = NULL; } }
if(word_start) { swap_word(word_start, input + len - 1); } }
|
On June 13 2017 13:13 dekibeki wrote: I didn't make the distinction between any character and a letter in that previous question. How would you respond to an applicant making that mistake?
It doesn't really matter. We even take some people who fail it but show good effort (we have one girl who failed it but on her first day submitted a very nice solution in PHP). It's really there just to see if you either know your way around a language or you know how to think (avoiding potential pitfalls like infinite loops etc.).
My own solution was pretty crap too, I took a letter, walked the array and if I didn't find it again I returned it. If I found the letter again I removed all copies of it from the array and moved on to the next one (not super optimal but it was more efficient with each pass).
|
|
|
|
|
Theoretically, tabs are superior in every single way to spaces. Practically, tabs are a nuisance.
|
I just use my IDE an press CTRL+I to format it in whatever way it is configured to do.
Tabs are for indentation, spaces are for alignment.
I never understood why people gave a shit about this. Some languages run faster with spaces instead of tabs, and some vice versa. Anything else is people being anal about if they like 2 space indentations or 4 space. Just do what you like, or if you are on a team, do what the team lead likes.
|
|
Sure, but that isn't answered at all by the everlasting question. Say you prefer 1 space indentation. What if I prefer 2? or 3? I'm pretty sure tabs default to 4 spaces. Just use tabs and let your IDE take care of how wide you want your tabs to be. If there is small things you want to make look nicer, you can use a space.
Tabs vs Spaces just feels like a meme and I bit the bait really hard.
|
When your opening brackets are in a separate line your code is already 436% more sexy.
|
On June 20 2017 11:26 Thaniri wrote: I never understood why people gave a shit about this. Some languages run faster with spaces instead of tabs, and some vice versa.
This surely only applies to compiling, right? ...right?
I also remember that (at least back then) with python there was a legit reason to use spaces instead of tabs since python uses tabs/spaces instead of brackets and the Linux tab was like 5 spaces and the windows tab was 4 or something like that. I believe this isn’t an issue anymore.
also: http://www.tylervigen.com/spurious-correlations
|
On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy. Nope. Just padding with extra lines for no good reason at all. Making your code needlessly long and very unsexy.
|
On June 20 2017 13:18 Nesserev wrote:Show nested quote +On June 20 2017 11:26 Thaniri wrote: Tabs are for indentation, spaces are for alignment.
Does this actually work though? Once you change the indentation width, "spaces for alignment" doesn't work anymore, right? Or it will look ugly, at the least. It does work:
void foo(void) { <---tab--->do_something(variable1, <---tab---><---space--->variable2, <---tab---><---space--->variable3); }
enum { <---tab--->FOO<-------space------->= 5, <---tab--->LONGEST_FOO<---space--->= 50, <---tab--->LONGER_FOO<----space--->= 500, };
|
On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy.
When you're writing in a language that doesn't use brackets your code is already 500% more sexy
|
On June 20 2017 18:10 Biolunar wrote:Show nested quote +On June 20 2017 13:18 Nesserev wrote:On June 20 2017 11:26 Thaniri wrote: Tabs are for indentation, spaces are for alignment.
Does this actually work though? Once you change the indentation width, "spaces for alignment" doesn't work anymore, right? Or it will look ugly, at the least. It does work: void foo(void) { <---tab--->do_something(variable1, <---tab---><---space--->variable2, <---tab---><---space--->variable3); }
enum { <---tab--->FOO<-------space------->= 5, <---tab--->LONGEST_FOO<---space--->= 50, <---tab--->LONGER_FOO<----space--->= 500, };
Urghhh. In your first example, the next dev comes along and changes the method name to do_some. Alignment is all messed up, so he deletes the tabs below and puts spaces to fill to requirement. Next person comes along and has a different setting for tab width. GG.
In your second example, I hate that shit. 3 weeks later, I want a new variable called LONGESTER_FOO, now I have to go through adding spaces everywhere? No. Just accept that the assignments are higgledypiggledy.
|
On June 20 2017 17:55 Acrofales wrote:Show nested quote +On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy. Nope. Just padding with extra lines for no good reason at all. Making your code needlessly long and very unsexy.
Yeah, like needlessly long legs on women. Uhm, wait...
On June 20 2017 18:31 Manit0u wrote:Show nested quote +On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy. When you're writing in a language that doesn't use brackets your code is already 500% more sexy 
But would you use tabs or spaces when writing e.g. python? I'm a man of spaces. Space is ace.
I'll see myself out now.
|
On June 20 2017 18:31 Manit0u wrote:Show nested quote +On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy. When you're writing in a language that doesn't use brackets your code is already 500% more sexy 
I honestly don't really get the notion of brackets versus spacing... just like with almost all syntax discussions it is just a case of getting used to it and afterwards you won't feel a difference. Not pointing at you of course, I assume you were just semi-serious, but I feel like the brackets vs spacing-thing is just some hipster-issue. Whenever this comes up I feel like spaces are cool just because brackets get associated with 'old' languages and could easily be reversed. I for once don't feel any difference when reading space or bracket code, unless of course I have spent some time with only reading one and not the other. Even then it will take a couple of days max to not feeling a difference again.
And I am writing this, because I seriously had this discussion and just like people disliking languages because they are using them incorrect/for the wrong purpose, I really don’t see how someone can try to objectively argue for this. Even though the language thing really drives my gear in comparison… Isn’t the whole point of graduating being able to choose the right tool for the job?
Oh and fuck people who name their functions in a way that autocomplete gets inefficient...
|
On June 20 2017 19:16 Khalum wrote: But would you use tabs or spaces when writing e.g. python?
https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces
On June 20 2017 19:28 waffelz wrote: I honestly don't really get the notion of brackets versus spacing... just like with almost all syntax discussions it is just a case of getting used to it and afterwards you won't feel a difference. Not pointing at you of course, I assume you were just semi-serious, but I feel like the brackets vs spacing-thing is just some hipster-issue. Whenever this comes up I feel like spaces are cool just because brackets get associated with 'old' languages and could easily be reversed. I for once don't feel any difference when reading space or bracket code, unless of course I have spent some time with only reading one and not the other. Even then it will take a couple of days max to not feeling a difference again.
And I am writing this, because I seriously had this discussion and just like people disliking languages because they are using them incorrect/for the wrong purpose, I really don’t see how someone can try to objectively argue for this. Even though the language thing really drives my gear in comparison… Isn’t the whole point of graduating being able to choose the right tool for the job?
Oh and fuck people who name their functions in a way that autocomplete gets inefficient...
I must say that I was of the same opinion as you are some time ago (when I was switching from PHP to Ruby), but after a while of using the "no brackets and semicolons" language I must say that it's getting increasingly harder for me to go back (and I'll have to do that since I need to learn me some JEE).
Writing brackets and semicolons just seems like a real nuisance with very little benefit (the only benefit I see is when people write multiple statements per line, which is shit anyway and you can do that in Ruby using semicolons too if you want). It just feels like a needless syntactic sugar to guard against noobs writing code the wrong way. I believe that was the main reason for Python to abandon them (although I think they went a bit too far and I much prefer Ruby's "def ... end" syntax) and I have to agree. If you need all those brackets and semicolons to figure out where things start and end in your code then it's probably bad code to begin with.
|
On June 20 2017 19:16 Khalum wrote:Show nested quote +On June 20 2017 17:55 Acrofales wrote:On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy. Nope. Just padding with extra lines for no good reason at all. Making your code needlessly long and very unsexy. Yeah, like needlessly long legs on women. Uhm, wait... Show nested quote +On June 20 2017 18:31 Manit0u wrote:On June 20 2017 16:33 Khalum wrote: When your opening brackets are in a separate line your code is already 436% more sexy. When you're writing in a language that doesn't use brackets your code is already 500% more sexy  But would you use tabs or spaces when writing e.g. python? I'm a man of spaces. Space is ace. I'll see myself out now.
Just use tabs that save as spaces, to everyone but you you use spaces but to you you use tabs EZPZ
The it becomes a 2 space vs 4 space argument and we all know 3 spaces is superior
|
|
|
|