My Old Blog Posts

Arnon Axelrod
Sep 27, 2018 · 24 min read

Hi,

From now on I intend to write and publish new blog posts here, instead of in my old blog. However, there’s a lot of good content there, so in case you’re looking for one of those articles, just click its title:

My book “Complete Guide to Test Automation” is due in September

July 10, 2018

I’m very proud to let you know that I finally completed writing the book I was working on for the last 2 years. While at first I called it “Succeeding with Test Automation”, when Apress Publishing suggested to publish my book they suggested the better name: “Complete Guide to Test Automation — Techniques, Practices and Patterns for Building and Maintaining Effective Software Projects”. According to Apress, it should be published at the beginning of September. Obviously I’ll update this post with the link to Amazon when it will be available. From the back cover: Book Description Rely on this robust and thorough…

tags: Apress, Book, Test Automation

no comments

Selenium in Depth — the demos

March 6, 2017

Last month I gave a talk on the Israel Test Automation Meetup titled “Selenium in Depth”. In this talk I showed highly simplified examples that demonstrate how Selenium behaves in certain conditions, mostly related to the html and JavaScript on the page. Now I decided to share the demos and you can find it here. Each demo is contained in a Test Case method. Most of them use a specific super-simple HTML file that is part of the project too. Note that not all tests pass, and this is by design! Here’s a short description of the test cases: IsItABugInSelenium — If you just open…

6 comments

Writing maintainable automated test and infrastructure — With live video recording!

November 9, 2016

Hi all, Long time since I last wrote here, but if you’ll take a look at the draft of my book, you’ll see why… By the time I’m writing this post I wrote 80 pages in the book, and hopefully when you read it there will be even more. Anyway, today I want to share with a screen cast that I recorded with one of my clients, in which I show to a new automation developer on the team how to create a new automated test and explain how I’m going about building a highly maintainable framework. The video is in…

one comment

“Succeeding with Test Automation” — The book!

July 3, 2016

Hi everyone! I’m super excited to let you know that I started writing a book, called “Succeeding with Test Automation”. By now I wrote only 1.5 chapters, but that’s something too :-) UPDATE: I already wrote 82 pages and 7 chapters. Stay tuned for more! You can find the draft here, and I’ll update it from time to time as I proceed. I still don’t know when/where/how I’m going to publish it, but I guess that when it will be closer to completion I’ll know better. At the meantime, I’m looking forward for your feedback!! It’s really important to me! Thanks in advance, Arnon.

one comment

הקלטות מקורס מיומנויות תכנות מתקדמות

April 21, 2016

For all non Hebrew readers: in this post I’m sharing some videos from a course I led about “Advanced programming skills”. Because the course was in Hebrew (and therefore the videos are too), then it’s only relevant to Hebrew readers. Sorry about that :-) ועכשיו לעברית: בחודשיים האחרונים העברתי קורס פנימי לעובדי סלע. מטרת הקורס שכלל 8 מפגשים בני כשעתיים כל אחד, היתה שיפור מיומנויות התכנות. הקורס עסק בהעמקת היסודות והבנת התהליכים שקורים במחשב (שפת מכונה, קומפילציה, מערכת ההפעלה, CLR וכדו’), ובמיומנויות של Clean Code ו-Refactoring. אני שמח לבשר לכם שהקלטנו את כל המפגשים בוידאו ועכשיו אני יכול לשתף בהם את…

no comments

TestAutomationEssentials.Selenium (Beta) is now available!

March 20, 2016

I’m excited to share with you that I’ve added a new library to the Test Automation Essentials suite, that includes reusable code for Selenium based tests! This is a Beta version because it still doesn’t include XML documentation and unit tests, which I try to include in the released versions. However, it is tested and is used in production in one of my customers! To start using it, simply add it as a NuGet package as follows: Right click on the Project References Select “Manage NuGet Packages…” Make sure that “Online” is selected In the search box, type “TestAutomationEssentials.Selenium”. The package should appear in the…

tags: Automated tests, GitHub, iframe, Logging, NuGet, Selenium, TestAutomationEssentials

no comments

I’m on .Net Rocks!!!

January 14, 2016

Hi everybody, As a long time avid listener of the greatest podcast for .Net developer — “.Net Rocks” , I’m very excited to let you know that I’m the guest at show 1243! In this show titled “Successful Test Automation with Arnon Axelrod”, I’m talking with the Carl and Richard (the hosts of the show) about best practices in test automation and how to write a good test automation suite that is valuable and easy to maintain. I also talk about my Test Automation Essentials GitHub project I announced in a previous post. Please listen up and tell me what you think! I’d like to…

