تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مواصفات قياسية تنصح بها مايكروسوفت عند كتابة الأكواد
#2
في البداية اتاسف على تاخري في إكمال الموضوع نظرا لانشغالي ...

There must be one blank line between the header and the first line of code in all function, subroutine, event, property routines, etc. There must be a blank line between the last line of code and the End statement (i.e. End Sub for subroutines) for all function, subroutine, event, property routines etc. Code must be indented at least one tab stop from the left margin. See examples on page 6.

في الوضائف،الإحراءات الفرعية ،الأحداث،الخصائص :يجب ان يكون السطر الأول فارغا وايضا بين السطر الأخير من الكود وجملة النهاية (End Sub مثلا) ويجب ان يكون الكود بين هذه الاشياء مسبوقا بفارغ 4 أحرف وذلك بالضغط على زر Tab
مثال عليه :
كود :
[b][FONT=Tahoma][FONT=arial][b]
Sub Print[/b][/FONT][/FONT][/b][COLOR=#000000][FONT=arial][b]
MsgBox("Print")
[FONT=Tahoma][FONT=arial][b]End Sub[/b][/FONT][/FONT][FONT=Tahoma]
[/FONT]
[/b][/FONT][/COLOR]
Use the FOR … EACH instruction instead of the FOR … NEXT instruction when dealing with object arrays and collections.
عند التعامل مع الكائنات ،المصفوفات أو المجموعات يفضل استخدام التعليمة For….Each بدلا من For……Next

Use variables within expressions instead of properties wherever possible. Properties generate events, variables don’t. An example would be when setting the LEFT property of several controls to be equal to the LEFT property of control A, you would assign the LEFT property of control A to an integer variable. You would then use that integer variable within the loop to assign it to the controls in the array.

استخدم المتغيرات بدل من الخصائص متى كان ممكنا في التعبيرات (إياك أعني واسمعي يا جارة) الخصائص تنشئ أحداثا بينما المتغيرات لاتنشئ كمثال عليه عندما نغير الخاصية Left لعدد من العناصر حتى تكون متساوية لنفس الخاصية في عنصر آخر وليكون اسمه A يجب ان تخصص الخاصية Left للعنصر A إلى قيمة عددية ثم تستخدم المتغير الرقيمة في تعليمة التكرار حتى تخصصها للعناصر الأخر


NOTE: The contents of table shown below will be used as a reference while developing your programs.
You DO NOT have to memorize the contents of this table.

الجدول التالي تستخدم كمرجع لدى تصميم برنامج معين (تذكر لست ملزما بحفظ الجدول)


Constant Naming
Constants must be used to improve readability and maintainability of your program. Constants MUST be defined using all upper case for the body of the constant name with words divided by underscores. The use and scope prefixes must precede the body of the constant name. The use and scope prefixes remain lower case. ALL constant definitions must use the As clause in the definition. For example, the definition for a global integer constant to indicate the maximum number of times the program will try to resend data would be defined as follows:
Const m_intMAX_NUMBER_RETRYS As Integer = 5

تسمية الثوابت
الثوابت يجب ان يستخدم لكي تبين امكانية قراءة برنامجك وانها ذات معنى مع مراعاة بانها يجب ان تعرف باستخدم الاحرف الكبيرة UPPER CASE مع ملاحظة بانها إذا كانت عبارة عن كلمتين تكون مفصولة بشرطة سفلية ( _ ) نوع ومدى الثابت يجب ان يضمن في تسمية الثابت حيث انها تسبق اسم الثابت وبشرط ان تكون أحرف صغيرة lower case جميع التعريفات عن الثوابت يجب ان تستخدم العبارة AS في التعريف المستخدمة لتبين نوعه ناخذ مثالا عاما نفرض انا لدينا ثابتا رقميا Integer هدفه حفظ القيمة القصوة لعدد المرات التي سيقوم البرنامج بمحاولة إعادة إرسال البيانات سيكون على الشكل التالي
كود :
Const m_intMAX_NUMBER_RETRYS As Integer = 5


Scope of Variables and Constants
All variables and constants must be defined locally unless absolutely necessary. This is good programming practice regardless of the programming language being used for development.

مدى المتغيرات والثوابت
جميع المتغيرات والثوابت يجب ان تعرف ضمن المدى المحلي إلا في حالة الضرورة المطلقة هذا النصيحة تعتبر تمرين برمجي جيد بغض النظر عن نوع لغة البرمجة المستخدمة
Naming of Visual Basic.NET and Add-on Controls
All controls MUST be given meaningful names using Hungarian Notation (described on first page). The name you assign to the control must be prefixed using one of the prefixes from the table on the next page.

التسمية في Visual Basic.Net وتسمية الأدوات :

يجب أن تسمى كل الأدوات بأسماء ذات معنى مع ملاحظة استخدام الطريقة المجرية أو Hungarian Notation (تم شرحه في البداية) مع ملاحظة بان اسم المتغير أو الداة يجب ان تسبق بسابقة باستخدام احد السوابق الموجودة في الجدول التالي
(تذكر لست ملزما بحفظه)

في المرة القادمة سنذكر بعض الأمثلة
}}}
تم الشكر بواسطة:


الردود في هذا الموضوع
مواصفات قياسية تنصح بها مايكروسوفت عند كتابة الأكواد - بواسطة Raggi Tech - 05-10-12, 02:56 AM


التنقل السريع :


يقوم بقرائة الموضوع: