Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

July 18, 2016

Personal current trends on software development



Most productive development environment (server-side):
Most productive web development environment (single-page applications):
 Most productive mobile development environment:
Most interesting programming model:
Most useful getting-things-done tool:

January 15, 2016

A new perspective

From time to time you get used to the environment you work with, you feel confident about what you do and you think that your approaches are kind of safe an standard.

That is something really naive for someone who is a developer, I have been/I am that person. During my first programming years I was exposed to Java and C++, these were the door-openers for my to the entire programming world.

I have set my expectations around the way these environments, and for a long time I thought that I was right in investing time and effort into making myself an expert on them. But then after a while, after some rough corners and rusted code I have thought to myself 'there must be a different way'.

And of course we have the Internet of things to ask for opinions, and that I did, and what a wonderful world I have found after that.

In my point of view, programming is much more like carpentry, there are tools to do the work, there are different kinds of wood, there are different kinds of furniture, and you can do many things with a different combinations.



As you might know carpenters have different styles and tools depending on how they learned to do their job, and I think of programming in a similar way, we do have really different ways to do things. And we should better know the most we can in order to make a decision.

So, to make it short, here are some programming languages that I would suggest you to learn (but learn, not just try, learn to the core by doing something with them):
  • Ruby: You will get a whole new mindset about programming and problem solving, it combines metadata-based programming, imperative programming and functional programming.
  • Go-lang: This is more than a language, is a whole environment that provides a practical and really simple programming experience.
  • Clojure: Still learning this, but is so much different to what I normally use that I'm really having my brain twisted backwards.

January 6, 2016

A strange path in development



During the time I've being a software developer there are many things that I noticed in my personal growth as a programmer, I can quickly list the following phases/periods:
  • Beginner: You do have notions for programming, but write awful code.
  • User: You start writting better code, you also see your previous mistakes.
  • Experienced: You know the ground, and you are comfortable with it.
And the interesting thing about these phases is that are technology/language/paradigm based. What I mean with this is that you cycle through these phases every time you learn something new (at least in programming, in my personal case).

First I learned structured programming, then object-oriented programming, then aspect-oriented programming, then functional-programming, then DCI. All of them in a different set of technologies and tools that completely changed what I thought I knew about programming. This is a learning pattern of mine that I know it works, every time I try to learn something new I know that these phases are going to be in the way.

I kind of know now how I learn, and I can do something about it. Now it's simpler to learn something new, and at the moment this new thing is LISP via Clojure, not sure what is gonna happen, but I can tell you that my brain is breaking old rules every week.

I think that's the message for this post, know how you learn, then kick the shit out of your brain.

December 8, 2012

Coding journal - Scala's Hello world

I'm learning Scala as part of my masters thesis and every day I find something new that gets me more and more interested about this language.

As I'm a technical guy I enjoy seeing things working, so hands down on the keyboard. Obviously the first attempt I do for any programming language is the classic Hello World.



They both compile to Java bytecode and work exactly the same, but I have to add some remarks on the few code I wrote:
  • There are no static things in Scala, they've been replaced by Singleton objects.
  • No semicolons, even though they are optional, it's kind of verbose.
  • I'm passing a function as a parameter, wow, that's powerful and much less verbose.
  • Those loops are awesome....
  • Much, but much less verbose.
In summary, with this stupid code I've seen how powerful can Scala be without having to give up all the knowledge I have about Java, its compatible and they can coexist together.

So, give it a try...

August 5, 2012

Development tips

I've worked in some projects so far and I learned some things that can save you a lot of time even if they sound very expensive. These tips are meant for small/medium size projects, perhaps you can apply them to big projects, but I'm not sure.


  1. Revision control system from the beginning.
  2. Define your goals and milestones, even without dates.
  3. Define what you are going to build, with use cases or user stories, or just use whatever you feel comfortable with.
  4. Define an architecture, don't go on without this. The architecture must define the form of the system, not the details.
  5. Define the contexts you are going to be working on, this means that you have to separate your project into smaller micro-projects (if it applies).
  6. Define your frameworks/libraries stack.
  7. Define your project(s) structure, this involves folders and files.
  8. Define your automated build scripts, something like Gradle would do it.
  9. Think in the tests before the implementation, if it's testable, it's implementable.
  10. Use continuous integration from the beginning.
  11. Keep you source files small and readable.
  12. Periodically check your system and update the architecture if some changes have been made.
