7 ms·
I teach using python. You should try explaining virtual environments to students, most of them with no programming experience, or any real notion of the state o
by abdullahkhalids 2y ago
I teach using python. You should try explaining virtual environments to students, most of them with no programming experience, or any real notion of the state of a computer system. I do, because we recommend students use them. Every class consists of endless debugging of student systems.
After that you might understand the OP's viewpoint.
- freeopinion 2y agoAfter that I wonder why people think Python is a good choice to teach as a first experience in programming. Virtual environments is actually my biggest gripe with Python. I think it is interesting to consider why Python is so popular despite such fiascos. The answers can be very informative but can also be giant red flags.
- Al-Khwarizmi 2y agoBecause every option sucks for teaching. C/C++? Full of footguns. Java/C#? Too complicated for beginners. Pascal? Outdated. Etc. I personally prefer C to teach first-year CS students but just as the lesser evil. A good first programming language is sorely lacking. (Note that I'm talking about the imperative programming paradigm. The debate on whether one should start with functional programming is outside the scope of this comment).
- Spivak 2y agoIt's weird you throw out Java because they are the teaching language. They're the stick everything else is measured against. CS101 is a sea of Eclipse. Having a programming environment where all the major structures are discoverable through menus is actually pretty useful.
- dvdkon 2y agoJava is popular as a first language, but I think it's just due to its (bygone?) general popularity. I don't think a language that forces you into a one-class-per-file mindset from day one has any business being used for teaching; students should start from the basics ("commands"/function calls, if, while, for, ...) and then discover what more complex concepts do within that framework. Java's tooling is nice, but frankly Turbo Pascal (or something at its level) is enough for beginners.
- eru 2y agoYou can teach imperative programming with OCaml or Racket, too. :) C is indeed pretty evil, though slightly less though with modern sanitisers, so you can get a better error message than just a segfault (or silently doing the wrong thing). Pascal isn't really more outdated than C. Especially if you use Delphi? Python is actually fine, you can get pretty far with just the standard library, and the libraries that you can install with your Linux distribution's package manager (eg via Pacman). I do agree that package management with Python is pretty bad out-of-the-box.
- bmitc 2y ago> Because every option sucks for teaching. The answer is really quite simple: F#
- moi2388 2y agoHow in the world is c# too complicated? Console app, top level statements, vs code. As easy as Python. Easier because your env isn’t messed up. If they can’t manage that they have no business doing data science or something similar to begin with
- cuddlyogre 2y agoYou sound like you have been doing this for way too long to know what it takes to teach beginners.
- neonsunset 2y agoNot for complete but for beginners lightly familiar with programming it is overall not difficult to teach the basics, often easier than to stubborn seniors who want to do it their way only :) var start = "commtext c00\">"; var end = "</div>"; using var http = new HttpClient(); var page = await http.GetStringAsync("https://news.ycombinator.com/item?id=41425416"); var commStart = page.IndexOf(start) + start.Length; var commEnd = page.IndexOf(end, commStart); Console.WriteLine(page[commStart..commEnd]); or var host = WebApplication .CreateBuilder() .Build(); host.MapGet("/", () => "Hello World"); host.Run("http://+:8080");
- moi2388 2y agoNot at all. I still teach interns and until 2 years ago complete beginners. I can teach them a console app with top level statements and have it running before they have installed a Python virtual environment.
- bspammer 2y agoIt’s not just the packaging situation that makes Python a bad first language. Whenever I write in Python, I find it completely impossible to stop myself from constantly making basic, beginner-level programming mistakes. Every time I miss having a compiler and strict typing that will yell at me when I’ve done something stupid.
- eru 2y agoModern linters and type-checkers for Python come pretty close to something usable for these situations. But it's certainly something they tacked on to the language afterwards. I like the recent addition of (proper) pattern matching to Python.
- bmitc 2y agoYea, the only way to get close to programming efficiently in Python is to turn MyPy and Pylint up to 11.
- airstrike 2y agoI switched to Rust full time about 6 months ago and recently had to write a somewhat long Python script for something else... it felt awfully quiet without the compiler yelling at me, but that also meant I was making the same silly mistakes over and over and over and over
- abdullahkhalids 2y agoWe use it because of other people use it. I would gladly switch to Julia for scientific commuting if I could.
- zaptheimpaler 2y agoI think docker would be a much better alternative. You can just hand students a pre-built docker with everything installed and they are free to mess up the system without any consequences.
- BlueTemplar 2y agoMight as well use Guix at that point, since that kind of OS-based dependency management seems to be the future.
- makeitdouble 2y agoBut then you're explaining virtualization and networking to your students, how to manage interactions in and out ("I wrote a program in Txtedit, how can I run it?"), when it's started and when it's not etc. I could see giving them a remote access to a prebuilt env (which can be containerized) to be simpler to explain.
- Daishiman 2y agoIn finding it very difficult to see what exactly is the problem with teaching a minimum of computer and operating system fundamentals to people that have to learn programming.
- abdullahkhalids 2y agoNot every person wants to become a software engineer, anymore than every person wants to learn to become a plumber or car mechanic. The vast majority, and by vast majority I mean more than 95% of students who are taught to code are training to be scientists, mathematicians, engineers, economists, accountants, or some such. They need to run simulations to understand their field. Any pain in the way of that is a failure of those who create software for a living.
- Daishiman 2y agoIf you're going to be spending a substantial part of your waking life working on a tool, spending a few hours to get the basics right is not an unreasonable ask. And as it turns out, all non-trivial programming languages that have some sort of packaging system or module system have some version of the problems involved. You don't see people complaining that musical instruments are unreasonably complex when that complexity usually gets solved after a couple months of training, or when someone who wants to basic woodworking has to have at least a passing knowledge of the different types of hardwoods, MDFs, and essential joinery techniques. Hate to say, but it definitely sounds like skills issues.
- bigger_cheese 2y agoNot sure how helpful this advice is for students I'm in my late 30's have programming experience but had never touched Python until about 6 months ago. What made Virtual environments work for me was switching to a different Editor. I use Visual Studio Code currently it works well with Virtual Environments. When you first create a new python file in a given "project folder" it prompts you to create a new Venv and when you switch project folders it remembers and restores the Venv for each project. One of my work colleagues pointed me to VSCode - it streamlined a lot of python things for me. If your students are disciplined about creating a new folder for each project managing virtual environments vscode could help them. Only issue I have is my work office has a corporate proxy setup and pip needs certificate to connect (and if I work remotely I have to turn this setting off) I wrote a shell script to toggle between the two proxy settings. Not sure if university will have the same issue proxy issues but if so this would certainly be a pain point for many students.
- promer 2y agoThis is a suggestion that deserves serious consideration. I started using VS Code after I had learned all the basics so I don't know what it feels like to be a new learner who is getting started by using VS Code. But it sounds like it worked for you. (And on campus, the proxy should not be an issue.) It does answer the question of which text editor to use when the time comes to teach them about editing text files. For a course, it helps that it is free and available on both macOS and Windows. I have a vague recollection that at some point I was testing without an install of Python and after I selected the Python extension for VS Code, it offered to install one for me. (I don't recall if this was on macOS or Windows and memory could be playing a trick on me.) But in any case, the people behind VS Code do seem to be trying very hard to make it easy for someone who is getting started. I am a little uneasy about the nudges to use Copilot, but on balance, it might offer a better path for students who are getting started.
- bmitc 2y agoThen why teach Python? All of these issues are because Python is a ridiculously poorly designed language which is still having new features added to it. It's generally a mess.
- regularfry 2y agoThe issues are with one particular facet of poor design and management. The rest of it is manageable, if distasteful, and worth the effort for the ecosystem (in general).
- bmitc 2y agoThere really is more than one particular face of poor design in Python. I honestly remain confused why people use and love Python so much. It very much says something.
- regularfry 2y agoOh, there are many. There are just comparatively few that you can point at as being quite as directly responsible for dev misery as thé packaging system.
- bmitc 2y agoLol. I see where you're coming from.
- Eduard 2y ago> You should try explaining virtual environments to students can you? Because I can't. e.g. "What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?" ( https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe https://stackoverflow.com/questions/41573587/what-is-the-dif... ) what is the difference between conda and anaconda? etc etc
- rahimnathwani 2y agoThat's exactly GP's point.
- justinclift 2y agoReckon they'd understand using something like asdf instead? https://asdf-vm.com https://asdf-vm.com The projects I work with have moved to it because it handles multiple languages (not just Python). It's made things easy to keep "the correct version of a language" that each project needs. So far so good, anyway. :)
- whywhywhywhy 2y agoYou’re swapping something that can be feasibly debugged or at least easily burnt and reformed for something that’s impossible to untangle once they’ve done two projects with different or conflicting deps into the base environment.