Best way to create reusable ui/view component?

I’m new to Corona.

What’s the best way to create reusable ui/view component?

For example, I want a circle, when I drag the circle, I want to create a firework around it (and move with the circle). 

And this circle are used multiple times in my app, I wan’t reuse my code for this circle.

Are you familiar with the concept of OOP(Object oriented programming)?

I’m not a pro in corona, but i came from java. And there, we use that concept to make reusable components. 

I think it’s what you need. Something like:

  1. Create a class (lua file, ex: circle.lua) that will contain all the characteristics that you want;

  2. In that file create a function to create new circles;

  3. Then instantiate this file in your main.lua like: 

    local circleClass = require( “circle” ) local circle = circleClass:new( { name = “circle1” } )

This link: http://www.develephant.net/an-rpg-themed-oop-design-pattern-for-corona-sdk-part-1/ has a good explanation about it.

It might have other options and maybe best ones, again not i’m not a pro…

Are you familiar with the concept of OOP(Object oriented programming)?

I’m not a pro in corona, but i came from java. And there, we use that concept to make reusable components. 

I think it’s what you need. Something like:

  1. Create a class (lua file, ex: circle.lua) that will contain all the characteristics that you want;

  2. In that file create a function to create new circles;

  3. Then instantiate this file in your main.lua like: 

    local circleClass = require( “circle” ) local circle = circleClass:new( { name = “circle1” } )

This link: http://www.develephant.net/an-rpg-themed-oop-design-pattern-for-corona-sdk-part-1/ has a good explanation about it.

It might have other options and maybe best ones, again not i’m not a pro…