IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

Avis sur le code d'un control


Sujet :

Windows Forms

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Septembre 2009
    Messages
    53
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 53
    Par défaut Avis sur le code d'un control
    Bonjour à tous.

    Je vais devoir réaliser une bibliothèque de composant Winform.
    Pour cela j'ai d'abords crée un premier control "Button"

    J'aimerais que vous regardiez mon code, dite ce que vous en pensez, ce qui pourrait être améliorer, les choses à faire et a ne pas faire dans la création de contrôle, enfin bref tous ce qui vous passe par la tête afin que je puisse crée des composants de qualité.

    Je vous remercie beaucoup d'avance

    Ps : ce control présente les fonctionnalité suivante :
    - Couleur de fond
    - dégradé
    - sens du dégradé
    - couleur et épaisseur de la bordure
    - alignement du texte
    - césure du texte

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
     
    namespace ItronControl
    {
     
        public enum alignementTextEnum
        {
            bottomLeft = 7,
            bottomMidle = 8,
            bottomRight = 9,
            midleLeft = 4,
            midleMidle = 5,
            midleRight = 6,
            topLeft = 1,
            topMidle = 2,
            topRight = 3
        }
     
        public class ButtonControl : Control
        {
            // Reference size
            private const int HeightReference = 320;
            private const int WidthReference = 240;
            private int factorX;
            private int factorY;
     
            // Text properties
            private alignementTextEnum alignementText = alignementTextEnum.midleMidle;
            private bool ceasureText = true;
            private Point pointButtonPlus;
     
            // Border
            private Color borderColor = Color.Black;
            private int widthBorder = 1;
     
            // Gradient
            private Color startColor = Color.Red;
            private Color endColor = Color.White;
            private bool wantGradient;
            private GradientFill.FillDirection fillDirectionValue;
     
            // Misc
            private bool wantRound;
            private Bitmap bmDoubleBuffer;
            private IContainer components = new Container();
     
     
            //################################################################################
            //################################################################################
     
            // Text
            public alignementTextEnum AlignementText
            {
                get
                {
                    return alignementText;
                }
                set
                {
                    alignementText = value;
                    Invalidate();
                }
            }
            public bool CeasureText
            {
                get
                {
                    return this.ceasureText;
                }
                set
                {
                    this.ceasureText = value;
                    base.Invalidate();
                }
            }
     
            // Border
            public Color BorderColor
            {
                get
                {
                    return this.borderColor;
                }
                set
                {
                    this.borderColor = value;
                    base.Invalidate();
                }
            }
            public int WidthBorder
            {
                get
                {
                    return this.widthBorder;
                }
                set
                {
                    this.widthBorder = value;
                    base.Invalidate();
                }
            }
     
            // Gradient
            public Color EndColor
            {
                get
                {
                    return this.endColor;
                }
                set
                {
                    this.endColor = value;
                    base.Invalidate();
                }
            }
            public GradientFill.FillDirection FillDirection
            {
                get
                {
                    return this.fillDirectionValue;
                }
                set
                {
                    this.fillDirectionValue = value;
                    base.Invalidate();
                }
            }
            public Color StartColor
            {
                get
                {
                    return this.startColor;
                }
                set
                {
                    this.startColor = value;
                    base.Invalidate();
                }
            }
            public bool WantGradient
            {
                get
                {
                    return this.wantGradient;
                }
                set
                {
                    this.wantGradient = value;
                    base.Invalidate();
                }
            }
     
            // Misc
            public bool WantRound
            {
                get
                {
                    return this.wantRound;
                }
                set
                {
                    this.wantRound = value;
                    base.Invalidate();
                }
            }
            private Bitmap DoubleBufferImage
            {
                get
                {
                    if (this.bmDoubleBuffer == null)
                    {
                        this.bmDoubleBuffer = new Bitmap(base.ClientSize.Width, base.ClientSize.Height);
                    }
                    return this.bmDoubleBuffer;
                }
                set
                {
                    if (this.bmDoubleBuffer != null)
                    {
                        this.bmDoubleBuffer.Dispose();
                    }
                    this.bmDoubleBuffer = value;
                    base.Invalidate();
                }
            }
     
     
            //################################################################################
            //################################################################################
     
     
            public ButtonControl()
            {
                if (!isPocket())
                {
                    factorX = 1;
                    factorY = 1;
                }
                else
                {
                    factorX = Screen.PrimaryScreen.Bounds.Width / WidthReference;
                    factorY = Screen.PrimaryScreen.Bounds.Height / HeightReference;
                }
            }
     
            public void DrawRectangle(Graphics g, Pen p, Rectangle rc)
            {
                if (!isPocket())
                {
                    Brush fillBrush = getGradientBrush(StartColor, EndColor);
                    g.FillRectangle(fillBrush, rc);
                    g.DrawRectangle(p, rc);
                    fillBrush.Dispose();
                }
                else
                {
                    Graphics gr2 = Graphics.FromImage(DoubleBufferImage);
                    if (wantGradient)
                    {
                        if (fillDirectionValue == GradientFill.FillDirection.LeftToRight)
                        {
                            gr2.FillRectangle(new SolidBrush(StartColor), 0, 0, 0, Height);
                        }
                        else
                        {
                            gr2.FillRectangle(new SolidBrush(StartColor), 0, 0, Width, 0);
                        }
                        if (fillDirectionValue == GradientFill.FillDirection.LeftToRight)
                        {
                            rc.X = 0;
                        }
                        else
                        {
                            rc.Y = 0;
                        }
                        GradientFill.Fill(gr2, rc, startColor, endColor, fillDirectionValue);
                        gr2.DrawRectangle(p, rc);
                        g.DrawImage(DoubleBufferImage, 0, 0);
                    }
                    else
                    {
                        gr2.FillRectangle(new SolidBrush(startColor), rc);
                        gr2.DrawRectangle(p, rc);
                        g.DrawImage(DoubleBufferImage, 0, 0);
                    }
                    gr2.Dispose();
                    g.Dispose();
                    p.Dispose();
                }
            }
     
            public void DrawRoundedRectangle(Graphics g, Pen p, Rectangle rc, Size size)
            {
                Brush fillBrush;
                Point[] points = new Point[8];
                points[0].X = rc.Left + (size.Width / 2);
                points[0].Y = rc.Top + 1;
                points[1].X = rc.Right - (size.Width / 2);
                points[1].Y = rc.Top + 1;
                points[2].X = rc.Right;
                points[2].Y = rc.Top + (size.Height / 2);
                points[3].X = rc.Right;
                points[3].Y = rc.Bottom - (size.Height / 2);
                points[4].X = rc.Right - (size.Width / 2);
                points[4].Y = rc.Bottom;
                points[5].X = rc.Left + (size.Width / 2);
                points[5].Y = rc.Bottom;
                points[6].X = rc.Left + 1;
                points[6].Y = rc.Bottom - (size.Height / 2);
                points[7].X = rc.Left + 1;
                points[7].Y = rc.Top + (size.Height / 2);
     
                fillBrush = wantGradient ? getGradientBrush(startColor, endColor) : new SolidBrush(startColor);
     
                g.DrawLine(p, rc.Left + (size.Width / 2), rc.Top, rc.Right - (size.Width / 2), rc.Top);
                g.FillEllipse(fillBrush, rc.Right - size.Width, rc.Top, size.Width, size.Height);
                g.DrawEllipse(p, rc.Right - size.Width, rc.Top, size.Width, size.Height);
                g.DrawLine(p, rc.Right, rc.Top + (size.Height / 2), rc.Right, rc.Bottom - (size.Height / 2));
                g.FillEllipse(fillBrush, rc.Right - size.Width, rc.Bottom - size.Height, size.Width, size.Height);
                g.DrawEllipse(p, rc.Right - size.Width, rc.Bottom - size.Height, size.Width, size.Height);
                g.DrawLine(p, rc.Right - (size.Width / 2), rc.Bottom, rc.Left + (size.Width / 2), rc.Bottom);
                g.FillEllipse(fillBrush, rc.Left, rc.Bottom - size.Height, size.Width, size.Height);
                g.DrawEllipse(p, rc.Left, rc.Bottom - size.Height, size.Width, size.Height);
                g.DrawLine(p, rc.Left, rc.Bottom - (size.Height / 2), rc.Left, rc.Top + (size.Height / 2));
                g.FillEllipse(fillBrush, rc.Left, rc.Top, size.Width, size.Height);
                g.DrawEllipse(p, rc.Left, rc.Top, size.Width, size.Height);
                g.FillPolygon(fillBrush, points);
                fillBrush.Dispose();
            }
     
            public Font getFontText()
            {
                return new Font(Font.Name, Font.Size, FontStyle.Bold);
            }
     
            public Brush getGradientBrush(Color StartColor, Color EndColor)
            {
                Bitmap linearGradient;
                Brush fillBrush = null;
                if (fillDirectionValue == GradientFill.FillDirection.LeftToRight)
                {
                    double redScale = ((double)Width) / (EndColor.R - StartColor.R);
                    double greenScale = ((double)Width) / ((EndColor.G - StartColor.G));
                    double blueScale = ((double)Width) / ((double)(EndColor.B - StartColor.B));
                    linearGradient = new Bitmap(Width, 1);
     
                    int x;
                    for (x = 0; x < base.Width; x++)
                    {
                        int red = Math.Max(Math.Min(StartColor.R + ((int)(x / redScale)), 0xff), 0);
                        int green = Math.Max(Math.Min(StartColor.G + ((int)(x / greenScale)), 0xff), 0);
                        int blue = Math.Max(Math.Min(StartColor.B + ((int)(x / blueScale)), 0xff), 0);
                        Color color = Color.FromArgb(red, green, blue);
                        linearGradient.SetPixel(x, 0, color);
                    }
                }
                else
                {
                    double RedScale = ((double)Height) / ((double)(EndColor.R - StartColor.R));
                    double GreenScale = ((double)Height) / ((double)(EndColor.G - StartColor.G));
                    double BlueScale = ((double)Height) / ((double)(EndColor.B - StartColor.B));
                    linearGradient = new Bitmap(1, Height);
     
                    for (int y = 0; y < Height; y++)
                    {
                        int red = Math.Max(Math.Min(StartColor.R + ((int)(((double)y) / RedScale)), 0xff), 0);
                        int green = Math.Max(Math.Min(StartColor.G + ((int)(((double)y) / GreenScale)), 0xff), 0);
                        int blue = Math.Max(Math.Min(StartColor.B + ((int)(((double)y) / BlueScale)), 0xff), 0);
                        Color color = Color.FromArgb(red, green, blue);
                        linearGradient.SetPixel(0, y, color);
                    }
                }
                if (linearGradient != null)
                {
                    fillBrush = new TextureBrush(linearGradient);
                }
                linearGradient.Dispose();
                return fillBrush;
            }
     
            public string getText(Graphics gr)
            {
                if (!this.ceasureText)
                {
                    return this.Text;
                }
     
                StringBuilder textCut = new StringBuilder();
                SizeF sizeText = gr.MeasureString("m", this.Font);
                if ((this.Text.Length * sizeText.Width) > base.Width)
                {
                    int nbrCaractere = (int)(((float)base.Width) / sizeText.Width);
                    textCut.Append(this.Text.Substring(0, nbrCaractere - 3));
                    textCut.Append("...");
                    this.pointButtonPlus = new Point(base.Width - (11 * this.factorX), base.Height + (9 * this.factorY));
                    gr.DrawString("+", this.Font, new SolidBrush(this.ForeColor), (float)(base.Width - (14 * this.factorX)), (float)(base.Height - (0x11 * this.factorY)));
                }
                else
                {
                    textCut.Append(this.Text);
                }
                return textCut.ToString();
            }
     
            public bool isPocket()
            {
                return ((Environment.OSVersion.Platform != PlatformID.Win32Windows) && (Environment.OSVersion.Platform != PlatformID.Win32NT));
            }
     
            protected override void OnMouseMove(MouseEventArgs e)
            {
                base.OnMouseMove(e);
                int xMouse = Control.MousePosition.X;
                int yMouse = Control.MousePosition.Y;
                int xButton = this.pointButtonPlus.X + base.Location.X;
                int yButton = this.pointButtonPlus.Y + base.Location.Y;
                int xx = xButton + (11 * this.factorX);
                int yy = yButton + (15 * this.factorY);
                if (((xMouse >= xButton) && (xMouse <= xx)) && ((yMouse >= yButton) && (yMouse <= yy)))
                {
                    MessageBox.Show(this.Text);
                }
                base.OnMouseMove(e);
            }
     
            protected override void OnPaint(PaintEventArgs e)
            {
                base.SuspendLayout();
                Pen pen = new Pen(this.borderColor);
                pen.Width = this.widthBorder;
                Graphics gr = e.Graphics;
                Rectangle rc = new Rectangle(0, 0, base.Width - 1, base.Height - 1);
     
                if (this.wantRound)
                {
                    this.DrawRoundedRectangle(e.Graphics, pen, rc, new Size(8, 8));
                }
                else
                {
                    this.DrawRectangle(e.Graphics, pen, rc);
                }
                gr.DrawString(this.getText(gr), this.getFontText(), new SolidBrush(this.ForeColor), base.ClientRectangle, this.StringFormatAlignement(this.alignementText));
                gr.Dispose();
                pen.Dispose();
                base.ResumeLayout();
            }
     
            public StringFormat StringFormatAlignement(alignementTextEnum alignement)
            {
                StringFormat stringFormat = new StringFormat(StringFormatFlags.NoClip);
                switch (alignement)
                {
                    case alignementTextEnum.topLeft:
                        stringFormat.LineAlignment = StringAlignment.Near;
                        stringFormat.Alignment = StringAlignment.Near;
                        return stringFormat;
     
                    case alignementTextEnum.topMidle:
                        stringFormat.LineAlignment = StringAlignment.Near;
                        stringFormat.Alignment = StringAlignment.Center;
                        return stringFormat;
     
                    case alignementTextEnum.topRight:
                        stringFormat.LineAlignment = StringAlignment.Near;
                        stringFormat.Alignment = StringAlignment.Far;
                        return stringFormat;
     
                    case alignementTextEnum.midleLeft:
                        stringFormat.LineAlignment = StringAlignment.Center;
                        stringFormat.Alignment = StringAlignment.Near;
                        return stringFormat;
     
                    case alignementTextEnum.midleMidle:
                        stringFormat.LineAlignment = StringAlignment.Center;
                        stringFormat.Alignment = StringAlignment.Center;
                        return stringFormat;
     
                    case alignementTextEnum.midleRight:
                        stringFormat.LineAlignment = StringAlignment.Center;
                        stringFormat.Alignment = StringAlignment.Far;
                        return stringFormat;
     
                    case alignementTextEnum.bottomLeft:
                        stringFormat.LineAlignment = StringAlignment.Far;
                        stringFormat.Alignment = StringAlignment.Near;
                        return stringFormat;
     
                    case alignementTextEnum.bottomMidle:
                        stringFormat.LineAlignment = StringAlignment.Far;
                        stringFormat.Alignment = StringAlignment.Center;
                        return stringFormat;
     
                    case alignementTextEnum.bottomRight:
                        stringFormat.LineAlignment = StringAlignment.Far;
                        stringFormat.Alignment = StringAlignment.Far;
                        return stringFormat;
                }
                return stringFormat;
            }
     
        }
    }

  2. #2
    Membre Expert
    Avatar de laedit
    Homme Profil pro
    Consultant études et développement
    Inscrit en
    Décembre 2006
    Messages
    1 344
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Consultant études et développement
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 344
    Par défaut
    Je n'ai pas parcouru ton code en détail car je n'ai pas le temps et que tu n'as pas soumis de problème particulier, mais je te conseillerais deux choses :

    • Utiliser des régions afin de "découper" ton code en plusieurs parties, par exemple les champs d'un côté, les propriétés dans une autre région.
    • Mettre des commentaires. Et plutôt ceux du genre XML (avec les 3 /). Cela évitera d'oublier à quoi sert telle fonction ou tel champ quand tu t'y repencheras dessus dans 2 mois.
    Blog - Articles - Framework

    MSDN vous aide, si si, alors n'hésitez pas à y faire un tour avant de poser une question.
    Ah, et n'oubliez pas, Google peut répondre à la majorité de vos questions.

  3. #3
    Membre averti
    Inscrit en
    Septembre 2009
    Messages
    53
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 53
    Par défaut
    Ok merci pour ton commentaire.

    Au niveau des commentaires.
    Quel est l'intérêt des triple / par rapport à de simple commentaire classique.

    Je sais que ca peut servir pour la génération de doc comme avec Sandcastle.
    Mais si cela n'est pas mon souhait.
    En effet je trouve que ce genre de commentaire gène plus la lisibilité général du code.

    Qu'en pensez vous ?

  4. #4
    Membre Expert Avatar de Guulh
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    2 160
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2007
    Messages : 2 160
    Par défaut
    Citation Envoyé par Omsalam Voir le message
    Qu'en pensez vous ?
    Ça permet surtout de voir le commentaire en question dans l'intellisense, quand tu te sers du type / de la propriété / de la méthode ailleurs dans ton code.

  5. #5
    Membre Expert
    Avatar de laedit
    Homme Profil pro
    Consultant études et développement
    Inscrit en
    Décembre 2006
    Messages
    1 344
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Consultant études et développement
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 344
    Par défaut
    Au contraire, pour moi cela rajoute de la lisibilité.

    Prenons un exemple :

    Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    /// <summary>
    /// Instancie un objet de type UCMobileUser
    /// </summary>
    /// <param name="monitoringDataAccess">Accès aux données de monitoring</param>
    /// <param name="date">Date pour laquelle les informations sont voulues</param>
    /// <param name="mobileUser">Utilisateur mobile concerné</param>
    /// <param name="company">Société de l'utilisateur mobile</param>
    /// <param name="varianteColor">Couleur de variante</param>
    public UCMobileUser(MDA monitoringDataAccess, DateTime date, MobileUser mobileUser, Company company, Color varianteColor)
    {
        ...
    }

    Cela prend de la place, certes, mais au moins j'ai tout les renseignements sous les yeux : ce que fait la méthode, à quoi correspond chaque paramètre et ce que doit retourner ou non la méthode.

    Cela évite de devoir se plonger dans le code pour deviner tout ça.


    Ensuite, en plus de la possibilité de pouvoir générer de la doc via SandCastle ou Doxygen, cela va générer des fichiers XML qui, si ils accompagnent les dll que tu produis, fourniront du contenu pour l'intellisense si quelqu'un d'autre que toi utilises tes dll.
    Blog - Articles - Framework

    MSDN vous aide, si si, alors n'hésitez pas à y faire un tour avant de poser une question.
    Ah, et n'oubliez pas, Google peut répondre à la majorité de vos questions.

  6. #6
    Max
    Max est déconnecté
    Expert confirmé

    Avatar de Max
    Homme Profil pro
    Artisan développeur
    Inscrit en
    Mai 2007
    Messages
    2 954
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Artisan développeur
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 954
    Par défaut
    Salut.

    Accessoirement, ça a également une utilité énorme... Je ne sais pas dans quel contexte tu développes, mais dans un contexte professionnel, dans le cas où quelqu'un reprendrait ton code parce que tu n'es plus là (typique dans le cas de la prestation de service, ou alors tu te pètes une jambe - on est d'accord je ne te le souhaite pas ), eh bien crois moi qu'il sera ravi de trouver un code bien commenté et documenté, ça lui facilitera grandement la compréhension...

    Plus simplement, imagine toi arriver sur un projet pour reprendre une application qui comporte des centaines de classes, des milliers, voire des millions de lignes de code (et oui ça existe ) et que ce code ne comporte quasiment AUCUN commentaire, et qu'à fortiori il n'y a pas de doc à côté...... bah tu vas tout simplement haïr ton prédécesseur

    Je conclue simplement en disant qu'à mes yeux, bien documenter et commenter son code, c'est indispensable ! Et si ça ne tenait qu'à moi, je le rendrais obligatoire

    Voilà pour mon avis sur la question

  7. #7
    Membre averti
    Inscrit en
    Septembre 2009
    Messages
    53
    Détails du profil
    Informations forums :
    Inscription : Septembre 2009
    Messages : 53
    Par défaut
    Ok d'accord merci pour vos réponse.
    Je suis tout a fait d'accord que les commentaires sont très utile dans un programme (surtout si je me pete une jambe )

    De plus, ce que me dit Guulh par rapport à l'intelisense est très interessant pour moi.

    Je vous remercie

Discussions similaires

  1. [XHTML] Avis sur un code XHTML/CSS
    Par babyshambles76 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 13/09/2007, 13h08
  2. Avis sur un code SDL
    Par Asmod_D dans le forum SDL
    Réponses: 3
    Dernier message: 18/02/2007, 22h33
  3. [FFT] Votre avis sur mon code
    Par deubelte dans le forum C++
    Réponses: 1
    Dernier message: 10/02/2007, 20h14
  4. [Code Prof]votre avis sur un code?
    Par granquet dans le forum Réseau
    Réponses: 6
    Dernier message: 11/04/2006, 20h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo