الجمعة، 31 ديسمبر 2010

لغة برمجة عربية تعليمية: بعض الاعتراضات والرد عليها

الاعتراضات
  • الموضوع مجرد قواعد وتركيبات؛ لا يوجد فارق فكري بين 'if' و 'إذا' أو 'while' و 'طالما'.
  • لو صنعنا لغة برمجة عربية ستكون ركيكة وغير منسجمة.
  • نريد أن نعلم المبتدئين لغة يستطيعون أن يتوظفوا بها مثل ++C أو Java أو #C...الخ، وهذه كلها انجليزية.
  • كيف سيتابع المبرمج أحدث التطورات التكنولوجية أو يشارك في البحث العلمي بدون أن يعرف الإنجليزية؟
الردود

الموضوع مجرد قواعد وتركيبات؛ لا يوجد فارق فكري بين 'if' و 'إذا' أو 'while' و 'طالما'.

الكلمات لها معنى وليست مجرد صور رياضية. المبرمج الناطق بالانجليزية لديه فرصه ليربط بين كلمة function وفكرة الدالة الرياضية، بين كلمة class وبين فكرة التصنيفات أو الفصائل، بين كلمة structure وفكرة التركيب العام أو البنْية.

أما المبرمج الذي لا يعرف الانجليزية ستكون الكلمات بالنسبة له رموز صماء يعرفها كما هي. ما هي كلمة class؟ هي كلمة تكتبها في البرنامج عندما تريد كذا، وينطبق الأمر على سائر المصطلحات.

الشيء الآخر أنه حتى هذه الكلمات الصغيرة ستعوق الكثير من أفراد المجتمع عن المشاركة. ماذا عن الصغار الذين لا يكتبون بالانجليزية بعد ويحتاجون لحفظ هذه المصطلحات كشرط لتعلم البرمجة؟ لماذا نضع أمامهم عائقاً إضافياً؟

نحن نريد أن يشارك المجتمع كله في التقدم العلمي، بدءاً من الأستاذ الجامعي وانتهاءاً بطفل القرية، ولو جعلنا نسبة بسيطة من دارسي الانجليزية هم فقط الذين يشاركون فسيساعد هذا على أن يكون موقفنا العلميّ -احم- مثل ما نحن فيه الآن.

لو صنعنا لغة برمجة عربية فستكون ركيكة وغير منسجمة

أمتأكد من ذلك؟ انظر لهذا البرنامج في لغة كلمات (على سبيل المثال) من مثال افتراضي عن لعبة طائرات:

قل لي بصدق..ألا يُفهَم هذا البرنامج بمجرد قراءته، حتى لو لم تعرف اللغة أصلا؟ :)

نريد أن نعلم المبتدئين لغة يستطيعون أن يتوظفوا بها مثل ++C أو Java أو #C...الخ، وهذه كلها انجليزية.

وما نقترحه يسهل لهم طريق التوظيف، بأن نفكك لهم عملية التعلم من خطوة واحدة كبيرة (تعلم الانجليزية والبرمجة معا) إلى خطوتين كل منهما مستقلة عن الأخرى ويمكن للمبتديء أن يتعلم كل منهما في الوقت المناسب لإمكانياته.

ثم أنه لو تعلم الفرد البرمجة جيداً بلغته الأم وتشرب مبادئها فليس من العسير بعد ذلك أن يتعلم أن 'فصيلة' معناها 'class' أو أن 'تعبير' معناه 'expression'...الخ لو أراد الانتقال للغة مبنية على الإنجليزية.

وعلى المدى الطويل، لو انتشرت البرمجة في المجتمع فسنجد بإذن الله أجيالاً جديدة من لغات البرمجة العربية الاحترافية التي يمكن إنجاز الأعمال بها في المؤسسات.

كيف سيتابع المبرمج أحدث التطورات التكنولوجية أو يشارك في البحث العلمي بدون أن يعرف الإنجليزية؟

فلندعهم يتعلمون البرمجة أولا ثم ننظر للتطورات والبحث العلمي! نحن الآن أمام موقفين محتملين في المجتمع:

الموقف الأول:
  • نسبة قليلة من المجتمع تعرف الإنجليزية
  • نسبة من هؤلاء تهتم بالبرمجة
  • نسبة من تلك النسبة من نسبة تتابع الأبحاث العلمية
الموقف الثاني:
  • المجتمع كله يعرف العربية
  • نسبة منه تهتم بالبرمجة
  • نسبة من هؤلاء تتابع الأبحاث العلمية، وقد تجاوزوا عقبة كبيرة (البرمجة) وبقت عقبة عادية (الانجليزية)
قل لي الآن أي هذين الموقفين تفضل.

الخميس، 30 ديسمبر 2010

Computer Science and great products

Do you need a good knowledge of computer science to make a great product? It certainly depends on what you're trying to do, but an important point is that the more CS you know the more enabled you are to make useful and impressive software.

The rest of this blog post is a case study in how CS is being used to shape my homegrown programming language for children, كلمات.

First the obvious: It would not have been made without knowledge of compilers. We got that out of the way.

Another thing is that it runs on a small virtual machine called (appropriately) SmallVM. Basically it's a program that reads assembly-like instructions and executes them. Do you know the "basic computer assembler/emulator" sometimes given in computer architecture courses? It's like the big brother of that :)

SmallVM doesn't just run instructions though; it also knows about classes and objects and has a garbage collector. That means it required knowledge about language runtimes in general.

Notice that currently the language runs programs at an acceptable speed. If I want programs to run really fast I need to go deeper: Compiler optimizations, better garbage collection, and perhaps modern VM tricks like polymorphic inline caches.

Do you know that with these techniques a language like Java or C# can reach performance comparable to C++? I hope that I or someone after me learns from those techniques and further improves on Kalimat/SmallVM.

All of this has been about the current version of the language, what about future versions? Here are some ideas I'm thinking about and how computer science can help...

Future idea #1: Gradual typing.

Currently Kalimat is dynamically typed. This means that a variable can take values of any type in the language, and obviously there are no type declarations. This is an example of a program that uses dynamic typing:


Notice how (a) There are no type declarations for the parameters or return value and (b) The program accepts any array of objects as long as each object has a method called نتيجته.

Now I've been thinking: If a child learns my language and afterwards wants to "graduate" into something like C++ ...etc then type declarations and static typing would be new to him or her, but on the other hand if I change Kalimat to require type declarations then it will be harder to teach it to children since the program will require type declarations everywhere, and those will (a) Need explaining (b) Need more syntax memorization and (c) Distract from the actual programming ideas like loops...etc

So the solution? Gradual typing! It means that the language is dynamically typed as usual but with optional static typing. When you declare the type of a variable the compiler will enforce it; otherwise the variable is dynamically typed.

If I decide to implement this feature, I imagine a future version of Kalimat where children would learn programming without being confused by types, and then at some future learning stage they would be introduced to type declarations, watch how the language checks for type errors, and see autocomplete at work!

Future idea #2: GUI programming.

Kalimat currently supports simple graphics like lines and rectangles, but in a future version I hope it supports GUI elements like Forms, Buttons, Textboxes...etc

It would be possible to copy the current event handling models of e.g C#, but I want to take seriously the idea of "a children's programming language". GUI programming is sometimes confusing even for college students! If there's a model that can make it simpler then I should do what I can to seek and use that model.

Again, computer science comes to help! There is a model for parallel programming called CSP, or Communicating Sequential Processes. It started from work by Tony Hoare (the same guy who invented quicksort) and it lead to many implementations and languages. It is also related to the actor model used in languages like Erlang.

So, a couple of days ago I read a paper about how to use CSP to greatly simplify GUI programming. To understand how this works I need to explain a little about the CSP model. Also my explanation is not 100% correspondent to the content of the paper (the idea was further developed in future papers, the paper itself is not current. Also my explanation is simplified).

Imagine that a program is composed of several processes that run independently. To communicate with each other they use a special type of object called a channel. There are two operations associated with a channel:

1- x = receive(ch) ; Which waits until data is available on the channel then returns it in x.

2- send(x, ch); Which waits until some process is ready to receive from the channel and then sends the data in x.

There is also a special command, spawn(p1, p2,...) that launches several processes in parallel.

Now we can talk about GUIs. Suppose we have a graphics application that can be used to draw lines and triangles. If we can assign a channel to each event then we can do this:

Finally we will launch both processes in the main function:


To implement something like this in a traditional GUI library you would need a lot of code in several places. If you studied design patterns you could use the state pattern, for example, to organize your code. But with CSP you write GUI code the same way you think about it. To draw a line you receive two points and join them together. Simple as that.

