Search Results

Search found 1837 results on 74 pages for 'act'.

Page 17/74 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Liskov Substitution Principle and the Oft Forgot Third Wheel

    - by Stacy Vicknair
    Liskov Substitution Principle (LSP) is a principle of object oriented programming that many might be familiar with from the SOLID principles mnemonic from Uncle Bob Martin. The principle highlights the relationship between a type and its subtypes, and, according to Wikipedia, is defined by Barbara Liskov and Jeanette Wing as the following principle:   Let be a property provable about objects of type . Then should be provable for objects of type where is a subtype of .   Rectangles gonna rectangulate The iconic example of this principle is illustrated with the relationship between a rectangle and a square. Let’s say we have a class named Rectangle that had a property to set width and a property to set its height. 1: Public Class Rectangle 2: Overridable Property Width As Integer 3: Overridable Property Height As Integer 4: End Class   We all at some point here that inheritance mocks an “IS A” relationship, and by gosh we all know square IS A rectangle. So let’s make a square class that inherits from rectangle. However, squares do maintain the same length on every side, so let’s override and add that behavior. 1: Public Class Square 2: Inherits Rectangle 3:  4: Private _sideLength As Integer 5:  6: Public Overrides Property Width As Integer 7: Get 8: Return _sideLength 9: End Get 10: Set(value As Integer) 11: _sideLength = value 12: End Set 13: End Property 14:  15: Public Overrides Property Height As Integer 16: Get 17: Return _sideLength 18: End Get 19: Set(value As Integer) 20: _sideLength = value 21: End Set 22: End Property 23: End Class   Now, say we had the following test: 1: Public Sub SetHeight_DoesNotAffectWidth(rectangle As Rectangle) 2: 'arrange 3: Dim expectedWidth = 4 4: rectangle.Width = 4 5:  6: 'act 7: rectangle.Height = 7 8:  9: 'assert 10: Assert.AreEqual(expectedWidth, rectangle.Width) 11: End Sub   If we pass in a rectangle, this test passes just fine. What if we pass in a square?   This is where we see the violation of Liskov’s Principle! A square might "IS A” to a rectangle, but we have differing expectations on how a rectangle should function than how a square should! Great expectations Here’s where we pat ourselves on the back and take a victory lap around the office and tell everyone about how we understand LSP like a boss. And all is good… until we start trying to apply it to our work. If I can’t even change functionality on a simple setter without breaking the expectations on a parent class, what can I do with subtyping? Did Liskov just tell me to never touch subtyping again? The short answer: NO, SHE DIDN’T. When I first learned LSP, and from those I’ve talked with as well, I overlooked a very important but not appropriately stressed quality of the principle: our expectations. Our inclination is to want a logical catch-all, where we can easily apply this principle and wipe our hands, drop the mic and exit stage left. That’s not the case because in every different programming scenario, our expectations of the parent class or type will be different. We have to set reasonable expectations on the behaviors that we expect out of the parent, then make sure that those expectations are met by the child. Any expectations not explicitly expected of the parent aren’t expected of the child either, and don’t register as a violation of LSP that prevents implementation. You can see the flexibility mentioned in the Wikipedia article itself: A typical example that violates LSP is a Square class that derives from a Rectangle class, assuming getter and setter methods exist for both width and height. The Square class always assumes that the width is equal with the height. If a Square object is used in a context where a Rectangle is expected, unexpected behavior may occur because the dimensions of a Square cannot (or rather should not) be modified independently. This problem cannot be easily fixed: if we can modify the setter methods in the Square class so that they preserve the Square invariant (i.e., keep the dimensions equal), then these methods will weaken (violate) the postconditions for the Rectangle setters, which state that dimensions can be modified independently. Violations of LSP, like this one, may or may not be a problem in practice, depending on the postconditions or invariants that are actually expected by the code that uses classes violating LSP. Mutability is a key issue here. If Square and Rectangle had only getter methods (i.e., they were immutable objects), then no violation of LSP could occur. What this means is that the above situation with a rectangle and a square can be acceptable if we do not have the expectation for width to leave height unaffected, or vice-versa, in our application. Conclusion – the oft forgot third wheel Liskov Substitution Principle is meant to act as a guidance and warn us against unexpected behaviors. Objects can be stateful and as a result we can end up with unexpected situations if we don’t code carefully. Specifically when subclassing, make sure that the subclass meets the expectations held to its parent. Don’t let LSP think you cannot deviate from the behaviors of the parent, but understand that LSP is meant to highlight the importance of not only the parent and the child class, but also of the expectations WE set for the parent class and the necessity of meeting those expectations in order to help prevent sticky situations.   Code examples, in both VB and C# Technorati Tags: LSV,Liskov Substitution Principle,Uncle Bob,Robert Martin,Barbara Liskov,Liskov

    Read the article

  • Writing the tests for FluentPath

    Writing the tests for FluentPath is a challenge. The library is a wrapper around a legacy API (System.IO) that wasnt designed to be easily testable. If it were more testable, the sensible testing methodology would be to tell System.IO to act against a mock file system, which would enable me to verify that my code is doing the expected file system operations without having to manipulate the actual, physical file system: what we are testing here is FluentPath, not System.IO. Unfortunately, that...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Making the Grade

    - by [email protected]
    Education Organizations Learn the Advantages of Oracle Today, K-12 school districts and state agencies nationwide have billions of reasons to come to Oracle OpenWorld 2010. Ever since the American Recovery and Reinvestment Act of 2009 set aside US$100 billion for education, schools have been eager to develop and implement statewide data systems to enhance workflow. And across the country, they've been turning to Oracle for help. According to a recent news release, Oracle already makes the grade. The Los Angeles Unified School District--the nation's second largest district--chose Oracle Business Intelligence Suite, Enterprise Edition Plus to help teachers keep track of student performance. Other educational organizations, including Fairfax County Public Schools and the North Carolina Department of Public Instruction, are also working with Oracle to improve their systemwide procedures. If you're an educator or administrator who is planning to optimize your school or agency data systems, this may be the best time to learn what Oracle can do help ensure success. Register for Oracle OpenWorld 2010 between now and July 16 and you'll save US$500 off registration.

    Read the article

  • How do I handle 3rd party search result data (via cache)

    - by reikyoushin
    I have a search function on my site and it is taking data from 6 different 3rd party resources. The problem is, it takes too long requesting the data over and over again on the results page. I've read for questions like this on SO about session not being a good choice but for me 'memcache' is not an option, because the server doesn't have memcached installed and I have no way to install it now. Is there any other approach to do this? Storing in the database seem inappropriate because the data depends on the search terms requested. What I've been thinking is writing a file on the server that would act as a cache for this file but I don't know how I would know when to delete it after.

    Read the article

  • Quote of the Day: A Credo

    - by BuckWoody
    To live content with small means, to seek elegance rather than luxury, and refinement rather than fashion, to be worthy, not respectable, and wealthy, not rich, to study hard, think quietly, talk gently, act frankly, to listen to stars and birds, to babes and sages, with open heart, to bear all cheerfully, do all bravely, await occasions, hurry never, in a word to let the spiritual, unbidden and unconscious, grow up through the common, this is to be my symphony. William Henry Channing Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • Free Web hosting for web applications

    - by Jairo
    Hi! Are there web sites that offers hosting of a web application that uses c++? I know that there are a lot of free web hosting solutions that offers hosting for regular web applications made with php, mysql, etc. I would like to upload a routing engine for my website. My application is a travel planner, and I have a custom routing engine that is made of c++. If there are free online Linux OS hosting that can act as a ordinary OS installation (which will be my best option), I would greatly appreciate if you can list them below. Thanks in advance.

    Read the article

  • keybinding issues with xmodmap across synergy

    - by Rick
    I've got two systems I use across Synergy. On the main one I have a normal keyboard that I swap caps lock and ctrl for. So I do: xmodmap -e 'keycode 66 = Control_L' xmodmap -e 'clear lock' xmodmap -e 'add Control = Control_L' Where keycode 66 is my caps lock key. The trouble is that I can't get this key to act as a control key on the other machine I connect to with synergy. The strange thing is that if I plug a keyboard into the machine, and run xev, the control key there is keycode 37. When I then hit my modified control key (keycode 66 on the master) it's registering as keycode 37 on the remote machine. So according to xev, it should be picking it up as a control keypress. Anyone have any hints on if Synergy is doing something overly helpful for me?

    Read the article

  • How do I set up a "gateway" for a specific subdomain?

    - by Mason Wheeler
    I'm looking at setting up a website that will run a few different apps. Most of them can be managed by an Apache server, but I've got one specific thing that will run on a custom HTTP server. Looking around on apache.org, it looks like you can use mod_proxy to configure Apache to act as a "reverse proxy" and forward requests from a specific subdirectory to a new server with the ProxyPass directive. So if I wanted send anything from mysite.com/special on to the custom server, that's how I would do it. But what if I want to set it up as a subdomain instead? The documentation doesn't seem to cover that. If, I wanted to make it forward anything from special.mysite.com to the new server, how would I set that up?

    Read the article

  • Web framework for IPad and common desktop browsers?

    - by Chris
    We are developing a web-based, commercial point-of-sale application. We'd like the same web site to work well on an Ipad as well a desktop browsers. We're looking for a web framework that makes the site look good on an IPad, but also makes the site work well in a desktop browser such as Chrome, IE, or Firefox on Windows or a Mac. I found quite a few at 18 Mobile Frameworks and Development Tools for Creating iPhone Apps Most of them, such as JQTouch, help a web site look and act more like a native IPhone application but they don't emphasize the cross platform/browser experience. The exception seems to be Sproutcore, which seems to be a full-fledged javascript MVC application framework. I did have trouble getting some of the demos to work under Chrome, but what did work looks good. What framework(s) have you actually used to develop web sites to work on an Ipad and desktop browser? If you didn't use a framework, how did you get it to work well under both environments?

    Read the article

  • Noting happens when I connect my Iphone to my laptop [closed]

    - by Allwar
    Possible Duplicate: Connect iPhone 3g to sync music and act as a mass storage device Hi, I know i can use banshee and libimobiledevice but that is the next step because nothing happens when I connect my Iphone my laptop doesn't realize that the usb port is beeing used! normally it comes up as a photo collection but now, nothing! What should i do? When I say normally I mean when I was using 10.10 I reinstalled a couple of weeks ago. I have an asus 1201n that runs ubuntu 10.04 desktop 64-bit, and I have an Iphone 3g.

    Read the article

  • How can I parse Amazon S3 log files?

    - by artlung
    What are the best options for parsing Amazon S3 (Simple Storage) log files? I've turned on logging and now I have log files that look like this: 858e709ba90996df37d6f5152650086acb6db14a67d9aaae7a0f3620fdefb88f files.example.com [08/Jul/2010:10:31:42 +0000] 68.114.21.105 65a011a29cdf8ec533ec3d1ccaae921c 13880FBC9839395C REST.GET.OBJECT example.com/blog/wp-content/uploads/2006/10/kitties_we_cant_stop_here_this_is_bat_country.jpg "GET /example.com/blog/wp-content/uploads/2006/10/kitties_we_cant_stop_here_this_is_bat_country.jpg HTTP/1.1" 200 - 32957 32957 12 10 "http://atlanta.craigslist.org/forums/?act=Q&ID=163218891" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19" - What are the best options for automating the log files? I'm not using any other Amazon services other than S3.

    Read the article

  • Self hosted Netvibes alternative [on hold]

    - by Jens
    I am looking for a self-hosted alternative to part of the Netvibes functionality. It should act as feed reader, show my mail inbox, a list of bookmarks and maybe the weather forecast. I wish to move away from Netvibes since I don't care to share my browsing habit, and certainly not my mail password, with another person or company. I am certainly willing to invest some time in setup, maybe up to writing a plugin for a solution that does not fulfill all my requirements. Dou you have suggestions on where to look?

    Read the article

  • Is it possible to use RubyGnome2's/QtRuby's HTML renderers to make UI for a Ruby script?

    - by mjr
    I'd like to make a graphical user interface for my script, instead of running it from the console. I'm aware there's a wealth of UI libraries for Ruby, but I'm quite familiar with HTML and CSS and I'd like to use them for building an interface. So the question is: Is it possible to use a HTML rendering library to make such an UI? From what I understand, it's relatively easy to put in a HTML rendered view of something, but is it possible to communicate back with the script? Like when I push that big red button, it actually tells the script to act on it? Obviously it's possible if the script run on the server side, but I'd like to run it as a desktop application.

    Read the article

  • A Method for Reducing Contention and Overhead in Worker Queues for Multithreaded Java Applications

    - by Janice J. Heiss
    A java.net article, rich in practical resources, by IBM India Labs’ Sathiskumar Palaniappan, Kavitha Varadarajan, and Jayashree Viswanathan, explores the challenge of writing code in a way that that effectively makes use of the resources of modern multicore processors and multiprocessor servers.As the article states: “Many server applications, such as Web servers, application servers, database servers, file servers, and mail servers, maintain worker queues and thread pools to handle large numbers of short tasks that arrive from remote sources. In general, a ‘worker queue’ holds all the short tasks that need to be executed, and the threads in the thread pool retrieve the tasks from the worker queue and complete the tasks. Since multiple threads act on the worker queue, adding tasks to and deleting tasks from the worker queue needs to be synchronized, which introduces contention in the worker queue.” The article goes on to explain ways that developers can reduce contention by maintaining one queue per thread. It also demonstrates a work-stealing technique that helps in effectively utilizing the CPU in multicore systems. Read the rest of the article here.

    Read the article

  • Continuous integration - build Debug and Release every time?

    - by Darian Miller
    Is it standard practice when setting up a Continuous Integration server to build a Debug and Release version of each project? Most of the time developers code with a Debug mode project configuration set enabled and there could be different library path configurations, compiler defines, or other items configured differently between Debug/Release that would cause them to act differently. I configured my CI server to build both Debug & Release of each project and I'm wondering if I'm just overthinking it. My assumption is that I'll do this as long as I can get quick feedback and once that happens, then push the Release off to a nightly build perhaps. Is there a 'standard' way of approaching this?

    Read the article

  • Accessibility Update: The Oracle ETPM v2.3 VPAT is now available on oracle.com

    - by Rick Finley
    Oracle Tax is committed to building accessible applications.  Oracle uses a VPAT (Voluntary Product Accessibility Template) to document the accessibility status of each product.  The VPAT was created by a partnership of the Information Technology Industry Council (ITI) and the U.S. General Services Administration (GSA) to create a simple document that could be used by US Federal contracting and procurement officials to evaluate a product with respect to the provisions contained in Section 508 of the Americans with Disabilities Act (ADA). The Oracle ETPM v2.3 VPAT is now available on oracle.com:  http://www.oracle.com/us/corporate/accessibility/templates/t2455.html    

    Read the article

  • Is Google showing ads from other companies or WordPress plugin is injecting ads which are not mine?

    - by Hafiz
    I am using WordPress for managing my blog sort of website, and I am using an Ad Injection plugin to place my ads where I want in a post. Plugin seems very good but I saw some ads which were not from ads networks which I was using. Now I have injected Google ads leaderboard at some place but I saw advertisement from this advertiser: http://www.adroll.com/about/privacy?utm_source=evidon&utm_medium=AdChoices&utm_campaign=privacy%2Bpolicy So I want to know whether ad injecting plugin is doing some trick or Google use ads from other networks too? Let me know so I can act accordingly and all good responses will be appreciated.

    Read the article

  • A better way to do concurrent programming

    - by Alex.Davies
    Programming to take advantage of multicore processors is hard. If you let multiple threads access the same memory, bad things happen. To avoid this, you use the lock keyword, but if you use that in the wrong way, your code deadlocks. It's all a nightmare. Luckily, there's a better way - Actors. They're really easy to think about. They're really safe (if you follow a couple of simple rules). And high-performance, type-safe actors are now available for .NET by using this open-source library: http://code.google.com/p/n-act/ Have a look at the site for details. I'll blog with more reasons to use actors and tips and tricks to get the best parallelism from them soon.

    Read the article

  • Java SE 7 Developer Preview Release - Download Now!

    - by ruma.sanyal
    The JDK7 Developer Preview Release is now available for rigorous community testing. But time is running out! The latest build is feature complete, stable and ready to roll - so download, test and report bugs now. Let us know what you think. If you report a bug in the JDK 7 developer preview before April 4th, the Java product team will sing your praises on the Java SE 7 Honor Role. PLUS... we will send you some Java swag. We'll read, evaluate, and act on all feedback received via the usual bug-reporting channel. Bugs reported later on might not get ?xed in time for the initial release, so if you want to be a contributor to Java SE 7 do it before the April deadline.

    Read the article

  • Should testers approve releases, or just report on tests?

    - by Ernest Friedman-Hill
    Does it make sense to give signoff authority to testers? Should a test team Just test features, issues, etc, and simply report on a pass/fail basis, leaving it up to others to act on those results, or Have authority to hold up releases themselves based on those results? In other words, should testers be required to actually sign off on releases? The testing team I'm working with feels that they do, and we're having an issue with this because of "testing scope creep" -- the refusal to approve releases is sometimes based on issues explicitly not addressed by the release in question.

    Read the article

  • Recommended language and IDE for simple linux application [on hold]

    - by niklon
    I want to write a simple program on Debian with Gnome. Application will act as a side bar, giving simple information on online servers statuses. I preferably have a black transparent background(Terminal-like). I'm asking this question because I was previously writing programs in .NET C# for myself, and now I don't want to get to Mono, but something more conventional. What language should I choose for this task? What would be the recommended way to do it?(eg. what IDE)

    Read the article

  • Are you ready for the needed changes to your Supply Chain for 2013?

    - by Stephen Slade
    With the initiation of the Dodd-Frank Act, companies need to determine if their products contain 'conflict materials' from certain global markets as the Rep of Congo. The materials include metals such as gold, tin, tungsten and tantalum. Compaines with global sourcing face new disclosure requirements in Feb'13 related to business being done in Iran. Public companies are required to disclose to U.S. security regulators if they or their affiliates are engaged in business in Iran either directly or indirectly.  Is your supply chain compliant?  Do you have sourcing reports to validate?  Where are the materials in your chips & circuit boards coming from? In the next few weeks, responsible companies will be scrutinizing their supply chains, subs, JVs, and affiliates to search for exposure. Source: Brian Lane, Atty at Gibson Dunn Crutcher, as printed in the WSJ Tues, Dec 11, 2012 p.B8

    Read the article

  • Actions and Controllers managing strategy in MVC apps

    - by singleton
    Can anyone name any usefull strategy/architectural pattern for allocating actions between different controllers when using MVC pattern for developing web application? I am now developing web app using asp.net Mvc3 framework and still can't figure out how to manage actions and controllers. One approach is to create single action controller for each url, but it's not the best choice since to much controllers have to be created. Should I list all available urls that are supported by me web app, devide them into groups and create separate controller for each group or act in any different manner? It seems like I will become face to face with some kind of mess with no consistent approach in managing actions and controllers.

    Read the article

  • Is there value in having technical authors in a software team?

    - by Desolate Planet
    During my 5 years in IT as a software developer, I've noticed that developers have a strong distaste towards doing any documentation. The act of taking screenshots and creating documentation seems to be a painful and time consuming experience. In one company I worked for, we had a technical documentation team with two technical authors and they developed all the user guides for our customers. In other companies where I've suggested hiring a technical author, I've been told they are not worth the money, but I'm a little unsure if that rings true. Is it better to have developers stop coding and take half a day to do screenshots and create the various guides or is it worth hiring someone who handles such tasks?

    Read the article

  • Collaboration between client, web designer, and web developer

    - by Alex
    I am primarily a Web Developer (back end programming) - but intend to offer a complete service to my clients, from concept, to brand design, photoshop mock-ups and everything else in between. I'm aware that it's a good idea to outsource this design aspect of the project to someone that I trust. My question is more about the process: I imagine that in order for the designer to really grasp what the client wants to create, they would need some sort of interaction. Therefore, does anyone know if it is common to bring both parties into a 3 way discussion? Or is it more common to get all of the info from the client, and then pass it onto the designer, and act as a back and forth middleman? Afterall, I am the designer's client. Any insight into this would be great

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >