الفرق بين المراجعتين لصفحة: «برمجة سي/لماذا تتعلم لغة البرمجة سي؟»

تم حذف المحتوى تمت إضافة المحتوى
طلا ملخص تعديل
وسم: تعديل مصدر 2017
لا ملخص تعديل
وسم: تعديل مصدر 2017
سطر 20:
فهل من المستغرب أن لغة سي هي لغة شائعة؟
 
مثل تساقط الدومينو، يتبع الجيل القادم من البرامج اتجاه أسلافه. تحتوي أنظمة التشغيل المُصممة في لغة سي دائمًا على مكتبات نظام مُصممة في لغة سي. تُستخدم مكتبات النظام هذه بدورها لإنشاء مكتبات برمجية ذات مستوى أعلى (مثل [[W:أوبن جي إل|أوبن جي إل]]، أو [[W:جتك|جتك]])، وغالبًا ما يقرر مصممو هذه المكتبات استخدام اللغة التي تستخدمها المكتبات البرمجية للنظام حيث يستخدم مطورو التطبيقات المكتبات عالية المستوى لتصميم برامج معالجة الكلمات والألعاب ومشغلات الوسائط وما شابه. سيختار الكثير منهم البرمجة باللغة التي تستخدمها المكتبة البرمجية من المستوى الأعلى، وهكذا يستمر النمط مرارًا وتكرارًا...
Like toppling dominoes, the next generation of programs follows the trend of its ancestors. Operating systems designed in C always have system libraries designed in C. Those system libraries are in turn used to create higher-level libraries (like [[Wikipedia:OpenGL|OpenGL]], or [[Wikipedia:GTK|GTK]]), and the designers of those libraries often decide to use the language the system libraries used. Application developers use the higher-level libraries to design word processors, games, media players and the like. Many of them will choose to program in the language that the higher-level library uses. And the pattern continues on and on and on...
 
بالرغم من ذلك، يمكن أن يكون تعلم لغة المُجمع ممتعًا وجديرًا بالاهتمام لأنه يمكن أن يمنحك فهمًا عميقًا لكيفية عمل جهاز الحاسوب الخاص في المستويات المنخفضة جدًا. وسيساعدك تعلم لغة المُجمع بالتأكيد على أن تصبح مبرمجًا أكثر مهارة بلغة سي، ولذلك نحن نُشجعك على تعلم لغة المُجمع بكل الطرق الممُكنة، ولكن عندما يحين وقت القيام بعمل حقيقي، سترغب بالتأكيد في إنجازه باستخدام لغة سي.
That said, learning assembly can be fun and worthwhile because it can give you a deep understanding of how your computer works at very low levels. And learning assembly will definitely help you become a more skilled C programmer. So, by all means, we encourage you learn assembly, but when it comes time to do real work, you'll definitely want to get it done with C.
 
=== لماذا اللغة سي وليس لغة أخرى؟ ===
 
الغرض من التصميم الأساسي للغة سي هو إنتاج كود محمول مع الحفاظ على الأداء وتقليل البصمة بقدر الإمكان ([[W:وقت الحوسبة|وقت الحوسبة]]، إستخدام [[W:ذاكرة حاسوب|ذاكرة الحاسوب]]، عمليات القرص الصلب، إلخ.). هذا الأمر مفيد [[W:نظام تشغيل|لنظم التشغيل]] أو [[W:نظام مضمن|الأنظمة المدمجة]] أو غيرها من البرامج التي يكون للأداء فيها أهمية كبيرة (حيث وجود الواجهة “عالية المستوى" ستؤثر على الأداء). باستخدام لغة سي، من السهل نسبيًا الاحتفاظ بصورة ذهنية لما يفعله سطر معين حقًا، لأن معظم الأشياء مكتوبة بشكل صريح في الكود. تحتوي لغة سي على قاعدة بيانات كبيرة للتطبيقات منخفضة المستوى. وهي اللغة "الأم" لنظام [[w:يونكس|يونكس]]، مما يجعلها مرنة ومحمولة. لغة سي مستقرة وناضجة ومن غير المرجح أن تختفي لفترة طويلة وقد تم نقلها إلى معظم إن لم يكن كل المنصات.
The primary design of C is to produce portable code while maintaining performance and minimizing footprint ([[Wikipedia:CPU time|CPU time]], [[Wikipedia:Computer memory|memory]] usage, disk I/O, etc.). This is useful for [[Wikipedia:Operating systems|operating systems]], [[Wikipedia:Embedded systems|embedded systems]] or other programs where performance matters a lot (“high-level” interface would affect performance). With C it’s relatively easy to keep a mental picture of what a given line really does, because most of the things are written explicitly in the code. C has a big codebase for low level applications. It is the “native” language of [[w:Unix|UNIX]], which makes it flexible and portable. It is a stable and mature language which is unlikely to disappear for a long time and has been ported to most, if not all, platforms.
 
أحد الأسباب القوية هو تخصيص الذاكرة. على عكس معظم لغات البرمجة ، تسمح لغة سي للمبرمج بالكتابة مباشرة على الذاكرة. تم تصميم التركيبات الرئيسية في لغة سي مثل الهياكل والمؤشرات والمصفوفات لبناء الذاكرة ومعالجتها بطريقة فعالة ومستقلة عن الآلة. بشكل مخصوص، تمنحك لغة سي إمكانية التحكم في تخطيط الذاكرة لهياكل البيانات. علاوة على ذلك، يخضع تخصيص الذاكرة الديناميكي لسيطرة المبرمج (مما يعني أيضًا أن إلغاء تخصيص الذاكرة يجب أن يتم بواسطة المبرمج). اللغات مثل [[W:جافا (لغة برمجة)|جافا]] و[[w:بيرل|بيرل]] تُعفي المبرمج من الحاجة إلى إدارة معظم تفاصيل تخصيص الذاكرة والمؤشرات (باستثناء [[w:تسرب الذاكرة|تسرب الذاكرة]] وبعض الأشكال الأخرى من الإستخدام المفرط للذاكرة). يمكن أن يكون هذا مفيدًا لأن التعامل مع تخصيص الذاكرة عند إنشاء برنامج عالي المستوى عملية معرضة بشكل كبير للخطأ. ومع ذلك، عند التعامل مع كود منخفض المستوى مثل جزء من نظام التشغيل الذي يتحكم في الجهاز، توفر لغة سي واجهة موحدة ونظيفة. هذه الإمكانيات غير موجودة في معظم اللغات الأخرى.
One powerful reason is memory allocation. Unlike most programming languages, C allows the programmer to write directly to memory. Key constructs in C such as structs, pointers and arrays are designed to structure and manipulate memory in an efficient, machine-independent fashion. In particular, C gives control over the memory layout of data structures. Moreover dynamic memory allocation is under the control of the programmer (which also means that memory deallocation has to be done by the programmer). Languages like [[Wikipedia:Java (programming language)|Java]] and Perl shield the programmer from having to manage most details of memory allocation and pointers (except for [[w:Memory leak|memory leaks]] and some other forms of excess memory usage). This can be useful since dealing with memory allocation when building a high-level program is a highly error-prone process. However, when dealing with low-level code such as the part of the OS that controls a device, C provides a uniform, clean interface. These capabilities just do not exist in most other languages.
 
في حين أن اللغات البرمجية '''بيرل''' و'''بي إتش بي''' و'''بايثون''' و'''روبي''' قد تكون قوية وتدعم العديد من الميزات التي لا يتم توفيرها افتراضيًا في لغة سي، إلا أنها لا تُطبَّق عادةً بلغتها الخاصة. بدلاً من ذلك، اعتمدت معظم هذه اللغات في البداية على كتابتها بلغة سي (أو لغة برمجة أخرى عالية الأداء)، وستتطلب نقل تنفيذها إلى نظام أساسي جديد قبل استخدامها.
While Perl, PHP, Python and Ruby may be powerful and support many features not provided by default in C, they are not normally implemented in their own language. Rather, most such languages initially relied on being written in C (or another high-performance programming language), and would require their implementation be ported to a new platform before they can be used.
 
كما هو الحال مع جميع لغات البرمجة، فإن ما إذا كنت ترغب في اختيار لغة سي على لغة أخرى عالية المستوى هو مسألة رأي ويمكن أن تُحدد المتطلبات الفنية والتجارية اللغة المطلوبة.
As with all programming languages, whether you want to choose C over another high-level language is a matter of opinion and both technical and business requirements could dictate which language is required.
 
{{تحرك}}