I received a question regarding this post: How do large programs work?

 

Hi Calvin. I thought we're supposed to write granular, encapsulated programs. I have read that the highest quality code is also some of the smallest code. If that's true, then why, oh why permit any one to write a monster routine thousands of times bigger than 64K?

 

Yes, it’s true that good programming practice encourages modular, encapsulated programs. Some people feel that a function should be completely visible on the screen.

 

Looking back at the feature request in our internal documents, I found this topic: “Optionally enlarge 65kB limit for compiled code in programs” with this comment:

 

I don't know why this "limit" exist in 32bit Windows, but our large programs generated from framework generator, must be fragmented to separately aplications. Please look in compiler, if there is only forgotten limitation from 16bit DOS times.

 

Another big motivator of this feature was customers bumping into this limit when creating fairly complex queries. Also each byte in a literal string adds one byte to the compiled program. If you have long table names, each with 250 fairly long field names, each with a few DBSetProps, the compiled program gets quite large.

 

I just created a simple remote view on SQL Server Northwind joining 4 tables and here are a few lines generated from it

 

SELECT Customers.CustomerID, Customers.CompanyName,;

  Customers.ContactName, Customers.ContactTitle, Customers.Address,;

  Customers.City, Customers.Region, Customers.PostalCode,;

  Customers.Country, Customers.Phone, Customers.Fax, Orders.OrderID,;

  Orders.CustomerID, Orders.EmployeeID, Orders.OrderDate,;

  Orders.RequiredDate, Orders.ShippedDate, Orders.ShipVia, Orders.Freight,;

  Orders.ShipName, Orders.ShipAddress, Orders.ShipCity, Orders.ShipRegion,;

  Orders.ShipPostalCode, Orders.ShipCountry;

 FROM ;

     dbo.Customers Customers ;

    INNER JOIN dbo.Orders Orders ;

   ON  Customers.CustomerID = Orders.CustomerID ;

    INNER JOIN dbo."Order Details" Order_details ;

   ON  Orders.OrderID = Order_details.OrderID ;

    INNER JOIN dbo.Products Products ;

   ON  Order_details.ProductID = Products.ProductID

 

DBSetProp(ThisView+".contacttitle","Field","DataType","C(30)")

DBSetProp(ThisView+".contacttitle","Field","UpdateName","dbo.Customers.ContactTitle")

DBSetProp(ThisView+".contacttitle","Field","KeyField",.F.)

DBSetProp(ThisView+".contacttitle","Field","Updatable",.T.)

 

 

Does anybody appreciate this feature? What are some reasons you have large programs? Please post a comment if you do.