یادداشت‌های شخصی در مورد مهندسی نرم‌افزار

  • یوسف مهرداد بی‌بالان

متن زیر از نوشته‌های فرانسوا شوله (François Chollet) خالق Keras و نویسنده‌ی کتاب Deep Learning with Python در سایت medium با عنوان Notes to Myself on Software Engineering است. چون خیلی آموزنده بود، همه‌ی آن را در اینجا آوردم تا در دفترچه خاطراتم (وبلاگ) ثبت شود. امیدوارم که خواندن آن برای شما هم مفید باشد.

On the Development Process

  1. Code isn’t just meant to be executed. Code is also a means of communication across a team, a way to describe to others the solution to a problem. Readable code is not a nice-to-have, it is a fundamental part of what writing code is about. This involves factoring code clearly, picking self-explanatory variable names, and inserting comments to describe anything that’s implicit.
  2. Ask not what your pull request can do for your next promotion, ask what your pull request can do for your users and your community. Avoid “conspicuous contribution” at all cost. Let no feature be added if it isn’t clearly helping with the purpose of your product.
  3. Taste applies to code, too. Taste is a constraint-satisfaction process regularized by a desire for simplicity. Keep a bias toward simplicity.
  4. It’s okay to say no — just because someone asks for a feature doesn’t mean you should do it. Every feature has a cost that goes beyond the initial implementation: maintenance cost, documentation cost, and cognitive cost for your users. Always ask: Should we really do this? Often, the answer is simply no.
  5. When you say yes to a request for supporting a new use case, remember that literally adding what the user requested is often not the optimal choice. Users are focused on their own specific use case, and you must counter this with a holistic and principled vision of the whole project. Often, the right answer is to extend an existing feature.
  6. Invest in continuous integration and aim for full unit test coverage. Make sure you are in an environment where you can code with confidence; if that isn’t the case, start by focusing on building the right infrastructure.
  7. It’s okay not to plan everything in advance. Try things and see how they turn out. Revert incorrect choices early. Make sure you create an environment where that is possible.
  8. Good software makes hard things easy. Just because a problem looks difficult at first doesn’t mean the solution will have to be complex or hard to use. Too often, engineers go with reflex solutions that introduce undesirable complexity (Let’s use ML! Let’s build an app! Let’s add blockchain!) in situations where a far easier, though maybe less obvious, alternative is available. Before you write any code, make sure your solution of choice cannot be made any simpler. Approach everything from first principles.
  9. Avoid implicit rules. Implicit rules that you find yourself developing should always be made explicit and shared with others or automated. Whenever you find yourself coming up with a recurring, quasi-algorithmic workflow, you should seek to formalize it into a documented process, so that other team members will benefit from the experience. In addition, you should seek to automate in software any part of such a workflow that can be automated (e.g., correctness checks).
  10. The total impact of your choices should be taken into account in the design process, not just the bits you want to focus on — such as revenue or growth. Beyond the metrics you are monitoring, what total impact does your software have on its users, on the world? Are there undesirable side effects that outweigh the value proposition? What can you do to address them while preserving the software’s usefulness?

 

On API Design

  1. Your API has users, thus it has a user experience. In every decision you make, always keep the user in mind. Have empathy for your users, whether they are beginners or experienced developers.
  2. Always seek to minimize the cognitive load imposed on your users in the course of using your API. Automate what can be automated, minimize the actions and choices needed from the user, don’t expose options that are unimportant, design simple and consistent workflows that reflect simple and consistent mental models.
  3. Simple things should be simple, complex things should be possible. Don’t increase the cognitive load of common use cases for the sake of niche use cases, even minimally.
  4. If the cognitive load of a workflow is sufficiently low, it should be possible for a user to go through it from memory (without looking up a tutorial or documentation) after having done it once or twice.
  5. Seek to have an API that matches the mental models of domain experts and practitioners. Someone who has domain experience, but no experience with your API, should be able to intuitively understand your API using minimal documentation, mostly just by looking at a couple of code examples and seeing what objects are available and what their signatures are.
  6. The meaning of an argument should be understandable without having any context about the underlying implementation. Arguments that have to be specified by users should relate to the mental models that the users have about the problem, not to implementation details in your code. An API is all about the problem it solves, not about how the software works in the background.
  7. The most powerful mental models are modular and hierarchical: simple at a high level, yet precise as you need to go into details. In the same way, a good API is modular and hierarchical: easy to approach, yet expressive. There is a balance to strike between having complex signatures on fewer objects, and having more objects with simpler signatures. A good API has a reasonable number of objects, with reasonably simple signatures.
  8. Your API is inevitably a reflection of your implementation choices, in particular your choice of data structures. To achieve an intuitive API, you must choose data structures that naturally fit the domain at hand — that match the mental models of domain experts.
  9. Deliberately design end-to-end workflows, not a set of atomic features. Most developers approach API design by asking: What capabilities should be available? Let’s have configuration options for them. Instead, ask: What are the use cases for this tool? For each use case, what is the optimal sequence of user actions? What’s the easiest API that could support this workflow? Atomic options in your API should answer a clear need that arises in a high-level workflow — they should not be added “because someone might need it.”
  10. Error messages, and in general any feedback provided to a user in the course of interacting with your API, is part of the API. Interactivity and feedback are integral to the user experience. Design your API’s error messages deliberately.
  11. Because code is communication, naming matters — whether naming a project or a variable. Names reflect how you think about a problem. Avoid overly generic names (x, variable, parameter), avoid OverlyLongAndSpecificNamingPatterns, avoid terms that can create unnecessary friction (master, slave), and make sure you are consistent in your naming choices. Naming consistency means both internal naming consistency (don’t call “dim” what is called “axis” in other places) and consistency with established conventions for the problem domain. Before settling on a name, make sure to look up existing names used by domain experts (or other APIs).
  12. Documentation is central to the user experience of your API. It is not an add-on. Invest in high-quality documentation; you will see higher returns than investing in more features.
  13. Show, don’t tell: Your documentation should not talk about how the software works, it should show how to use it. Show code examples for end-to-end workflows; show code examples for each and every common use case and key feature of your API.

 

On Software Careers

  1. Career progress is not how many people you manage, it is how much of an impact you make: the differential between a world with and without your work.
  2. Software development is teamwork; it is about relationships as much as it is about technical ability. Be a good teammate. As you go on your way, stay in touch with people.
  3. Technology is never neutral. If your work has any impact on the world, then this impact has a moral direction. The seemingly innocuous technical choices we make in software products modulate the terms of access to technology, its usage incentives, who will benefit, and who will suffer. Technical choices are also ethical choices. Thus, always be deliberate and explicit about the values you want your choices to support. Design for ethics. Bake your values into your creations. Never think, I’m just building the capability; that in itself is neutral. It is not because the way you build it determines how it will get used.
  4. Self-direction — agency over your work and your circumstances — is the key to life satisfaction. Make sure you grant sufficient self-direction to the people around you, and make sure your career choices result in greater agency for yourself.
  5. Build what the world needs — not just what you wish you had. Too often, technologists live rarefied lives and focus on products catering to their own specific needs. Seek opportunities to broaden your life experience, which will give you better visibility into what the world needs.
  6. When making any choice with long-term repercussions, place your values above short-term self-interest and passing emotions — such as greed or fear. Know what your values are, and let them guide you.
  7. When we find ourselves in a conflict, it’s a good idea to pause to acknowledge our shared values and our shared goals, and remind ourselves that we are, almost certainly, on the same side.
  8. Productivity boils down to high-velocity decision-making and a bias for action. This requires a) good intuition, which comes from experience, so as to make generally correct decisions given partial information, b) a keen awareness of when to move more carefully and wait for more information, because the cost of an incorrect decision would be greater than cost of the delay. The optimal velocity/quality decision-making tradeoff can vary greatly in different environments.
  9. Making decisions faster means you make more decisions over the course of your career, which will give you stronger intuition about the correctness of available options. Experience is key to productivity, and greater productivity will provide you with more experience: a virtuous cycle.
  10. In situations where you are aware that your intuition is lacking, adhere to abstract principles. Build up lists of tried-and-true principles throughout your career. Principles are formalized intuition that generalize to a broader range of situations than raw pattern recognition (which requires direct and extensive experience of similar situations).

Quote:
You can definitely do great work without having to sacrifice other aspects of your life — in fact, in many cases, having a fulfilling life outside of work is a requirement in order to do great work
François Chollet

کلاس درس استاد علی کسمایی و منوچهر اسماعیلی

  • یوسف مهرداد بی‌بالان

برای همه‌ی آنهایی که عاشق یاددادن هستند پیشنهاد می‌کنم گفتگوی اساتید به نام دوبلوی ایران، استاد علی کسمایی و استاد منوچهر اسماعیلی را با دقت ببینند. اگر فرصت کافی ندارید حتما بیست دقیقه ابتدایی و پنج دقیقه‌ی پایانی آن را ببینید. یک استاد، یک شاگرد و یک دنیا درس برای یادگیری.
من از مفصل این نکته مجملی گفتم؛ تو خود حدیث مفصل بخوان ازین مجمل

برای مشاهده ویدیو اینجا کلیک کنید.

بخش‌هایی از صحبت‌های این دو استاد را در ادامه آورده‌ام.

استاد علی کسمایی:
فکر نمی‌کنم من درحدی باشم که این چیزها رو درباره‌ی من بگن. این بزرگواری دوستان من و پاداشی است که به کوشش من در راهنمایی اون‌ها دادن. … و امیدوارم این برنامه‌هایی که برای بزرگداشت من گرفتن، برای نسل بعد از من و نسل‌های بعد از من، این در یادشون باشه که هیچ وقت کوشش اون‌ها در راه راست، در راه درست، فراموش نمی‌شه.

استاد منوچهر اسماعیلی:
یکی از خصیصه‌های ایشون [استاد علی کسمایی] دادن فرصت بود، یاد دادن بود، و یاد دادن که چیزی رو که یاد گرفتی پیش خودت نگه ندار، به دیگری بده. و این باعث ماندگاری نام علی کسمایی و دوبلاژ شد.
[رو به استاد کسمایی] استاد، من حاصل عمر توام.
صدا معرفت می‌خواد. صدا معرفت نداشته باشه، مثل آش رشته می‌مونه!

گزیده:
استاد علی کسمایی در دفتر موزه سینما نوشت: «اینک حاصل زندگی‌ام را، از نوشته‌ها، سروده‌ها، کتاب‌ها، لوح‌های تقدیر، فیلمنامه‌ها، نوارها و … به موزه‌ی سینمای ایران پیشکش می‌کنم، تا از گزند پراکندگی و نابودی در امان باشند و باشد که برای آیندگان به کار آید بر پیشینیان است که‌ با کوشش خستگی ناپذیرتری، این مرزوبوم کهنسال پرافتخار را، آبادتر و توسعه یافته‌تر و افتخار آمیزتر و موزه‌اش را پربارتر به آیندگان پیشکش کنند.» [مرجع]

پ.ن:
از احمدآقای عزیز که این ویدیو را برایم ارسال کردند، بسیار سپاسگزارم.

برنامه‌نویسی دسته‌جمعی (mob programming)

  • یوسف مهرداد بی‌بالان

برنامه‌نویسی دسته‌جمعی رویکردی جدید و جذابی در توسعه سیستم است که تیمی با مربی‌گری وودی زوئیل پیشگام آن است. مفهوم اصلی برنامه‌نویسی دسته‌جمعی ساده است: کل اعضای تیم با هم و ‌هم‌زمان روی یک وظیفه کار می‌کنند. یعنی: یک تیم، یک صفحه کلید (فعال) و یک نمایش‌گر (البته پروژکتور). درست مثل این‌که همه‌ی تیم دارند برنامه‌نویسی دونفره انجام می‌دهند.

مرجع: کتاب کانبان کاربردی (Kanban in Action)

شب یلدا و فال حافظ

  • یوسف مهرداد بی‌بالان

کلک مشکین تو روزی که ز ما یاد کند ببرد اجر دو صد بنده که آزاد کند
قاصد منزل سلمی که سلامت بادش چه شود گر به سلامی دل ما شاد کند
امتحان کن که بسی گنج مرادت بدهند گر خرابی چو مرا لطف تو آباد کند
یا رب اندر دل آن خسرو شیرین انداز که به رحمت گذری بر سر فرهاد کند
شاه را به بود از طاعت صدساله و زهد قدر یک ساعته عمری که در او داد کند
حالیا عشوه ناز تو ز بنیادم برد تا دگرباره حکیمانه چه بنیاد کند
گوهر پاک تو از مدحت ما مستغنی‌ست فکر مشاطه چه با حسن خداداد کند
ره نبردیم به مقصود خود اندر شیراز خرم آن روز که حافظ ره بغداد کند

چرخه‌ی پروژه‌های هوش مصنوعی؛ نقش‌های یک تیم هوش مصنوعی، مهارت‌ها و شرح کارها

  • یوسف مهرداد بی‌بالان

شرکت ورکرا (workera) به تازگی کتابچه‌ای منتشر کرده است که در آن به بررسی مراحل پروژه‌های هوش مصنوعی، نقش‌های اعضای یک تیم AI، مهارت‌های مورد انتظار و کارهای آنها پرداخته شده است. این کتابچه برای عزیزانی که به دنبال تعریف نقش و مسیر شغلی خود در دنیای هوش مصنوعی هستند می‌تواند بسیار مفید باشد. از طرف دیگر برای شرکت‌ها و تیم‌هایی هم که به دنبال اجرای پروژه‌های AI هستند، می‌تواند نقش یک مرجع و راهنمای کلان را داشته باشد. امیدوارم که برای خوانندگان عزیز مفید باشد. این کتابچه را می‌توانید از اینجا یا اینجا دریافت کنید.
نکته جالب توجه این کتابچه این است که مقدمه‌ی آن را آقای کیان کتان‌فروش، هم‌بنیانگذار شرکت deeplearning.ai نوشته است. برای ایشان آرزوی موفقیت روزافزون دارم.

Companies everywhere are building AI teams, but it’s still unclear what aspiring machine learning engineers, data scientists, and software engineers should focus on when applying for AI jobs. This report walks you through different types of organization, different roles within them, the tasks you’ll work on, and the skills recruiters are looking for in each role. It is the result of two large-scale studies of the supply of and business demand for AI talent. We’re here to provide mentorship and help you find a job that suits your skills, experience, and aspirations.

CONTENTS

AI organizations
The AI project development lifecycle: Tasks and Skills6
** Overview of the AI project development lifecycle7
** Data Engineering
** Modeling
** Deployment
** Business Analytics
** AI Infrastructure
The roles of an AI team
** Overview
** Data Scientist
** Data Analyst
** Machine Learning Engineer
** Machine Learning Researcher
** Software Engineer – Machine Learning
** Software Engineer
Conclusion

گزیده:
آرتور: تو اینقدر به جایی که باید باشی فکر می‌کنی که یادت می‌ره از جایی که هستی به اندازه کافی لذت ببری.

فیلم Passengers، مرجع: کانال گزیده‌های ماندگار

لیدر یا کاپیتان

  • یوسف مهرداد بی‌بالان

سخنان خوزه مورینیو درباره‌ی تفاوت کاپیتان و لیدر را در ادامه با هم می‌خوانیم.

——————————————————————————————————————————–

زانتی و تری: کاپیتان یا لیدر؟
من کاپیتانهایی داشتم که لیدر نبودند. مردم همه فکر می‌کنند خوب کسی که بازوبند داره، کاپیتانه، پس لیدر هم هست. واقعا این طور نیست! بارها شده که کاپیتان تیم‌ام نتونسته لیدری کنه.

فکر کنم به نکته خوبی اشاره کردید. این دو نفر (خاویر زانتی کاپیتان اینترمیلان و جان تری کاپیتان چلسی) لیدر بودن. وقتی این لیدرها رو در تیم‌تون داشته باشید، بیشتر می‌تونید کار اصلی‌تون یعنی مربی‌گری رو انجام بدید و روی جنبه‌ی مربی‌گری کارتون بیشتر تمرکز کنید.

من یه لیدر در پورتو داشتم: خورخه کاستا.یک بار در یه بازی در برابر تیمی به نام بلاننس داشتیم می‌باختیم و توی نیمه‌ی اول 2-0 عقب بودیم. من داشتم به سمت رختکن می‌رفتم، همه‌ می‌دیدن که از شدت ناراحتی و عصبانیت، دود از کله‌ام بلند می‌شه. وقتی به رختکن رسیدم، خورخه کاستا بهم گفت: لطفا دو دقیقه بیرون وایسید. اون رفت توی رختکن، در رو هم بست، کار سخت رو برای من انجام داد. بعد در رو باز کرد و به من گفت: حالا مربی ما باش. هر کاری که من می‌خواستم در رختکن بکنم رو اون انجام داده بود. آخر بازی تونستیم 2-3 بازی رو ببریم، اون یه مدافع میانی بود، هیچ گلی هم تا اون روز توی زندگیش نزده بود. توی اون بازی دو تا گل زد؛ دو تا گل؛ اصلا توی زندگیش گل نزده بود.

به همین خاطر می‌گم به نکته‌ی خوبی اشاره کردین، کاپیتان بودن و لیدر بودن، واقعا تفاوت زیادی با هم دارن.
لیدرها رو نمی‌شه خرید؛ لیدرها رو نمی‌شه پرورش داد.
وقتی یه دونه‌اش رو داشته باشین، تیم‌تون یک قدم جلوتره.
.اما متاسفانه فوتبال امروز پر از تصویره و ظاهره و مردم بیشتر به اونی که خودش رو نشون می‌ده توجه می‌کنند تا اونی که واقعا توانمنده. بازیکنان زیادی هستند که در رختکن واقعا لیدرن!

مرجع: ورزش سه با اندکی تغییر

 

فرایندکاوی (Process Mining)

  • یوسف مهرداد بی‌بالان

این چند ماه به خاطر انتخاب موضوع دانش‌نامه (تز)، یک سری مقاله و کتاب خواندم تا به این نتیجه رسیدم که بد نیست در چارچوب موضوعی به نام فرایندکاوی، کارهای تحقیقاتی‌ام را پیش ببرم. هر چند تا تعریف دقیق موضوع تحقیق، راه زیادی مانده است ولی به نظر می‌رسد این حوزه، حوزه‌ای باشد که بتوانم روی آن کار کنم.
خلاصه‌ی بسیار کوتاهی از آنچه که در این مدت یاد گرفتم را در اینجا بازگو می‌کنم به این امید که مورد استفاده‌ی علاقه‌مندان قرار گیرد.

تعریف فرایندکاوی:

فرایند کاوی، یک موضوع بین رشته‌ای است. از یک طرف به علم داده (Data Science) مربوط می‌شود چون قرار است از داده‌ها برای فهم و حل مسایل استفاده کند؛ از سوی دیگر به علم فرایند (Process Science) مربوط می‌گردد، چون به بررسی و حل مسائلی در چارچوب فرایندهای کسب‌وکار و به طور کلی فرایندها می‌پردازد. در حقیقت فرایندکاوی پلی است بین علم داده و علم فرایند که سعی دارد دیدگاه فرایندی را به یادگیری ماشین و داده کاوی اضافه کند.

Process mining is an analytical discipline for discovering, monitoring, and improving real processes (i.e., not assumed processes) by extracting knowledge from event logs readily available in today’s information systems. [celonis.com]

تعریف علم داده:

Data science is an interdisciplinary field aiming to turn data (structured or unstructured, big or small, static or streaming) into real value (predictions, automated decisions, models learned from data, or data visualization). [Process Mining book]

تعریف علم فرایند:

Process science is an umbrella term for the broader discipline that combines knowledge from information technology and knowledge from management sciences to improve and run operational processes. [Process Mining book]

مرجع عکس: اینجا

موردهای کاربرد (use case) فرایندکاوی:

در فرایندکاوی موردهای کاربرد فراوانی وجود دارد، اما عمومی‌ترین آنها به شرح زیر است:

  • What is the process that people really follow?
  • Where are the bottlenecks in my process?
  • Where do people (or machines) deviate from the expected or idealized process?
  • What are the “highways” in my process?
  • What factors are influencing a bottleneck?
  • Can we predict problems (delay, deviation, risk, etc.) for running cases?
  • Can we recommend countermeasures?
  • How to redesign the process / organization / machine?

انواع فرایندکاوی:

فرایندکاوی به سه نوع اصلی تقسیم‌بندی می‌شود:

  • Discovery: در اکتشاف، با دریافت رویدادهای ثبت‌شده یا event log (اطلاعات رویدادهایی که در فرایند اتفاق افتاده و ثبت شده‌اند)، مدل فرایند ساخته می‌شود. برای مثال با دریافت اطلاعات رویدادهای ثبت‌شده در فرایند ثبت سفارش کالا، می‌توان مدلی تهیه کرد که نشان دهد این فرایند چگونه انجام می‌شود. این نوع از فرایندکاوی برای شناسایی فرایندهای واقعی کسب‌وکار به کار گرفته می‌شود. به یاد داشته باشید که فرایند اجرایی ممکن است با فرایند طراحی‌شده تفاوت‌ داشته باشد.
  • Conformance: در تطابق‌سنجی (یا یکسان‌سنجی)، مدل موجودِ یک فرایند با رویدادهای ثبت‌شده‌ای که از فرایند واقعی و در حال اجرا وجود دارد مقایسه می‌شود. از این نوع از فرایندکاوی می‌توان برای کارهایی مانند ممیزی فرایندها استفاده کرد.
  • Enhancement: در این نوع از فرایندکاوی، مدل فرایندی موجود با استفاده از اطلاعات دریافتی در رویدادهای ثبت‌شده توسعه یا بهبود پیدا می‌کند.

 

مراجع:
از بین منابع و مراجعی زیادی که در اینترنت در دسترس است، این منابع را بیشتر از بقیه توصیه می‌نمایم.

* Process Mining: Data Science in Action 2nd, Wil M. P. van der Aalst
* Process Mining Course in Coursera.org
* What Process Mining Is, and Why Companies Should Do It (Harvard Business Review)

برای خروج از جستجو کلید ESC را بفشارید