It's Complicated

In a recent episode of Rationally Speaking, Samuel Arbesman, a complexity scientist, talks about complexity in technology. Here’s a few quotes I particularly enjoyed.

On levels of understanding of systems:

Technology very broadly is becoming more and more complicated … actually so complex that no one, whether you’re an expert or otherwise, fully understands these things … They have enormous number of parts that are all interacting in highly nonlinear ways that are subject to emerging phenomena.

We’re going to have bugs and glitches and failures. And if we think we understand these things well and we don’t, there’s going to be tons of gap between how we think we understand the system and how it actually does behave.

On modelling reality with a system and then creating a model of that system:

… the world is messy and complex. Therefore, often, in order to capture all that messiness and complexity, you need a system that effectively is often of equal level of messiness and complexity … whether or not it’s explicitly including all the rules and exceptions and kind of the edge cases, or a system that learns these kinds of things in some sort of probabilistic, counterintuitive manner.

It might be hard to understand all the logic in [a] machine learning system, but it still captures a lot of that messiness. I think you can see the situation where in machine learning, the learning algorithm might be fairly understandable. But then the end result … You might be able to say, theoretically, I can step through the mathematical logic in each individual piece of the resulting system, but effectively there’s no way to really understand what’s going on.

On “physics” and “biological” thinking:

[Physics:] A simple set of equations explains a whole host of phenomena. So you write some equations to explain gravity, and it can explain everything from the orbits, the planets, the nature of the tides …  It has this incredibly explanatory power. It might not explain every detail, but it maybe it could explain the vast majority of what’s going on within a system. That’s the physics. The physics thinking approach, abstracting away details, deals with some very powerful insights.

[Biology:] Which is the recognition that oftentimes … the details not only are fun and enjoyable to focus on, but they’re also extremely important. They might even actually make up the majority of the kinds of behavior that the system can exhibit. Therefore, if you sweep away the details and you try to create this abstracted notion of the system, you’re actually missing the majority of what is going on.

Oftentimes I think people in their haste to understand technology … because technologies are engineered things … think of them as perhaps being more the physics thinking side of the spectrum.

On robustness:

There’s this idea within complexity science … “robust yet fragile,” and the idea behind this is that a lot of these very complex systems are highly robust. They’ve been tested thoroughly. They had a lot of edge cases and exceptions built in and baked into the system. They’re robust to an enormously large set of things but oftentimes, they’re only the set of things that have been anticipated by the engineers. However, they’re actually quite fragile to the unanticipated situations.

Side note: I don’t think there’s an attempt in this discussion to draw a distinction between complex and complicated, which some do.
Image: https://flic.kr/p/Q2tMz

Giving 'Back

The Test team book club at Linguamatics is currently reading What Did You Say? The Art of Giving and Receiving Feedback. Here’s a couple of quotes that I picked out for our last session:

  • If you’re really interested in helping people, you’ll do well to start your feedback by opening your own motives to inspection.
  • Even when it’s given at the receiver’s request, feedback describes the giver more than the receiver.
  • When the data and their model don’t match, most people discard the data.

I recall an instance when, engaged in discussion with a colleague I’ll call Russell, about the data analysis he was presenting, I spotted an opportunity to offer feedback. It was about something that I knew Russell wanted to change. It was about something that I knew was open to me to give feedback on, because we had talked about it. It was about something that I thought would be beneficial for Russell in multiple ways and, I hoped, would provide some insight into a particular behaviour pattern that he had.

However, it was also the first time that I had seen this particular thing. A data set of size one. I had no evidence, yet, that it would lead to the end point that Russell desired to alter. A data set of size zero.

Against this: my instinct, my gut, and my experience. And a sense of goodwill, built up over time, over repeated interactions, over sometimes difficult sessions where I had tried to demonstrate that I do care to assist and support and advise because I want to help Russell to be the best he can be, in the respects that matter to him and for his work.

But I was still cautious. I have unwittingly burned and been burned enough times over the years to know that each of these conversations carries with it risks. Risks of misreading the context, risks of misreading the agreements, risks of misreading the mood, risks, risks, risks, …

But I went ahead anyway. The potential benefit and the goodwill in the bank outweighed the risks, I calculated, on this occasion. And I gave my feedback. And Russell agreed with me. And I breathed a deep internal sigh of relief.

