Answered
CFC Methods and Code
Hello Community!
I was asked to create a CFC that will encapsulate together the methods that as of today my company has in 3 different files. Each one of these file is included in the main program as a template using cfinclude. When I opened the 3 files, I noticed that the first 150 lines of code were exactly the same. The only thing that changed in the 3 of them were the methods after those blocks of code.
Before I ask my question let me explain how I am laying out my code:
<cfcomponent displayname="" hint="">
code that was common in the 3 places
code that was common in the 3 places
code that was common in the 3 places
code that was common in the 3 places
code that was common in the 3 places
method 1
method 1 code
method 1 code
method 1 codd
method 2
method 2 code
method 2 code
method 2 code
method 3
method 3 code
method 3 code
method 3 code
<cfcomponent>
Ok, I want to know if everytime I call one of my methods the 'code that was common in the 3 places
' will get executed or if I have to put that code in another method that gets called everytime I call the others. I want an idea to complete this task. I have created CFCs before but this is the first time I face a situation where I have to make such decisions.
Thanks!
Ysais.
I was asked to create a CFC that will encapsulate together the methods that as of today my company has in 3 different files. Each one of these file is included in the main program as a template using cfinclude. When I opened the 3 files, I noticed that the first 150 lines of code were exactly the same. The only thing that changed in the 3 of them were the methods after those blocks of code.
Before I ask my question let me explain how I am laying out my code:
<cfcomponent displayname="" hint="">
code that was common in the 3 places
code that was common in the 3 places
code that was common in the 3 places
code that was common in the 3 places
code that was common in the 3 places
method 1
method 1 code
method 1 code
method 1 codd
method 2
method 2 code
method 2 code
method 2 code
method 3
method 3 code
method 3 code
method 3 code
<cfcomponent>
Ok, I want to know if everytime I call one of my methods the 'code that was common in the 3 places
' will get executed or if I have to put that code in another method that gets called everytime I call the others. I want an idea to complete this task. I have created CFCs before but this is the first time I face a situation where I have to make such decisions.
Thanks!
Ysais.