no comments

Keeping an active desktop session

January 3, 2016

UPDATE: For some reason, the solution as it was before didn’t always work. I don’t understand the root cause, but the solution was simply to remove the “-file” at the start of the arguments of the Task’s action. I now fixed the instructions below accordingly. When doing any kind of UI automation, there are several cases that a desktop session will be active. I’ll get to what it actually means in a second, but first I want to list some of the common problems that people encounter that are caused by not having an active desktop session: 1. In Coded UI,…

tags: Remote Desktop, Screehshot, UITestException

24 comments

Israel Test Automation Meetup

October 14, 2015

I’m happy to announce that I started the Israel Test Automation Meetup user group. The aim is to meet every 2 months for lectures and discussions about Test Automation topics. I’ll announce the first meetup soon (in the meetup group), once all the details will be closed, but you don’t have to wait in order to register to the meetup group! Stay tuned…

no comments

Announcing “Test Automation Essentials”!

August 25, 2015

I’d very glad to announce that I just published a new project on GitHub, and also made it available through NuGet! “Test Automation Essentials” is a set of tools that are handy for any test automation project. It contains all the code that I want to take with me from one project to another. I hope you’ll find it useful for your projects too :-) Over time, I intend to add to this project everything that I do and can be helpful to other test projects. Of course that I’d also love to get contributions from the community! The source code itself…

tags: GitHub, NuGet, Test Automation, Test Automation Essentials

no comments

The Real Value of Test Automation

April 23, 2015

Automating the manual tests Most development organizations (and QA teams as part of them) that start developing an automation suite, aim that the automation will replace part of the long manual QA cycles. They expect that the test automation project will be a one-time effort (maybe with some low effort for continuous maintenance and adding tests afterwards), and from that point on its purpose will be to find bugs, just like manual testers do. Because the manual testing is a very simple and repetitive task, it looks like developing the automation should be simple too. After all, tests…

2 comments

Refactoring towards the Liskov Substitution Principle

January 4, 2015

Sometimes you write or encounter a method that return an object that represents a complex result upon which the caller should decide how to proceed. For example, consider the method with the following signature: StudentQueryResult FindStudent(string nameSubstring); This method looks for a student by his name or part (substring) of it. This method can have 3 possible return values: 1. If there’s no student found that matches the substring, it should return null 2. If there’s exactly one student that matches the substring, it should return all of the details about this student, including the list of courses he completed and the…

tags: DEV, Liskov Substitution Principle, LSP, Refactoring, SOLID

no comments

The Right Way to do Test Cleanup

September 2, 2014

MSTest and NUnit, as most of the other common test frameworks, provide means for write cleanup code that is executed whether the test passed or failed. In addition they provide means to write cleanup code that runs after all tests in a class or assembly has completed. This is especially important in End-to-end or Integration Tests, in which the tests cannot be 100% isolated from one another. In MSTest this is done using the , and attributes. Of course there are also corresponding attributes, but this is out of the scope of our discussion. Look here for…

tags: Automated tests, Cleanup, MS-Test, Unit Tests

2 comments

TDD, SOLID, Functional Programming, Declarative programming and more…

December 19, 2013

TDD and the Single Responsibility Principle Amongst the 5 SOLID principles, I found that the one which is the least tangible is the “Single Responsibility Principle” (SRP). Even though this is the most well-known and intuitively easy to understand, the questions “What exactly is ‘Responsibility’?” or “How do you determine whether a class has exactly one Responsibility?” is not trivial whatsoever. Obviously there are many cases that the violation of this principle is evident, but there are many more which fall in the grey area. It’s often being claimed that TDD helps guide you to develop classes which adhere to the…

tags: Declarative, DEV, Duplication, Functional, Single Responsibility Principle, SOLID, SRP, TDD

no comments

Main Pitfall of TDD–Refactoring

May 27, 2013

Many people have bad experience with TDD. Their main complaints are: They spend too much time maintaining tests. For example, to fix a small bug or a small change in the production code they need to fix many tests Even though they follow the TDD practice and always write tests before production code, the production code doesn’t become so “clean” and SOLID. It’s difficult to write tests that cover all lines of code and all cases Tests need very long and complicated setups of mock objects…

tags: Coupling, DEV, Duplication, Kent Beck, Refactoring, TDD, Unit Tests

2 comments

The inherent productivity dilemmas of big teams

February 17, 2013

Most people say that they’re more productive when they work alone, in private, without anything or anyone to disturb them. This claim is even backed up by various researches that show, among other things, that working in a noisy environment detract from the employees’ ability to solve complex problems. Microsoft took the conclusion of that research and implemented it in its own premises. At Microsoft almost each employee has his own room. All of that is viable and true as long the individual has all the information and all the knowledge he needs in order to complete…

one comment

Online materials from my Expert Days sessions

December 29, 2012

Thanks for those who participated in my sessions in Expert Days! I hope you enjoyed it. For your benefit and also for everyone else that didn’t participated, I uploaded all the materials online so you can browse whenever you want. You can find all the materials here. In the above link you’ll find the following files: For the “C# in Depth” session you’ll find: The presentation All the demos (except for the Roslyn project demo) The Roslyn project demo For the “Software Quality –…

tags: Acceptance Tests, Async/Await, ATDD, Automated tests, BDD, Bugs, C#, demo, DEV, Expert Days, Expression trees, Fitnesse, Functional tests, generics, Iterators, Lambda expression, MS-Test, presentation, TDD, Unit Tests, value types, Visual Studio, yield return

no comments

Test driving interactions using Async and Await

September 15, 2012

From time to time I encounter a problem that seems pretty straight-forward to implement without TDD, but very cumbersome to do with TDD. Most of these cases have something in common: they describe interactions between the tested component and external parties. These external parties can be either the user, external system, or any kind of communication protocol. Here’s the simplest example I could think of: This is a simple console application that asks the user for his name, and then greets him with “Hello, “, followed by his name. Writing this application takes exactly 3…

tags: Async/Await, C#, DEV, Hello, World, MS-Test, Mutlithreading, Single Responsibility Principle, TDD, Unit Tests, Visual Studio

one comment

Avoiding Conway’s Law using TDD and ATDD

July 11, 2012

Back in 1968, Melvin Conway stated that “organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations”. This statement is still relevant today and is well known as the Conway’s Law. There’s a lot of truth in this observation, and many organizations take this law seriously and structure their development organization to best reflect their desired architecture. The desired outcome of such organizational structure, which is mostly achieved, is that each component is cohesive, loosely-coupled from the other components, and also pretty well maintained by the team –…

tags: ATDD, Clean Code, Conway’s Law, Coupling, DEV, Pair programming, SOLID, TDD

no comments

ATDD with MS-Test or NUnit

May 29, 2012

Normally ATDD and BDD are associated with special tools that allow non-developers like business people and testers write or at least read tests, without having to write code. Examples of such tools are FitNesse, M-Spec, SpecFlow, Cucumber and more. However, even though these tools allow to specify tests scripts without code, often for business analysts these tools are too technical, or they just don’t have the mindset to specify tests in a well-structured “Given-When-Then” format. About two years ago, the core group in Retalix tried to adopt ATDD using FitNesse, where the BA’s (Business Analysts)…

tags: Acceptance Tests, ATDD, Automated tests, BDD, C#, DEV, Fitnesse, MS-Test

one comment

Guidelines for writing good automated tests

April 30, 2012

Hi everybody! Recently I was appointed to lead the test automation and TDD efforts in Retalix’s development group. As part of this effort, I realized that most people lack the knowledge of how to write good tests, and their mistakes lead to tests that are a pain to maintain, or give doubtful ROI. So I ended up putting this short guidelines on the internal Wiki. However, I thought that it should be useful to share it with everyone. What kind of tests these guidelines refer to? Any functional automated tests. That is automated tests that…

tags: Acceptance Tests, Agile, Automated tests, Clean Code, Code review, DEV, Functional tests, Guidelines, Pair programming, Single Responsibility Principle

one comment

Worst VS feature: Copy & Paste

March 21, 2012

Time and time again, when I’m reviewing code of pretty experienced programmers, I’m still shocked how they’re using Copy & Paste programming extensively instead of extracting common code to shared methods and classes. Visual Studio and many 3rd party add-ons tools make it very easy to make these refactoring that allows to avoid any duplication. But still — Copy & Paste is easier and that’s what many programmers use by default. Frankly, I chose the title for this post just to tease. Clearly there’s nothing wrong with the Copy & Paste feature of Visual Studio. The problem is…