I omitted several things, but I consider these the most important from a developer's perspective.

I didn't have this information at the beginning because I was too lazy to read about it, and had to learn it the hard way, by suffering the consequences...

May 23, 2012

Ant and Maven, a brief comparison

I've been working for the last three years and during this period of time the projects I've been involved with have the same discussion:

which build tool should I use?...and the most common answers were...Ant and Maven

You can check some statistics to see which one is going to rule the market, honestly I think Ant will never leave.



But I must say that there's a very important difference between Ant and Maven, Ant is task-oriented with the possibility of handling project-related configurations. And Maven is project-oriented with the possibility of handling task-related configurations.

Considering that, I have these questions that might help you to decide between the right tool:

Maven


  1. Do you need to keep standard project structures?
  2. Do you want to avoid manual tasks/steps?
  3. Do your projects have dependencies to another projects/libraries/frameworks?
  4. Do you have a fairly good Internet connection?
  5. Do you like to follow the Convention over configuration way?
Ant


  1. Do your projects are very different one from another?
  2. Do your projects have very different structures?
  3. Do you customize your projects so they behave in a very specific way?
  4. Do you already have a tight workspace structure that doesn't fit in the Maven world?
  5. Do you need to have full control over what your projects do?
Some of these questions might be incorrect, but those are the ones coming to my head right now, so feel free to use them or not.

May 15, 2012

Generic actions model

Have you ever tried to install something in a Linux distribution and have struggled with a dependency manager? such as DEB, RPM, PACMAN?

Dependency graph


I have a love/hate relationship with these models, sometimes they save my day, but some others are really, but really hard to deal with.

In software development you will find such scenarios, where you have something to do, and that thing will require another thing... and so on.

I mapped this model about a generic rule-dependency model:


  • Action: Component doing some kind of work. All the dependencies are one-side oriente, and each dependency can have many other dependencies.
  • ActionsRepository: A collection of sorted actions by any kind of criteria. Normally not allowing duplicated actions.
  • ActionsExecutor: Component in charge of iterate and execute the actions.

May 12, 2012

TDD helps you find the way...when you are lost

There are times when you start a project, and you understand exactly what it has to do, you know the inputs, and the outputs. You might know even some of the inner logic in between, but you can't get your head around it.

That is, not to know how to do it. Not to know where to start from and where you are targeting to. This problem arises almost always you are dealing with something new, something you have never done before and perhaps have ever seen.

That's been the case for me in some projects I've worked on, some times it took me a while to get the right idea, after hours/days/weeks struggling with the logic and the results verification.

In my first days, I would do the verifications by hand, a tedious process where I would reply all the steps in order to verify that everything is working as expected. If something got broken, I would fix it and then start the tedious process again.

This was painful, and exhausting, that loop trapped me for months. I thought that someone else would have found a way to get this done without that much effort. Then I started reading about testing techniques, leading to best practices, disciplines....a hole world of professionalism and engineering is out there, you just have to seek it.

The concept that fit for my problems was TDD, it applied for the situations I experienced and its scope is what I was looking for, the cycle looks like this:



with automated tests and frameworks, and the most important....you know that you are done when you can't think on more tests to write!!!

I strongly suggest you to give it a try, it's a discipline that will make you a better, more responsible developer, and also will provide you a way of building targeted products in a safe way.

April 15, 2012

When you don't need a framework

I've been developing applications for a short time, from small to medium size codebases with many different features, requirements and environments. For all these applications I've always found the issue about the frameworks, sometimes this discussion takes days, or even weeks if the people involved is very passionate about Rails, Hibernate, JSF, CDI, and some others.

Mostly the discussions tend to be related to the benefits a framework can give us: speed, conventions, less coding, design improvements, being cool....