Comparing this anecdote to the quotes I pulled from the book:

  • My motives, I think, were good: I wanted to help Russell achieve a personal goal.
  • But the feedback does reflect something about me: an interest in reducing unnecessary complexity, an interest in making presentation clear, the ego that is required to believe that my colleagues will want to listen to any advice from me, …
  • In this case, it turned out my suggestion didn’t contradict Russell’s model but exposed it, and in any case I had little concrete data to present.

I use this episode as an example not because it ended well, particularly, but because it’s an illustration for me of how much I have been influenced by What Did You Say? in the couple of years since I first read it. I consciously I go about my day-to-day business, doing my best to be careful about when I choose to offer feedback, about when I deliberately choose not to, and about picking up and picking up on any feedback that’s coming my way in return.

I try to treat this as a testing task where I can, in the sense that I try hard to observe my own actions and the responses they generate, and I think about ways in which they might be related and how I might approach things differently in the next exchange, or at another time, with this person, or someone else.

Easier said than done, of course, so I’ll finish with another quote from the book, another quote that I’ve taken to heart and act on, that regularly helps guide me with pretty much everything that I’ve said above:

Don’t concentrate on giving feedback; concentrate on being congruent – responding to the other person, to yourself, and to the here-and-now situation. Don’t go around hunting for opportunities to give feedback, because feedback is effective only when the need arises naturally out of congruent interactions.

Some details have been changed.
Image: Leanpub

לרכוב בלי גלגלי עזר Riding without training wheels

(English first, as this is also a response to a source whose owner probably does not speak Hebrew)

I’m assuming you have at least heard of Gem Hill’s podcast let’s talk about tests baby and if you didn’t, go and listen to a few episodes – they are short and I usually find them interesting.  I’ve listened to the episode on using selenium IDE. It just so happens that on the same day I’ve listened to it, I also attended a local selenium meetup (which, in case you live in Israel, or just happen to be in the neighborhood when one is occurring, can be found here) and after the meetup a few of us grabbed a cup of coffee (tea in my case) and continued to chat for a bit. One of the subjects that came up during this chat was about record and playback tools. If you’ve read this post you can probably guess that I feel very strongly against this kind of tools.
Listening to Gem’s podcast, I noted that I was listening to the rare occasion where the person using selenium IDE1 is doing it properly with the right goals in mind – create a base, use the recording to flesh out some crude scaffolding quickly and then go and fix the generated code. Then, after the chat I had following the meetup, I thought about it a bit more, and realized I don’t like selenium IDE even when it’s used responsibly (Though, if I understood correctly, Gem’s done it right – use once or twice to bootstrap the code, then defenestrate).
Why? Because it’s like riding with training wheels.
When I was young, like all of the kids around my age, I had a bicycle with training wheels, and I rode them around. At some point, came the time for me to remove them, and my father spent several hours running behind me, holding the bicycle rack and releasing it when I wasn’t noticing. If you’ve been anywhere near bicycles lately, you probably know that the new fashion on teaching kinds to ride is by having them ride a balance bike – the reason is simple: When using training wheels the kid might get used to using the pedals and the breaks, but will miss the most important thing – learning to self balance on the bicycle. You also acquire some bad habits you will need to get rid of when you’ll later learn to properly ride a bike (for instance, the way you turn around is completely different). Finally,  removing the training wheels is quite scary.

The same is true for using selenium IDE – it helps you do something that looks a lot like writing an automated check, and using it you are able to get some results that are (at least at the beginning) better than not using it, but by using it, you are missing the central skill that is required to write decent automated checks – which is the ability to think in algorithms and organize code in a reasonable way.  And just like training wheels, it can be very scary to let go of it. Worse – using it as a learning tool leads to learning some bad habits – such as having each script live in it’s own world, initialize everything for itself and so on. In fact, if we were to convert a recorded script to fit into a proper test infrastructure, not a single line of code will remain – initialization and teardown code will be in the superclass, every selenium code will be in the page-objects, and chances are that even page-objects will be hidden beneath another abstraction level. A bad habit that is a bit harder to shrug off is that by using Selenium IDE we are getting used to try and mimic human actions with our automation and completely ignore the fact that humans and computers are different – and things that are easy for a human being are sometimes difficult, or impossible, for a computer – and vice versa. In addition, recorded scripts are usually quite meaningless in terms of what they actually validate.

So, what should we do? To answer that I want to go back to my bicycle example – How do I like to teach riding a bicycle? I got to do that several times in the past – teaching my cousins, and a couple of friends closer to my age that managed to grow up without learning to ride. What I did was to start from the running point, but instead of holding the bicycle from behind, I run side by side with them, holding them by the shoulder and balancing them until they start doing that themselves. It takes about two hours of doing that before they can ride without my help, and then we go on to the more complicated parts of getting on and off the bike. All in all, after four hours of training, we can ride side by side for a short trip. An equivalent behavior will be learning with a mentor – strong style pairing seems to fit well this image, assuming that there is some basic coding knowledge to begin with (otherwise, focusing on at least some basic coding skills should be the first thing to learn). Lacking a mentor around, I guess you could start by copying some template of “how to write a selenium test in language X” from an online tutorial (there are dozens of them). Though, if you don’t have a mentor available to help you, feel free to send me a message (there should be a “contact me” form on the left, or you could leave here a comment) and I’ll try to help you getting started – though if you are using a language I’m not familiar with, my help will be limited.



1 Just one note – I use here “selenium IDE” quite often, but if you are actually using selenium IDE, you might want to check out “Selenium Builder”, since IDE is planned to reach end-of-life for at least 3 years now. ↩



———————————–
אני מניח שמי שקורא כאן מכיר את הפודקאסט של ג’ם היל let’s talk about tests baby, ואם לא – לכו להקשיב לכמה פרקים. הם קצרים, ואני חושב שרובם מעניינים למדי ונעימים להקשבה. האזנתי לפרק ה&#148
8;חרון שהתעסק בשימוש בסלניום IDE, ולגמרי במקרה, באותו היום גם השתתפתי במיטאפ סלניום בארץ (אם טרם הגעתם לאחד – למה?). אחרי המפגש נשארנו (לא כולם) לדבר קצת על כוס קפה, ואיכשהו גם כאן השיחה הגיעה לדבר גם על סלניוםIDE. אם יצא לכם לקרוא את הפוסט הזה אתם יודעים מה דעתי על כלי הקלטה. 
תוך כדי הקשבה לפרק, שמתי לב שבאופן שנדיר להיתקל בו, ג’ם משתמשת בסלניום IDE1 בצורה נכונה – היא מקליטה בסיס כלשהו, מייצאת אותו לקוד, ואז עורכת אותו אחרי שיש לה שלד ראשוני, והיא מודעת לחלוטין לכך שזה רק כלי זמני לצורכי לימוד. אבל, אחרי השיחה בערב הבנתי שאני מתנגד אפילו לשימוש הזה בכלי הקלטה. 
למה? כי זה כמו לרכוב על אופניים עם גלגלי עזר. 
כשהייתי ילד היו לי, כמו לכל הילדים בסביבה, אופניים עם גלגלי עזר שאפשרו לי לרכוב מסביב בעצמי. בשלב כזה או אחר הגיע הזמן להוריד את גלגלי העזר ואבא שלי בילה כמה שעות טובות בריצה אחרי כשהוא מחזיק את הסבל ומשחרר אותו בכל הזדמנות בה לא שמתי לב. אם יוצא לכם להסתובב בקרב חובבי אופניים אתם כבר יודעים שהטרנד היום הוא ללמד ילדים בעזרת אופני הליכה. הסיבה לאופנה הזו פשוטה – כשלומדים לרכוב עם גלגלי עזר לומדים להתרגל לרעיון של דיווש, אולי גם מחזקים שרירים מתאימים, אבל מחמיצים לחלוטין את הכישור המרכזי שנדרש ברכיבה על אופניים – היכולת לאזן את הגוף בזמן רכיבה. בנוסף, גם רוכשים כמה הרגלים מהם יהיה צורך להיפטר בהמשך (למשל, הצורה בה פונים בעזרת הכידון על אופניים עם גלגלי עזר שונה לחלוטין מאשר ברכיבה רגילה). וכמובן – זה מפחיד להסיר את גלגלי העזר.
אותו ה&
#1491;בר נכון לגבי סלניום IDE – הקלטה עוזרת לכתוב משהו שנראה כמו בדיקה אוטומטית, והתוצאות שמשיגים בעזרת הכלי הזה עדיפות (לפחות בתחילת הדרך) על התוצאות שניתן להשיג בלעדיו. אבל שימוש בכלי הזה מדלג על הכישור הכי חשוב כדי ליצור בדיקות אוטומטיות  – היכולת לחשוב על אלגוריתם ולארגן קוד בצורה פחות או יותר הגיונית. בדיוק כמו גלגלי עזר, גם על סלניום IDE מפחיד לוותר, וגרוע יותר – רוכשים כמה הרגלים מגונים דרך שימוש בכלי הזה, כמו למשל העובדה שכל סקריפט מוקלט מבצע את פעולות האתחול בעצמו וחי בעולם משלו במקום שקוד האתחול ישב במקום אחד מסודר. למעשה, אם ממירים קוד מוקלט לתוך פרוייקט בו התשתיות מסודרות היטב, לא תישאר שורה אחת מתוך הסקריפט המקורי – קוד האתחול והניקיון אחרי הבדיקה יהיו במחלקה ממנה יורשת מחלקת הבדיקה, קוד סלניום יעבור לתוך page-objects (שבעצמם יהיו חבויים בתוך שכבת אבסטרקציה) ומהבדיקה המקורית לא נשאר כבר כלום. הרגל מגונה שקשה יותר להיפטר ממנו הוא שכלי הקלטה נוטים להרגיל אותנו לחקות פעולות משתמש בעזרת הקוד שלנו ולהתעלם מכך שיש דברים שנכון יותר לעשות אחרת בעזרת מחשב. חוץ מזה, בדיקות שנכתבות בעזרת כלי הקלטה נוטות להיות שטחיות וחסרות שיניים בהשוואה לבדיקות שנכתבו ע”י קוד ויכולות להסתכל על דברים שקורים מחוץ לדפדפן (כמו למשל מסד הנתונים).