tags: 4 rules of simple design, Clean Code, Copy & Paste, Design, DEV, Duplication, Kent Beck, Object Oriented, SOLID, Unit Tests, Visual Studio

no comments

Do you really code-review? (Or: to pair or not to pair?)

February 10, 2012

There’s no doubt that Code review is an important practice. It has many advantages: · Bugs are likely to be found early · The quality and especially the readability of the code are kept high · Technical knowledge and experience is shared · Domain knowledge is shared In most organizations I encountered, some kind of code-review policy was in place. However, not many of them succeeded in implementing the policy. The main “excuse” is usually pressure, but in my opinion, the problem is deeper than this as I’ll explain later. Another practice,…

tags: Code review, DEV, Pair programming

no comments

Open House about TDD–The presentation!

December 16, 2011

UPDATE: I updated the link to the presentation As I mentioned in my previous post, this Thursday (Dec. 22nd), I’ll be giving an Open House about TDD and ATDD. If you still haven’t registered, do it now! (it’s free, of course) And now you can already peep into the presentation here! See you all there!

tags: DEV, introduction, presentation, TDD, Unit Tests

one comment

Open House on TDD, Clean Code and ATDD (22/12/2011)

December 4, 2011

יכולים לגרום ללקוחות שלך להיות יותר מרוצים ואפילו להאיץ את קצב ATDD ו-TDD-ידעת ש ?הפיתוח !ב-22.12.2011, ותשמעו איך זה אפשרי E4D Solutions-בואו לפגוש אותי ביום הפתוח ב .הקליקו על הלינק למידע נוסף ולהרשמה

no comments

TDD and the SOLID principles (Part 7 — Conclusion)

November 20, 2011

Table of contents: Pat 1 — introduction Part 2 — SRP Part 3 — OCP Part 4 — LSP Part 5 — ISP Part 6 — DIP Part 7 — Conclusion (This post) Often when talking about TDD it is said that despite of its name, TDD is not a testing methodology, but rather it’s a design methodology. As you’ve seen in this series of articles, the SOLID principles goes hand-in-hand with TDD, and indeed TDD drives the design of your code in a way that adheres to the SOLID principles….

tags: Bob Martin, Clean Code, Dependency Inversion Principle, DEV, DIP, Interface Segregation Principle, LSP, OCP, Open-Close Principle, Single Responsibility Principle, SOLID, SRP, TDD, Unit Tests

no comments

TDD and the SOLID principles (Part 6 — DIP)

November 1, 2011

This is the 6th post in the series about TDD and its relationships with the SOLID principles. Here’s the table of content for the series: Pat 1 — introduction Part 2 — SRP Part 3 — OCP Part 4 — LSP Part 5 — ISP Part 6 — DIP (this post) Part 7 — Conclusion DIP — Dependency Inversion Principle Depend on abstractions, not on concretions. This principle states that: A. HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW LEVEL MODULES. BOTH SHOULD DEPEND UPON ABSTRACTIONS. …

tags: Bob Martin, Clean Code, Dependency Inversion Principle, DEV, DIP, Interface Segregation Principle, IoC Containers, ISP, LSP, MEF, Object Oriented, OCP, Open-Close Principle, Separation of Concerns, Single Responsibility Principle, SOLID, SRP, TDD, Unit Tests

no comments

TDD and the SOLID principles (Part 5 — ISP)

October 1, 2011

This is the 5th post in the series about TDD and its relationships with the SOLID principles. Here are the links to the previous parts: Pat 1 — introduction Part 2 — SRP Part 3 — OCP Part 4 — LSP Part 5 — ISP (this post) Part 6 — DIP Part 7 — Conclusion ISP — Interface Segregation Principle “Make fine grained interfaces that are client specific” This principle speaks for itself… but anyway I’ll “translate” it… : It is better to create many small interfaces than…

tags: Bob Martin, Clean Code, Dependency Inversion Principle, DEV, DIP, Interface Segregation Principle, ISP, LSP, Object Oriented, OCP, Open-Close Principle, Single Responsibility Principle, SOLID, SRP, TDD, Unit Tests

no comments

TDD and the SOLID principles (Part 4 — LSP)

September 22, 2011