And for some projects the right frameworks have been a blessing, improving the developer experience and reducing development effort. But that's not always the case, because sometimes the frameworks can lead you to think that 'their' way to do it is the 'right' way.

'Their' way to do it can be 'right' for their intentions, but your application is not meant to be based on their intentions, but your customer ones. A framework should not define how your application is structured, how your business logic is wired, and not even how your tests are written.

I've always struggled with testing on a framework, because most of the times the requirements for its setup are so large, that makes you feel sick. And it's even worse if you are tied to certain technology because your customer has bought the 'sweetest' license in the market.

But well, here's my summary about frameworks:

Advantages

  • Speed, not always, but a lot of frameworks are performance-oriented.
  • Support, if it's open source, you will have a lot of it.
  • DRY, yeah, you don't reinvent the wheel.
  • Convention over configuration, very powerful, and saves lots of efforts.

Disadvantages

  • With bad design decisions, you can marry your code with a framework, and that marriage is an ugly one
  • Performance, as said, not all frameworks are performance-oriented.
  • Test difficulty, you mean that I have to setup the entire framework stack in order to test a single operation?

When to use them

  •  It's rare to find a reason not to use a framework, I would say that the question is not 'when to use a framework?', but 'how my application should be designed in order to be framework-agnostic?'.

When not to use them, or at least think twice before using them

  • When its usage doesn't give you any advantages
  • When you have a 'contractual' boundary with it
  • When your team dislikes it
  • When your tests take more than 10 seconds to setup its environment
  • When the framework itself is untestable
Based on: Architecture, the lost years - Robert C. Martin

April 10, 2012

SE books you must read: Agile Principles, Patterns, and Practices in C#

As a disclaimer, I'm a Java developer, but this book can't be left aside. If you are a follower of the Clean Code movement this is the right book for you. Perhaps the most 'engineer-oriented' book written by Robert C. Martin and Micah Martin.

It covers several concepts about agile development, design patterns, programming, anti-patterns and some code katas to have fun with.


[ Agile Principles, Patterns, and Practices in C# ]

April 3, 2012

Binary tree implementation on Ruby

I was having fun comparing the code I did in my early programming attempts in Java, and thought about how much would it take to rewrite it now, but in Ruby.



As an initial attempt, I took the widely known Binary tree, I started with the test cases and then implemented the code for them, here's the result.


I can say that it took at least ~50% less effort compared to the Java implementation, and it looks good :-)

January 31, 2012

Exercise: Sieve of Eratosthenes

After reading an interesting blog post from Robert Martin I started writing this nice algorithm in Ruby (I'm still learning it).

As I'm a refactoring freak, here's the first version:

Nasty right? Then the cleaned up release:

January 19, 2012

Semantics and programming

After using the Play framework for a while, and reading several good articles, I started using some of the concepts that have been around the cloud for some time.

One of them took my attention, the one claiming:
"Never use strings in Java"

Initially I found this really stupid, how can you program without strings?

But after applying the concept for some months, it has showed me how wrong I was. Once you start coding with Objects, you are giving your operations a semantic meaning. This means that you can say by checking an operation identifier what it really does.

It also simplifies the API definition, because the object talk by themselves. You will not be able to pass a null string as a parameter, instead you will create a class wrapping it, then the wrapper class is in charge of checking if the data you are using is valid.

As I'm still digging into it, more posts will be written about the topic. Just as a suggestion, please take a look at it.

Resources:

November 13, 2011

Object Calisthenics

Yet again I come here to share something learned from very smart people. Initially when I saw these rules my head exploded. Even though they are reasonable rules, they break the traditional non-object-oriented I've been doing for a while.



  1. One level of indentation per method
  2. No else keyword
  3. Wrap all primitives and strings
  4. Use only one dot per line
  5. Don’t abbreviate names but keep them short
  6. Keep all entities small
  7. No more than two instance variables per class
  8. Use first-class collections
  9. Don’t use any getters/setters or properties
I'm still trying to wrap a prototype project around them, and the partial results are astonishing.

Sources