F# refactoring
possibilities
BASIC REFACTORINGS THAT I WOULD LIKE TO HAVE IN VISUAL STUDIO IDE
Purge tuples



Which is cleaner? It depends.



This is just a matter of clean code.



Also needed: Rename a variable...
Move discriminated union to subtype



Usually coder starts with the first one…



But the data (string*int) is so much ...
Convert to immutable



Usually you need either all or just one property to be changed to
immutable/mutable
Pattern match to If-else



Usually in case of booleans (or when-patterns)



Back-conversion not possible, if left-hand...
Move function parameters
Move List, Seq or Array conversion
in composition
Extract Function-Composition
Extract to active pattern



Longer code but sometimes better visibility of business logic intentions.
Convert to Option-module



Option-module (bind, map, etc.) could be used more…



One step more would be List-module to...
Strip un-used computation
expression wrapping



Just minor cleanup if Async (or other monads) are not really used to bin...
Basic object-oriented features



Generate a base class (and move some methods to there)



Create and/or Implement inte...
Simple pattern/snippet to make a
simple MailboxProcessor



So that user doesn’t have to remember the whole syntax



Or...
Upcoming SlideShare
Loading in …5
×

Possible FSharp Refactorings could be...

858 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
858
On SlideShare
0
From Embeds
0
Number of Embeds
135
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Possible FSharp Refactorings could be...

  1. 1. F# refactoring possibilities BASIC REFACTORINGS THAT I WOULD LIKE TO HAVE IN VISUAL STUDIO IDE
  2. 2. Purge tuples  Which is cleaner? It depends.  This is just a matter of clean code.  Also needed: Rename a variable/function/parameter
  3. 3. Move discriminated union to subtype  Usually coder starts with the first one…  But the data (string*int) is so much easier to access in the later one!  Even later, it may not be clear that what sub-types belongs to where in the type hierarchy
  4. 4. Convert to immutable  Usually you need either all or just one property to be changed to immutable/mutable
  5. 5. Pattern match to If-else  Usually in case of booleans (or when-patterns)  Back-conversion not possible, if left-hand-side compare condition is not the same
  6. 6. Move function parameters
  7. 7. Move List, Seq or Array conversion in composition
  8. 8. Extract Function-Composition
  9. 9. Extract to active pattern  Longer code but sometimes better visibility of business logic intentions.
  10. 10. Convert to Option-module  Option-module (bind, map, etc.) could be used more…  One step more would be List-module to recursion, or recursion to fold
  11. 11. Strip un-used computation expression wrapping  Just minor cleanup if Async (or other monads) are not really used to bind any data to computation
  12. 12. Basic object-oriented features  Generate a base class (and move some methods to there)  Create and/or Implement interface  So that user doesn’t have to remember interface-syntax
  13. 13. Simple pattern/snippet to make a simple MailboxProcessor  So that user doesn’t have to remember the whole syntax  Or a way to convert existing list/dictionary to a MailboxProcessor…

×