|
My freshman high school CS classes actually started with functional Logo, though honestly I don't think any of us appreciated what that meant, it largely seemed like a tool to teach recursion at the time.
|
# ? Jan 25, 2014 09:53 |
|
|
# ? Jun 6, 2024 05:00 |
|
evensevenone posted:I don't think it's really that surprising. Functional languages are kind of trendy for first-year CS education right now, but it's hardly all schools that do it that way or some kind of fundamental requirement of a CS program. Lots of places still use Java or some combination of Python, C and C++. Some places even use Lisp. Is that a new trend? If so what's old is new again. My university's CS program originally used Scheme and SICP for the first year intro courses, but switched to Java in 1998, the year before I started there. The rest of the sequence was extremely theory-heavy and outside of learning C++ in an OO design course, any "practical" knowledge you got, you had to get on your own. As a result, people who graduated without having done internships were pretty well screwed on job prospects. (that said, I have zero problem with a theory-heavy program) I did not see a functional language in coursework until my third year. I took a course on deeper fundamentals of programming languages, where over the course of the semester you'd end up with an interpreter for a toy language and you'd implement it in Scheme. The course was a requirement for the computer science degree; however it was a 400 level class and due to the mess of trying to schedule all your requirements, most people didn't take it until their third or fourth year.
|
# ? Jan 25, 2014 16:53 |
|
My degree taught Java for the first two years and then did a combined 'Operating Systems and C/C++' module in year 3 which was about as effective as you might expect when you try and teach too much too quickly. When I'd finished that course you'd be lucky to get me to produce code that didn't segfault if it was more complicated than Hello World. We were given the choice between Haskell or Prolog in the second year, though. The Haskell course was pretty good but it only taught you to use monads, not understand them, and never use them for more than IO or ordered instructions.
|
# ? Jan 25, 2014 17:44 |
|
Shinku ABOOKEN posted:Actually she is right. Freshman and Sophomore year are usually full of 101 courses from different unrelated majors (mandatory electives). Eh, okay buddy. Went to school too. People reaching their third year without going into an intro language course is what I am surprised about. Oddly enough my school actually taught Scheme for intro classes ~13 years ago. This was right after they dumped C++ as the AP language which caused most of the other universities to switch over to Java as well. Oddly enough, I tested out of the intro class so instead I was put into a class that taught Java which they didn't have an intro course on.
|
# ? Jan 25, 2014 22:02 |
|
People go...to college...for programming?
|
# ? Jan 26, 2014 00:31 |
|
Doc Hawkins posted:People go...to college...for programming? If you want to learn Java, because that's all they teach for some silly reason.
|
# ? Jan 26, 2014 01:00 |
|
Doc Hawkins posted:People go...to college...for programming? This also confuses me. I was being served by a guy in Morrisons (uh, it's a superstore for you foreign, Nick Griffin hated folk) who was studying game development. He had jumped straight into the uni (what could be called 'college' for Americans) course without any programming knowledge at all. Surely you should have a knowledge of at least some sort of programming before you join, like, gently caress, you need a good grasp of Maths before you start a degree in Pure Maths, right?
|
# ? Jan 26, 2014 01:11 |
|
When the most advanced computer class your high school offers is Introduction To Excel, yes, you may need some programming guidance in university.
|
# ? Jan 26, 2014 01:23 |
|
Pretty sure they do the intro to programming courses so they can be sure everyone has a baseline knowledge. Seems to me to be preferable to trying to teach functional programming to autodidacts of the school of Rasmus Lerdorf.
|
# ? Jan 26, 2014 01:24 |
|
carry on then posted:Pretty sure they do the intro to programming courses so they can be sure everyone has a baseline knowledge. Seems to me to be preferable to trying to teach functional programming to autodidacts of the school of Rasmus Lerdorf. I'm slightly offended by that. You're right though, personal experience (IE: what I do as a job) says it's 100% true, although I've been thinking of giving Erlang a bash - who needs ifs!
|
# ? Jan 26, 2014 01:29 |
|
Misogynist posted:This code just turned up in some code I'm writing to integrate Crossroads.js with Backbone Curious, how is that integration going? I'm extremely frustrated with Backbone's lovely router, having been used to Ember's wonderful, promise-ified, basically magical router, and have been looking for an escape. I've been considering trying to get router.js (which Ember's router is built on) working with Backbone, but that seems like a dark road to go down. abraham linksys fucked around with this message at 01:41 on Jan 26, 2014 |
# ? Jan 26, 2014 01:38 |
|
Westie posted:Surely you should have a knowledge of at least some sort of programming before you join, like, gently caress, you need a good grasp of Maths before you start a degree in Pure Maths, right? The math prerequisite education (i.e. pre-calc) is supplied by universities for those who need it and is also provided for free by virtually all first-world high schools. You probably want to take pre-calc or at least some trig before starting calculus. Meanwhile you only need a basic grasp of algebra to get started programming or started with a CS degree, and high schools are typically awful at teaching intro CS or programming. Programming just has a lot less scaffolding, you don't need general knowledge about real numbers or anything.
|
# ? Jan 26, 2014 01:46 |
|
Doc Hawkins posted:People go...to college...for programming? One of the best programmers I ever had the pleasure of working with learned programming by starting with CS 101 at his university. He had never written a single line of code before then. The common stereotype of "you had to do it your entire life or you're a worthless piece of poo poo" isn't true, and it only discourages those who want to start learning in university. It needs to stop. Practice and dedication are what's important, not at what age you first typed "hello world".
|
# ? Jan 26, 2014 03:30 |
|
Suspicious Dish posted:One of the best programmers I ever had the pleasure of working with learned programming by starting with CS 101 at his university. He had never written a single line of code before then. Which is true for any skill. I see it in Art the most, too many people saying "well, I didn't start when I was six years old so I'll never be good" and quit or never begin. I've seen some people start at the age of 25 and within 5 years end up in art galleries. It's about effort, determination, and productive/targeted practice.
|
# ? Jan 26, 2014 04:01 |
|
If anything, teaching yourself is a good way to learn bad habits that have to be broken later. There's nothing wrong with a good formal education (although there's plenty of opportunity for bad formal education, too)
|
# ? Jan 26, 2014 04:31 |
|
Suspicious Dish posted:The common stereotype of "you had to do it your entire life or you're a worthless piece of poo poo" isn't true, and it only discourages those who want to start learning in university. It needs to stop. I agree! I personally didn't start until I was a few years out of college. The joke was supposed to be about how people like me can get good careers with absolutely no formal education in the field, but apparently I am the humor-horror as well as the regular kind.
|
# ? Jan 26, 2014 04:38 |
|
QuarkJets posted:If anything, teaching yourself is a good way to learn bad habits that have to be broken later. There's nothing wrong with a good formal education (although there's plenty of opportunity for bad formal education, too) I think that your point here also touches on the fact that 'formal education' isn't the solution, really. Just like you say you can get good and bad formal education, you can get good self-taught and bad self-taught people. It's more about your interest in exploring what you're learning. I'd struggle to name an influential CS figure who wasn't primarily self-taught in their field of excellence. Although I'll agree that for most of us mediocre programmers formal education is better than loving things up because of ignorance.
|
# ? Jan 26, 2014 20:59 |
|
But it's also true that a lot of those influential CS figures were learning programming back when there wasn't much formal education available.
|
# ? Jan 26, 2014 22:38 |
|
Stanford didn't even have an undergraduate CS program until the mid-80s.
|
# ? Jan 26, 2014 23:22 |
|
College courses that teach programming all vary wildly in structure in content with the only constant being that their structure and content almost assuredly sucks. Please do not ruin my world view with stories of your Stanford, MIT, and CMU CS courses, those obviously do not count. For a related coding horror, I present some mime-type checking code I wrote for a school project where we had to make an application with the minimal functionality of Google Docs: code:
Speaking of compiler horrors in uni, we had to write an Android->JS transcompiler, so I chose to generate Coffeescript and compile that into JS using the `coffee` tool. To support overloaded functions in Coffeescript (since we used an ANTLR Java grammar and didn't know anything about Android), I mapped all function names of a class to a set of definitions of different argument lengths and parameter lists and in the generated Coffeescript I defined each class function by switching on argument length and then doing type checking on each argument for each length case. Basically, the following code in Java: code:
code:
|
# ? Jan 27, 2014 04:10 |
|
Voted Worst Mom posted:Honestly, I don't know how you're really supposed to do this anyways, but I know this isn't the right solution. a set. quote:Speaking of compiler horrors in uni, we had to write an Android->JS transcompiler, so I chose to generate Coffeescript and compile that into JS using the `coffee` tool. To support overloaded functions in Coffeescript (since we used an ANTLR Java grammar and didn't know anything about Android), I mapped all function names of a class to a set of definitions of different argument lengths and parameter lists and in the generated Coffeescript I defined each class function by switching on argument length and then doing type checking on each argument for each length case. if you weren't expected to have your output code work with other bits of javascript, you could've just output however many different versions of a function with a separate unique identifier. ex. getBones(Int,Int,Int) and getBones(List,List,List) would become getBonesIntIntInt and getBonesListListList (or something less brittle).
|
# ? Jan 27, 2014 05:14 |
|
FamDav posted:a set. I'm referring to actually populating that set to catch the correct video formats. It seemed like a "video/" filetype would be a catchall for videos. I just added the four other on, but I never tested whether any vulnerabilities could happen and I found out a couple of years later (with the site running on my linode still for some reason) that it was vulnerable to this old PHP hack since I couldn't think of better ways to find out if a file was really a video/audio file or not.
|
# ? Jan 27, 2014 07:50 |
|
Back a few pages people were complaining about using exceptions for control flow. Here's some code you'll love:code:
|
# ? Jan 29, 2014 02:32 |
|
FoiledAgain posted:Back a few pages people were complaining about using exceptions for control flow. Here's some code you'll love: This is exactly what I fear people really mean when they boast about their increased productivity with dynamically typed languages.
|
# ? Jan 29, 2014 03:54 |
|
But It's Better To Ask Forgiveness than Permission, wouldn't want to mess up that lovely duck typing!
|
# ? Jan 29, 2014 04:08 |
|
I'm inclined to think the horror is that the function's return type is one of multiple things - just because there's no restrictions on the return type for the function doesn't mean you should just return whatever sludge you come up with and let the caller sort it out. Presumably "string or tuple" is an abbreviation of "string or tuple of strings" - just return a tuple with one element, it's probably closer to the semantics of the function in question ("returns all names matching a particular search query" or something of the sort) and means you don't have to play silly games to work out how to process the return value. e: that said, I can acknowledge a deficiency in Python in that its tuples and lists are too similar given that there's a cultural expectation that they have different semantics. There should be a dedicated record type, freeing up tuples to be an invisible type for varargs and multiple assignments, and lists should be prohibited from containing heterogeneous data. Crosscontaminant fucked around with this message at 05:44 on Jan 29, 2014 |
# ? Jan 29, 2014 05:39 |
|
Crosscontaminant posted:Presumably "string or tuple" is an abbreviation of "string or tuple of strings" - just return a tuple with one element, it's probably closer to the semantics of the function in question ("returns all names matching a particular search query" or something of the sort) and means you don't have to play silly games to work out how to process the return value. No, it's either a string or a tuple of integers. This is from a simulation (this is an academic's code), and this part generates some objects for use in the simulation. There are only three kinds of objects. A tuple means the user wants to randomly generate them, with each of the numbers in the tuple representing how many of each kind of object, e.g. (10,3,5) means 10 objects of the first type, 3 of the second type, and 5 of the third. If the user gives a string, it's the name of a file that has specific information about how to generate the objects rather than doing it randomly.
|
# ? Jan 29, 2014 07:49 |
|
C code:
|
# ? Jan 29, 2014 10:09 |
|
Aleksei Vasiliev posted:
The real coding horror is that someone wrote "LOL" in your codebase
|
# ? Jan 29, 2014 15:46 |
|
Volmarias posted:The real coding horror is that someone wrote "LOL" in your codebase https://github.com/search?q=LOL&type=Code&ref=searchresults
|
# ? Jan 29, 2014 16:59 |
|
Aleksei Vasiliev posted:
Ugh. So many problems with this it hurts.
|
# ? Jan 29, 2014 17:08 |
|
Of course it's all PHP.
|
# ? Jan 29, 2014 17:20 |
|
php:<? /** * myFunction() * @param whatever $var * @return something, hopefully ;) */ public myFunction($var) { ... } ?>
|
# ? Jan 29, 2014 18:44 |
|
Interesting that XML is #2 mostly because of the billion laughs exploit.
|
# ? Jan 29, 2014 20:24 |
|
When in doubt, just wrap it in a <div>. Within another <div>. Within another <div> Ad nauseam. (I hate the "senior" graphic designer at my work.) pre:<div id="title" class="section"> <div class="content txt-center maxwidth400"> <h2>Welcome to BLAH BLAH BLAH.</h2> </div> </div> <div id="login" class="section"> <div class="content"> <div class="form-container"> <form name="loginForm" id="loginForm" action="/menu" method="post" data-eval="true"> <label>Enter your email address</label> <input name="username" value="" type="email"> <label>Enter your Password</label> <input name="password" value="" type=""> <p class="forgot-password"><a href="#">Forgot password.</a></p> <input name="submitHandler" class="submit" value="Login" type="submit"> </form> </div> <p class="create-profile"><a href="/account/create.php">Create profile</a></p> </div> </div>
|
# ? Jan 30, 2014 06:22 |
|
substitute posted:When in doubt, just wrap it in a <div>. Within another <div>. Within another <div> Ad nauseam. He should use HTML5 and make that last one a SECTION.
|
# ? Jan 30, 2014 16:01 |
|
FoiledAgain posted:No, it's either a string or a tuple of integers. This is what is really the problem, not the exceptions. You're basically trying to pass data via the type system. This will always end up being a mess--you're either going to have to use try/except, or you're going to have to use something like type() or isinstance(), which can also be fragile. Any time a method returns multiple types, and the client is then supposed to infer meaning from the type is really suspicious. The python way would be to just return the data already built. If that doesn't work (because it takes a long time or whatever), return an object that has a build() method or something that either builds the test data or loads it from a file. The point of duck typing is not really that you can return a string or a tuple and base later code off of the type, it's that you can pass and return in objects of different types that share an interface (or the subset of the interface that you actually need).
|
# ? Jan 30, 2014 19:03 |
|
I wonder if the original version of that code had them calling open() on Schrödinger's variable and catching the TypeError exception if it's a tuple.
|
# ? Jan 30, 2014 21:17 |
|
evensevenone posted:This is what is really the problem, not the exceptions. You're basically trying to pass data via the type system. This will always end up being a mess--you're either going to have to use try/except, or you're going to have to use something like type() or isinstance(), which can also be fragile. Any time a method returns multiple types, and the client is then supposed to infer meaning from the type is really suspicious. I agree. I went a looked at little more at the code, and here's why you end up with two different types: For this simulation, users write a configuration file, which is just a text file with parameter=value on each line. The parameter 'objects' can take as a value either the name of a file that lists the specific objects you want to use (every possible object in the simulation has a unique ID) or else it can be three comma separated numbers indicating you want a random choice of objects. A parse_args() function reads the config file and returns either a string or a tuple back to the function that I referenced in my other post (actually it return a dictionary because there are other parameters too, but there is no weirdness in dealing with them so I left it out of the post). The try/except block is then used to figure out if it's a tuple or a string, and then either go read a file or do some random generation.
|
# ? Jan 30, 2014 22:53 |
|
|
# ? Jun 6, 2024 05:00 |
|
Aleksei Vasiliev posted:
I like how instead of letting it keep crashing and figuring out why "this cannot happen" happened, they just decided to say "gently caress it, let's keep on trucking" with the program in a potentially catastrophically invalid state.
|
# ? Jan 31, 2014 01:32 |