Legacy Code Conversion - Computerphile

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 476

  • @kenziemac130
    @kenziemac130 Рік тому +1372

    I cant get over using WordPad as a code editor.

    • @user_user1337
      @user_user1337 Рік тому +10

      lol

    • @kenziemac130
      @kenziemac130 Рік тому +136

      (this man clearly knows more than most of us about legacy code, just a decision that made me double take)

    • @carlospulpo4205
      @carlospulpo4205 Рік тому +70

      It's a step up from using VIM!

    • @jens256
      @jens256 Рік тому +133

      @@carlospulpo4205 it really isn't...

    • @johndupont1413
      @johndupont1413 Рік тому

      @@jens256 notepad++ for the win

  • @ScottPlude
    @ScottPlude Рік тому +106

    Every time I master a new topic and feel proud of myself, I see people like this and wonder how I can even tie my own shoes in the morning.
    Brilliant people!

  • @woaq4486
    @woaq4486 Рік тому +16

    This is the most fanscenating computerphile video I have seen so far because it directly relates to research I have been doing for over a year. I have the privelege to go to a University in the states that focuses on learning by application and provides lots of internship opportunities. I have been working with an unnamed corporation for over a year focusing on this very topic. Code modernization. From COBOL to Python, and several other legacy languages such as NATURAL, to more modern languages. We take a different approach, using NLP models, finetuned with our code translation data for our process, but still, different means to the same goal. I'm so happy that Dr.Lano took some time to explain the process of this, so more people can know about the beauty in old languages. It's astounding to me that I've had to opportunity to work on this stuff as an undergrad.

  • @VivekYadav-ds8oz
    @VivekYadav-ds8oz Рік тому +103

    The bigger legacy conversion that needs to happen here is the code editor :)

  • @cryptc
    @cryptc Рік тому +50

    20 years ago I was forced to manually read some old cobol code for modernizing it, would loved a tool that would helped automate part of that process back then

    • @zardify_
      @zardify_ Рік тому +1

      Behold, WordPad XD

  • @FishFind3000
    @FishFind3000 Рік тому +503

    This could only get better if he used a actual notepad to do code editing…

    • @portlyoldman
      @portlyoldman Рік тому +13

      which we did when i started programming....

    • @josephgaviota
      @josephgaviota Рік тому +11

      I continue to this day, to code in vi.

    • @BAD_CONSUMER
      @BAD_CONSUMER Рік тому +16

      wordpad is worse, in my opinion

    • @xa6859
      @xa6859 Рік тому +6

      Notepad? You mean PAINT

    • @dgh25
      @dgh25 Рік тому +5

      dude has 30 boxes of printing paper, so maybe he does?

  • @-_-.-.._.
    @-_-.-.._. Рік тому +72

    1 second in and I see code in WordPad 👌

    • @olamarvin
      @olamarvin Рік тому +5

      Or "modern tooling" as its known in Cobol environments.

  • @DutchManticore
    @DutchManticore Рік тому +5

    I mean this in the best of ways I genuinely do but I love when peoples appearances match their professions.
    If you have an IT problem and this guys shows up you'd immediately feel better

  • @air9music
    @air9music Рік тому +62

    This is really fascinating! I'd attempted to do almost exactly this a few years back in my org - trying to convert our legacy PL/SQL code to Java, using Antlr for parse tree generation. As a side project I didn't go too far but it's fascinating to see where this concept is going.

    • @custardtart1312
      @custardtart1312 Рік тому +5

      SQL and PL/SQL is not legacy, and performs certain tasks beautifully.

    • @discoisdead8504
      @discoisdead8504 Рік тому +1

      Probably a better fit would be pl/sql to Pascal 😏
      Interesting concept though... 4gl to 3gl.
      Having said that, pl/sql for Oracle Db data manipulation is awesome, but you lose db platform dependence.... being able to do both can be tricky, basically Implementing abstracted SQL calls and sql translations between db platforms.
      But where pl/sql really shines is db stored procedures/packages... that's an even bigger task to implement externally.

    • @air9music
      @air9music Рік тому +3

      @@custardtart1312 Of course SQL/PLSQL isn't legacy per se - it was our code that was "legacy". We had loads of business functionality written directly in PL/SQL which was a holdover from ancient days of Oracle Forms and D2K. Apart from the obvious platform dependence issue, using PL/SQL prevented development of capabilities that we take for granted with modern Java code (containerization and creation of REST APIs are the first points that pop into my head right now but I can probably name at least 15 more). I must say, though, that having code so closely coupled with the DB made it *blazing* fast for some specific cases.

  • @tpobrienjr
    @tpobrienjr Рік тому +28

    Around Y2K, I worked as a contractor doing some code translation. The company had a parallel activity to rework incomprehensible COBOL to equally incomprehensible SAP. There also were some date routines whose source code had been lost. I prefer APL, which is (was) considered write-only.

    • @justliberty4072
      @justliberty4072 Рік тому +1

      I was just wondering if he's got a universal description of APL. I know of several million lines of APL (! LOTS of lines in some other language) that could use converting.

    • @jpisello
      @jpisello Рік тому

      One of my first programming jobs after I graduated university was translating an actuarial program written in APL into (I think) Pascal. I had never seen APL before, and of course its programming paradigm was radically different from Pascal's imperative style. Fun times!

  • @aznir2427
    @aznir2427 Рік тому +23

    The superior IDE

  • @luckyluckydog123
    @luckyluckydog123 Рік тому +35

    At 1:32 he says Visual Basic is from "the early sixties". Visual Basic is actually from 1991, I guess he meant BASIC (not Visual) which is from 1964

    • @clickrick
      @clickrick Рік тому +3

      Came here to say exactly this.

    • @AlFredo-sx2yy
      @AlFredo-sx2yy Рік тому +5

      He's so professional he uses word to edit code and was already using visual basic back in the 60s. What a pro.

    • @squirlmy
      @squirlmy Рік тому

      I'm still puzzled though, whether he conflated BASIC with Visual Basic, or just meant BASIC. I imagine there are billions of lines of code of "Visual Basic" from the 90s, when PCs were replacing the older mainframes and minicomputers. I imagine much was written from scratch, at cheapest rates possible, rather than getting experienced professionals to re-write code the right way. The first "Visual Basic" that Microsoft put out was for DOS. I don't think Windows Visual Basic was backwards compatible, but I'm not sure. And maybe there's just a lot more of the older dialects of BASIC than I know.

    • @AlFredo-sx2yy
      @AlFredo-sx2yy Рік тому

      @@squirlmy dont overthink it, it just means he doesnt really know what he's talking about.

    • @cromefire_
      @cromefire_ 5 місяців тому

      Maybe he means COBOL from the sixties and then also visual basic code (from the 90s). I mean both are definitely a problem, we've migrated quite some systems from VB to for example C# on .NET (which is sadly the current default language/platform specified by our company...).

  • @COMATRON.
    @COMATRON. Рік тому +8

    that is an interesting dude i have to say ... a true character in this blunt time ... bro got real passion

  • @fabianmerki4222
    @fabianmerki4222 Рік тому +38

    1:1 translation is OK for some cases, but it is often smarter to start over and ditch old outdated business processes along the way... gone through that multiple times in my career.

    • @Dontcaredidntask-q9m
      @Dontcaredidntask-q9m Рік тому +4

      Yes, this is why we're seeing modern startups like Monzo bank do so well. They're able to build systems faster, and be more flexible, that the older banks can't do

    • @ShinyQuagsire
      @ShinyQuagsire Рік тому +6

      tbh I'd imagine something like this will be mostly useful for like, getting rid of crusty hardware first and foremost, but also for unit testing its replacement. That's kinda the most daunting part of 'just rewrite it' imo is making sure that the core functions are even the same, or if there's load-bearing off-by-one errors speckled around lol

    • @zefarmer
      @zefarmer Рік тому +20

      @@ShinyQuagsire A big issue that I have encountered in legacy conversion projects is that there's sometimes no clear definition of what the core functions are and how they work precisely. It's all shoestrings and bubblegum mashed together after 30+ years of adding and removing features.

  • @MrGeekGamer
    @MrGeekGamer Рік тому +29

    Visual Basic was first released in 1991. BASIC dates from the 60's

    • @uk_phil
      @uk_phil Рік тому +5

      I'm glad someone else spotted this.
      I was thinking "no way VB existed in the 60's?"

    • @SteveGoodenough
      @SteveGoodenough Рік тому +1

      not just me that noticed that then. Remember Visual Basic v1?...for DOS, I remember having to fix some of the "GUI" code due to bugs

    • @olamarvin
      @olamarvin Рік тому

      Tells you something about how bad VB is.

  • @professorcomputer
    @professorcomputer Рік тому +2

    Nice to see that these type of people still exist: balanced, experienced and thrustworthy. At least that is what I feel listening to the accurate, simple and efficient explanations of this problem that as profesionals in the IT world are dealing with almost daily. As Dr. Kevin Lano is stating the environment overall is changing and that's forcing the creation of more powerfull programming languages from aproximation to the abstraction and human language perspective. The enterprises "resistance" to the change is only making it worst as the time lapsed between would be nice to be done and has to be done is fast pacing consumed. The real added value is to understand this and act on time and not get confused by trends. Thanks for the insightfull video.

  • @ZedaZ80
    @ZedaZ80 Рік тому +3

    When I started my current job, the first big yeah was I converting over 100k lines of legacy code and it was fun. I cheated by writing a translator and then manually reviewing/fixing the resultant code.
    One great thing that came out of it was finding and fixing a lot of long-standing bugs

  • @tratzz84
    @tratzz84 Рік тому +5

    I got an uncle who told a story he optimized his cobol code by replacing function calls with GOTO's. It was a 10x speed up (late 80s). Never complaining since when working on bad code ;)

  • @digitaus8383
    @digitaus8383 Рік тому +6

    My job is MBSE and while it’s not the most thrilling engineering, if you can’t characterise a system, it’s hard to verify and maintain the configuration going into the future. A lot of this have to be designed with the aim of future proofing them out 10-20 years.

  • @black_platypus
    @black_platypus Рік тому +38

    "How do you like to organize your code?"
    "Why, In a bunch of single WordPad windows, of course!"

  • @dripcode2600
    @dripcode2600 Рік тому +5

    Write your code to be testable (automatically testable), which means coding to interfaces, using SOLID principles, and using and inventing design patterns. Having unit test, integration tests,, user acceptance test, and a full set of test for every use case in a user story, and to ensure every user story is captures for the requirements can help with the lowering cost and raising the maintainablity of a software system. Software should be written as plug and play and not have tight coupling to other parts of a software system, including a particular language. Programming is not just about a language; but rather, it's about designing a high quality robust software system that is easy to maintain and is extendable. The benefit is a trusted system that can be update and changed at low cost.

    • @sayamqazi
      @sayamqazi Рік тому

      This advice only applies to very high level languages and general purpose software. The moment you have to write a hardware driver, programs embedded in tiny devices all of that has no meaning.

  • @voomastelka4346
    @voomastelka4346 Рік тому +92

    I don't believe for a second that the Cobol or basic equivalent in Java or any other language would be any easier to maintain and develop than its original form. Autogenerated things are usually a horrible mess and even if it works it just don't make much sense for programmers. It is hard to make out from video but the 10 or so lines of Cobol exploded into at least 50 lines of weird looking Java.

    • @sanderd17
      @sanderd17 Рік тому +41

      Auto generated code usually is a mess, but at least now you get some of the benefits of using a modern language. Like garbage collection, the ability to write tests, and a bigger pool of developers.
      So I guess at that point, it's time to start the traditional refactor job.

    • @EraYaN
      @EraYaN Рік тому +18

      It’s really all about the tooling, now replacing parts and writing tests is much easier. Development can be done on much newer platforms. There aren’t really any modern COBOL IDE’s you can use. But the amount of tooling for Java is nearly endless.

    • @turun_ambartanen
      @turun_ambartanen Рік тому +19

      This! The legacy part is not due to COBOL, the legacy is using a datatype that overflows above 10k customers.
      Also the natural spaghettification of code if one does not refactor regularly and has a thought out design.

    • @progammler
      @progammler Рік тому

      You should give ChatGPT a try. I was quite impressed how easily readable the translated code was. Might take a few iterations to tweak the output but I was able to go from Cobol to c++20 back and forth.

    • @voomastelka4346
      @voomastelka4346 Рік тому +14

      ​@@progammler That misses the point of this project because ChatGPT will give you no guarantee at all that the output is doing the same thing as the input. This project is about guarantees. By assumption there are no tests and so there is also no easy way to verify the result, it doesn't really matter whether the rewrite was done manually or by ChatGPT.

  • @jerryarmitage206
    @jerryarmitage206 Рік тому

    Before taking early retirement I spent 20 years working for a UK bank writing banking systems in IBM Mainframe Assembler (HLASM). We had ~13 million lines of code and there had been attempts in the past to convert to C, this resulted in a few C modules while the rest was still HLASM. We had problems because we were all assembler developers (several hundred of us) who knew the assembler code well and never had problems supporting and maintaining the code, the C however we couldn't maintain because there was so little of it that cross training wasn't practical. In the end the C was converted to assembler (success!!).
    This highlights the a major issue with translation of code in one language to another. While it might be easy to get someone who can develop in the target language it is much harder to to get prople who understand what a program actually does, reading the code is only part of the solution. The knowledge of the orignal program, it structure and in depth functionality is lost when translated to a new language.

  • @JoannaHammond
    @JoannaHammond Рік тому +15

    Imagine converting code that was converted from assembler into COBOL (auto generated!), then converting that to PL/SQL. Now that was a pain.

    • @ChristopherHailey
      @ChristopherHailey Рік тому +2

      I once worked on a system where some of the code had been machine translated from PL/1 to Ada, I made sure I never went anywhere near that. Instead I was reverse engineering a system that was originally written in PL/C and rewriting in in c so that could interact with the translated Ada code. We did not have the source so I had to inspect the data flows in and out. I got it working, too.

  • @964tractorboy
    @964tractorboy Рік тому +2

    Fascinating. The thought of so much VB6 legacy code is terrifying. But then I remembered I wrote some even older VB business code. A big problem.

  • @tehdusto
    @tehdusto Рік тому +78

    Ah yes, ms wordpad, the premiere IDE for based gigachads

    • @cromefire_
      @cromefire_ 5 місяців тому

      I mean is there something better for COBOL? It's not like you just get JetBrains Coboland and off you go 😅

  • @TheReferrer72
    @TheReferrer72 Рік тому +2

    Wow this has been part of my day job for years, for VB to Java there are commercial tools. The biggest problem I find is UI code so that is just redesigned.
    Unit Tests are a life saver in these endeavours.

  • @jacobswartz5420
    @jacobswartz5420 Рік тому +18

    This is why documentation, comments, flowcharts, and additional information on functionality is crucial. The source code + docs + data has to be passed on. "It works because it works" is no excuse for an institution like government or the finance sector.

    • @brendonwood7595
      @brendonwood7595 Рік тому +10

      I've worked on software where they didn't even have all the source code. Literally ended up rewriting the whole thing in a more modern language to make a minor change.

    • @DrewTNaylor
      @DrewTNaylor Рік тому +3

      Uncommented code really bothers me. I don't care what language comments are written in as long as it can be reasonably translated, there needs to be comments.

    • @MeppyMan
      @MeppyMan Рік тому +1

      @@DrewTNaylor JavaScript coders don’t know it’s possible to add comments to their code. Or they think it will be too big and run too slow, while the actual code is poorly optimised and badly designed.

    • @quintrankid8045
      @quintrankid8045 Рік тому +1

      And how often do those docs reflect the actual state of the code?

    • @MePeterNicholls
      @MePeterNicholls Рік тому +2

      # TODO: fix this bit properly

  • @kimollivier
    @kimollivier Рік тому

    I changed from engineering to programming jobs by my first moonlight assignment translating legacy systems from HP and Data General to an IBM PC. I underestimated how long it would take just to proof read 250,000 lines of code! Although they were 'just' versions of Basic they were actually very different on the display (single line v full screen), Fortran style print statements and plug-in cartridges that solved matrix equations and sorting. I soon realised I could write an interpreter of the source and write out a new program that could be tested on the original inputs and outputs luckily one line at a time because that is how BASIC worked. At least GW Basic had functions instead of GOTOs!
    It was insanely successful in preserving the intellectual property of the companies developed over years. I did one job for $10,000 and I later found the next quote to rewrite from scratch was $250,000.

  • @paddycoleman1472
    @paddycoleman1472 Рік тому +9

    One feels this fellow is reinventing the wheel. If you want to modernize COBOL, PL/I and other enterprise software assets then talk to the experts at Micro Focus and/or Heirloom Computing. For example, Micro Focus’ COBOL compilers can convert to C, Javen and .NET already.

    • @EraYaN
      @EraYaN Рік тому +1

      I feel this is a much more formal and more scientific research like approach (hence the UML output), more about understanding compared just making a transpiler for cobol as a tool.

    • @jespervalgreen6461
      @jespervalgreen6461 Рік тому +3

      Whooosh

    • @paddycoleman1472
      @paddycoleman1472 Рік тому +3

      @@EraYaN Micro Focus has tools that do this sort of detailed analysis within their product suite. In fact, these tools go beyond just a program and look at the whole system (code, job control, data, forms etc.). To be fair, Micro Focus started this sort holistic approach as part of their Y2K solution in the 1990s.

  • @davidmurphy563
    @davidmurphy563 Рік тому +24

    0:30 It's very hard to read the code. Could you screen record in future please? OBS works well, dead easy to use.

    • @JohnMichaelson
      @JohnMichaelson Рік тому

      That would be a good upgrade!

    • @MrGeekGamer
      @MrGeekGamer Рік тому

      Corporates and the like (such as a university) don't like you installing random open source programs, because it requires effort to verify it's not a threat to their network. Unlikely that Grady could get them to allow it for a UA-cam video.

    • @tophat593
      @tophat593 Рік тому

      @@MrGeekGamer If it's windows you can record the screen just by pressing win, alt and R. For Linux you'll need Kazam or similar but if you're a Linux user you're installing six hundred and thirty three apps a day and changing your distro once a fortnight so I'm sure you'll get away with one more.

    • @MrGeekGamer
      @MrGeekGamer Рік тому

      @@tophat593 You're joking right? You think that "XBox Game Bar" is installed on corporate installations?
      Spoiler: It is not.

    • @tophat593
      @tophat593 Рік тому +1

      @@MrGeekGamer It's installed by default. The question is whether corporations actively go in and spend time and effort uninstalling it. I'm sure there are some that do, the vast majority wouldn't bother. It's considered safe and turning background stuff like this off in windows can even cause issues and give you a non-standard installation which is just a headache.
      Although, in a high security environment where you want to prevent recording of sensitive internal zoom meetings and the like. Sure, that would make sense.

  • @benpro95
    @benpro95 Рік тому +3

    COBOL is still going strong in the banking industry, I develop mostly payment processing applications running on a IBM z/OS mainframe.

    • @jklax
      @jklax Рік тому

      Why isn't COBOL taught these days?

    • @benpro95
      @benpro95 Рік тому +1

      @@jklax It is very application specific I was taught on the job I have more experience programming in C++

    • @jimrodarmel8512
      @jimrodarmel8512 Рік тому +1

      @@jklax COBOL was created back in the 50s as a business oriented, supposedly manager-readable language that would make plain what the mysterious computer geeks where doing inside their cubicles and therefore make their product more manageable and maintainable. Unfortunately it didn't address the problems of poor specification, poor documentation, bad coding habits, and other issues that were more the cause of the difficulties. When these concepts were taught in colleges, it was in connection with languages that enforced some of the better coding practices, but many of the businesses were loaded with mountains of black-box COBOL code that wasn't much clearer than the assembly that preceded it, and everybody was afraid to touch the jury-rigged edifice and maybe bring it crashing to the ground.
      Short answer - COBOL didn't solve the problems it was created to address, and was abandoned by academia in favor of more robust languages and codes of practice. Business didn't follow the trend because updating their software structure presented too much risk. Same reason airports use equipment and code that is sometimes decades out of date.

  • @jimrodarmel8512
    @jimrodarmel8512 Рік тому +1

    Early in my software career the bane of my life was being given reams of uncommented spaghetti code in Basic, Pascal, etc. to somehow comprehend and then modify to integrate new features. Sometimes it was easier to just rebuild it from scratch in a better language. Tools like this reverse engineering engine would have been so useful back then, but at that time even UML was in its infancy.

  • @velho6298
    @velho6298 Рік тому +16

    I think Wordpad has been deprecated as code editor and Microsoft suggests to use Office Word 2022

    • @DrewTNaylor
      @DrewTNaylor Рік тому +2

      That would be a problem, as WordPad is free to use and Word is not.

    • @ChristopherHailey
      @ChristopherHailey Рік тому +3

      @@DrewTNaylor I think your sarcasm detector might not be working.

    • @DrewTNaylor
      @DrewTNaylor Рік тому

      @@ChristopherHailey Oh, I didn't know it was sarcasm.

    • @IngieKerr
      @IngieKerr Рік тому +2

      Ah, I remember those days
      "Hello, it looks like you're writing a mission critical business application", Clippy would say.

  • @versacebroccoli7238
    @versacebroccoli7238 Рік тому +15

    Please use screenshots or screen capture software. It would be nice to read the code along with the video.

  • @jens256
    @jens256 Рік тому +11

    This is super interesting. I was always told that COBOL was well suited for describing business logic because it was fairly abstract. But i guess that was by the state of the art half a century ago. The COBOL I've seen, comes over as barely above machine code to my modern sensibilities.

    • @DC-id2ih
      @DC-id2ih Рік тому +1

      I think this might depend a lot on the age/ver of COBOL as well as the programming style used to write the application in question. In the company I work at, we have a fairly large, mainframe-based, vendor legacy COBOL system used to administer financial products. The system was originally written using a post COBOLII version of the language and has since been upgraded to IBM's latest ver of the compiler. The system is made up of about 3000 programs with the size of the procedure divisions ranging anywhere from 5000 to 15,000 lines of code. The licenses with the vendor allows my company to make significant changes to the source code in order to support the types of financial products being developed. One key feature of this legacy system is how it was originally designed. It uses a very strict structured programming philosophy and takes advantage of the cleaner COBOL coding style that became possible after (I think) COBOLII was introduced (way back in the 80s I think). . As a result, structured programming language concepts are prevalent throughout all programs within this system - i.e. in-paragraph loops are accomplished through PERFORM/UNTIL/END-PERFORM stmts; conditional stmts are always bound by END-IF clauses, and complex case logic is handled by EVALUATE/WHEN/END-EVALUATE statements (some of these structures were not available in much older versions of COBOL). Because of the strict coding standard that was applied to this system, spaghetti-like/"GOTO rich" logic is entirely missing from the system (GOTOs in this application are strictly only used for abnormal paragraph exits in the event of errors being detected). This makes the code much easier to read in a top-down fashion.....(the programs are literally designed to mirror the business flow that describes how the financial products should work. As a result, it makes it easier to identify which programs need to be changed (and where the change should be applied) when new bus requirements get sent to the development team. However, I completely understand that not all legacy systems are written this way. In my career I've also encountered legacy mainframe COBOL programs that were designed/written using much older versions of the compiler that did not support some of the syntax described above....and as a result in these other older systems you end up having to deal with code that might be much harder to follow.

    • @jens256
      @jens256 Рік тому +1

      @@DC-id2ih that's super interesting, thank you for sharing. The COBOL war stories I know, were mostly from my dad, who worked in EDP/IT-Auditing in 70s, 80s, and onwards. COBOL wasn't exactly a new language at that time either, but it was clear that a well maintained COBOL-application, wasn't the worst thing his auditing team could encounter (like APl, for which apparently need a special keyboard to even write it) It makes sense that it would have evolved and improved, as you say. One of the first languages I was first taught, around the 2000s, was Java, and modern Java is a different beast altogether, with many new features. Same deal with COBOL, I'm sure.

    • @quintrankid8045
      @quintrankid8045 Рік тому +1

      @@jens256 A quick search says, "Classes and interfaces have been in COBOL since 2002. Classes have factory objects, containing class methods and variables, and instance objects, containing instance methods and variables. Inheritance and interfaces provide polymorphism." The Wikipedia article on COBOL is worth a quick look. Lots of interesting stuff, both tech and cultural.

    • @ChristopherHailey
      @ChristopherHailey Рік тому +5

      Actually COBOL is quite the opposite of abstract. It's also very, very, very, far from machine code. COBOL is an attempt to make something similar to the English Language and this has long since been determined to be a bad idea. It is indeed primarily intended for business programs. The term business logic just means that it's describing arbitrary rules such as tax code as opposed to something not arbitrary like the laws of physics like one might do in scientific languages.

  • @Cypeq
    @Cypeq Рік тому +2

    Used cobol a little bit maintaining inventory system, it's not bad, and very easy to read.

  • @trejkaz
    @trejkaz Рік тому +4

    I'm quite interested in this topic as it always bugs me that there are so many targets for code and languages which aren't cross-usable. Often it would be amazing to be able to integrate two things without having to resort to separate services or processes.

  • @judgewest2000
    @judgewest2000 Рік тому +3

    this is something to consider when writing anything mission critical, choose languages and frameworks that will be around for the long-term - or at least supported for the long term. otherwise your grand-children will be left with a major headache.

    • @newvocabulary
      @newvocabulary Рік тому +1

      This is why I chose JavaScript, unironically. It's event driven by nature, asynchronous by design, and used by literally everyone who's ever bothered to learn programming in the last 30 years. It is the most widely developed language, and the one with the most money thrown at it. I laughed at myself when I came to the conclusion that my core applications should be written in the language I scoffed at for most of my life, but it is what it is. It's the best language available today for general maintainability, and ease of access to talent.

    • @merseyviking
      @merseyviking Рік тому +2

      There simply wasn't the choice back then. If COBOL is all you had, the future was COBOL.

  • @dragonore2009
    @dragonore2009 Рік тому +3

    Part of my full time job is to convert legacy C++ code to modern Typescript front end code. It's challenging sometimes since as you know it isn't always one to one, you have to be clever and understand what the C++ code is doing and think how would JavaScript or TypeScript do it.

    • @dragonore2009
      @dragonore2009 Рік тому +2

      For those wondering, the app is written in C++ and the company wants a more modern look and feel to it and be browser based. So I take the modules that were written in C++ and I go through it and write the Angular/typescript code based on what the C++ does in the legacy app. Sometimes the C++ does things of course TypeScript can't do, so with that I will sometimes need to write C# code and reference that with the TypeScript via a controller. It could be a DLL wrapper or something like that, that of course TypeScript can't do.

  • @Roxor128
    @Roxor128 Рік тому +4

    Can this handle assembly language as input? If so, it might be useful for making open-source firmware replacements. Dump the ROM from a device, run the binary through a disassembler, run that through the specification-generator, then use the resulting specification to write a functional replacement.

  • @skamandrios
    @skamandrios Рік тому +1

    Anybody, even someone who's never seen COBOL before, can look at those few lines and instantly see what it's doing. Yes, it's an old language but it is not some lost cryptic notation that only an archaeologist could decipher. It's damned simple, even if it requires more discipline to avoid spaghetti code than modern languages do. You can still write spaghetti code in any language if you want to.

  • @AlexAegisOfficial
    @AlexAegisOfficial Рік тому +6

    My man is using a chisel while everyone else has a CNC machine at home

  • @PhilippBlum
    @PhilippBlum Рік тому +1

    I guess it also makes sense to have some kind of blue green deployment in order to make sure the application still does the same.

  • @jenpsakiscousin4589
    @jenpsakiscousin4589 Рік тому

    We are in the middle of re-writing programs at work that were in Algol-60, and Z80 Assembler.

  • @shinoobie1549
    @shinoobie1549 Рік тому +23

    This is why the Y2K bug was potentially a huge problem. People don't understand this and think it was all a big hoax but a lot of work goes into forward compatibility that non-technical people can't even begin to appreciate

    • @NeinStein
      @NeinStein Рік тому +9

      Year 2038 bug, here we come!

    • @timop6340
      @timop6340 Рік тому +1

      If y2k was not warned so broadly in advance, significant amount of software would probably have failed. Tech people understand but what about C-suite people who probably first ask how much the fix costs and then forget it until sh.. hits the fan.

    • @thebigmacd
      @thebigmacd Рік тому +9

      It's like someone with epillepsy taking medication and complaining that it was a waste of money because you didn't have a seizure.

    • @tbird-z1r
      @tbird-z1r Рік тому +1

      There's no evidence that not addressing y2k would have caused any real issues.
      Lots of money wasted all over the world, checking that the receptionist's 486 was y2k compliant.
      There was some legit issues, but 98% of it was computer companies scamming government entities.
      2038 will cause much more problems. But that's decades away right?

    • @shinoobie1549
      @shinoobie1549 Рік тому

      @@tbird-z1r Just because there was a lot of overexaggeration and fraud doesn't mean that it wasn't a real problem.
      There was massive fraud during the last health crisis and lots of overcounting and overexaggeration but I don't think any sane person would deny that it was a real problem.
      We don't know for sure what could have happened if some of those systems were not corrected. Software has a tendency to break in really unexpected ways when something as simple as a buffer overflow can cause an entire system to crash. I used the word "potentially" simply because I don't have the infinite wisdom or some alternate dimension to know for sure that it was but I'm on the side of an abundance of caution when it comes to dealing with critical systems.
      The fraud issues are something else entirely that has to do with how screwed up our political system is. But that's outside the scope of computerphile

  • @theheadshot45
    @theheadshot45 Рік тому +4

    Fascinating, would like to see more of Dr Kevin Lano Reader.

    • @dylancope
      @dylancope Рік тому +1

      @@MenaceInc "Reader in X" is a common academic position in UK universities (and perhaps elsewhere but I mainly know the UK)

  • @mnoxman
    @mnoxman Рік тому +4

    Zarquan! Back in the 00s the GNU people had GnuCOBOL which was a transcompiler to C. Not sure what his does different other than making it "java".

  • @victornoagbodji
    @victornoagbodji Рік тому +4

    Very interesting! 😊Would love to know more about the text format mentioned that ANTLR parses into. I also wonder if doing an AST based translation would not result in bugs being ported from source language into the destination language? 🤔

    • @Kenionatus
      @Kenionatus Рік тому +5

      I say you actually *want* to port bugs in case they are required for the function of some systems, like API consumers who use a workaround that would break if the buy were fixed.

    • @kevinlano4025
      @kevinlano4025 Рік тому +1

      I use OCL (Object Constraint Language), a standard language that is part of the UML, so a kind of universal software specification language. And yes, bugs are translated unchanged - it would be an extra step to check and remove them, ideally before target code generation.

  • @EgonOlsen71
    @EgonOlsen71 Рік тому +2

    Don't know about Cobol, but in BASIC, you have no structured control flow. You can basically (no pun intended) jump around from anywhere to anywhere which makes it quite hard if not impossible to automatically transfer it into a modern language with structured control flow without making a huge mess. I would be interested to see how they deal with that issue.

    • @jamesnomos8472
      @jamesnomos8472 Рік тому +3

      I think cobol allows gotos (I think you can see it in the video itself), but most of the time large systems will have most of their gotos structured as de-facto loops or other modern control flow structures, just because it made writing these systems much much easier. Our modern control flow largely derives from these folk practices anyway, and they became formalised once it was proven that loops and if-else statements were sufficient to enact any control flow required.

  • @FabioRossettiFI
    @FabioRossettiFI Рік тому +2

    visual basic 1.0 came out in 1990-91 - Dartmouth BASIC (quite a different language) is from the 60s

  • @eliotcougar
    @eliotcougar Рік тому +11

    I remember reading some sci-fi novel where there were some sort of "digital archaeologists"... In the far future they replaced real programmers... Instead of writing new code they were looking for ancient code that did the job...

  • @combatking0
    @combatking0 Рік тому +2

    Right now I'm converting one of my old websites from Actionscript 2 to Javascript.

    • @custardtart1312
      @custardtart1312 Рік тому +1

      A medal is on its way in the post.

    • @ChristopherHailey
      @ChristopherHailey Рік тому

      That's only slightly more modern than Cuneiform

    • @combatking0
      @combatking0 Рік тому +1

      @@ChristopherHailey The silly thing is that the interactive elements were originally written in Javascript. People kept telling me to convert it all to Flash / Actionscript as it would "look better". I deleted the original Javascript thinking I wouldn't need it.

    • @ChristopherHailey
      @ChristopherHailey Рік тому +1

      @@combatking0 That's pretty funny.

  • @AlFredo-sx2yy
    @AlFredo-sx2yy Рік тому +2

    I didnt know Petelgeuse was a programmer!

  • @CenturionDobrius
    @CenturionDobrius Рік тому

    I've recently got a job with legacy Java code 20+ years old (Jsp/Servlet era).
    There is no a slightest chance of rewriting it, making it more modern :)

  • @bide7603
    @bide7603 Рік тому

    This seems like an excellent example of using an LLM to modernise and rewrite code

  • @amorphant
    @amorphant Рік тому

    When I saw legacy code in the title, I wasn't expecting legacy languages, but the more common usage meaning poorly written/convoluted/unmaintainable OG code, usually written by someone in another department who didn't know better before hiring proper devs, which everyone's afraid to touch.
    A tip for future devs: the most important thing in maintainability is readability and ease of understanding. Organize your classes to make sense to humans. Name your functions and variables so they read close to natural language, ie IF (operationHasFinished) { . . .

    • @jamesnomos8472
      @jamesnomos8472 Рік тому

      I mean those are basically the same thing in this context. It's just that by unmaintainable OG code, we mean REAL OG written back before people stopped using gotos, having a string type was decadent, and you had to worry about your variable names taking up too much disk space in the source code.

  • @joachimm81
    @joachimm81 Рік тому +18

    First time I have seen someone code in Microsoft Word.

    • @jens256
      @jens256 Рік тому

      I guess it's always there (on windows systems), and it might have some features, like saving to a specific character encoding scheme, that notepad doesn't have. It might have the same frankenstein pattern engine for search and replace that's used in Word.

    • @0x90h
      @0x90h Рік тому +3

      It is not "Microsoft Word", he is using WordPad.

    • @jonathanhopkins4042
      @jonathanhopkins4042 Рік тому

      39 years ago, we were preparing our COBOL code in wordstar.

    • @TonyWhitley
      @TonyWhitley Рік тому +2

      I used WordStar too at one time, for assembly code. It caused a bug that took a long time to track down - it set b7 of a character which looked and printed out just fine but the assembler took one look, said "Invalid character" and simply ignored the line - no error or warning!

  • @HKragh
    @HKragh Рік тому +3

    It is so clear to me that some programmers do what they do for entirely different reasons than I. Which is great! But man... as a games programmer I program to invent stuff. Not to program. Programming is a mean to an end. To create. This, taking another persons creation, and then translating it into another language...? He is a clever translator. I would not know how to do what he does.

    • @newvocabulary
      @newvocabulary Рік тому

      They're a different breed of person. Hyper turbo autismos, but talented beyond compare. I've met several of them, and they are extremely strange creatures. Nearly one dimensional except for the odd esoteric hobby. For most of them, the idea of sport, or outdoorsmanship is horrifying, and socially they're abysmal. But give them a technical task, a mundane one that must be solved procedurally, and they excel in ways that make my skin crawl. I'd say they were fictional had I not met many of them.

    • @jakubloucky4338
      @jakubloucky4338 Рік тому +6

      99% of the code that current legacy business applications consist of wasn't written by people with passion; they were written by people (many of them, spanning generations) who just needed to pay their bills. How much passion can you have for your task to write COBOL that generates a monthly bank account statement? Add numbers in a column, add summary at the end, and format it all in a simple ASCII (or rather EBCDIC) table?

  • @BethKjos
    @BethKjos Рік тому

    Can confirm on all counts. 2,000 lines of VB6 is big enough to make a nice proof-of-concept yet small enough for a programmer to validate the result independently, but business-types will remain skeptical. Yes, py2 -> py3 takes an unreasonably long time when you're worried about stability at all costs. And yes, banks still employ COBOL programmers. IDENTIFICATION DIVISION.!

  • @jimadams7765
    @jimadams7765 Рік тому +1

    I would never write COBOL code like this. And it's not even safe or maintenance friendly.
    Even if there was source, I would still transform the object code because (as we all know) the source rarely matches the object and so, will always give the "actual spec". If the compiler is known, then recompiling either the generated or original source should result in the same functionality.
    I believe, therefore, that a Cobol Dis-Assembler for each machine the code is to run on would be a better investment. Most compilers have this ability nowadays. Plus this provides the ability to compare code and convert the object for different compilers on the same machine. I used to use this method to show people that ICL 2900 used hardware BCD arithmetic and the data didn't need to be converted into a COMP for processing arithmetic.

  • @lukaslukazius1289
    @lukaslukazius1289 Рік тому +7

    All code is legacy from the moment it was written ...

  • @extraxt
    @extraxt Рік тому

    Fantastic video as always

  • @bgezal
    @bgezal Рік тому +20

    First version of Visual Basic is from 1991 (VB6 is 1998). He must mean some other BASIC.

    • @SteveGouldinSpain
      @SteveGouldinSpain Рік тому +6

      Indeed. BASIC was around for decades before Microsoft made it visual.

    • @custardtart1312
      @custardtart1312 Рік тому

      @@SteveGouldinSpain but he said Visual Basic.

    • @Wiggs1979
      @Wiggs1979 Рік тому +1

      I was about to comment the same. I still support and develop VB6 applications to this day for my day job, they're far too big and complex to completely rewrite or translate. We do use modern languages for components where possible though.

    • @FabioRossettiFI
      @FabioRossettiFI Рік тому +1

      @@Wiggs1979 yep, it's still completely interoperable with .NET, even the IDE still runs on modern Windows with some tweaks. there are even one or two alternative compilers (far from complete)

    • @quintrankid8045
      @quintrankid8045 Рік тому

      @@Wiggs1979 How big is too big and how complex is too complex?

  • @cg8912
    @cg8912 Рік тому +5

    visual basic dates back from the early 60's?

    • @brazni
      @brazni Рік тому

      It does not, I was very confused by what he meant by this

    • @DerULF1
      @DerULF1 Рік тому +4

      @@brazni I guess he meant just BASIC - not visual basic. BASIC as such dates back to 1963.

  • @TwurtleX
    @TwurtleX Рік тому +1

    Doing the COBOL to Java conversion for a critical process at the bank I work at now. Still a long ways to go

    • @jklax
      @jklax Рік тому

      What hardware is COBOL on at banks?

    • @wadu7205
      @wadu7205 Рік тому +1

      ​@@jklax 100% chance he is not allowed to tell you about the system environment.

    • @jklax
      @jklax Рік тому

      @@wadu7205 You're most likely right.

  • @xurtis
    @xurtis Рік тому +1

    Would love to see a video on what is meant by the ‘semantics’ of a program or language

    • @Kersich86
      @Kersich86 Рік тому

      you can think of semantics as the WHAT you can express in a language as opposed to syntax which is the HOW you express it. For example in Python compared to C, classes are a semantic feature that the C language does not have.

    • @xurtis
      @xurtis Рік тому

      @@Kersich86 _I_ know what semantics are; I’d like to see a video explaining why they’re important in a manner that a wider audience can understand and appreciate. Particularly with regard to how they relate to the notion of program specification and proof.

    • @xybersurfer
      @xybersurfer Рік тому

      the syntax is the structure of the language and what it looks like:
      - in English for example every sentence must end with a "." and you can only use words in the dictionary and made up names
      - in C for example every statement must end with a ";" and you can only use variable names that you declared
      i recommend the Comupterphile video *"Parsing Explained - Computerphile"* about syntax
      the semantics is what the syntax means or does:
      - in English for example you can lookup the meaning of words in a dictionary. words have a different meaning depending on the language
      - in C for example you could look up the meaning of a statement in a book like "The C Programming Language"
      i recommend Udacity video *"Syntax Vs Semantics - Programming Language"* about semantics
      i don't remember any video from Computerphile about both, but it would be cool to see such a video.

    • @xurtis
      @xurtis Рік тому

      @@xybersurfer i have a copy of The C programming language and can assure you it does not have a description of the semantics of the language. The C language specification has some, but not really enough to guarantee a single consistent meaning to even simple programs written in C.

    • @xybersurfer
      @xybersurfer Рік тому

      @@xurtis i am aware that it falls short. i was never really a fan of the book to be honest. i'm not really expecting OP to go read that book. it was merely meant as an example, to give a rough idea. sorry for making it look like i was endorsing that book

  • @BernhardWeber-l5b
    @BernhardWeber-l5b Рік тому +1

    Opening code in Wordpad. Exactly my type of humour.

  • @tantzer6113
    @tantzer6113 Рік тому +1

    What are the modern engineering approaches he mentioned (specifications, models, etc.)?

  • @mokopa
    @mokopa Рік тому

    Said with all respect, Dr Lano has such distinguishing features that he could have, or maybe still could, make a killing as a performance character! What a unique face!

  • @360Fov
    @360Fov Рік тому

    GPT models must be revolutionizing legacy code conversion....all of a sudden the output potential of humans is hugely leveraged by machine learning.

  • @fslurrehman
    @fslurrehman Рік тому

    @5:59 Dr Kevin Lano talks about CSTL. In case if someone else also confuse it with CSDL as appears in CC caption.

  • @lmpeters
    @lmpeters Рік тому +1

    I'd be curious to know if this technique could be used to more easily change code dependencies. My job would be a lot easier if, for example, this could automatically replace a legacy framework with a more modern one, e.g. CORBA with gRPC.

  • @AmexL
    @AmexL Рік тому

    COBOL will be around for another 50 years.

  • @DanielFSmith
    @DanielFSmith Рік тому

    Back in the 1990s it was easier to teach a C expert FORTRAN than it was to maintain C code generated by F2C. (In my experience, YMMV, etc.) Hopefully the tools are better now.

  • @deld9968
    @deld9968 Рік тому +4

    Very interesting

  • @Keksmania
    @Keksmania Рік тому

    We still use visual fox pro at our company and would like to convert it to a new language, but the effort would be so great starting new would be cheaper than trying to rewrite almost 30 years of code with many many bad design decisions and bugs ..

  • @austinskylines
    @austinskylines Рік тому

    amazing video, thank you so much for sharing

  • @BigyetiTechnologies
    @BigyetiTechnologies Рік тому +1

    I wonder if it's possible to dump it in Chatgpt and ask it to rewrite it in whatever language

  • @codecaine
    @codecaine Рік тому +2

    Amazing work!

  • @monkeybarmonkeyman
    @monkeybarmonkeyman Рік тому

    The great thing about old code is often it is doing things for reasons entirely invisible. We used to say COBOL was an Italian coding language, because it always looked like spaghetti 🍝

  • @lordplenty
    @lordplenty Рік тому +1

    Goto's are great - when used sparingly, in limited situations. Well placed GOTO can increase readability of the code, for example as an exit to a common destination from different layers of multiple nested loops . Also goto=jmp is used all over the place in assembly. Don't dis goto, just don't abuse it.

  • @blenderpanzi
    @blenderpanzi Рік тому

    Do these tools preserve comments? I don't know how it is in COBOL, but in many programming languages comments can go anywhere and aren't part of the AST.

  • @comrade171
    @comrade171 Рік тому

    This didnt happen overnight, these companies have this problem from years of deliberate underinvestment in the people and depts that manage/maintain their code and systems, all this does is empower them to do it all over again but not to worry soon A.I will maintain it for them.

  • @andrewfriedrichs9340
    @andrewfriedrichs9340 Рік тому +3

    I feel sorry for the poor person who eventually needs to reengineer code I have written

    • @strayling1
      @strayling1 Рік тому +3

      Careful - that person might be you.

  • @arcaneminded
    @arcaneminded Рік тому

    I've heard of some OG programmers still using notepad.exe but I had completely forgotten wordpad existed.

    • @lmpeters
      @lmpeters Рік тому

      I maintain a heterogeneous environment of Windows and Linux servers, and if I'm on Windows, I often use WordPad because it's always there and it seamlessly handles UNIX-style line endings (unlike Notepad).

  • @hakarthemage
    @hakarthemage Рік тому

    I wonder how you deal with language specific unusual behaviour like code being tied to clock cycles or something weird like that.

  • @pierreabbat6157
    @pierreabbat6157 Рік тому +1

    How do you deal with COBOL doing arithmetic in decimal fractions?

    • @ar_xiv
      @ar_xiv Рік тому +1

      Make some kinda weird tuple that behaves the same way

    • @ChristopherHailey
      @ChristopherHailey Рік тому +1

      It's like any other format, decimal numbers (zoned or packed) represent numbers, internal and external representations are up to the program. A common example would be money, e.g. USD. You can represent dollar amounts as pennies, e.g. $1.23 would be "123". When you format the output you would insert a decimal point to represent as dollars, "123" would display as "1.23". This would be fixed point and is used because it's exact. On the other hand, floating point is an approximation, and COBOL supports fp data types.

  • @sanderbos4243
    @sanderbos4243 Рік тому

    Amazing video

  • @StanislavPozdnyakov
    @StanislavPozdnyakov Рік тому

    is there a lot of cobol software running in production in banks today?

  • @Chriva
    @Chriva Рік тому +4

    goto still has its uses. Fight me :P

    • @rickyrico80
      @rickyrico80 Рік тому +3

      I agree, sometimes its pretty awkward to get out of an switch statement by cascading through and break, sometimes you want different endpoints. Its still pretty nasty though if people start misusing it way out of scope.

    • @Chriva
      @Chriva Рік тому

      @@rickyrico80 I've seen some horrors lol. I certainly get what you mean. :D It's a last resort tool when other options have been exhausted. Kinda like the volatile keyword. Rarely is it actually needed :)

  • @makkkkkkkkk
    @makkkkkkkkk Рік тому

    Really good task for LLMs

  • @AcornElectron
    @AcornElectron Рік тому

    Man knows the code.

  • @andyhall7032
    @andyhall7032 Рік тому +1

    wait...10 lines of COBOL became several pages of Java ? which runs faster ?

    • @ChristopherHailey
      @ChristopherHailey Рік тому +4

      Languages that have fewer lines of code do not necessarily run faster. You might find that one line translates to 100 lines of machine language but in the other language is tends to represent 10 lines of machine language. COBOL tends to represent numbers in decimal which is no longer directly handled by most modern hardware so COBOL tends to run very, very slowly on modern machines. IBM computers like the Series Z do support decimal for this reason.

    • @newvocabulary
      @newvocabulary Рік тому

      No, the 10 lines had a lot of GOTO, which went to other parts of the program which weren't shown.

    • @merseyviking
      @merseyviking Рік тому

      I am not a COBOL expert, but that code is the equivalent of:
      a = 4
      b = 2

  • @GordonjSmith1
    @GordonjSmith1 Рік тому

    Very informing. My thanks.

  • @RupertBruce
    @RupertBruce Рік тому

    I've done a few of those...

  • @cidercreekranch
    @cidercreekranch Рік тому +4

    I actually wrote COBOL programs back in the 80s on punch cards! Never going back.

    • @mattsadventureswithart5764
      @mattsadventureswithart5764 Рік тому

      I wonder how much money you could command with your experience...

    • @ChristopherHailey
      @ChristopherHailey Рік тому

      Do you still experience PTSD? :)

    • @northcoast7184
      @northcoast7184 Рік тому

      Did you ever drop the stack?

    • @MisterMcHaos
      @MisterMcHaos Рік тому

      Yes, you're not a *real* programmer unless you know how to indent (or outdent) source code using an IBM 029 card punch. :)
      (Hint for the youngsters: it involves deploying a wet finger.)

  • @justinmijnbuis
    @justinmijnbuis Рік тому

    Fascinating

  • @TheGreatAtario
    @TheGreatAtario Рік тому

    …That COBOL program was a fraction the size of the resulting translated versions

  • @sarundayo
    @sarundayo Рік тому

    Not taking anything away from the man, but as a very honest question: could AI also analyze legacy code, convert it to a modern language, and perhaps even optimize the same program, too?

    • @jimrodarmel8512
      @jimrodarmel8512 Рік тому

      Key thing to remember is Artificial Intelligence isn't Real Intelligence. It just looks so much like real intelligence that we can fool ourselves into giving it more credit than it deserves.