Now imagine if all this was part of Kalimat.. it would be an Arabic children's programming language that has an easier GUI library than the default library of most modern professional languages!

We need a lot of computer science to implement such a feature. How will we run the processes? Do we use multi-threading and rely on the operating system to schedule the work; or do we modify SmallVM to make it run several processes concurrently and write our own scheduler? Does that mean we will need to revisit what we learned in the operating systems course? :D

Finally

What I want to say in this article is...I'm grateful for all what I've learned in FCIS, without which I wouldn't have been the programmer I am today, that's one thing.

The other thing, and this is important, is that it took me a lot of years learning computer science topics to know all of this. It doesn't have to be about programming languages: Any CS topic; be it operating systems, computer vision, AI, or anything else can open the doors to great products. Products you can use to make money, or improve society, or move science further. But it will take years of hard work and learning.

Why not start now?

الثلاثاء، 21 ديسمبر 2010

Can your C++ do this?





The command وكل إلى is used to invoke tail calls. In the current language implementation it means "remove the current function's activation record from the call stack before calling the new function".

I'm still deciding if I'm going to keep this feature in the final version of Kalimat or not :)

الاثنين، 6 ديسمبر 2010

ابتسامات الكترونية جديدة :)

الابتسامة
المعنى

"مقموص"

مندهش

متأمل

متأمل ولديه نمش

ديناصور سعيد

ديناصور سعيد ولديه شامة في وجهه

الأحد، 14 نوفمبر 2010

خطط وأهداف: جهاز أوراق

This is an article about a tablet computer model for the future: Awraq.

We all know the importance of paper. We also know the importance of computers.

Paper records our thoughts and designs and ideas and dreams. I forget a lot; so I surround my work environment with pens and copybooks everywhere. Designs, sketches, sample code in imagined programming languages, stories...

How about computers? They are a magnifying glass for our thoughts. They give us a way to make the conceptual become real. To make our designs seen and heard.

Sometimes a computer can be better paper than paper itself: in addition to recording your idea the computer can let you search it and categorize it and share it and email it. In other areas paper is clearly the better choice:
  • It's available everywhere; you can take it to bed or in a small bag or wherever.
  • It's more durable, with no hard disk crashes or data corruption.
  • You can easily combine sketching with writing; you can layout the information in anyway with ultimate freedom.
  • It's easier to use :)
Apple's iPad tries to solve some of those problems: it's much more portable and easier to use. It's name even is related to "a pad of paper". It is certainly a sign of progress. However, one crucial thing is missing: A pen.

The iPad uses an on-screen keyboard for text entry. This is good for casual writing or typing up an email message, but it makes the iPad mainly an information consumption device and not an information production device. I think it would be better for all of society if there was an easy way for anyone to write and sketch and think. Something that changes the way we make information the way the iPad changed how people consume it.

Also, I want this device to be intrinsically Arabic-based, to recognize Arabic handwriting (which lends itself more to being written with a pen), to have an Arabic GUI, and to be usable by Arabic children and mothers and families. To be the next stage of the development started by the old Sakhr home computers.

I imagine a future where أوراق is the school textbook and copybook and blackboard. I imagine a sketch-based programming language so you can sit and code anywhere (I'm currently designing such a language). I imagine simulations where students use multitouch to run science experiments and geometry constructions. Don't you want to live in that future?


How realistic is this idea? Surprisingly the hardware manufacturing isn't the hardest part of it; given enough funding and availability of good partners, it might be a solvable problem. The real problem that worries me however is software:
  • Arabic handwriting recognition
  • The touch-based and gesture-based user interface
  • An operating system that works well given the hardware and battery limitations
  • Good OS security to avoid the problems of viruses and spyware in current PCs
  • Sketch-based programming, sketch-based design, sketch-based everything :)
  • Data indexing and organization, a new electronic book experience, a natural language user interface, or many other future research points...
So in summary, we need many geniuses in many fields like compilers, pattern recognition, operating systems, graphics, embedded systems...

If only we had faculties that were created for such topics! Hmm....

And if only we can push the students of this faculty to reach much higher levels of knowledge...

If we would create new tools to make this job easier.

These are my goals, إن شاء الله.

الأربعاء، 10 نوفمبر 2010

خطط وأهداف: مركز التفكير الحوسبي

ما هي أهدافي؟

الموضوع هو أنه هناك دافعان يحركانني.

1) كثيرا ما أتتني أفكارٌ تكنولوجية مثيرة للإعجاب. أريد أن اصنع لنفسي ولغيري بيئة لتنفيذ هذه الأفكار والاستفادة منها ماديا وعلميا.
2) مللت الفجوة بيننا وبين الغرب، علميا واقتصاديا و...و...--هذه الفجوة سلاح دائما يوجّه ضدنا. كم مرة ستدفع الأمة ثمن تخلفها العلمي؟ كم مرة سيحتلونا وينهبوا ثرواتنا؟ ألم يأت وقت سد هذه الفجوة؟ ألم يأت وقت النهضة؟

هل تسمح الظروف الحالية بالتخطيط لهذين الهدفين؟ هل يمكن حاليا السعي لتنفيذ الهدف الأول، ناهيك عن الثاني؟

أجل إن شاء الله. أعتقد أن لديّ خططاً.

لا أريد أن أسمّيها احلاماً. كلمة "أحلام" توحي بأنها صعبة أو أننا مسموح لنا فقط أن نتخيلها. هذه ليست احلاماً: هذه خطط. خطط كبيرة، نعم، لكنها ليست بالخيالية.

تعال نتكلم عن الأطفال (كما افعل كثيرا!)...

الخطوة الأولى هي مركز لبحث تعليم البرمجة. نعم هناك مركزان في مصر حاليا لتعليم الأطفال البرمجة، لكنهما ليسا ما أريد: هذان المركزان يستخدمان التكنولوجيا الحالية للتعليم، بينما أريد أنا صنع تكنولوجيا مستقبلية كما يلي:

في ظاهره يكون المركز هو مركز تدريب عادي، لكن في داخله هو مركز أبحاث أبوابه مفتوحة لطلبة الماجستير والدكتوراه في مجالات علوم الحاسب والعلوم التربوية معا. هؤلاء الباحثون يجرون تجارب ذات منهج علمي ويطورون طرق جديدة لتأليف الكتب ولغات برمجة جديدة وبيئات لاكتشاف الcomputer science.

أفكر في لغات كثيرة نصية ورسومية. افكر في برنامج يرسم اوتوماتيكيا قصصا متحركة تعبّر عن تنفيذ الcode التي تكتبها. افكر في compiler شفاف يجعلك ترى مراحل الcompilation مرحلة وراء أخرى (بالمناسبة، حلمت ذات مرّة بحائط من زجاج عليه code، ثم تسير خلال هذا الحائط للحائط الذي وراؤه فترى الparse tree، ثم الحائط الذي وراء ذلك عليه الassembly code...وهكذا).

ماذا لو طوّر هؤلاء الباحثون طريقة عامة لتعليم الأطفال البرمجة؟ طريقة عامة معناها تعليم البرمجة لكل الناس-- مثلما يتعلمون الآن الجبر او حساب المثلثات-- ليس للأذكيار فقط ولا العباقرة، بل للجميع (وإن تفاوَت استيعابهم بالطبع). ماذا قد يحدث وقتها؟

حينها يمكن الكلام عن اضافة البرمجة كمنهج للتعليم الأساسي. ويمكن تدريب كادر جديد من المعلّمين-المبرمجين ليقوموا بالتدريس. يمكن تدريب هذه الكوادر في العالم العربي كله وليس مصر وحدها. يمكن أن يكون العالم الإسلامي من أوائل من يمحون "أميّة البرمجة" لا فقط "أميّة الكمبيوتر".

وإذا تعلّم الطلبة البرمجة في المدارس فقد يخرج منهم ...

- عالِم الحديث الذي يستخدم الgraph theory كأداة في دراسة هذا العلم.
- المهندس الذي يصمم سيارة تكاد تكون حاسوب اكثر منها مركبة-- وكلما حدّثت الsoftware صار لها امكانات اكثر.
- استيعاب لموضوع الefficiency كما يصفه علم الalgorithm analysis، ولغة يمكن الحديث بها عن كفاءة الأنشطة الصناعية والبشرية حيثما يمكن تطبيق هذا العلم.

