How can I select data in JADE?

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Jaded >> Wed, 10 Aug 2005 5:28:46 GMT
This could very easily become a religious war with both sides dreaming up examples of where their preferred technology out-performs the other. For example, one could easily come up with a more complex example that in an OO world will return the required information in very short order, even with interpreted Jade code, but take magnitudes of time longer in a relational SQL select statement world. A much less complex example could be as follows:

Suppose you have a table of purchase orders, keyed by the purchase order ID field as per your previous example. You now want to know how many purchases customer #1234 has made so you'd write something like the following, assuming you have the customer number inserted as custId in the "PurchaseOrder" table:

select count(*) from PurchaseOrder where custId = 1234

As you add more entries to the PurchaseOrder table, this will of course naturally take increasingly longer to execute as it has an increasing number of rows in the table to traverse when processing the select statement. Now, the semi-equivalent JADE code:

cust.allPurchases.size

Time to execute is not affected by how many purchase order instances there are.


As I said at the beginning, this could easily become a religious war so why not simply agree that there are situations where either technology will easily outperform the other and use whichever technology suits the requirements of the development at hand.

eg: There are situations where it is appropriate and right to choose and use tools other than Jade to develop your solution.

Given complex real world requirements to solve in an application, at this point in time I would much rather use Jade as my development tool of choice to develop that application as my development time is much faster than it was with the other technologies I used to use. If simple queries like the ones you have used as examples take a little longer to process then that is a price I am more than willing to pay for the benefit of faster development time. I can of course utilise some of the time I saved developing the application to optimise any common query requirements of the end users as appropriate to reduce this time.

Looking at the 6.1 road map, the new Relational Population Service seems to allow us to have the best of both worlds. Develop the application faster and still have the option of running adhoc SQL queries over an appropriately populated relational database.

Hope that helps,
Pat.



Hi Pat

Yes, I agree this could become a religious war between both sides. And obviously, that's not what these newsgroups are for. You will have noticed that these groups are populated (mostly) by Jade developers (which I am), and I thought it useful to have an alternative perspective on things.

The example you cited is obviously correct, but Jade is making the classic computer science space/time trade-off in being able to do this. It's effectively storing the results of queries. To counter this example, if I added an index to my relational PurchaseOrder table over the Customer ID column, the number of rows would have to grow *substantially* large before the query was likely to be considered slow. To me, this is one of the big advantages of relational databases - the ability to tune deployed systems. Whereas in Jade, I have to go back to the developer who then has to add a new collection (and then modify the code to use it) in order to tune the performance.

I really also take issue with your claim that apps get built faster in Jade. Having seen both sides, there are certainly some things that are quicker in Jade, but on the whole, given the amount of stuff you have to build yourself in Jade, as opposed to a whole world of available components, not to mention advice available (ever tried solving a Jade problem by googling it?, ever looked in a bookshelf for books on Jade?) I think, on the whole, I can produce better systems that better meet customer expectations in mainstream technologies.

So, I've said my piece. I'll shut up for now :-)

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Jared >> Sun, 14 Aug 2005 23:16:19 GMT

Jaded said:

"I really also take issue with your claim that apps get built faster in Jade. Having seen both sides, there are certainly some things that are quicker in Jade, but on the whole, given the amount of stuff you have to build yourself in Jade, as opposed to a whole world of available components, not to mention advice available (ever tried solving a Jade problem by googling it?, ever looked in a bookshelf for books on Jade?) I think, on the whole, I can produce better systems that better meet customer expectations in mainstream technologies. "

If you feel that Jade still doesn't have enough material on the web or advice available please help me write code, examples and tutorials for my site www.jader.co.nz.

I also feel there is too little content on the web. Probably because Jade doesn't have time to write example applications for users.

Of course, I think it's the users role to develop such examples.

Thank you.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Gerard O'Brien >> Thu, 11 Aug 2005 21:02:32 GMT

It is my judgement that his postings have "religious" overtones and frankly over the years I've become sick and tired of the rantings and ravings of OO DB detractors. It is, has always been, and always will be a matter of horses for courses.