אז, מה עושים? לבד זה מפחיד, וגלגלי עזר הם לא פתרון טוב.
כדי לענות על זה אני רוצה לחזור למשל האופניים, ולספר איך אני מלמד לרכוב (אני לא עושה את זה באופן מקצועי במיוחד, אבל יצא לי ללמד כמה בני דודים בגיל הנכון, וכמה חברים בני גילי שהצליחו לגדול בלי ללמוד &#15
00;רכוב) – אנחנו מתחילים קודם כל מהשלב בו אני רץ לידם (לא מאחור, ליד) ומחזיק אותם בכתפיים כדי לאזן אותם עד שיוכלו לעשות את זה בעצמם. בערך אחרי שעתיים הם מגיעים לנקודה בה הם מסוגלים לרכוב בלעדי, ואז אפשר להתחיל לטפל בנקודות הקשות יותר של לעלות על האופניים ולרדת מהם. בסך הכל, אחרי כארבע שעות (על פני שני מפגשים) אנחנו כבר מסוגלים לרכוב יחד לטיול קצר. המקבילה של זה בעולם התכנות היא עבודה עם מדריך אישי, והרעיון של strong style pairing נראה לי מתאים במיוחד, אם יש ידע כלשהו בתכנות שאפשר לבנות עליו. אם אין ידע כזה, אגב, לרכוש אותו יהיה הצעד הראשון שצריך לעשות בכל מקרה – אין משמעות לשימוש בכלי הקלטה לצורכי לימוד אם אי אפשר להבין את התוצרים של הכלי הזה מספיק כדי לשפר אותם. בהיעדר מדריך זמין, אני מניח שאפשר להסתכל על אחד המדריכים ל”איך לכתוב סלניום בשפה X” באינטרנט (יש לא מעט מהם בחוץ, ואני מחבב את האתר של יוני פלנר שמכיל מדריכים בלא מעט שפות תכנות). אבל, אם אין אף אחד שידריך אתכם, אתם מוזמנים להשתמש בטופס הפנייה שנמצא משמאל, או להשאיר כאן הודעה ואשמח לנסות לעזור לכם להתחיל. 



1 אני משתמש בשם סלניום IDE, אבל אם אתם משתמשים בכלי הזה, עשו לעצמכם טובה והעיפו מבט בSelenium builder שאמור להחליף אותו אחרי שהתמיכה בIDE תסתיים, כמו שאומרים שיקרה כבר לפחות שלוש שנים.  ↩