وكيف نفكر في العالم من حولنا؟ إنّك لتنظر للأشياء من حولك فتجدها يمثلها tree أو graph أو list أو stack أو queue. ويجب أن يكون الكل عالما بأنه هناك ادوات جاهزة ومدروسة لتحليل هذه التركيبات والتعامل معها.

هل سيفعل هذا المركز شيئا غير اكتشاف طريقة عامة لتعليم البرمجة؟ من يعلم؟

نحن لا نعرف إلى أين سيأخذنا هذا الطريق. ربما يحتاج الأمر الى تطوير فكرة التعلم بشكل عام. ربما نفهم أشياءا جديدة عن البرمجة، أو التعليم، أو الأطفال، أو حتى --ربما-- طريقة عمل العقل البشري.

هذه هي أحد الخطوات الأولى في الخطة. وإنّي أتمنى أن أراها بإذن الله تحدث.

الأحد، 31 أكتوبر 2010

Two new open source projects: QPeg and LogoArabic

I've been coding for a while!

During and after the previous Eid, I created two new projects:

LogoArabic

The first is LogoArabic: An interpreter for an Arabized version of the well-known LOGO programming language, as a part of my project for teaching children programming. I was reading an old childhood book called "تعلم مع صخر لوغو", and wished there was a way to run the book's examples for new-generation kids. Now there's a way! (almost...my syntax is similar but not identical to the Sakhr Logo syntax. But the differences are small).

The code is available now on Google code: http://code.google.com/p/logoarabic/

QPeg

The second project is QPeg: a parser generator for PEG grammars...I'll explain:

You give it a grammar (a way to describe language syntax) and it will produce C++ or Java code, this produced code in turn will try to parse (or recognize) its input according to the grammar.

To learn more about PEG grammars you can visit here.

Again, the source for this project is on Google code: http://code.google.com/p/qpeg/

Want to participate?

Both projects are still in their starting phases, so there might be a chance for external contributors to join early before the projects get more complex!

Both are written in C++ and use the QT library (and are worked on with QT Creator instead of Visual C++). If people are interested I could post documentation and design documents on the project's web site. Perhaps I could also meet interested participants or have a "dissect-a-project" session (remember "dissect-a-project" from my post about the new ACM?).

If you don't want to participate, I hope you still enjoy the projects :)

الأربعاء، 27 أكتوبر 2010

!بلاغة

أحب التشبيه كما تحب القطط السمك.
وأركب الاستعارة فتنطلق بي للمعنى الذي أريد.
وتعلو الابتسامة وجهي حين استخدم الكناية.
ويفرح قلمي حين أكتب عن المجاز المرسل.
واستمتع باستخدام التضادّ، قلّ هذا الاستخدام أو كثُر.
وأخيراً، من منا لا يحب الإستفهام ذا الغرض البلاغيّ؟

الثلاثاء، 19 أكتوبر 2010

Proposal for a new-style FCIS ACM chapter

As some of you know, I have long-term plans of creating a software company, إن شاء الله.

The question is: Where to get great programmers to work there?

What's a great programmer anyway? What types of programmers am I looking for? Think of someone who has some (not necessarily all) of those capabilities:

- Knows enough to create a basic computer vision application.
- Can write a compiler for a small but useful language in a couple of days.
- Can learn a new platform (say a mobile platform) in a short time.
- Invents his own tools to help with projects (e.g code generators, data editors such as level editors in games, verifiers...).
- Understands design trade-offs and the needs for real-world applications.
- Can mix concepts from different disciplines (e.g use techniques from AI when writing a database application).
- ...etc

The reader might now ask: Why do I want such a level of programmers? Does the market need anything like that at all? Well, my plan is to change the market a little. I have big ideas for creative hardware and software applications, many of which I hope are monetizable. Some of them are for internal markets (Egyptian, Arab...) and some for the international market. I should talk more later those projects. Some of their names may be familiar to readers who know me:
- Arwa
- Kalimat
- Awraq
- Kitty
- SketchCode
- Ideaz
- SenseWiki
- ...etc

Isn't this the dream of every computer-science student or graduate? A company where the valuable science they've learned is applied, improved and monetized? A place where you get paid for doing the things you love, and yet produce useful tools for society?

In order to have a chance at doing this, إن شاء الله , many things are needed: I need funding, good strategic planning, and more. But one of the things I'd need most is the existence of a growing number of smart, talented, capable programmers . The existence of those programmers is a major deciding factor for all of this.

