skeldoy Posted December 10, 2012 Posted December 10, 2012 Is bash a prgramming language suitable for use in education, or does it just make kids lazy? "...Bash is fantastically powerful but I would never introduce it to my students, unless of course they already have programming experience and they have a need for it. Even then I would choose C over bash scripting... " Well.. I work in a profession that is slowly being overtaken by software running on machines. If I got 10 cents for every time some salesperson pitched me a solution that "required" custom software written in some new object-oriented language I would be rich. If I got an additional 10 cents for all those problems that could be solved using "scripting language" running on a linux machine I would be doubly rich. The fact is that unless your doing something really really really groundbreaking - what you are trying to accomplish is probably just a new workflow on existing algorithms/tools: then you need a scripting language. But if you don't know scripting-languages and don't understand them you will see every problem as a ground-up problem. I would actually recommend teachers to do scripting languages as a primary. They are WAY more powerful than your average programming-language. Not only in terms of time to implement a rudimentary solution but in terms of stability. Bash is one of the best scripting-languages in the sense that it forces you to come to terms with what software is out there already, instead of trying to reinvent the wheel all the time. The filesystem is there - you won't reimplement a filesystem unless you really have to - so why would you reimplement reading or writing to a file? Makes absolutely no sense at all. You are killing the benefits of the fancy kernel if you do - and then guess what - you would be better of with a scripting language. There are so many hours wasted on trying to teach everybody the virtues of LISP and object-oriented perfection that we are loosing track of what matters: employers want to see results - end-users are crazy and time is very expensive. If you cannot do something in a scripting language you are basically trying to do something so novel that you need to get your head looked at or you are approaching it the wrong way or maybe your end-users are asking the wrong questions. I think that one of the major problems with accepting scripting languages as the most powerful languages is that we have grown accustomed to the thought that everybody is so special. Of course there will be people that excel in writing an algorithm for signal detection or people that love finding new ways to sort but those people are the exception. We are loosing a lot of people on the way - just trying to teach everybody to do everything but nothing at the same time. Using a scripting language like Perl you would write AI-laden SOAP-speaking twitter-bots in a couple of hours. Doing so in C would take hundreds of people or multiple years of nothing else. What I hated most with doing computer science at the university was that every single problem they would throw at me could be solved in less than ten seconds using perl one-liners. What a joke. We were thought to think slowly and solve problems in inadequate and ridiculous ways in the event of those rare cases where nobody had even ventured into that domain before. That's like creating esperanto and trying to teach your kid that before moving on to real languages afterwards. It's bad pedagogy.. That's probably why only a few people from every class actually end up doing programming - it's a waste of time. There will always be people who thrive in object-oriented perfection. Or people who dream in LISP. Great! But unless you are aware of what a scripting language can do for you: you will forever just be a moron .. Just think about the frameworks - frameworks in modern programming languages are basically scriptifying code. Why bother doing cell-tower triangulation in C when you can do a single line of objective-c CLLocationManager in some framework? Btw: Python is a scripting language. Java is a scripting language. We just perceive them as programming languages because of the syntax. But they have the flaws of scripting-languages and none of the benefits of lighter scripting languages. I bet you I could do most anything faster (in terms of execution time and implementation) with #!/bin/sh than you could with python or java. If you want to be real crazy you could always try coding a scripting language in an objective manner to slow you down and teach kids something about the stuff the drones do at the major companies.. But unless you do algorithms or something that needs to be fast: Scripting languages are basically the next best thing to pure C (or objective-C, C++, etc) out there.. Python is a waste of time. Java is a waste of time. Knowing what an integer is - ok - fine. Knowing what object-oriented code is - fine. But give me a bloke that knows regular expressions, scripting in bash/perl/... there is no limit to what that person could accomplish.. And I bet you the kids will be thrilled by doing twitter-bots the first day of the course instead of just printing shitty strings to stdout in a complicated manner. Printing to stdout is done by echo. Maths is done by bc. Protocols are done with curl/wget/netcat. Listing files: ls. Outputting files: cat. Removing them: rm. How hard to you want to make it? Well that depends on the students more then the teacher doesn't it? Doesn't it? 4
pcstru Posted December 11, 2012 Posted December 11, 2012 What I hated most with doing computer science at the university was that every single problem they would throw at me could be solved in less than ten seconds using perl one-liners. What a joke. Nice post but I think you may have missed the point of university. It wasn't to produce solutions to problems that could be used, it was to teach you programming. You won't learn much about sorting algorithms by simply calling a sort program. There are two other problems with your philosophy of solution is packaging them up and throwing them at end users. The first is complexity - having your system dependent on multiple programs and systems involves more potential points of failure. You will need to be sure for instance that you control the underlying configuration otherwise an update to any of the subsystems you rely on could kill your workflow. The second is usability. If I tell one of our secretaries to open up a bash shell, cd to scripts and run ./mycelverscript ; I might be lucky to get out alive (or I will be calling an ambulance as their stress levels and anxiety overcome them). Of course, you could package your scripts up as CGI behind a web page or some such, at which point ... see complexity. That said, I'd agree that scripting is important, especially in systems management. At a basic level it allows you to eliminate the tedium of often repeated tasks. At an advanced level it can be the string that allows you to tie systems together into a cohesive whole that is more than the sum of the parts.
localzuk Posted December 11, 2012 Posted December 11, 2012 (edited) No-one is denying the importance of scripting. None of us could do our jobs effectively in IT support without them IMO. But as pcstru says, university isn't about producing usable solutions, its about teaching the concepts of programming. Skills that you can transfer between languages, and aren't restricted to knowing Perl one liners (which even amongst system admins are often mind numbingly complex). Sure, knowing Perl is a very useful skill for a linux admin, just like knowing VBS or Powershell (now) is in Windows, but it doesn't teach you about polymorphism, or inheritance, or any other programming techniques which someone who is training to be a programmer needs to know. Not to mention, you do realise that Windows is the most commonly used OS in the world, and is the one they see in their homes and businesses. Linux for all its brilliance is not the software they will come across, and therefore learning bash is somewhat pointless and niche for kids starting out in the world of computing. Edited December 11, 2012 by localzuk
CyberNerd Posted December 11, 2012 Posted December 11, 2012 Not to mention, you do realise that Windows is the most commonly used OS in the world, and is the one they see in their homes and businesses. Linux for all its brilliance is not the software they will come across, and therefore learning bash is somewhat pointless and niche for kids starting out in the world of computing. Not in the servers, supercomputers or telephone world. And BASH does work on windows too. .....
localzuk Posted December 11, 2012 Posted December 11, 2012 Not in the servers, supercomputers or telephone world. And BASH does work on windows too. ..... And kids in our schools will be coming across bash installed on Windows regularly won't they? Or supercomputers, servers or telephony systems? No. Why not just go the whole hog and teach assembly in year 2. Its used in embedded systems all over the place, and its very quick at processing things... You have to draw a line about what is likely and what is niche. Bash, even though common in server, is niche. Also, you can't say that about servers - there's no real usable metric to draw that conclusion, as most stats about it talk about web servers. If you look at hardware sales, then Windows beats Linux, but neither are really accurate.
CyberNerd Posted December 11, 2012 Posted December 11, 2012 And kids in our schools will be coming across bash installed on Windows regularly won't they? Or supercomputers, servers or telephony systems? No. Why not just go the whole hog and teach assembly in year 2. Its used in embedded systems all over the place, and its very quick at processing things... You have to draw a line about what is likely and what is niche. Bash, even though common in server, is niche. Also, you can't say that about servers - there's no real usable metric to draw that conclusion, as most stats about it talk about web servers. If you look at hardware sales, then Windows beats Linux, but neither are really accurate. Yes I think kids who are likely to be good programmers will be coming across BASH. BASH is already available for 70% of smartphones - chances are they have them in their pockets already. Are there more Windows servers than all the ESX, BSD, Apple, Solaris, Linux and other unicies put together !?!?
skeldoy Posted December 11, 2012 Posted December 11, 2012 Nice post but I think you may have missed the point of university. It wasn't to produce solutions to problems that could be used, it was to teach you programming. You won't learn much about sorting algorithms by simply calling a sort program. ... The first is complexity. The second is usability. The point of university is to learn how to think - not to learn how to code. Problem is that programming is "still new" in an academic sense so they focus on the tool instead of the solution. Coding is a vocation. It's still best learned in a vocational environment and I bet you a lot of money that the majority of people actually coding are people who are either self-thought or vocationally thought. Most people who do a programming course on university level never actually code ever again after that. And I know the reason for that: it makes no sense to still teach low-level stuff in this day and age. Sure ten years ago most systems would have to be built from scratch - but today; if you can't find software for it or do it with scripts you are either crazy or you have to learn how to code. But if you are that brilliant that you need to code a kernel or a protocol or something like that - you already know how to code. Your sort-example is actually brilliant. Sort-algorithms are mathematical problems - you just implement them using C because you want to squeeze as much as you can out from it. And maybe once in a while there is a need to do something like that - but how many people actually need to do something like that? How likely is that? Complexity? So when a new version of Python comes along - that's not complex? When a .NET-upgrade kills your whole design because of some security stuff that is not complex? Tried running 16-bit wintel applications lately? Tried running a 30 year old script on unix? Do you see? You are talking about complexity but you are looking at the wrong suspect. I never deal with any complexity - bc never changes - ls never changes - bash/perl never changes - the unices never changes. Tried maintaining 455 versions of an Android app lately? As for usability.. Don't really see that. Most stuff people do every day has scripts behind them. Writing a web-frontend is as simple and fast as it is easy. Writing a small GUI the same. Users know how files work and folders work. Users can actually handle a nice CLI-menu.. But most of the time I just automate all of it - the users never see it - people get less to do and we get more of their brain-time. Win-win!
skeldoy Posted December 11, 2012 Posted December 11, 2012 Sure, knowing Perl is a very useful skill for a linux admin, just like knowing VBS or Powershell (now) is in Windows, but it doesn't teach you about polymorphism, or inheritance, or any other programming techniques which someone who is training to be a programmer needs to know. Not to mention, you do realise that Windows is the most commonly used OS in the world, and is the one they see in their homes and businesses. Linux for all its brilliance is not the software they will come across, and therefore learning bash is somewhat pointless and niche for kids starting out in the world of computing. Why wouldn't you learn about polymorphism, inheritance or other programming techniques? I don't see how not teaching about their existence helps the situation. But seriously what would you rather want: A bunch of people that barely knows how to solve something in a very very very time consuming and overly complicated way that then have to learn how the real world works OR a bunch of people that can solve most any problem really fast and then choose whether they want to learn how to improve components of their solution. It's as easy as that really. Actually 70% of the worlds servers are unices. Last time I checked 90% of the worlds smartphones where unices. 99% of the worlds tablets are unices. And right now unix is on the most popular brand of computer in the US. The relatively small world of Windows is now getting even smaller. It's gaming-PC's left now and even they are moving to linux last time I checked. Most of the users want web-ui or maybe a native frontend to a web-thing anyway. Learning how to do SWING or visual studio-stuff just won't cut it anymore. Similarly I think that students poking around C to print to STDOUT is ridiculous compared to a 9 year old girl running a tweeting pot-plant on linux. People need to learn how to actually do stuff. We didn't learn anything relevant in uni: SOAP? No. XML? No. JSON? No. Perl? No. Obj-C? No. NoSQL/SQL? No. Automation? No. Java? Yes! SWING? Yes! Solving a stupid problem with N queens on a chessboard? Yes! Writing to stdout with C? Yes! But something I could use later? No. Glad I spent my weekends drinking beer and reading about Perl.
pcstru Posted December 11, 2012 Posted December 11, 2012 In my experience (30 years of software development), many coders are "self taught". They are the ones who have the greatest difficulties in a professional development environment where code needs to communicate it's function as well as execute it. While overall university might aim to teach people how to think, to learn programming you need to *do* programming. To learn how to think like a good programmer you need to be exposed to good programming practice. Sure you may never need to write a sorting algorithm but you should be confident that you can and you should be skilled enough to know a good one from a bad one. In complexity I was referring to the fact that stringing together multiple component systems into an overall whole tends to introduce additional complexity. You have the whole of python to deal with sure, but then you have the whole of a Unix, the applications, the network infrastructure that is providing the service pipes between data sources etc. It's not that it won't work, just (and again IME) that the risks aren't contained within a single code base that you fully control. For scripting that's not usually much of a problem because the scripts themselves tend to be fairly trivial. But if you are looking for scripting to be a replacement for programming, then that starts to fall apart. But then there I think is the philosophical nub of your problem. You want to make a firm differentiation between scripting and programming and then you are upset because you are being taught programming rather than scripting. Perhaps you should have chosen a scripting course or taken a vocational route? End user applications are always likely to be developed using programming languages not scripted together from other component parts. There are sounds business reasons why this makes sense, but if you want to do scripting not programming then that is a choice for you. Both are useful skills.
localzuk Posted December 11, 2012 Posted December 11, 2012 [citation needed] - your numbers are near to those provided by organisations like W3Techs. Basically, limited to web servers. There are a lot more servers than webservers, so as I say, it is difficult to find a number for the server market. You didn't learn about XML or SQL in uni? Then I would say your course was somewhat flawed. My course covered web technologies, so SOAP, XML etc..., database systems including SQL and other non-SQL systems (which were esoteric to say the least, but covered concepts used within non-relational databses). Sure, Java and Swing were covered as they are tools to teach the basics of programming in. We also had examples given to us in Pascal, Ada, Lisp, C, and some others. My university course set me up to quite happily design and implement several programs where I work now - a cashless catering system and a merit tracking program. If I'd just done Bash scripting? I wouldn't have been able to build those systems plain and simple. What I want is a generation of kids who understand what they have in front of them. How it is communicating, how the program will have been put together, how to therefore diagnose it when it is misbehaving etc... Most applications that they come across will NOT be scripts, they will be complex systems written in c/java/.net/python which interact with databases, and have highly interactive interfaces. Bash is not suited to teaching about that.
skeldoy Posted December 11, 2012 Posted December 11, 2012 In my experience (30 years of software development), many coders are "self taught". They are the ones who have the greatest difficulties in a professional development environment where code needs to communicate it's function as well as execute it. While overall university might aim to teach people how to think, to learn programming you need to *do* programming. To learn how to think like a good programmer you need to be exposed to good programming practice. Sure you may never need to write a sorting algorithm but you should be confident that you can and you should be skilled enough to know a good one from a bad one. In complexity I was referring to the fact that stringing together multiple component systems into an overall whole tends to introduce additional complexity. You have the whole of python to deal with sure, but then you have the whole of a Unix, the applications, the network infrastructure that is providing the service pipes between data sources etc. It's not that it won't work, just (and again IME) that the risks aren't contained within a single code base that you fully control. For scripting that's not usually much of a problem because the scripts themselves tend to be fairly trivial. But if you are looking for scripting to be a replacement for programming, then that starts to fall apart. But then there I think is the philosophical nub of your problem. You want to make a firm differentiation between scripting and programming and then you are upset because you are being taught programming rather than scripting. Perhaps you should have chosen a scripting course or taken a vocational route? End user applications are always likely to be developed using programming languages not scripted together from other component parts. There are sounds business reasons why this makes sense, but if you want to do scripting not programming then that is a choice for you. Both are useful skills. I agree. Self-thaught people are a royal pain. It doesn't work. They don't know enough about datatypes and other fundamental things. But I have yet to work with someone that does code and have a uni-background. So I think the vocational route works well there. Yeah. But *do* programming though,.. I would rather work with a thirteen year old girl that knows how to interface twitter with her GPIO than with a guy that knows how to waste time with UML. Complexity for me is when a piece of software tries to do too many things at once. Simplicity is a design where you have a thing that does metadata, a thing that does data, a thing that does control, a thing that does interfacing with users, a thing that does interfacing with machines. That's normally what we teach people to do when they are coding - but why do all of that yourself when we have a lot of good systems for doing that already? SQL, files, scripts, web, soap.. etc.. I know coding *and* scripting. The thing is though: I almost never need to do it. Most of the stuff I need to do have already been done before. Ten years ago that was not the case but today it is. I think coding is great. I love it. But I rarely use it. In fact I try to find stupid solutions to problems just to get the chance to code nowadays. Both are useful I agree - but I think that scripting is way more useful today. But then again. Things might change. Maybe we get some new device in the future that needs it..
pcstru Posted December 11, 2012 Posted December 11, 2012 (edited) I agree. Self-thaught people are a royal pain. It doesn't work. They don't know enough about datatypes and other fundamental things. But I have yet to work with someone that does code and have a uni-background. So I think the vocational route works well there. I wouldn't like to try and estimate, but I worked for a long time for a quite large software house and there were a "fair few" (Scottish quantity n>1 n< a lot) who did computing or similar at Uni. Some were very good, some ... not so much. I don't see any particular reason to expect otherwise. Complexity for me is when a piece of software tries to do too many things at once. Simplicity is a design where you have a thing that does metadata, a thing that does data, a thing that does control, a thing that does interfacing with users, a thing that does interfacing with machines. That's normally what we teach people to do when they are coding - but why do all of that yourself when we have a lot of good systems for doing that already? SQL, files, scripts, web, soap.. etc.. Complexity is a measure of the information capacity of a state space. At simplest, the total number of bits needed to represent the system. My 250 byte object file is simpler than a 2K bash shell script which relies on 100's of KB of other compiled object files. I know coding *and* scripting. The thing is though: I almost never need to do it. Most of the stuff I need to do have already been done before. Ten years ago that was not the case but today it is. I think coding is great. I love it. But I rarely use it. In fact I try to find stupid solutions to problems just to get the chance to code nowadays. Both are useful I agree - but I think that scripting is way more useful today. But then again. Things might change. Maybe we get some new device in the future that needs it.. Well, OK. I'm not now sure where you are coming from! I don't know of any modern development environment in which you would have to resort to (say) actually writing a sort algorithm from scratch. Most development environments tend to have excellent coverage of common tasks in the supplied libraries. These days the libraries will encompass API's and connectivity to the object models of the host Operating Systems. A lot of programming is dull "monkey work", get/put/validate/analyse data. I've made choices about development environments based as much or more on the people skills available as the intrinsic virtues of (say) C# vs PL/SQL. Personally I don't even see a nice solid differentiation between scripting and programming. Complex scripting is programming. Simple programming is scripting. Languages pro-port to be many things and some real crap seems to rise to the top of the "in use" pile (here we are on a functional forum written using php. PH ferking P - who dreamed up that mess!!). These days it's not just academic egos that fuel the pointless evangelism of C++ vs Java vs C# etc, there are powerful marketing forces at work too. And scripting is great - the glue of the internet could probably be described as a bunch of scripts. But try writing something like "rise of flight" in Bash. And find it on the ATMega328 that I'm trying to persuade to be a PID for a sous-vide cooker. Shift F11 on excel doesn't pop up a menu - "would you like to use VBA or drop out to a bash shell. Scripting, Programming, they all have their place. Be a master of one, all or none. The real blinding jaw-on-the-floor-miracle of our age is that we get a choice. I dropped a USB stick the other day and I didn't have to sort out the mess 1000's of mixed up punched cards. Which is nice, because the USB stick is quite small so sorting out the cards must have been absolute hell. Edited December 11, 2012 by pcstru clarity, spelling, glaringly horrible errors of logic, rationale and sanity.
unixman_again Posted December 11, 2012 Posted December 11, 2012 If you dropped your punch card deck, you simply ran it through the old IBM 082 File:Punch card sorter.JPG - Wikipedia, the free encyclopedia
ijk Posted December 12, 2012 Posted December 12, 2012 Could you say that bash is a programmable interface to some standard libraries like ls, wget, ftp, ssh, grep, sed, awk, touch, etc?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now