Refactored code for Table and its child nodes.

Поиск
Список
Период
Сортировка
Искать

Refactored code for Table and its child nodes.

От:
Akshay Joshi <akshay.joshi@enterprisedb.com>
Дата:
Вложения:
Hi Hackers,

For a couple of days, I was working on the code refactoring of Table and it's child nodes.

Problem:  In pgAdmin4 child nodes of the table can be created/modified from table dialog as well as from individual node. For example: Primary Key constraint can be created/updated from tables as well as from individual primary key node.

After analyzing the code it seems that we have duplicate logic/functions in 'tables/utils.py' and '__init__.py' of the respective node. 

So because of the above-described problem, if there is a bug at one place we need to fix it on both the places.  

Purpose: 
  1. Remove duplicate logic.
  2. Child node specific logic should be inside the child node and table node gets the required information from the respective child node.
Solution:
  1. Create 'utils.py' for each child node.
  2. Move the common logic from 'tables/utils.py' and '__init__.py' of the respective node to 'utils.py'.
  3. Both table and its respective child access the functions from the respective 'utils.py'.

Note: Refactoring of columns node still remaining I'll start working on it.

Please review/test the patch thoroughly for tables and it's child nodes.

--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246

Re: Refactored code for Table and its child nodes.

От:
Khushboo Vashi <khushboo.vashi@enterprisedb.com>
Дата:
Hi Akshay,

Everything works fine on Python 3 but not working on Python 2.7.
Code refactoring looks good to me.

Thanks,
Khushboo

On Wed, Nov 13, 2019 at 7:13 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers,

For a couple of days, I was working on the code refactoring of Table and it's child nodes.

Problem:  In pgAdmin4 child nodes of the table can be created/modified from table dialog as well as from individual node. For example: Primary Key constraint can be created/updated from tables as well as from individual primary key node.

After analyzing the code it seems that we have duplicate logic/functions in 'tables/utils.py' and '__init__.py' of the respective node. 

So because of the above-described problem, if there is a bug at one place we need to fix it on both the places.  

Purpose: 
  1. Remove duplicate logic.
  2. Child node specific logic should be inside the child node and table node gets the required information from the respective child node.
Solution:
  1. Create 'utils.py' for each child node.
  2. Move the common logic from 'tables/utils.py' and '__init__.py' of the respective node to 'utils.py'.
  3. Both table and its respective child access the functions from the respective 'utils.py'.

Note: Refactoring of columns node still remaining I'll start working on it.

Please review/test the patch thoroughly for tables and it's child nodes.

--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246

Re: Refactored code for Table and its child nodes.

От:
Akshay Joshi <akshay.joshi@enterprisedb.com>
Дата:
Вложения:
Hi Khushboo

Attached is the patch to fix Python 2.7 issue.

On Thu, Nov 14, 2019 at 2:48 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Akshay,

Everything works fine on Python 3 but not working on Python 2.7.
Code refactoring looks good to me.

Thanks,
Khushboo

On Wed, Nov 13, 2019 at 7:13 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers,

For a couple of days, I was working on the code refactoring of Table and it's child nodes.

Problem:  In pgAdmin4 child nodes of the table can be created/modified from table dialog as well as from individual node. For example: Primary Key constraint can be created/updated from tables as well as from individual primary key node.

After analyzing the code it seems that we have duplicate logic/functions in 'tables/utils.py' and '__init__.py' of the respective node. 

So because of the above-described problem, if there is a bug at one place we need to fix it on both the places.  

Purpose: 
  1. Remove duplicate logic.
  2. Child node specific logic should be inside the child node and table node gets the required information from the respective child node.
Solution:
  1. Create 'utils.py' for each child node.
  2. Move the common logic from 'tables/utils.py' and '__init__.py' of the respective node to 'utils.py'.
  3. Both table and its respective child access the functions from the respective 'utils.py'.

Note: Refactoring of columns node still remaining I'll start working on it.

Please review/test the patch thoroughly for tables and it's child nodes.

--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246


--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246

Re: Refactored code for Table and its child nodes.

От:
Khushboo Vashi <khushboo.vashi@enterprisedb.com>
Дата:
Hi Akshay,

On Thu, Nov 14, 2019 at 5:52 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Khushboo

Attached is the patch to fix Python 2.7 issue.
Looks good to me. 

Thanks,
Khushboo

On Thu, Nov 14, 2019 at 2:48 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Akshay,

Everything works fine on Python 3 but not working on Python 2.7.
Code refactoring looks good to me.

Thanks,
Khushboo

On Wed, Nov 13, 2019 at 7:13 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers,

For a couple of days, I was working on the code refactoring of Table and it's child nodes.

Problem:  In pgAdmin4 child nodes of the table can be created/modified from table dialog as well as from individual node. For example: Primary Key constraint can be created/updated from tables as well as from individual primary key node.

After analyzing the code it seems that we have duplicate logic/functions in 'tables/utils.py' and '__init__.py' of the respective node. 

So because of the above-described problem, if there is a bug at one place we need to fix it on both the places.  

Purpose: 
  1. Remove duplicate logic.
  2. Child node specific logic should be inside the child node and table node gets the required information from the respective child node.
Solution:
  1. Create 'utils.py' for each child node.
  2. Move the common logic from 'tables/utils.py' and '__init__.py' of the respective node to 'utils.py'.
  3. Both table and its respective child access the functions from the respective 'utils.py'.

Note: Refactoring of columns node still remaining I'll start working on it.

Please review/test the patch thoroughly for tables and it's child nodes.

--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246


--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246
FAQ