Results 1 to 17 of 17

Thread: Automatic code generation

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Posts
    159

    Talking Automatic code generation

    Can anyone explain to me some ADVANTAGES and DISADVANTAGES of automatic code generation provided by applications such as Dreamweaver?

    i have come up with the following:

    Advantages

    • implement an application quickley
    • code that has been tested and debugged
    • view the code to see what effect it has


    Disadvantages

    • Code can be difficult to understanding is limited
    • Difficult to add to the generated code if developers understanding is limited


    more advantages would be great

    thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Automatic code generation

    Quote Originally Posted by NOTSOSURE
    more advantages would be great
    I don't agree with two of the advantages you list. My thoughts are:

    Advantages

    • implement an application quickley


    Disadvantages

    • Provides little or no incentive to improve programming skills
    • Code can be difficult to understanding
    • Can be limited in scope and sophistication
    • Code would still need to be throughly tested and debugged
    • Can be difficult to debug WHEN something goes wrong or does not perform to specs
    • Difficult to add to the generated code if developers understanding is limited
    • Difficult to maintain and/or enhance without fundamentally rewriting it

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Posts
    159

    Talking Re: Automatic code generation

    cool constructive critisisms are just what i'm after

    But wouldn't you learn from observing the code generated?

    and surley applications such as dreamweaver would not allow code to be generated that contained bugs?

  4. #4
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Automatic code generation

    and surley applications such as dreamweaver would not allow code to be generated that contained bugs?
    Bugs do not occur randomly through transcription errors and spelling mistakes, they most frequently occur by a difference of understanding between the implementor and the designer as to the function of the code. This is every bit as true for automatically generated code as it is for human-typed code ... arguably more so.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Posts
    159

    Talking Re: Automatic code generation

    Does anyone here like autogenerated code, if so why? there seems to be a negative vibe here!

    cheers

  6. #6
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Automatic code generation

    It depends on the degree of the code being generated. If it's skeletal, then yeah; I love it. For instance, in .Net, if you implement something in a class; it draws out everything you need to override and have (along with everything else intellisense provides). Same thing with visio. You design the entire project without a single line of syntax and it will create the outline framework for you. You still have to give the objects their functionality, but you don't need to keep refferring to your original design.

    This kind of goes along with what Hack had said -
    As long as the automated code generation is doing the mundane tasks, I'm for it. The key word is "mundane." If after the code is generated, you can say "I'm glad it did all of that for me so I didn't have to." You're ok. But if you say "I'm glad it did all of that for me because I had no clue." Stay away from them.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Posts
    159

    Talking Re: Automatic code generation

    so future development of programming skills effected by auto generated code everyone hates

    But it's cool for structuring the framework for the devloper to start coding

    Does anyone agree that auto generated code will ensure the application adheres by the rules of the programming language and help create an application with minimal errors?

  8. #8
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Automatic code generation

    I'll meet you half way and say "sort of."

    Good code is two things. It works, and it works the best way that it can with maximum efficiency and low overhead. Templates do their best to make it work, but it's a universal solution to your unique problem.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Automatic code generation

    Quote Originally Posted by sevenhalo
    For instance, in .Net, if you implement something in a class; it draws out everything you need to override and have (along with everything else intellisense provides). Same thing with visio. You design the entire project without a single line of syntax and it will create the outline framework for you. You still have to give the objects their functionality, but you don't need to keep refferring to your original design.
    This may be more symantical than anything else, but, as long as nothing more than outlined framework is generated while the real coding must be done by the developers, then I can agree with it being autogenerated.
    Quote Originally Posted by sevenhalo
    Good code is two things. It works, and it works the best way that it can with maximum efficiency and low overhead. Templates do their best to make it work, but it's a universal solution to your unique problem.
    I liked this quote so much, I saved it
    Quote Originally Posted by Joacim Anderssen
    You should never just write code that works.

    You should also write code that is maintainable.

    Writing code that works, but isn't easily maintained, will, in the end, be very costly for the company that is stuck with the source.
    How maintainable can code that is auto generated be?

  10. #10
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Automatic code generation

    My five cents (inflation)....

    Auto generated code, just like anything else in programming is a tool. You use the right tool for the right job. I agree that using autogenerators for the mundane stuff is a god send. Take for instance a project I'm working on. Over the last few months, my cohort and I have been buisy building tables to hold the data we need. Now that we have that 90% done, I'm ready to generate the stored procs for those tables. How ever I wasn't looking forward to building the CRUD procs needed for the nearly 50-some odd tables we have. For those basic sprocs, I'm glad there's an autogenerator (I used mygeneration for this) to create them. I also used the tool to build my base classes to interact with those sprocs. Granted that's just the basics, for the more complex queries, I'll have to create the sprocs myself and integrate them into the classes, but that's the "fun" part.

    Quote Originally Posted by NOTSOSURE
    Does anyone agree that auto generated code will ensure the application adheres by the rules of the programming language and help create an application with minimal errors?
    Yes and no. The result is only as good as the template. One of two things will happen, you'll get something clean and pristine, or you will have very quickly automated errors right into the app. The result is also only as good as the inputs into the template. I ran into one issue when I was generating my base sprocs and classes. I have one table that will only ever have one row in it, so I didn't put a PKey on it. This caused the auto generator to choke. But that's OK, since I got the other 99% done, dealing with one table/class is a walk in the park.

    Funny that Hack should mention that quote... it's the same one I've got saved off as well.... probably from the same thread.

    The problem with auto code is that, as sevenhalo mentioned, it's a generic solution for everyone. It can never be specific to all needs. There will always need to be situation specific code that could never be automated. I've tried to do this with error handling before... but in every sub, the situations are for the most part so specific, that it can't be generalized enough for automation.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  11. #11
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Automatic code generation

    It is worth noting that most of us work with automatic code generation all the time - the windows forms designer(s) are code generators - if you look in the form class's InitializeComponent sub you can see it in all it's glory...

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Automatic code generation

    Quote Originally Posted by Merrion
    It is worth noting that most of us work with automatic code generation all the time - the windows forms designer(s) are code generators - if you look in the form class's InitializeComponent sub you can see it in all it's glory...
    No argument...but I would classify that more along the lines of what sevenhalo termed an "outline framework"

    In order for what has been generated to really do something beneficial, code needs to be written.

  13. #13
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Automatic code generation

    Autogenerated code is clothes off the rack. Hand generated code is custom-made clothing. Unless your body is off the rack, off-the-rack clothes won't fit as well as custom-made clothing. They probably won't look as good or last as long either.

    I prefer to generate all my own code - that way I understand all of it, not just most of it. (Now if only I could remember to make my documentation adequate enough so that I could still understand all of the code 5 years after I wrote it ...)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  14. #14
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Automatic code generation

    Framework type code generation is actually quite useful. For example I use an Object-Relational mapper that generates a lot of code for serialising objects to/from tables. Given that there are about 250 tables and each of them has between 5 and 50 fields I'm glad I don't have to write all that code myself.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Automatic code generation

    Take MS FrontPage for example: Its terrible and known for generating much unnecessary code and bloat. Probably same can be said for dreamweaver but to a lesser extent. Now coding in Notepad is cleaner but tedious and time consuming. Like already posted, you use the right tool for the job as each job is different, especially when you have a time constraint like a budget. I hate autogenerated code in web development software for anything more then scripting a basis for a template page or something.

    Autogenerated code does not really teach you how to c0d as only writting and debugging it manually will you gain the most knowledge and skill.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Automatic code generation

    Quote Originally Posted by NOTSOSURE
    and surley applications such as dreamweaver would not allow code to be generated that contained bugs?
    Depends what you term a "bug". Run a non-trivial page produced in Dreamweaver or FP through a validator and see how full of junk it is. Yes FP is worse but they are both bad. The many disadvantages far outweight the very slight productivity advantage through using either product.

    Along the lines of the clothes analogy, think of hand code as shrink-wrapping something, and auto-generated code as a massive bag surrounding the whole thing and several acres beyond. Occasionally with holes.
    Last edited by penagate; May 24th, 2006 at 05:04 AM.

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Automatic code generation

    Quote Originally Posted by RD
    ... Probably same can be said for dreamweaver but to a lesser extent.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width