Better control of Coldfusion Component (CFC) functions

I rely heavily on CFC

. Sometimes in an application I would have several CFC

containing dozens of functions on CFC

. Therefore, over time, it is easy to forget or miss functions that have already been created.

So my question is, how do you guys manage all these features? Do you have a separate document listing all the features and indexing them this way? Is there a built-in automatic function that we can use?

What I am doing is more meaningful to name functions, but this is very tedious. There must be a better way to do this. Just look for your thoughts.

Thanks in advance.

+3


source to share


2 answers


I don't think there is a magic bullet here. Programmers with a bit more OCD than me are more likely to answer and give you a hardware-covered solution. For me (or my team), I keep a library of shared components in a folder that I reuse for different sites and applications. Then I add them as / util or / lib folder for a given project and use (or expand) them as needed. Good planning - good documentation (Wiki is a great choice for a team) is a must.

It is very important to plan carefully whether CFCs should be expanded. Otherwise, you have to chase a nested function that is part of some superclass down in the weed (which is how it works, though, but I really don't know why it works).



This is where frameworks can provide the required structure. For common functions and events, they usually provide a location and convention for creating things like this. This makes it easier to decipher them (if you've been indexed into a structure). They have some drawbacks, but they make life much easier :)

+7


source


-You must follow the appropriate naming conventions for each cfcs.

-Each cfcs must be dedicated to a specific purpose. that is, the login cfcs should contain only registration-related functions.

- All common functions must be kept together in a cfc and which can be extended by other cfcs.



-You can use generic cfc for random functions.

Now, if you want to add a new function for any function, you can only scan 3 cfcs, i.e. dedicated to this functionality, general and casual. And you add new things as best you can.

+1


source







All Articles