Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aVGi4-00084k-NU for pgadmin-hackers@arkaria.postgresql.org; Mon, 15 Feb 2016 10:48:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aVGi4-0006OP-6e for pgadmin-hackers@arkaria.postgresql.org; Mon, 15 Feb 2016 10:48:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aVGi3-0006N8-F1 for pgadmin-hackers@postgresql.org; Mon, 15 Feb 2016 10:48:51 +0000 Received: from mail-ig0-x229.google.com ([2607:f8b0:4001:c05::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aVGhz-0000ao-G2 for pgadmin-hackers@postgresql.org; Mon, 15 Feb 2016 10:48:51 +0000 Received: by mail-ig0-x229.google.com with SMTP id y8so72377943igp.0 for ; Mon, 15 Feb 2016 02:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=qwECwFpKfGFjYTcuDZ4smE71XOWJOrG4+cbLiTFyeck=; b=Ht5x5k5I8WrQidzz3eo1/YixaFkhCJQTTOD+K0mRr51KXfR4Ie0IC/XeDBnSPmP1HQ XIZt/qCG56gzhnTK0N10cyh7FU+Ch+WzrrtiYyF4H5PFxs4ElzL1kS9oqZUTVhw5yqnK UYtR1QszvhrCO+/jDrv63iyQgpxFP4dsF9Vgal2nejm6ybw5Fx3T/zEWcrJU0TOyePna 30FsZckcLOPv6mkFQYRGUpE50GM/4vNwAxVh7d+wiUG88x2Ge4iCRJh5QZl8f+qdYliD PwHzXUisPIfAkAwnvgSTUSAVwMtO6Onr6N3cMfxbcMSRAUd2DX9bmXGQOY1S5hWrShSG csXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=qwECwFpKfGFjYTcuDZ4smE71XOWJOrG4+cbLiTFyeck=; b=Z3Gv+gEOwR1POT5pP02ulGCPn4O+rn2a2LpdyHstglKzKO9N0f17Js1Sas0l8RreBq mEB6bgW26sjbpEjZTw2XWf/cmrRYKsvonhZ2Q4i1awFmiI48nVauHU4McCTRrSFUSMtG itBYSOXGznt3ORaDsjkOPtD2szWCQhDHY8z/tHX7AJqLVfhkG6w5vY7cWpSgc9nvLEBK h1awI80TtGH/JZBHWoThZHbckVGSPuK0LVyTR/yalV6XsrKUUL8u9J1pwl+OpmkGHC98 RhYNrtyjNZMO1chJqkLGPYRYZg7ow05m72/OdBV7ixp9uHf+WRT3TlDu2q1vOwfI/bkP U1ZA== X-Gm-Message-State: AG10YOR21kcxo+GJMndRhSjHz82Dts+Ak+RHJui3lJlZtHnGGU/86cwZMf5S1RBqAgLc7pS4PYHNiUeBLWJUqQ== MIME-Version: 1.0 X-Received: by 10.50.43.136 with SMTP id w8mr11781807igl.96.1455533325862; Mon, 15 Feb 2016 02:48:45 -0800 (PST) Received: by 10.64.76.137 with HTTP; Mon, 15 Feb 2016 02:48:45 -0800 (PST) In-Reply-To: References: Date: Mon, 15 Feb 2016 10:48:45 +0000 Message-ID: Subject: Re: patch for cast module From: Dave Page To: Sanket Mehta Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary=089e011602a8d8ee85052bccc2fb X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --089e011602a8d8ee85052bccc2fb Content-Type: text/plain; charset=UTF-8 On Mon, Feb 15, 2016 at 8:10 AM, Sanket Mehta wrote: > Hi Dave, > > Regarding your suggestion of putting some comments in javascript, I think > I have already put some comments regarding model data and their controls if > any extended. > > Can you please let me know where exactly you think more comments are > required? > Hi The issue for me is that jQuery code isn't the easiest to read at the best of times, with nested/anonymous functions and inline JSON etc. As I look through the code for the various nodes in isolation, it's extremely difficult to get a sense of what exactly each part of the code is doing. In this example, what I see by reading the code is: - Define the required libraries (require.js stuff) - Extend the collection class - Extend the node class - Define an init function inline - Add the menu options That part is fairly easy to figure out (easier because there are blank lines between the logical sections). From there though, it becomes much harder; - There are no blank lines to separate logical code sections at all between line 48 and 235 (there is one blank line, but it doesn't separate code sections). - There are 4 comments that I can see. The first two are identical, and appear to have identical code blocks following them for reasons that are not even remotely obvious. - As a newcomer to this code, I'm wondering if it's purpose is to define the backform model. If so, why is it not broken up into sections with a comment to tell me what field each block handles, and any other useful information I may need to know? If it's not, then what is it for? So... I'm not going to tell you exactly where to put comments, because the point is that without spending a couple of hours understanding this, I simply don't know. The point of the comments (and separation of logical sections of code with blank lines) is to make it easy for another developer (especially one as rusty as me) to read and understand, then fix and improve. Be generous with comments, but don't use them unnecessarily (e.g. "a = 1 // Set a to one"). Of course, this is not just directed at you Sanket - it's something all of us working on pgAdmin need to keep in mind. Thanks. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company --089e011602a8d8ee85052bccc2fb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Mon, Feb 15, 2016 at 8:10 AM, Sanket Mehta <sanket.meht= a@enterprisedb.com> wrote:
=
Hi Dave,

Regarding your suggestion = of putting some comments in javascript, I think I have already put some com= ments regarding model data and their controls if any extended.

Can you please let me know where exactly you think more comments are requi= red?

Hi

The = issue for me is that jQuery code isn't the easiest to read at the best = of times, with nested/anonymous functions and inline JSON etc. As I look th= rough the code for the various nodes in isolation, it's extremely diffi= cult to get a sense of what exactly each part of the code is doing. In this= example, what I see by reading the code is:

- Def= ine the required libraries (require.js stuff)
- Extend the collec= tion class
- Extend the node class
=C2=A0 - Define an i= nit function inline
=C2=A0 - Add the menu options

<= /div>
That part is fairly easy to figure out (easier because there are = blank lines between the logical sections). From there though, it becomes mu= ch harder;

- There are no blank lines to separate = logical code sections at all between line 48 and 235 (there is one blank li= ne, but it doesn't separate code sections).=C2=A0
- There are= 4 comments that I can see. The first two are identical, and appear to have= identical code blocks following them for reasons that are not even remotel= y obvious.=C2=A0
- As a newcomer to this code, I'm wondering = if it's purpose is to define the backform model. If so, why is it not b= roken up into sections with a comment to tell me what field each block hand= les, and any other useful information I may need to know? If it's not, = then what is it for?

So... I'm not going to te= ll you exactly where to put comments, because the point is that without spe= nding a couple of hours understanding this, I simply don't know. The po= int of the comments (and separation of logical sections of code with blank = lines) is to make it easy for another developer (especially one as rusty as= me) to read and understand, then fix and improve. Be generous with comment= s, but don't use them unnecessarily (e.g. "a =3D 1 // Set a to one= ").

Of course, this is not just directed at y= ou Sanket - it's something all of us working on pgAdmin need to keep in= mind.

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: = @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQ= L Company
--089e011602a8d8ee85052bccc2fb--