I just did a run-through and I hit 45 minutes exactly, so I'm just going to get started so that you can all have a nice coffee break after this. So chances are that you've heard of refinements, but never used them. The refinements feature has existed as part of Ruby for around five years, first as a patch, and then subsequently as an official part of Ruby since Ruby 2.0. And yet to most of us, it exists only in the background, surrounded by a haze of opinions about how they work, how to use them, and indeed whether or not using them at all is a good idea. I'd like to spend a little time looking at what refinements are, how to use them, and what they can do. But don't get me wrong, this is not a sales pitch for refinements. I'm not going to try and convince you that you should be using refinements and that they're going to solve all your problems. The title of this presentation is Why is Nobody Using Refinements? And that's a genuine question. I don't have all the answers. My only goal is that by the end of this session, both you and I will have a better understanding of what they actually are, what they can actually do, and why they might be useful, when they might be useful, why they've lingered in the background for so long. So let's go. Simply put, refinements are a mechanism to change the behavior of an object in a limited and controlled way. And by change, I mean add new methods or redefine existing methods. And by limited and controlled, I mean that by adding or changing those methods, it does not have an impact on other parts of our software which might interact with the same object. So let's look at a very simple example. Refinements are defined inside a module using the refine method. This method accepts a class, string in this case, and a block which contains all the methods to add to that class when the refinement is used. You can refine as many classes as you want within a module and you can define as many methods as you want within each block. To use a refinement, we call the using method with the name of the enclosing module. And when we do that, all instances of that class, which is string in this case, within the same scope as our using call, will have the refined methods available. Another way of saying this is that the refinement has been activated within that scope. However, any strings outside the scope are left unaffected. Refinements can also change methods that already exist. When the refinement is active, it is used instead of the existing method, although the original is still available via the super keyword, which can be very useful. And anywhere the refinement isn't active, the original method gets called exactly as before. And that's really all there is to refinements. Two new methods, refine and using. However, there are some quirks, and if we want to properly understand refinements, we need to explore them a little bit. And the best way of approaching this is by considering a few more examples. So now we know that we can call the refine method within a module to create refinements, and that is actually all relatively straightforward. But it turns out that when and where you call the using method can have a profound effect on how the refinement behaves with our code. We've seen that invoking using insider class definition works. We activate the refinement, and we can call refined methods on string instances, in this case. We can also move the call to using somewhere outside the class and still use the refine method as before. In the example so far, we've been calling the refine method directly, but we can also use them within methods defined in the class. And again, this also works even if the call to using is outside of the class. But this doesn't work. We cannot call our shout method on the string returned by our method, even though that string object was created within a class where the refinement was activated. And here's another broken example. We've activated the refinement inside our class, but when we reopen the class and try to use the refinement, we get no method error. If we nest a class within another where the refinement is active, it seems to work, but it doesn't work in subclasses unless they're also nested classes. And even though nested classes seem to work, if you try and define them using the double colon or the compact form, the refinements will have disappeared again. And even blocks seem to act a little bit strangely. Our class uses the refinement, but when we pass a block to the method in that class, suddenly it breaks, as if the refinement has disappeared. So what's going on here? For many of us, especially those relatively new to Ruby, this is going to be quite counterintuitive. After all, we're used to being able to reopen classes or share a behavior between super and subclasses, but it seems like that only works intermittently with refinements. It turns out that the key to understanding how and when refinements are available relies on another aspect of how Ruby works, which you may have already heard of and possibly even encountered directly. The key to understanding refinements is understanding about lexical scope. To understand about lexical scope, we need to learn about some of the things that happens when Ruby parses our program. So let's look at that first example again. As Ruby parses the program, it is constantly tracking a handful of things to understand what the meaning of the program is. And exploring all of these in detail would take far more time than I actually have, but for the moment, the one that we're interested in is called the current lexical scope. So let's pretend to be Ruby as we walk through the code and see what happens. When Ruby starts parsing the file, it creates a new structure in memory, a new lexical scope, which holds various bits of information that Ruby uses to track what's happening at that point. When we start processing, we create this initial one and we call that the top-level lexical scope. And when we encounter a class definition or a module definition, as well as creating the class and everything that that involves, Ruby also creates a new lexical scope nested inside the current one. And we can call this lexical scope A just to give it an easy label. It doesn't actually have a name. Visually, it makes sense to show them as nested, but behind the scenes, the relationship is modeled by each scope linking to its parent. So A's parent is the top-level scope and the top-level scope has no parent. As Ruby processes all the code within this class definition, the current scope is now lexical scope A. When we call using, Ruby stores a reference to the refinement within the current lexical scope. We can also say that within lexical scope A, the refinement has been activated. You can now see that there are no activated refinements in the top-level scope, but our shouting refinement is activated for lexical scope A. So next, we can see that the call to the method shout on a string instance. Jay McAvron, who sat there, is gonna talk a lot more about what method dispatch does. But one of the things that happens at this point is that Ruby checks to see if there are any activated refinements in the current lexical scope that might affect this method. And in this case, there is an activated refinement for the shout method on strings, which is exactly what we're calling. So Ruby then looks up the correct method body within the refinement rather than the class and invokes that instead of any existing method. And there, we can see that our refinement is working as we hope. So what about when we try and call the method later? Well, once we leave the class definition, the current lexical scope becomes the top level scope again. And then we find our second string instance with a method being called on it. And once again, when Ruby dispatches for the shout method, it checks the current lexical scope for the presence of any refinements. And in this case, there are none. So Ruby behaves as normal, which is to invoke method missing, which raises an exception and that's why we get our no method error. Now if we are called using shouting outside the class at the top of the file or something like that, we can see that our refine method works both inside and outside the class perfectly. And this is because we're activating the refinement for the top level lexical scope. And once a refinement is activated, for all, it's activated for all nested lexical scopes. So Colty using at the top of the file means that it will work everywhere in that file. And so our call to the refined method in the class works as well as just in the top of the file. So this is our first principle about how refinements work. When we activate a refinement with the using method, that refinement is active in the current and any nested lexical scopes. However, once we leave that scope, the refinement is no longer activated and Ruby behaves just like it did before. So let's look at another example from earlier. Here we define a class and activate the refinement and then later, either somewhere in the same file or in a different file, we reopen the class and try to use it. Now we've already seen that this doesn't work, but the question is why? For watching Ruby build its lexical scopes, again we'll reveal why this is the case. So once again, we have our top level lexical scope and when we encounter the first class definition, Ruby gives us a new nested lexical scope that I'll call A again. And it's within this scope that we activate the refinements. Once we reach the end of the class definition, we return to the top level lexical scope. But when we reopen the class, Ruby creates a nested lexical scope just as it did before, but it's distinct from the previous one. We'll call it B just to make that clear. While the refinement is activated in the first lexical scope, when we reopen the class, we're in a new lexical scope. It's different. It's distinct. And one where the refinements are no longer active. So the second principle is this. Just because the class is the same, doesn't mean you're back in the same lexical scope. And this also is the reason why our example for subclasses didn't behave as we might have expected. So we don't have to pretend to be Ruby anymore and we can just draw these scopes. And it should be clear now that the fact that we're in a subclass actually has no bearing on whether or not the refinement is active. It's entirely determined by lexical scope. Anytime Ruby encounters a class or module definition via the class or module keywords, it creates a new fresh lexical scope, even if that class or module has already been defined somewhere else. And this is also the reason why, even when activated at the top level of a file, refinements only stay activated until the end of that file. Because each file is also processed using a new top level lexical scope. So now we have another two principles about how lexical scope and refinements work. Just as reopened classes have a different scope, so do subclasses. In fact, the class hierarchy has nothing to do with a lexical scope hierarchy. And we also now know that every file is processed with a new top level scope, so refinements activated in one file are not activated in any other files, unless those other files also explicitly activate our refinement. Let's look at one more example. What happened there? There we go. Here, we were activating a refinement within a class, and then defining a method in that class which uses the refinement, and then later we create an instance of the class and then call that method. So we can see that even though the method gets invoked from our top level lexical scope, that's where that call to greet is, a refinement where the refinement is not activated, the refinement still somehow works, and the behavior is what we hoped. So what's going on here? Well, when Ruby processes a method definition, it stores with that method a reference to the current lexical scope at the point the method was defined. So when Ruby processes the greet method definition, it stores a reference to lexical scope A along with it. And then when we call the greet method from anywhere, even in a different file, Ruby evaluates it using the lexical scope that it has associated with it. So when Ruby tries to evaluate hello.shout inside our greet method and tries to dispatch the shout method, it's checking for activated refinements in lexical scope A, even though the method was called from an entirely different lexical scope. We already know that our refinement is active in scope A, and so Ruby can use the method body for shout from the refinement, and it works exactly like we'd hoped. So our fourth principle is this, methods are evaluated using the lexical scope at their definition, no matter where those methods are actually called from. Okay, one more example, I promised just one. A very similar process explains why blocks didn't work. So here's that example again, a method defined in a class where the refinement is activated yields to a block, but when we call that method with a block that uses the refinement, we get our error. So we can quickly see which lexical scopes Ruby has created as it's processed this code. And as before, we have a nested lexical scope that we'll call A and the method defined in our class is associated with it, and A has the refinement active. However, just as methods are associated with the current lexical scope, so are blocks and prox and lambdas and everything like that. When we define the block, the current lexical scope is the top level one. So when the run method yields to the block, Ruby evaluates that block using the top level lexical scope, and so Ruby's method dispatch algorithm finds no active refinements and therefore no shout method. A final principle, blocks and prox and lambdas and so on are evaluated using the lexical scope at their definition too. And with a bit of experimentation, we can also demonstrate to ourselves that even blocks evaluated using tricks like instance eval or class eval or anything like that retain this link to their original lexical scope, even if the value of self might change depending on how you're passing them around. And this link from methods and blocks to a specific lexical scope might seem strange or even confusing right now, but we'll soon see that it's precisely because of this that refinements are so safe to use. But I'll get to that in a minute. For now, let's just recap what we know. Refinements are controlled entirely using lexical scope structures already present in Ruby. You get a new lexical scope anytime you do any of the following, entering a different file, opening a class or module definition, or running code from a string using eval, although I haven't showed any examples of that. And as I said earlier, you might find the principle of lexical scope surprising if you've never really thought about it before, but it's actually a very useful property for a language to have. Because without it, lots of the things that we take for granted about Ruby would be much harder if not impossible. Lexical scope is actually part of how Ruby determines what constant you mean, and it's fundamental to using blocks and prox as closures, for example. We also know how our five basic principles enable us to explain how and why refinements behave the way they do. Once you call using, refinements are activated for the current and any nested lexical scopes. The nested scope hierarchy is entirely distinct from any class hierarchy in your code. Superclasses and subclasses have no impact on refinements at all. Only nested lexical scopes do. Different files get different top-level scopes. So even if we call using at the very top of a file and activate the refinement for all code within that file, the meaning of code in all other files is unchanged. Methods are evaluated using the current lexical scope at the point of definition, so we can call methods that make use of refinements internally, that make use of refinements internally, sorry, from anywhere in the rest of our code base. And finally, blocks are also evaluated using the lexical scope, and so it's impossible for refinements activated elsewhere in our code to change the behavior of blocks, or indeed other methods or any other code written where that refinement wasn't activated. Right, so now you basically know everything there is to know about refinements, but what is it good for? Anything? Maybe nothing. Let's try and find out. Now again, another disclaimer, these are just some ideas, some are more controversial than others, but hopefully they will help frame what refinements might be good for, what they might make more elegant or more robust. Well, the first one is probably not gonna be a surprise, but I think it's worth discussing anyway. Monkey patching is the act of modifying a class or object that we don't own, that we didn't write, basically. And because Ruby has open classes, it's trivial to redefine any method on any class with new or different behavior. The danger that monkey patching brings is that those changes are global. They affect every part of the system as it runs, and as a result it can be very hard to tell which parts of our software will be affected. If we change the behavior of an existing method to suit one use, there's a good chance that some distant part of the code base, hidden somewhere in rails or something like that, is going to call that method expecting the original behavior, or even worse, its own monkey patch behavior, and things are gonna get messy. So say I'm writing some code in a gem, and as part of that I want to be able to turn an underscored string into a camelized version. I might decide, oh, the easiest thing to do would be to reopen the string class and just add this method. It's innocent looking and it looks like it works. That's a very simple and quite understandable thing to want to do. But unfortunately, as soon as anyone tries to use my gem, even myself in a Rails application, the test suite is gonna go from passing not to failing, but to exploding entirely. You can see the error at the top there. It's something to do with constant names or something like that. We're looking at the back trace. I don't see anything about camelize, so it doesn't seem very obvious really why what I did seems to have broken this. I really doubt if I was using code from someone else that I would have any idea, and it would probably take me a long time to trace through figuring out what had gone. And this is exactly the problem that Yehuda Katz identified with monkey patching in his blog post about refinements almost exactly five years ago. So monkey patching has two fundamental issues. The first is breaking API expectations. We can see that Rails has some expectation, for example, about the behavior of the camelize method on string, which we obviously broke when we added our own monkey patch. The second is that monkey patching can make it far harder to understand what might be causing unexpected or strange behavior in our software. Refinements in Ruby addresses both of these issues. If we change the behavior of a class using refinement, we know that it cannot affect parts of the software that we don't control, because refinements are restricted by lexical scope. We've already seen that refinements activated in one file are not activated in any other file, even when reopening the same classes. If I wanted to use a version of camelize in my gem, I could define and use it via a refinement, but anywhere that refinement wasn't specifically activated, which won't be anywhere in Rails, for example, the original behavior remains. It's actually impossible to break existing software like Rails using refinements. There's no way to influence the lexical scope associated with code without editing that code itself. And so the only way that we can poke refinement behavior into a gem is by literally finding the source code to that gem and typing into it. This is exactly what I meant by limited and controlled at the start of this presentation. Refinements also make it easier to understand when unexpected behavior, where unexpected behavior may be coming from, because they require an explicit call to using somewhere in the same file as the code that uses that behavior. You know if there's no call to using in a file, we can be confident, assuming that no one else has monkey-patched anything, that there are no refinements active and that Ruby should behave the way that we would expect. Now, this is not to say that it's impossible to create convoluted code, which is tricky to trace or debug. In Ruby, that will always be possible, but if we use refinements, there will always at least be a visual clue that a refinement is activated, so it might be involved. Onto my second example. Sometimes, software we depend on changes its behavior over time, as new versions are released. APIs can change in newer versions of libraries, and even in some cases, the language itself can change. For example, in Ruby 2, the behavior of the charge method on string changed from returning an enumerator to returning an array of single character strings. Imagine we're migrating an application from Ruby 1.9 to Ruby 2 or later, and we discover that some part of our application is relying on this earlier behavior of charge. If some parts of our software rely on it, we can use refinements to preserve the original API without impacting any other code that might have already been adapted to the new API. Here's a simple refinement, which we could activate only for the code, which depends on that Ruby 1.9 behavior, while the rest of the system remains unaffected, and even any dependencies that we bring in now or in the future, we'll be able to use Ruby 2 as they might expect. My third example will hopefully be familiar to most people. One of the major strengths of Ruby is that its flexibility can be used to help us write very expressive code. That's the main reason why I was drawn to Ruby in the first place. In particular, it supports the creation of DSLs, or domain-specific languages, and these are just collections of objects and methods that have been designed to express concepts as closely as possible to the terminology that non-developers might use, and they're often designed to read more like human language than code. Adding methods to core classes can often help make DSLs more readable and expressive, so refinements are a natural candidate for doing this in a way that doesn't leak those methods into other parts of an application. RSpec is a great example of a DSL, in this case, for testing. Until recently, this would have been a typical example of RSpec usage. One hallmark is the emphasis on writing code that reads fluidly, and we can see that demonstrated in the line, developers should be happy, which is valid Ruby, but reads more like English than code. And to enable this, RSpec used monkey-patching to add a should method to all objects. Now recently, RSpec moved away from this DSL, and while I cannot speak for the developers to maintain RSpec, I'm quite confident that part of the reason was that they wanted to avoid monkey-patching in the object class. However, refinements offer a compromise that balances readability of the original API with the integrity of our objects. It's easy to add a should method to all objects in your spec files using a refinement, but this method doesn't leak out into the rest of the code base. Now the compromise is that you must write using RSpec at the top or somewhere in every file, which I don't think is a large price to pay, but you might disagree, and we'll get to that shortly. RSpec isn't the only DSL that's commonly used, and you might not even have thought of it as a DSL. After all, it is just Ruby. You can also view the root's file of a Rails application as a DSL of sorts, or even the query methods of active record, and in fact, the SQL gem actually does optionally provide a mechanism to let you write queries more fluently by adding methods to String and Symbol and a few other classes using refinements so that you don't affect the rest of your code base. The DSLs are everywhere, and refinements can help make them more expressive without resorting to monkey-patching or other brittle techniques, so under my last example, refinements might not just be useful for monkey-patching or implementing DSLs. We might also be able to harness refinements as a kind of design pattern, and use them to ensure that certain methods are only callable from specific, potentially restricted parts of our code base. For example, consider a Rails application with a model that has some sort of dangerous or expensive method on it. By using a refinement, the only places we can call this method are where we've explicitly activated that refinement. From everywhere else, all other normal controllers, views, or other classes, even though they might be handling the same object, even the same instance of that object, the dangerous or expensive method is guaranteed not to be available there. I think this is a really interesting use for refinements as a sort of design pattern rather than monkey-patching, and while I know there could be some obvious objections to that suggestion, and I even have some objections myself, I'm certainly curious to explore it a bit more and decide whether or not it's worthwhile. So those are some examples of things that we might be able to do with refinements. I think they're all potentially very interesting and all potentially very useful. And so finally, to the question that I'm curious about, if refinements can do all of these things in such an elegant, safe way, why aren't we seeing more use of them? It's been five years since they appeared in almost three years since they were an official part of Ruby, and yet when I searched GitHub, almost none of the results are actual uses of refinements. In fact, some of the top hits are actually gems that try to remove refinements from Ruby. You can see in the description, no one knows what problem they solve or how they work. Well, hopefully over the last 25 minutes, we might have tried to address some of that. Now, I asked another one of the speakers from this conference who will remain nameless, what they thought the answer to my question might be. And they said, because they're just bad, as if it was a fact. And my initial reaction to this kind of answer is somewhat emotionally charged, but my actual answer is more like, are they? Why do you think that? So I don't find this answer very satisfying. Why are they bad? I asked them, you know, why do you think that? And they replied, because they're just some other form of monkey patching, right? Well, yes, sort of, but also not really. And just because they might be related in some way to monkey patching, does that automatically make them bad or not worth understanding? I can't shake the feeling that this is the same mode of thinking that leads us to ideas like metaprogramming is too much magic or using single or double courted strings consistently is a very important thing. Or something that something, anything you type into a text editor can be described as awesome when that word should be reserved exclusively for moments in your life like seeing the Grand Canyon for the first time and not when you install the latest gem or anything like that. I am deeply suspicious of awesome. And so I'm also suspicious of bad. I asked another friend if they had any ideas about why people weren't using refinements. And they said, because they're slow. Again, as if it was a fact. And if that were true, that would be totally legitimate. But it's not. If you look at this blog post, which is actually from I think a few weeks ago, someone's done some nice benchmarking and it has almost no difference on the amount of time it takes to dispatch Ruby method calls. So why aren't people using refinements? Why do people have these ideas that they're just slow or plain bad? Is there any actual solid basis for those opinions? As I told you right at the start, I don't have any neatly packaged answer and maybe nobody does. When I proposed this talk, it really was a genuine question. I didn't know that much about refinements and I wanted to know if there was an answer. So here are my best guesses based on tangible evidence and the understanding that we now have about how refinements actually work. While refinements have been around for five years, the refinements you see now are not the same as those that were introduced half a decade ago. Originally, they weren't strictly lexically scoped and while this provides some opportunity for more elegant code, I think not having to write using RSpec at the top of every file, it also breaks the guarantee that refinements cannot affect distant parts of a code base. It's also probably true that lexical scope is not a familiar concept for many Ruby developers. I'm not ashamed to say I've been using Ruby for over 13 years now and it's only recently that I've really understood what lexical scope actually meant. I think you can probably make quite a lot of money writing Rails applications without really caring about lexical scope at all and yet without understanding it, refinements will always seem like confusing and uncontrollable magic. The evolution of refinements hasn't been smooth and I think that's maybe why some people feel like nobody knows how they work or what problem they solve. It doesn't help, for example, that a lot of the blog posts you'll find if you search for refinements in Ruby now are no longer accurate and even the official Ruby documentation is actually wrong. This hasn't been true since Ruby 2.1 but this is what the documentation says right now. It's a nudge to any Ruby core team members. Issue 11681 might fix that if you have a look at it. I think that some of this information rots can explain a little about why refinements have stayed in the background. There were genuine and valid questions about early implementation and design choices and I think it's fair to say that some of those questions maybe took a little bit of the steam out of the new feature as it was being unveiled to the world. But even with all the outdated blog posts, I don't think this entirely explains why no one seems to be using them. So perhaps it's the current implementation that people don't like. Maybe the idea of having to write using everywhere goes against the mantra of dry, let's don't repeat yourself, that we've generally adopted as a community. After all, who wants to remember to have to write using our spec or using SQL or using active support at the top of literally every file? Doesn't sound fun. And this points to another potential reason. A huge number of Ruby developers spend most if not all of their time using Rails. And so Rails has a huge amount of influence over which language features are promoted and adopted by the community. Rails contains perhaps the biggest collection of monkey patches ever in the form of active support, but because it doesn't use refinements, no signal is sent to us as developers that we should or even could be using them. Now you might be starting to form the impression that I don't like Rails, but I'm actually very hesitant to single it out. To be clear, I love Rails. Rails feeds and clothes me and enables me to fly to Texas and meet all y'all wonderful people. The developers who contribute to Rails are also wonderful human beings who deserve a lot of thanks. I also think it's easily possible and perhaps even likely that there's just no way for Rails to use refinements for something at the scale of active support. It's possible. But even more than this, nothing in the Ruby Standard Library even uses refinements. There's no call to refine anywhere in the Ruby Standard Library. Many new language features like keyword arguments and refinements won't see widespread adoption until Rails and the Ruby Standard Library starts to promote them. Now Rails 5 has adopted keyword arguments and so I think we can expect to see them spread to other libraries as a result. But without compelling examples of refinements from the libraries and frameworks that we use every day, there's nothing nunchagous towards really understanding when they're appropriate or not. I said there were a number of quirks with refinements or unexpected gotchas and it could be that that is the reason why no one is using them. For example, even when a refinement is activated and you can call it, you cannot call methods like send or respond to to check whether or not those refinements are activated and you can't also use them in convenient forms like symbol to proc. You can also get into some really weird situations if you try to include a module into a refinement where methods from that module cannot call other methods defined in the same module. But these don't necessarily mean that refinements are broken. All of these are either by design or direct consequences of lexical scoping. Even so, they're unintuitive and it could be the aspects like these are a factor in limiting the ability to use refinements at the scale of something like active support. But as easy as it is for me to stand up here and make logical and rational arguments about why monkey patching is bad and wrong and breaks things, it's impossible to deny that even since the start of this presentation, software written using libraries that relies heavily on monkey patching has made literally millions of dollars. So maybe refinements solve a problem that nobody actually has. Maybe for all the potential problems that monkey patching might bring, the solutions we have for managing those are good enough. Things like test suites. And even if you disagree with that, which I wouldn't blame you for doing, perhaps it points to another reason that's more compelling. Maybe refinements aren't the right solution for the problem of monkey patching. Maybe the right solution is something like object-oriented design. I think it's fair to say that over the last two or three years, the Ruby community has become much more interested in object-oriented design. And you can trace that in the presentations that Sandy Metz, for example, has given or in her book or in discussion of patterns like hexagonal architecture or interactors or presenters and all the gems that have recently appeared that help us use those patterns. The benefit that object-oriented design brings tries to bring to software. Those benefits are important and valuable. Smaller objects with cleaner responsibilities that are easier and faster to test and change. All of this helps us do our jobs more effectively. And anything that does that must be good. And from our perspective today, there's nothing you can do with refinements that you cannot do by introducing a new object or a new method that encapsulates the new or changed behavior. For example, rather than adding a shout method to all strings, we could introduce a new class that only knows about shouting and wrap any strings that we want shouted in instances of this new class. Now, I don't want to discuss whether or not this is actually better than the refinement version, partly because it's obviously trivial. And so it wouldn't be a realistic discussion, but mostly because I think there's a more interesting point. While good object-oriented design brings a lot of tangible benefits to software development, the cost of proper design is robustity. And just as a DSL tries to hide the active programming behind language that appears natural, the introduction of many objects can sometimes make it harder to quickly grasp what the overall intention of code is. And the right balance of explicitness and expressiveness will be different for different teams and for different projects. And not everyone who interacts with software is even a developer, let alone somebody trained in software design. And so not everyone can be expected to easily adopt sophisticated principles with ease. Software is for its users and sometimes the cost of making them deal with extra objects or methods might not be worth the benefit in terms of design purity. It is, like so many things, subjective. Now, to be clear, just like with Rails, I'm not arguing in any way that oh, design is not good. I'm simply wondering that whether or not it being good necessarily means that other approaches should not be considered in some situations. And so these are the six reasonable reasons that I could come up with for why nobody seems to be using refinements. Which is the right answer? I don't know. There's probably no way to know. I think all of these are potentially good defensible reasons why we might have decided collectively to ignore refinements or why we might make a case to remove refinements from Ruby entirely. However, I'm not really sure that any of them are really the answer that most accurately reflects reality. Unfortunately, I think the answer is probably more likely to be closer to the one that we encountered at the very start of our journey is because other people have told us that they are bad. So let me make a confession. When I said this is not a sales pitch for refinements, I really meant it. I'm fully open to the possibility that it might never be a good idea to use them. I think it's unlikely, but it is possible. And to be honest, I don't even really care. I just want to make nice software. But what I do care about though is that we might start to accept and adopt opinions like that feature is bad or this sucks without ever pausing to question them or explore the feature for ourselves. Now, nobody has the time to research everything. And that would not only be unrealistic, but one of the benefits of being in a community is that we can benefit from each other's experiences. We can use our collective experience to learn and improve. And that's definitely a good thing. But if we just accept opinions as facts without ever even asking why, I think this is a bit more dangerous. If nobody ever questioned opinion as fact, then we'd still think that the world was flat. It's only by questioning opinions that we make new discoveries and that we learn for ourselves and that together we make progress as a community.  Nothing is ever that clear cut. There's a great quote by a British journalist and doctor called Ben Goldaker that he uses anytime somebody tries to present something as being starkly good or bad. When he says, I think you'll find it's a little bit more complicated than that.   It's up to us to listen and read critically and then explore for ourselves what we think. I think this is particularly true when it comes to software development. If we hand most, if not all responsibility for that exploration to the relatively small number of people who talk at conferences or who have popular blogs or who tweet a lot or who maintain these very popular projects and frameworks, that's only a very limited perspective compared to the enormous size of the actual Ruby community. I think we have a responsibility not only to ourselves, but also to each other, to our community, not to use Ruby only in the ways that are either implicitly or explicitly promoted to us, but to explore the fringes, to wrestle with new and experimental ideas and features and techniques so that as many different perspectives as possible inform on the question of whether or not this is good. Now, if you'll forgive the pun, there are no constants in programming. The opinions that Rails enshrines, even for great benefit, will change and even the principles of design are only principles. They're not laws that we have to follow blindly for the rest of time. There will be other ways of doing things. Change is inevitable. So we're at the end now. I might not have been able to tell you precisely why so few people seem to be using refinements, but I do have one small request. Please, make a little time to explore Ruby. Maybe you'll discover something simple. Maybe you'll discover something wonderful. And if you do, please share it with everybody. Thank you very much. Does anybody have any questions? Yes. So I'm not really sure what the question was, but I have the question, so what was the history of refinements? So they were inspired by a concept called class boxing from a different language, which effectively does a similar thing and originally proposed as a patch actually at RubyConf 2010. So literally 10 years ago, if RubyConf happened at the same time, the inspiration was to solve monkey patching. And I imagine that was because Rails was really becoming popular at that point. And people were encountering some issues with monkey patching, like the Camelize example actually does come from a real experience that you heard the cast blogged about. So that is the inspiration. The history is quite interesting, but it will take you a long time if you want to read it. There are 278 comments on the Ruby Tracker issue that introduced it over a period of two years, so. The question was in the concept of refactoring. This might be a bit confusing, but I think they're quite separate because you're not really extracting a method from anywhere. It's not like an object is losing a responsibility or something like that. Okay, I think that's the time up now. Thanks very much for your time.


So, before we get started, we should define what is heart disease. So, there are many forms of heart disease, and that includes, you know, the avial dysfunction that includes issues with the heart muscle or the myocardial itself and also includes issues with conduction disease, but the most common cause of heart disease is coronary artery disease. And when we talk about coronary artery disease, we're referring to plaque buildup in the arteries of the heart itself. And so with CAD or coronary artery disease, it's a disease process that develops over time. It takes many years for it to improve. And eventually, what happens is that your heart or the muscle, your heart doesn't get enough nutrient rich flow as a result. And so when we refer to atherosclerosis, we're essentially referring to plaque buildup. And so, as I mentioned before, once you have, once you develop enough plaque, the plaque can obstruct the inner part of the artery of the heart and that restricts blood flow. And ultimately, that can cause the part of the heart that's blocked off to die or to have abnormal rhythm. And so, and this is usually considered coronary or heart artery problem, but it's not only confined to the heart. You know, atherosclerosis is a process that developed throughout the body and all the arteries. So when you pick up stroke, it can involve the arteries supplying to the brain. And when you think of having peripheral vascular disease or circulation issues, it can involve the arteries supplying blood to the legs. And so how do these coronary artery plaques form? And so essentially what happens is that you have the inner lining of the blood vessel, the inner part of it, and once it's damaged, the body attempts to repair this inner lining by essentially causing platelets and other vascular sub-factors to come in and essentially form a scar or a stab over that area to seal it essentially. And what that does is that invites excess plaque or excess cholesterol in the bloodstream, in particular LDL particles or the small cholesterol particles, which then attach to this scarred area. And then this then further recruits other elements in the bloodstream, as far as monophages or white blood cells and inflammatory heart cells, which then layer on top of each other until you ultimately develop this fibro-fatty plaque. And so over time, this plaque buildup approves and gets to become larger and larger. And once the outer portion of that plaque becomes very thin and vulnerable, it can be exposed. And that's the issue, because when it becomes exposed, the body then attacks it, seeing it as a vulnerable site that needs to be repaired, and then ultimately you get an acute blockage. And that can lead to many issues down the line. And so this is a schematic here that essentially outlines what I just described. So you start off with the fatty streak and the inner lining of the artery. In this case, it would be the artery to heart. Over time, those LDL particles or the cholesterol particles buildup, they then recruit other inflammatory cells that are present in the bloodstream to then continue to build up this fibro-fatty plaque. And then ultimately, when you have a very thin wall that's covering this plaque, if that becomes vulnerable or that has an opening, the body sees it as a disruption that needs to be clogged. And so you get this acute platelet buildup. And then that's what leads to heart attacks. And so this is the process that occurs over time, and to cause many acute processes as far as heart attacks, strokes, and limb ischemia, or if you could split both of them. And so why do cholesterol plaques form to begin with? And ultimately, it's a balance between inflammatory markers in the body, as well as your tendency for clot. And this is balanced against your body's ability to naturally thin the blood and also to cause basal dilation or increase of blood flow to an area. And so this balance is disrupted whenever you have any type of processes that increase risk or the amount of inflammation or blood clotting when it's in the body. And these different circumstances include having high glucose or high insulin levels in the blood, because that does increase your inflammatory markers in the body and also makes you more pro-thumbotic or increases your susceptibility to developing clots. And high blood pressure causes high shear stress that tips the balance towards inflammation and blood clotting tendency, smoking as you can imagine. You have toxic substances, which increase inflammation throughout the body and then tips the scales towards developing information. Obesity, which is associated with high cholesterol, high blood pressure, etc. That can also tip the scales and for direction for patients' care and their disease processes. Inactivity, where you have increased basal dilatory properties in the body, which also tips the scale, and we can imagine the seat deprivation. You are essentially having increased stress hormones in the body that also tips the scales in that direction as well. And of course, infection and air pollution that occurs along with the whole thought process of inflammation. So why is this important? So this is important because over time that imbalance that you have in your bloodstream can cause plaque support. And we talked about the mechanism or the way plaque progresses throughout your time in the heart or the arteries throughout the body. And ultimately, it can lead to a heart attack in the case of the arteries supplying the heart and then for the arteries supplying the brain, it can lead to a stroke. And it is this plaque filled up that ultimately leads to heart attacks and death. And so, as you can see here, this is a graph on the y-axis we have death and the x-axis we have a year and you can see that cardiovascular mortality is on the rise for both men and women. So this is something that we need to bring more awareness to as a result. And for women in particular, it is the leading cause of death in the US and worldwide. And so 35% of all deaths in women worldwide are caused by cardiovascular. Okay. 275 women, 275 million women were diagnosed with cardiovascular disease in 2019 and 8.9 million of which died in cardiovascular disease in 2019. When it comes to cardiovascular disease in women, it is understudied, it is under-recognized, it is under-diagnosed, and it is under-treated. And while we know that heart disease is a leading cause of death for both men and women, a gender gap does exist when it comes to diagnosis and treatment. So, for instance, women are more likely than men to die within the first year after a heart attack. And this is due to a multitude of factors, one of which is delayed diagnosis. So, if you have healthcare providers who are less likely to do upfront testing because women may present differently to men when it comes to cardiovascular presentations, that's one way that diagnosis can be delayed, but the other is women themselves. If they aren't aware of the different ways that heart disease can present within women, or just not having, not accepting the fact that they potentially could have a heart problem, even though they haven't had any other issues in the past. And so that can culminate to a delayed diagnosis and ultimately presenting later in your stage of cardiovascular disease than you otherwise would have been had there been a more aggressive intervention. And also for women who are diagnosed with cardiovascular disease, there tend to be less aggressive invasive interventions that are offered. And this is something that we're seeing with more and more research with women who do develop heart attacks. Invasive interventions are not being offered to the same way as men. And they are being prescribed less medications. So, when it comes to aspirin and cholesterol medications and women who are admitted to the hospital for a heart attack, they're not being prescribed it at the same rate as men who have similar cardiac presentations. And also women who after suffering a heart attack are less likely to be referred to cardiac rehab. So as you can see, there are multiple reasons as to why there's a gender gap that does exist in women compared to men. And this has been all explained why women ultimately are more likely to die within the first year after a heart attack compared to men. And despite the increase in awareness over the past several decades, only about a half of women recognize that heart disease is their number one killer. And as we know, heart disease is the leading cause for death for women in the United States. It's killed over 300,000 women in the year 2019 alone, about one in every five deaths in women. And so what attributes to this gap is simply misinformation from commonly held myths. So myth number one, women just don't get heart disease. And we know that not to be true based off the data that I just presented to you before. Because heart disease is the leading killer for women in the United States and throughout the world as well. Myth number two, women are more at risk for breast-reader and ovarian cancer than they are from heart and cardiovascular disease. You also know that to be false as well. So worldwide cardiovascular disease is the single most common cause of death among women. And it's nearly twice as many women in the US die of heart attack, stroke, and other cardiovascular diseases as from all forms of cancer combined. So when you combine breast, uterine, ovarian, and all other, and GI, and women, the rate of death from cardiovascular disease is more than double. Okay. Now myth number three, women are not at risk for a heart attack until after menopause. We know that to be false. In fact, heart disease is the third most common cause of death among women aged 25 to 44. Okay. Myth number four, current research on heart disease applies equally to men and women. We know that to be false based off of recent data that was collected. We know that women only represent 25% of all study participants based off large landmark or randomized people. And myth number five, men and women receive the same treatment for heart disease. And we know that to be false as well. So women are less likely to have an electrocardiogram done within 10 minutes of presenting with potential heart attack symptoms. And they're less likely to be cared for by cardiologists during their admission to the hospital or through their presentation to the emergency. And although we know that women have the standard risk factors that men have, hypertension, high cholesterol, obesity, smoking and unhealthy diet. There are also other sex specific risk factors that make women or increase women's risk for heart disease when compared to men. And this includes premature menopause. We know typically estrogen itself will be cardiovascular when it comes to developing cardiac disease. And so if you undergo premature menopause, you're not having, you're having less years of added protective benefit compared to women who don't have premature menopause. Gestational diabetes associated with cardiovascular disease after pregnancy and also high blood pressure. Okay, hypertensive disorders of pregnancy. So when it comes to the clamps, the clamps here are just gestational hypertension. All of those particular risk factors can increase your risk of developing cardiovascular disease as a subsequent date later on. PCOS or body system are very simple. That particular disease process increases your risk of developing heart disease, diabetes, high blood pressure, high cholesterol. And those particular risk factors, as you all know, are one of the leading causes of cardiovascular or actual death. And throughout the audience at the body when it comes to developing cardiovascular exactly in the future. And then also systemic inflammatory and autoimmune disorders. So when it comes to rheumatoid arthritis, when it comes to lupus, when it comes to APLS. These particular disorders are more frequently developed for women compared to men. It's about a two to one ratio. And a member from what I mentioned before, that is that balance between the blood stream of inflammatory and pro thrombotic factors balanced against the blood thinning factors in the blood. And so if you're tipping the scales towards increased inflammation, you're going to put yourself at a higher risk of developing accelerated atherosclerosis. And in addition, there are other under recognized risk factors that are all that often fall under the stress related category. So women, as you know, are more prone to experiencing abuse and intimate partner violence, psychosocial factors. And when it comes to health literature, not having that same access to educational opportunities throughout the world compared to men. And all of these factors which increase stress hormones throughout the body, which ultimately influence that hormone that the inflammatory balance throughout the body does increase your risk as well, compared to men. The other thing I actually now listed here is breast cancer. So if you have women who have a higher risk of breast cancer, not only the cancer itself with this information, but the treatment for the cancer, all can increase the risk. And so these are all the specific risk factors that make women just as likely to find more like men to develop cardiovascular disease and that's undirected. So when we talk about coronary artery disease or CAD, we break it down to two main categories. Stable CAD or unstable. And when we were discussing stable CAD, what we're referring to is plaque that's pretty stable, that's causing a blockage, and it's leading to symptoms, but it's reproducible in the sense that you can do the same activity and cause it to occur and know that you stop that activity that would go away worse than patients that they have any type of emotional distress that can provoke their symptoms to develop. But then once you remove yourself from that particular situation, then the symptoms go away. And that's considered stable CAD. It's when you really can't determine or anticipate when your symptoms will develop. It just happens out of the blue. It can happen at rest, it can happen when you're sleeping, it can happen when you're sitting there and watching TV. And it's something where the symptoms last for more than 15 minutes. It's not a brief injury because that's something that you can turn on and turn off. And that's important to know because when you fall under the unstable category, it goes under the umbrella of acute coronary syndrome. And when we were talking about acute coronary syndrome, we're essentially referring to a heart attack. Okay. And so it's important for you to recognize what a heart attack is and what are the common symptoms when it comes to women compared to men. Now, first and foremost, the predominant symptom presentation for a heart attack for women is chest pain. Okay. Women are, in addition to developing chest pain, they are more likely to develop additional symptoms, but the most common cause for the most common presentation for heart attack women is chest pain. Okay. And the accompanying risk, the accompanying symptoms that women tend to develop more are compared to men would be associated with shortness of breath, pain in the upper back, pain in one of both arms, having nausea or lightheadedness. To kill this reclammy skin is the symptom that both men and women do experience. And also unusual fatigue, something where it happens all of a sudden out of the blue, I'm provoked feeling extremely fatigue. That could also be another sign of a heart attack. And so to reiterate what I mentioned before, the most common cause, or the most common presentation of a heart attack women will be chest pain, but it's going to be discovered that it's going to be associated with other symptoms as well. It's an upper body back pain between the scapula, pain to the neck, pain to the jaw, nausea, shortness of breath, having a lot of colds, but those are all signs and symptoms of potential heart attack that's developing. And so minutes matter when this is happening.  My party. And so you want to be able to we talked about the warning signs you want to be able to recognize them because if you're developing the symptoms happening all over the blue. You want to call 911. Okay. Faster you act in more timely intervention to be able to receive. And so you don't want to drive to yourself to the hospital you just want to call 911 because it is not safe to be able to drive and potentially have worsening of symptoms or having abnormal resumes or passing out or all the above. Don't be embarrassed. So uncertainty is normal. It's better to be safe than be sorry. And so if you go to the emergency room and do the full work up if they don't find anything that is a better scenario than delaying your treatment showing up. 1520 30 and then an hour, two hours later, having a delay in your care and then ultimately having more my party of being at a vulnerable at risk or potentially parking. Otherwise, would it be able to be avoided had to come and go. Okay. And so what we're essentially concerned about in this particular scenario would be an acute heart attack. And so we were talking about the different factor of that. So here was a schematic shown the an acute blockage. So you're essentially not getting any blood flow to the heart. You're going to develop symptoms that are hinting at that. So you want to prevent prolonged increase in blood flow to the heart. And so when you arrive to the hospital, they will complete standard set of testing. Depending on your presentation. So if you were to check your blood pressure.  So, based off of what they find based off your presentation and their exam, we'll determine what the next steps are. So it's either for the testing or they might decide to do further evaluation when it comes out of functional or anatomic evaluation. So when it comes to functional evaluation, if there's, if you're primary doctor or cardiology consultant decides if you would be best for the evaluate with the stress test, then they'll do it in patients with nuclear stress test. And then the others, they want more of an anatomic elimination, then they would either do a CAT scan of the chest or or evasive anti-aggression, which really depends on how you present and what you expect yourself. And while all the aforementioned tests are meant to identify a blockage within the heart. There are many women who develop other forms of coronary artery disease that doesn't necessarily cause blockage in the heart. And you can develop cardiac symptoms in the absence of that. So the two main forms that are more common women compared to men are what's called coronary artery spasm and microvascular coronary artery. And so if you look at the schematic up top, this is the blood vessel of the heart. And so if there was a blockage, you would see the artery spasm here, you do the angiogram, find it and fix it if it's amendable to a fixed extent. However, you can have what's called coronary artery spasm where the artery itself or the inside lining of the heart is wide open. There's no blockage. However, if the artery spasm closes down on its own, it can obstruct blood flow. And so if you could think of anything that spasms, then you're temporarily causing these blood flow to the heart, even though there physically is no blockage. And another form of cardiac or not a disease that can cause cardiac discomfort without any evidence of any blockage in the heart is what's called coronary and microvascular coronary microvascular spasm. And so you can have wide open arteries inside the blockage. However, remember your arteries break down to smaller arteries and arterials. And so here are these small arteries that you can't really visualize based off of current testing methods. Those small arteries can be dysfunctional to the point where they're not providing blood flow to the heart. So if you're having blockages in these tiny arteries, there's no definitive treatment that you can have. You can't have a stent for the scale because it's just too small. But it can lead to the same discomfort that you would have if you would have a major blockage in the main artery of the heart. And so that's in these particular disease sets can present in the women who have coronary catheterization and they don't find anything. It's why it's important to really hone in on presentation and realize that women are compared to men are more likely to develop coronary artery spasms on microvascular disease and to do further testing if there is a clinical suspicion. And the special testing that you would do for microvascular disease and particularly what's called a pet nuclear stress test. And that's a stress test that looks that not only as a nuclear stress test looks at relatively growth of differences in flow of the artery of the heart, but it measures the absolute blood flow throughout the heart at rest and with stress. And so actually for heart rate we have had a pet nuclear stress test that's not the only one in the region as far as practice would be concerned. And it's very helpful because we have patients with major catheterizations, we don't find any major blockages. They're having angina or chest pain like symptoms that suggests it's cardiac in nature. And that stress is very helpful because it can rule in or rule out potential for microvascular disease. Now there are other special tests that are performed as well as the stress cardiac MRI which are done up large academic institutions, which is another option to evaluate for microvascular disease. And when it comes to that coronary basal spasm that I mentioned before, you can do what's called a provocative endocrine. Now this is a test that has not done routinely it's done at certain centers that have a lot of experience. But that's one potential way to diagnose microvascular spasm or macrovascular spasm essentially. And so we've identified the different ways that women can present with heart disease and how it's diagnosed, but now it's transition to strategies to mitigate or even prevent it in the first place. And so this diagram shows life simple seven. And so these are seven simple strategies to mitigate or to prevent heart disease from developing in the first place. And you can see here, normalizing your blood sugar, free diabetics and undergoing diabetics. Eating healthy, as you'd expect, maintaining a healthy weight, being active, stopping smoking if you do smoke. And just so everyone's aware, even a few cigarettes a day, more than double your risk of developing cardiovascular disease in the future compared to those who don't smoke at all. So it's never too late. Normalizing your blood pressure. So that's blood pressure, like I mentioned before, alters that the balance when it comes to the pro pregnant factors and the time for markers in the blood. And that can accelerate or increase your risk of developing cardiovascular disease in the future and blowing blood pressure by 12 milliliters of mercury at 12 points for 10 years can save one life out of 11 patients. So definitely see the emphasize flowing cholesterol and as you'd expect to go, you know, I showed you the schematic for how black blood cells in the first place with cholesterol in an essential role. These are the life simple seven ways that you can, from a lifestyle perspective really reduce your risk of developing heart disease in the future. So as far as risk factors from that life simple seven control yourself, maintaining a healthy diet is one. Increase your risk of diabetes, high blood pressure, another potential way you can. Is another risk factor that you can control yourself as well with the caveat being that there. Yes, there are metabolic disorders that do increase or cause diabetes or obesity and high blood pressure develop. But by and large, a lot of it can be mitigated or reversed with lifestyle modification. A lot of exercise, something that can respect you can control and then start to smoke. So we are all connected in a larger control by lifestyle modification something that we have in our hands in October and it does one. As far as risk factors that are beyond your control. So as you get older, plus you're off to a level of 10 to increase platforms will ultimately start to form. And this depending on how many other comorbidities you have that you're confident. But it doesn't necessarily mean that you are destined to develop for you are just an additional risk factor that you can't necessarily control. So, as I mentioned before, with the estrogen, it's more of a cardio protective hormone. And so before menopause, we tend to have a lot of cholesterol and also lower risk as a result of that to develop heart disease. But after menopause, that was start to level out. And then family history, you can't hide from that. So having history of heart disease that develops at a young age, having high cholesterol, having history of high blood pressure. Those are things that you can run away from, but you can mitigate it to the best of your ability. And we talked about the cholesterol as one of the simple seven categories that we can control or try to control. And so I would want to touch base on different types of cholesterol. So you have total cholesterol, which is the sum of all the cholesterol of the mind. And when it's elevated, it raises your list of developing cholesterol. Okay, HDL, it's the high density of the protein is one of the components of cholesterol. And it's like the idea of HDL is that it maps up on this cholesterol level. It may lower risk, but we're finding new evidence that this might necessarily not be the case if you have a high HDL level. So this shouldn't be reassuring. We need to make sure that the other components of this control are LDL or bad cholesterol or low density cholesterol. That's the one that's involved in the pathogenesis of fat for a month. And the higher the level, generally, the higher the risk of developing a subsequent cardiovascular disease. And the LDL, the other very low density of the protein falls in the same classes as LDL and the higher the level, the higher the risk. And as far as specific putoffs, so for total cholesterol, we want to be less than 200 for HDL. For women, we want to be more than 55. For men, more than 45. The bad cholesterol, LDL, we want that level to be less than 100. And these are the targets when it comes to cholesterol. So now going back to the simple seven, what are the strategies to be helpful? And so with healthy food techniques, including choosing lean meats and poultry.  And you want to select non-fat or low-fat dairy products. So choosing skin, choosing low-fat or 1% low-fat or non-fat yogurt and cheese. And living dairy products is the best of your ability. And then when you're making salads, try not to dress it up with too much dressing because then you start negating the benefits that you are striving to achieve. And then try to use spices instead of butter and salt. Now as far as cholesterol in particular, you want to limit total cholesterol intake as well as saturated fats. So with saturated fats at room temperature, it becomes solid form. And that's what contributes to fat production throughout the body. When it comes to all the unsaturated fats, it is liquid form at room temperature. And so it is less likely to develop or contribute to fat production. So that's why you want to be able to limit the saturated fat intake. And so for total cholesterol itself, about 300 milligrams a day, I always get asked how many eggs I eat. And generally around six eggs a week is considered okay. Try not to do more than that. And then with fats, you want it to be about 10% of saturated fats, especially for calories. And a high percentage of saturated fats are going to be coming in on the fats in dairy products. That's why we always recommend limiting red meats and dairy products for our patients. I'm sure as everyone has heard in the past, trans fats are the fats. And these are the fats that come with the food that tastes really good.  And these are just hydrogenated or partially hydrogenated fats. And they're bad for you because they increase the bad cholesterol at the end. They lower the good cholesterol, the HDL, and they increase regular stress. And you want to be able to look at what the label is pretty closely because if it mentions that there's food containing less than 0.5 grams of trans fat for serving, they can label it as trans fat free. So just because it says trans fat free doesn't necessarily mean it's completely free of fat. So, and, you know, for one or two meals here there might not be an issue, but if you're continually eating a lot of food that has traces of trans fat, it does add up. And then I mentioned before the difference between saturated and unsaturated fats. It's basically one is more solid form. And then temperature in the other is liquid form. And so the healthy fats will be the unsaturated fats because they're more liquid form. And so they're within that liquid form of the unsaturated, the saturated and non unsaturated. And so for polyunsaturated they're great because they help lower the LDL or the bad cholesterol. And in the sample foods that contain that would be sunflower, safflower, soybean, sesame oils, nuts and seeds and fish give you lots of amounts of polyunsaturated fat. As far as mono-unsaturated fats, it does lower the total and bad cholesterol may increase your HDL. And so that's why you have a lot of infomercials really promoting olive oil. So it actually works in olive oil to large amounts of mono-unsaturated fats. And that's what I thought it would do as well. And for any patients who are on the SIPA, the SIPA contains highly concentrated form of EPA or omega-3 fatty acids. And these are forms of polyunsaturated fat stuff are very beneficial when it comes to decreasing your triglycerides and lowering the information in your body. And you know there's been a trial that was informed within the past six to seven years that has shown benefit in patients who have cardiovascular disease or cardiovascular risk and who are on the SIPA and have been taking the SIPA. And so this is why we always recommend a SIPA and increase in SIPA intake when it comes to the Mediterranean diet that's been recommended. This includes fish in your diet 20 times a week and fish is great because it's low in saturated fats and it's a good source of polyunsaturated fats. And from that simple seven diagram that I showed before, categories are reducing carbohydrates. And not only just carbohydrates, but simple carbohydrates. So anything that causes a spike or a rush in glucose in your body which causes a rise in insulin. Because those two products tip the balance towards inflammation in your body. So having excess sugar in the body simply gets towards that. And so you can think of any sugars, sweets, fruit juice, even dried fruits or anything like that as well. And then when it comes to alcohol, called in moderation, and that's because excess amounts of alcohol can increase your triglyceride levels, and it's simply high in sugars. So as we discussed before, increasing simple sugars will essentially gets towards the spat and will raise the glucose levels and even some levels in your body. So one way to combat this is fiber. So lots of non-stargene whole vegetables and whole fruits are great because they have lots of soluble fiber and the benefits of soluble fiber in lowering the total and specifically the LDL in the back cholesterol in the body. And then soluble fiber is great because it adds both to the gut. So you're not absorbing as much of what you eat. And one thing to keep in mind is that any time you see the word instant, it's going to be a process full grain. So you're not going to get as many benefits of which by the way would from something that's full in nature. So if you get whole oats, beans, lentils, peas, these are great sources of soluble fiber. And then exercise, real exercise. So start off 10 to 15 minutes a day and you want to gradually increase the limit to 60 minutes a day, five days a week. You can do it in intervals. What I will say about exercise is that something is better than nothing. There have been studies comparing patients who are completely sedentary to those who do just a little bit of exercise. And there are significant benefits from those who even do a small amount of exercise. So shouldn't be thought of as an all or nothing phenomenon where you're not doing half mile runs and 40 minutes exercise intervals each and every day. Then you shouldn't be doing anything at all. If something is better than nothing. Okay. And also do not forget a weight bearing exercise because this is just as important as doing the robots. It's great for bone strength as well as as well as stretching and flexibility. Then weight loss. So we know that excess weight causes high cholesterol and high triglycerides, also high blood pressure when you're interested in diabetes. And it's hip to scale towards a pro-inflammatory state. Okay. The same thing. It's not an all or nothing phenomenon. Just using five or 10 pounds can be significant to cardiovascular benefits. So something is better than nothing. And I wouldn't take it as an all or nothing phenomenon. And just doing a little bit of your state. Five minutes of exercise that you otherwise wouldn't do. If it's taking out instead of having if you can make a lot of diet coke or coke. And instead of having two, you have one that can have significant impact on your health. Baby steps are a better than no steps at all. And so we've touched upon the lifestyle modifications that can be implemented. But sometimes that's not enough. And some patients will need to take a cholesterol and medications even with them maximizing or achieving their lifestyle intervention. And so who should take cholesterol drugs? People who've already had a heart attack or stroke. But once you've already developed an event at that point in the cast after that, you need to be on a cholesterol medication to reduce the risk of further issues going forward. And that also plus the aspect. So I already did that in questions and patients. The study that recently came out, or I used to be from the news saying that you don't see an aspirin. Well, that isn't a part of patients who already have developed an event. They're in a completely separate category. They're the time target. Yes, one of the patients never developed. Okay. Those who are LVL or load incident. That was a matter of significantly elevated.  If you're diabetic over the age of 40, and the LVL is above 70, where you do derive a benefit. And then in general, there are risk profile scores that are out there based off of your risk factors. And if you have an elevated 10 year cardiovascular list, you would also benefit from a cholesterol medication as well. And so the commonly prescribed medications are statins and PCSK mine. So stands are the drugs that are most commonly be prescribed PCSK mine inhibitors. They're an injectable form that helps remove that bad cholesterol, the LVL easier. And that's something that's usually prescribed by cardiovascular specialists.  That's something that will be prescribed or it will be prescribed as an alternative if you have side effects. And then these other forms of cholesterol medication that reduce cholesterol that provided here, but the two most common forms of these kinds of PCSK mine inhibitors. And as with any medication that's prescribed, so discussion between you and your doctor when it comes to social side effects and rainbow side effects to your health benefits for your particular situation. That's just discussions between you and your patient. And so as a take on cardiovascular mortality is on the rise for both men and women. But in particular, particularly for women, I think there is not as much emphasis on how prevalent it is the number one killer in women. And as I mentioned before, when you combine all cardiovascular disease stroke, heart attack and cardiovascular disease, it is more than double number. And when it compared to all cancer women in front, so breastfeeding and GI etc. So it's something that we definitely get the word out on, and it is under recognized as under diagnosed and just under treated. And so because of that women are being diagnosed in later stages than the ordinary would have had a high index of suspicion. It's important to know what the signs of heart disease are in women in particular and acting on that area. And then focusing on the simple seven, you can do your part to mitigate the risk or help prevent any of these practices from the current. And so why me why now, as I mentioned before, even in younger women, less than the age of 44, heart disease is the third common cause of death. And so it starts early on. And so you want to start the simple seven early on to help mitigate that. And the risk does increase after menopause because estrogen. So you always want to keep this in the back of your mind and be proactive in order to catch something is catching the early on. And it begins today, one step at a time. You don't have to make the article from zero to 60 is just taking a day by day and do what you can to ultimately look something being a life bar. You don't want it to be something temporary. Okay. So I can smoking being active and adding to function or all the things that don't get emphasized as much pressure. And these are the resources. How far are the both for health, health, education, so if you go to hmh4u.org, you would find all the resources. Thank you so much, Dr. This was great. We do have a couple of questions that came in during the presentation. So I'll start off with what cars is the heart arteries plaque buildup? Is it specific foods that you eat? It's a combination of things. It's a combination of your genetic makeup. And also the circumstances. So what causes plaque to develop is inflammation. Plus cholesterol elevation in your body and how your body processes that cholesterol. And that final with the different inflammatory part of markers, which can be raised for multiple reasons for having an autoimmune disorder, smoking, having high blood pressure, having diabetes, or just having high circulating hormone levels, just as a genetic cars. All those factors combined when can ultimately lead to plaque to start to develop and also not only for to develop but for to progress and build. So it's not any one particular thing, but it's a combination of markers that increase inflammation and also cholesterol and how your body processes that all together. Thank you. The next question is, I have uncontrolled diabetes for years. What are my chances of having a heart attack or stroke. It depends on what type of diabetes, whether that's type one or type two, and when when it developed and how many years you've had for years, but five and 20. So being a diabetic, it's doesn't necessarily mean that you are ultimately going to develop cardiovascular disease, it just increases your risk, and it's never too late. So if you haven't seen a cardiologist and had a diabetes stroke for years, you definitely want to see one to be screened. Okay, so you want to make sure that the circulation of your legs that we perform to the heart are optimized as possible and also that your cholesterol is where you used to be. So to answer your question, there are a lot of things that contribute to that it depends on your other comorbidities that also depends on lifestyle factors if you smoke, how high your cholesterol is high blood pressure is all those things can increase it but it doesn't necessarily mean you're ultimately going to develop it but it does increase your risk which is hard to say without having the full clinical picture. Thank you. What are good oils to cook in is canola oil good. Canola oil, when it comes to the medium chain fatty acid oils, there's mixed information mixed data as far as it's actually being beneficial versus being neutral to potentially harmful. And we know that extra virginal oil for sure is something that is beneficial vegetable or something to be avoided canola oil remains to be seen as their mixed information and mixed data that's been published on that. Okay. Are there any recent studies or data that shows the effects of COVID on the heart. COVID when COVID first came out there was a concern for my rights. And so there is a small increased risk of developing my product as a result. But COVID can be associated with abnormal rhythms during an acute COVID phase. So you're working obviously with increased information so you're at a higher risk of developing heart attacks and strokes. But the data keeps changing and so it's not as high as we thought as a first came out but the risk is still there for sure. Thank you. And then I have three more questions that are all combined into one. What is the calcium scoring test? And who should have this test? Great question, sir. Calcium score, it's a cascane in the chest that does not use contrast. It takes about 30 seconds to do it. And you're essentially looking for a calcified plaque product in the heart. And so if you have calcified plaque product, it depends on how much, but the absolute number is, but also when you percentile. It's mass based off of your gender and your faith. And that helps this further the stratified patients who otherwise are on the fence of determining whether or not they will need to be on cholesterol medication. So for the guidelines, if you have a risk factor score around 7.5% where that's on the borderline is potentially suggesting that you need to be on cholesterol medication. And having a coronary calcium score in that case will serve as a high barrier on your age and also your absolute score and your percentile based off your background. And so that's when the coronary calcium score will be helpful. And as far as who is beneficial for it's, it's individualized. I think part of the guidelines we know as for patients who are at borderline risk, you're not sure whether or not they benefit from a cholesterol medication. But it also depends on your particular clinical scenario. So, you know, for instance, if you have a patient who doesn't want to be on a cholesterol medication at all, even though we know that they're high risk, or would potentially benefit from having that knowledge, having that coronary calcium score is a yes. You happen to have a score of 140 and you're in the 80% of your age and gender and you would benefit from it. And having that knowledge is powerful. It's something that helps reinforce potential benefit. Thank you. And actually this is also about calcium scoring. And I'm going to read them both at the same time. So how is it performed. Do you give a pill to adjust the heart rate during the test, and are there risks to the test. So yeah, the coronary calcium score is different from the coronary CTA. The coronary CTA is CAT scan of the chest where you do get contrast through an IV. And your heart rate has to be at a certain number so that it's slow enough to be able to get very quick to answer the question. When it comes to the coronary calcium score test alone, where you're not using contrast, it's simply a CAT scan of the chest. And it's only looking at a small portion of the chest wall and basically confined to the heart itself because you only want to see if there is calcium on the back of the heart. It's a low amount of radiation. So low risk because you're only exposing yourself to radiation within the heart region itself. And there's no contrast that's being administered because you're not doing the coronary CTA. You're essentially just doing a simple CAT scan, only focus on the heart and only looking for a classified plasma. You're not looking at the heart rate itself. When it comes to contrast, so very quick low risk and there's no need for medication to store the heart rate.


Assalamu alaikum. Today we are going to talk about ecology, environment and the organisms. Ecology is the study of interaction between organisms and their environment. What is an environment? Environment is the surroundings in which an organism is living. An organism is never living in an isolation. It has to interact with the organisms which are surrounding it, with the physical factors which are present around it, with the chemical factors which are present around it. So, environment consists of other living organisms, water, the air currents, the soil, maybe the roads, the cats, the dogs around us. For example, if I am an individual, organisms have to interact with their environments. For example, if I am living in an area, there are various plants present in that area. There are other human beings present in that area. There are cats and dogs. There may be microscopic organisms, the bacteria which can spoil my food, which can even make some foods for me. For example, we know that yogurt is produced by the bacteria from the milk. Every organism has to interact with its surroundings, both living surroundings and non-living surroundings. Environment provides the organism all those things which are required to live. That is food. Every organism gets food from the environment, shelter. Every organism has to get the shelter protection from the environment. For example, the human beings, which are the most advanced organisms, lives in houses. The cats and dogs, they have their own places on which they live. For example, a street. Birds live on the trees. Sometimes for bringing up their kids, they have nests. The bears and the lions have their caves in which they live. Organisms also have to interact with other organisms, which are present in the environment. So, environment is everything present in the surroundings of an organism, which is providing us, providing the organism with food, with shelter and with relationships. Environment is always changing. We know that even in a day, in a single day, temperature may change. In the morning, temperature is lower. When sun is, sun just has a rise in. When sun goes up, temperature rises up. When sun again goes down, then the temperature raises down. At night, temperature may be more different. Seasons change. Seasons winter comes, summer comes, harsh winter comes, spring, fall. Environments are always changing, even sometimes, disastrously. For example, after a flood, the environment of the area may be totally, entirely changed. After a flood, this is possible that all of the trees in a specific area are just fallen down and all the birds which were living on those trees are now homeless, just like the people of that area. So, environment sometimes may be very favorable. Sometimes it may be very hostile. That is unfavorable. What is the strategy of organisms? Organisms have to adapt to the situations. Different organisms have different properties. And according to their characteristics, their properties of life, they can survive in different types of environments. Organisms are best fit for their environment. There are different types of organisms and there are different types of environment. Every organism lives in that environment to which its characteristics are best fit. Otherwise, it will not be able to compete with other organisms of maybe the same species, maybe the different species and it will die. Or maybe it have to migrate from that area. So, each organism is best fit to its surroundings, to its environment. Every organisms always select to that environment in which its characteristics allows it to live. Otherwise, other organisms may compete with it and either it have to die or it have to migrate. Now, environment consists of two types of factors. If we generally divide them according to the living and non-living condition, we call them biotic factors and abiotic factors. Biotic factors are those factors which are living. In other words, biotic factors are the living organisms present inside the environment. The abiotic factors are all the other factors which are non-living part of the surroundings or the environment. The abiotic factors includes animals, plants, all those small animals, the small plants, the trees, the herbs, the shrubs, the shrews, the moles, very large arephans and the abiotic factors. They consist of light, air currents, the atmosphere, water, even temperature, pH, soil, all the other things present inside the environments which are non-living. The living factors or the living part of the environment may be microscopic like bacteria, viruses, which are living in the environment but they are not visible to our eyes because they are very small. But the human being can see them using a microscope just like our very small cells. So the environment consists of the biotic factors and the abiotic factors. Biotic factors are the living factors, the living organisms. Abiotic factors are all the non-living things or all the non-living surroundings. What is ecology? Ecology is from a cause and a logic. Ecology is the study of interactions of organisms with each other and with their non-living surroundings. So in ecology we study the interactions of organisms with other organisms, maybe similar organisms, maybe very different organisms and also their interactions with their non-living surroundings. For example, if a deer is living in a specific area then it have to take its food from the environment. The grasses may be the small plants whose leaves it can eat but it have to interact with the organism of same species like the other deers because in a specific area grass may be limited. If there are too many deers they have to compete with each other for food and the one who is more strong can get that food and other either have to migrate or may be die out of starvation. Those deers also have to interact with the tigers present in their area if they are present because tigers are the predators which can eat upon the deers. A deer which is living in an environment have to protect itself from the tigers or the other predators. For that it have to adapt some strategies. This also have to interact with some other animals which may be large or small. It have to drink water. If there are few water bodies and if there is a less amount of water then it have to compete even for water with other organisms. The organisms have to compete for each and everything. Their food, their shelter, for the interaction with other organisms for each and every resource which is present inside the environment. Organisms also have to interact with their abiotic factors. Like for example if temperature is so high then the organism have to protect itself from temperature. Maybe they have to find shadows, shadows of the trees if the trees are present. If the trees are not present maybe they have to find out the caves if they are present or some other type of shade or maybe they have to adapt some other strategy. So every organism have to interact with the biotic factors and the abiotic factors present in the environment. Now the biosphere. Biosphere is the whole part of earth, the planet earth which is covered with life. We say the bio, life, sphere, part of the earth, the whole part of the earth on which the living organisms are inhabiting. There are different types of areas on the earth on which the living organisms can inhabit. In water, on land and even in the air like birds. Look at a diagram. It shows that the biosphere consists of three further spheres. Actually these are not spherical but these are just for an example. These are various parts of the world of our planet earth. The atmosphere, the hydrosphere and the ecosphere. The atmosphere, the air, the hydrosphere, the waters, the ecosphere, the ecosystems. Air or atmosphere is actually part of almost all of the ecosystems. Hydrosphere or the waters, they are also parts of the ecosystems. Now what is an ecosystem? Look at another diagram. It shows various organisms in interaction with their environment. You can see a big water body on which a man is rowing a boat. On the other side, there is a large fish. You can also see various small fish. You can see various plants which are submerged in that water. Submerged means some part of them is inside the water and there are few which are totally submerged, which are totally present inside the water. There are lot many plants on the sides. There are rocks, there is an atmosphere, the air, there are clouds, there are trees. Areas like this in which different types of organisms, the animals, the plants, the bacteria, the fungi, the algae, the other organisms, they are living with their abiotic surroundings. Water, atmosphere, rocks, soil, a system in which all of these organisms are living. That is all the biotic factors are living in interaction with their abiotic factors and in interaction with each other is called an ecosystem. So ecosystem is an area in which the living organisms are living, are inhabiting in interaction with each other and with their non-living surroundings. Have a look on another diagram which also shows a mountain, a small hill with different types of trees, then there is a water body and then the big water body making a lake, then there is a stream, then there are more trees, there are different types of animals present in it and of course there is soil, there are rocks, there is an atmosphere, there are animals and there are plants. So this is an example of another wetland ecosystem. Pakistan is rich in wetland ecosystems. We have various wetlands which are very important part of Pakistan because they have diverse organisms. We say that they have a biodiversity. There are diverse forms of life present inside these ecosystems and these organisms, this biodiversity actually gives a stability to the ecosystem. They make the ecosystem stable.


The Welsh Government is working towards a more equal nation. Violence against women, domestic abuse and sexual violence continue to damage the lives of individuals and families in Wales, stopping them from reaching their full potential. The Welsh Government's third annual violence against women, domestic abuse and sexual violence report sets out this significant progress made over the last year to deliver our six strategic objectives for tackling VARDA as V. Some of these key achievements include our communications campaign, This Is Not Loud, This Is Control, which is focused on raising awareness and knowing how to spot the signs of coercive control. So far the film has been watched more than 200,000 times and the Live Feel Free helpline has reported an increase in calls about coercive control. We've increased the reach of our This Is Me campaign with children and young people. The campaign challenges gender stereotypes and shows that everyone can be who they want to be and achieve their potential. We've worked with our partners to develop standards for working with perpetrators of violence and abuse. This will help us to meet our commitment to hold perpetrators to account and give them the opportunity to change their behaviour. We teamed up with the Home Office to hold an information sharing event on forced marriage and female genital mutilation protection orders. We've supported 23,000 more professionals in Wales to increase their skills and understanding of our strategy through our national training framework. This means that over 158,000 professionals have received training to date. For the help of our sustainable funding group, we finalised our guidance for the commissioning of services. This guidance encourages organisations such as local authorities, local health boards and the police to work together to commission high quality, more consistent and effective services to prevent, protect and support victims across Wales. In the annual report you can read more about all the progress we've made over the last year. I'm proud of what we've achieved but I want to emphasise that we have not achieved these alone. We are grateful for the input and support of a range of people and organisations and have been informed by the experiences of many survivors of domestic abuse. Help us celebrate and highlight these achievements. Over the coming weeks we'll be publicising infographics which highlight achievements described in the annual report. Look out for these on social media and please share widely. I look forward to continuing to work together in our efforts to end violence against women, domestic abuse and sexual violence.