This is the 4th post in the series about TDD and its relationships with the SOLID principles. Here are the links to the other parts: Pat 1 — introduction Part 2 — SRP Part 3 — OCP Part 4 — LSP (this post) Part 5 — ISP Part 6 — DIP Part 7 — Conclusion The LSP (Liskov Substitution Principle) The principle (originally stated by Barbara Liskov in a more academic fashion), states that: FUNCTIONS THAT USE REFERENCES TO BASE CLASSES MUST BE ABLE TO USE OBJECTS OF DERIVED…

tags: Bob Martin, Clean Code, Code contracts, Dependency Inversion Principle, DEV, DIP, Interface Segregation Principle, ISP, LSP, Object Oriented, OCP, Open-Close Principle, Single Responsibility Principle, SOLID, SRP, TDD, Unit Tests

no comments

TDD and the SOLID principles (Part 3 — OCP)

September 7, 2011

Table of contents: Part1 — Indrocution Part 2 — SRP Part 3 — OCP (this post) Part 4 — LSP Part 5 — ISP Part 6 — DIP Part 7 — Conclusion The Open/Close Principle The Open/Close Principle states that: SOFTWARE ENTITIES (CLASSES, MODULES, FUNCTIONS, ETC.) SHOULD BE OPEN FOR EXTENSION, BUT CLOSED FOR MODIFICTION. This statement pretty much says it all, and naturally extends the Single-Responsibility principle: Classes (and functions, etc.) should be kept as simple as possible (having a single responsibility) and therefore should never have to change. Therefore, if you want to add functionality to your system you should add new code instead of changing existing one….

tags: Bob Martin, Clean Code, Composition, Dependency Inversion Principle, DEV, DIP, Essential Complexity, Interface Segregation Principle, ISP, LSP, Object Oriented, OCP, Open-Close Principle, Single Responsibility Principle, SOLID, SRP, Unit Tests

one comment

TDD and the SOLID principles (Part 2: SRP)

August 26, 2011

Table of contents: Part1 — Indrocution Part 2 — SRP (this post) Part 3 — OCP Part 4 — LSP Part 5 — ISP Part 6 — DIP Part 7 — Conclusion In the previous post I introduced the SOLID principles and their relation to TDD in general. And as promised, I’m diving into each of these principles and explain their relationships with TDD. The first principle, which I’ll be talking about in this post, is the Single Responsibility Principle or SRP in short. SRP is the…

tags: Bob Martin, Clean Code, Cohesion, Coupling, Dependency Inversion Principle, DEV, DIP, Interface Segregation Principle, ISP, LSP, Object Oriented, OCP, Open-Close Principle, Single Responsibility Principle, SOLID, SRP, TDD, Unit Tests

one comment

TDD and the SOLID principles (Part 1 — introduction)

Table of contents: Part1 — Indrocution (this post) Part 2 — SRP Part 3 — OCP Part 4 — LSP Part 5 — ISP Part 6 — DIP Part 7 — Conclusion Mastering TDD is a process that takes time. There are many pitfalls that “newbie’s” fall into. IMHO the following 2 reasons are the main ones: Thinking about the implementation before writing a test. That is, writing tests that are coupled with the implementation instead of with the problem…

tags: Backward Compatibility, Bob Martin, Clean Code, Cohesion, Composition, Coupling, Dependency Inversion Principle, Design, DEV, DIP, Duplication, Interface Segregation Principle, ISP, LSP, MS-Test, Object Oriented, OCP, Open-Close Principle, Single Responsibility Principle, SOLID, SRP, TDD, Unit Tests

2 comments

Is Bug-Free Software Possible (or, Who Afraid of Change?)

August 11, 2011

Introducing a new methodology in an organization is an investment. As with all investments, you first see what you give up, and only later see what you get. As humans (and as any biological creature), it’s against our instincts, because the future is always more vague than the present, and so any investment feels like a risk (and in fact, it is always a risk, to some degree). Because investments are against our nature, we tend to make only small improvements to our existing practices. And because we’re afraid of big changes, we convince ourselves that our problems…

tags: Acceptance Tests, Agile, ATDD, BDD, Bugs, Clean Code, DEV, Fitnesse, TDD

no comments

Introduction to FitNesse

August 2, 2011

No, I’m not going to tell you that fitness is very important to your health. I’ll leave it that your doctor. What I’m going to tell you about today is a tool called FitNesse (note the final ‘e’ which doesn’t exist in the word “fitness”. I don’t know what’s the reason they added this ‘e’ to the name, but it makes it somewhat easier to search for “FitNesse” in Google and get relevant results). Anyway, last time I told you mostly everything you need to know about ATDD, but I also promised to tell you about FitNesse, which…