I write only to point out that he should at least compare similar fruit if he can't compare examples of the same variety.

Whether one likes it or not in the sql environment a table index is being traversed and sets are being created using the dynamic key specifications in order to generate the desired query result.

If comparative times are to be offered an effort should be made to do comparable things.

If he would like to more closely approximate in Jade what is being done for him under the hood in the sql query processing then he should investigate dynamic dictionaries and server execution methods.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by cnwjhp1 >> Thu, 4 Aug 2005 10:42:23 GMT

That is a common example given to demonstrate the "power of sql", but you know, it's funny, but I've never wanted to write code to count the number of customers named Smith!

What I HAVE experienced with years of trying to use Oracle was that even if you have the right index in place, you can't convince it to use it! Even when Hints came out, you still couldn't get it to use the right index.

I'd much rather have the power of being able to iterate through a collection and be able to specify exactly what will happen. And largely BECAUSE we deal with large colletions with millions of objects and performance is crucial.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Jaded >> Thu, 4 Aug 2005 19:29:28 GMT

Yes, it was a simple example, but only for purposes of illustration. We could get more complicated, of course, but then the JADE equivalent would be more complex too. As I said in my other post, I was simply trying to make the point that some adhoc query engine with a simple syntax wouls be beneficial.

As for your criticism of Oracle, I'm sure that its query analyser may well get it wrong in certain circumstances, but this is definitely not a general case.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by cnwjhp1 >> Fri, 5 Aug 2005 6:20:10 GMT

I beg to differ on the Oracle performance issue. Two of us worked fulltime trying to get Oracle up to the performance of a network database, and only managed to get it one third as fast. This is for a generalised application generator, where you might think a generalised language such as sql would be better, but it wasn't. And lest you think we didn't know what we were doing, we were both database experts with good performance optimisation skills.

Having said that, I wholeheartedly agree that an adhoc query interface would be useful! After a few decades' experience though, I would not want to have to use sql when writing applications!

If you just want to wander around and look at data you have created, try the Object Inspector. In the Class Browser, click on a class and choose Classes>Inspect Instances (either from menu or right-click). On a class called Customer, this would be equivalent to a "select *". Then double-click on a reference or collection (such as myGlobal or allCustomers) to explore further.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Houston >> Mon, 8 Aug 2005 3:22:50 GMT

Don't make the query too complex, or that other cited sql strength - cross-platform compatibility - will be compromised.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Jaded >> Mon, 8 Aug 2005 7:41:02 GMT

Well if I were designing a system to execute on multiple target databases, I'd abstract the SQL away into a separate layer where the SQL could be customised for each target database, or, better still, delegate writing the SQL at runtime to an Object Relational Mapper.

Bit of a moot point though since with Jade I don't even get a choice of database!

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Patwos >> Wed, 10 Aug 2005 1:43:40 GMT

Juan,

Your original posting has been hijacked somewhat, so I thought I'd add another answer to your question. While Houston has already pointed you at the tutorials, which I'd still recommend you read, you can use SQL to select objects in your Jade DB as follows:

1. Setup a Relational View to expose the data you want to be accessible via the Jade ODBC driver. This allows you to block access to classes you don't want to be visible via SQL queries, such as usercode information etc.

2. Configure the Jade ODBC Driver to connect to the desired database and Relational View using the ODBC Data Source Applet in Windows Control Panel.

3. Connect to this Data Source using your query tool of choice. eg: MS Query, MS Access, SQL Server etc.

The Jade ODBC Driver provides read only access to the objects in your Jade DB, so you can't use SQL to update the objects in your Jade DB.

Hope that helps,
Pat.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How can I select data in JADE?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:52 pm

by Anonymous >> Fri, 19 Aug 2005 7:02:54 GMT

As per your example using the instances method in Jade uses up a lot of time as it has to firstly build the collection. If you already had a Root object which had the customer collection on it then you would find that the speed of processing your query would be more comparable with your SQL equivalent.

Iain Kerr


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 39 guests