Re: Can this be improved
On Sat, Dec 1, 2012 at 4:43 PM, Bruce Sorge sor...@gmail.com wrote: I did not use stored procs because I have having issues with making them on MySQL since I am new to the db, so I know that is one improvement that I could make. In addition to casey's comments, I would generally say that using Stored Procs is usually NOT an improvement. they don't usually give you a measurable performance gain, nor a security gain. They just end up making your code less maintainable since you have to maintain things in two places (the DB and CF code) instead of just one place (CF code). They also make your code less portable. ORM, on the other hand, makes your code WAY WAY WAY more portable, and (once you are past the learning curve) much faster to do development and easier to maintain. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353336 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Can this be improved
Hey All, I'm curious as to what is behind statements like Cameron's (not picking on you Cameron.just a good example of what I'm talking about) ORM, on the other hand, makes your code WAY WAY WAY more portable, and (once you are past the learning curve) much faster to do development and easier to maintain. So what is it about ORM that makes this WAY WAY WAY better - defining better along the way of course ;-) I'm asking because EVERY coding efficiency anything I've ever tried (i.e. Ruby on Rails) turned out to be good to a point and then you're painted into a corner needing good old fashioned custom coding to solve the problem. Why is ORM (or ORM with CF) the magic bullet? Simple real life example? Thanks in advance folks -- Bryan Stevenson B.Comm. VP Director of E-Commerce Development Electric Edge Systems Group Inc. - makers of FACTS⢠phone: 250.480.0642 cell: 250.920.8830 e-mail: br...@electricedgesystems.com web: www.electricedgesystems.com and www.fisheryfacts.com Please consider the environment before printing this e-mail -CONFIDENTIALITY-- This message, including any attachments, is confidential and may contain information that is privileged or exempt from disclosure. It is intended only for the person to whom it is addressed unless expressly authorized otherwise by the sender. If you are not an authorized recipient, please notify the sender immediately and permanently destroy all copies of this message and attachments. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353340 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Can this be improved
ORM should allow your app to run on any database on any platform (MySQL, MSSQL, Oracle) without you having to change any code. Although it doesn't cover all possible queries you may ever need to write, you may still find some instances where ORM doesn't do what you need. On Mon, Dec 3, 2012 at 4:36 PM, Bryan Stevenson br...@electricedgesystems.com wrote: Hey All, I'm curious as to what is behind statements like Cameron's (not picking on you Cameron.just a good example of what I'm talking about) ORM, on the other hand, makes your code WAY WAY WAY more portable, and (once you are past the learning curve) much faster to do development and easier to maintain. So what is it about ORM that makes this WAY WAY WAY better - defining better along the way of course ;-) I'm asking because EVERY coding efficiency anything I've ever tried (i.e. Ruby on Rails) turned out to be good to a point and then you're painted into a corner needing good old fashioned custom coding to solve the problem. Why is ORM (or ORM with CF) the magic bullet? Simple real life example? Thanks in advance folks -- Bryan Stevenson B.Comm. VP Director of E-Commerce Development Electric Edge Systems Group Inc. - makers of FACTS phone: 250.480.0642 cell: 250.920.8830 e-mail: br...@electricedgesystems.com web: www.electricedgesystems.com and www.fisheryfacts.com Please consider the environment before printing this e-mail -CONFIDENTIALITY-- This message, including any attachments, is confidential and may contain information that is privileged or exempt from disclosure. It is intended only for the person to whom it is addressed unless expressly authorized otherwise by the sender. If you are not an authorized recipient, please notify the sender immediately and permanently destroy all copies of this message and attachments. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353351 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Can this be improved
On Mon, Dec 3, 2012 at 11:36 AM, Bryan Stevenson br...@electricedgesystems.com wrote: So what is it about ORM that makes this WAY WAY WAY better I didn't say better, actually, I said portable Why is ORM (or ORM with CF) the magic bullet? Simple real life example? There is no such thing as a magic bullet. This is the reason we all are employed. I've used ORM in CF for a number of projects, and have used/explored maybe 50% of it's functionality so far. I am by no means an expert, however in my own personal experience.. ORM is good at: - Hibernate makes CRUD drop dead simple. - Your code will be shorter, more consistant - Changes are easier to make in one central place - You can even have Hibernate build your tables for you! Including relationships and indexes! - HQL Will let you drop down to SQL when the ORM entities don't seem to be doing the job alone. ORM is bad at: - Learning curve. The basics are easy. Adding complexity adds er... complexity. - Errors that it throws are sometimes misleading and semi-nonsensical (impacts learning curve) - Things like Self-Joins and more advances functionality can be difficult to figure out. Like any tool in your programming toolbox, you have to know when to use it and when not to. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353353 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Can this be improved
Thanks Russ.in my world that is not an issueand I'll stay custom if that's the only benefit. I can re-write T-SQL to PL-SQL in my sleep, but the only place I use PL-SQL is for custom system dev clientsand we are mostly moved to a product based company where our DBs of choice are T-SQL based (thus highly portable to other T-SQL based DBs should the need arise). Thanks for the concrete example Russmuch appreciated. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353356 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Can this be improved
Thanks Cameronand sorry on the portable/better goof ;-) I'd say from what you and Russ have said that there is no urgent need for me to experience the learning curve. I'll swing back and take a peek so I am better informed and give it a fair kick at the can ;-) Cheers On Mon, 2012-12-03 at 14:04 -0500, Cameron Childress wrote: On Mon, Dec 3, 2012 at 11:36 AM, Bryan Stevenson br...@electricedgesystems.com wrote: So what is it about ORM that makes this WAY WAY WAY better I didn't say better, actually, I said portable Why is ORM (or ORM with CF) the magic bullet? Simple real life example? There is no such thing as a magic bullet. This is the reason we all are employed. I've used ORM in CF for a number of projects, and have used/explored maybe 50% of it's functionality so far. I am by no means an expert, however in my own personal experience.. ORM is good at: - Hibernate makes CRUD drop dead simple. - Your code will be shorter, more consistant - Changes are easier to make in one central place - You can even have Hibernate build your tables for you! Including relationships and indexes! - HQL Will let you drop down to SQL when the ORM entities don't seem to be doing the job alone. ORM is bad at: - Learning curve. The basics are easy. Adding complexity adds er... complexity. - Errors that it throws are sometimes misleading and semi-nonsensical (impacts learning curve) - Things like Self-Joins and more advances functionality can be difficult to figure out. Like any tool in your programming toolbox, you have to know when to use it and when not to. -Cameron -- Bryan Stevenson B.Comm. VP Director of E-Commerce Development Electric Edge Systems Group Inc. - makers of FACTS⢠phone: 250.480.0642 cell: 250.920.8830 e-mail: br...@electricedgesystems.com web: www.electricedgesystems.com and www.fisheryfacts.com Please consider the environment before printing this e-mail -CONFIDENTIALITY-- This message, including any attachments, is confidential and may contain information that is privileged or exempt from disclosure. It is intended only for the person to whom it is addressed unless expressly authorized otherwise by the sender. If you are not an authorized recipient, please notify the sender immediately and permanently destroy all copies of this message and attachments. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353357 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Can this be improved
I would agree...unless it is a really, really complex query that is just killing performance...I try and avoid SP's...they make life so much harder for debugging. I haven't jumped into ORM land yet...it's on the list. Three Ravens Consulting Eric Roberts Owner/Developer ow...@threeravensconsulting.com tel: 630-486-5255 fax: 630-310-8531 http://www.threeravensconsulting.com -Original Message- From: Cameron Childress [mailto:camer...@gmail.com] Sent: Monday, December 03, 2012 9:28 AM To: cf-talk Subject: Re: Can this be improved On Sat, Dec 1, 2012 at 4:43 PM, Bruce Sorge sor...@gmail.com wrote: I did not use stored procs because I have having issues with making them on MySQL since I am new to the db, so I know that is one improvement that I could make. In addition to casey's comments, I would generally say that using Stored Procs is usually NOT an improvement. they don't usually give you a measurable performance gain, nor a security gain. They just end up making your code less maintainable since you have to maintain things in two places (the DB and CF code) instead of just one place (CF code). They also make your code less portable. ORM, on the other hand, makes your code WAY WAY WAY more portable, and (once you are past the learning curve) much faster to do development and easier to maintain. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353359 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Can this be improved
Since I have been out of CF dev for several years, I thought I would work on some simple stuff. Looking at this code below, can this be improved? I am using CF 10 with MySQL backend. I did not use stored procs because I have having issues with making them on MySQL since I am new to the db, so I know that is one improvement that I could make. Thanks, Bruce Code snippet below: !--- Insert users information into the database --- cfquery datasource=#request.datasource# INSERT INTO themovement.users (firstname, lastname, email, zipcode, groupemail, orgid) VALUES (cfqueryparam value=#form.firstname# cfsqltype=cf_sql_varchar, cfqueryparam value=#form.lastname# cfsqltype=cf_sql_varchar, cfqueryparam value=#form.email# cfsqltype=cf_sql_varchar, cfqueryparam value=#form.zipcode# cfsqltype=cf_sql_varchar, cfqueryparam value=#form.friendemail# cfsqltype=cf_sql_varchar, cfqueryparam value=#form.selectOrg# cfsqltype=cf_sql_integer) /cfquery !--- Select the org ID and DL count from the database using the form variable for a match --- cfquery datasource=#request.datasource# name=qgetOrgID SELECT orgid, dlcount FROM themovement.dlcount WHERE orgid = cfqueryparam value=#form.selectOrg# cfsqltype=cf_sql_integer /cfquery !--- If there is already an org ID in the database, then update the dlcount by one --- cfif qgetorgID.recordcount GT 0 cfquery datasource=#request.datasource# UPDATE themovement.dlcount set dlcount = cfqueryparam value=#qgetOrgID.dlcount# cfsqltype=cf_sql_integer + 1 Where orgid = cfqueryparam value=#form.selectORg# cfsqltype=cf_sql_integer /cfquery !--- Otherwise we can assume that the org ID is not in the database and add it here, and set the DL count to 1 --- cfelse cfquery datasource=#request.datasource# INSERT INTO themovement.dlcount (orgid, dlcount) VALUES (cfqueryparam value=#form.selectOrg# cfsqltype=cf_sql_integer, cfqueryparam value=1 cfsqltype=cf_sql_integer) /cfquery /cfif ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353322 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Can this be improved
On Sat, Dec 1, 2012 at 4:43 PM, Bruce Sorge sor...@gmail.com wrote: Since I have been out of CF dev for several years, I thought I would work on some simple stuff. Looking at this code below, can this be improved? I am using CF 10 with MySQL backend. I did not use stored procs because I have having issues with making them on MySQL since I am new to the db, so I know that is one improvement that I could make. Thanks, Bruce I just started a new job where main things are code using ColdBox and ORM / Hibernate which is built into cf9 and higher. It was a pain to get started but as a whole things will move a lot smoother and allow for more standardized code. You should really read this book before continuing anything. http://www.coldfusionormbook.com/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353323 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm