"The New COBOL" - Benno Rice (PyCon AU 2019)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to the first talk in this track for the morning in Cocoa Beach first up we have been erased talking about the new Cobalt so when I saw that the announcement that a that vicki was gonna be keynoting I thought to myself pity the poor fellow has to go on after her anyway so I am here as a nerd because languages are fascinating programming languages are fascinating to nerds but murdery is a state of mind I think like everyone is nerdy about something because I define nerdery is like you know having a very deep and loving knowledge of some of a particular subject to the point where you could conceivably bore someone to death with it if you chose to but programming language nerds are an interesting breed and you know I came up at a time when languages there was a lot of language comparisons going on there still are and one of the topics that inevitably comes up is languages that suck and my talk here I think I'm lucky in that I've ended up a kind of a nexus of Oren's keynote and Vicki's keynote and what we'll get to that but you know suckiness has several axes languages can suck for several different reasons and you know the most obvious is that things are being designed to but you know we'll get to that in a sec but one of the big things that used to come up and we're talking like the late night he's early 2000s here is which language is the new COBOL and so it has anyone here actually written COBOL excellent with purr in anger or just for the fun of it no and the thing is that this whole question of what is the new COBOL tries to cast COBOL in a specific sort of context in the usual context is languages that are dead or a joke and the thing is that neither of those are really true about COBOL I mean whether a language is dead or not is a whole interesting concept in and of itself because like Adam I think I've coded in at least two or three or four of those five and I don't think assemblies going away anytime soon even if people aren't writing it directly but some of them are and then as for jokes I mean whether a language is a joke or not is an equally subjective thing I mean there are languages that are actually designed as jokes Wikipedia has a lovely page of them there are some wonderful examples this is the the language with no pronounceable acronym or inter Cal it's a very early joke languages designed explicitly as a joke everything is done pretty much the opposite of what you would expect the read out instruction at the bottom prints out writes a letter to at the standard output if you want to read in you say right in you end approach it instead of go to it had come from which led to it an implementation of threads using multiple come from from the same location and to end a program you say give up or more idiomatically please give up the please doesn't do anything but if you didn't put enough of them in the compiler would refuse to compile your program because you weren't being polite and if you had too many of them would refuse to compile it because you're being obsequious that's not the only joke language this is a language that I shall refer to as brain Fork it has a table codes all of them single characters that is hello world all of these examples a hello world if that's too readable for you this is Mel Bulger it's a ternary machine language the language the in op codes are still single characters but they change function based on where they are and self modify if one dimension is not sufficient for you then B funds has works in two dimensions the control flow is in two dimensions and angle brackets fees and carats change the way the control flow is going and if you prefer something a bit more along the lines of Bianca's talk with Rockstar last night there are plenty of languages to work on those lines this one's based on My Little Pony Friendship is Magic and then there are languages that are not designed as jokes but can seem like jokes so if you look at them wrong this is not hello world this is an n-dimensional Sudoku solver in APL this is the more readable version the original version that I saw was in Rommels talk at North Bay Python and it used was a lot harder to read but it does actually solve any dimension Sudoku and then you get to languages that people consider jokes like language that some of us may have started with like basic or more idiomatic basic and the thing is you know these languages are people like my first code was written in basic so you know like I can hang on in a bit if I but you know it's where I came from there are other people who started with other languages that people also you know don't give you know give grief to these days like Perl or Ruby or Python sorry Python and the thing is languages have a really rich and long history this is a sort of a genealogy chart of languages that goes back all the way to the beginning of programming languages as we know it it's a bit hard to read in this form but you know we'll zoom in on in a sec you can find it at the URL at the bottom there and so if we zoom in on this a bit we can see Python over here we can follow Python 3 back to where it splits off from Python 2 and then we can follow that back all the way to the very beginning of Python and we can see that Python was kind of derived from three different languages being modular 3 a b c and a dear old friend c but the interesting thing about those languages is if you follow their lineage back you get back to Algol Algol or algorithmic language was one of a set of four early languages that kind of really set the stage for the way we see programming languages today Algol was kind of the compete science language but there were three other languages that will go into here one of them is Fortran which is probably the earliest language that we're really shown up Fortran was the mathematics language it was used for numerical analysis whole bunch of things and this quote from John Backus is interesting Bacchus is the Bacchus in Bacchus near form if you didn't know that much of my work has come from being lazy I didn't like writing programs and so when I was working on the IBM 701 writing programs for computing missile trajectories I started work on a programming system to make it easier to write programs the thing that jumps out at me about this is it echos a whole bunch of things that Larry wall says a whole but whole lot of time later about Perl and the thing is that Fortran is has an impact on a lot of people in this room because it shows up in places like numpy numpy is numerical analysis stuff of Python and a lot of the code that underlies that is not written in Python it comes from other languages for example Blas and la pact Blas or basic linear algebra subprograms and la pact or linear algebra package code for doing linear algebra and Blas was originally written in Fortran there are no implementations of the same API in languages like C but la pact is still written in Fortran 90 and then there's F 2 pi F 2 pi is a tool that's entirely designed for you to glue your old Fortran code into your new Python code and so one could almost argue that the whole rise of Python in the scientific in numerical communities is all about the fact that you could uplift your old Fortran code and use it within Python so that's Fortran another really early language is Lisp Lisp is a bit harder to categorize it was kind of the the really serious computer science language you kind of had nation artificial intelligence for a while it's really popular amongst a certain kind of person who wants a very kind of philosophical mathematical rigor to their programming and if that doesn't make any sense then what I suggest you do is go out in any kind of computer conference and loudly state that you don't know what lambda calculus is and someone will come and tell you at length but Lisp still shows up in a bunch of places one of the most popular ones these days is closure there's a bunch of closure code that gets written that's fine the other place that people use it is in text editors that's all called so Lisp and then we come to the common business oriented language COBOL so COBOL starts as you can see just before that with a language called flow-matic and fly Matic was the brainchild of this amazing person here this is Rear Admiral Grace Hopper Grace Hopper is famous for a bunch of things one of them was actually creating compilers before people actually believe that compilers were useful I had a running compiler and nobody would touch it they told me computers could only do arithmetic and also this the idea that she had sort of progresses further manipulating symbols was fine for mathematicians but was no good for data processors who were not symbol manipulators and it's much easier for most people to write an English statement than it is to use symbols so I decided data processors this is people processing data as opposed to you know CPUs ought to be able to write their programs in English and the computers would translate them into machine code again this sounds a lot like what Larry wall said it's nice to be able to program in a set of concepts that are familiar to you and that allow you to get things done easily so the Pentagon kind of bought into some of these ideas and so they started saying okay we need a language to be able to write business programs in because let's face it a large part of a modern military is making sure that material and people and things get from here to there are acquired purchased tracked dealt with whatever there's a lot of that stuff going on so the Committee on data systems languages or codasyl was put together in about 1959 to look at what would work as a programming language for businesses and the primary contenders that went into that were grace hoppers flah Matic and a language out of IBM called comm Tran and being committee they shoved bits of them together and came out with cobalt and COBOL has been around ever since I've got a major revamp in 1985 gaining things object-orientation freeform code more on that in a bit and it even got XML processing capabilities in 2014 so it's still a live spec I mean for trans live most recent spec was 2018 so these languages that are considered dead they're still around so that's kind of the history of COBOL what did it look like well that's 1970 zero COBOL designed to run on an emulated s/390 running on Linux all each of these lines would have been on our punch card back in the day so if punch card a bit of cardboard holes in it so that you can read it so that the computer can read it and lines on the top and line numbers so that when you drop them all over the floor you've got a chance to get them all back in the right order so these bits here job control language that tells the mainframe how to link the program together so that it can run these days that ends up is still stuff like that around but it's hidden inside your executable file and it's we call it shared library linkages these days COBOL separates its programs into divisions the identification division at the top identifies the program environment division tells it things about what files and stuff that it's using the data division defines any variables or data structures that it's using and the procedure division actually does the work and so again this is hello world and when you ran this on the emulator you got a bunch of output again this would have been output probably our line printers so that old folded paper thing where you had the sprocket hole in the side and everything just great for making banners and again eventually it prints hello world along with a whole bunch of other informational things and the thing is that you know this all looks a bit weird given where we come from but the thing is that this all makes sense when you think about computers not these computers or these computers or even these computers these computers this is an IBM 701 so all of those boxes together make the computer you feed the punch cards into it through a punch card reading machine this was better than the old version where you had to toggle switches and press buttons to get data into memory to run your program you print things out on your line printer which is again better than reading lights on the front of the machine and if you need to store things for a long time you've got tape hard drives show up later and cost a lot of money but the things that we're dealing with here are often record oriented data as in you know each each line of data is a record and that makes a lot of sense when you think that codasyl actually has two claims to find one is COBOL the other is a body of work that lends to a thing that we now call SQL and the other thing that computers did a lot more at the time is batch processing you don't have long running tasks you have I'm going to process all of the account transfers for today and generate some numbers that are then good and we're going to move around between accounts we're going to do a whole bunch of other things like that we're not dealing and dealing with long running jobs we're dealing with batch jobs that run on a say daily basis weekly basis the data gets fed in other data comes out things move on and this is where you see a lot of the industries that this ended up in are things that have that kind of data Thanks insurance companies government departments Airlines any anything that you see where they have that we did kind of terminal looking interface on the computer they've got even if they've got some modern PC they've got some window with the terminal thing in it that's generally talking to this bad system like this in the back so let's have a quick look at actually you know some more sort of details of COBOL the actual language itself this is more modern COBOL this is free form so I the line structure gets to be a little bit more thing I don't have the line numbers on it we have an identification division this is designed to do a really sort of silly funds transfer kind of thing just to give you an idea of what it looks like we have an environment division that defines a file that we're using you can define different organizations you can have indexed files if you want this is just line sequential because it works we're defining a record structure each of these lines here the line numbers at the start of the lines the o1 and o2 to find the hierarchy of the record the pick statement or picture statement defines what the data actually looks like so the from account into account are nine digit numbers nine means a digit X me character and the bracket nine means nine of them and then the amount is four digits and then two digits so I can never transfer more than about 10,000 more just under $10,000 we can also define a working storage section these are what we would now call global variables and the other thing that's here is a level 88 variable COBOL it does have a bunch of quirks that make it have been interesting to work with the one of them is that these level numbers some of them have special meanings eighty eight's are billions that are true when the value of the thing that they are contained within matches one of the values that you tell it's so done is when should continue is Q and the main procedure is relatively straightforward we open our transfer file we perform a subroutine until we're done and then we close it and we're done and get transferred details just displays a bunch of prompts except some data and writes it out and that's all pretty cool but later on we do get things like the screen handling stuff and one of the things that I found interesting research in COBOL is around the 2002 spec they formalized a whole bunch of things that had been in various sort of vendor specific versions of COBOL for a long time and you've got screen sections in the the data division so this allows me to rewrite my thing to have basically a form on the screen I can display I can lay out some stuff on the screen with input fields I can define where they go in terms of the record structure so you can see that I am getting my from input two from account various things like that and it simplifies my get transfer details significantly and when I run this because there are compilers you can actually write your own COBOL code and run it I can actually come up with transfer screens will look like this and if you were in a bank or an airline check-in cure whatever and you leaned over the shoulder of the person who's typing it in you would see something like this before security kind of took you away and what struck me when I was going through all this is like you know we've got this lovely tool for dealing with record oriented data and making easy interfaces on it and I don't know anything else that does anything like that in modern work like record oriented data easily dealt with views forms the the whole idea that went into that they're still there they're just not used the same way but that's not to say everything's perfect I mean this whole picture thing is important because you it limits what you can express you know if I define things like this I can't go about certain Precision's if I set a certain width on my surname field then mr. Neugebauer would like a word with me and it's a good thing that these days we don't run into like fixed with record limits anyone who's reading that will notice that the tags are not saving because the tag table hit a scaling limited the two billion tag mark anyone who knows anything about 32 bit integers knows what's coming next five lies analysis why did tags stop working tag ID hit a limit why did hit a limit he was Indians column why was it in int I am a careless and don't follow through enough why am I so careless lonely childhood ate paint chips why am I so lonely fast empty universe no God but so 32-bit integers we still hit all of these limits the all of these things that are annoying about COBOL still exist and some of the things that we think of quirky were actually things that we've then re implemented in other languages so why is COBOL held in such withering contempt this is an entry from the internet jargon file which is a collection of internet humor maintained by someone so yeah it says that cobalt is a weak robos and flabby language used by code writers to do boring mindless things on dinosaur mainframes this is not useful I mean and I'm at this point wondering where all of this contempt comes from and I think Wikipedia has the answer the COBOL community has always been isolated from the computer science community now academic computer scientists participated in the design of COBOL all of those on the committee came from commerce or government they weren't the cool kids computer scientists at the time were more interested in feels like numerical analysis Fortran physics and system programming then commercial file processing problems with COBOL development tackled they weren't the cool problems and so you have this sort of spectrum of cool to uncool and those four foundational languages kind of fell on a fairly fixed positions in those so you know you had Algol which was the computer science language you had Fortran which was the maths language you had lists which was the serious computer science language and cobalt which was the business language and yeah the usual contempt stuff that Orrin talked about the other day all came into play and the thing is you see that reflector today too lots of work got done in Visual Basic Visual Basic is not regarded as a cool language PHP we would not have Wikipedia without PHP but it's not a cool language Perl was at the time a very cool language but over time has lost some of its luster but it's still very important in terms of the history of the internet and there are still things we could learn from it today Java there's tons of java code out there I mean there are billions of lines of COBOL still running out there and there will be probably billions of lines of Java out there still running in five or ten years time but it's not considered a cool language virtual machine might be considered cool but Java is not with a Python - I mean there's a lot of Python - out there a whole bunch of a profile a whole bunch of us probably maintaining some of it but it's not considered cool as much anymore and so it's interesting to think about in five or ten years time where's Python 3 going to be but I think when I was going through this sort of thought process the thing that I the programming environment that I thought was most interesting to fit to throw into this was excel the amount of Excel sort of macro work and stuff like that that goes into making sure that things like you know boring boring like making sure we get paid is it's is just staggering and by being paid I mean that quite literally when I first moved to Seattle several years ago before I got my social security number the way that I got paid was that I had to get emailed and Excel spreadsheet with macros in it so that I could approve my manual paycheck and he then got forwarded to my boss who then had to approve the method of thing through the same Excel macro based workflow so it literally got me paid and so I started thinking when we think about when you're looking for something like what the new COBOL is like where should we be directing this kind of I don't know I don't know what the right word is but you know what should be looking at for the things that are making our lives miserable when it comes to programming maybe it's not the language maybe it's something else and so I started looking at the other things that cobalt has left for us and the other obvious one given the the picture statement I was giving you before was y2k the thing is y2k was a late 1998-99 was a great time to know COBOL because there was lots and lots of work going around it oh god we need to fix this now prices because everyone who had given themselves a two-digit year field needed either a windowing function or to fix a large amount of data very quickly and it's worth thinking about like when did peach Holly people realize before 98 99 that this was going to be a problem or did they because there are other things it's not just cobalt heartbleed was hilarious from the outside for those who didn't who weren't paying attention at the time heartbleed was a major flaw in open SSL open SSL is this little unknown piece of software that basically secures almost all of your communications on the internet somebody found a way to do nasty things with it and suddenly same people discovered it was important to maintain open SSL like we needed because at the time I think there was one one person working on it - two people working on it and it's you know it's another things - event stream was a nodejs module where the maintainer had had written the module it had gotten massive use but the maintainer wasn't interested anymore and so when someone came along said hey would you like me to maintain that module for you he went yeah handed it over and the person promptly put stuff in there to steal cryptocurrency wallets from people who use the module again hilarious and it's not just no jeaious and the others though I mean I think Viki put this this tweet up Python has a maintainer ship problem as well and it's not just in pet I mean I work for yubico we have a vested interest in making sure the cryptography keeps working and so when we see things like this this is a bit worrying and so it occurred to me that you know the problem with COBOL was that there was all this legacy code lying around that no one really wanted to touch there's all this stuff here where where this vital code that we rely on doesn't get looked after maybe the real cobalt is the maintenance debt we incurred along the way and yeah and so realistically I think to avoid falling into these situations again there is one simple strategy support the people maintaining the code that we rely on which is a problem in a world with corporations in it as corporations love externalities which is where you find something you don't have to pay for and don't pay for it but I feel that for those of us who work for corporations who have resources you have money who have employee time you have a whole bunch of things it's worth going to our bosses you know the people in charge and saying things like start a conversation like you have an unmitigated risk due to a dependency on potentially unmaintained code and start a conversation about maintaining the software that your company relies on whether it's insight internal code or external code because as Oren said speaking the language of business is important and it shouldn't be a thing that we see as dirty or contempt worthy so thank you if you have questions I will be outside thank you
Info
Channel: PyCon AU
Views: 29,458
Rating: 4.8627453 out of 5
Keywords: pyconau, pyconau2019, Python, PyCon, PyConAU, BennoRice
Id: BCqGjGzWI48
Channel Id: undefined
Length: 25min 54sec (1554 seconds)
Published: Sun Aug 04 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.