one comment

ATDD Explained

July 26, 2011

In few of my previous posts I mentioned ATDD (and a related tool called FitNesse), but I never really explained what it is, and how it works. So here I go: ATDD stands for Acceptance Test Driven Development. ATDD is somewhat related to TDD (Test Driven Development), but there are also some key differences (see this comparison). In my opinion, it is best to use both techniques together, as each has its own benefits. ATDD is an agile development methodology (complementary to SCRUM or any other agile methodology), which puts the focus on the customer requirements and…

tags: Acceptance Tests, Agile, ATDD, BDD, Clean Code, DEV, Fitnesse, introduction, TDD, Unit Tests, User Stories

2 comments

Understanding One to Many relationships in NHibernate

July 12, 2011

One to many relationships in a relational model is probably the most common kind of relationship used in a relational database. Typically, the table in the “many” side of the relationship contains a special column in which each row contains the Id of the corresponding row in the table at the ‘one’ side. Even though this is very straight-forward in the relational database model, there are many nuances as how to map it to the object-oriented model. These nuances confuses many developers, especially those new to NHibernate. In this post I’ll try to explain each of these…

tags: DEV, hibernate-mapping.xsd, NHibernate, parent/child relationships

59 comments

A glimpse into “NHibernate — data access made easy!” workshop at Expert Days

June 29, 2011

