Code Building Code

  • Comments posted to this topic are about the item Code Building Code

  • I too use have been known to use whatever tool can give me the quick and dirty solution to a data update, load, etc. excel, vbscript, powershell, what have you. Its not pretty, but it works.

    I don't really know if AI can develop full blown systems of code, although it could happen. Where I would like to see AI focused in the development world is in helping developers like me write better and stronger code and be more aware of standards and practices.

  • To err is human. To really foul up - it takes a computer.

  • I believe that software design and construction is somewhat of an art form and it will be impossible to make a really good application via algorithm or AI. People are too hard to predict and there has to be a human element. Query optimization could be help but to me, people still need to make decisions.

  • I don't know about AI (ie: speech to code) driven application development, but meta-data driven application development certainly is a thing. T-SQL is adept at generating code. The example below builds create index statements by leveraging the dm_db_missing_index_* system views, but I've also used T-SQL to crank out stuff HTML and XML documents.

    -- Generate CREATE statements for suggested missing indexes:
    SELECT 'CREATE INDEX [missing_index_' + CONVERT (VARCHAR, mig.index_group_handle) + '_' + CONVERT (VARCHAR, mid.index_handle)
    + '_' + LEFT (PARSENAME(mid.statement, 1), 32) + ']'
    + ' ON ' + mid.statement
    + ' (' + ISNULL (mid.equality_columns,'')
    + CASE WHEN mid.equality_columns IS NOT NULL AND mid.inequality_columns IS NOT NULL THEN ',' ELSE '' END
    + ISNULL (mid.inequality_columns, '')
    + ')'
    + ISNULL (' INCLUDE (' + mid.included_columns + ')', '') AS create_index_statement
    FROM sys.dm_db_missing_index_groups mig
    INNER JOIN sys.dm_db_missing_index_group_stats migs ON migs.group_handle = mig.index_group_handle
    INNER JOIN sys.dm_db_missing_index_details mid ON mig.index_handle = mid.index_handle
    INNER JOIN sys.objects o ON o.object_id = mid.object_id
    WHERE mid.database_id = DB_ID()
    AND migs.avg_total_user_cost * (migs.avg_user_impact / 100.0) * (migs.user_seeks + migs.user_scans) > 10
    ORDER BY migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans) DESC;


    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • We all think of speech, but text to AI works as well. I think things could work well, but we have so much ambiguity in communication, not sure that an AI really works outside of some simple situation. Just like T-SQL building T-SQL only works in limited cases.


  • Awk is a great utility for processing text files. I had to migrate data from one system that used Active Directory (in Application Mode) to a CSV file for the vendor to load into their database. I wrote an awk program to read the LDAP ldif export file and created a CVS file.

    Recently, my manager wanted some stats on an XML input file that we process on a quarterly basis and the matched XML output file. With an input file over 753,000 KB, I reached back with my knowledge of UNIX utilities, grep and wc (word count). Cygwin ( is a UNIX compatible environment that runs on Windows.

  • Great point, Ralph. Note that PowerShell and Python are also great text processing utilities as well. Learning some of the Unix, PoSh, or Python skills can be very handy for stringing together items to solve a problem.

  • The idea of using AI to generate code is scary to me. In my experience, I am rarely given the level of specs that would answer all the questions that AI would need to come up with reasonable solutions. Even if the specs were there, would the code be maintainable down the road?

    I use Unix tools all the time, - awk, vi - to create repetitive sql insert or update statements. I find that excel tries to get too smart and changes some date or numeric field in a way that I don't want it to change. With the unix tools, it's WYSIWYG.

  • Not sure AI plays a huge role in here, since a human is still describing the requirements.  This feels a bit more like a lot of the standards being worked on through the Open Group (Mof2Text or BPMN or even advance UML), where any number of formats might be used to capture the requirements and the compatible engines can generate runnable and compiled code that can perform said tasks.

    Perhaps the natural language processing parts of what we've been calling AI can be used to create compatible inputs to the above, but still - without some formality in how you describe what the system or component is expected to do, the code that is generated as a result will be nonsense.  In short - you'll end up with yet another programming language, albeit one that can be spoken and turned into something actionable later.


    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • I have frequently used metadata within SQL Server to script out many things over the years, I keep scripts around to easily build basic CRUD stored procs, to recreate tables, to be able to figure out what synonyms are in a database and easily recreate them to another database with permissions, and even script the restore of a database based on the MSDB backup history or contents of a BAK file.

    FYI, on Eric's comment, yes you can get CREATE INDEX scripts from the missing index DMVs but you need to manually review them because the missing index logic inside of SQL Server isn't all that great at determining which columns should be index key columns and what order the index key columns should be in:

  • null

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Yes, an index recommendation should be treated like a pharmaceutical add: always consult your DBA, and stop using the index when database bloating and slowness of data movement occurs.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Until product owners are willing to put enough detail into requirements documents, we're not going to see AI build complete programs. I know that I routinely round trip back to product owners 4 - 5 ( 15 - 20 🙂 ) times to get enough clarity to build what they really want instead of what they said they wanted the first time. It's a very interactive process.

    That said, when AI gets to the point of being close to human intelligence, it could start interactively working with a product owner the same way we do. It needs to be an iterative process. That's not going to happen in my lifetime but there's no reason it could not eventually happen.

    And yes, I use code to build code quite often.

    • This reply was modified 5 years, 3 months ago by  Tom Uellner.
  • Do we really need AI driven application development?

    Just like AI driven cars, it's an interesting concept, and I'm sure it's in our future, but at least here an now, there doesn't seem to be much consumer demand for it. However, where I can see this having obvious and immediate benefit today would be in the area of data analytics and visualization. Simply tell the AI what data you want to see.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

Viewing 15 posts - 1 through 15 (of 24 total)

You must be logged in to reply to this topic. Login to reply