How to establish a pool of talent then? Long-term I hope social changes help with this (like teaching children programming). Short-term we need to look at existing students and graduates and help them grow as programmers.

(Are you growing as a programmer?)

Now my opinion on the current FCIS ACM chapter activities. Before I go on I have to say two important things:

1- The ACMers have worked hard to organize competitions and educate students. Many of them have spent long hours of their own time helping others and expecting nothing in return. I'm not trying to discredit their hard work. I think it's clear that they deserve appreciation.

2- I'm not opposing their strategies for the sake of mere opposition. I've talked about these issues with several members of the organization. I think we all have the same goals for the faculty and society in general.

Now..criticism time :-) :-) :-)

1- The current ACM activities make students focus too much on algorithmic problem-solving and almost nothing else. Eventually there's a limit to the usefulness of repeatedly practicing the same topics over and over. After a while you learn nothing new.

2- Then there's no creation involved... The main aim of the competition is to give correct output for a given input. Real-world programming isn't like that. When creating a real product almost nothing is fixed in advance and you need to think hard about features, trade-offs, system constraints and user-interaction.

3- The training focuses almost exclusively on C++ console applications. This is a very small part of the development world. Again, real development has a very diverse ecosystem: Mobile applications, web apps, embedded systems, games, developer tools, scientific applications...etc. All these need a multitude of tools, techniques and languages.

4- The training talks a lot about "Computer science", "Math" and the like yet it only focuses on one aspect of CS and Math ignoring all other important aspects. This could give students the false idea that CS is only about algorithms.

5- ...Even then, the (few small) observations I've noticed make me think algorithms are not really taught in-depth. "Some lessons about graphs and dynamic programming" != "algorithms".

True, the ACMers make the occasional educational sessions or other activities but for me the real goal is achieved when people grow enough as programmers to reach and exceed the level I described at the beginning of this article. Success is when programmers are able to help with the kind of applications I described, for the kind of companies I described. (Yes, I said companies, I hope my own company helps set a wave of change in the local market).

I've talked with some ACM members and leaders and described a proposal for improving the organization. Here's some more details:

The new, new ACM

My proposal for the new ACM is all about changing the focus from one aspect (problem solving competitions) to other suggested aspects:

Creation
Students should train on creating real, working applications and not just idealized programming examples.

Diversity
Students should learn a variety of tools and languages, be capable of creating more than one type of application, and get good introductions to the various fields of computer science.

Depth
Students should have the opportunity of, and be helped with, getting deeper into the subjects that fit with their interests, both scientific and technical.


Activities

Here's a sample of suggested activities that could be made in the new ACM:

Events:-

Hackathons: Where students gather in labs (like in competitions) but instead have 2-3 hours to create a small, useful application. Like a game or a web tool.

Special topic weeks like "software engineering week", "game programming week", "programming language week", where several speakers interested in the same topic can all give presentations about the different sides of that topic.

Minimalist presentation days where several speakers can give sessions, but each session is very focused (say 15 or 20 minutes) so the speakers will have to really concentrate on what's important. And at the same time allow the audience to view many presentations without feeling tired.

Research days where TAs and other researchers can speak about their research and discuss their scientific interests with the audience.

Projects:-

Ongoing open-source projects where fresh members regularly join and learn from experienced members. I think the 2010 summer of code was a real important step forwards in this direction.

Dissect-a-project where a presenter takes some project (open source or developed by the presenter) and explains how it was designed and implemented, with a focus on how design decisions were made, how implementation problem were solved, techniques used, and the like.

Knowledge repositories: An online site where summaries, tutorials and example programs are regularly added and modified. Perhaps also a place to collect technical knowledge from the forum, blogs...etc. Perhaps in the long-term books could be authored that way.

Activities:-

Book rings where (say) five readers take five books, and each reader reads his book then passes it to the next 'element' in the ring.

Sessions of knowledge (مجالس علم) would be like mini-sessions where learners can exchange knowledge, discuss a book, plan for projects...etc

I'm sure that with some brainstorming more and more ideas could be found.

Moving forward

While this discussion is already going with existing ACM members/leaders, I decided to put this article on my blog for several reasons:
  • I wanted to raise awareness of the need for creation, diversity, and depth.
  • I wanted older ACMers (many of whom are outside Egypt) to know about these suggestions and join the discussion if they want.
  • I wanted a stable reference where my ideas are organized, written-down and publicly available.
If something stops improving, it stagnates. I think it's time to take FCIS programming activities (and perhaps the local software market) to the next stage.

الأحد، 12 سبتمبر 2010

الصورة أكبر مما تبدو عليه

هذا برنامج مكتوب بلغة Logo:
لكن مفسر الLogo نفسه مكتوب هنا بلغة كلمات
...ولغة كلمات مكتوبة بال++C


الأحد، 4 أبريل 2010

بيئة حية متكاملة

في طفولتي كان عندي كمبيوتر صخر. وكانت تلك الأجهزة تملأ الدنيا في سائر بلاد الوطن العربي. جهاز صنعته شركة ياماها، مبنيّ على نظام MSX، معرّبٌ يفهم لغتي. قبل "الكمبيوتر الشخصي" كان هناك "الكمبيوتر المنزلي".

الجهاز فيه لغة برمجة جاهزة. افتح الكمبيوتر، انتظر، اضغط زر "4"، صرت في بيئة البرمجة! أدّى هذا إلى ظهور جيل من المبرمجين في سن العاشرة فما فوق. لم تكن هناك كليات الحاسبات ولم يكونوا يعرفون انه هناك وظيفة اسمها "مبرمج" يقوم بها محترف يأخذ أجراً. اطفال وجدوا اللغة أمامهم فبرمجوا. هكذا بكل بساطة. انا نفسي لم اكن اعتبر نفسي مبرمجا شديد التمكن وقتها، كنت اكتب برامج عادية بينما غيري يكتب العابا كاملة.

الشركة العربية التي قدمت هذا الكمبيوتر لم تكتف بالجهاز فحسب، لكنها قدمت أيضا برامج بعضها تعليمي وبعضها ترفيهي وبعضها احترافي. من هذه البرامج كانت لغة Basic معرّبة اسمها "صخر Basic". لم استخدم أنا هذه اللغة وتعلمت على لغة الBasic الأنجليزية، لكن ثاني لغة برمجة تعلمتها كانت لغة Logo المعرّبة هي الأخرى. كم مرة كتبتُ فيها هذه الكود يا ترى؟:

يا مربع
كرر ٤ [امام ٥٠ يمين ٩٠]
نهاية

نشرت الشركة أيضا كتبا برمجية عديدة للأطفال. منها كتب أجنبية مترجمة ومنها إنتاج عربي.

لم تكن الشركة منتجة كمبيوتر صخر هي اللاعب الوحيد في هذا المضمار. من ناحية الأجهزة كان هناك الكومودور والسنكلير والتكساس وغيرهم. وفي مجال النشر كان هناك دور نشر كثيرة تنتج كتبا في البرمجة في مختلف الدول العربية. بعضها مترجم، بعضها إنتاج عربي أصيل. وكثيرها بجودة عالية جدا. كانت هناك أيضا مجلة اسمها "ميكرو" -أظنها كانت لبنانية- تقدم برامجا على صفحاتها وأبواب تعليمية وركن للقراء ليرسلوا برامجهم التي تنشرها المجلة. كان باقي القراء يكتبون هذه البرامج بأيديهم سطرا سطرا لينفذوها بعد ذلك. لا اظن مجلة ميكرو المجلة الوحيدة، بل غالبا كان هناك الكثير غيرها.

الذي اريد أن اقوله من كل هذا أن البرمجة لم تكن نشاطاً فردياً بل ظاهرة اجتماعية: موردو الأجهزة، الناشرون، الأطفال، المجلات كلهم يكوّنون بيئة حية متكاملة (ecosystem)، كل منهم له ما يقدمه وما يستفيد منه. هذا يبيع، وهذا يكتب، وهذا يرسل برامجه لبريد القراء. الكل مستفيد. الكل رابح.

لو اشتريت جهازاً حديثاً عليه الWindows فكيف ستبرمجه؟ برنامج الpaint واضح مكانه. برنامج الكتابة كذلك. لكن أين لغة البرمجة؟ أين الكتب؟ بل نحن الآن مستهلكون للتكنولوجيا لا صانعون لها. لم تنقرض حركة البرمجة في الصغر تماما؛ لن اتعجب مثلا لو رأيت مبرمج عربي في الرابعة عشرة يبرمج visual basic أو PHP الآن، لكن لم يعد الموقف كما كان.

أريد بإذن الله إعادة إنشاء تلك البيئة الحية المتكاملة. أريد لغات برمجة عربية، أريد كتبا في كل شيء: كيف تؤلف برامجك. كيف تحلّ الواجبات المدرسية بالبرمجة. كيف تساعدك البرمجة في إجراء تجارب علمية. كيف تكتب برنامجا يحسب ميزانية المنزل. كيف تطوّع هذا الجهاز لحسابك. كيف تكون صانعا للتكنولوجيا. أريد أن أرى الأطفال يُرِي بعضهم البعض البرامج ويتبادلون الsource code.

على المدى الطويل أتمنى بديلا لكمبيوتر صخر لكن بمقاييس القرن الواحد والعشرين. عربيّ. سلس. رخيص. قويّ. عودة لفكرة الكمبيوتر المنزلي المخصص لأهداف الأسرة وليس فقط الأعمال.

لعل هذه البيئة تعود إن شاء الله. قديما كان شعار كمبيوتر صخر هو "يجعل التعلم متعة". وإني لأراه شعارا جديرا بالتمسك به.

الأحد، 14 مارس 2010

المقامة البرمجية

إنما البرمجة تفصيل المبهم وتنظيم الذي لا يُنظّم. البرنامج امتداد لفكرك واللغة أداتك؛ فاشحذ فكرك فالكمبيوتر لن يؤلف شيئا بدلا منك، وأتقن لغتك فالكمبيوتر لن يقرأ أفكارك. اعرف لغات متعددة تتفتح الطرق لك، ولا تتحيز للغة دون الأخرى. فكر في مواءمة اللغة للهدف الذي بين يديك، ولا تضيع وقتا في جدل عن لغة مقابل غيرها، وتذكر: إن هي إلا أدوات تعمل بها.

البرمجة أسسها رياضية وتطبيقاتها عملية – فقدّر هذين الجانبين واهتم بهما، واستمتع بما تعمل واعمل ما تنفع به الناس، ولا تتوقف عن التعلم ولا تدع تخرجا ولا توظفا يمنعك من معرفة أو يخبرك أنك قد اكتفيت من العلم.

البرامج خطط ثابتة تنفيذها عمليات سائرة. اعرف العلاقة بين تكوين البرنامج وبين سلوك العمليات الذي تتبع منه تصبحْ برامجك بين يديك، وافتح عينيك لما تراه يتكرر أمامك، وسرعان ما تجد مفاهيم كنت تظنها مختلفة قد صارت واحدا، وما كان مجسما قد صار مجردا.

ليس كل الناس مبرمجين ولم يبلغ كل المبرمجين علمك، فكن صبورا لمن لم يفهم لك قصدا ولا تتكبر على من يقلّ عنك علما، واعلم أن البرامج للبشر ليقرؤوها كما هي للآلة لتنفـّذها فاكتب برامجك لتُقرأ قبل أن تكتبها لتُنفـّذ، وليكن أول قاريء تراعيه هو أنت.

لا تجعل العمل يحطمك واهتم بصحتك، لا تقضِ الساعات الطوال جالسا بلا راحة واصنع بيئة عمل تعينك واحجز وقتا كافيا لنومك. تعلم علوما غير البرمجة تجد نفسك مبرمجا أفضل، ولو قابلت خطأ لا حل له اترك الكمبيوتر برهة لعلك تُلْهَم الحل، وتذكر أن البرمجة تفكير لا كتابة فأحيانا تفكر جديا وأنت بعيد عن الجهاز وتفكيرك عمل.

البرمجة تفاهم بين بشر وآلة وبين بشر وبشر، فتعلّم كيف تتكلم يسرِ الحال كما أردت، وتعلم كيف تكتب تتحقق أهدافك، واعلم أن أهم أداة للإقناع أن تكون على حق أولا، وإن وجدت خطأ في قولك فلا تعاند فيه. وإن كنت لا تعلم فقل "لا أعلم" ولا تدّعِ علما ليس لك.

سألتني فأجبتك على قدر ما أعلم، وما لا أعلم أكثر وأعظم.

(انتهت المقامة البرمجية، شكراً لعمر عثمان على مراجعتها والأقتراحات القيمة التي قدمها)