Expert Days is just around the corner (July 10, in case you forgot…), and I’m super excited toward my workshop “NHibernate — data access made easy!”. In case you haven’t heard of NHibernate yet, this is a the most successful, powerful and yet pretty easy-to-use open-source ORM technology for .Net. ORM stands for Object/Relational Mapping, and in short it means that it bridges the gap between your object-oriented business-logic layer and the relational database. It has many benefits, including: 1. It saves you a lot of time and money, because most of the DAL is implemented for you! (and it’s…

tags: DEV, Expert Days, NHibernate, presentation

no comments

Register to “NHibernate — data access made easy!” and get 20% off!

June 5, 2011

1: using E4D.ExpertDays; 2: 3: public void Get20PercentsDiscountForNHibernateWorkshop() 4: { 5: ReadMyPreviousBlogPost(); 6: if (you.WantToRegister(“NHibernate — data access made easy!”) 7: && you.WantADiscountOf(20).Percents) 8: { 9: OnRegistration += () => 10: { 11: Specify(“Arnon sent me :-)”);…

tags: Expert Days, NHibernate

no comments

Come meet me at Expert Days!

June 3, 2011

:בואו לפגוש אותי ב עורכת את הכנס השנתי למקצועני טכנולוגיות מייקרוסופט. השנה הכנס E4D גם השנה יתקיים בפארק אזורים, פ”ת בין התאריכים 10–14 ליולי ויכלול למעלה מ-35 סנדאות של יום שלם שיועברו ע”י 21 מרצים המומחים בתחומם! בכנס תוכלו למצוא סדנאות במגוון מסלולים המיועדים למפתחים, ראשי צוותים, ארכיטקטים ובודקי תוכנה. כך לדוגמא נכללים בכנס סדנאות בנושאים הללו: … ועוד.NET , Dynamic CRM, AZURE, WCF, Silverlight, Windows Phone 7 אני אעביר השנה את הסדנא: NHibernate — Data access made easy! .net-שהוסבה ל Open-Source זוהי טכנולוגיית ,NHibernate למי מכם שעוד לא שמע על בצורה Database-לבין ה Business Logic-ומאפשרת לגשר על הפער שבין ה Java-מעולם הdata-access-בשכבת ה “plumbing…

tags: DEV, Expert Days, NHibernate

no comments

AOP with PostSharp

March 30, 2011

Recently I listened to show #640 of .Net rocks on which Carl and Richard talk with Gael Fraiteur about PostSharp and AOP in general. In the past I heard about AOP (Aspect Oriented Programming), but it was in the context of AspectJ which is for Java, and in general it appeared to me more of an academic or esoteric thing rather than something I really like to try and even actually use it. But that show raised my interest in that subject a lot and so I took a look at the PostSharp website which contains very clear explanations…

tags: .Net rocks, AOP, Aspect Oriented Programming, Aspects, C#, Clean Code, Cross-cutting concerns, DEV, introduction, Object Oriented, PostSharp, Separation of Concerns

no comments

TDD and multi-threading

March 28, 2011

According to good TDD practices a test should describe (and eventually test) a behavior and not the implementation. Because of that, one thing that is tricky to do in TDD is to write tests for a multi-threaded component. One can argue that multi-threading is a non-functional requirement, and therefore shouldn’t be covered by behavior tests, but only by load-tests. I don’t subscribe to this approach for few reasons: As I’ll show below, it is possible to describe a multi-threaded problem as a functional requirement. Load tests are non-deterministic Load tests usually take long to run, and therefore aren’t being run very…

tags: BDD, DEV, Mutlithreading, TDD, Threads, Unit Tests

no comments

hibernate-mapping.xsd with comments is ready!

February 27, 2011

Hi! As I promised in an earlier post, I’m publishing the hibernate-mapping.xsd to which I’ve added the documentation, and you’re the first to know! So now you can enjoy IntelliSense tooltips while your editing your *.hbm.xml files, like this: I’m trying to contact NHibernate owners in order to submit this to the official NHibernate source files, but I’m still waiting for their response. In the mean time, you can be the first to enjoy it by downloading it from the link below.

tags: DEV, hibernate-mapping.xsd, IntelliSense, NHibernate, tooltips, Visual Studio, xsd

4 comments

Comparing TDD with ATDD

February 14, 2011

In the project I’m working on right now we’re using FitNesse as a core part of our development process and I found it very useful. FitNesse is a wiki-like tool that provides the ability to define tests (and run them) by writing them in a special mark-up language, rather than in a programming language. This is usually best for describing user-stories (rather than low-level unit-tests), and therefore this approach is often referred to as “Acceptance Test Driven Development” or shortly ATDD. Note: other tools (like Cucumber and SpecFlow) refer to a similar approach…

tags: Acceptance Tests, Agile, ATDD, BDD, DEV, Fitnesse, Single Responsibility Principle, SRP, TDD, Unit Tests, User Stories

2 comments

About TDD, Clean Code and the Single Responsibility Principle

February 3, 2011

Hi again, I’m programming for over 15 years as a profession, in additional to about 10 years as a hobby before that. One thing I like about this profession is that you keep learning new things every day. However, only rarely you have a true “enlightenment” which really changes the way you write code. Few days I ago I had one! I first heard about TDD about 7 years ago but it took me some more years to really grasp it…

no comments

“Introduction to NHibernate” presentation and demo

January 30, 2011

Last week I presented a lecture about NHibernate to the .Net division of E4D Solutions. Now all of you can download the presentation and the demo sources (attached to this post). The zip file contains: NHibernteDemo.pptx — this is the PowerPoint presentation. NHibernateTest.mdf — this is the database used for the demo. Attach this database to your local SQL Server. 6 folders containing the demo sources split into stages. The solutions are for VS2010 and contain 2 projects: Client and BusinesLogic. Note that the Client are the same for all stages and only the BusinessLogic projects are changed. Notes: If you don’t have NHibernate binaries you…

tags: demo, DEV, introduction, NHibernate, presentation

no comments

Tip of the day for NHibernate #2: show_sql and format_sql

January 19, 2011

As always with tips, either you already know this or it would be invaluable. This time I’m talking about 2 configuration properties: “show_sql” and “format_sql”. To switch on these options, add the corresponding lines to your hibernate.cfg.xml file as in the following example: <?xml version=”1.0" encoding=”utf-8" ?> <hibernate-configuration xmlns=”urn:nhibernate-configuration-2.2"> <session-factory> <property name=”connection.connection_string”>Data Source=.;Initial Catalog=NHibernateDemo;Integrated Security=True</property> <property name=”dialect”>NHibernate.Dialect.MsSql2005Dialect</property> <property name=”proxyfactory.factory_class”>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property> <property name=”show_sql”>True</property> <property name=”format_sql”>True</property> <mapping assembly=”BusinessLogic”/> </session-factory> </hibernate-configuration> What is does? The “show_sql” property tells NHibernate to output all the SQL statements it executes onto the console. This way you can see exactly what…

tags: DEV, nhiberbnate-configuration, NHibernate, Visual Studio

one comment

Tip of the day on NHibernate: IntelliSense for the hbm files

January 11, 2011

If you’re using NHibernate and writing your NHibernate mapping files (*.hbm.xml) by hand, (as opposed to using Fluent NHibernate for example), then you’ll probably be interested in the following tip (unless you already done that :-) ) You can have IntelliSense validation and auto-completion in the XML editor for NHibernate xml files (both the *.hbm.xml and hibernate.cfg.xml) by following the following steps: 1. Inside VS, select XML->Schemas. 2. Click “Add…” 3. Browse to the “Required_bins” folder inside of your NHibernate folder (e.g. “C:\Nhibernate3.0\Required_bins”) 4. Select both “nhibernate-configuration.xsd” and “nhibernate-mapping.xsd” file and click “Open”. The 2 schemas will be added to the list: 5. Click OK…

tags: DEV, NHibernate, Visual Studio, xsd

no comments

Taking OO with C# to the extreme: decoupling from the basic value types

December 28, 2010

Hi, Did it ever happen to you that you hit a problem that you couldn’t solve, and even you’re convinced that it’s impossible, but then just by telling about it to someone you find the solution? I’m sure you did, it happens a lot. A boss I once had used to call this phenomenon “talking to a glass of water”: it would as well be a glass of water that you’re talking to for finding the answerJ Anyway, the reason I’m talking about this phenomenon is that I started to write this post with the following title: Frustrating limitations of C# with…

tags: C#, DEV, generics, Object Oriented, operator overloading, value types

2 comments

Debugging Fitnesse User Stories

December 21, 2010

In the recent project I’m working on we’re using Fitnesse, which is a very nice acceptance testing framework. Probably because Fitnesse was aimed initially at Java developers, it doesn’t have a very good integration story with VS. The main problem is revealed when you try to debug a User Story, because there isn’t a “debug” button in Fitnesse. When you run a Fitnesse user story it invokes a new process (called Runner.exe) which calls your code, and finished very quickly, which makes it practically impossible to attach to it. The way other people in the team worked before I came…

tags: Debug, DEV, Fitnesse, Visual Studio

2 comments

Elegant solution for the recursive iterator

December 21, 2010

Update: I attached the sources to this post. Hi again,As I mentioned in the earlier post, while I wrote it I realized that even though I can use recursive iterators, I must iterate though all the “child” elements from the parent iterator, which makes the algorithm less efficient (e.g. O(n*logn) instead of O(n)). On the other hand, when I tried to write the same algorithm without recursion I ended up in a pretty cumbersome and ugly code compared to the recursive version. I didn’t see a good reason why the C# design team couldn’t make it possible to “yield” another enumerator….

tags: Binary trees, C#, DEV, Iterators, recursion, yield return

2 comments

Traversing binary tree using an iterator

IteratorsTest.zip BinaryTreeIterator.zip BinaryTreeIterator2.zip This time I’m willing to explain a feature of C# that exists since version 2.0, but even though I find that many developers are either not familiar with, or don’t feel comfortable with, mainly because they don’t fully understand how it works. This feature is called iterators. I’m talking about these methods that return IEnumerator (or IEnumerator<T>, or IEnumerable or IEnumerable<T>) and use the yield return keyword. Another reason to explain this feature is that it is used extensively in Linq, and understanding how it works will allow you to use Linq better. …

no comments

Creating ASP.Net CustomValidators that automatically creates the client-side (javascript) validation functions using expression trees — Part 2

Hi everyone! Last time I showed how you can use Expression Trees to create Custom Validators in ASP.Net that automatically generates the JavaScript code for the client-side validation. But there was one part I didn’t get into details and promised to explain it in the next post (this one), and that was how to translate specific methods and properties from C# to JavaScript. Of course that we could go with a trivial solution that simply maps the method and property names as strings, but that would have several disadvantages: The arguments of the method in C# may not match exactly those of…

tags: Asp.net, CustomValidator, DEV, Expression trees, Lambda expression

no comments

Creating ASP.Net CustomValidators that automatically creates the client-side (javascript) validation functions using expression trees

Hi everyone! This is my first blog and my first post ever, so wish me luck Recently I started to learn ASP.Net from a book, and I reached the topic that discusses the various Validators, including CustomValidator. I was disappointed to find that when you create a CustomValidator you must create both the client script and the server script manually, even though normally you want them to evaluate exactly the same expression. Of course that’s a problem because in the client side the function should be written in JavaScript, while in the server it will be in C#, and…

tags: Asp.net, CustomValidator, DEV, Expression trees, Lambda expression

2 comments

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade